diff --git a/accelerators/gateway-kubernetes-discovery/Dockerfile b/accelerators/gateway-kubernetes-discovery/Dockerfile new file mode 100644 index 00000000000..f0f10ac4e34 --- /dev/null +++ b/accelerators/gateway-kubernetes-discovery/Dockerfile @@ -0,0 +1,31 @@ + +FROM golang:1.13-alpine as build + +ENV GO111MODULE=on +ENV GOCACHE=/tmp + +ARG WORK_DIR +WORKDIR /app + +COPY ${WORK_DIR}/go.mod . +COPY ${WORK_DIR}/go.sum . + +RUN go mod download + +COPY . . + +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build + + +# Create runtime image +FROM alpine:3 + +WORKDIR /opt/egov + +RUN addgroup -S egov && adduser -S -G egov egov +COPY --chown=egov:egov --from=build /app/zuul-kubernetes-discovery /opt/egov/ + +RUN chmod +x /opt/egov/zuul-kubernetes-discovery + +CMD ["/opt/egov/zuul-kubernetes-discovery"] +# USER egov diff --git a/accelerators/gateway-kubernetes-discovery/LICENSE b/accelerators/gateway-kubernetes-discovery/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/accelerators/gateway-kubernetes-discovery/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/accelerators/gateway-kubernetes-discovery/go.mod b/accelerators/gateway-kubernetes-discovery/go.mod new file mode 100644 index 00000000000..dce635764a6 --- /dev/null +++ b/accelerators/gateway-kubernetes-discovery/go.mod @@ -0,0 +1,9 @@ +module github.com/egovernments/utilities/zuul-kubernetes-discovery + +go 1.13 + +require ( + k8s.io/api v0.17.0 + k8s.io/apimachinery v0.17.0 + k8s.io/client-go v0.17.0 +) diff --git a/accelerators/gateway-kubernetes-discovery/go.sum b/accelerators/gateway-kubernetes-discovery/go.sum new file mode 100644 index 00000000000..ec8a043e010 --- /dev/null +++ b/accelerators/gateway-kubernetes-discovery/go.sum @@ -0,0 +1,183 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= +github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= +github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= +github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= +github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= +github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I= +github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k= +github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/imdario/mergo v0.3.5 h1:JboBksRwiiAJWvIYJVo46AfV+IAIKZpfrSzVKj42R4Q= +github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 h1:rjwSpXsdiK0dV8/Naq3kAw9ymfAeJIyd0upUIElB+lI= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456 h1:ng0gs1AKnRRuEMZoTLLlbOd+C17zUDepwGQBb/n+JVg= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +k8s.io/api v0.17.0 h1:H9d/lw+VkZKEVIUc8F3wgiQ+FUXTTr21M87jXLU7yqM= +k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI= +k8s.io/apimachinery v0.17.0 h1:xRBnuie9rXcPxUkDizUsGvPf1cnlZCFu210op7J7LJo= +k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= +k8s.io/client-go v0.17.0 h1:8QOGvUGdqDMFrm9sD6IUFl256BcffynGoe80sxgTEDg= +k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= +k8s.io/client-go v11.0.0+incompatible h1:LBbX2+lOwY9flffWlJM7f1Ct8V2SRNiMRDFeiwnJo9o= +k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= +k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= +k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= +k8s.io/utils v0.0.0-20191114184206-e782cd3c129f h1:GiPwtSzdP43eI1hpPCbROQCCIgCuiMMNF8YUVLF3vJo= +k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= +sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= +sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/accelerators/gateway-kubernetes-discovery/main.go b/accelerators/gateway-kubernetes-discovery/main.go new file mode 100644 index 00000000000..74fa95bb6c0 --- /dev/null +++ b/accelerators/gateway-kubernetes-discovery/main.go @@ -0,0 +1,161 @@ +/* +Copyright © 2019 NAME HERE + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package main + +import ( + "fmt" + "log" + "os" + "text/template" + "strings" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + + "k8s.io/client-go/rest" +) + +// Route comprising of attributes to build a zuul route object +type Route struct { + Path string // Annotation value of zuul/route-path pointing to the context to be filtered + ServiceURL string // Service URL to be redirected to + RateLimiter bool + KeyResolver string + ReplenishRate string + BurstCapacity string +} + +const gatewayKeyResolver = "gateway-keyResolver" +const gatewayReplenishRate = "gateway-replenishRate" +const gatewayBurstCapacity = "gateway-burstCapacity" +const sAnnotation string = "zuul/route-path" +const routesTemplate string = +`{{- range $index, $route := . }} +spring.cloud.gateway.routes[{{ $index }}].id={{ $route.Path }} +spring.cloud.gateway.routes[{{ $index }}].uri={{ $route.ServiceURL }} +spring.cloud.gateway.routes[{{ $index }}].predicates[0]=Path=/{{ $route.Path }}/** +{{ if $route.RateLimiter }}spring.cloud.gateway.routes[{{ $index }}].filters[0].name=RequestRateLimiter +{{ if ne $route.KeyResolver "" }}spring.cloud.gateway.routes[{{ $index }}].filters[0].args.redis-rate-limiter.keyResolver="#{{ "{" }}{{ $route.KeyResolver }}{{ "}" }}"{{ end }} +{{ if ne $route.ReplenishRate "" }}spring.cloud.gateway.routes[{{ $index }}].filters[0].args.redis-rate-limiter.replenishRate={{ $route.ReplenishRate }}{{ end }} +{{ if ne $route.BurstCapacity "" }}spring.cloud.gateway.routes[{{ $index }}].filters[0].args.redis-rate-limiter.burstCapacity={{ $route.BurstCapacity }}{{ end }} +{{ end }}{{ end }}` + +func getKubeConnection() (clientset *kubernetes.Clientset) { + + config, err := rest.InClusterConfig() + if err != nil { + panic(err) + } + clientset, err = kubernetes.NewForConfig(config) + if err != nil { + panic(err) + } + + return clientset +} + +func listAllServices(clientset *kubernetes.Clientset, namespace string) (s *v1.ServiceList) { + sc := clientset.CoreV1().Services(namespace) + + s, err := sc.List(metav1.ListOptions{}) + if err != nil { + panic(err) + } + + return s +} + +func getRoutes(s *v1.ServiceList) (r *[]Route) { + routes := []Route{} + for _, s := range s.Items { + + if s.Annotations != nil { + if val, ok := s.Annotations[sAnnotation]; ok { + path := fmt.Sprintf("%s", val) + url := fmt.Sprintf("http://%s.%s:%d/", s.Name, s.Namespace, s.Spec.Ports[0].Port) + // Initialize variables for rate limiter annotations + rateLimiter := false + keyResolver := "" + replenishRate := "" + burstCapacity := "" + if val, ok := s.Annotations[gatewayKeyResolver]; ok { + rateLimiter = true + keyResolver = val + } + if val, ok := s.Annotations[gatewayReplenishRate]; ok { + rateLimiter = true + replenishRate = val + } + if val, ok := s.Annotations[gatewayBurstCapacity]; ok { + rateLimiter = true + burstCapacity = val + } + + routes = append(routes, Route{path, url, rateLimiter, keyResolver, replenishRate, burstCapacity}) + log.Printf("Configuring service %s routing to service URL %s \n", path, url) + } + } + } + + return &routes + +} + +func writeTemplate(r *[]Route) { + path, _ := os.LookupEnv("OUTPUT_FILE_PATH") + f, err := os.Create(path) + if err != nil { + panic(err) + } + + tmpl, err := template.New("test").Parse(routesTemplate) + if err != nil { + panic(err) + } + + err = tmpl.Execute(f, *r) + if err != nil { + panic(err) + } + + f.Close() +} + +// Get all kubernetes services in the cluster using config serviceaccount +// Filter services with annotation "zuul/route-path" +// Build zuul routing configuration using configured template file +// Write file to "OUTPUT_FILE_PATH" path +func main() { + if _, ok := os.LookupEnv("OUTPUT_FILE_PATH"); !ok { + log.Panicln("OUTPUT_FILE_PATH environment variable not set! Exiting!") + } + n, ok := os.LookupEnv("NAMESPACE") + if !ok { + log.Println("NAMESPACE environment vairable not set, defaulting to cluster wide") + } + + clientset := getKubeConnection() + + namespaces := strings.Split(n, ",") + routes := []Route{} + for _, namespace := range namespaces { + s := listAllServices(clientset, namespace) + r := getRoutes(s) + routes = append(routes, *r...) + } + writeTemplate(&routes) +} diff --git a/accelerators/inbox/CHANGELOG.md b/accelerators/inbox/CHANGELOG.md deleted file mode 100644 index 9d28a250345..00000000000 --- a/accelerators/inbox/CHANGELOG.md +++ /dev/null @@ -1,26 +0,0 @@ - -# Changelog -All notable changes to this module will be documented in this file. - -## 1.3.1 - 2023-08-11 -- Central Instance Library Integration - -## 1.3.0 - 2023-03-15 - -- Introduced event based inbox as part of v2 search API which does not depend on searcher service for fetching inbox items. - -## 1.2.0 - 2022-08-18 - -- Support Inbox for WnS service - -## 1.1.0 - 2022-01-13 - -- Updated to log4j2 version 2.17.1 - -## 1.1.0 - -- Support new Inbox for for OBPS service, stakeholder registration service, and NOC service - -## 1.0.0 - -- base version \ No newline at end of file diff --git a/accelerators/inbox/LOCALSETUP.md b/accelerators/inbox/LOCALSETUP.md deleted file mode 100644 index 358c88ce78a..00000000000 --- a/accelerators/inbox/LOCALSETUP.md +++ /dev/null @@ -1,31 +0,0 @@ -# Local Setup - -To setup the inbox in your local system, clone the [Muncipal Service repository](https://github.com/egovernments/municipal-services). - -## Dependencies - -### Infra Dependency - -- [X] Postgres DB -- [ ] Redis -- [ ] Kafka - - [ ] Consumer - - [ ] Producer - -## Running Locally - -To run the inbox localy, you need to port forward below services locally - -```bash -egov-workflow-v2 -user-service -egov-searcher -Municipal service for which inbox config is defined -``` - -To run the inbox locally, update below listed properties in `application.properties` prior to running the project: - -```ini -service.search.mapping= -``` - diff --git a/accelerators/inbox/README.md b/accelerators/inbox/README.md deleted file mode 100644 index 9a3d5a35c3c..00000000000 --- a/accelerators/inbox/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# inbox - -The inbox service is a aggregation service which aggregates data of municipal services and workflow based on given complex search criteria -and returns applications and workflow data in paginated manner. The service also returns the total count matching the search criteria. - - - -### Service Dependencies - - -- workflow-v2 -- user-service -- egov-searcher -- The Municipal service for which inbox configuration is added - - -### Swagger API Contract - -Link to the swagger API contract [yaml](https://raw.githubusercontent.com/egovernments/municipal-services/master/docs/inbox.yml) and editor link like below - - -### Postman Collection -Link to the postman collection [here](https://www.getpostman.com/collections/5e9f36ddf4b34460287e) - - -## Service Details - -The service aggregates data from workflow and configured municipal services, to provide data required for displaying on inbox screen - - -### API Details - - -`_search` : This API is used to search inbox application data based on the criteria provided - - - -### Reference Document -TBD - - - diff --git a/accelerators/inbox/pom.xml b/accelerators/inbox/pom.xml deleted file mode 100644 index e8562ce2fc1..00000000000 --- a/accelerators/inbox/pom.xml +++ /dev/null @@ -1,251 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - - org.egov - inbox - 1.3.1-SNAPSHOT - inbox-services - inbox services - - - 2.17.1 - 1.8 - ${java.version} - ${java.version} - 1.18.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - - org.springframework.boot - spring-boot-starter-jdbc - - - - org.apache.commons - commons-collections4 - 4.4 - - - - com.google.code.gson - gson - - - org.cache2k - cache2k-spring - 1.2.0.Final - compile - - - org.hibernate - hibernate-validator - 6.0.16.Final - - - org.springframework.boot - spring-boot-starter-tomcat - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - org.springframework.boot - spring-boot-starter-validation - - - org.elasticsearch.client - elasticsearch-rest-high-level-client - 6.5.4 - - - org.elasticsearch - elasticsearch - 6.5.4 - - - - io.swagger - swagger-core - 1.5.18 - - - - - org.projectlombok - lombok - provided - - - com.cedarsoftware - java-util - 1.63.0 - - - com.github.joschi.jackson - jackson-datatype-threetenbp - 2.6.4 - - - org.javers - javers-core - 3.1.0 - - - org.egov.services - tracer - 2.1.2-SNAPSHOT - - - org.egov.services - services-common - 1.1.1-SNAPSHOT - - - org.projectlombok - lombok - true - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - javax.validation - validation-api - - - org.postgresql - postgresql - 42.2.2.jre7 - - - org.egov - mdms-client - 0.0.2-SNAPSHOT - compile - - - com.github.wnameless.json - json-flattener - 0.12.0 - - - - org.flywaydb - flyway-core - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.35.1025 - - - org.egov - enc-client - 2.0.4-SNAPSHOT - - - org.springframework.kafka - spring-kafka - - - org.apache.kafka - kafka-clients - - - - - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/releases/ - - - repo.egovernments.org.snapshots - eGov ERP Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org.public - eGov Public Repository Group - https://nexus-repo.digit.org/nexus/content/groups/public/ - - - - src/main/java - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - - - diff --git a/accelerators/inbox/src/main/java/org/egov/InboxApplication.java b/accelerators/inbox/src/main/java/org/egov/InboxApplication.java deleted file mode 100644 index cd5bb99b50e..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/InboxApplication.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov; - -import org.cache2k.extra.spring.SpringCache2kCacheManager; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.encryption.config.EncryptionConfiguration; -import org.egov.tracer.config.TracerConfiguration; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cache.CacheManager; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.Profile; - -import java.util.concurrent.TimeUnit; - -@SpringBootApplication -@EnableAutoConfiguration -@EnableCaching -@Import({ TracerConfiguration.class, MultiStateInstanceUtil.class, EncryptionConfiguration.class }) -public class InboxApplication { - - public static void main(String[] args) { - SpringApplication.run(InboxApplication.class, args); - } - - @Value("${cache.expiry.minutes}") - private int cacheExpiry; - - @Bean - @Profile("!test") - public CacheManager cacheManager(){ - return new SpringCache2kCacheManager().addCaches(b->b.name("businessServices").expireAfterWrite(cacheExpiry, TimeUnit.MINUTES) - .entryCapacity(10)).addCaches(b->b.name("inboxConfiguration").expireAfterWrite(cacheExpiry, TimeUnit.MINUTES) - .entryCapacity(10)); - } - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/config/InboxConfiguration.java b/accelerators/inbox/src/main/java/org/egov/inbox/config/InboxConfiguration.java deleted file mode 100644 index 4c5679aa899..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/config/InboxConfiguration.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.egov.inbox.config; - -import java.util.List; -import java.util.Map; -import java.util.TimeZone; - -import javax.annotation.PostConstruct; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@Component -public class InboxConfiguration { - - @Value("${app.timezone}") - private String timeZone; - - @PostConstruct - public void initialize() { - TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); - } - - @Value("${workflow.host}") - private String workflowHost; - - @Value("${workflow.process.search.path}") - private String processSearchPath; - - @Value("${workflow.businessservice.search.path}") - private String businessServiceSearchPath; - - @Value("#{${service.search.mapping}}") - private Map> serviceSearchMapping; - - @Value("${workflow.process.count.path}") - private String processCountPath; - - @Value("${workflow.process.nearing.sla.count.path}") - private String nearingSlaProcessCountPath; - - @Value("${workflow.process.statuscount.path}") - private String processStatusCountPath; - - @Value("${egov.searcher.host}") - private String searcherHost; - - @Value("${egov.searcher.fsm.dsoid.path}") - private String fsmInboxDSoIDEndpoint; - - @Value("${egov.vehicle.host}") - private String vehicleHost; - - @Value("${vehicle.search.path}") - private String vehicleSearchPath; - - @Value("${vehicle.fetchApplicationStatusCount.path}") - private String vehicleApplicationStatusCountPath; - - @Value("${vehicle.searchTrip.path}") - private String vehicleSearchTripPath; - - @Value("${egov.fsm.host}") - private String fsmHost; - - @Value("${egov.fsm.fetchApplicationIds.path}") - private String fetchApplicationIds; - - @Value("#{${bs.businesscode.service.search}}") - private Map> bsServiceSearchMapping; - - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsSearchEndPoint; - - @Value("${egov.es.username}") - private String esUserName; - - @Value("${egov.es.password}") - private String esPassword; - - @Value("${services.esindexer.host}") - private String indexServiceHost; - - @Value("${egov.services.esindexer.host.search}") - private String indexServiceHostSearchEndpoint; - - @Value("${egov.user.host}") - private String userHost; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.user.create.path}") - private String userCreateEndpoint; - - @Value("${egov.internal.microservice.user.uuid}") - private String egovInternalMicroserviceUserUuid; - - @Value("${parent.level.tenant.id}") - private String parentLevelTenantId; - - // ES Config - - @Value("${water.es.index}") - private String esWSIndex; - - @Value("${sewerage.es.index}") - private String esSWIndex; - - // Inbox service Config - - @Value("${inbox.water.search.allowed}") - private Boolean isInboxSearchAllowed; - - @Value("${es.search.pagination.default.limit}") - private Long defaultLimit; - - @Value("${es.search.pagination.default.offset}") - private Long defaultOffset; - - @Value("${es.search.pagination.max.search.limit}") - private Long maxSearchLimit; - - @Value("${state.level.tenant.id}") - private String stateLevelTenantId; - - @Value("${es.search.default.sort.order}") - private String defaultSortOrder; -} \ No newline at end of file diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/AuditDetails.java b/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/AuditDetails.java deleted file mode 100644 index 8fb658e4e4a..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/AuditDetails.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.inbox.model.vehicle; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class AuditDetails { - - @JsonProperty("createdBy") - private String createdBy = null; - - @JsonProperty("lastModifiedBy") - private String lastModifiedBy = null; - - @JsonProperty("createdTime") - private Long createdTime = null; - - @JsonProperty("lastModifiedTime") - private Long lastModifiedTime = null; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/User.java b/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/User.java deleted file mode 100644 index 34a7175a11d..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/User.java +++ /dev/null @@ -1,205 +0,0 @@ -package org.egov.inbox.model.vehicle; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import javax.validation.Valid; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; - -import org.egov.common.contract.request.Role; -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Validated -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class User { - - @JsonProperty("id") - private Long id; - - @Size(max=64) - @SafeHtml - @JsonProperty("uuid") - private String uuid; - - @Size(max=64) - @SafeHtml - @JsonProperty("userName") - private String userName; - - - @Size(min=1,max=64) - @SafeHtml - @Pattern(regexp = "^[a-zA-Z \\-'`\\.]*$", message = "Invalid name. Only alphabets and special characters -, ',`, .") - @JsonProperty("name") - private String name; - - @Size(max=64) - @SafeHtml - @JsonProperty("password") - private String password; - - @Size(max=64) - @SafeHtml - @JsonProperty("mobileNumber") - private String mobileNumber; - - @Size(max=64) - @SafeHtml - @JsonProperty("tenantId") - private String tenantId; - - @SafeHtml - @JsonProperty("salutation") - private String salutation; - - @Size(max=128) - @SafeHtml - @JsonProperty("emailId") - private String emailId; - - @Size(max=50) - @SafeHtml - @JsonProperty("altContactNumber") - private String altContactNumber; - - @Size(max=10) - @SafeHtml - @JsonProperty("pan") - private String pan; - - @Pattern(regexp = "^[0-9]{12}$", message = "AdharNumber should be 12 digit number") - @SafeHtml - @JsonProperty("aadhaarNumber") - private String aadhaarNumber; - - @Size(max=300) - @SafeHtml - @JsonProperty("permanentAddress") - private String permanentAddress; - - @Size(max=300) - @SafeHtml - @JsonProperty("permanentCity") - private String permanentCity; - - @Size(max=10) - @SafeHtml - @JsonProperty("permanentPinCode") - private String permanentPincode; - - @Size(max=300) - @SafeHtml - @JsonProperty("correspondenceCity") - private String correspondenceCity; - - @Size(max=10) - @SafeHtml - @JsonProperty("correspondencePinCode") - private String correspondencePincode; - - @JsonProperty("active") - private Boolean active; - - @JsonProperty("dob") - private Long dob; - - @JsonProperty("pwdExpiryDate") - private Long pwdExpiryDate; - - @Size(max=16) - @SafeHtml - @JsonProperty("locale") - private String locale; - - @Size(max=50) - @SafeHtml - @JsonProperty("type") - private String type; - - @SafeHtml - @JsonProperty("signature") - private String signature; - - @JsonProperty("accountLocked") - private Boolean accountLocked; - - @JsonProperty("roles") - @Valid - private List roles; - - @Size(max=32) - @SafeHtml - @JsonProperty("bloodGroup") - private String bloodGroup; - - @SafeHtml - @JsonProperty("identificationMark") - private String identificationMark; - - @SafeHtml - @JsonProperty("photo") - private String photo; - - @Size(max=64) - @SafeHtml - @JsonProperty("createdBy") - private String createdBy; - - @JsonProperty("createdDate") - private Long createdDate; - - @Size(max=64) - @SafeHtml - @JsonProperty("lastModifiedBy") - private String lastModifiedBy; - - @JsonProperty("lastModifiedDate") - private Long lastModifiedDate; - - @SafeHtml - @JsonProperty("otpReference") - private String otpReference; - - @SafeHtml - @JsonProperty("gender") - private String gender; - - public User addRolesItem(Role rolesItem) { - if (this.roles == null) { - this.roles = new ArrayList<>(); - } - this.roles.add(rolesItem); - return this; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - User user = (User) o; - return Objects.equals(emailId, user.emailId); -// Objects.equals(dob, user.dob) && //Epoch format not converting properly from UI - - } - - @Override - public int hashCode() { - - return Objects.hash(uuid); - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleSearchCriteria.java b/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleSearchCriteria.java deleted file mode 100644 index 9d7d9f7301f..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleSearchCriteria.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.egov.inbox.model.vehicle; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class VehicleSearchCriteria { - @JsonProperty("offset") - private Integer offset; - - @JsonProperty("limit") - private Integer limit; - - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("businessService") - private String businessService; - - @JsonProperty("ids") - private List ids; - - @JsonProperty("mobileNumber") - private String mobileNumber; - - @JsonProperty("vehicleIds") - private List vehicleIds; - - @JsonProperty("tripOwnerIds") - private List tripOwnerIds; - - @JsonProperty("driverIds") - private List driverIds; - - @JsonProperty("applicationStatus") - private List applicationStatus; - - @JsonProperty("refernceNos") - private List refernceNos; - - @JsonProperty("applicationNos") - private List applicationNos; - - @JsonProperty("sortBy") - private SortBy sortBy; - - @JsonProperty("sortOrder") - private SortOrder sortOrder; - - public enum SortOrder { - ASC, - DESC - } - - public enum SortBy { - applicationStatus, - applicationiNo, - vehicle, - referenceNo, - createdTime, - tripStartTime, - tripEndTime - } - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleTripDetail.java b/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleTripDetail.java deleted file mode 100644 index 6b8df6bc154..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleTripDetail.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.egov.inbox.model.vehicle; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Request schema of VehicleLog. - */ -@Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-12-23T12:08:13.326Z[GMT]") - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter - -public class VehicleTripDetail { - - - @JsonProperty("id") - private String id = null; - - @NotNull - @NotBlank - @JsonProperty("tenantId") - private String tenantId = null; - - @NotNull - @NotBlank - @JsonProperty("referenceNo") - private String referenceNo = null; - - @NotBlank - @NotNull - @JsonProperty("referenceStatus") - private String referenceStatus = null; - - - @JsonProperty("additionalDetails") - private Object additionalDetails = null; - - /** - * Gets or Sets status - */ - public enum StatusEnum { - ACTIVE("ACTIVE"), - - INACTIVE("INACTIVE"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - @JsonProperty("status") - private StatusEnum status = null; - - @JsonProperty("itemStartTime") - private Long itemStartTime = null; - - @JsonProperty("itemEndTime") - private Long itemEndTime = null; - - @JsonProperty("volume") - private Double volume = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - - @JsonProperty("trip_id") - private String trip_id = null; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleTripDetailResponse.java b/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleTripDetailResponse.java deleted file mode 100644 index 0bab1519377..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleTripDetailResponse.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.egov.inbox.model.vehicle; - -import java.util.List; - -import javax.validation.Valid; - -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Response of Vendor detail - */ -//@Schema(description = "Response of Vehicle Trip Detail") -@Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-02-14T05:34:12.238Z[GMT]") -@AllArgsConstructor -@NoArgsConstructor -@Builder -@Getter -@Setter -public class VehicleTripDetailResponse { - - @JsonProperty("responseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("vehicleTripDetail") - @Valid - private List vehicleTripDetail = null; - - @JsonProperty("totalCount") - private Integer totalCount = null; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleTripSearchCriteria.java b/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleTripSearchCriteria.java deleted file mode 100644 index b5cba137fe1..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/model/vehicle/VehicleTripSearchCriteria.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.egov.inbox.model.vehicle; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class VehicleTripSearchCriteria { - @JsonProperty("offset") - private Integer offset; - - @JsonProperty("limit") - private Integer limit; - - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("businessService") - private String businessService; - - @JsonProperty("ids") - private List ids; - - @JsonProperty("vehicleIds") - private List vehicleIds; - - @JsonProperty("tripOwnerIds") - private List tripOwnerIds; - - @JsonProperty("driverIds") - private List driverIds; - - @JsonProperty("applicationStatus") - private List applicationStatus; - - @JsonProperty("refernceNos") - private List refernceNos; - - @JsonProperty("applicationNos") - private List applicationNos; - - @JsonProperty("sortBy") - private SortBy sortBy; - - @JsonProperty("sortOrder") - private SortOrder sortOrder; - - public enum SortOrder { - ASC, - DESC - } - - public enum SortBy { - applicationStatus, - applicationiNo, - vehicle, - referenceNo, - createdTime, - tripStartTime, - tripEndTime - } - - public boolean isEmpty() { - // TODO Auto-generated method stub - return (this.tenantId == null && this.offset == null && this.limit == null - && CollectionUtils.isEmpty(this.applicationStatus) && StringUtils.isEmpty(businessService) && - CollectionUtils.isEmpty(this.vehicleIds) && - CollectionUtils.isEmpty(this.tripOwnerIds) && CollectionUtils.isEmpty(this.ids) && CollectionUtils.isEmpty(this.driverIds) - && CollectionUtils.isEmpty(this.applicationNos) && CollectionUtils.isEmpty(this.applicationNos)); - } - - public boolean tenantIdOnly() { - // TODO Auto-generated method stub - return (this.tenantId != null && this.offset == null && this.limit == null - && CollectionUtils.isEmpty(this.applicationStatus) && StringUtils.isEmpty(businessService) && - CollectionUtils.isEmpty(this.vehicleIds) && - CollectionUtils.isEmpty(this.tripOwnerIds) && CollectionUtils.isEmpty(this.ids) && CollectionUtils.isEmpty(this.driverIds) - && CollectionUtils.isEmpty(this.applicationNos) && CollectionUtils.isEmpty(this.applicationNos)); - } - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/repository/ElasticSearchQueryBuilder.java b/accelerators/inbox/src/main/java/org/egov/inbox/repository/ElasticSearchQueryBuilder.java deleted file mode 100644 index df89cf940f3..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/repository/ElasticSearchQueryBuilder.java +++ /dev/null @@ -1,368 +0,0 @@ -package org.egov.inbox.repository; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.inbox.config.InboxConfiguration; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import lombok.extern.slf4j.Slf4j; - -import org.egov.encryption.EncryptionService; -import org.springframework.util.StringUtils; - -@Component -@Slf4j -public class ElasticSearchQueryBuilder { - - - private ObjectMapper mapper; - - private InboxConfiguration config; - - private EncryptionService encryptionService; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - public ElasticSearchQueryBuilder(ObjectMapper mapper, InboxConfiguration config, EncryptionService encryptionService) { - this.mapper = mapper; - this.config = config; - this.encryptionService = encryptionService; - } - - - private static final String BASE_QUERY = "{\n" + - " \"from\": {{OFFSET}},\n" + - " \"size\": {{LIMIT}},\n" + - " \"sort\": {\n" + - " \"{{SORT_BY}}\": {\n" + - " \"order\": \"{{SORT_ORDER}}\"\n" + - " }\n" + - " },\n" + - " \"query\": {\n" + - " }\n" + - "}"; - - private static final String wildCardQueryTemplate = "{\n" + - " \"query_string\": {\n" + - " \"default_field\": \"{{VAR}}\",\n" + - " \"query\": \"*{{PARAM}}*\"\n" + - " }\n" + - " }"; - private static final String mustClause = "{\n" + - " \"terms\": { \"{{VAR}}\" : \n" + - " [ \"{{PARAM}}\"]\n" + - " }\n" + - " }"; - - private static final String filterTemplate = "\"filter\": { " + - " \"bool\":{} \n" + - " }"; - - private static final String existsClause = "{\n" + - " \"field\": \"{{VAR}}\" \n" + - " }"; - - private static final String shouldClause1 = "{\n" + - " \"bool\": { \n" + - " \"{{MUST_CLAUSE}}\" : [ \n" + - " { \n " + - " \"exists\": \n " + - existsClause + " \n" + - " },\n" + - mustClause + - " ]\n" + - " }\n" + - " }"; - private static final String shouldClause2 = "{\n" + - " \"bool\": { \n" + - " \"{{MUSTNOT_CLAUSE}}\" : [ \n" + - " { \n " + - " \"exists\": \n " + - existsClause + " \n" + - " }\n],\n" + - " \"{{MUST_CLAUSE}}\" : [ \n" + - "{\n" + - " \"terms\": { \"{{VAR2}}\" : \n" + - " [ \"{{PARAM}}\"]\n" + - " }\n" + - " }" + - " ]\n" + - " }\n" + - " }"; - - - /** - * Builds a elasticsearch search query based on the search criteria - * - * @param criteria - * @return - */ - public String getSearchQuery(InboxSearchCriteria criteria, List ids) { - - String finalQuery; - - try { - String baseQuery = addPagination(criteria); - baseQuery = baseQuery.replace("{{SORT_BY}}", "Data." + criteria.getModuleSearchCriteria().get("sortBy").toString()); - baseQuery = baseQuery.replace("{{SORT_ORDER}}", criteria.getModuleSearchCriteria().get("sortOrder").toString()); - JsonNode node = mapper.readTree(baseQuery); - ObjectNode insideMatch = (ObjectNode) node.get("query"); - List clauses = new LinkedList<>(); - List mobileClause = new LinkedList<>(); - //encrypting criteria for mobileNumber - try { - if (criteria == null) { - return null; - } - criteria.setModuleSearchCriteria(encryptionService.encryptJson(criteria.getModuleSearchCriteria(), "InboxWnS",centralInstanceUtil.getStateLevelTenant(criteria.getTenantId()), HashMap.class)); - if (criteria == null) { - throw new CustomException("ENCRYPTION_NULL_ERROR", "Null object found on performing encryption"); - } - - } catch (Exception e) { - log.error("Error occurred while encrypting W&S search criteria", e); - throw new CustomException("WnS_CRITERIA_ENCRYPTION_ERROR", "Unknown error occurred in encryption process"); - } - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - //Adding "must" terms for the search parameters in criteria - if (!StringUtils.isEmpty(moduleSearchCriteria.get("mobileNumber"))) { - mobileClause.add(getInnerNodeForMobileNumber(moduleSearchCriteria.get("mobileNumber").toString(), "Data.connectionHolders.mobileNumber.keyword", "Data.ownerMobileNumbers.keyword")); - } - if (!StringUtils.isEmpty(moduleSearchCriteria.get("locality"))) { - clauses.add(getInnerNode(moduleSearchCriteria.get("locality").toString(), "Data.additionalDetails.locality.keyword")); - } - if (!StringUtils.isEmpty(moduleSearchCriteria.get("applicationNumber"))) { - clauses.add(getInnerNode(moduleSearchCriteria.get("applicationNumber").toString(), "Data.applicationNo.keyword")); - } - if (!StringUtils.isEmpty(moduleSearchCriteria.get("applicationType"))) { - clauses.add(getInnerNode(moduleSearchCriteria.get("applicationType").toString(), "Data.applicationType.keyword")); - } - if (!StringUtils.isEmpty(moduleSearchCriteria.get("consumerNo"))) { - clauses.add(getInnerNode(moduleSearchCriteria.get("consumerNo").toString(), "Data.connectionNo.keyword")); - } - if (!StringUtils.isEmpty(moduleSearchCriteria.get("propertyId"))) { - clauses.add(getInnerNode(moduleSearchCriteria.get("propertyId").toString(), "Data.propertyId.keyword")); - } - if (!StringUtils.isEmpty(moduleSearchCriteria.get("applicationStatus"))) { - clauses.add(getInnerNode(moduleSearchCriteria.get("applicationStatus").toString(), "Data.applicationStatus.keyword")); - } - if (!StringUtils.isEmpty(moduleSearchCriteria.get("assignee"))) { - clauses.add(getInnerNode(moduleSearchCriteria.get("assignee").toString(), "Data.workflow.assignes.keyword")); - } - if (!StringUtils.isEmpty(moduleSearchCriteria.get("businessService"))) { - clauses.add(getInnerNode(moduleSearchCriteria.get("businessService").toString(), "Data.history.businessService.keyword")); - } - - JsonNode mustNode = mapper.convertValue(new HashMap>() {{ - put("must", clauses); - }}, JsonNode.class); - //Updating filter clause if MobileNumber search is there - if (!StringUtils.isEmpty(moduleSearchCriteria.get("mobileNumber"))) { - ObjectNode insideNode = (ObjectNode) node.get("query"); - insideNode.put("bool", mobileClause.get(0)); - mobileClause.remove(0); - ObjectNode parentNode = mapper.createObjectNode(); - parentNode.put("filter", insideNode); - //Merge all search criterias including that of mobileNumber - mustNode = merge(mustNode, (JsonNode) new ObjectMapper().readTree(parentNode.toString())); - } - - insideMatch.put("bool", mustNode); - ObjectNode boolNode = (ObjectNode) insideMatch.get("bool"); - - - if (!CollectionUtils.isEmpty(ids)) { - JsonNode jsonNode = mapper.convertValue(new HashMap>() {{ - put("Data.id.keyword", ids); - }}, JsonNode.class); - ObjectNode parentNode = mapper.createObjectNode(); - parentNode.put("terms", jsonNode); - boolNode.put("filter", parentNode); - } - - finalQuery = mapper.writeValueAsString(node); - - } catch (Exception e) { - log.error("ES_ERROR", e); - throw new CustomException("JSONNODE_ERROR", "Failed to build json query for fuzzy search"); - } - - return finalQuery; - - } - - - /** - * Creates inner query using the query template - * - * @param param - * @param var - * @return - * @throws JsonProcessingException - */ - private JsonNode getInnerNode(String param, String var) throws JsonProcessingException { - - String template; - template = mustClause; - - String innerQuery = new String(); - if (param.contains(",")) { - String[] splitted = param.split(","); - StringBuilder stringArray = new StringBuilder(); - for (int i = 0; i < splitted.length; i++) { - if (i < splitted.length - 1) { - if (i == 0) - stringArray.append("" + splitted[i].trim() + "\","); - else - stringArray.append("\"" + splitted[i].trim() + "\","); - } else { - stringArray.append("\"" + splitted[i].trim() + ""); - } - } - - param = stringArray.toString(); - innerQuery = template.replace("{{PARAM}}", param); - } else - innerQuery = template.replace("{{PARAM}}", param); - innerQuery = innerQuery.replace("{{VAR}}", var); - - - JsonNode innerNode = mapper.readTree(innerQuery); - return innerNode; - } - - /** - * Creates inner query using the query template for mobileNumber search in WnS module - * - * @param param - * @param var - * @param var2 - * @return - * @throws JsonProcessingException - */ - private JsonNode getInnerNodeForMobileNumber(String param, String var, String var2) throws JsonProcessingException { - List mobileClause = new LinkedList<>(); - String template = shouldClause1; - String template2 = shouldClause2; - String innerQuery = new String(); - String innerQuery2 = new String(); - innerQuery = template.replace("{{MUST_CLAUSE}}", "must"); - innerQuery = innerQuery.replace("{{PARAM}}", param); - innerQuery = innerQuery.replace("{{VAR}}", var); - - innerQuery2 = template2.replace("{{MUSTNOT_CLAUSE}}", "must_not"); - innerQuery2 = innerQuery2.replace("{{MUST_CLAUSE}}", "must"); - innerQuery2 = innerQuery2.replace("{{PARAM}}", param); - innerQuery2 = innerQuery2.replace("{{VAR}}", var); - innerQuery2 = innerQuery2.replace("{{VAR2}}", var2); - - JsonNode innerNode = mapper.readTree(innerQuery); - mobileClause.add(innerNode); - mobileClause.add(mapper.readTree(innerQuery2)); - JsonNode mobileClauseNode = mapper.convertValue(new HashMap>() {{ - put("should", mobileClause); - }}, JsonNode.class); - - return mobileClauseNode; - } - - /** - * Adds pagination - * - * @param criteria - * @return baseQuery with pagination - */ - private String addPagination(InboxSearchCriteria criteria) { - Long limit = config.getDefaultLimit(); - Long offset = config.getDefaultOffset(); - - if (criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) - limit = Long.valueOf(criteria.getLimit()); - - if (criteria.getLimit() != null && criteria.getLimit() > config.getMaxSearchLimit()) - limit = Long.valueOf(config.getMaxSearchLimit()); - - if (criteria.getOffset() != null) - offset = Long.valueOf(criteria.getOffset()); - - String baseQuery = BASE_QUERY.replace("{{OFFSET}}", offset.toString()); - baseQuery = baseQuery.replace("{{LIMIT}}", limit.toString()); - - return baseQuery; - } - - /** - * Escapes special characters in given string - * - * @param inputString - * @return - */ - private String getEscapedString(String inputString) { - final String[] metaCharacters = {"\\", "/", "^", "$", "{", "}", "[", "]", "(", ")", ".", "*", "+", "?", "|", "<", ">", "-", "&", "%"}; - for (int i = 0; i < metaCharacters.length; i++) { - if (inputString.contains(metaCharacters[i])) { - inputString = inputString.replace(metaCharacters[i], "\\\\" + metaCharacters[i]); - } - } - return inputString; - } - - /** - * Merges 2 JSONNodes - * - * @param mainNode - * @param updateNode - * @return JsonNode - */ - public static JsonNode merge(JsonNode mainNode, JsonNode updateNode) { - - Iterator fieldNames = updateNode.fieldNames(); - - while (fieldNames.hasNext()) { - String updatedFieldName = fieldNames.next(); - JsonNode valueToBeUpdated = mainNode.get(updatedFieldName); - JsonNode updatedValue = updateNode.get(updatedFieldName); - - // If the node is an @ArrayNode - if (valueToBeUpdated != null && valueToBeUpdated.isArray() && - updatedValue.isArray()) { - // running a loop for all elements of the updated ArrayNode - for (int i = 0; i < updatedValue.size(); i++) { - JsonNode updatedChildNode = updatedValue.get(i); - // Create a new Node in the node that should be updated, if there was no corresponding node in it - // Use-case - where the updateNode will have a new element in its Array - if (valueToBeUpdated.size() <= i) { - ((ArrayNode) valueToBeUpdated).add(updatedChildNode); - } - // getting reference for the node to be updated - JsonNode childNodeToBeUpdated = valueToBeUpdated.get(i); - merge(childNodeToBeUpdated, updatedChildNode); - } - // if the Node is an @ObjectNode - } else if (valueToBeUpdated != null && valueToBeUpdated.isObject()) { - merge(valueToBeUpdated, updatedValue); - } else { - if (mainNode instanceof ObjectNode) { - ((ObjectNode) mainNode).replace(updatedFieldName, updatedValue); - } - } - } - return mainNode; - } - -} \ No newline at end of file diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/repository/ElasticSearchRepository.java b/accelerators/inbox/src/main/java/org/egov/inbox/repository/ElasticSearchRepository.java deleted file mode 100644 index ff5ead893e2..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/repository/ElasticSearchRepository.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.egov.inbox.repository; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.inbox.config.InboxConfiguration; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; -import org.springframework.web.client.RestTemplate; - -import java.util.List; - -@Component -public class ElasticSearchRepository { - - private InboxConfiguration config; - - private ElasticSearchQueryBuilder queryBuilder; - - private RestTemplate restTemplate; - - private ObjectMapper mapper; - - @Autowired - public ElasticSearchRepository(InboxConfiguration config, ElasticSearchQueryBuilder queryBuilder, RestTemplate restTemplate, ObjectMapper mapper) { - this.config = config; - this.queryBuilder = queryBuilder; - this.restTemplate = restTemplate; - this.mapper = mapper; - } - - - /** - * Searches records from elasticsearch based on the fuzzy search criteria - * - * @param criteria - * @return - */ - public Object elasticSearchApplications(InboxSearchCriteria criteria, List uuids) { - - - String url = getESURL(criteria); - - String searchQuery = queryBuilder.getSearchQuery(criteria, uuids); - - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); - ResponseEntity response = null; - try { - response = restTemplate.postForEntity(url, requestEntity, Object.class); - - } catch (Exception e) { - e.printStackTrace(); - throw new CustomException("WNS_ES_SEARCH_ERROR", "Failed to fetch data from ES for W&S"); - } - - return response.getBody(); - - } - - - /** - * Generates elasticsearch search url from application properties - * - * @return - */ - private String getESURL(InboxSearchCriteria criteria) { - - StringBuilder builder = new StringBuilder(config.getIndexServiceHost()); - if (criteria.getProcessSearchCriteria().getModuleName().equals("ws-services")) - builder.append(config.getEsWSIndex()); - else if (criteria.getProcessSearchCriteria().getModuleName().equals("sw-services")) { - builder.append(config.getEsSWIndex()); - } - builder.append(config.getIndexServiceHostSearchEndpoint()); - - return builder.toString(); - } - -} \ No newline at end of file diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/repository/RetryTemplate.java b/accelerators/inbox/src/main/java/org/egov/inbox/repository/RetryTemplate.java deleted file mode 100644 index 6b5e514e27a..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/repository/RetryTemplate.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.inbox.repository; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.retry.annotation.Backoff; -import org.springframework.retry.annotation.Retryable; -import org.springframework.stereotype.Component; -import org.springframework.web.client.ResourceAccessException; -import org.springframework.web.client.RestTemplate; - -import javax.naming.ServiceUnavailableException; - -/** - * Wraps rest template with retry - */ -@Component -public class RetryTemplate { - - @Autowired - private RestTemplate restTemplate; - - @Retryable(value = {RuntimeException.class, ResourceAccessException.class, ServiceUnavailableException.class}, - maxAttemptsExpression = "#{${service.retry.maxAttempts}}", - backoff = @Backoff(delayExpression = "#{${service.retry.backoff.delay}}")) - public ResponseEntity postForEntity(String url, Object request) { - return restTemplate.postForEntity(url, request, Object.class); - } - - @Retryable(value = {RuntimeException.class, ResourceAccessException.class, ServiceUnavailableException.class}, - maxAttemptsExpression = "#{${service.retry.maxAttempts}}", - backoff = @Backoff(delayExpression = "#{${service.retry.backoff.delay}}")) - public ResponseEntity getForEntity(String url, HttpEntity headerEntity) { - return restTemplate.exchange(url, HttpMethod.GET, headerEntity, Object.class); - } - -} - diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/repository/ServiceRequestRepository.java b/accelerators/inbox/src/main/java/org/egov/inbox/repository/ServiceRequestRepository.java deleted file mode 100644 index 5628bd9b98a..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/repository/ServiceRequestRepository.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.egov.inbox.repository; - -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.core.JsonProcessingException; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class ServiceRequestRepository { - private ObjectMapper mapper; - - private RestTemplate restTemplate; - - @Autowired - public ServiceRequestRepository(ObjectMapper mapper, RestTemplate restTemplate) { - this.mapper = mapper; - this.restTemplate = restTemplate; - } - /** - * fetchResult form the different services based on the url and request object - * @param uri - * @param request - * @return - */ - public Object fetchResult(StringBuilder uri, Object request) { - Object response = null; - //log.debug("URI: " + uri.toString()); - try { - log.info("Request: " + mapper.writeValueAsString(request)); - response = restTemplate.postForObject(uri.toString(), request, Map.class); - } catch (HttpClientErrorException e) { - //log.error("External Service threw an Exception: ", e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - //log.error("Exception while fetching from searcher: ", e); - throw new ServiceCallException(e.getMessage()); - } - - return response; - } - - /** - * fetchResult form the different services based on the url and request object - * @param uri - * @param request - * @return - */ - public List fetchListResult(StringBuilder uri, Object request) { - List response = null; - //log.debug("URI: " + uri.toString()); - try { - //log.debug("Request: " + mapper.writeValueAsString(request)); - response = restTemplate.postForObject(uri.toString(), request, List.class); - } catch (HttpClientErrorException e) { - //log.error("External Service threw an Exception: ", e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - //log.error("Exception while fetching from searcher: ", e); - throw new ServiceCallException(e.getMessage()); - } - - return response; - } - /** - * fetchResult form the different services based on the url and request object - * @param uri - * @param request - * @return - */ - public Integer fetchIntResult(StringBuilder uri, Object request) { - Integer response = null; - //log.debug("URI: " + uri.toString()); - try { - //log.debug("Request: " + mapper.writeValueAsString(request)); - response = restTemplate.postForObject(uri.toString(), request, Integer.class); - } catch (HttpClientErrorException e) { - //log.error("External Service threw an Exception: ", e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - //log.error("Exception while fetching from searcher: ", e); - throw new ServiceCallException(e.getMessage()); - } - - return response; - } - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/repository/builder/V2/InboxQueryBuilder.java b/accelerators/inbox/src/main/java/org/egov/inbox/repository/builder/V2/InboxQueryBuilder.java deleted file mode 100644 index 1a052621d2b..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/repository/builder/V2/InboxQueryBuilder.java +++ /dev/null @@ -1,395 +0,0 @@ -package org.egov.inbox.repository.builder.V2; - -import static org.egov.inbox.util.InboxConstants.BOOL_KEY; -import static org.egov.inbox.util.InboxConstants.MUST_KEY; -import static org.egov.inbox.util.InboxConstants.ORDER_KEY; -import static org.egov.inbox.util.InboxConstants.QUERY_KEY; -import static org.egov.inbox.util.InboxConstants.SORT_BY_CONSTANT; -import static org.egov.inbox.util.InboxConstants.SORT_KEY; -import static org.egov.inbox.util.InboxConstants.SORT_ORDER_CONSTANT; -import static org.egov.inbox.util.InboxConstants.SOURCE_KEY; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.inbox.util.ErrorConstants; -import org.egov.inbox.util.MDMSUtil; -import org.egov.inbox.web.model.InboxRequest; -import org.egov.inbox.web.model.V2.InboxQueryConfiguration; -import org.egov.inbox.web.model.V2.SearchParam; -import org.egov.inbox.web.model.V2.SearchRequest; -import org.egov.inbox.web.model.V2.SortParam; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - - -@Slf4j -@Component -public class InboxQueryBuilder implements QueryBuilderInterface { - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private MDMSUtil mdmsUtil; - - - @Override - public Map getESQuery(InboxRequest inboxRequest, Boolean isPaginationRequired) { - - InboxQueryConfiguration configuration = mdmsUtil.getConfigFromMDMS(inboxRequest.getInbox().getTenantId(), inboxRequest.getInbox().getProcessSearchCriteria().getModuleName()); - Map params = inboxRequest.getInbox().getModuleSearchCriteria(); - Map baseEsQuery = getBaseESQueryBody(inboxRequest, isPaginationRequired); - - if(isPaginationRequired) { - // Adds sort clause to the inbox ES query only in case pagination is present, else not - String sortClauseFieldPath = configuration.getSortParam().getPath(); - SortParam.Order sortOrder = inboxRequest.getInbox().getModuleSearchCriteria().containsKey(SORT_ORDER_CONSTANT) ? SortParam.Order.valueOf((String) inboxRequest.getInbox().getModuleSearchCriteria().get(SORT_ORDER_CONSTANT)) : configuration.getSortParam().getOrder(); - addSortClauseToBaseQuery(baseEsQuery, sortClauseFieldPath, sortOrder); - - // Adds source filter only when requesting for inbox items. - List sourceFilterPathList = configuration.getSourceFilterPathList(); - addSourceFilterToBaseQuery(baseEsQuery, sourceFilterPathList); - } - - Map innerBoolClause = (HashMap) ((HashMap) baseEsQuery.get(QUERY_KEY)).get(BOOL_KEY); - List mustClauseList = (ArrayList) innerBoolClause.get(MUST_KEY); - - Map nameToPathMap = new HashMap<>(); - Map nameToOperator = new HashMap<>(); - - configuration.getAllowedSearchCriteria().forEach(searchParam -> { - nameToPathMap.put(searchParam.getName(), searchParam.getPath()); - nameToOperator.put(searchParam.getName(), searchParam.getOperator()); - }); - - addModuleSearchCriteriaToBaseQuery(params, nameToPathMap, nameToOperator, mustClauseList); - addProcessSearchCriteriaToBaseQuery(inboxRequest.getInbox().getProcessSearchCriteria(), nameToPathMap, nameToOperator, mustClauseList); - - innerBoolClause.put(MUST_KEY, mustClauseList); - - return baseEsQuery; - } - - public Map getESQueryForSimpleSearch(SearchRequest searchRequest, Boolean isPaginationRequired) { - - InboxQueryConfiguration configuration = mdmsUtil.getConfigFromMDMS(searchRequest.getIndexSearchCriteria().getTenantId(), searchRequest.getIndexSearchCriteria().getModuleName()); - Map params = searchRequest.getIndexSearchCriteria().getModuleSearchCriteria(); - Map baseEsQuery = getBaseESQueryBody(searchRequest, isPaginationRequired); - - if(isPaginationRequired) { - // Adds sort clause to the inbox ES query only in case pagination is present, else not - String sortClauseFieldPath = configuration.getSortParam().getPath(); - SortParam.Order sortOrder = searchRequest.getIndexSearchCriteria().getModuleSearchCriteria().containsKey(SORT_ORDER_CONSTANT) ? SortParam.Order.valueOf((String) searchRequest.getIndexSearchCriteria().getModuleSearchCriteria().get(SORT_ORDER_CONSTANT)) : configuration.getSortParam().getOrder(); - addSortClauseToBaseQuery(baseEsQuery, sortClauseFieldPath, sortOrder); - - // Adds source filter only when requesting for inbox items. - List sourceFilterPathList = configuration.getSourceFilterPathList(); - addSourceFilterToBaseQuery(baseEsQuery, sourceFilterPathList); - } - - Map innerBoolClause = (HashMap) ((HashMap) baseEsQuery.get(QUERY_KEY)).get(BOOL_KEY); - List mustClauseList = (ArrayList) innerBoolClause.get(MUST_KEY); - - Map nameToPathMap = new HashMap<>(); - Map nameToOperator = new HashMap<>(); - - configuration.getAllowedSearchCriteria().forEach(searchParam -> { - nameToPathMap.put(searchParam.getName(), searchParam.getPath()); - nameToOperator.put(searchParam.getName(), searchParam.getOperator()); - }); - - addModuleSearchCriteriaToBaseQuery(params, nameToPathMap, nameToOperator, mustClauseList); - - innerBoolClause.put(MUST_KEY, mustClauseList); - - return baseEsQuery; - } - - private void addSourceFilterToBaseQuery(Map baseEsQuery, List sourceFilterPathList) { - if(!CollectionUtils.isEmpty(sourceFilterPathList)) - baseEsQuery.put(SOURCE_KEY, sourceFilterPathList); - } - - private void addSortClauseToBaseQuery(Map baseEsQuery, String sortClauseFieldPath, SortParam.Order sortOrder) { - List sortClause = new ArrayList<>(); - Map innerSortOrderClause = new HashMap<>(); - innerSortOrderClause.put(ORDER_KEY, sortOrder); - Map outerSortClauseChild = new HashMap<>(); - outerSortClauseChild.put(sortClauseFieldPath, innerSortOrderClause); - sortClause.add(outerSortClauseChild); - baseEsQuery.put(SORT_KEY, sortClause); - } - - private void addProcessSearchCriteriaToBaseQuery(ProcessInstanceSearchCriteria processSearchCriteria, Map nameToPathMap, Map nameToOperator, List mustClauseList) { - if(!ObjectUtils.isEmpty(processSearchCriteria.getTenantId())){ - String key = "tenantId"; - Map mustClauseChild = null; - Map params = new HashMap<>(); - params.put(key, processSearchCriteria.getTenantId()); - mustClauseChild = (Map) prepareMustClauseChild(params, key, nameToPathMap, nameToOperator); - if(CollectionUtils.isEmpty(mustClauseChild)){ - log.info("Error occurred while preparing filter for must clause. Filter for key " + key + " will not be added."); - }else { - mustClauseList.add(mustClauseChild); - } - } - - if(!ObjectUtils.isEmpty(processSearchCriteria.getStatus())){ - String key = "status"; - Map mustClauseChild = null; - Map params = new HashMap<>(); - params.put(key, processSearchCriteria.getStatus()); - mustClauseChild = (Map) prepareMustClauseChild(params, key, nameToPathMap, nameToOperator); - if(CollectionUtils.isEmpty(mustClauseChild)){ - log.info("Error occurred while preparing filter for must clause. Filter for key " + key + " will not be added."); - }else { - mustClauseList.add(mustClauseChild); - } - } - - if(!ObjectUtils.isEmpty(processSearchCriteria.getAssignee())){ - String key = "assignee"; - Map mustClauseChild = null; - Map params = new HashMap<>(); - params.put(key, processSearchCriteria.getAssignee()); - mustClauseChild = (Map) prepareMustClauseChild(params, key, nameToPathMap, nameToOperator); - if(CollectionUtils.isEmpty(mustClauseChild)){ - log.info("Error occurred while preparing filter for must clause. Filter for key " + key + " will not be added."); - }else { - mustClauseList.add(mustClauseChild); - } - } - - if(!ObjectUtils.isEmpty(processSearchCriteria.getFromDate())){ - String key = "fromDate"; - Map mustClauseChild = null; - Map params = new HashMap<>(); - params.put(key, processSearchCriteria.getFromDate()); - mustClauseChild = (Map) prepareMustClauseChild(params, key, nameToPathMap, nameToOperator); - if(CollectionUtils.isEmpty(mustClauseChild)){ - log.info("Error occurred while preparing filter for must clause. Filter for key " + key + " will not be added."); - }else { - mustClauseList.add(mustClauseChild); - } - } - - if(!ObjectUtils.isEmpty(processSearchCriteria.getToDate())){ - String key = "toDate"; - Map mustClauseChild = null; - Map params = new HashMap<>(); - params.put(key, processSearchCriteria.getToDate()); - mustClauseChild = (Map) prepareMustClauseChild(params, key, nameToPathMap, nameToOperator); - if(CollectionUtils.isEmpty(mustClauseChild)){ - log.info("Error occurred while preparing filter for must clause. Filter for key " + key + " will not be added."); - }else { - mustClauseList.add(mustClauseChild); - } - } - - } - - - private void addModuleSearchCriteriaToBaseQuery(Map params, Map nameToPathMap, - Map nameToOperator, List mustClauseList) { - params.keySet().forEach(key -> { - if (!(key.equals(SORT_ORDER_CONSTANT) || key.equals(SORT_BY_CONSTANT))) { - - SearchParam.Operator operator = nameToOperator.get(key); - if (operator != null && operator.equals(SearchParam.Operator.WILDCARD)) { - List> mustClauseChild = null; - - mustClauseChild = (List>) prepareMustClauseWildCardChild(params, key, - nameToPathMap, nameToOperator); - - if (CollectionUtils.isEmpty(mustClauseChild)) { - log.info("Error occurred while preparing filter for must clause. Filter for key " + key - + " will not be added."); - } else { - mustClauseList.addAll(mustClauseChild); - } - } else { - - Map mustClauseChild = null; - mustClauseChild = (Map) prepareMustClauseChild(params, key, nameToPathMap, - nameToOperator); - if (CollectionUtils.isEmpty(mustClauseChild)) { - log.info("Error occurred while preparing filter for must clause. Filter for key " + key - + " will not be added."); - } else { - mustClauseList.add(mustClauseChild); - } - - } - } - }); - } - - @Override - public Map getStatusCountQuery(InboxRequest inboxRequest) { - Map baseEsQuery = getBaseESQueryBody(inboxRequest, Boolean.FALSE); - appendStatusCountAggsNode(baseEsQuery); - return baseEsQuery; - } - - @Override - public Map getNearingSlaCountQuery(InboxRequest inboxRequest, Long businessServiceSla) { - Map baseEsQuery = getESQuery(inboxRequest, Boolean.FALSE); - Long currenTimeInMillis = System.currentTimeMillis(); - Long lteParam = currenTimeInMillis; - Long slotLimit = businessServiceSla - 40 * (businessServiceSla/100); - Long gteParam = currenTimeInMillis - slotLimit; - - appendNearingSlaCountClause(baseEsQuery, gteParam, lteParam); - return baseEsQuery; - } - - private void appendNearingSlaCountClause(Map baseEsQuery, Long gteParam, Long lteParam) { - List mustClause = JsonPath.read(baseEsQuery, "$.query.bool.must"); - Map rangeObject = new HashMap<>(); - Map rangeClause = new HashMap<>(); - rangeClause.put("gte", gteParam); - rangeClause.put("lte", lteParam); - rangeObject.put("Data.auditDetails.lastModifiedTime", rangeClause); - HashMap rangeMap = new HashMap<>(); - rangeMap.put("range", rangeObject); - mustClause.add(rangeMap); - } - - private void appendStatusCountAggsNode(Map baseEsQuery) { - Map aggsNode = new HashMap<>(); - aggsNode.put("statusCount", new HashMap<>()); - Map statusCountNode = (Map) aggsNode.get("statusCount"); - statusCountNode.put("terms", new HashMap<>()); - Map innerTermsQuery = (Map) statusCountNode.get("terms"); - innerTermsQuery.put("field", "Data.currentProcessInstance.state.uuid.keyword"); - baseEsQuery.put("aggs", aggsNode); - } - - private Map getBaseESQueryBody(InboxRequest inboxRequest, Boolean isPaginationRequired){ - Map baseEsQuery = new HashMap<>(); - Map boolQuery = new HashMap<>(); - Map mustClause = new HashMap<>(); - - // Prepare bool query - boolQuery.put("bool", new HashMap<>()); - Map innerBoolBody = (Map) boolQuery.get("bool"); - innerBoolBody.put("must", new ArrayList<>()); - - // Prepare base ES query - if(isPaginationRequired) { - baseEsQuery.put("from", inboxRequest.getInbox().getOffset()); - baseEsQuery.put("size", inboxRequest.getInbox().getLimit()); - } - baseEsQuery.put("query", boolQuery); - - return baseEsQuery; - } - - private Map getBaseESQueryBody(SearchRequest searchRequest, Boolean isPaginationRequired){ - Map baseEsQuery = new HashMap<>(); - Map boolQuery = new HashMap<>(); - - // Prepare bool query - boolQuery.put("bool", new HashMap<>()); - Map innerBoolBody = (Map) boolQuery.get("bool"); - innerBoolBody.put("must", new ArrayList<>()); - - // Prepare base ES query - if(isPaginationRequired) { - baseEsQuery.put("from", searchRequest.getIndexSearchCriteria().getOffset()); - baseEsQuery.put("size", searchRequest.getIndexSearchCriteria().getLimit()); - } - baseEsQuery.put("query", boolQuery); - - return baseEsQuery; - } - - private Object prepareMustClauseChild(Map params, String key, Map nameToPathMap, - Map nameToOperatorMap) { - - SearchParam.Operator operator = nameToOperatorMap.get(key); - if (operator == null || operator.equals(SearchParam.Operator.EQUAL)) { - // Add terms clause in case the search criteria has a list of values - if (params.get(key) instanceof List) { - Map termsClause = new HashMap<>(); - termsClause.put("terms", new HashMap<>()); - Map innerTermsClause = (Map) termsClause.get("terms"); - innerTermsClause.put(addDataPathToSearchParamKey(key, nameToPathMap), params.get(key)); - return termsClause; - } - // Add term clause in case the search criteria has a single value - else { - Map termClause = new HashMap<>(); - termClause.put("term", new HashMap<>()); - Map innerTermClause = (Map) termClause.get("term"); - innerTermClause.put(addDataPathToSearchParamKey(key, nameToPathMap), params.get(key)); - return termClause; - } - } else if (operator.equals(SearchParam.Operator.LTE) || operator.equals(SearchParam.Operator.GTE)) { - Map rangeClause = new HashMap<>(); - rangeClause.put("range", new HashMap<>()); - Map innerTermClause = (Map) rangeClause.get("range"); - Map comparatorMap = new HashMap<>(); - - if (operator.equals(SearchParam.Operator.LTE)) { - comparatorMap.put("lte", params.get(key)); - } else if (operator.equals(SearchParam.Operator.GTE)) { - comparatorMap.put("gte", params.get(key)); - } - innerTermClause.put(addDataPathToSearchParamKey(key, nameToPathMap), comparatorMap); - return rangeClause; - } else - throw new CustomException(ErrorConstants.INVALID_OPERATOR_DATA, " Unsupported Operator : " + operator); - - } - - private List> prepareMustClauseWildCardChild(Map params, String key, - Map nameToPathMap, Map nameToOperatorMap) { - // Add wildcard clause in case the search criteria has a list of values - Object value = params.get(key); - List> wildcardClauses = new ArrayList<>(); - if (value instanceof List) { - List values = (List) value; - for (Object item : values) { - Map wildcardClause = new HashMap<>(); - wildcardClause.put("wildcard", new HashMap<>()); - Map innerWildcardClause = (Map) wildcardClause.get("wildcard"); - innerWildcardClause.put(addDataPathToSearchParamKey(key, nameToPathMap), "*" + item + "*"); - wildcardClauses.add(wildcardClause); - } - - return wildcardClauses; - } else { - Map wildcardClause = new HashMap<>(); - wildcardClause.put("wildcard", new HashMap<>()); - Map innerWildcardClause = (Map) wildcardClause.get("wildcard"); - innerWildcardClause.put(addDataPathToSearchParamKey(key, nameToPathMap), "*" + value + "*"); - wildcardClauses.add(wildcardClause); - return wildcardClauses; - } - } - - private String addDataPathToSearchParamKey(String key, Map nameToPathMap){ - - String path = nameToPathMap.get(key); - - if (StringUtils.isEmpty(path)) - path = "Data." + key + ".keyword"; - - return path; - } - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/repository/builder/V2/QueryBuilderInterface.java b/accelerators/inbox/src/main/java/org/egov/inbox/repository/builder/V2/QueryBuilderInterface.java deleted file mode 100644 index f1406241e6e..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/repository/builder/V2/QueryBuilderInterface.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.inbox.repository.builder.V2; - - -import org.egov.inbox.web.model.InboxRequest; -import org.egov.inbox.web.model.V2.InboxQueryConfiguration; - -import java.util.Map; -import java.util.Optional; - -public interface QueryBuilderInterface{ - - /** - * This method will take the incoming request and create - * elasticsearch query based on input search criteria - * @param inboxRequest - * @return - */ - public Map getESQuery(InboxRequest inboxRequest, Boolean isPaginationRequired); - - - /** - * This method will take the incoming request and create - * elasticsearch query based on input search criteria - * to get status count map - * @param inboxRequest - * @return - */ - public Map getStatusCountQuery(InboxRequest inboxRequest); - - /** - * This method will take the incoming request and create - * elasticsearch query based on input search criteria - * to get nearing sla count - * @param inboxRequest - * @return - */ - public Map getNearingSlaCountQuery(InboxRequest inboxRequest, Long businessServiceSla); - -} \ No newline at end of file diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/BPAInboxFilterService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/BPAInboxFilterService.java deleted file mode 100644 index b0a5973cea7..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/BPAInboxFilterService.java +++ /dev/null @@ -1,345 +0,0 @@ -package org.egov.inbox.service; - -import static org.egov.inbox.util.BpaConstants.*; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.web.client.RestTemplate; - -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class BPAInboxFilterService { - - @Value("${egov.user.host}") - private String userHost; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.searcher.host}") - private String searcherHost; - - @Value("${egov.searcher.bpa.search.path}") - private String bpaInboxSearcherEndpoint; - - @Value("${egov.searcher.bpa.search.desc.path}") - private String bpaInboxSearcherDescEndpoint; - - @Value("${egov.searcher.bpa.count.path}") - private String bpaInboxSearcherCountEndpoint; - - @Value("${egov.searcher.bpa.citizen.search.path}") - private String bpaCitizenInboxSearcherEndpoint; - - @Value("${egov.searcher.bpa.citizen.search.desc.path}") - private String bpaCitizenInboxSearcherDescEndpoint; - - @Value("${egov.searcher.bpa.citizen.count.path}") - private String bpaCitizenInboxSearcherCountEndpoint; - - @Value("${egov.searcher.bpa.tenant.wise.applnno.path}") - private String bpaStakeholderInboxTenantWiseApplnNosEndpoint; - - @Value("${egov.searcher.bpa.citizen.tenant.wise.applnno.path}") - private String bpaCitizenInboxTenantWiseApplnNosEndpoint; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - public List fetchApplicationNumbersFromSearcher(InboxSearchCriteria criteria, - HashMap StatusIdNameMap, RequestInfo requestInfo) { - List applicationNumbers = new ArrayList<>(); - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - List citizenRoles = Collections.emptyList(); - if (moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)) { - isMobileNumberPresent = true; - } - if (isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - Map> userDetails = fetchUserUUID(mobileNumber, requestInfo, tenantId); - userUUIDs = userDetails.get(USER_UUID); - citizenRoles = userDetails.get(USER_ROLES); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if (isSearchResultEmpty) { - return new ArrayList<>(); - } - } else { - List roles = requestInfo.getUserInfo().getRoles().stream().map(Role::getCode).collect(Collectors.toList()); - if(roles.contains(CITIZEN)) { - userUUIDs.add(requestInfo.getUserInfo().getUuid()); - citizenRoles = roles; - } - } - - if (!isSearchResultEmpty) { - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = getSearchCriteria(criteria, StatusIdNameMap, requestInfo, - moduleSearchCriteria, processCriteria, userUUIDs, citizenRoles); - // Paginating searcher results - searchCriteria.put(OFFSET_PARAM, criteria.getOffset()); - searchCriteria.put(NO_OF_RECORDS_PARAM, criteria.getLimit()); - moduleSearchCriteria.put(LIMIT_PARAM, criteria.getLimit()); - - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - - if (citizenHasStakeholderRoles(requestInfo, citizenRoles)) { - StringBuilder uri = new StringBuilder(); - if (moduleSearchCriteria.containsKey(SORT_ORDER_PARAM) - && moduleSearchCriteria.get(SORT_ORDER_PARAM).equals(DESC_PARAM)) - uri.append(searcherHost).append(bpaInboxSearcherDescEndpoint); - else - uri.append(searcherHost).append(bpaInboxSearcherEndpoint); - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - applicationNumbers = JsonPath.read(result, "$.BPAs.*.applicationno"); - } else { - StringBuilder citizenUri = new StringBuilder(); - - if (moduleSearchCriteria.containsKey(SORT_ORDER_PARAM) - && moduleSearchCriteria.get(SORT_ORDER_PARAM).equals(DESC_PARAM)) - citizenUri.append(searcherHost).append(bpaCitizenInboxSearcherDescEndpoint); - else - citizenUri.append(searcherHost).append(bpaCitizenInboxSearcherEndpoint); - - result = restTemplate.postForObject(citizenUri.toString(), searcherRequest, Map.class); - - List citizenApplicationsNumbers = JsonPath.read(result, "$.BPAs.*.applicationno"); - - applicationNumbers.addAll(citizenApplicationsNumbers); - } - - } - return applicationNumbers; - } - - private Map getSearchCriteria(InboxSearchCriteria criteria, Map statusIdNameMap, - RequestInfo requestInfo, Map moduleSearchCriteria, - ProcessInstanceSearchCriteria processCriteria, List userUUIDs, List userRoles) { - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM, criteria.getTenantId()); - searchCriteria.put(BUSINESS_SERVICE_PARAM, processCriteria.getBusinessService()); - - // Accommodating module search criteria in searcher request - if (moduleSearchCriteria != null && (moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) || userRoles.contains(CITIZEN)) - && !CollectionUtils.isEmpty(userUUIDs)) { - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if (moduleSearchCriteria != null && moduleSearchCriteria.containsKey(LOCALITY_PARAM)) { - List localities = Arrays.asList(String.valueOf(moduleSearchCriteria.get(LOCALITY_PARAM)).split(",")); - searchCriteria.put(LOCALITY_PARAM, localities); - } - if (moduleSearchCriteria != null && moduleSearchCriteria.containsKey(APPROVAL_NUMBER_PARAM)) { - searchCriteria.put(APPROVAL_NUMBER_PARAM, moduleSearchCriteria.get(APPROVAL_NUMBER_PARAM)); - } - if (moduleSearchCriteria != null && moduleSearchCriteria.containsKey(BPA_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(BPA_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(BPA_APPLICATION_NUMBER_PARAM)); - } - if (moduleSearchCriteria != null && moduleSearchCriteria.containsKey(APPLICATION_TYPE)) { - searchCriteria.put(APPLICATION_TYPE, moduleSearchCriteria.get(APPLICATION_TYPE)); - } - if (moduleSearchCriteria != null && moduleSearchCriteria.containsKey(SERVICE_TYPE)) { - searchCriteria.put(SERVICE_TYPE, moduleSearchCriteria.get(SERVICE_TYPE)); - } - - // Accommodating process search criteria in searcher request - if (!ObjectUtils.isEmpty(processCriteria.getAssignee())) { - searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if (!ObjectUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - } else { - if (statusIdNameMap != null && statusIdNameMap.values().size() > 0) { - if (CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, statusIdNameMap.keySet()); - } - } - } - return searchCriteria; - } - - public Integer fetchApplicationCountFromSearcher(InboxSearchCriteria criteria, - HashMap StatusIdNameMap, RequestInfo requestInfo) { - Integer totalCount = 0; - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if (moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)) { - isMobileNumberPresent = true; - } - List citizenRoles = Collections.emptyList(); - if (isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - Map> userDetails = fetchUserUUID(mobileNumber, requestInfo, tenantId); - userUUIDs = userDetails.get(USER_UUID); - citizenRoles = userDetails.get(USER_ROLES); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if (isSearchResultEmpty) { - return 0; - } - } else { - List roles = requestInfo.getUserInfo().getRoles().stream().map(Role::getCode).collect(Collectors.toList()); - if(roles.contains(CITIZEN)) { - userUUIDs.add(requestInfo.getUserInfo().getUuid()); - citizenRoles = roles; - } - } - - if (!isSearchResultEmpty) { - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = getSearchCriteria(criteria, StatusIdNameMap, requestInfo, - moduleSearchCriteria, processCriteria, userUUIDs, citizenRoles); - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - if (citizenHasStakeholderRoles(requestInfo, citizenRoles)) { - StringBuilder uri = new StringBuilder(); - uri.append(searcherHost).append(bpaInboxSearcherCountEndpoint); - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - double count = JsonPath.read(result, "$.TotalCount[0].count"); - totalCount = (int) count; - } else { - StringBuilder citizenUri = new StringBuilder(); - citizenUri.append(searcherHost).append(bpaCitizenInboxSearcherCountEndpoint); - - Object citizenResult = restTemplate.postForObject(citizenUri.toString(), searcherRequest, Map.class); - - double citizenCount = JsonPath.read(citizenResult, "$.TotalCount[0].count"); - totalCount = totalCount + (int) citizenCount; - } - } - return totalCount; - } - - private Map> fetchUserUUID(String mobileNumber, RequestInfo requestInfo, String tenantId) { - Map> userDetails = new ConcurrentHashMap<>(); - StringBuilder uri = new StringBuilder(); - uri.append(userHost).append(userSearchEndpoint); - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("userType", CITIZEN); - userSearchRequest.put("mobileNumber", mobileNumber); - try { - Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); - if (null != user) { - // log.info(user.toString()); - userDetails.put(USER_UUID, JsonPath.read(user, "$.user.*.uuid")); - userDetails.put(USER_ROLES, new ArrayList<>(new HashSet<>(JsonPath.read(user, "$.user.*.roles.*.code")))); - } else { - log.error("Service returned null while fetching user for mobile number - " + mobileNumber); - } - } catch (Exception e) { - log.error("Exception while fetching user for mobile number - " + mobileNumber); - log.error("Exception trace: ", e); - } - return userDetails; - } - - private boolean citizenHasStakeholderRoles(RequestInfo requestInfo, List citizenRoles) { - if (citizenRoles.isEmpty()) - citizenRoles = requestInfo.getUserInfo().getRoles().stream().map(Role::getCode) - .collect(Collectors.toList()); - if (!citizenRoles.isEmpty() && citizenRoles.size() > 1 && citizenRoles.contains(CITIZEN)) - return true; - return false; - } - - public List> fetchTenantWiseApplicationNumbersForCitizenInboxFromSearcher(InboxSearchCriteria criteria, - Map statusIdNameMap, RequestInfo requestInfo) { - List> tenantWiseApplns = new ArrayList<>(); - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = true; - List userUUIDs = new ArrayList<>(); - List citizenRoles = new ArrayList<>(); - if ((moduleSearchCriteria == null || moduleSearchCriteria.isEmpty()) || (moduleSearchCriteria != null && !moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM))) { - moduleSearchCriteria = new HashMap<>(); - moduleSearchCriteria.put(MOBILE_NUMBER_PARAM, requestInfo.getUserInfo().getMobileNumber()); - } - if (Boolean.TRUE.equals(isMobileNumberPresent)) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - Map> userDetails = fetchUserUUID(mobileNumber, requestInfo, tenantId); - userUUIDs = userDetails.get(USER_UUID); - citizenRoles = userDetails.get(USER_ROLES); - Boolean isUserPresentForGivenMobileNumber = !CollectionUtils.isEmpty(userUUIDs); - isSearchResultEmpty = !isUserPresentForGivenMobileNumber; - if (Boolean.TRUE.equals(isSearchResultEmpty)) { - userUUIDs.add(requestInfo.getUserInfo().getUuid()); - List roles = requestInfo.getUserInfo().getRoles().stream().map(Role::getCode).collect(Collectors.toList()); - citizenRoles.addAll(roles); - } - } /* - * else { userUUIDs.add(requestInfo.getUserInfo().getUuid()); - * citizenRoles.addAll(requestInfo.getUserInfo().getRoles().stream().map(Role::getCode).collect(Collectors.toList())); } - */ - - if (Boolean.FALSE.equals(isSearchResultEmpty)) { - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = getSearchCriteria(criteria, statusIdNameMap, requestInfo, - moduleSearchCriteria, processCriteria, userUUIDs, citizenRoles); - - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - if (citizenHasStakeholderRoles(requestInfo, citizenRoles)) { - StringBuilder uri = new StringBuilder(); - uri.append(searcherHost).append(bpaStakeholderInboxTenantWiseApplnNosEndpoint); - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - tenantWiseApplns = JsonPath.read(result, "$.BPA.*"); - } else { - StringBuilder citizenUri = new StringBuilder(); - citizenUri.append(searcherHost).append(bpaCitizenInboxTenantWiseApplnNosEndpoint); - result = restTemplate.postForObject(citizenUri.toString(), searcherRequest, Map.class); - tenantWiseApplns = JsonPath.read(result, "$.BPA.*"); - } - } - return tenantWiseApplns; - } - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/BillingAmendmentInboxFilterService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/BillingAmendmentInboxFilterService.java deleted file mode 100644 index 07202fe2d53..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/BillingAmendmentInboxFilterService.java +++ /dev/null @@ -1,280 +0,0 @@ -package org.egov.inbox.service; - -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.RequestInfo; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.web.client.RestTemplate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.egov.inbox.util.BSConstants.*; - -@Slf4j -@Service -public class BillingAmendmentInboxFilterService { - - @Value("${egov.user.host}") - private String userHost; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.searcher.host}") - private String searcherHost; - - @Value("${egov.searcher.bs.search.path}") - private String bsInboxSearcherEndpoint; - - @Value("${egov.searcher.bs.search.desc.path}") - private String bsInboxSearcherDescEndpoint; - - @Value("${egov.searcher.bs.count.path}") - private String bsInboxSearcherCountEndpoint; - - @Value("${egov.searcher.bs.sw.search.path}") - private String bsSwInboxSearcherEndpoint; - - @Value("${egov.searcher.bs.sw.search.desc.path}") - private String bsSwInboxSearcherDescEndpoint; - - @Value("${egov.searcher.bs.sw.count.path}") - private String bsSwInboxSearcherCountEndpoint; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - public Map> fetchConsumerNumbersFromSearcher(InboxSearchCriteria criteria, - HashMap StatusIdNameMap, RequestInfo requestInfo) { - List consumerCodes = new ArrayList<>(); - List amendmentIds = new ArrayList<>(); - Map> map = new HashMap(); - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if (moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)) { - isMobileNumberPresent = true; - } - if (isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if (isSearchResultEmpty) { - return new HashMap<>(); - } - } - - if (!isSearchResultEmpty) { - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM, criteria.getTenantId()); - searchCriteria.put(BS_BUSINESS_SERVICE_PARAM, processCriteria.getBusinessService()); - - // Accomodating module search criteria in searcher request - if (moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)) { - searchCriteria.put(USERID_PARAM, userUUIDs); - } - /* - * if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - * searchCriteria.put(MOBILE_NUMBER_PARAM, - * moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); } - */ - if (moduleSearchCriteria.containsKey(LOCALITY_PARAM)) { - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if (moduleSearchCriteria.containsKey(PROPERTY_ID_PARAM)) { - searchCriteria.put(PROPERTY_ID_PARAM, moduleSearchCriteria.get(PROPERTY_ID_PARAM)); - } - if (moduleSearchCriteria.containsKey(BS_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(BS_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(BS_APPLICATION_NUMBER_PARAM)); - } - if (moduleSearchCriteria.containsKey(BS_APPLICATION_TYPE_PARAM)) { - searchCriteria.put(BS_APPLICATION_TYPE_PARAM, moduleSearchCriteria.get(BS_APPLICATION_TYPE_PARAM)); - } - if (moduleSearchCriteria.containsKey(BS_CONSUMER_NO_PARAM)) { - searchCriteria.put(BS_CONSUMER_NO_PARAM, moduleSearchCriteria.get(BS_CONSUMER_NO_PARAM)); - } - if (moduleSearchCriteria.containsKey("appStatus")) { - searchCriteria.put(BS_APPLICATION_STATUS_PARAM, moduleSearchCriteria.get("appStatus")); - } - // Accomodating process search criteria in searcher request - if (!ObjectUtils.isEmpty(processCriteria.getAssignee())) { - searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if (!ObjectUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - } else { - if (StatusIdNameMap.values().size() > 0) { - if (CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - // Paginating searcher results - searchCriteria.put(OFFSET_PARAM, criteria.getOffset()); - searchCriteria.put(NO_OF_RECORDS_PARAM, criteria.getLimit()); - // moduleSearchCriteria.put(LIMIT_PARAM, criteria.getLimit()); - - searcherRequest.put(BS_REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(BS_SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - if (criteria.getProcessSearchCriteria().getModuleName().equalsIgnoreCase(BS_WS)) { - if (moduleSearchCriteria.containsKey(SORT_ORDER_PARAM) - && moduleSearchCriteria.get(SORT_ORDER_PARAM).equals(DESC_PARAM)) { - uri.append(searcherHost).append(bsInboxSearcherDescEndpoint); - } else { - uri.append(searcherHost).append(bsInboxSearcherEndpoint); - } - } else { - if (moduleSearchCriteria.containsKey(SORT_ORDER_PARAM) - && moduleSearchCriteria.get(SORT_ORDER_PARAM).equals(DESC_PARAM)) { - uri.append(searcherHost).append(bsSwInboxSearcherDescEndpoint); - } else { - uri.append(searcherHost).append(bsSwInboxSearcherEndpoint); - } - } - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - consumerCodes = JsonPath.read(result, "$.BillAmendments.*.consumercode"); - amendmentIds = JsonPath.read(result, "$.BillAmendments.*.amendmentid"); - map.put("consumerCodes", consumerCodes); - map.put("amendmentIds", amendmentIds); - } - return map; - } - - public Integer fetchApplicationCountFromSearcher(InboxSearchCriteria criteria, - HashMap StatusIdNameMap, RequestInfo requestInfo) { - Integer totalCount = 0; - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if (moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)) { - isMobileNumberPresent = true; - } - if (isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if (isSearchResultEmpty) { - return 0; - } - } - - if (!isSearchResultEmpty) { - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM, criteria.getTenantId()); - - // Accomodating module search criteria in searcher request - if (moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)) { - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if (moduleSearchCriteria.containsKey(LOCALITY_PARAM)) { - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if (moduleSearchCriteria.containsKey(PROPERTY_ID_PARAM)) { - searchCriteria.put(PROPERTY_ID_PARAM, moduleSearchCriteria.get(PROPERTY_ID_PARAM)); - } - if (moduleSearchCriteria.containsKey(BS_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(BS_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(BS_APPLICATION_NUMBER_PARAM)); - } - if (moduleSearchCriteria.containsKey(BS_APPLICATION_TYPE_PARAM)) { - searchCriteria.put(BS_APPLICATION_TYPE_PARAM, moduleSearchCriteria.get(BS_APPLICATION_TYPE_PARAM)); - } - if (moduleSearchCriteria.containsKey(BS_CONSUMER_NO_PARAM)) { - searchCriteria.put(BS_CONSUMER_NO_PARAM, moduleSearchCriteria.get(BS_CONSUMER_NO_PARAM)); - } - if (moduleSearchCriteria.containsKey("appStatus")) { - searchCriteria.put(BS_APPLICATION_STATUS_PARAM, moduleSearchCriteria.get("appStatus")); - } - // Accomodating process search criteria in searcher request - if (!ObjectUtils.isEmpty(processCriteria.getAssignee())) { - searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if (!ObjectUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - } else { - if (StatusIdNameMap.values().size() > 0) { - if (CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - // Paginating searcher results - - searcherRequest.put(BS_REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(BS_SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - - if (criteria.getProcessSearchCriteria().getModuleName().equalsIgnoreCase(BS_WS)) { - uri.append(searcherHost).append(bsInboxSearcherCountEndpoint); - } else { - uri.append(searcherHost).append(bsSwInboxSearcherCountEndpoint); - } - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - double count = JsonPath.read(result, "$.TotalCount[0].count"); - totalCount = new Integer((int) count); - - } - return totalCount; - } - - private List fetchUserUUID(String mobileNumber, RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - uri.append(userHost).append(userSearchEndpoint); - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("userType", "CITIZEN"); - userSearchRequest.put("mobileNumber", mobileNumber); - List userUuids = new ArrayList<>(); - try { - Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); - if (null != user) { - // log.info(user.toString()); - userUuids = JsonPath.read(user, "$.user.*.uuid"); - } else { - log.error("Service returned null while fetching user for mobile number - " + mobileNumber); - } - } catch (Exception e) { - log.error("Exception while fetching user for mobile number - " + mobileNumber); - log.error("Exception trace: ", e); - } - return userUuids; - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/DSSInboxFilterService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/DSSInboxFilterService.java deleted file mode 100644 index 20c396ec548..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/DSSInboxFilterService.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.egov.inbox.service; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.RequestInfo; -import org.egov.inbox.config.InboxConfiguration; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.util.ErrorConstants; -import org.egov.inbox.web.model.dss.*; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.ModuleDetail; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.util.*; - -import static org.egov.inbox.util.DSSConstants.*; -@Slf4j -@Service -public class DSSInboxFilterService { - - @Autowired - private InboxConfiguration config; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Value("${egov.dashboard.analytics.host}") - private String dashboardAnalyticsHost; - - @Value("${egov.dashboard.analytics.getchartv2.path}") - private String dashboardAnalyticsEndPoint; - - public Map getAggregateData(InboxMetricCriteria request) { - Map result = new HashMap<>(); - RequestDate dateReq = new RequestDate(); - Map headers = new HashMap<>(); - AggregateRequestDto aggregateRequestDto = new AggregateRequestDto(); - AggregationRequest aggRequest = new AggregationRequest(); - Map filters = new HashMap<>(); - try { - //Adding default values - dateReq.setInterval(DSS_INTERVAL); - aggregateRequestDto.setRequestDate(dateReq); - aggregateRequestDto.setVisualizationType(DSS_VISUALIZATIONTYPE); - aggregateRequestDto.setModuleLevel(""); - filters.put(TENANT_ID, new ArrayList<>()); - aggregateRequestDto.setFilters(filters); - String tenantId = config.getStateLevelTenantId(); - headers.put(TENANT_ID, tenantId); - aggRequest.setHeaders(headers); - - //mdms cala to fetch aggregation data - Object mdmsData = mdmsCall(tenantId, AGGREGATE_MASTER_CODE); - List aggregationData = JsonPath.read(mdmsData, MDMS_AGGREGATE_PATH); - - aggregationData.forEach(aggData -> { - if(aggData.get(MDMS_VISUALIZATION_MODULE_KEY).toString().equals(request.getModule())) { - List> vizCodes = JsonPath.read(aggData, MDMS_VISUALIZATION_PATH); - vizCodes.forEach(visualizationcodes -> { - try { - if (Integer.parseInt(String.valueOf(visualizationcodes.get(MDMS_VISUALIZATION_DATE_KEY))) > 0) { - Calendar cal = Calendar.getInstance(); - aggregateRequestDto.getRequestDate().setEndDate(String.valueOf(cal.getTimeInMillis())); - Integer dateInMonths = Integer.parseInt(String.valueOf(visualizationcodes.get(MDMS_VISUALIZATION_DATE_KEY))); - cal.add(Calendar.MONTH, -dateInMonths); - aggregateRequestDto.getRequestDate().setStartDate(String.valueOf(cal.getTimeInMillis())); - } else { - aggregateRequestDto.getRequestDate().setEndDate("0"); - aggregateRequestDto.getRequestDate().setStartDate("0"); - } - aggregateRequestDto.setVisualizationCode(visualizationcodes.get(MDMS_VISUALIZATION_CODES_KEY).toString()); - aggRequest.setAggregationRequestDto(aggregateRequestDto); - log.info("Request for " + request.getModule() + ": " + mapper.writeValueAsString(aggRequest)); - Object response = getHeaderData(aggRequest); - MetricResponse metricResponse = mapper.convertValue(response, MetricResponse.class); - result.put(visualizationcodes.get(MDMS_VISUALIZATION_CODES_KEY), metricResponse.getResponseData().getData().get(0).getHeaderValue()); - } catch (Exception e) { - throw new CustomException(ErrorConstants.INVALID_MODULE_DATA, e.getMessage()); - } - }); - } - }); - } catch (Exception e) { - throw new CustomException(ErrorConstants.INVALID_MODULE_DATA, e.getMessage()); - } - return result; - } - - public Object mdmsCall(String tenantId, String mastername) { - MdmsCriteriaReq mdmsCriteriaReq = enrichMdmsRequest(tenantId, mastername); - StringBuilder url = new StringBuilder(config.getMdmsHost()).append(config.getMdmsSearchEndPoint()); - Object result = serviceRequestRepository.fetchResult(url,mdmsCriteriaReq); - return result; - } - - public MdmsCriteriaReq enrichMdmsRequest(String tenantId, String mastername) { - List aggregateMasterDetails = new ArrayList<>(); - - aggregateMasterDetails.add(MasterDetail.builder().name(mastername).build()); - - ModuleDetail aggregateModuleDtls = ModuleDetail.builder().masterDetails(aggregateMasterDetails) - .moduleName(AGGREGATE_MODULE_NAME).build(); - - List moduleDetails = new ArrayList<>(); - moduleDetails.add(aggregateModuleDtls); - - MdmsCriteria mdmsCriteria = MdmsCriteria.builder().moduleDetails(moduleDetails).tenantId(tenantId) - .build(); - - return MdmsCriteriaReq.builder().requestInfo(new RequestInfo()).mdmsCriteria(mdmsCriteria).build(); - } - - public Object getHeaderData(AggregationRequest request) { - StringBuilder uri = new StringBuilder(dashboardAnalyticsHost) - .append(dashboardAnalyticsEndPoint); - try { - Object response = serviceRequestRepository.fetchResult(uri, request); - return response; - } catch (IllegalArgumentException e) { - throw new CustomException("IllegalArgumentException", "ObjectMapper not able to convertValue in dss call"); - } catch (Exception e) { - throw new CustomException("ServiceCallException", "Exception while fetching the result for dss"); - } - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/ElasticSearchService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/ElasticSearchService.java deleted file mode 100644 index ad4773a7213..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/ElasticSearchService.java +++ /dev/null @@ -1,427 +0,0 @@ -package org.egov.inbox.service; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; -import org.apache.http.HttpHost; -import org.apache.tomcat.util.codec.binary.Base64; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.common.contract.request.User; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.inbox.config.InboxConfiguration; -import org.egov.inbox.repository.RetryTemplate; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.web.model.elasticsearch.InboxElasticSearchCriteria; -import org.egov.inbox.web.model.elasticsearch.InboxElasticSearchRequest; -import org.egov.inbox.web.model.elasticsearch.UserDetailResponse; -import org.egov.tracer.model.CustomException; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.HttpClientErrorException; - -import javax.annotation.PostConstruct; -import java.nio.charset.Charset; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; - -import static java.util.Objects.isNull; -import static javax.servlet.http.HttpServletRequest.BASIC_AUTH; -import static org.apache.commons.codec.CharEncoding.US_ASCII; -import static org.egov.inbox.util.DSSConstants.*; -import static org.springframework.http.HttpHeaders.AUTHORIZATION; - -@Slf4j -public class ElasticSearchService { - - @Autowired - private InboxConfiguration config; - - @Autowired - private RetryTemplate retryTemplate; - - @Autowired - private DSSInboxFilterService dssInboxFilterService; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - private String internalMicroserviceRoleUuid = null; - - public static final String TENANTID_MDC_STRING = "TENANTID"; - - - @PostConstruct - void initalizeSystemuser(){ - - // Adding in MDC so that tracer can add it in header - MDC.put(TENANTID_MDC_STRING, config.getStateLevelTenantId()); - - RequestInfo requestInfo = new RequestInfo(); - StringBuilder uri = new StringBuilder(); - uri.append(config.getUserHost()).append(config.getUserSearchEndpoint()); // URL for user search call - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", config.getStateLevelTenantId()); - userSearchRequest.put("roleCodes", Collections.singletonList(INTERNALMICROSERVICEROLE_CODE)); - try { - LinkedHashMap responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(uri, userSearchRequest); - List> users = (List>) responseMap.get("user"); - if(users.size()==0) - createInternalMicroserviceUser(requestInfo); - internalMicroserviceRoleUuid = (String) users.get(0).get("uuid"); - }catch (Exception e) { - throw new CustomException("EG_USER_SEARCH_ERROR", "Service returned null while fetching user"); - } - - } - - private void createInternalMicroserviceUser(RequestInfo requestInfo){ - Map userCreateRequest = new HashMap<>(); - //Creating role with INTERNAL_MICROSERVICE_ROLE - Role role = Role.builder() - .name(INTERNALMICROSERVICEROLE_NAME).code(INTERNALMICROSERVICEROLE_CODE) - .tenantId(config.getStateLevelTenantId()).build(); - User user = User.builder().userName(INTERNALMICROSERVICEUSER_USERNAME) - .name(INTERNALMICROSERVICEUSER_NAME).mobileNumber(INTERNALMICROSERVICEUSER_MOBILENO) - .type(INTERNALMICROSERVICEUSER_TYPE).tenantId( config.getStateLevelTenantId()) - .roles(Collections.singletonList(role)).id(0L).build(); - - userCreateRequest.put("RequestInfo", requestInfo); - userCreateRequest.put("user", user); - - StringBuilder uri = new StringBuilder(); - uri.append(config.getUserHost()).append(config.getUserCreateEndpoint()); // URL for user create call - - try { - LinkedHashMap responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(uri, userCreateRequest); - List> users = (List>) responseMap.get("user"); - internalMicroserviceRoleUuid = (String) users.get(0).get("uuid"); - }catch (Exception e) { - throw new CustomException("EG_USER_CRETE_ERROR", "Service returned throws error while creating user"); - } - } - - - public Map search(InboxElasticSearchRequest request) { - Map query = new HashMap<>(); - try{ - String tenantId = centralInstanceUtil.getStateLevelTenant(request.getInboxElasticSearchCriteria().getTenantId()); - Object mdmsData = dssInboxFilterService.mdmsCall(tenantId, ELASTIC_SEARCH_MASTER); - String jsonPath = MDMS_ELASTIC_SEARCH_PATH.replace("{{indexKey}}",request.getInboxElasticSearchCriteria().getIndexKey()); - List object = JsonPath.read(mdmsData, jsonPath); - query = mapper.convertValue(object.get(0),Map.class); - }catch (Exception e) { - throw new CustomException("MDMS_DATA_EXTRACTION_ERROR", "Error in fetching mdms data. Check whether index key present in mdms file or not"); - } - - String searchQuery = (String) query.get("query"); - String indexName = (String) query.get("indexName"); - List placeHolderList = (List) query.get("placeHolders"); - searchQuery = enrichSearchQuery(request.getRequestInfo(),request.getInboxElasticSearchCriteria(),searchQuery, placeHolderList); - String url =( config.getIndexServiceHost() ) + indexName + config.getIndexServiceHostSearchEndpoint(); - HttpHeaders headers = getHttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - log.info("Searching ES for Query: " + searchQuery); - HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); - String reqBody = requestEntity.getBody(); - JsonNode responseNode = null; - Map finalResult = new HashMap<>(); - - try { - ResponseEntity response = retryTemplate.postForEntity(url, requestEntity); - responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); - Object total = responseNode.get(ELASTICSEARCH_HIT_KEY).get(ELASTICSEARCH_TOTAL_KEY); - JsonNode output = responseNode.get(ELASTICSEARCH_HIT_KEY).get(ELASTICSEARCH_HIT_KEY); - if(output.size()==0){ - throw new CustomException("NO_DATA", "No logs data for the given user with the provided search criteria"); - } - List> result = new ArrayList<>(); - List userIds = new ArrayList<>(); - Map totalHits = new HashMap<>(); - totalHits.put(ELASTICSEARCH_TOTAL_KEY,total); - result.add(totalHits); - if (!isNull(output) && output.isArray()) { - for(JsonNode objectnode : output){ - Map data = new HashMap<>(); - data.put(ELASTICSEARCH_TIMESTAMP_KEY,objectnode.get(ELASTICSEARCH_SOURCE_KEY).get(ELASTICSEARCH_DATA_KEY).get(ELASTICSEARCH_TIMESTAMP_KEY)); - data.put(ELASTICSEARCH_DATAVIEW_KEY,objectnode.get(ELASTICSEARCH_SOURCE_KEY).get(ELASTICSEARCH_DATA_KEY).get(ELASTICSEARCH_PALINACCESSREQUEST_KEY).get(ELASTICSEARCH_PALINACCESSREQUESTFIELD_KEY)); - data.put(ELASTICSEARCH_USERID_KEY,objectnode.get(ELASTICSEARCH_SOURCE_KEY).get(ELASTICSEARCH_DATA_KEY).get(ELASTICSEARCH_USERID_KEY).textValue()); - if(!(userIds.contains((String) data.get(ELASTICSEARCH_USERID_KEY)))) - userIds.add((String) data.get(ELASTICSEARCH_USERID_KEY)); - result.add(data); - } - } - Map mapping = getPlainOwnerDetails(request.getRequestInfo(), userIds, request.getInboxElasticSearchCriteria().getTenantId()); - if(mapping.size() != userIds.size()) - getremainingCitizenUserDetails(request.getRequestInfo(),userIds,request.getInboxElasticSearchCriteria().getTenantId(), mapping); - - for(int i=0;i userData = (Map) mapping.get(uuid); - if(userData!= null){ - result.get(i).put(ELASTICSEARCH_DATAVIEWEDBY_KEY,userData.get("name")); - result.get(i).put(ELASTICSEARCH_ROLES_KEY,userData.get("roles")); - } - else - result.get(i).put("user",null); - } - finalResult.put("ResponseInfo",null); - finalResult.put("ElasticSearchData",result); - - } catch (HttpClientErrorException e) { - log.error("client error while searching ES : " + e.getMessage()); - throw new CustomException("ELASTICSEARCH_ERROR", "client error while searching ES : \" + e.getMessage()"); - } - return finalResult; - } - - /** - * Gets plain data of citizen user details - * @param requestInfo requestinfo - * @param uuids List of user uuids - * @param tenantId tenantid - * @param mapping map of uuid and employee user - */ - private void getremainingCitizenUserDetails(RequestInfo requestInfo, List uuids, String tenantId, Map mapping){ - Map citizenUser = new HashMap<>(); - List citizenUuids = new ArrayList<>(); - - // Getting the citizen user uuid from the collatted uuid list - for(String uuid : uuids){ - if(!mapping.containsKey(uuid)) - citizenUuids.add(uuid); - } - citizenUser = getPlainOwnerDetails(requestInfo, uuids, centralInstanceUtil.getStateLevelTenant(tenantId)); - mapping.putAll(citizenUser); - } - - - /** - * Enrich elastic search query - * @param requestInfo requestinfo - * @param criteria inbox search criteria - * @param searchQuery elastic search query - * @param placeHolderList list of placeholder to replace - */ - public String enrichSearchQuery(RequestInfo requestInfo, InboxElasticSearchCriteria criteria, String searchQuery, List placeHolderList){ - String elasticSearchQuery = searchQuery; - Long limit = config.getDefaultLimit(); - Long offset = config.getDefaultOffset(); - String sortOrder = config.getDefaultSortOrder(); - - if(criteria.getLimit() != null && criteria.getLimit() <= config.getMaxSearchLimit()) - limit = Long.valueOf(criteria.getLimit()); - - if(criteria.getLimit() != null && criteria.getLimit() > config.getMaxSearchLimit()) - limit = Long.valueOf(config.getMaxSearchLimit()); - - if(criteria.getOffset() != null) - offset = Long.valueOf(criteria.getOffset()); - - if(criteria.getSortOrder() != null) - sortOrder = criteria.getSortOrder(); - - for(String placeholder:placeHolderList){ - - if(placeholder.equalsIgnoreCase(PLACEHOLDER_FROMDATE_KEY)){ - String fromDate = "0"; - if(criteria.getFromDate()!=0) - fromDate = String.valueOf(criteria.getFromDate()); - elasticSearchQuery = elasticSearchQuery.replace(PLACEHOLDER_FROMDATE_KEY,fromDate); - - } - - if(placeholder.equalsIgnoreCase(PLACEHOLDER_TODATE_KEY)){ - String toDate = String.valueOf(System.currentTimeMillis()); - if(criteria.getToDate()!=0) - toDate = String.valueOf(criteria.getToDate()); - elasticSearchQuery = elasticSearchQuery.replace(PLACEHOLDER_TODATE_KEY,toDate); - - } - - if(placeholder.equalsIgnoreCase(PLACEHOLDER_OFFSET_KEY)) - elasticSearchQuery = elasticSearchQuery.replace(PLACEHOLDER_OFFSET_KEY,String.valueOf(offset)); - - if(placeholder.equalsIgnoreCase(PLACEHOLDER_LIMIT_KEY)) - elasticSearchQuery = elasticSearchQuery.replace(PLACEHOLDER_LIMIT_KEY,String.valueOf(limit)); - - if(placeholder.equalsIgnoreCase(PLACEHOLDER_SORT_ORDER_KEY)) - elasticSearchQuery = elasticSearchQuery.replace(PLACEHOLDER_SORT_ORDER_KEY,sortOrder); - - - if(placeholder.equalsIgnoreCase(PLACEHOLDER_UUID_KEY)){ - String mobileNumber = requestInfo.getUserInfo().getMobileNumber(); - String tenantId = centralInstanceUtil.getStateLevelTenant(criteria.getTenantId()); - List usersUuid = getUsersUuid(requestInfo,mobileNumber,tenantId); - String multiMatchQuery = String.join(" OR ",usersUuid); - elasticSearchQuery = elasticSearchQuery.replace(PLACEHOLDER_UUID_KEY,multiMatchQuery); - } - } - return elasticSearchQuery; - } - - /** - * Searches the citizen user based on mobileNumber and returns the list of their UUIDS - * @param requestInfo RequestInfo - * @param mobileNumber Citizen mobile number - * @param tenantId tenantId for citizen search - * @return List of citizen user uuids - */ - private List getUsersUuid(RequestInfo requestInfo, String mobileNumber, String tenantId ){ - List usersUuid = new ArrayList<>(); - StringBuilder uri = new StringBuilder(); - uri.append(config.getUserHost()).append(config.getUserSearchEndpoint()); // URL for user search call - Map userSearchRequest = new HashMap<>(); - - // Setting user search criteria - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("mobileNumber",mobileNumber); - userSearchRequest.put("type","CITIZEN"); - UserDetailResponse userDetailResponse = null; - - try { - LinkedHashMap responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(uri, userSearchRequest); - List> users = (List>) responseMap.get("user"); - if(null != users) { - users.forEach( user -> { - usersUuid.add((String)user.get("uuid")); - }); - } - } catch (Exception e) { - throw new CustomException("EG_USER_SEARCH_ERROR", "Service returned null while fetching user : "+e.getMessage()); - } - - return usersUuid; - } - - - private HttpHeaders getHttpHeaders() { - HttpHeaders headers = new HttpHeaders(); - headers.add(AUTHORIZATION, getBase64Value(config.getEsUserName(), config.getEsPassword())); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - headers.setContentType(MediaType.APPLICATION_JSON); - - List mediaTypes = new ArrayList<>(); - mediaTypes.add(MediaType.APPLICATION_JSON); - headers.setAccept(mediaTypes); - return headers; - } - - private String getBase64Value(String userName, String password) { - String authString = String.format("%s:%s", userName, password); - byte[] encodedAuthString = Base64.encodeBase64(authString.getBytes(Charset.forName(US_ASCII))); - return String.format(BASIC_AUTH, new String(encodedAuthString)); - } - - /** - * Gets plain data of user details - * @param requestInfo requestinfo - * @param uuids List of user uuids - * @param tenantId tenantid - */ - private Map getPlainOwnerDetails(RequestInfo requestInfo, List uuids, String tenantId){ - Map mapping = new HashMap<>(); - User userInfoCopy = requestInfo.getUserInfo(); - StringBuilder uri = new StringBuilder(); - uri.append(config.getUserHost()).append(config.getUserSearchEndpoint()); // URL for user search call - Map userSearchRequest = new HashMap<>(); - - //Creating role with INTERNAL_MICROSERVICE_ROLE - Role role = Role.builder() - .name(INTERNALMICROSERVICEROLE_NAME).code(INTERNALMICROSERVICEROLE_CODE) - .tenantId(centralInstanceUtil.getStateLevelTenant(tenantId)).build(); - - //Creating userinfo with uuid and role of internal micro service role - User userInfo = User.builder() - .uuid(internalMicroserviceRoleUuid) - .type(INTERNALMICROSERVICEUSER_TYPE) - .roles(Collections.singletonList(role)).id(0L).build(); - - requestInfo.setUserInfo(userInfo); - - // Setting user search criteria - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("uuid",uuids); - UserDetailResponse userDetailResponse = null; - try { - LinkedHashMap responseMap = (LinkedHashMap) serviceRequestRepository.fetchResult(uri, userSearchRequest); - - List> users = (List>) responseMap.get("user"); - String dobFormat = "yyyy-MM-dd"; - - // parsing the user response - parseResponse(responseMap,dobFormat,mapping); - - /*for(User user: userDetailResponse.getUser()) - mapping.put(user.getUuid(),user);*/ - - } catch (Exception e) { - throw new CustomException("EG_USER_SEARCH_ERROR", "Service returned null while fetching user"); - } - requestInfo.setUserInfo(userInfoCopy); - return mapping; - } - - - /** - * Converts date to required date format - * @param responseMap date to be parsed - * @param dobFormat Format of the date - */ - private void parseResponse(LinkedHashMap responseMap,String dobFormat, Map mapping) { - - List> users = (List>)responseMap.get("user"); - String format1 = "dd-MM-yyyy HH:mm:ss"; - - if(null != users) { - - users.forEach( map -> { - - map.put("createdDate",dateTolong((String)map.get("createdDate"),format1)); - if((String)map.get("lastModifiedDate")!=null) - map.put("lastModifiedDate",dateTolong((String)map.get("lastModifiedDate"),format1)); - if((String)map.get("dob")!=null) - map.put("dob",dateTolong((String)map.get("dob"),dobFormat)); - if((String)map.get("pwdExpiryDate")!=null) - map.put("pwdExpiryDate",dateTolong((String)map.get("pwdExpiryDate"),format1)); - - mapping.put((String)map.get("uuid"),map); - } - ); - } - } - - /** - * Converts date to long - * @param date date to be parsed - * @param format Format of the date - * @return Long value of date - */ - private Long dateTolong(String date,String format){ - SimpleDateFormat f = new SimpleDateFormat(format); - Date d = null; - try { - d = f.parse(date); - } catch (ParseException e) { - log.error("Error while parsing the date"); - } - return d.getTime(); - } - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/FSMInboxFilterService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/FSMInboxFilterService.java deleted file mode 100644 index d26974fff42..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/FSMInboxFilterService.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.egov.inbox.service; - -import static org.egov.inbox.util.TLConstants.APPLICATION_NUMBER_PARAM; -import static org.egov.inbox.util.TLConstants.ASSIGNEE_PARAM; -import static org.egov.inbox.util.TLConstants.LICENSE_NUMBER_PARAM; -import static org.egov.inbox.util.TLConstants.LOCALITY_PARAM; -import static org.egov.inbox.util.TLConstants.MOBILE_NUMBER_PARAM; -import static org.egov.inbox.util.TLConstants.REQUESTINFO_PARAM; -import static org.egov.inbox.util.TLConstants.SEARCH_CRITERIA_PARAM; -import static org.egov.inbox.util.TLConstants.STATUS_PARAM; -import static org.egov.inbox.util.TLConstants.TENANT_ID_PARAM; -import static org.egov.inbox.util.TLConstants.USERID_PARAM; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.util.FSMConstants; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.web.client.RestTemplate; - -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class FSMInboxFilterService { - - - @Value("${egov.user.host}") - private String userHost; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.searcher.host}") - private String searcherHost; - - @Value("${egov.searcher.tl.search.path}") - private String tlInboxSearcherEndpoint; - - @Value("${egov.searcher.fsm.count.path}") - private String fsmInboxSearcherCountEndpoint; - - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - - public Integer fetchApplicationCountFromSearcher(InboxSearchCriteria criteria, HashMap StatusIdNameMap, RequestInfo requestInfo,String dsoId){ - Integer totalCount = 0; - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - - List userUUIDs = new ArrayList<>(); - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - isMobileNumberPresent = true; - } - if(isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if(isSearchResultEmpty){ - return 0; - } - } - - - - if(!isSearchResultEmpty){ - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); - - // Accomodating module search criteria in searcher request - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)){ - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - - if(moduleSearchCriteria.containsKey(FSMConstants.APPLICATION_NUMBER)) { - searchCriteria.put(FSMConstants.APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(FSMConstants.APPLICATION_NUMBER)); - } - - if(dsoId!=null) { - searchCriteria.put(FSMConstants.DSO_ID,dsoId); - } - - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if(!ObjectUtils.isEmpty(processCriteria.getStatus()) && !requestInfo.getUserInfo().getRoles().get(0).getCode().equals(FSMConstants.FSM_DSO)){ - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - }else{ - if(StatusIdNameMap.values().size() > 0) { - if(CollectionUtils.isEmpty(processCriteria.getStatus()) || (!(requestInfo.getUserInfo().getRoles().get(0).getCode().equals(FSMConstants.FSM_DSO)))) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - uri.append(searcherHost).append(fsmInboxSearcherCountEndpoint); - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - double count = JsonPath.read(result, "$.TotalCount[0].count"); - totalCount = new Integer((int) count); - } - return totalCount; - } - - - private List fetchUserUUID(String mobileNumber, RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - uri.append(userHost).append(userSearchEndpoint); - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("userType", "CITIZEN"); - userSearchRequest.put("mobileNumber", mobileNumber); - List userUuids = new ArrayList<>(); - try { - Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); - if(null != user) { - //log.info(user.toString()); - userUuids = JsonPath.read(user, "$.user.*.uuid"); - }else { - log.error("Service returned null while fetching user for mobile number - " + mobileNumber); - } - }catch(Exception e) { - log.error("Exception while fetching user for mobile number - " + mobileNumber); - log.error("Exception trace: ", e); - } - return userUuids; - } - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/InboxService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/InboxService.java deleted file mode 100644 index 1db7107127f..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/InboxService.java +++ /dev/null @@ -1,1173 +0,0 @@ -package org.egov.inbox.service; - -import static org.egov.inbox.util.BpaConstants.BPA; -import static org.egov.inbox.util.BpaConstants.BPAREG; -import static org.egov.inbox.util.BpaConstants.BPA_APPLICATION_NUMBER_PARAM; -import static org.egov.inbox.util.BpaConstants.LOCALITY_PARAM; -import static org.egov.inbox.util.BpaConstants.MOBILE_NUMBER_PARAM; -import static org.egov.inbox.util.BpaConstants.OFFSET_PARAM; -import static org.egov.inbox.util.BpaConstants.STATUS_ID; -import static org.egov.inbox.util.BpaConstants.STATUS_PARAM; -import static org.egov.inbox.util.DSSConstants.*; -import static org.egov.inbox.util.FSMConstants.APPLICATIONSTATUS; -import static org.egov.inbox.util.FSMConstants.CITIZEN_FEEDBACK_PENDING_STATE; -import static org.egov.inbox.util.FSMConstants.COMPLETED_STATE; -import static org.egov.inbox.util.FSMConstants.COUNT; -import static org.egov.inbox.util.FSMConstants.DISPOSED_STATE; -import static org.egov.inbox.util.FSMConstants.DSO_INPROGRESS_STATE; -import static org.egov.inbox.util.FSMConstants.FSM_VEHICLE_TRIP_MODULE; -import static org.egov.inbox.util.FSMConstants.STATUSID; -import static org.egov.inbox.util.FSMConstants.VEHICLE_LOG; -import static org.egov.inbox.util.FSMConstants.WAITING_FOR_DISPOSAL_STATE; -import static org.egov.inbox.util.NocConstants.NOC; -import static org.egov.inbox.util.NocConstants.NOC_APPLICATION_NUMBER_PARAM; -import static org.egov.inbox.util.PTConstants.ACKNOWLEDGEMENT_IDS_PARAM; -import static org.egov.inbox.util.PTConstants.PT; -import static org.egov.inbox.util.TLConstants.APPLICATION_NUMBER_PARAM; -import static org.egov.inbox.util.TLConstants.BUSINESS_SERVICE_PARAM; -import static org.egov.inbox.util.TLConstants.REQUESTINFO_PARAM; -import static org.egov.inbox.util.TLConstants.SEARCH_CRITERIA_PARAM; -import static org.egov.inbox.util.TLConstants.TENANT_ID_PARAM; -import static org.egov.inbox.util.TLConstants.TL; -import static org.egov.inbox.util.SWConstants.SW; -import static org.egov.inbox.util.BSConstants.*; -import static org.egov.inbox.util.WSConstants.WS; - -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; - -import static java.util.Objects.isNull; -import com.fasterxml.jackson.databind.JsonNode; -import org.apache.commons.collections4.MapUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.inbox.config.InboxConfiguration; -import org.egov.inbox.model.vehicle.VehicleSearchCriteria; -import org.egov.inbox.model.vehicle.VehicleTripDetail; -import org.egov.inbox.model.vehicle.VehicleTripDetailResponse; -import org.egov.inbox.model.vehicle.VehicleTripSearchCriteria; -import org.egov.inbox.repository.ElasticSearchRepository; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.util.BpaConstants; -import org.egov.inbox.util.ErrorConstants; -import org.egov.inbox.util.FSMConstants; -import org.egov.inbox.util.TLConstants; -import org.egov.inbox.web.model.Inbox; -import org.egov.inbox.web.model.InboxResponse; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.inbox.web.model.RequestInfoWrapper; -import org.egov.inbox.web.model.VehicleCustomResponse; -import org.egov.inbox.web.model.workflow.BusinessService; -import org.egov.inbox.web.model.workflow.ProcessInstance; -import org.egov.inbox.web.model.workflow.ProcessInstanceResponse; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.egov.inbox.web.model.workflow.State; -import org.egov.tracer.model.CustomException; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class InboxService { - - private InboxConfiguration config; - - private ServiceRequestRepository serviceRequestRepository; - - private ObjectMapper mapper; - - private WorkflowService workflowService; - - @Autowired - private PtInboxFilterService ptInboxFilterService; - - @Autowired - private TLInboxFilterService tlInboxFilterService; - - @Autowired - private BPAInboxFilterService bpaInboxFilterService; - - @Autowired - private FSMInboxFilterService fsmInboxFilter; - - @Autowired - private NOCInboxFilterService nocInboxFilterService; - - @Autowired - private WSInboxFilterService wsInboxFilterService; - - @Autowired - private SWInboxFilterService swInboxFilterService; - - @Autowired - private BillingAmendmentInboxFilterService billInboxFilterService; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - ElasticSearchRepository elasticSearchRepository; - - @Autowired - public InboxService(InboxConfiguration config, ServiceRequestRepository serviceRequestRepository, - ObjectMapper mapper, WorkflowService workflowService) { - this.config = config; - this.serviceRequestRepository = serviceRequestRepository; - this.mapper = mapper; - this.mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - - this.workflowService = workflowService; - } - - public InboxResponse fetchInboxData(InboxSearchCriteria criteria, RequestInfo requestInfo) { - - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - processCriteria.setTenantId(criteria.getTenantId()); - Integer flag=0; - if (processCriteria.getModuleName().equalsIgnoreCase(BS_WS)) { - flag=1; - processCriteria.setModuleName(BS_WS_MODULENAME); - } else if(processCriteria.getModuleName().equalsIgnoreCase(BS_SW)) { - flag=2; - processCriteria.setModuleName(BS_SW_MODULENAME); - } - - Integer totalCount = 0; - if(!(processCriteria.getModuleName().equals(SW) || processCriteria.getModuleName().equals(WS))) - totalCount = workflowService.getProcessCount(criteria.getTenantId(), requestInfo, processCriteria); - Integer nearingSlaProcessCount = workflowService.getNearingSlaProcessCount(criteria.getTenantId(), requestInfo, processCriteria); - List inputStatuses = new ArrayList<>(); - if (!CollectionUtils.isEmpty(processCriteria.getStatus())) - inputStatuses = new ArrayList<>(processCriteria.getStatus()); - StringBuilder assigneeUuid = new StringBuilder(); - String dsoId = null; - if (requestInfo.getUserInfo().getRoles().get(0).getCode().equals(FSMConstants.FSM_DSO)) { - Map searcherRequestForDSO = new HashMap<>(); - Map searchCriteriaForDSO = new HashMap<>(); - searchCriteriaForDSO.put(TENANT_ID_PARAM, criteria.getTenantId()); - searchCriteriaForDSO.put(FSMConstants.OWNER_ID, requestInfo.getUserInfo().getUuid()); - searcherRequestForDSO.put(REQUESTINFO_PARAM, requestInfo); - searcherRequestForDSO.put(SEARCH_CRITERIA_PARAM, searchCriteriaForDSO); - StringBuilder uri = new StringBuilder(); - uri.append(config.getSearcherHost()).append(config.getFsmInboxDSoIDEndpoint()); - - Object resultForDsoId = restTemplate.postForObject(uri.toString(), searcherRequestForDSO, Map.class); - - dsoId = JsonPath.read(resultForDsoId, "$.vendor[0].id"); - - } - if (!ObjectUtils.isEmpty(processCriteria.getAssignee())) { - assigneeUuid = assigneeUuid.append(processCriteria.getAssignee()); - processCriteria.setStatus(null); - } - // Since we want the whole status count map regardless of the status filter and assignee filter being passed - processCriteria.setAssignee(null); - processCriteria.setStatus(null); - - List> bpaCitizenStatusCountMap = new ArrayList>(); - List roles = requestInfo.getUserInfo().getRoles().stream().map(Role::getCode).collect(Collectors.toList()); - - String moduleName = processCriteria.getModuleName(); - /* - * SAN-920: Commenting out this code as Module name will now be passed for FSM - * if(ObjectUtils.isEmpty(processCriteria.getModuleName()) && - * !ObjectUtils.isEmpty(processCriteria.getBusinessService()) && - * (processCriteria.getBusinessService().contains("FSM") || - * processCriteria.getBusinessService().contains("FSM_VEHICLE_TRIP"))){ - * processCriteria.setModuleName(processCriteria.getBusinessService().get(0)); } - */ - List> statusCountMap = workflowService.getProcessStatusCount(requestInfo, processCriteria); - processCriteria.setModuleName(moduleName); - processCriteria.setStatus(inputStatuses); - processCriteria.setAssignee(assigneeUuid.toString()); - List businessServiceName = processCriteria.getBusinessService(); - List inboxes = new ArrayList(); - InboxResponse response = new InboxResponse(); - JSONArray businessObjects = null; - // Map srvMap = (Map) config.getServiceSearchMapping().get(businessServiceName.get(0)); - Map srvMap = fetchAppropriateServiceMap(businessServiceName,moduleName); - if (CollectionUtils.isEmpty(businessServiceName)) { - throw new CustomException(ErrorConstants.MODULE_SEARCH_INVLAID, "Bussiness Service is mandatory for module search"); - } - - Map businessServiceSlaMap = new HashMap<>(); - - if (!CollectionUtils.isEmpty(moduleSearchCriteria)) { - moduleSearchCriteria.put("tenantId", criteria.getTenantId()); - moduleSearchCriteria.put("offset", criteria.getOffset()); - moduleSearchCriteria.put("limit", criteria.getLimit()); - List bussinessSrvs = new ArrayList(); - for (String businessSrv : businessServiceName) { - BusinessService businessService = workflowService.getBusinessService(criteria.getTenantId(), requestInfo, - businessSrv); - bussinessSrvs.add(businessService); - businessServiceSlaMap.put(businessService.getBusinessService(),businessService.getBusinessServiceSla()); - } - HashMap StatusIdNameMap = workflowService.getActionableStatusesForRole(requestInfo, bussinessSrvs, - processCriteria); - String applicationStatusParam = srvMap.get("applsStatusParam"); - String businessIdParam = srvMap.get("businessIdProperty"); - if (StringUtils.isEmpty(applicationStatusParam)) { - applicationStatusParam = "applicationStatus"; - } - List crtieriaStatuses = new ArrayList(); - // if(!CollectionUtils.isEmpty((Collection) moduleSearchCriteria.get(applicationStatusParam))) { - // //crtieriaStatuses = (List) moduleSearchCriteria.get(applicationStatusParam); - // }else { - if (StatusIdNameMap.values().size() > 0) { - if (!CollectionUtils.isEmpty(processCriteria.getStatus())) { - List statuses = new ArrayList(); - processCriteria.getStatus().forEach(status -> { - statuses.add(StatusIdNameMap.get(status)); - }); - moduleSearchCriteria.put(applicationStatusParam, StringUtils.arrayToDelimitedString(statuses.toArray(), ",")); - } else { - moduleSearchCriteria.put(applicationStatusParam, - StringUtils.arrayToDelimitedString(StatusIdNameMap.values().toArray(), ",")); - } - - } - - Map> tenantAndApplnNumbersMap = new HashMap<>(); - if(processCriteria != null && !ObjectUtils.isEmpty(processCriteria.getModuleName()) - && processCriteria.getModuleName().equals(BPA) && roles.contains(BpaConstants.CITIZEN)) { - List> tenantWiseApplns = bpaInboxFilterService.fetchTenantWiseApplicationNumbersForCitizenInboxFromSearcher(criteria, StatusIdNameMap, requestInfo); - if (moduleSearchCriteria == null || moduleSearchCriteria.isEmpty()) { - moduleSearchCriteria = new HashMap<>(); - moduleSearchCriteria.put(MOBILE_NUMBER_PARAM, requestInfo.getUserInfo().getMobileNumber()); - criteria.setModuleSearchCriteria(moduleSearchCriteria); - } - for(Map tenantAppln : tenantWiseApplns) { - String tenant = tenantAppln.get("tenantid"); - String applnNo = tenantAppln.get("applicationno"); - if(tenantAndApplnNumbersMap.containsKey(tenant)) { - List applnNos = tenantAndApplnNumbersMap.get(tenant); - applnNos.add(applnNo); - tenantAndApplnNumbersMap.put(tenant, applnNos); - } else { - List l = new ArrayList<>(); - l.add(applnNo); - tenantAndApplnNumbersMap.put(tenant, l); - } - } - String inputTenantID = processCriteria.getTenantId(); - List inputBusinessIds = processCriteria.getBusinessIds(); - List inputStatus = processCriteria.getStatus(); - if(!StatusIdNameMap.isEmpty()) - processCriteria - .setStatus(StatusIdNameMap.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList())); - for(Map.Entry> t : tenantAndApplnNumbersMap.entrySet()) { - processCriteria.setTenantId(t.getKey()); - processCriteria.setBusinessIds(t.getValue()); - List> tenantWiseStatusCount = workflowService.getProcessStatusCount(requestInfo, processCriteria); - if(bpaCitizenStatusCountMap.isEmpty()) { - bpaCitizenStatusCountMap.addAll(tenantWiseStatusCount); - } else { - for (HashMap tenantStatusMap : tenantWiseStatusCount) { - for (HashMap bpaStatusMap : bpaCitizenStatusCountMap) { - if (bpaStatusMap.containsValue(tenantStatusMap.get(STATUS_ID))) { - bpaStatusMap.put(COUNT, Integer.parseInt(String.valueOf(bpaStatusMap.get(COUNT))) - + Integer.parseInt(String.valueOf(tenantStatusMap.get(COUNT)))); - } - } - } - } - } - statusCountMap = bpaCitizenStatusCountMap; - processCriteria.setTenantId(inputTenantID); - processCriteria.setBusinessIds(inputBusinessIds); - processCriteria.setStatus(inputStatus); - } - - /* - * In the WF statuscount API, locality based fileter is not supported. - * To support status wise count based on locality, with status and locality API - * is called and those count will be set in statuscount response. - */ - if(processCriteria != null && !ObjectUtils.isEmpty(processCriteria.getModuleName()) - && processCriteria.getModuleName().equals(BPA)) { - if(moduleSearchCriteria.get(LOCALITY_PARAM) != null) { - for(Map statusWiseCount : statusCountMap) { - List statusList = new ArrayList<>(); - statusList.add(String.valueOf(statusWiseCount.get(STATUS_ID))); - criteria.getProcessSearchCriteria().setStatus(statusList); - Integer count = bpaInboxFilterService.fetchApplicationCountFromSearcher(criteria, StatusIdNameMap, requestInfo); - if(count == 0) { - statusWiseCount.clear(); - } else { - statusWiseCount.put(COUNT, count); - } - } - criteria.getProcessSearchCriteria().setStatus(inputStatuses); - } - if(!statusCountMap.isEmpty()) { - List> bpaInboxStatusCountMap = new ArrayList<>(); - for (HashMap bpaLoclalityStatusCount : statusCountMap) { - if (!bpaLoclalityStatusCount.isEmpty()) - bpaInboxStatusCountMap.add(bpaLoclalityStatusCount); - } - statusCountMap = bpaInboxStatusCountMap; - } - } - - // } - // Redirect request to searcher in case of PT to fetch acknowledgement IDS - Boolean isSearchResultEmpty = false; - List businessKeys = new ArrayList<>(); - if (!ObjectUtils.isEmpty(processCriteria.getModuleName()) && processCriteria.getModuleName().equals(PT)) { - totalCount = ptInboxFilterService.fetchAcknowledgementIdsCountFromSearcher(criteria, StatusIdNameMap, - requestInfo); - List acknowledgementNumbers = ptInboxFilterService.fetchAcknowledgementIdsFromSearcher(criteria, - StatusIdNameMap, requestInfo); - if (!CollectionUtils.isEmpty(acknowledgementNumbers)) { - moduleSearchCriteria.put(ACKNOWLEDGEMENT_IDS_PARAM, acknowledgementNumbers); - businessKeys.addAll(acknowledgementNumbers); - moduleSearchCriteria.remove(LOCALITY_PARAM); - moduleSearchCriteria.remove(OFFSET_PARAM); - } else { - isSearchResultEmpty = true; - } - } - if (!ObjectUtils.isEmpty(processCriteria.getModuleName()) && ( processCriteria.getModuleName().equals(TL) - || processCriteria.getModuleName().equals(BPAREG))) { - totalCount = tlInboxFilterService.fetchApplicationCountFromSearcher(criteria, StatusIdNameMap, requestInfo); - List applicationNumbers = tlInboxFilterService.fetchApplicationNumbersFromSearcher(criteria, - StatusIdNameMap, requestInfo); - if (!CollectionUtils.isEmpty(applicationNumbers)) { - moduleSearchCriteria.put(APPLICATION_NUMBER_PARAM, applicationNumbers); - businessKeys.addAll(applicationNumbers); - moduleSearchCriteria.remove(TLConstants.STATUS_PARAM); - moduleSearchCriteria.remove(LOCALITY_PARAM); - moduleSearchCriteria.remove(OFFSET_PARAM); - } else { - isSearchResultEmpty = true; - } - } - - //TODO as on now this does not seem to be required, hence commenting the code - /* if (!ObjectUtils.isEmpty(processCriteria.getModuleName()) - && processCriteria.getModuleName().equalsIgnoreCase(FSMConstants.FSM_MODULE)) { - - totalCount = fsmInboxFilter.fetchApplicationCountFromSearcher(criteria, StatusIdNameMap, requestInfo, dsoId); - }*/ - if (processCriteria != null && !ObjectUtils.isEmpty(processCriteria.getModuleName()) - && processCriteria.getModuleName().equals(BPA)) { - totalCount = bpaInboxFilterService.fetchApplicationCountFromSearcher(criteria, StatusIdNameMap, requestInfo); - List applicationNumbers = bpaInboxFilterService.fetchApplicationNumbersFromSearcher(criteria, - StatusIdNameMap, requestInfo); - if (!CollectionUtils.isEmpty(applicationNumbers)) { - moduleSearchCriteria.put(BPA_APPLICATION_NUMBER_PARAM, applicationNumbers); - businessKeys.addAll(applicationNumbers); - moduleSearchCriteria.remove(STATUS_PARAM); - moduleSearchCriteria.remove(MOBILE_NUMBER_PARAM); - moduleSearchCriteria.remove(LOCALITY_PARAM); - moduleSearchCriteria.remove(OFFSET_PARAM); - } else { - isSearchResultEmpty = true; - } - } - - if (processCriteria != null && !ObjectUtils.isEmpty(processCriteria.getModuleName()) - && processCriteria.getModuleName().equals(NOC)) { - totalCount = nocInboxFilterService.fetchApplicationCountFromSearcher(criteria, StatusIdNameMap, requestInfo); - List applicationNumbers = nocInboxFilterService.fetchApplicationNumbersFromSearcher(criteria, StatusIdNameMap, requestInfo); - if (!CollectionUtils.isEmpty(applicationNumbers)) { - moduleSearchCriteria.put(NOC_APPLICATION_NUMBER_PARAM, applicationNumbers); - businessKeys.addAll(applicationNumbers); - moduleSearchCriteria.remove(STATUS_PARAM); - moduleSearchCriteria.remove(MOBILE_NUMBER_PARAM); - moduleSearchCriteria.remove(LOCALITY_PARAM); - moduleSearchCriteria.remove(OFFSET_PARAM); - } else { - isSearchResultEmpty = true; - } - } - - List> result = new ArrayList<>(); - Map businessMapWS = new LinkedHashMap<>(); - // Redirect request to ElasticSearch in case of WS and SW to fetch data - if (!ObjectUtils.isEmpty(processCriteria.getModuleName()) && (processCriteria.getModuleName().equals(WS) - || processCriteria.getModuleName().equals(SW))){ - JsonNode responseNode = null; - Map finalResult = new HashMap<>(); - - try { - responseNode = new ObjectMapper().convertValue(elasticSearchRepository.elasticSearchApplications(criteria, (List) null), JsonNode.class); - JsonNode output = responseNode.get(ELASTICSEARCH_HIT_KEY).get(ELASTICSEARCH_HIT_KEY); - //Throw exception for no returned result -// if(output.size()==0){ -// throw new CustomException("NO_DATA", "No logs data for the given user with the provided search criteria"); -// } - totalCount = responseNode.get(ELASTICSEARCH_HIT_KEY).get("total").intValue(); - - List userIds = new ArrayList<>(); - if (!isNull(output) && output.isArray()) { - for (JsonNode objectnode : output) { - Map data = new HashMap<>(); - data.put("Data", objectnode.get("_source").get("Data")); - - Long applicationServiceSla = getApplicationServiceSla(businessServiceSlaMap, data.get("Data")); - data.put("serviceSLA", applicationServiceSla); - result.add(data); - } - } - } catch (HttpClientErrorException e) { - log.error("client error while searching ES : " + e.getMessage()); - throw new CustomException("ELASTICSEARCH_ERROR", "client error while searching ES : \" + e.getMessage()"); - } - } - - // Redirect request to searcher in case of WS to fetch acknowledgement IDS - if (!ObjectUtils.isEmpty(processCriteria.getModuleName()) && processCriteria.getModuleName().equals(BS_WS_MODULENAME) - && flag==1) { - processCriteria.setModuleName(BS_WS); - totalCount = billInboxFilterService.fetchApplicationCountFromSearcher(criteria, StatusIdNameMap, - requestInfo); - Map> map = billInboxFilterService.fetchConsumerNumbersFromSearcher(criteria, - StatusIdNameMap, requestInfo); - List consumerCodes = map.get("consumerCodes"); - List amendmentIds = map.get("amendmentIds"); - if (!CollectionUtils.isEmpty(consumerCodes)) { - moduleSearchCriteria.put(BS_CONSUMER_NO_PARAM, consumerCodes); - businessKeys.addAll(amendmentIds); - moduleSearchCriteria.put(BS_BUSINESS_SERVICE_PARAM, "WS"); - moduleSearchCriteria.remove(MOBILE_NUMBER_PARAM); - moduleSearchCriteria.remove(ASSIGNEE_PARAM); - moduleSearchCriteria.remove(LOCALITY_PARAM); - moduleSearchCriteria.remove(OFFSET_PARAM); - } else { - isSearchResultEmpty = true; - } - moduleSearchCriteria.put("isPropertyDetailsRequired", true); - processCriteria.setModuleName(BS_WS_MODULENAME); - } - - // Redirect request to searcher in case of SW to fetch acknowledgement IDS - if (!ObjectUtils.isEmpty(processCriteria.getModuleName()) && processCriteria.getModuleName().equals(BS_SW_MODULENAME) - && flag==2) { - processCriteria.setModuleName(BS_SW); - totalCount = billInboxFilterService.fetchApplicationCountFromSearcher(criteria, StatusIdNameMap, - requestInfo); - Map> map = billInboxFilterService.fetchConsumerNumbersFromSearcher(criteria, - StatusIdNameMap, requestInfo); - List consumerCodes = map.get("consumerCodes"); - List amendmentIds = map.get("amendmentIds"); - if (!CollectionUtils.isEmpty(consumerCodes)) { - moduleSearchCriteria.put(BS_CONSUMER_NO_PARAM, consumerCodes); - businessKeys.addAll(amendmentIds); - moduleSearchCriteria.put(BS_BUSINESS_SERVICE_PARAM, "SW"); - moduleSearchCriteria.remove(MOBILE_NUMBER_PARAM); - moduleSearchCriteria.remove(ASSIGNEE_PARAM); - moduleSearchCriteria.remove(LOCALITY_PARAM); - moduleSearchCriteria.remove(OFFSET_PARAM); - } else { - isSearchResultEmpty = true; - } - moduleSearchCriteria.put("isPropertyDetailsRequired", true); - processCriteria.setModuleName(BS_SW_MODULENAME); - } - /* - * if(!ObjectUtils.isEmpty(processCriteria.getModuleName()) && processCriteria.getModuleName().equals(PT)){ Boolean - * isMobileNumberPresent = false; if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ isMobileNumberPresent = - * true; } Boolean isUserPresentForGivenMobileNumber = false; if(isMobileNumberPresent) { String tenantId = - * criteria.getTenantId(); String mobileNumber = (String) moduleSearchCriteria.get(MOBILE_NUMBER_PARAM); String - * userUUID = fetchUserUUID(mobileNumber, requestInfo, tenantId); isUserPresentForGivenMobileNumber = - * ObjectUtils.isEmpty(userUUID) ? true : false; } if(isMobileNumberPresent && isUserPresentForGivenMobileNumber){ - * isSearchResultEmpty = true; } if(!isSearchResultEmpty){ Object result = null; Map searcherRequest = - * new HashMap<>(); Map searchCriteria = new HashMap<>(); - * searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); // Accomodating module search criteria in searcher - * request if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ searchCriteria.put(MOBILE_NUMBER_PARAM, - * moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); } if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - * searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); } - * if(moduleSearchCriteria.containsKey(PROPERTY_ID_PARAM)){ searchCriteria.put(PROPERTY_ID_PARAM, - * moduleSearchCriteria.get(PROPERTY_ID_PARAM)); } if(moduleSearchCriteria.containsKey(APPLICATION_NUMBER_PARAM)) { - * searchCriteria.put(APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(APPLICATION_NUMBER_PARAM)); } // Accomodating - * process search criteria in searcher request if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - * searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); } - * if(!ObjectUtils.isEmpty(processCriteria.getStatus())){ searchCriteria.put(STATUS_PARAM, - * processCriteria.getStatus()); }else{ if(StatusIdNameMap.values().size() > 0) { - * if(CollectionUtils.isEmpty(processCriteria.getStatus())) { searchCriteria.put(STATUS_PARAM, - * StatusIdNameMap.keySet()); } } } // Paginating searcher results searchCriteria.put(OFFSET_PARAM, - * criteria.getOffset()); searchCriteria.put(NO_OF_RECORDS_PARAM, criteria.getLimit()); - * searcherRequest.put(REQUESTINFO_PARAM, requestInfo); searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - * result = restTemplate.postForObject(PT_INBOX_SEARCHER_URL, searcherRequest, Map.class); List - * acknowledgementNumbers = JsonPath.read(result, "$.Properties.*.acknowldgementnumber"); - * if(!CollectionUtils.isEmpty(acknowledgementNumbers)) { moduleSearchCriteria.put(ACKNOWLEDGEMENT_IDS_PARAM, - * acknowledgementNumbers); moduleSearchCriteria.remove(OFFSET_PARAM); moduleSearchCriteria.remove(LIMIT_PARAM); - * }else{ isSearchResultEmpty = true; } } } - */ - businessObjects = new JSONArray(); - //Search module specific data from respective modules. Works for all modules except WS and SW - if (!isSearchResultEmpty && !(processCriteria.getModuleName().equals(SW) || processCriteria.getModuleName().equals(WS))) { - businessObjects = fetchModuleObjects(moduleSearchCriteria, businessServiceName, criteria.getTenantId(), - requestInfo, srvMap); - } - Map businessMap = StreamSupport.stream(businessObjects.spliterator(), false) - .collect(Collectors.toMap(s1 -> ((JSONObject) s1).get(businessIdParam).toString(), - s1 -> s1, (e1, e2) -> e1, LinkedHashMap::new)); - ArrayList businessIds = new ArrayList(); - businessIds.addAll(businessMap.keySet()); - processCriteria.setBusinessIds(businessIds); - // processCriteria.setOffset(criteria.getOffset()); - // processCriteria.setLimit(criteria.getLimit()); - processCriteria.setIsProcessCountCall(false); - - String businessService; - Map srvSearchMap; - JSONArray serviceSearchObject = new JSONArray(); - Map serviceSearchMap ; - String businessServiceForAmendment = businessServiceName.get(0); - Boolean isBusinessServiceWSOrSW = businessServiceForAmendment.equalsIgnoreCase(BS_WS_SERVICE) || businessServiceForAmendment.equalsIgnoreCase(BS_SW_SERVICE); - if (businessObjects != null && businessObjects.length() > 0 - && isBusinessServiceWSOrSW) { - businessService = moduleSearchCriteria.get(BS_BUSINESS_SERVICE_PARAM).toString(); - // businessObjects.getJSONObject(0).getString("businessService"); - srvSearchMap = fetchAppropriateServiceSearchMap(businessService, moduleName); - if (!isSearchResultEmpty && (processCriteria.getModuleName().equalsIgnoreCase(BS_WS_MODULENAME) || processCriteria.getModuleName().equalsIgnoreCase(BS_SW_MODULENAME))) { - moduleSearchCriteria.put(srvSearchMap.get("consumerCodeParam"), moduleSearchCriteria.get(BS_CONSUMER_NO_PARAM)); - moduleSearchCriteria.remove(BS_CONSUMER_NO_PARAM); - moduleSearchCriteria.remove(BS_BUSINESS_SERVICE_PARAM); - moduleSearchCriteria.remove(BS_APPLICATION_NUMBER_PARAM); - moduleSearchCriteria.remove("status"); - moduleSearchCriteria.put("searchType", "CONNECTION"); - serviceSearchObject = fetchModuleSearchObjects(moduleSearchCriteria, businessServiceName, - criteria.getTenantId(), requestInfo, srvSearchMap); - moduleSearchCriteria.remove("searchType"); - moduleSearchCriteria.put(BS_BUSINESS_SERVICE_PARAM, businessService); - } - - } - serviceSearchMap = StreamSupport.stream(serviceSearchObject.spliterator(), false) - .collect(Collectors.toMap(s1 -> ((JSONObject) s1).get("connectionNo").toString(), - s1 -> s1, (e1, e2) -> e1, LinkedHashMap::new)); - - ProcessInstanceResponse processInstanceResponse; - /* - * In BPA, the stakeholder can able to submit applications for multiple cities - * and in the single inbox all cities submitted applications need to show - */ - if(processCriteria != null && !ObjectUtils.isEmpty(processCriteria.getModuleName()) - && processCriteria.getModuleName().equals(BPA) && roles.contains(BpaConstants.CITIZEN)) { - Map> tenantAndApplnNoForProcessInstance = new HashMap<>(); - for(Object businessId : businessIds) { - for (Map.Entry> tenantAppln : tenantAndApplnNumbersMap.entrySet()) { - String tenantId = tenantAppln.getKey(); - if (tenantAppln.getValue().contains(businessId) - && tenantAndApplnNoForProcessInstance.containsKey(tenantId)) { - List applnNos = tenantAndApplnNoForProcessInstance.get(tenantId); - applnNos.add(String.valueOf(businessId)); - tenantAndApplnNoForProcessInstance.put(tenantId, applnNos); - } else { - List businesIds = new ArrayList<>(); - businesIds.add(String.valueOf(businessId)); - tenantAndApplnNoForProcessInstance.put(tenantId, businesIds); - } - } - } - ProcessInstanceResponse processInstanceRes = new ProcessInstanceResponse(); - for(Map.Entry> appln : tenantAndApplnNoForProcessInstance.entrySet()) { - processCriteria.setTenantId(appln.getKey()); - processCriteria.setBusinessIds(appln.getValue()); - ProcessInstanceResponse processInstance = workflowService.getProcessInstance(processCriteria, requestInfo); - processInstanceRes.setResponseInfo(processInstance.getResponseInfo()); - if(processInstanceRes.getProcessInstances() == null) - processInstanceRes.setProcessInstances(processInstance.getProcessInstances()); - else - processInstanceRes.getProcessInstances().addAll(processInstance.getProcessInstances()); - } - processInstanceResponse = processInstanceRes; - } else { - processInstanceResponse = workflowService.getProcessInstance(processCriteria, requestInfo); - } - - List processInstances = processInstanceResponse.getProcessInstances(); - Map processInstanceMap = processInstances.stream() - .collect(Collectors.toMap(ProcessInstance::getBusinessId, Function.identity())); - - //Adding searched Items in Inbox result object for WS and SW - if (moduleName.equals(WS) || moduleName.equals(SW)) { - if (!CollectionUtils.isEmpty(result)) { - //Add items in Inbox response in Inbox object - result.forEach(res -> { - Inbox inbox = new Inbox(); - JsonNode jsonNode = mapper.convertValue(res.get("Data"), JsonNode.class); - JSONObject jsonObject=new JSONObject(); - jsonObject.put("Data",jsonNode); - jsonObject.put("serviceSLA",res.get("serviceSLA")); - inbox.setBusinessObject(toMap(jsonObject)); - inboxes.add(inbox); - }); - } - } - if (businessObjects.length() > 0 && processInstances.size() > 0) { - if (CollectionUtils.isEmpty(businessKeys)) { - businessMap.keySet().forEach(businessKey -> { - if(null != processInstanceMap.get(businessKey)) { - if (!isBusinessServiceWSOrSW) { - //For non- Bill Amendment Inbox search - Inbox inbox = new Inbox(); - inbox.setProcessInstance(processInstanceMap.get(businessKey)); - inbox.setBusinessObject(toMap((JSONObject) businessMap.get(businessKey))); - inboxes.add(inbox); - } else { - //When Bill Amendment objects are searched - Inbox inbox = new Inbox(); - inbox.setProcessInstance(processInstanceMap.get(businessKey)); - inbox.setBusinessObject(toMap((JSONObject) businessMap.get(businessKey))); - inbox.setServiceObject(toMap( - (JSONObject) serviceSearchMap.get(inbox.getBusinessObject().get("consumerCode")))); - inboxes.add(inbox); - } - } - }); - if (isBusinessServiceWSOrSW) - totalCount = processInstanceMap.size(); - } else { - //For non- Bill Amendment Inbox search - if (!isBusinessServiceWSOrSW) { - businessKeys.forEach(businessKey -> { - Inbox inbox = new Inbox(); - inbox.setProcessInstance(processInstanceMap.get(businessKey)); - inbox.setBusinessObject(toMap((JSONObject) businessMap.get(businessKey))); - inboxes.add(inbox); - }); - } else { - //When Bill Amendment objects are searched - for (String businessKey : businessKeys) { - Inbox inbox = new Inbox(); - inbox.setProcessInstance(processInstanceMap.get(businessKey)); - inbox.setBusinessObject(toMap((JSONObject) businessMap.get(businessKey))); - inbox.setServiceObject(toMap( - (JSONObject) serviceSearchMap.get(inbox.getBusinessObject().get("consumerCode")))); - inboxes.add(inbox); - } - } - } - } - } else { - processCriteria.setOffset(criteria.getOffset()); - processCriteria.setLimit(criteria.getLimit()); - - ProcessInstanceResponse processInstanceResponse = workflowService.getProcessInstance(processCriteria, requestInfo); - List processInstances = processInstanceResponse.getProcessInstances(); - HashMap> businessSrvIdsMap = new HashMap>(); - Map processInstanceMap = processInstances.stream() - .collect(Collectors.toMap(ProcessInstance::getBusinessId, Function.identity())); - moduleSearchCriteria = new HashMap(); - if (CollectionUtils.isEmpty(srvMap)) { - throw new CustomException(ErrorConstants.INVALID_MODULE, - "config not found for the businessService : " + businessServiceName); - } - String businessIdParam = srvMap.get("businessIdProperty"); - moduleSearchCriteria.put(srvMap.get("applNosParam"), - StringUtils.arrayToDelimitedString(processInstanceMap.keySet().toArray(), ",")); - moduleSearchCriteria.put("tenantId", criteria.getTenantId()); - // moduleSearchCriteria.put("offset", criteria.getOffset()); - moduleSearchCriteria.put("limit", -1); - businessObjects = fetchModuleObjects(moduleSearchCriteria, businessServiceName, criteria.getTenantId(), requestInfo, - srvMap); - Map businessMap = StreamSupport.stream(businessObjects.spliterator(), false) - .collect(Collectors.toMap(s1 -> ((JSONObject) s1).get(businessIdParam).toString(), - s1 -> s1)); - - if (businessObjects.length() > 0 && processInstances.size() > 0) { - processInstanceMap.keySet().forEach(pinstance -> { - Inbox inbox = new Inbox(); - inbox.setProcessInstance(processInstanceMap.get(pinstance)); - inbox.setBusinessObject(toMap((JSONObject) businessMap.get(pinstance))); - inboxes.add(inbox); - }); - } - - } - - // log.info("businessServiceName.contains(FSM_MODULE) ::: " + businessServiceName.contains(FSM_MODULE)); - - if (!ObjectUtils.isEmpty(processCriteria.getModuleName()) - && processCriteria.getModuleName().equalsIgnoreCase(FSMConstants.FSM_MODULE)) { - - List applicationStatus = new ArrayList<>(); - applicationStatus.add(WAITING_FOR_DISPOSAL_STATE); - applicationStatus.add(DISPOSED_STATE); - List> vehicleResponse = fetchVehicleTripResponse(criteria, requestInfo,applicationStatus); - BusinessService businessService = workflowService.getBusinessService(criteria.getTenantId(), requestInfo, - FSM_VEHICLE_TRIP_MODULE); - //log.info("businessService :::: " + businessService); - populateStatusCountMap(statusCountMap, vehicleResponse, businessService); - - for (HashMap vTripMap : statusCountMap) { - if ((WAITING_FOR_DISPOSAL_STATE.equals(vTripMap.get(APPLICATIONSTATUS)) - || DISPOSED_STATE.equals(vTripMap.get(APPLICATIONSTATUS))) - && inputStatuses.contains(vTripMap.get(STATUSID))) { - totalCount += ((int) vTripMap.get(COUNT)); - } - } - List requiredApplications = new ArrayList<>(); - inboxes.forEach(inbox -> { - ProcessInstance inboxProcessInstance = inbox.getProcessInstance(); - if (null != inboxProcessInstance && null!= inboxProcessInstance.getState()) { - String appStatus = inboxProcessInstance.getState().getApplicationStatus(); - if (DSO_INPROGRESS_STATE.equals(appStatus) || CITIZEN_FEEDBACK_PENDING_STATE.equals(appStatus) - || COMPLETED_STATE.equals(appStatus)) { - requiredApplications.add(inboxProcessInstance.getBusinessId()); - } - } - }); - //log.info("requiredApplications :::: " + requiredApplications); - - List vehicleTripDetail = fetchVehicleStatusForApplication(requiredApplications,requestInfo,criteria.getTenantId()); - //log.info("vehicleTripDetail :::: " + vehicleTripDetail); - inboxes.forEach(inbox -> { - if (null != inbox && null != inbox.getProcessInstance() - && null != inbox.getProcessInstance().getBusinessId()) { - List vehicleTripDetails = vehicleTripDetail.stream() - .filter(trip -> inbox.getProcessInstance().getBusinessId().equals(trip.getReferenceNo())) - .collect(Collectors.toList()); - Map vehicleBusinessObject = inbox.getBusinessObject(); - vehicleBusinessObject.put(VEHICLE_LOG, vehicleTripDetails); - } - }); - //log.info("CollectionUtils.isEmpty(inboxes) :::: " + CollectionUtils.isEmpty(inboxes)); - if (CollectionUtils.isEmpty(inboxes) && totalCount>0 && !moduleSearchCriteria.containsKey("applicationNos")) { - inputStatuses = inputStatuses.stream().filter(x -> x != null).collect(Collectors.toList()); - List fsmApplicationList = fetchVehicleStateMap(inputStatuses, requestInfo, criteria.getTenantId(),criteria.getLimit(),criteria.getOffset()); - moduleSearchCriteria.put("applicationNos", fsmApplicationList); - moduleSearchCriteria.put("applicationStatus", requiredApplications); -// moduleSearchCriteria.put("offset", criteria.getOffset()); -// moduleSearchCriteria.put("limit", criteria.getLimit()); - processCriteria.setBusinessIds(fsmApplicationList); - processCriteria.setStatus(null); - ProcessInstanceResponse processInstanceResponse = workflowService.getProcessInstance(processCriteria, - requestInfo); - //log.info("processInstanceResponse :::: " + processInstanceResponse); - List vehicleProcessInstances = processInstanceResponse.getProcessInstances(); - Map vehicleProcessInstanceMap = vehicleProcessInstances.stream() - .collect(Collectors.toMap(ProcessInstance::getBusinessId, Function.identity())); - JSONArray vehicleBusinessObjects = fetchModuleObjects(moduleSearchCriteria, businessServiceName, - criteria.getTenantId(), requestInfo, srvMap); - String businessIdParam = srvMap.get("businessIdProperty"); - //log.info("businessIdParam :::: " + businessIdParam); - Map vehicleBusinessMap = StreamSupport - .stream(vehicleBusinessObjects.spliterator(), false) - .collect(Collectors.toMap(s1 -> ((JSONObject) s1).get(businessIdParam).toString(), s1 -> s1, - (e1, e2) -> e1, LinkedHashMap::new)); - //log.info("businessIdParam :::: " + businessIdParam); - //log.info("vehicleBusinessObjects.length() :::: " + vehicleBusinessObjects.length()); - //log.info("vehicleProcessInstances.size() :::: " + vehicleProcessInstances.size()); - - if (vehicleBusinessObjects.length() > 0 && vehicleProcessInstances.size() > 0) { - //log.info("vehicleBusinessObjects.length() :::: " + vehicleBusinessObjects.length()); - //log.info("vehicleProcessInstances.size() :::: " + vehicleProcessInstances.size()); - fsmApplicationList.forEach(busiessKey -> { -// if(null != vehicleProcessInstanceMap.get(busiessKey)) { - Inbox inbox = new Inbox(); - inbox.setProcessInstance(vehicleProcessInstanceMap.get(busiessKey)); - inbox.setBusinessObject(toMap((JSONObject) vehicleBusinessMap.get(busiessKey))); - inboxes.add(inbox); -// } - }); - } - } - - //SAN-920: Logic for aggregating the statuses of Pay now and post pay application - List> aggregateStatusCountMap = new ArrayList<>(); - for (HashMap statusCountEntry : statusCountMap) { - HashMap tempStatusMap = new HashMap<>(); - boolean matchFound=false; - for (HashMap aggrMapInstance : aggregateStatusCountMap) { - - String statusMapAppStatus = (String) statusCountEntry.get("applicationstatus"); - String aggrMapAppStatus = (String) aggrMapInstance.get("applicationstatus"); - - if (aggrMapAppStatus.equalsIgnoreCase(statusMapAppStatus)) { - aggrMapInstance.put(COUNT, - ((Integer) statusCountEntry.get(COUNT) + (Integer) aggrMapInstance.get(COUNT))); - aggrMapInstance.put(APPLICATIONSTATUS, (String) statusCountEntry.get(APPLICATIONSTATUS)); - aggrMapInstance.put(BUSINESS_SERVICE_PARAM, (String) statusCountEntry.get(BUSINESS_SERVICE_PARAM) + "," - + (String) aggrMapInstance.get(BUSINESS_SERVICE_PARAM)); - aggrMapInstance.put(STATUSID, (String) statusCountEntry.get(STATUSID) + "," - + (String) aggrMapInstance.get(STATUSID)); - matchFound=true; - break; - } else { - tempStatusMap.put(COUNT, (Integer) statusCountEntry.get(COUNT)); - tempStatusMap.put(APPLICATIONSTATUS, (String) statusCountEntry.get(APPLICATIONSTATUS)); - tempStatusMap.put(BUSINESS_SERVICE_PARAM, (String) statusCountEntry.get(BUSINESS_SERVICE_PARAM)); - tempStatusMap.put(STATUSID, (String) statusCountEntry.get(STATUSID)); - - } - } - if (ObjectUtils.isEmpty(aggregateStatusCountMap)) { - aggregateStatusCountMap.add(statusCountEntry); - } else { - if (!matchFound) { - aggregateStatusCountMap.add(tempStatusMap); - } - } - } - - statusCountMap= aggregateStatusCountMap; - //log.info("removeStatusCountMap:: "+ new Gson().toJson(statusCountMap)); - - } - log.info("statusCountMap size :::: " + statusCountMap.size()); - - response.setTotalCount(totalCount); - response.setNearingSlaCount(nearingSlaProcessCount); - response.setStatusMap(statusCountMap); - response.setItems(inboxes); - return response; - } - - /** - * @param businessServiceSlaMap - * @param data -- application object - * @return - * Description : Calculate ServiceSLA for each application for WS and SW - */ - private Long getApplicationServiceSla(Map businessServiceSlaMap, Object data) { - - Long currentDate = System.currentTimeMillis(); //current time - ObjectMapper mapper = new ObjectMapper(); - Map properties = mapper.convertValue(data, Map.class); - Map additionalDetails = (Map) properties.get("additionalDetails"); - if (!ObjectUtils.isEmpty(additionalDetails.get("appCreatedDate")) || !Objects.isNull(additionalDetails.get("appCreatedDate"))) { - Long createdTime = ((Number) additionalDetails.get("appCreatedDate")).longValue(); - Map history = (LinkedHashMap) ((ArrayList) properties.get("history")).get(0); - String businessService = (String) history.get("businessService"); - Long businessServiceSLA = businessServiceSlaMap.get(businessService); - - return Long.valueOf(Math.round((businessServiceSLA - (currentDate - createdTime)) / ((double) (24 * 60 * 60 * 1000)))); - } - return null; - } - - public List fetchVehicleStateMap(List inputStatuses, RequestInfo requestInfo, String tenantId,Integer limit,Integer offSet) { - VehicleTripSearchCriteria vehicleTripSearchCriteria = new VehicleTripSearchCriteria(); - vehicleTripSearchCriteria.setApplicationStatus(inputStatuses); - vehicleTripSearchCriteria.setTenantId(tenantId); - vehicleTripSearchCriteria.setLimit(limit); - vehicleTripSearchCriteria.setOffset(offSet); - StringBuilder url = new StringBuilder(config.getFsmHost()); - url.append( config.getFetchApplicationIds()); - - Object result = serviceRequestRepository.fetchResult(url, vehicleTripSearchCriteria); - VehicleCustomResponse response =null; - try { - response = mapper.convertValue(result, VehicleCustomResponse.class); - if(null != response && null != response.getApplicationIdList()) { - System.out.println("size :::: "+response.getApplicationIdList().size());; - return response.getApplicationIdList(); - } - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of ProcessInstance"); - } - return new ArrayList<>(); - } - - /** - * @param requiredApplications - * @return - * Description : Fetch the vehicle_trip_detail by list of reference no. - */ - private List fetchVehicleStatusForApplication(List requiredApplications,RequestInfo requestInfo, String tenantId) { - VehicleTripSearchCriteria vehicleTripSearchCriteria = new VehicleTripSearchCriteria(); - vehicleTripSearchCriteria.setApplicationNos(requiredApplications); - vehicleTripSearchCriteria.setTenantId(tenantId); - return fetchVehicleTripDetailsByReferenceNo(vehicleTripSearchCriteria,requestInfo); - } - - public List fetchVehicleTripDetailsByReferenceNo(VehicleTripSearchCriteria vehicleTripSearchCriteria, RequestInfo requestInfo) { - StringBuilder url = new StringBuilder(config.getVehicleHost()); - url.append( config.getVehicleSearchTripPath()); - Object result = serviceRequestRepository.fetchResult(url, vehicleTripSearchCriteria); - VehicleTripDetailResponse response =null; - try { - response = mapper.convertValue(result, VehicleTripDetailResponse.class); - if(null != response && null != response.getVehicleTripDetail()) { - System.out.println("size :::: "+response.getVehicleTripDetail().size());; - return response.getVehicleTripDetail(); - } - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of ProcessInstance"); - } - return new ArrayList<>(); - } - - - private void populateStatusCountMap(List> statusCountMap, - List> vehicleResponse, BusinessService businessService) { - - if (!CollectionUtils.isEmpty(vehicleResponse) && businessService != null) { - List appStates = businessService.getStates(); - - for (State appState : appStates) { - - vehicleResponse.forEach(trip -> { - - HashMap vehicleTripStatusMp = new HashMap<>(); - if(trip.get(APPLICATIONSTATUS).equals(appState.getApplicationStatus())) { - - vehicleTripStatusMp.put(COUNT, trip.get(COUNT)); - vehicleTripStatusMp.put(APPLICATIONSTATUS, appState.getApplicationStatus()); - vehicleTripStatusMp.put(STATUSID, appState.getUuid()); - vehicleTripStatusMp.put(BUSINESS_SERVICE_PARAM, FSM_VEHICLE_TRIP_MODULE); - } - - if (MapUtils.isNotEmpty(vehicleTripStatusMp)) - statusCountMap.add(vehicleTripStatusMp); - }); - } - } - } - - private List> fetchVehicleTripResponse(InboxSearchCriteria criteria, RequestInfo requestInfo,List applicationStatus) { - - VehicleSearchCriteria vehicleTripSearchCriteria = new VehicleSearchCriteria(); - - vehicleTripSearchCriteria.setApplicationStatus(applicationStatus); - - vehicleTripSearchCriteria.setTenantId(criteria.getTenantId()); - - List> vehicleResponse = null ; - VehicleCustomResponse vehicleCustomResponse = fetchApplicationCount(vehicleTripSearchCriteria, requestInfo); - if(null != vehicleCustomResponse && null != vehicleCustomResponse.getApplicationStatusCount() ) { - vehicleResponse =vehicleCustomResponse.getApplicationStatusCount(); - }else { - vehicleResponse = new ArrayList>(); - } - - - return vehicleResponse; - } - - public VehicleCustomResponse fetchApplicationCount(VehicleSearchCriteria criteria, RequestInfo requestInfo) { - StringBuilder url = new StringBuilder(config.getVehicleHost()); - url.append( config.getVehicleApplicationStatusCountPath()); - Object result = serviceRequestRepository.fetchResult(url, criteria); - VehicleCustomResponse resposne =null; - try { - resposne = mapper.convertValue(result, VehicleCustomResponse.class); - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of ProcessInstance"); - } - return resposne; - } - - /* - * private String fetchUserUUID(String mobileNumber, RequestInfo requestInfo, String tenantId) { StringBuilder uri = new - * StringBuilder(); uri.append(userHost).append(userSearchEndpoint); Map userSearchRequest = new HashMap<>(); - * userSearchRequest.put("RequestInfo", requestInfo); userSearchRequest.put("tenantId", tenantId); - * userSearchRequest.put("userType", "CITIZEN"); userSearchRequest.put("userName", mobileNumber); String uuid = ""; try { - * Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); if(null != user) { uuid = JsonPath.read(user, - * "$.user[0].uuid"); }else { log.error("Service returned null while fetching user for username - " + mobileNumber); } - * }catch(Exception e) { log.error("Exception while fetching user for username - " + mobileNumber); - * log.error("Exception trace: ", e); } return uuid; } - */ - - private Map fetchAppropriateServiceMap(List businessServiceName,String moduleName) { - StringBuilder appropriateKey = new StringBuilder(); - for (String businessServiceKeys : config.getServiceSearchMapping().keySet()) { - if (businessServiceKeys.contains(businessServiceName.get(0))) { - appropriateKey.append(businessServiceKeys); - break; - } - } - if (ObjectUtils.isEmpty(appropriateKey)) { - throw new CustomException("EG_INBOX_SEARCH_ERROR", - "Inbox service is not configured for the provided business services"); - } - //SAN-920: Added check for enabling multiple business services only for FSM module - for (String inputBusinessService : businessServiceName) { - if (!FSMConstants.FSM_MODULE.equalsIgnoreCase(moduleName)) { - if (!appropriateKey.toString().contains(inputBusinessService)) { - throw new CustomException("EG_INBOX_SEARCH_ERROR", "Cross module search is NOT allowed."); - } - } - - } - return config.getServiceSearchMapping().get(appropriateKey.toString()); - } - - private JSONArray fetchModuleObjects(HashMap moduleSearchCriteria, List businessServiceName, String tenantId, - RequestInfo requestInfo, Map srvMap) { - JSONArray resutls = null; - - if (CollectionUtils.isEmpty(srvMap) || StringUtils.isEmpty(srvMap.get("searchPath"))) { - throw new CustomException(ErrorConstants.INVALID_MODULE_SEARCH_PATH, - "search path not configured for the businessService : " + businessServiceName); - } - StringBuilder url = new StringBuilder(srvMap.get("searchPath")); - url.append("?tenantId=").append(tenantId); - - Set searchParams = moduleSearchCriteria.keySet(); - - searchParams.forEach((param) -> { - - if (!param.equalsIgnoreCase("tenantId")) { - - if (moduleSearchCriteria.get(param) instanceof Collection) { - url.append("&").append(param).append("="); - url.append(StringUtils - .arrayToDelimitedString(((Collection) moduleSearchCriteria.get(param)).toArray(), ",")); - } else if(param.equalsIgnoreCase("appStatus")){ - url.append("&").append("applicationStatus").append("=") - .append(moduleSearchCriteria.get(param).toString()); - } else if(param.equalsIgnoreCase("consumerNo")){ - url.append("&").append("connectionNumber").append("=") - .append(moduleSearchCriteria.get(param).toString()); - } else if(null != moduleSearchCriteria.get(param)) { - url.append("&").append(param).append("=").append(moduleSearchCriteria.get(param).toString()); - } - } - }); - - log.info("\nfetchModuleObjects URL :::: " + url.toString()); - - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - Object result = serviceRequestRepository.fetchResult(url, requestInfoWrapper); - - LinkedHashMap responseMap; - try { - responseMap = mapper.convertValue(result, LinkedHashMap.class); - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of ProcessInstance Count"); - } - - - JSONObject jsonObject = new JSONObject(responseMap); - - try { - resutls = (JSONArray) jsonObject.getJSONArray(srvMap.get("dataRoot")); - } catch (Exception e) { - throw new CustomException(ErrorConstants.INVALID_MODULE_DATA, - " search api could not find data in dataroot " + srvMap.get("dataRoot")); - } - - - return resutls; - } - - public static Map toMap(JSONObject object) throws JSONException { - Map map = new HashMap(); - - if (object == null) { - return map; - } - Iterator keysItr = object.keys(); - while (keysItr.hasNext()) { - String key = keysItr.next(); - Object value = object.get(key); - - if (value instanceof JSONArray) { - value = toList((JSONArray) value); - } - - else if (value instanceof JSONObject) { - value = toMap((JSONObject) value); - } - map.put(key, value); - } - return map; - } - - public static List toList(JSONArray array) throws JSONException { - List list = new ArrayList(); - for (int i = 0; i < array.length(); i++) { - Object value = array.get(i); - if (value instanceof JSONArray) { - value = toList((JSONArray) value); - } - - else if (value instanceof JSONObject) { - value = toMap((JSONObject) value); - } - list.add(value); - } - return list; - } - - - private Map fetchAppropriateServiceSearchMap(String businessServiceName, String moduleName) { - StringBuilder appropriateKey = new StringBuilder(); - for (String businessServiceKeys : config.getBsServiceSearchMapping().keySet()) { - if (businessServiceKeys.contains(businessServiceName)) { - appropriateKey.append(businessServiceKeys); - break; - } - } - if (ObjectUtils.isEmpty(appropriateKey)) { - throw new CustomException("EG_INBOX_SEARCH_ERROR", - "Inbox service is not configured for the provided business services"); - } - return config.getBsServiceSearchMapping().get(appropriateKey.toString()); - } - - private JSONArray fetchModuleSearchObjects(HashMap moduleSearchCriteria, List businessServiceName, - String tenantId, RequestInfo requestInfo, Map srvMap) { - JSONArray results = null; - - if (CollectionUtils.isEmpty(srvMap) || StringUtils.isEmpty(srvMap.get("searchPath"))) { - throw new CustomException(ErrorConstants.INVALID_MODULE_SEARCH_PATH, - "search path not configured for the businessService : " + businessServiceName); - } - StringBuilder url = new StringBuilder(srvMap.get("searchPath")); - url.append("?tenantId=").append(tenantId); - - Set searchParams = moduleSearchCriteria.keySet(); - - searchParams.forEach((param) -> { - - if (!param.equalsIgnoreCase("tenantId")) { - if (param.equalsIgnoreCase("limit")) - return; - if (moduleSearchCriteria.get(param) instanceof Collection) { - url.append("&").append(param).append("="); - url.append(StringUtils - .arrayToDelimitedString(((Collection) moduleSearchCriteria.get(param)).toArray(), ",")); - } else if (null != moduleSearchCriteria.get(param)) { - url.append("&").append(param).append("=").append(moduleSearchCriteria.get(param).toString()); - } - } - }); - - log.info("\nfetchModulSearcheObjects URL :::: " + url.toString()); - - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - Object result = serviceRequestRepository.fetchResult(url, requestInfoWrapper); - - LinkedHashMap responseMap; - try { - responseMap = mapper.convertValue(result, LinkedHashMap.class); - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of ProcessInstance Count"); - } - - JSONObject jsonObject = new JSONObject(responseMap); - - try { - results = (JSONArray) jsonObject.getJSONArray(srvMap.get("dataRoot")); - } catch (Exception e) { - throw new CustomException(ErrorConstants.INVALID_MODULE_DATA, " search api could not find data in serviceMap " + srvMap.get("dataRoot")); - } - - return results; - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/NOCInboxFilterService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/NOCInboxFilterService.java deleted file mode 100644 index 6ea034d7adc..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/NOCInboxFilterService.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.egov.inbox.service; - -import static org.egov.inbox.util.NocConstants.ASSIGNEE_PARAM; -import static org.egov.inbox.util.NocConstants.BUSINESS_SERVICE_PARAM; -import static org.egov.inbox.util.NocConstants.CITIZEN; -import static org.egov.inbox.util.NocConstants.DESC_PARAM; -import static org.egov.inbox.util.NocConstants.LIMIT_PARAM; -import static org.egov.inbox.util.NocConstants.LOCALITY_PARAM; -import static org.egov.inbox.util.NocConstants.MOBILE_NUMBER_PARAM; -import static org.egov.inbox.util.NocConstants.NOC_APPLICATION_NUMBER_PARAM; -import static org.egov.inbox.util.NocConstants.NOC_SOURCE_APPLICATION_NUMBER_PARAM; -import static org.egov.inbox.util.NocConstants.NOC_SOURCE_REF_ID_PARAM; -import static org.egov.inbox.util.NocConstants.NO_OF_RECORDS_PARAM; -import static org.egov.inbox.util.NocConstants.OFFSET_PARAM; -import static org.egov.inbox.util.NocConstants.REQUESTINFO_PARAM; -import static org.egov.inbox.util.NocConstants.SEARCH_CRITERIA_PARAM; -import static org.egov.inbox.util.NocConstants.SORT_ORDER_PARAM; -import static org.egov.inbox.util.NocConstants.STATUS_PARAM; -import static org.egov.inbox.util.NocConstants.TENANT_ID_PARAM; -import static org.egov.inbox.util.NocConstants.USERID_PARAM; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.web.client.RestTemplate; - -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class NOCInboxFilterService { - - @Value("${egov.user.host}") - private String userHost; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.searcher.host}") - private String searcherHost; - - @Value("${egov.searcher.noc.search.path}") - private String nocInboxSearcherEndpoint; - - @Value("${egov.searcher.noc.search.desc.path}") - private String nocInboxSearcherDescEndpoint; - - @Value("${egov.searcher.noc.count.path}") - private String nocInboxSearcherCountEndpoint; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - public List fetchApplicationNumbersFromSearcher(InboxSearchCriteria criteria, - HashMap StatusIdNameMap, RequestInfo requestInfo) { - List applicationNumbers = new ArrayList<>(); - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if (moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)) { - isMobileNumberPresent = true; - } - if (isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if (isSearchResultEmpty) { - return new ArrayList<>(); - } - } - - if (!isSearchResultEmpty) { - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = getSearchCriteria(criteria, StatusIdNameMap, requestInfo, - moduleSearchCriteria, processCriteria, userUUIDs); - // Paginating searcher results - searchCriteria.put(OFFSET_PARAM, criteria.getOffset()); - searchCriteria.put(NO_OF_RECORDS_PARAM, criteria.getLimit()); - moduleSearchCriteria.put(LIMIT_PARAM, criteria.getLimit()); - - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - - if (moduleSearchCriteria.containsKey(SORT_ORDER_PARAM) - && moduleSearchCriteria.get(SORT_ORDER_PARAM).equals(DESC_PARAM)) - uri.append(searcherHost).append(nocInboxSearcherDescEndpoint); - else - uri.append(searcherHost).append(nocInboxSearcherEndpoint); - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - List citizenApplicationsNumbers = JsonPath.read(result, "$.Noc.*.applicationno"); - - applicationNumbers.addAll(citizenApplicationsNumbers); - - } - return applicationNumbers; - } - - private Map getSearchCriteria(InboxSearchCriteria criteria, HashMap StatusIdNameMap, - RequestInfo requestInfo, HashMap moduleSearchCriteria, - ProcessInstanceSearchCriteria processCriteria, List userUUIDs) { - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM, criteria.getTenantId()); - searchCriteria.put(BUSINESS_SERVICE_PARAM, processCriteria.getBusinessService()); - - // Accommodating module search criteria in searcher request - if (moduleSearchCriteria != null && moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) - && !CollectionUtils.isEmpty(userUUIDs)) { - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if (moduleSearchCriteria != null && moduleSearchCriteria.containsKey(LOCALITY_PARAM)) { - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if (moduleSearchCriteria != null && moduleSearchCriteria.containsKey(NOC_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(NOC_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(NOC_APPLICATION_NUMBER_PARAM)); - } - if (moduleSearchCriteria != null && moduleSearchCriteria.containsKey(NOC_SOURCE_REF_ID_PARAM)) { - searchCriteria.put(NOC_SOURCE_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(NOC_SOURCE_REF_ID_PARAM)); - } - - // Accommodating process search criteria in searcher request - if (!ObjectUtils.isEmpty(processCriteria.getAssignee())) { - searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if (!ObjectUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - } else { - if (StatusIdNameMap != null && StatusIdNameMap.values().size() > 0) { - if (CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - return searchCriteria; - } - - public Integer fetchApplicationCountFromSearcher(InboxSearchCriteria criteria, - HashMap StatusIdNameMap, RequestInfo requestInfo) { - Integer totalCount = 0; - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if (moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)) { - isMobileNumberPresent = true; - } - if (isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if (isSearchResultEmpty) { - return 0; - } - } - - if (!isSearchResultEmpty) { - Map searcherRequest = new HashMap<>(); - Map searchCriteria = getSearchCriteria(criteria, StatusIdNameMap, requestInfo, - moduleSearchCriteria, processCriteria, userUUIDs); - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - StringBuilder citizenUri = new StringBuilder(); - citizenUri.append(searcherHost).append(nocInboxSearcherCountEndpoint); - - Object result = restTemplate.postForObject(citizenUri.toString(), searcherRequest, Map.class); - - double citizenCount = JsonPath.read(result, "$.TotalCount[0].count"); - totalCount = totalCount + (int) citizenCount; - } - return totalCount; - } - - private List fetchUserUUID(String mobileNumber, RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - List uuids = new ArrayList<>(); - uri.append(userHost).append(userSearchEndpoint); - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("userType", CITIZEN); - userSearchRequest.put("mobileNumber", mobileNumber); - try { - Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); - if (null != user) { - // log.info(user.toString()); - uuids.addAll(JsonPath.read(user, "$.user.*.uuid")); - } else { - log.error("Service returned null while fetching user for mobile number - " + mobileNumber); - } - } catch (Exception e) { - log.error("Exception while fetching user for mobile number - " + mobileNumber); - log.error("Exception trace: ", e); - } - return uuids; - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/PtInboxFilterService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/PtInboxFilterService.java deleted file mode 100644 index 9ce106da471..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/PtInboxFilterService.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.egov.inbox.service; - -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.RequestInfo; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.web.client.RestTemplate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.egov.inbox.util.PTConstants.*; -import static org.egov.inbox.util.PTConstants.LIMIT_PARAM; - -@Slf4j -@Service -public class PtInboxFilterService { - - @Value("${egov.user.host}") - private String userHost; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.searcher.host}") - private String searcherHost; - - @Value("${egov.searcher.pt.search.path}") - private String ptInboxSearcherEndpoint; - - @Value("${egov.searcher.pt.search.desc.path}") - private String ptInboxSearcherDescEndpoint; - - @Value("${egov.searcher.pt.count.path}") - private String ptInboxSearcherCountEndpoint; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - public List fetchAcknowledgementIdsFromSearcher(InboxSearchCriteria criteria, HashMap StatusIdNameMap, RequestInfo requestInfo){ - List acknowledgementNumbers = new ArrayList<>(); - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - isMobileNumberPresent = true; - } - if(isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if(isSearchResultEmpty){ - return new ArrayList<>(); - } - } - - if(!isSearchResultEmpty){ - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); - searchCriteria.put(BUSINESS_SERVICE_PARAM, processCriteria.getBusinessService()); - - // Accomodating module search criteria in searcher request - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)){ - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if(moduleSearchCriteria.containsKey(PROPERTY_ID_PARAM)){ - searchCriteria.put(PROPERTY_ID_PARAM, moduleSearchCriteria.get(PROPERTY_ID_PARAM)); - } - if(moduleSearchCriteria.containsKey(PT_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(PT_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(PT_APPLICATION_NUMBER_PARAM)); - } - - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if(!ObjectUtils.isEmpty(processCriteria.getStatus())){ - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - }else{ - if(StatusIdNameMap.values().size() > 0) { - if(CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - // Paginating searcher results - searchCriteria.put(OFFSET_PARAM, criteria.getOffset()); - searchCriteria.put(NO_OF_RECORDS_PARAM, criteria.getLimit()); - moduleSearchCriteria.put(LIMIT_PARAM, criteria.getLimit()); - - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - if(moduleSearchCriteria.containsKey(SORT_ORDER_PARAM) && moduleSearchCriteria.get(SORT_ORDER_PARAM).equals(DESC_PARAM)){ - uri.append(searcherHost).append(ptInboxSearcherDescEndpoint); - }else { - uri.append(searcherHost).append(ptInboxSearcherEndpoint); - } - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - acknowledgementNumbers = JsonPath.read(result, "$.Properties.*.acknowldgementnumber"); - - } - return acknowledgementNumbers; - } - - public Integer fetchAcknowledgementIdsCountFromSearcher(InboxSearchCriteria criteria, HashMap StatusIdNameMap, RequestInfo requestInfo){ - Integer totalCount = 0; - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - isMobileNumberPresent = true; - } - if(isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if(isSearchResultEmpty){ - return 0; - } - } - - if(!isSearchResultEmpty){ - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); - - // Accomodating module search criteria in searcher request - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)){ - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if(moduleSearchCriteria.containsKey(PROPERTY_ID_PARAM)){ - searchCriteria.put(PROPERTY_ID_PARAM, moduleSearchCriteria.get(PROPERTY_ID_PARAM)); - } - if(moduleSearchCriteria.containsKey(PT_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(PT_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(PT_APPLICATION_NUMBER_PARAM)); - } - - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if(!ObjectUtils.isEmpty(processCriteria.getStatus())){ - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - }else{ - if(StatusIdNameMap.values().size() > 0) { - if(CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - // Paginating searcher results - - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - uri.append(searcherHost).append(ptInboxSearcherCountEndpoint); - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - double count = JsonPath.read(result, "$.TotalCount[0].count"); - totalCount = new Integer((int) count); - - } - return totalCount; - } - - - private List fetchUserUUID(String mobileNumber, RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - uri.append(userHost).append(userSearchEndpoint); - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("userType", "CITIZEN"); - userSearchRequest.put("mobileNumber", mobileNumber); - List userUuids = new ArrayList<>(); - try { - Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); - if(null != user) { - //log.info(user.toString()); - userUuids = JsonPath.read(user, "$.user.*.uuid"); - }else { - log.error("Service returned null while fetching user for mobile number - " + mobileNumber); - } - }catch(Exception e) { - log.error("Exception while fetching user for mobile number - " + mobileNumber); - log.error("Exception trace: ", e); - } - return userUuids; - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/SWInboxFilterService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/SWInboxFilterService.java deleted file mode 100644 index fb5de9230b7..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/SWInboxFilterService.java +++ /dev/null @@ -1,253 +0,0 @@ -package org.egov.inbox.service; - -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.RequestInfo; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.web.client.RestTemplate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.egov.inbox.util.SWConstants.*; -import static org.egov.inbox.util.WSConstants.WS_ASSIGNEE_PARAM; -import static org.egov.inbox.util.WSConstants.WS_APPLICATION_STATUS_PARAM; - -@Slf4j -@Service -public class SWInboxFilterService { - - @Value("${egov.user.host}") - private String userHost; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.searcher.host}") - private String searcherHost; - - @Value("${egov.searcher.sw.search.path}") - private String swInboxSearcherEndpoint; - - @Value("${egov.searcher.sw.search.desc.path}") - private String swInboxSearcherDescEndpoint; - - @Value("${egov.searcher.sw.count.path}") - private String swInboxSearcherCountEndpoint; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - public List fetchApplicationNumbersFromSearcher(InboxSearchCriteria criteria, HashMap StatusIdNameMap, RequestInfo requestInfo){ - List applicationNumbers = new ArrayList<>(); - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - isMobileNumberPresent = true; - } - if(isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if(isSearchResultEmpty){ - return new ArrayList<>(); - } - } - - if(!isSearchResultEmpty){ - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); - searchCriteria.put(SW_BUSINESS_SERVICE_PARAM, processCriteria.getBusinessService()); - - // Accomodating module search criteria in searcher request - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)){ - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if(moduleSearchCriteria.containsKey(PROPERTY_ID_PARAM)){ - searchCriteria.put(PROPERTY_ID_PARAM, moduleSearchCriteria.get(PROPERTY_ID_PARAM)); - } - if(moduleSearchCriteria.containsKey(SW_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(SW_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(SW_APPLICATION_NUMBER_PARAM)); - } - if(moduleSearchCriteria.containsKey(SW_APPLICATION_SEARCH_TYPE_PARAM)) { - searchCriteria.put(SW_APPLICATION_SEARCH_TYPE_PARAM, moduleSearchCriteria.get(SW_APPLICATION_SEARCH_TYPE_PARAM)); - } - if(moduleSearchCriteria.containsKey(SW_CONNECTION_NO_PARAM)){ - searchCriteria.put(SW_CONNECTION_NO_PARAM, moduleSearchCriteria.get(SW_CONNECTION_NO_PARAM)); - } - if(moduleSearchCriteria.containsKey("appStatus")){ - searchCriteria.put(SW_APPLICATION_STATUS_PARAM, moduleSearchCriteria.get("appStatus")); - } - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(WS_ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if(!ObjectUtils.isEmpty(processCriteria.getStatus())){ - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - }else{ - if(StatusIdNameMap.values().size() > 0) { - if(CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - // Paginating searcher results - searchCriteria.put(OFFSET_PARAM, criteria.getOffset()); - searchCriteria.put(NO_OF_RECORDS_PARAM, criteria.getLimit()); - //moduleSearchCriteria.put(LIMIT_PARAM, criteria.getLimit()); - - searcherRequest.put(SW_REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SW_SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - if(moduleSearchCriteria.containsKey(SORT_ORDER_PARAM) && moduleSearchCriteria.get(SORT_ORDER_PARAM).equals(DESC_PARAM)){ - uri.append(searcherHost).append(swInboxSearcherDescEndpoint); - }else { - uri.append(searcherHost).append(swInboxSearcherEndpoint); - } - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - applicationNumbers = JsonPath.read(result, "$.SewerageConnections.*.applicationno"); - - } - return applicationNumbers; - } - - public Integer fetchApplicationCountFromSearcher(InboxSearchCriteria criteria, HashMap StatusIdNameMap, RequestInfo requestInfo){ - Integer totalCount = 0; - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - isMobileNumberPresent = true; - } - if(isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if(isSearchResultEmpty){ - return 0; - } - } - - if(!isSearchResultEmpty){ - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); - - // Accomodating module search criteria in searcher request - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)){ - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if(moduleSearchCriteria.containsKey(PROPERTY_ID_PARAM)){ - searchCriteria.put(PROPERTY_ID_PARAM, moduleSearchCriteria.get(PROPERTY_ID_PARAM)); - } - if(moduleSearchCriteria.containsKey(SW_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(SW_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(SW_APPLICATION_NUMBER_PARAM)); - } - if(moduleSearchCriteria.containsKey(SW_APPLICATION_TYPE_PARAM)) { - searchCriteria.put(SW_APPLICATION_TYPE_PARAM, moduleSearchCriteria.get(SW_APPLICATION_TYPE_PARAM)); - } - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(USERID_PARAM, processCriteria.getAssignee()); - } - if(moduleSearchCriteria.containsKey(SW_CONNECTION_NO_PARAM)){ - searchCriteria.put(SW_CONNECTION_NO_PARAM, moduleSearchCriteria.get(SW_CONNECTION_NO_PARAM)); - } - if(moduleSearchCriteria.containsKey("appStatus")){ - searchCriteria.put(WS_APPLICATION_STATUS_PARAM, moduleSearchCriteria.get("appStatus")); - } - - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(WS_ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if(!ObjectUtils.isEmpty(processCriteria.getStatus())){ - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - }else{ - if(StatusIdNameMap.values().size() > 0) { - if(CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - // Paginating searcher results - - searcherRequest.put(SW_REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SW_SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - uri.append(searcherHost).append(swInboxSearcherCountEndpoint); - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - double count = JsonPath.read(result, "$.TotalCount[0].count"); - totalCount = new Integer((int) count); - - } - return totalCount; - } - - - private List fetchUserUUID(String mobileNumber, RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - uri.append(userHost).append(userSearchEndpoint); - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("userType", "CITIZEN"); - userSearchRequest.put("mobileNumber", mobileNumber); - List userUuids = new ArrayList<>(); - try { - Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); - if(null != user) { - //log.info(user.toString()); - userUuids = JsonPath.read(user, "$.user.*.uuid"); - }else { - log.error("Service returned null while fetching user for mobile number - " + mobileNumber); - } - }catch(Exception e) { - log.error("Exception while fetching user for mobile number - " + mobileNumber); - log.error("Exception trace: ", e); - } - return userUuids; - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/TLInboxFilterService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/TLInboxFilterService.java deleted file mode 100644 index 1e35e0d34cd..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/TLInboxFilterService.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.egov.inbox.service; - -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.util.BpaConstants; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.web.client.RestTemplate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static org.egov.inbox.util.BpaConstants.BPAREG; -import static org.egov.inbox.util.BpaConstants.MOBILE_NUMBER_PARAM; -import static org.egov.inbox.util.TLConstants.*; - -@Slf4j -@Service -public class TLInboxFilterService { - - @Value("${egov.user.host}") - private String userHost; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.searcher.host}") - private String searcherHost; - - @Value("${egov.searcher.tl.search.path}") - private String tlInboxSearcherEndpoint; - - @Value("${egov.searcher.tl.search.desc.path}") - private String tlInboxSearcherDescEndpoint; - - @Value("${egov.searcher.tl.count.path}") - private String tlInboxSearcherCountEndpoint; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - public List fetchApplicationNumbersFromSearcher(InboxSearchCriteria criteria, HashMap StatusIdNameMap, RequestInfo requestInfo){ - List acknowledgementNumbers = new ArrayList<>(); - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - moduleSearchCriteria = setUserWhenMobileNoIsEmptyForStakeholderRegOfCitizen(criteria, requestInfo, moduleSearchCriteria, - processCriteria); - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - isMobileNumberPresent = true; - } - if(isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if(isSearchResultEmpty){ - return new ArrayList<>(); - } - } - - if(!isSearchResultEmpty){ - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); - searchCriteria.put(BUSINESS_SERVICE_PARAM,processCriteria.getBusinessService()); - - // Accomodating module search criteria in searcher request - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)){ - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if(moduleSearchCriteria.containsKey(LICENSE_NUMBER_PARAM)){ - searchCriteria.put(LICENSE_NUMBER_PARAM, moduleSearchCriteria.get(LICENSE_NUMBER_PARAM)); - } - if(moduleSearchCriteria.containsKey(APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(APPLICATION_NUMBER_PARAM)); - } - - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if(!ObjectUtils.isEmpty(processCriteria.getStatus())){ - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - }else{ - if(StatusIdNameMap.values().size() > 0) { - if(CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - // Paginating searcher results - searchCriteria.put(OFFSET_PARAM, criteria.getOffset()); - searchCriteria.put(NO_OF_RECORDS_PARAM, criteria.getLimit()); - moduleSearchCriteria.put(LIMIT_PARAM, criteria.getLimit()); - - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - if(moduleSearchCriteria.containsKey(SORT_ORDER_PARAM) && moduleSearchCriteria.get(SORT_ORDER_PARAM).equals(DESC_PARAM)){ - uri.append(searcherHost).append(tlInboxSearcherDescEndpoint); - }else { - uri.append(searcherHost).append(tlInboxSearcherEndpoint); - } - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - acknowledgementNumbers = JsonPath.read(result, "$.Licenses.*.applicationnumber"); - - } - return acknowledgementNumbers; - } - - private HashMap setUserWhenMobileNoIsEmptyForStakeholderRegOfCitizen(InboxSearchCriteria criteria, RequestInfo requestInfo, - HashMap moduleSearchCriteria, ProcessInstanceSearchCriteria processCriteria) { - List roles = requestInfo.getUserInfo().getRoles().stream().map(Role::getCode).collect(Collectors.toList()); - if(processCriteria.getModuleName().equals(BPAREG) && roles.contains(BpaConstants.CITIZEN)) { - if (moduleSearchCriteria == null || moduleSearchCriteria.isEmpty() || !moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)) { - moduleSearchCriteria = new HashMap<>(); - moduleSearchCriteria.put(MOBILE_NUMBER_PARAM, requestInfo.getUserInfo().getMobileNumber()); - criteria.setModuleSearchCriteria(moduleSearchCriteria); - } - } - return moduleSearchCriteria; - } - - public Integer fetchApplicationCountFromSearcher(InboxSearchCriteria criteria, HashMap StatusIdNameMap, RequestInfo requestInfo){ - Integer totalCount = 0; - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - moduleSearchCriteria = setUserWhenMobileNoIsEmptyForStakeholderRegOfCitizen(criteria, requestInfo, moduleSearchCriteria, - processCriteria); - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - isMobileNumberPresent = true; - } - if(isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if(isSearchResultEmpty){ - return 0; - } - } - - if(!isSearchResultEmpty){ - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); - - // Accomodating module search criteria in searcher request - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)){ - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if(moduleSearchCriteria.containsKey(LICENSE_NUMBER_PARAM)){ - searchCriteria.put(LICENSE_NUMBER_PARAM, moduleSearchCriteria.get(LICENSE_NUMBER_PARAM)); - } - if(moduleSearchCriteria.containsKey(APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(APPLICATION_NUMBER_PARAM)); - } - - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if(!ObjectUtils.isEmpty(processCriteria.getStatus())){ - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - }else{ - if(StatusIdNameMap.values().size() > 0) { - if(CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - searcherRequest.put(REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - uri.append(searcherHost).append(tlInboxSearcherCountEndpoint); - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - double count = JsonPath.read(result, "$.TotalCount[0].count"); - totalCount = new Integer((int) count); - } - return totalCount; - } - - - private List fetchUserUUID(String mobileNumber, RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - uri.append(userHost).append(userSearchEndpoint); - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("userType", "CITIZEN"); - userSearchRequest.put("mobileNumber", mobileNumber); - List userUuids = new ArrayList<>(); - try { - Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); - if(null != user) { - //log.info(user.toString()); - userUuids = JsonPath.read(user, "$.user.*.uuid"); - }else { - log.error("Service returned null while fetching user for mobile number - " + mobileNumber); - } - }catch(Exception e) { - log.error("Exception while fetching user for mobile number - " + mobileNumber); - log.error("Exception trace: ", e); - } - return userUuids; - } - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/V2/InboxServiceV2.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/V2/InboxServiceV2.java deleted file mode 100644 index 3e39a20fce2..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/V2/InboxServiceV2.java +++ /dev/null @@ -1,420 +0,0 @@ -package org.egov.inbox.service.V2; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.wnameless.json.flattener.JsonFlattener; -import com.google.gson.Gson; -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; -import org.egov.hash.HashService; -import org.egov.inbox.config.InboxConfiguration; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.repository.builder.V2.InboxQueryBuilder; -import org.egov.inbox.service.V2.validator.ValidatorDefaultImplementation; -import org.egov.inbox.service.WorkflowService; -import org.egov.inbox.util.MDMSUtil; -import org.egov.inbox.web.model.Inbox; -import org.egov.inbox.web.model.InboxRequest; -import org.egov.inbox.web.model.InboxResponse; -import org.egov.inbox.web.model.V2.*; -import org.egov.inbox.web.model.workflow.BusinessService; -import org.egov.inbox.web.model.workflow.ProcessInstance; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; - -import java.util.*; - -import static org.egov.inbox.util.InboxConstants.*; - -@Service -@Slf4j -public class InboxServiceV2 { - - @Autowired - private InboxConfiguration config; - - @Autowired - private InboxQueryBuilder queryBuilder; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Autowired - private WorkflowService workflowService; - - @Autowired - private ValidatorDefaultImplementation validator; - - @Autowired - private MDMSUtil mdmsUtil; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private HashService hashService; - - - /** - * - * @param inboxRequest - * @return - */ - public InboxResponse getInboxResponse(InboxRequest inboxRequest){ - - validator.validateSearchCriteria(inboxRequest); - InboxQueryConfiguration inboxQueryConfiguration = mdmsUtil.getConfigFromMDMS(inboxRequest.getInbox().getTenantId(), inboxRequest.getInbox().getProcessSearchCriteria().getModuleName()); - hashParamsWhereverRequiredBasedOnConfiguration(inboxRequest.getInbox().getModuleSearchCriteria(), inboxQueryConfiguration); - List items = getInboxItems(inboxRequest, inboxQueryConfiguration.getIndex()); - enrichProcessInstanceInInboxItems(items); - Integer totalCount = CollectionUtils.isEmpty(inboxRequest.getInbox().getProcessSearchCriteria().getStatus()) ? 0 : getTotalApplicationCount(inboxRequest, inboxQueryConfiguration.getIndex()); - List> statusCountMap = CollectionUtils.isEmpty(inboxRequest.getInbox().getProcessSearchCriteria().getStatus()) ? new ArrayList<>() : getStatusCountMap(inboxRequest, inboxQueryConfiguration.getIndex()); - Integer nearingSlaCount = CollectionUtils.isEmpty(inboxRequest.getInbox().getProcessSearchCriteria().getStatus()) ? 0 : getApplicationsNearingSlaCount(inboxRequest, inboxQueryConfiguration.getIndex()); - InboxResponse inboxResponse = InboxResponse.builder().items(items).totalCount(totalCount).statusMap(statusCountMap).nearingSlaCount(nearingSlaCount).build(); - - return inboxResponse; - } - - private void hashParamsWhereverRequiredBasedOnConfiguration(Map moduleSearchCriteria, InboxQueryConfiguration inboxQueryConfiguration) { - - inboxQueryConfiguration.getAllowedSearchCriteria().forEach(searchParam -> { - if(!ObjectUtils.isEmpty(searchParam.getIsHashingRequired()) && searchParam.getIsHashingRequired()){ - if(moduleSearchCriteria.containsKey(searchParam.getName())){ - if(moduleSearchCriteria.get(searchParam.getName()) instanceof List){ - List hashedParams = new ArrayList<>(); - ((List) moduleSearchCriteria.get(searchParam.getName())).forEach(object -> { - hashedParams.add(hashService.getHashValue(object)); - }); - moduleSearchCriteria.put(searchParam.getName(), hashedParams); - }else{ - Object hashedValue = hashService.getHashValue(moduleSearchCriteria.get(searchParam.getName())); - moduleSearchCriteria.put(searchParam.getName(), hashedValue); - } - } - } - }); - } - - private void enrichProcessInstanceInInboxItems(List items) { - /* - As part of the new inbox, having currentProcessInstance as part of the index is mandated. This has been - done to avoid having redundant network calls which could hog the performance. - */ - items.forEach(item -> { - if(item.getBusinessObject().containsKey(CURRENT_PROCESS_INSTANCE_CONSTANT)) { - // Set process instance object in the native process instance field declared in the model inbox class. - ProcessInstance processInstance = mapper.convertValue(item.getBusinessObject().get(CURRENT_PROCESS_INSTANCE_CONSTANT), ProcessInstance.class); - item.setProcessInstance(processInstance); - - // Remove current process instance from business object in order to avoid having redundant data in response. - item.getBusinessObject().remove(CURRENT_PROCESS_INSTANCE_CONSTANT); - } - }); - } - - private List getInboxItems(InboxRequest inboxRequest, String indexName){ - List businessServices = workflowService.getBusinessServices(inboxRequest); - enrichActionableStatusesFromRole(inboxRequest, businessServices); - if(CollectionUtils.isEmpty(inboxRequest.getInbox().getProcessSearchCriteria().getStatus())){ - return new ArrayList<>(); - } - Map finalQueryBody = queryBuilder.getESQuery(inboxRequest, Boolean.TRUE); - try { - String q = mapper.writeValueAsString(finalQueryBody); - log.info("Query: "+q); - } - catch (Exception e){ - e.printStackTrace(); - } - StringBuilder uri = getURI(indexName, SEARCH_PATH); - Object result = serviceRequestRepository.fetchResult(uri, finalQueryBody); - List inboxItemsList = parseInboxItemsFromSearchResponse(result, businessServices); - log.info(result.toString()); - return inboxItemsList; - } - - private void enrichActionableStatusesFromRole(InboxRequest inboxRequest, List businessServices) { - ProcessInstanceSearchCriteria processCriteria = inboxRequest.getInbox().getProcessSearchCriteria(); - String tenantId = inboxRequest.getInbox().getTenantId(); - processCriteria.setTenantId(tenantId); - - HashMap StatusIdNameMap = workflowService.getActionableStatusesForRole(inboxRequest.getRequestInfo(), businessServices, - inboxRequest.getInbox().getProcessSearchCriteria()); - log.info(StatusIdNameMap.toString()); - List actionableStatusUuid = new ArrayList<>(); - if (StatusIdNameMap.values().size() > 0) { - if (!CollectionUtils.isEmpty(processCriteria.getStatus())) { - processCriteria.getStatus().forEach(statusUuid -> { - if(StatusIdNameMap.keySet().contains(statusUuid)){ - actionableStatusUuid.add(statusUuid); - } - }); - inboxRequest.getInbox().getProcessSearchCriteria().setStatus(actionableStatusUuid); - } else { - inboxRequest.getInbox().getProcessSearchCriteria().setStatus(new ArrayList<>(StatusIdNameMap.keySet())); - } - }else{ - inboxRequest.getInbox().getProcessSearchCriteria().setStatus(new ArrayList<>()); - } - } - - public Integer getTotalApplicationCount(InboxRequest inboxRequest, String indexName){ - - Map finalQueryBody = queryBuilder.getESQuery(inboxRequest, Boolean.FALSE); - StringBuilder uri = getURI(indexName, COUNT_PATH); - Map response = (Map) serviceRequestRepository.fetchResult(uri, finalQueryBody); - Integer totalCount = 0; - if(response.containsKey(COUNT_CONSTANT)){ - totalCount = (Integer) response.get(COUNT_CONSTANT); - }else{ - throw new CustomException("INBOX_COUNT_ERR", "Error occurred while executing ES count query"); - } - return totalCount; - } - - public List> getStatusCountMap(InboxRequest inboxRequest, String indexName){ - Map finalQueryBody = queryBuilder.getStatusCountQuery(inboxRequest); - StringBuilder uri = getURI(indexName, SEARCH_PATH); - Map response = (Map) serviceRequestRepository.fetchResult(uri, finalQueryBody); - Set actionableStatuses = new HashSet<>(inboxRequest.getInbox().getProcessSearchCriteria().getStatus()); - HashMap statusCountMap = parseStatusCountMapFromAggregationResponse(response, actionableStatuses); - List> transformedStatusMap = transformStatusMap(inboxRequest, statusCountMap); - return transformedStatusMap; - } - - private Long getApplicationServiceSla(Map businessServiceSlaMap, Map stateUuidSlaMap, Object data) { - - Long currentDate = System.currentTimeMillis(); //current time - Map auditDetails = (Map) ((Map) data).get(AUDIT_DETAILS_KEY); - String stateUuid = JsonPath.read(data, STATE_UUID_PATH); - if(stateUuidSlaMap.containsKey(stateUuid)){ - if (!ObjectUtils.isEmpty(auditDetails.get(LAST_MODIFIED_TIME_KEY))) { - Long lastModifiedTime = ((Number) auditDetails.get(LAST_MODIFIED_TIME_KEY)).longValue(); - - return Long.valueOf(Math.round((stateUuidSlaMap.get(stateUuid) - (currentDate - lastModifiedTime)) / ((double) (24 * 60 * 60 * 1000)))); - } - }else { - if (!ObjectUtils.isEmpty(auditDetails.get(CREATED_TIME_KEY))) { - Long createdTime = ((Number) auditDetails.get(CREATED_TIME_KEY)).longValue(); - String businessService = JsonPath.read(data, BUSINESS_SERVICE_PATH); - Long businessServiceSLA = businessServiceSlaMap.get(businessService); - - return Long.valueOf(Math.round((businessServiceSLA - (currentDate - createdTime)) / ((double) (24 * 60 * 60 * 1000)))); - } - } - return null; - } - - private List> transformStatusMap(InboxRequest request,HashMap statusCountMap) { - - if(CollectionUtils.isEmpty(statusCountMap)) - return null; - - List businessServices = workflowService.getBusinessServices(request); - - Map statusIdToBusinessServiceMap = workflowService.getStatusIdToBusinessServiceMap(businessServices); - Map statusIdToApplicationStatusMap = workflowService.getApplicationStatusIdToStatusMap(businessServices); - - List> statusCountMapTransformed = new ArrayList<>(); - - for(Map.Entry entry : statusCountMap.entrySet()){ - String statusId = entry.getKey(); - Integer count = (Integer) entry.getValue(); - HashMap map = new HashMap<>(); - map.put(COUNT_CONSTANT, count); - map.put(APPLICATION_STATUS_KEY,statusIdToApplicationStatusMap.get(statusId)); - map.put(BUSINESSSERVICE_KEY,statusIdToBusinessServiceMap.get(statusId)); - map.put(STATUSID_KEY, statusId); - statusCountMapTransformed.add(map); - } - return statusCountMapTransformed; - } - - private HashMap parseStatusCountMapFromAggregationResponse(Map response, Set actionableStatuses) { - List> statusCountResponse = new ArrayList<>(); - if(!CollectionUtils.isEmpty((Map) response.get(AGGREGATIONS_KEY))){ - List> statusCountBuckets = JsonPath.read(response, STATUS_COUNT_AGGREGATIONS_BUCKETS_PATH); - HashMap statusCountMap = new HashMap<>(); - statusCountBuckets.forEach(bucket -> { - if(actionableStatuses.contains(bucket.get(KEY))) - statusCountMap.put((String)bucket.get(KEY), bucket.get(DOC_COUNT_KEY)); - }); - statusCountResponse.add(statusCountMap); - } - if(CollectionUtils.isEmpty(statusCountResponse)) - return null; - - return statusCountResponse.get(0); - } - - private List parseInboxItemsFromSearchResponse(Object result, List businessServices) { - Map hits = (Map)((Map) result).get(HITS); - List> nestedHits = (List>) hits.get(HITS); - if(CollectionUtils.isEmpty(nestedHits)){ - return new ArrayList<>(); - } - - Map businessServiceSlaMap = new HashMap<>(); - Map stateUuidVsSlaMap = new HashMap<>(); - - businessServices.forEach(businessService -> { - businessServiceSlaMap.put(businessService.getBusinessService(),businessService.getBusinessServiceSla()); - businessService.getStates().forEach(state -> { - if(!ObjectUtils.isEmpty(state.getSla())) - stateUuidVsSlaMap.put(state.getUuid(), state.getSla()); - }); - }); - - List inboxItemList = new ArrayList<>(); - nestedHits.forEach(hit ->{ - Inbox inbox = new Inbox(); - Map businessObject = (Map) hit.get(SOURCE_KEY); - inbox.setBusinessObject((Map)businessObject.get(DATA_KEY)); - Long serviceSla = getApplicationServiceSla(businessServiceSlaMap, stateUuidVsSlaMap, inbox.getBusinessObject()); inbox.getBusinessObject().put(SERVICESLA_KEY, serviceSla); - inboxItemList.add(inbox); - }); - return inboxItemList; - } - - public Integer getApplicationsNearingSlaCount(InboxRequest inboxRequest, String indexName) { - List businessServicesObjs = workflowService.getBusinessServices(inboxRequest); - Map businessServiceSlaMap = new HashMap<>(); - Map> businessServiceVsStateUuids = new HashMap<>(); - businessServicesObjs.forEach(businessService -> { - List listOfUuids = new ArrayList<>(); - businessService.getStates().forEach(state -> { - listOfUuids.add(state.getUuid()); - }); - businessServiceVsStateUuids.put(businessService.getBusinessService(), new HashSet<>(listOfUuids)); - businessServiceSlaMap.put(businessService.getBusinessService(),businessService.getBusinessServiceSla()); - }); - - List uuidsInSearchCriteria = inboxRequest.getInbox().getProcessSearchCriteria().getStatus(); - - Map> businessServiceVsUuidsBasedOnSearchCriteria = new HashMap<>(); - - // If status uuids are being passed in process search criteria, segregating them based on their business service - if(!CollectionUtils.isEmpty(uuidsInSearchCriteria)) { - uuidsInSearchCriteria.forEach(uuid -> { - businessServiceVsStateUuids.keySet().forEach(businessService -> { - HashSet setOfUuids = businessServiceVsStateUuids.get(businessService); - if (setOfUuids.contains(uuid)) { - if (businessServiceVsUuidsBasedOnSearchCriteria.containsKey(businessService)) { - businessServiceVsUuidsBasedOnSearchCriteria.get(businessService).add(uuid); - } else { - businessServiceVsUuidsBasedOnSearchCriteria.put(businessService, new ArrayList<>(Collections.singletonList(uuid))); - } - } - }); - - }); - }else{ - businessServiceVsStateUuids.keySet().forEach(businessService -> { - HashSet setOfUuids = businessServiceVsStateUuids.get(businessService); - businessServiceVsUuidsBasedOnSearchCriteria.put(businessService, new ArrayList<>(setOfUuids)); - }); - } - - - - List businessServices = new ArrayList<>(businessServiceVsUuidsBasedOnSearchCriteria.keySet()); - Integer totalCount = 0; - // Fetch slot percentage only once here !!!!!!!!!! - - - for(int i = 0; i < businessServices.size(); i++){ - String businessService = businessServices.get(i); - Long businessServiceSla = businessServiceSlaMap.get(businessService); - inboxRequest.getInbox().getProcessSearchCriteria().setStatus(businessServiceVsUuidsBasedOnSearchCriteria.get(businessService)); - Map finalQueryBody = queryBuilder.getNearingSlaCountQuery(inboxRequest, businessServiceSla); - StringBuilder uri = getURI(indexName, COUNT_PATH); - Map response = (Map) serviceRequestRepository.fetchResult(uri, finalQueryBody); - Integer currentCount = 0; - if(response.containsKey(COUNT_CONSTANT)){ - currentCount = (Integer) response.get(COUNT_CONSTANT); - }else{ - throw new CustomException("INBOX_COUNT_ERR", "Error occurred while executing ES count query"); - } - totalCount += currentCount; - } - - return totalCount; - - } - - - private StringBuilder getURI(String indexName, String endpoint){ - StringBuilder uri = new StringBuilder(config.getIndexServiceHost()); - uri.append(indexName); - uri.append(endpoint); - return uri; - } - - public SearchResponse getSpecificFieldsFromESIndex(SearchRequest searchRequest) { - String tenantId = searchRequest.getIndexSearchCriteria().getTenantId(); - String moduleName = searchRequest.getIndexSearchCriteria().getModuleName(); - Map moduleSearchCriteria = searchRequest.getIndexSearchCriteria().getModuleSearchCriteria(); - - validator.validateSearchCriteria(tenantId, moduleName, moduleSearchCriteria); - InboxQueryConfiguration inboxQueryConfiguration = mdmsUtil.getConfigFromMDMS(tenantId, moduleName); - hashParamsWhereverRequiredBasedOnConfiguration(moduleSearchCriteria, inboxQueryConfiguration); - List data = getDataFromSimpleSearch(searchRequest, inboxQueryConfiguration.getIndex()); - SearchResponse searchResponse = SearchResponse.builder().data(data).build(); - return searchResponse; - } - - private List getDataFromSimpleSearch(SearchRequest searchRequest, String index) { - Map finalQueryBody = queryBuilder.getESQueryForSimpleSearch(searchRequest, Boolean.TRUE); - try { - String q = mapper.writeValueAsString(finalQueryBody); - log.info("Query: "+q); - } - catch (Exception e){ - e.printStackTrace(); - } - StringBuilder uri = getURI(index, SEARCH_PATH); - Object result = serviceRequestRepository.fetchResult(uri, finalQueryBody); - List dataList = parseSearchResponseForSimpleSearch(result); - return dataList; - } - - private List parseSearchResponseForSimpleSearch(Object result) { - Map hits = (Map)((Map) result).get(HITS); - List> nestedHits = (List>) hits.get(HITS); - if(CollectionUtils.isEmpty(nestedHits)){ - return new ArrayList<>(); - } - - List dataList = new ArrayList<>(); - nestedHits.forEach(hit -> { - Data data = new Data(); - Map sourceObject = (Map) hit.get(SOURCE_KEY); - Map dataObject = (Map)sourceObject.get(DATA_KEY); - List fields = getFieldsFromDataObject(dataObject); - data.setFields(fields); - dataList.add(data); - }); - - return dataList; - } - - private List getFieldsFromDataObject(Map dataObject) { - List listOfFields = new ArrayList<>(); - try { - Map flattenedDataObject = JsonFlattener.flattenAsMap(mapper.writeValueAsString(dataObject)); - flattenedDataObject.keySet().forEach(key -> { - Field field = new Field(); - field.setKey(key); - field.setValue(flattenedDataObject.get(key)); - listOfFields.add(field); - }); - }catch (JsonProcessingException ex){ - throw new CustomException("EG_INBOX_GET_FIELDS_ERR", "Error while processing JSON."); - } - return listOfFields; - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/V2/validator/SearchCriteriaValidatorInterface.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/V2/validator/SearchCriteriaValidatorInterface.java deleted file mode 100644 index 675aaf4a150..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/V2/validator/SearchCriteriaValidatorInterface.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.inbox.service.V2.validator; - -import org.egov.inbox.web.model.InboxRequest; -import org.egov.tracer.model.CustomException; - -public interface SearchCriteriaValidatorInterface { - - /** - * This method will validate if the input search criteria is - * valid or not for the given module. It will return true if - * the criteria is valid else it will return false - * @param inboxRequest - * @return - */ - public void validateSearchCriteria(InboxRequest inboxRequest) throws CustomException; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/V2/validator/ValidatorDefaultImplementation.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/V2/validator/ValidatorDefaultImplementation.java deleted file mode 100644 index 680891ba008..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/V2/validator/ValidatorDefaultImplementation.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.egov.inbox.service.V2.validator; - - -import java.util.Map.Entry; -import java.util.Set; -import java.util.stream.Collectors; -import org.egov.inbox.util.MDMSUtil; -import org.egov.inbox.web.model.InboxRequest; -import org.egov.inbox.web.model.V2.InboxQueryConfiguration; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; - -import java.util.HashMap; -import java.util.Map; - -import static org.egov.inbox.util.InboxConstants.SORT_BY_CONSTANT; -import static org.egov.inbox.util.InboxConstants.SORT_ORDER_CONSTANT; - -@Component -public class ValidatorDefaultImplementation implements SearchCriteriaValidatorInterface { - - - @Autowired - private MDMSUtil mdmsUtil; - - @Override - public void validateSearchCriteria(InboxRequest inboxRequest) { - InboxQueryConfiguration config = mdmsUtil.getConfigFromMDMS(inboxRequest.getInbox().getTenantId(), inboxRequest.getInbox().getProcessSearchCriteria().getModuleName()); - - Map isMandatoryMap = new HashMap<>(); - - config.getAllowedSearchCriteria().forEach( - searchParam -> { - isMandatoryMap.put(searchParam.getName(), ObjectUtils.isEmpty(searchParam.getIsMandatory()) ? Boolean.FALSE : searchParam.getIsMandatory()); - } - ); - - HashMap moduleSearchCriteria = inboxRequest.getInbox().getModuleSearchCriteria(); - - // Check if all mandatory fields exist in search criteria - Set mandatoryTrueFields = isMandatoryMap.entrySet().stream() - .filter(entry -> Boolean.TRUE.equals(entry.getValue())) - .map(Entry::getKey) - .collect(Collectors.toSet()); - if (!mandatoryTrueFields.isEmpty() && !moduleSearchCriteria.keySet() - .containsAll(mandatoryTrueFields)) { - throw new CustomException("INVALID_SEARCH_CRITERIA", - "Mandatory fields are missing in the moduleSearchCriteria"); - } - - Map errorMap = new HashMap<>(); - for(Map.Entry entry: moduleSearchCriteria.entrySet()){ - - String key = entry.getKey(); - Object value = entry.getValue(); - - if(!(key.equals(SORT_ORDER_CONSTANT) || key.equals(SORT_BY_CONSTANT))) { - - if (isMandatoryMap.get(key)) { - if (ObjectUtils.isEmpty(value)) { - errorMap.put("INVALID_SEARCH_CRITERIA", "Field cannot be null or empty: " + key); - } - } - } - } - - if(!CollectionUtils.isEmpty(errorMap)) - throw new CustomException(errorMap); - - } - - public void validateSearchCriteria(String tenantId, String moduleName, Map moduleSearchCriteria) { - InboxQueryConfiguration config = mdmsUtil.getConfigFromMDMS(tenantId, moduleName); - - Map isMandatoryMap = new HashMap<>(); - - config.getAllowedSearchCriteria().forEach( - searchParam -> { - isMandatoryMap.put(searchParam.getName(), ObjectUtils.isEmpty(searchParam.getIsMandatory()) ? Boolean.FALSE : searchParam.getIsMandatory()); - } - ); - - Map errorMap = new HashMap<>(); - for(Map.Entry entry: moduleSearchCriteria.entrySet()){ - - String key = entry.getKey(); - Object value = entry.getValue(); - - if(!(key.equals(SORT_ORDER_CONSTANT) || key.equals(SORT_BY_CONSTANT))) { - - if (isMandatoryMap.get(key)) { - if (ObjectUtils.isEmpty(value)) { - errorMap.put("INVALID_SEARCH_CRITERIA", "Field cannot be null or empty: " + key); - } - } - } - } - - if(!CollectionUtils.isEmpty(errorMap)) - throw new CustomException(errorMap); - - } - - - - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/WSInboxFilterService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/WSInboxFilterService.java deleted file mode 100644 index 2d7a253b83c..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/WSInboxFilterService.java +++ /dev/null @@ -1,250 +0,0 @@ -package org.egov.inbox.service; - -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.RequestInfo; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.web.model.InboxSearchCriteria; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.web.client.RestTemplate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.egov.inbox.util.WSConstants.*; - -@Slf4j -@Service -public class WSInboxFilterService { - - @Value("${egov.user.host}") - private String userHost; - - @Value("${egov.user.search.path}") - private String userSearchEndpoint; - - @Value("${egov.searcher.host}") - private String searcherHost; - - @Value("${egov.searcher.ws.search.path}") - private String wsInboxSearcherEndpoint; - - @Value("${egov.searcher.ws.search.desc.path}") - private String wsInboxSearcherDescEndpoint; - - @Value("${egov.searcher.ws.count.path}") - private String wsInboxSearcherCountEndpoint; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - public List fetchApplicationNumbersFromSearcher(InboxSearchCriteria criteria, HashMap StatusIdNameMap, RequestInfo requestInfo){ - List applicationNumbers = new ArrayList<>(); - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - isMobileNumberPresent = true; - } - if(isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if(isSearchResultEmpty){ - return new ArrayList<>(); - } - } - - if(!isSearchResultEmpty){ - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); - searchCriteria.put(WS_BUSINESS_SERVICE_PARAM, processCriteria.getBusinessService()); - - // Accomodating module search criteria in searcher request - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)){ - searchCriteria.put(USERID_PARAM, userUUIDs); - } - /*if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - searchCriteria.put(MOBILE_NUMBER_PARAM, moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - }*/ - if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if(moduleSearchCriteria.containsKey(PROPERTY_ID_PARAM)){ - searchCriteria.put(PROPERTY_ID_PARAM, moduleSearchCriteria.get(PROPERTY_ID_PARAM)); - } - if(moduleSearchCriteria.containsKey(WS_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(WS_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(WS_APPLICATION_NUMBER_PARAM)); - } - if(moduleSearchCriteria.containsKey(WS_APPLICATION_TYPE_PARAM)) { - searchCriteria.put(WS_APPLICATION_TYPE_PARAM, moduleSearchCriteria.get(WS_APPLICATION_TYPE_PARAM)); - } - if(moduleSearchCriteria.containsKey(WS_CONNECTION_NO_PARAM)){ - searchCriteria.put(WS_CONNECTION_NO_PARAM, moduleSearchCriteria.get(WS_CONNECTION_NO_PARAM)); - } - if(moduleSearchCriteria.containsKey("appStatus")){ - searchCriteria.put(WS_APPLICATION_STATUS_PARAM, moduleSearchCriteria.get("appStatus")); - } - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(WS_ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if(!ObjectUtils.isEmpty(processCriteria.getStatus())){ - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - }else{ - if(StatusIdNameMap.values().size() > 0) { - if(CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - // Paginating searcher results - searchCriteria.put(OFFSET_PARAM, criteria.getOffset()); - searchCriteria.put(NO_OF_RECORDS_PARAM, criteria.getLimit()); - //moduleSearchCriteria.put(LIMIT_PARAM, criteria.getLimit()); - - searcherRequest.put(WS_REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(WS_SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - if(moduleSearchCriteria.containsKey(SORT_ORDER_PARAM) && moduleSearchCriteria.get(SORT_ORDER_PARAM).equals(DESC_PARAM)){ - uri.append(searcherHost).append(wsInboxSearcherDescEndpoint); - }else { - uri.append(searcherHost).append(wsInboxSearcherEndpoint); - } - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - applicationNumbers = JsonPath.read(result, "$.WaterConnections.*.applicationno"); - - } - return applicationNumbers; - } - - public Integer fetchApplicationCountFromSearcher(InboxSearchCriteria criteria, HashMap StatusIdNameMap, RequestInfo requestInfo){ - Integer totalCount = 0; - HashMap moduleSearchCriteria = criteria.getModuleSearchCriteria(); - ProcessInstanceSearchCriteria processCriteria = criteria.getProcessSearchCriteria(); - Boolean isSearchResultEmpty = false; - Boolean isMobileNumberPresent = false; - List userUUIDs = new ArrayList<>(); - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM)){ - isMobileNumberPresent = true; - } - if(isMobileNumberPresent) { - String tenantId = criteria.getTenantId(); - String mobileNumber = String.valueOf(moduleSearchCriteria.get(MOBILE_NUMBER_PARAM)); - userUUIDs = fetchUserUUID(mobileNumber, requestInfo, tenantId); - Boolean isUserPresentForGivenMobileNumber = CollectionUtils.isEmpty(userUUIDs) ? false : true; - isSearchResultEmpty = !isMobileNumberPresent || !isUserPresentForGivenMobileNumber; - if(isSearchResultEmpty){ - return 0; - } - } - - if(!isSearchResultEmpty){ - Object result = null; - - Map searcherRequest = new HashMap<>(); - Map searchCriteria = new HashMap<>(); - - searchCriteria.put(TENANT_ID_PARAM,criteria.getTenantId()); - - // Accomodating module search criteria in searcher request - if(moduleSearchCriteria.containsKey(MOBILE_NUMBER_PARAM) && !CollectionUtils.isEmpty(userUUIDs)){ - searchCriteria.put(USERID_PARAM, userUUIDs); - } - if(moduleSearchCriteria.containsKey(LOCALITY_PARAM)){ - searchCriteria.put(LOCALITY_PARAM, moduleSearchCriteria.get(LOCALITY_PARAM)); - } - if(moduleSearchCriteria.containsKey(PROPERTY_ID_PARAM)){ - searchCriteria.put(PROPERTY_ID_PARAM, moduleSearchCriteria.get(PROPERTY_ID_PARAM)); - } - if(moduleSearchCriteria.containsKey(WS_APPLICATION_NUMBER_PARAM)) { - searchCriteria.put(WS_APPLICATION_NUMBER_PARAM, moduleSearchCriteria.get(WS_APPLICATION_NUMBER_PARAM)); - } - if(moduleSearchCriteria.containsKey(WS_APPLICATION_TYPE_PARAM)) { - searchCriteria.put(WS_APPLICATION_TYPE_PARAM, moduleSearchCriteria.get(WS_APPLICATION_TYPE_PARAM)); - } - if(moduleSearchCriteria.containsKey(WS_CONNECTION_NO_PARAM)){ - searchCriteria.put(WS_CONNECTION_NO_PARAM, moduleSearchCriteria.get(WS_CONNECTION_NO_PARAM)); - } - if(moduleSearchCriteria.containsKey("appStatus")){ - searchCriteria.put(WS_APPLICATION_STATUS_PARAM, moduleSearchCriteria.get("appStatus")); - } - // Accomodating process search criteria in searcher request - if(!ObjectUtils.isEmpty(processCriteria.getAssignee())){ - searchCriteria.put(WS_ASSIGNEE_PARAM, processCriteria.getAssignee()); - } - if(!ObjectUtils.isEmpty(processCriteria.getStatus())){ - searchCriteria.put(STATUS_PARAM, processCriteria.getStatus()); - }else{ - if(StatusIdNameMap.values().size() > 0) { - if(CollectionUtils.isEmpty(processCriteria.getStatus())) { - searchCriteria.put(STATUS_PARAM, StatusIdNameMap.keySet()); - } - } - } - - // Paginating searcher results - - searcherRequest.put(WS_REQUESTINFO_PARAM, requestInfo); - searcherRequest.put(WS_SEARCH_CRITERIA_PARAM, searchCriteria); - - StringBuilder uri = new StringBuilder(); - uri.append(searcherHost).append(wsInboxSearcherCountEndpoint); - - result = restTemplate.postForObject(uri.toString(), searcherRequest, Map.class); - - double count = JsonPath.read(result, "$.TotalCount[0].count"); - totalCount = new Integer((int) count); - - } - return totalCount; - } - - - private List fetchUserUUID(String mobileNumber, RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - uri.append(userHost).append(userSearchEndpoint); - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", tenantId); - userSearchRequest.put("userType", "CITIZEN"); - userSearchRequest.put("mobileNumber", mobileNumber); - List userUuids = new ArrayList<>(); - try { - Object user = serviceRequestRepository.fetchResult(uri, userSearchRequest); - if(null != user) { - //log.info(user.toString()); - userUuids = JsonPath.read(user, "$.user.*.uuid"); - }else { - log.error("Service returned null while fetching user for mobile number - " + mobileNumber); - } - }catch(Exception e) { - log.error("Exception while fetching user for mobile number - " + mobileNumber); - log.error("Exception trace: ", e); - } - return userUuids; - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/service/WorkflowService.java b/accelerators/inbox/src/main/java/org/egov/inbox/service/WorkflowService.java deleted file mode 100644 index 70ae112d249..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/service/WorkflowService.java +++ /dev/null @@ -1,404 +0,0 @@ -package org.egov.inbox.service; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.inbox.config.InboxConfiguration; -import org.egov.inbox.repository.ServiceRequestRepository; -import org.egov.inbox.util.BpaConstants; -import org.egov.inbox.util.ErrorConstants; -import org.egov.inbox.util.FSMConstants; -import org.egov.inbox.web.model.InboxRequest; -import org.egov.inbox.web.model.RequestInfoWrapper; -import org.egov.inbox.web.model.workflow.BusinessService; -import org.egov.inbox.web.model.workflow.BusinessServiceResponse; -import org.egov.inbox.web.model.workflow.ProcessInstanceResponse; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; -import org.egov.tracer.model.CustomException; -import org.egov.inbox.web.model.workflow.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class WorkflowService { - - private InboxConfiguration config; - - private ServiceRequestRepository serviceRequestRepository; - - private ObjectMapper mapper; - - @Autowired - public WorkflowService(InboxConfiguration config, ServiceRequestRepository serviceRequestRepository, - ObjectMapper mapper) { - this.config = config; - this.serviceRequestRepository = serviceRequestRepository; - this.mapper = mapper; - } - - public Integer getProcessCount(String tenantId, RequestInfo requestInfo, ProcessInstanceSearchCriteria criteria) { - List listOfBusinessServices = new ArrayList<>(criteria.getBusinessService()); - Integer processCount = 0; - for(String businessSrv : listOfBusinessServices) { - criteria.setBusinessService(Collections.singletonList(businessSrv)); - StringBuilder url = new StringBuilder(config.getWorkflowHost()); - url.append(config.getProcessCountPath()); - criteria.setIsProcessCountCall(true); - url = this.buildWorkflowUrl(criteria, url, Boolean.FALSE); - - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - Object result = serviceRequestRepository.fetchIntResult(url, requestInfoWrapper); - Integer response = null; - try { - response = mapper.convertValue(result, Integer.class); - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of ProcessInstance Count"); - } - processCount += response; - } - criteria.setBusinessService(listOfBusinessServices); - return processCount; - } - - public Integer getNearingSlaProcessCount(String tenantId, RequestInfo requestInfo, ProcessInstanceSearchCriteria criteria) { - List listOfBusinessServices = new ArrayList<>(criteria.getBusinessService()); - Integer processCount = 0; - for(String businessSrv : listOfBusinessServices) { - criteria.setBusinessService(Collections.singletonList(businessSrv)); - StringBuilder url = new StringBuilder(config.getWorkflowHost()); - url.append(config.getNearingSlaProcessCountPath()); - criteria.setIsProcessCountCall(true); - url = this.buildWorkflowUrl(criteria, url, Boolean.FALSE); - - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - Object result = serviceRequestRepository.fetchIntResult(url, requestInfoWrapper); - Integer response = null; - try { - response = mapper.convertValue(result, Integer.class); - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of ProcessInstance Count"); - } - processCount += response; - } - criteria.setBusinessService(listOfBusinessServices); - return processCount; - } - - public List> getProcessStatusCount(RequestInfo requestInfo, - ProcessInstanceSearchCriteria criteria) { - List listOfBusinessServices = new ArrayList<>(criteria.getBusinessService()); - List> finalResponse = null; - for (String businessSrv : listOfBusinessServices) { - criteria.setBusinessService(Collections.singletonList(businessSrv)); - StringBuilder url = new StringBuilder(config.getWorkflowHost()); - url.append(config.getProcessStatusCountPath()); - criteria.setIsProcessCountCall(true); - // For BPA having large request, so that it was sending from the body - List roles = requestInfo.getUserInfo().getRoles().stream().map(Role::getCode).collect(Collectors.toList()); - if ((!ObjectUtils.isEmpty(criteria.getModuleName()) && !criteria.getModuleName().equalsIgnoreCase(BpaConstants.BPA)) - || (!ObjectUtils.isEmpty(criteria.getModuleName()) && - criteria.getModuleName().equalsIgnoreCase(BpaConstants.BPA) && !roles.contains(BpaConstants.CITIZEN))) - url = this.buildWorkflowUrl(criteria, url, Boolean.FALSE); - if (requestInfo.getUserInfo().getRoles().get(0).getCode().equals(FSMConstants.FSM_DSO)) { - url.append("&assignee=").append(requestInfo.getUserInfo().getUuid()); - } - - if (criteria != null && !ObjectUtils.isEmpty(criteria.getModuleName()) && criteria.getModuleName().equalsIgnoreCase(BpaConstants.BPA) - && roles.contains(BpaConstants.CITIZEN)) { - List inputBusinessSrvs = new ArrayList<>(criteria.getBusinessService()); - criteria.setBusinessService(null); - Map statusRequest = new HashMap<>(); - statusRequest.put("RequestInfo", requestInfo); - statusRequest.put("ProcessInstanceSearchCriteria", criteria); - finalResponse = (List>) serviceRequestRepository.fetchListResult(url, statusRequest); - criteria.setBusinessService(inputBusinessSrvs); - } else { - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - if (finalResponse == null) { - finalResponse = (List>) serviceRequestRepository.fetchListResult(url, - requestInfoWrapper); - } else { - finalResponse.addAll( - (List>) serviceRequestRepository.fetchListResult(url, requestInfoWrapper)); - } - } - } - criteria.setBusinessService(listOfBusinessServices); - return finalResponse; - } - - public ProcessInstanceResponse getProcessInstance(ProcessInstanceSearchCriteria criteria, RequestInfo requestInfo) { - StringBuilder url = new StringBuilder(config.getWorkflowHost()); - url.append( config.getProcessSearchPath()); - url = this.buildWorkflowUrl(criteria, url, Boolean.FALSE); - if(requestInfo.getUserInfo().getRoles().get(0).getCode().equals(FSMConstants.FSM_DSO)) { - url.append("&assignee=").append( requestInfo.getUserInfo().getUuid()); - } - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - Object result = serviceRequestRepository.fetchResult(url, requestInfoWrapper); - ProcessInstanceResponse resposne =null; - try { - resposne = mapper.convertValue(result, ProcessInstanceResponse.class); - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of ProcessInstance"); - } - return resposne; - } - /** - * Get the workflow config for the given tenant - * - * @param tenantId - * id of the tenant - * @param requestInfo - * The RequestInfo object of the request - * @param businessServiceName - * businessService code - * @return BusinessService for the the given tenantId - */ - public BusinessService getBusinessService(String tenantId, RequestInfo requestInfo, String businessServceName) { - StringBuilder url = getSearchURLWithParams(tenantId, businessServceName); - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - Object result = serviceRequestRepository.fetchResult(url, requestInfoWrapper); - BusinessServiceResponse response = null; - try { - response = mapper.convertValue(result, BusinessServiceResponse.class); - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of Workflow"); - } - return response.getBusinessServices().get(0); - } - - - @Cacheable(value="businessServices") - public List getBusinessServices(InboxRequest request) { - String tenantId = request.getInbox().getTenantId(); - RequestInfo requestInfo = request.getRequestInfo() ; - List businessServicesCodes = request.getInbox().getProcessSearchCriteria().getBusinessService(); - String businessServiceList = String.join(",",businessServicesCodes); - StringBuilder url = getSearchURLWithParams(tenantId, businessServiceList); - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - Object result = serviceRequestRepository.fetchResult(url, requestInfoWrapper); - BusinessServiceResponse response = null; - try { - response = mapper.convertValue(result, BusinessServiceResponse.class); - } catch (IllegalArgumentException e) { - throw new CustomException(ErrorConstants.PARSING_ERROR, "Failed to parse response of Workflow"); - } - return response.getBusinessServices(); - } - - - public Map getStatusIdToBusinessServiceMap(List businessServices){ - - Map statusIdToBusinessServiceMap = new HashMap<>(); - - businessServices.forEach(businessService -> { - businessService.getStates().forEach(state -> { - statusIdToBusinessServiceMap.put(state.getUuid(), businessService.getBusinessService()); - } - ); - }); - - return statusIdToBusinessServiceMap; - } - - public Map getApplicationStatusIdToStatusMap(List businessServices){ - - Map statusIdToApplicationStatusMap = new HashMap<>(); - - businessServices.forEach(businessService -> { - businessService.getStates().forEach(state -> { - statusIdToApplicationStatusMap.put(state.getUuid(), state.getApplicationStatus()); - } - ); - }); - - return statusIdToApplicationStatusMap; - } - - - private StringBuilder buildWorkflowUrl(ProcessInstanceSearchCriteria criteria, StringBuilder url,boolean noStatus) { - url.append("?tenantId=").append(criteria.getTenantId()); - if(!CollectionUtils.isEmpty(criteria.getStatus()) && noStatus == Boolean.FALSE) { - url.append("&status=").append(StringUtils.arrayToDelimitedString(criteria.getStatus().toArray(),",")); - } - - if(!CollectionUtils.isEmpty(criteria.getBusinessIds())) { - url.append("&businessIds=").append(StringUtils.arrayToDelimitedString(criteria.getBusinessIds().toArray(),",")); - } - - if(!CollectionUtils.isEmpty(criteria.getIds())) { - url.append("&ids=").append(StringUtils.arrayToDelimitedString(criteria.getIds().toArray(),",")); - } - if(!StringUtils.isEmpty(criteria.getAssignee())) { - url.append("&assignee=").append( criteria.getAssignee()); - } - if(criteria.getHistory() != null) { - url.append("&history=").append( criteria.getHistory()); - } - if(criteria.getFromDate() != null) { - url.append("&fromDate=").append( criteria.getFromDate()); - } - if(criteria.getToDate() != null) { - url.append("&toDate=").append( criteria.getToDate()); - } - - if(!StringUtils.isEmpty(criteria.getModuleName())) { - url.append("&moduleName=").append( criteria.getModuleName()); - } - if(criteria.getIsProcessCountCall() || ObjectUtils.isEmpty(criteria.getModuleName()) && !StringUtils.isEmpty(criteria.getBusinessService())) { - url.append("&businessService=").append( StringUtils.arrayToDelimitedString(criteria.getBusinessService().toArray(),",")); - } - if(!StringUtils.isEmpty(criteria.getLimit())) { - url.append("&limit=").append( criteria.getLimit()); - } - if(!StringUtils.isEmpty(criteria.getOffset())) { - url.append("&offset=").append( criteria.getOffset()); - } - - return url; - } - - /** - * Creates url for search based on given tenantId - * - * @param tenantId - * The tenantId for which url is generated - * @return The search url - */ - private StringBuilder getSearchURLWithParams(String tenantId, String businessService) { - StringBuilder url = new StringBuilder(config.getWorkflowHost()); - - - - if (businessService != null) { - url.append(config.getBusinessServiceSearchPath()); - url.append("?businessServices="); - url.append(businessService); - } - - url.append("&tenantId="); - url.append(tenantId); - - return url; - } - - /** - * Gets the list of status on which user from requestInfo can take action upon - * @param requestInfo The RequestInfo Object of the request - * @param businessServices List of all businessServices - * @return List of status on which user from requestInfo can take action upon - */ - - public HashMap getActionableStatusesForRole(RequestInfo requestInfo, List businessServices,ProcessInstanceSearchCriteria criteria){ - - String tenantId; - List userRoleCodes; - Map> tenantIdToUserRolesMap = getTenantIdToUserRolesMap(requestInfo); - Map> tenantIdToBuisnessSevicesMap = getTenantIdToBuisnessSevicesMap(businessServices); - Map> stateToRoleMap = getStateToRoleMap(businessServices); - HashMap actionableStatuses = new HashMap<>(); - - for(Map.Entry> entry : tenantIdToUserRolesMap.entrySet()){ - - String statelevelTenantId=entry.getKey().split("\\.")[0]; - - if(entry.getKey().equals(criteria.getTenantId()) || (entry.getValue().contains(FSMConstants.FSM_DSO) && entry.getKey().equals(statelevelTenantId)) ){ - List businessServicesByTenantId = new ArrayList(); - if(entry.getKey().split("\\.").length==1){ - businessServicesByTenantId = tenantIdToBuisnessSevicesMap.get(criteria.getTenantId()); - }else{ - businessServicesByTenantId = tenantIdToBuisnessSevicesMap.get(entry.getKey()); - } - if(businessServicesByTenantId != null ) { - businessServicesByTenantId.forEach(service -> { - List states = service.getStates(); - states.forEach(state -> { - Set stateRoles = stateToRoleMap.get(state.getUuid()); - if(!CollectionUtils.isEmpty(stateRoles) && !Collections.disjoint(stateRoles,entry.getValue())){ - actionableStatuses.put(state.getUuid(), state.getApplicationStatus()); - } - - }); - }); - } - - } - } - return actionableStatuses; - } - - /** - * Gets the map of tenantId to roles the user is assigned - * @param requestInfo RequestInfo of the request - * @return Map of tenantId to roles for user in the requestInfo - */ - public Map> getTenantIdToUserRolesMap(RequestInfo requestInfo){ - Map> tenantIdToUserRoles = new HashMap<>(); - requestInfo.getUserInfo().getRoles().forEach(role -> { - if(tenantIdToUserRoles.containsKey(role.getTenantId())){ - tenantIdToUserRoles.get(role.getTenantId()).add(role.getCode()); - } - else { - List roleCodes = new LinkedList<>(); - roleCodes.add(role.getCode()); - tenantIdToUserRoles.put(role.getTenantId(),roleCodes); - } - - }); - return tenantIdToUserRoles; - } - - public Map> getTenantIdToBuisnessSevicesMap(List businessServices){ - Map> tenantIdToBuisnessSevicesMap = new HashMap<>(); - businessServices.forEach(businessService -> { - if(tenantIdToBuisnessSevicesMap.containsKey(businessService.getTenantId())){ - tenantIdToBuisnessSevicesMap.get(businessService.getTenantId()).add(businessService); - } - else { - List businessServiceList = new LinkedList<>(); - businessServiceList.add(businessService); - tenantIdToBuisnessSevicesMap.put(businessService.getTenantId(),businessServiceList); - } - }); - return tenantIdToBuisnessSevicesMap; - } - - /** - * Creates a map of status to roles who can take actions on it for all businessService - * @param businessServices The list of businessServices - * @return Map of status to roles which can take action on it for all businessService - */ - public Map> getStateToRoleMap(List businessServices){ - Map> stateToRolesMap = new HashMap<>(); - businessServices.forEach(businessService -> { - for(State state : businessService.getStates()){ - HashSet roles = new HashSet<>(); - if(!CollectionUtils.isEmpty(state.getActions())){ - state.getActions().forEach(action -> { - roles.addAll(action.getRoles()); - }); - } - stateToRolesMap.put(state.getUuid(),roles); - } - }); - return stateToRolesMap; - } - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/BSConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/BSConstants.java deleted file mode 100644 index 2b04f136a82..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/BSConstants.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.egov.inbox.util; - -public class BSConstants { - - public static final String BS_WS = "bsWs-service"; - public static final String BS_SW = "bsSw-service"; - public static final String BS_SERVICE = "BS.AMENDMENT"; - public static final String BS_WS_SERVICE = "WS.AMENDMENT"; - public static final String BS_SW_SERVICE = "SW.AMENDMENT"; - public static final String BS_WS_MODULENAME = "WS"; - public static final String BS_SW_MODULENAME = "SW"; - public static final String BS = "BS"; - public static final String MOBILE_NUMBER_PARAM = "mobileNumber"; - public static final String BS_BUSINESS_SERVICE_PARAM = "businessService"; - public static final String TENANT_ID_PARAM = "tenantId"; - public static final String LOCALITY_PARAM = "locality"; - public static final String PROPERTY_ID_PARAM = "propertyId"; - public static final String BS_APPLICATION_NUMBER_PARAM = "applicationNumber"; - public static final String BS_APPLICATION_STATUS_PARAM = "applicationStatus"; - public static final String BS_APPLICATION_TYPE_PARAM = "applicationType"; - public static final String BS_APPLICATION_SEARCH_TYPE_PARAM = "searchType"; - public static final String ASSIGNEE_PARAM = "assignee"; - public static final String STATUS_PARAM = "status"; - public static final String OFFSET_PARAM = "offset"; - public static final String NO_OF_RECORDS_PARAM = "noOfRecords"; - public static final String LIMIT_PARAM = "limit"; - public static final String ACKNOWLEDGEMENT_IDS_PARAM = "businessIds"; - public static final String BS_REQUESTINFO_PARAM = "RequestInfo"; - public static final String BS_SEARCH_CRITERIA_PARAM = "searchCriteria"; - public static final String USERID_PARAM = "userIds"; - public static final String SORT_ORDER_PARAM = "sortOrder"; - public static final String DESC_PARAM = "DESC"; - public static final String BS_BUSINESS_IDS_PARAM = "businessIds"; - public static final String BS_CONSUMER_NO_PARAM = "consumerCode"; - public static final String BS_AMENDMENT_ID_PARAM = "amendmentId"; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/BpaConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/BpaConstants.java deleted file mode 100644 index cc8e8bfb159..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/BpaConstants.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.inbox.util; - -public class BpaConstants { - - public static final String BPA = "bpa-services"; - public static final String MOBILE_NUMBER_PARAM = "mobileNumber"; - public static final String BUSINESS_SERVICE_PARAM = "businessservice"; - public static final String TENANT_ID_PARAM = "tenantId"; - public static final String LOCALITY_PARAM = "locality"; - public static final String ASSIGNEE_PARAM = "assignee"; - public static final String STATUS_PARAM = "status"; - public static final String OFFSET_PARAM = "offset"; - public static final String NO_OF_RECORDS_PARAM = "noOfRecords"; - public static final String LIMIT_PARAM = "limit"; - public static final String REQUESTINFO_PARAM = "RequestInfo"; - public static final String SEARCH_CRITERIA_PARAM = "searchCriteria"; - public static final String USERID_PARAM = "userid"; - public static final String APPROVAL_NUMBER_PARAM = "approvalNo"; - public static final String BPA_APPLICATION_NUMBER_PARAM = "applicationNo"; - public static final String SORT_ORDER_PARAM = "sortOrder"; - public static final String DESC_PARAM = "DESC"; - public static final String CITIZEN = "CITIZEN"; - public static final String USER_ROLES = "userRoles"; - public static final String USER_UUID = "userUUID"; - public static final String BPAREG = "BPAREG"; - public static final String APPLICATION_TYPE = "applicationType"; - public static final String SERVICE_TYPE = "serviceType"; - public static final String COUNT = "count"; - public static final String STATUS_ID = "statusid"; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/DSSConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/DSSConstants.java deleted file mode 100644 index 511fca8031e..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/DSSConstants.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.egov.inbox.util; - -public class DSSConstants { - - public static final String DSS_VISUALIZATIONTYPE = "METRIC"; - - public static final String DSS_INTERVAL = "month"; - - public static final String TENANT_ID = "tenantId"; - - public static final String AGGREGATE_MASTER_CODE = "AggregationData"; - - public static final String ELASTIC_SEARCH_MASTER = "ElasticSearchQueries"; - - public static final String AGGREGATE_MODULE_NAME = "inbox-dss"; - - public static final String MDMS_AGGREGATE_PATH = "$.MdmsRes.inbox-dss.AggregationData"; - - public static final String MDMS_ELASTIC_SEARCH_PATH = "$.MdmsRes.inbox-dss.ElasticSearchQueries[?(@.indexKey=='{{indexKey}}')]"; - - public static final String MDMS_VISUALIZATION_PATH = "visualizationCode"; - - public static final String MDMS_VISUALIZATION_CODES_KEY = "code"; - - public static final String MDMS_VISUALIZATION_DATE_KEY = "dateRange"; - - public static final String MDMS_VISUALIZATION_MODULE_KEY = "module"; - - public static final String ELASTICSEARCH_SOURCE_KEY = "_source"; - - public static final String ELASTICSEARCH_DATA_KEY = "Data"; - - public static final String ELASTICSEARCH_USERID_KEY = "userId"; - - public static final String ELASTICSEARCH_TIMESTAMP_KEY = "timestamp"; - - public static final String ELASTICSEARCH_DATAVIEW_KEY = "dataView"; - - public static final String ELASTICSEARCH_PALINACCESSREQUEST_KEY = "plainAccessRequest"; - - public static final String ELASTICSEARCH_PALINACCESSREQUESTFIELD_KEY = "plainRequestFields"; - - public static final String ELASTICSEARCH_HIT_KEY = "hits"; - - public static final String ELASTICSEARCH_TOTAL_KEY = "total"; - - public static final String ELASTICSEARCH_DATAVIEWEDBY_KEY = "dataViewedBy"; - - public static final String ELASTICSEARCH_ROLES_KEY = "roles"; - - public static final String PLACEHOLDER_UUID_KEY = "$uuid"; - - public static final String PLACEHOLDER_FROMDATE_KEY = "$fromDate"; - - public static final String PLACEHOLDER_TODATE_KEY = "$toDate"; - - public static final String PLACEHOLDER_OFFSET_KEY = "$offset"; - - public static final String PLACEHOLDER_LIMIT_KEY = "$limit"; - - public static final String PLACEHOLDER_SORT_ORDER_KEY = "$sortOrder"; - - public static final String INTERNALMICROSERVICEROLE_NAME = "Internal Microservice Role"; - - public static final String INTERNALMICROSERVICEROLE_CODE = "INTERNAL_MICROSERVICE_ROLE"; - - public static final String INTERNALMICROSERVICEUSER_NAME = "Internal Microservice User"; - - public static final String INTERNALMICROSERVICEUSER_USERNAME = "INTERNAL_USER"; - - public static final String INTERNALMICROSERVICEUSER_MOBILENO = "9999999999"; - - public static final String INTERNALMICROSERVICEUSER_TYPE = "SYSTEM"; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/ErrorConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/ErrorConstants.java deleted file mode 100644 index 65488a588cb..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/ErrorConstants.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.egov.inbox.util; - -public class ErrorConstants { - - public static final String PARSING_ERROR = "PARSING_ERROR"; - public static final String MODULE_SEARCH_INVLAID = "MODULE_SEARCH_INVLAID"; - public static final String INVALID_MODULE_SEARCH_PATH = "INVALID_MODULE_SEARCH_PATH"; - public static final String INVALID_MODULE = "INVALID_MODULE"; - public static final String INVALID_MODULE_DATA = "INVALID_MODULE_DATA"; - public static final String INVALID_OPERATOR_DATA = "INVALID_OPERATOR_DATA"; - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/FSMConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/FSMConstants.java deleted file mode 100644 index 111adf11cba..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/FSMConstants.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.inbox.util; - -public class FSMConstants { - - public static final String FSM_MODULE = "FSM"; - public static final String APPLICATION_NUMBER_PARAM = "applicationNo"; - public static final String APPLICATION_NUMBER = "applicationNos"; - public static final String FSM_DSO = "FSM_DSO"; - public static final String OWNER_ID = "ownerId"; - public static final String DSO_ID = "dsoId"; - - public static final String FSM_VEHICLE_TRIP_MODULE = "FSM_VEHICLE_TRIP"; - public static final String WAITING_FOR_DISPOSAL_STATE = "WAITING_FOR_DISPOSAL"; - public static final String DSO_INPROGRESS_STATE = "DSO_INPROGRESS"; - public static final String CITIZEN_FEEDBACK_PENDING_STATE = "CITIZEN_FEEDBACK_PENDING"; - public static final String DISPOSED_STATE = "DISPOSED"; - public static final String APPLICATIONSTATUS = "applicationstatus"; - public static final String COUNT = "count"; - public static final String STATUSID = "statusid"; - public static final String COMPLETED_STATE = "COMPLETED"; - public static final String VEHICLE_LOG = "vehicleLog"; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/InboxConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/InboxConstants.java deleted file mode 100644 index acf0eb257bf..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/InboxConstants.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.egov.inbox.util; - -import org.springframework.stereotype.Component; - -@Component -public class InboxConstants { - - public static final String INBOX_QUERY_CONFIG_NAME = "InboxQueryConfiguration"; - - public static final String INBOX_MODULE_CODE = "INBOX"; - - public static final String MDMS_RESPONSE_JSONPATH = "$.MdmsRes.INBOX.InboxQueryConfiguration[?(@.module==\'{{MODULE_NAME}}\')]"; - - public static final String MODULE_PLACEHOLDER = "{{MODULE_NAME}}"; - - public static final String SEARCH_PATH = "/_search"; - - public static final String COUNT_PATH = "/_count"; - - public static final String SORT_ORDER_CONSTANT = "sortOrder"; - - public static final String SORT_BY_CONSTANT = "sortBy"; - - public static final String CURRENT_PROCESS_INSTANCE_CONSTANT = "currentProcessInstance"; - - public static final String COUNT_CONSTANT = "count"; - - public static final String AUDIT_DETAILS_KEY = "auditDetails"; - - public static final String CREATED_TIME_KEY = "createdTime"; - - public static final String LAST_MODIFIED_TIME_KEY = "lastModifiedTime"; - - public static final String BUSINESS_SERVICE_PATH = "$.currentProcessInstance.businessService"; - - public static final String STATE_UUID_PATH = "$.currentProcessInstance.state.uuid"; - - public static final String APPLICATION_STATUS_KEY = "applicationstatus"; - - public static final String BUSINESSSERVICE_KEY = "businessservice"; - - public static final String STATUSID_KEY = "statusid"; - - public static final String AGGREGATIONS_KEY = "aggregations"; - - public static final String STATUS_COUNT_AGGREGATIONS_BUCKETS_PATH = "$.aggregations.statusCount.buckets.*"; - - public static final String KEY = "key"; - - public static final String DOC_COUNT_KEY = "doc_count"; - - public static final String HITS = "hits"; - - public static final String SOURCE_KEY = "_source"; - - public static final String DATA_KEY = "Data"; - - public static final String SERVICESLA_KEY = "serviceSla"; - - public static final String QUERY_KEY = "query"; - - public static final String BOOL_KEY = "bool"; - - public static final String MUST_KEY = "must"; - - public static final String ORDER_KEY = "order"; - - public static final String SORT_KEY = "sort"; - - public static final String TENANTID_KEY = "tenantId"; - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/MDMSUtil.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/MDMSUtil.java deleted file mode 100644 index a3674f2c91b..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/MDMSUtil.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.egov.inbox.util; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.inbox.web.model.InboxRequest; -import org.egov.inbox.web.model.V2.InboxQueryConfiguration; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.ModuleDetail; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.web.client.RestTemplate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.egov.inbox.util.InboxConstants.*; - - -@Component -public class MDMSUtil { - @Autowired - private RestTemplate restTemplate; - - @Autowired - private MultiStateInstanceUtil multiStateInstanceUtil; - - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsUrl; - - @Autowired - private ObjectMapper objectMapper; - - @Cacheable(value="inboxConfiguration") - public InboxQueryConfiguration getConfigFromMDMS(String tenantId, String moduleName) { - - StringBuilder uri = new StringBuilder(); - uri.append(mdmsHost).append(mdmsUrl); - MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForInboxQueryConfiguration(tenantId); - Object response = new HashMap<>(); - List configs; - try { - response = restTemplate.postForObject(uri.toString(), mdmsCriteriaReq, Map.class); - String jsonpath = MDMS_RESPONSE_JSONPATH.replace(MODULE_PLACEHOLDER, moduleName); - configs = JsonPath.read(response, jsonpath); - }catch(Exception e) { - throw new CustomException("CONFIG_ERROR","Error in fetching inbox query configuration from MDMS for: " + moduleName); - } - - if (CollectionUtils.isEmpty(configs)) - throw new CustomException("CONFIG_ERROR","Inbox Query Configuration not found in MDMS response for: " + moduleName); - - InboxQueryConfiguration configuration = objectMapper.convertValue(configs.get(0), InboxQueryConfiguration.class); - - return configuration; - } - - private MdmsCriteriaReq getMdmsRequestForInboxQueryConfiguration(String tenantId) { - MasterDetail masterDetail = new MasterDetail(); - masterDetail.setName(INBOX_QUERY_CONFIG_NAME); - List masterDetailList = new ArrayList<>(); - masterDetailList.add(masterDetail); - - ModuleDetail moduleDetail = new ModuleDetail(); - moduleDetail.setMasterDetails(masterDetailList); - moduleDetail.setModuleName(INBOX_MODULE_CODE); - List moduleDetailList = new ArrayList<>(); - moduleDetailList.add(moduleDetail); - - MdmsCriteria mdmsCriteria = new MdmsCriteria(); - mdmsCriteria.setTenantId(multiStateInstanceUtil.getStateLevelTenant(tenantId)); - mdmsCriteria.setModuleDetails(moduleDetailList); - - MdmsCriteriaReq mdmsCriteriaReq = new MdmsCriteriaReq(); - mdmsCriteriaReq.setMdmsCriteria(mdmsCriteria); - mdmsCriteriaReq.setRequestInfo(new RequestInfo()); - - return mdmsCriteriaReq; - } -} - diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/NocConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/NocConstants.java deleted file mode 100644 index f925325b128..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/NocConstants.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.inbox.util; - -public class NocConstants { - - public static final String NOC = "noc-services"; - public static final String MOBILE_NUMBER_PARAM = "mobileNumber"; - public static final String BUSINESS_SERVICE_PARAM = "businessservice"; - public static final String TENANT_ID_PARAM = "tenantId"; - public static final String LOCALITY_PARAM = "locality"; - public static final String ASSIGNEE_PARAM = "assignee"; - public static final String STATUS_PARAM = "status"; - public static final String OFFSET_PARAM = "offset"; - public static final String NO_OF_RECORDS_PARAM = "noOfRecords"; - public static final String LIMIT_PARAM = "limit"; - public static final String REQUESTINFO_PARAM = "RequestInfo"; - public static final String SEARCH_CRITERIA_PARAM = "searchCriteria"; - public static final String USERID_PARAM = "userid"; - public static final String NOC_APPLICATION_NUMBER_PARAM = "applicationNo"; - public static final String NOC_SOURCE_APPLICATION_NUMBER_PARAM = "sourceApplicationNumber"; - public static final String NOC_SOURCE_REF_ID_PARAM = "sourceRefId"; - public static final String SORT_ORDER_PARAM = "sortOrder"; - public static final String DESC_PARAM = "DESC"; - public static final String CITIZEN = "CITIZEN"; - public static final String USER_UUID = "userUUID"; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/PTConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/PTConstants.java deleted file mode 100644 index 682dce3d7de..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/PTConstants.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.inbox.util; - -public class PTConstants { - - public static final String PT = "PT"; - public static final String MOBILE_NUMBER_PARAM = "mobileNumber"; - public static final String BUSINESS_SERVICE_PARAM = "businessservice"; - public static final String TENANT_ID_PARAM = "tenantId"; - public static final String LOCALITY_PARAM = "locality"; - public static final String PROPERTY_ID_PARAM = "propertyId"; - public static final String PT_APPLICATION_NUMBER_PARAM = "applicationNumber"; - public static final String ASSIGNEE_PARAM = "assignee"; - public static final String STATUS_PARAM = "status"; - public static final String OFFSET_PARAM = "offset"; - public static final String NO_OF_RECORDS_PARAM = "noOfRecords"; - public static final String LIMIT_PARAM = "limit"; - public static final String ACKNOWLEDGEMENT_IDS_PARAM = "acknowledgementIds"; - public static final String REQUESTINFO_PARAM = "RequestInfo"; - public static final String SEARCH_CRITERIA_PARAM = "searchCriteria"; - public static final String USERID_PARAM = "userid"; - public static final String SORT_ORDER_PARAM = "sortOrder"; - public static final String DESC_PARAM = "DESC"; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/ResponseInfoFactory.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/ResponseInfoFactory.java deleted file mode 100644 index f204544ffdd..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/ResponseInfoFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.egov.inbox.util; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.stereotype.Component; - -import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils; - -@Component -public class ResponseInfoFactory { - public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { - - final String apiId = requestInfo != null ? requestInfo.getApiId() : StringUtils.EMPTY; - final String ver = requestInfo != null ? requestInfo.getVer() : StringUtils.EMPTY; - Long ts = null; - if (requestInfo != null) - ts = requestInfo.getTs(); - final String resMsgId = "uief87324"; - final String msgId = requestInfo != null ? requestInfo.getMsgId() : StringUtils.EMPTY; - final String responseStatus = success ? "successful" : "failed"; - - return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) - .status(responseStatus).build(); - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/SWConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/SWConstants.java deleted file mode 100644 index 95f6ae7ecfc..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/SWConstants.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.egov.inbox.util; - -public class SWConstants { - - public static final String SW = "sw-services"; - public static final String MOBILE_NUMBER_PARAM = "mobileNumber"; - public static final String SW_BUSINESS_SERVICE_PARAM = "businessservice"; - public static final String TENANT_ID_PARAM = "tenantId"; - public static final String LOCALITY_PARAM = "locality"; - public static final String PROPERTY_ID_PARAM = "propertyId"; - public static final String SW_APPLICATION_NUMBER_PARAM = "applicationNumber"; - public static final String SW_APPLICATION_STATUS_PARAM = "applicationStatus"; - public static final String SW_APPLICATION_TYPE_PARAM = "applicationType"; - public static final String SW_APPLICATION_SEARCH_TYPE_PARAM = "searchType"; - public static final String ASSIGNEE_PARAM = "assignee"; - public static final String STATUS_PARAM = "status"; - public static final String OFFSET_PARAM = "offset"; - public static final String NO_OF_RECORDS_PARAM = "noOfRecords"; - public static final String LIMIT_PARAM = "limit"; - public static final String ACKNOWLEDGEMENT_IDS_PARAM = "businessIds"; - public static final String SW_REQUESTINFO_PARAM = "RequestInfo"; - public static final String SW_SEARCH_CRITERIA_PARAM = "searchCriteria"; - public static final String USERID_PARAM = "userIds"; - public static final String SORT_ORDER_PARAM = "sortOrder"; - public static final String DESC_PARAM = "DESC"; - public static final String SW_BUSINESS_IDS_PARAM = "businessIds"; - public static final String SW_CONNECTION_NO_PARAM = "consumerNo"; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/TLConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/TLConstants.java deleted file mode 100644 index 7f92d09c322..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/TLConstants.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.egov.inbox.util; - -public class TLConstants { - public static final String TL = "tl-services"; - public static final String MOBILE_NUMBER_PARAM = "mobileNumber"; - public static final String BUSINESS_SERVICE_PARAM = "businessservice"; - public static final String TENANT_ID_PARAM = "tenantId"; - public static final String LOCALITY_PARAM = "locality"; - public static final String ASSIGNEE_PARAM = "assignee"; - public static final String STATUS_PARAM = "status"; - public static final String OFFSET_PARAM = "offset"; - public static final String NO_OF_RECORDS_PARAM = "noOfRecords"; - public static final String LIMIT_PARAM = "limit"; - public static final String REQUESTINFO_PARAM = "RequestInfo"; - public static final String SEARCH_CRITERIA_PARAM = "searchCriteria"; - public static final String USERID_PARAM = "userid"; - public static final String LICENSE_NUMBER_PARAM = "licenseNumber"; - public static final String APPLICATION_NUMBER_PARAM = "applicationNumber"; - public static final String SORT_ORDER_PARAM = "sortOrder"; - public static final String DESC_PARAM = "DESC"; - public static final String FSM_VEHICLE_TRIP_MODULE = "FSM_VEHICLE_TRIP"; - public static final String FSM_MODULE = "FSM"; - public static final String WAITING_FOR_DISPOSAL_STATE = "WAITING_FOR_DISPOSAL"; - public static final String DSO_INPROGRESS_STATE = "DSO_INPROGRESS"; - public static final String CITIZEN_FEEDBACK_PENDING_STATE = "CITIZEN_FEEDBACK_PENDING"; - public static final String DISPOSED_STATE = "DISPOSED"; - public static final String APPLICATIONSTATUS = "applicationstatus"; - public static final String COUNT = "count"; - public static final String STATUSID = "statusid"; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/util/WSConstants.java b/accelerators/inbox/src/main/java/org/egov/inbox/util/WSConstants.java deleted file mode 100644 index 9ba93771892..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/util/WSConstants.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.egov.inbox.util; - -public class WSConstants { - - public static final String WS = "ws-services"; - public static final String MOBILE_NUMBER_PARAM = "mobileNumber"; - public static final String WS_BUSINESS_SERVICE_PARAM = "businessservice"; - public static final String TENANT_ID_PARAM = "tenantId"; - public static final String LOCALITY_PARAM = "locality"; - public static final String PROPERTY_ID_PARAM = "propertyId"; - public static final String WS_APPLICATION_NUMBER_PARAM = "applicationNumber"; - public static final String WS_APPLICATION_STATUS_PARAM = "applicationStatus"; - public static final String WS_APPLICATION_TYPE_PARAM = "applicationType"; - public static final String WS_APPLICATION_SEARCH_TYPE_PARAM = "searchType"; - public static final String WS_ASSIGNEE_PARAM = "assignee"; - public static final String STATUS_PARAM = "status"; - public static final String OFFSET_PARAM = "offset"; - public static final String NO_OF_RECORDS_PARAM = "noOfRecords"; - public static final String LIMIT_PARAM = "limit"; - public static final String ACKNOWLEDGEMENT_IDS_PARAM = "businessIds"; - public static final String WS_REQUESTINFO_PARAM = "RequestInfo"; - public static final String WS_SEARCH_CRITERIA_PARAM = "searchCriteria"; - public static final String USERID_PARAM = "userIds"; - public static final String SORT_ORDER_PARAM = "sortOrder"; - public static final String DESC_PARAM = "DESC"; - public static final String WS_BUSINESS_IDS_PARAM = "businessIds"; - public static final String WS_CONNECTION_NO_PARAM = "consumerNo"; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/vehicle/rowmapper/VehicleTripDetailRowMapper.java b/accelerators/inbox/src/main/java/org/egov/inbox/vehicle/rowmapper/VehicleTripDetailRowMapper.java deleted file mode 100644 index f9007d0d87a..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/vehicle/rowmapper/VehicleTripDetailRowMapper.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.egov.inbox.vehicle.rowmapper; - -import java.io.IOException; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.egov.inbox.model.vehicle.VehicleTripDetail; -import org.egov.tracer.model.CustomException; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -@Component -public class VehicleTripDetailRowMapper implements ResultSetExtractor> { - - @Autowired - private ObjectMapper mapper; - - @SuppressWarnings("rawtypes") - @Override - public List extractData(ResultSet rs) throws SQLException, DataAccessException { - - Map tripDetailMap = new LinkedHashMap(); - - while (rs.next()) { - String id = rs.getString("id"); - String tenantId = rs.getString("tenantid"); - String trip_id = rs.getString("trip_id"); - String referenceno = rs.getString("referenceno"); - String referencestatus = rs.getString("referencestatus"); - Object additionaldetails = getAdditionalDetail("additionalDetails",rs); - String status = rs.getString("status"); - Long itemstarttime = rs.getLong("itemstarttime"); - Long itemendtime = rs.getLong("itemendtime"); - Double volume = rs.getDouble("volume"); - -// String createdBy = rs.getString("createdby"); -// String lastModifiedBy = rs.getString("lastmodifiedby"); -// Long createdTime = rs.getLong("createdtime"); -// Long lastModifiedTime = rs.getLong("lastmodifiedtime"); - -// AuditDetails audit = AuditDetails.builder().createdBy(createdBy).lastModifiedBy(lastModifiedBy).createdTime(createdTime) -// .lastModifiedTime(lastModifiedTime).build(); -// .auditDetails(audit) - tripDetailMap.put(id, VehicleTripDetail.builder().id(id).tenantId(tenantId).referenceNo(referenceno).referenceStatus(referencestatus) - .additionalDetails(additionaldetails).status(VehicleTripDetail.StatusEnum.fromValue(status)).itemStartTime(itemstarttime) - .itemEndTime(itemendtime).volume(volume).build()); - - - } - return new ArrayList<>(tripDetailMap.values()); - } - - private JsonNode getAdditionalDetail(String columnName, ResultSet rs){ - - JsonNode additionalDetail = null; - try { - PGobject pgObj = (PGobject) rs.getObject(columnName); - if(pgObj!=null){ - additionalDetail = mapper.readTree(pgObj.getValue()); - } - } - catch (IOException | SQLException e){ - e.printStackTrace(); - throw new CustomException("PARSING_ERROR","Failed to parse additionalDetail object"); - } - return additionalDetail; - } - -} \ No newline at end of file diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/controller/InboxController.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/controller/InboxController.java deleted file mode 100644 index 81aef751542..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/controller/InboxController.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.egov.inbox.web.controller; - -import java.math.BigDecimal; -import java.util.Map; - -import javax.validation.Valid; - -import lombok.extern.slf4j.Slf4j; -import org.egov.inbox.repository.builder.V2.InboxQueryBuilder; -import org.egov.inbox.service.DSSInboxFilterService; -import org.egov.inbox.service.InboxService; -import org.egov.inbox.web.model.InboxRequest; -import org.egov.inbox.web.model.InboxResponse; -import org.egov.inbox.util.ResponseInfoFactory; -import org.egov.inbox.web.model.dss.InboxMetricCriteria; -import org.egov.inbox.web.model.elasticsearch.InboxElasticSearchRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * Home redirection to swagger api documentation - */ -@RestController -@RequestMapping("/v1") -@Slf4j -public class InboxController { - - @Autowired - private InboxService inboxService; - - - @Autowired - private ResponseInfoFactory responseInfoFactory; - - @Autowired - private DSSInboxFilterService dssInboxService; - - //@Autowired - //private ElasticSearchService elasticSearchService; - - @Autowired - private InboxQueryBuilder inboxQueryBuilder; - - - @PostMapping(value = "/_search") - public ResponseEntity search(@Valid @RequestBody InboxRequest inboxRequest) { - - InboxResponse response = inboxService.fetchInboxData(inboxRequest.getInbox(),inboxRequest.getRequestInfo()); - - response.setResponseInfo( - responseInfoFactory.createResponseInfoFromRequestInfo(inboxRequest.getRequestInfo(), true)); - return new ResponseEntity<>(response, HttpStatus.OK); - } - - @PostMapping(value = "/dss/_search") - public ResponseEntity> getChartV2(@Valid @RequestBody InboxMetricCriteria request) { - Map response = dssInboxService.getAggregateData(request); - return new ResponseEntity<>(response, HttpStatus.OK); - } - - @PostMapping(value = "/elastic/_search") - public ResponseEntity> elasticSearch(@Valid @RequestBody InboxElasticSearchRequest request) { - Map data = null; - return new ResponseEntity<>(data, HttpStatus.OK); - } - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/controller/InboxV2Controller.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/controller/InboxV2Controller.java deleted file mode 100644 index b9789c16139..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/controller/InboxV2Controller.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.egov.inbox.web.controller; - -import lombok.extern.slf4j.Slf4j; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.inbox.repository.builder.V2.InboxQueryBuilder; -import org.egov.inbox.service.V2.InboxServiceV2; -import org.egov.inbox.util.ResponseInfoFactory; -import org.egov.inbox.web.model.InboxRequest; -import org.egov.inbox.web.model.InboxResponse; -import org.egov.inbox.web.model.V2.SearchRequest; -import org.egov.inbox.web.model.V2.SearchResponse; -import org.egov.tracer.config.TracerConfiguration; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Import; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.validation.Valid; - -@RestController -@RequestMapping("/v2") -@Slf4j -@Import({TracerConfiguration.class, MultiStateInstanceUtil.class}) -public class InboxV2Controller { - - @Autowired - private ResponseInfoFactory responseInfoFactory; - - @Autowired - private InboxQueryBuilder inboxQueryBuilder; - - @Autowired - private InboxServiceV2 inboxService; - - - @PostMapping(value = "/_search") - public ResponseEntity searchNewInbox(@Valid @RequestBody InboxRequest inboxRequest) { - InboxResponse inboxResponse = inboxService.getInboxResponse(inboxRequest); - return new ResponseEntity<>(inboxResponse, HttpStatus.OK); - } - - - @PostMapping(value = "/_getFields") - public ResponseEntity searchFields(@Valid @RequestBody SearchRequest searchRequest) { - SearchResponse searchResponse = inboxService.getSpecificFieldsFromESIndex(searchRequest); - return new ResponseEntity<>(searchResponse, HttpStatus.OK); - } -} - diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/AuditDetails.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/AuditDetails.java deleted file mode 100644 index bc262db1488..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/AuditDetails.java +++ /dev/null @@ -1,156 +0,0 @@ -package org.egov.inbox.web.model; - -import java.util.Objects; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Collection of audit related fields used by most models - */ - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class AuditDetails { - @JsonProperty("createdBy") - private String createdBy = null; - - @JsonProperty("lastModifiedBy") - private String lastModifiedBy = null; - - @JsonProperty("createdTime") - private Long createdTime = null; - - @JsonProperty("lastModifiedTime") - private Long lastModifiedTime = null; - - public AuditDetails createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - * username (preferred) or userid of the user that created the object - * @return createdBy - **/ - - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - public AuditDetails lastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - /** - * username (preferred) or userid of the user that last modified the object - * @return lastModifiedBy - **/ - - - public String getLastModifiedBy() { - return lastModifiedBy; - } - - public void setLastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - } - - public AuditDetails createdTime(Long createdTime) { - this.createdTime = createdTime; - return this; - } - - /** - * epoch of the time object is created - * @return createdTime - **/ - - - public Long getCreatedTime() { - return createdTime; - } - - public void setCreatedTime(Long createdTime) { - this.createdTime = createdTime; - } - - public AuditDetails lastModifiedTime(Long lastModifiedTime) { - this.lastModifiedTime = lastModifiedTime; - return this; - } - - /** - * epoch of the time object is last modified - * @return lastModifiedTime - **/ - - - public Long getLastModifiedTime() { - return lastModifiedTime; - } - - public void setLastModifiedTime(Long lastModifiedTime) { - this.lastModifiedTime = lastModifiedTime; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuditDetails auditDetails = (AuditDetails) o; - return Objects.equals(this.createdBy, auditDetails.createdBy) && - Objects.equals(this.lastModifiedBy, auditDetails.lastModifiedBy) && - Objects.equals(this.createdTime, auditDetails.createdTime) && - Objects.equals(this.lastModifiedTime, auditDetails.lastModifiedTime); - } - - @Override - public int hashCode() { - return Objects.hash(createdBy, lastModifiedBy, createdTime, lastModifiedTime); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AuditDetails {\n"); - - sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); - sb.append(" lastModifiedBy: ").append(toIndentedString(lastModifiedBy)).append("\n"); - sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); - sb.append(" lastModifiedTime: ").append(toIndentedString(lastModifiedTime)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/Document.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/Document.java deleted file mode 100644 index 25763dbf31c..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/Document.java +++ /dev/null @@ -1,186 +0,0 @@ -package org.egov.inbox.web.model; - -import java.util.Map; -import java.util.Objects; - -import javax.validation.constraints.Size; - -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * This object holds list of documents attached during the transaciton for a property - */ - -@Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-12-09T07:13:46.742Z[GMT]") - - -public class Document { - @JsonProperty("id") - private String id = null; - - @JsonProperty("documentType") - private String documentType = null; - - @JsonProperty("fileStore") - private String fileStore = null; - - @JsonProperty("documentUid") - private String documentUid = null; - - @JsonProperty("additionalDetails") - private Object additionalDetails = null; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("fileStoreId") - private String fileStoreId; - - @JsonProperty("auditDetails") - private Map auditDetails; - - public Document id(String id) { - this.id = id; - return this; - } - - /** - * system id of the Document. - * @return id - **/ - - - @Size(max=64) public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Document documentType(String documentType) { - this.documentType = documentType; - return this; - } - - /** - * unique document type code, should be validated with document type master - * @return documentType - **/ - - - public String getDocumentType() { - return documentType; - } - - public void setDocumentType(String documentType) { - this.documentType = documentType; - } - - public Document fileStore(String fileStore) { - this.fileStore = fileStore; - return this; - } - - /** - * File store reference key. - * @return fileStore - **/ - - - public String getFileStore() { - return fileStore; - } - - public void setFileStore(String fileStore) { - this.fileStore = fileStore; - } - - public Document documentUid(String documentUid) { - this.documentUid = documentUid; - return this; - } - - /** - * The unique id(Pancard Number,Adhar etc.) of the given Document. - * @return documentUid - **/ - - - @Size(max=64) public String getDocumentUid() { - return documentUid; - } - - public void setDocumentUid(String documentUid) { - this.documentUid = documentUid; - } - - public Document additionalDetails(Object additionalDetails) { - this.additionalDetails = additionalDetails; - return this; - } - - /** - * Json object to capture any extra information which is not accommodated by model - * @return additionalDetails - **/ - - - public Object getAdditionalDetails() { - return additionalDetails; - } - - public void setAdditionalDetails(Object additionalDetails) { - this.additionalDetails = additionalDetails; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Document document = (Document) o; - return Objects.equals(this.id, document.id) && - Objects.equals(this.documentType, document.documentType) && - Objects.equals(this.fileStore, document.fileStore) && - Objects.equals(this.documentUid, document.documentUid) && - Objects.equals(this.additionalDetails, document.additionalDetails); - } - - @Override - public int hashCode() { - return Objects.hash(id, documentType, fileStore, documentUid, additionalDetails); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Document {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" documentType: ").append(toIndentedString(documentType)).append("\n"); - sb.append(" fileStore: ").append(toIndentedString(fileStore)).append("\n"); - sb.append(" documentUid: ").append(toIndentedString(documentUid)).append("\n"); - sb.append(" additionalDetails: ").append(toIndentedString(additionalDetails)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/Error.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/Error.java deleted file mode 100644 index 2b2f8948256..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/Error.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.egov.inbox.web.model; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; - -/** - * Error object will be returned as a part of reponse body in conjunction with ResponseHeader as part of ErrorResponse whenever the request processing status in the ResponseHeader is FAILED. HTTP return in this scenario will usually be HTTP 400. - */ -@Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-12-23T12:08:13.326Z[GMT]") - -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class Error { - @JsonProperty("code") - private String code = null; - - @JsonProperty("message") - private String message = null; - - @JsonProperty("description") - private String description = null; - - @JsonProperty("params") - @Valid - private List params = null; - - public Error code(String code) { - this.code = code; - return this; - } - - /** - * Error Code will be module specific error label/code to identiffy the error. All modules should also publish the Error codes with their specific localized values in localization service to ensure clients can print locale specific error messages. Example for error code would be User.NotFound to indicate User Not Found by User/Authentication service. All services must declare their possible Error Codes with brief description in the error response section of their API path. - * @return code - **/ - @NotNull - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public Error message(String message) { - this.message = message; - return this; - } - - /** - * English locale message of the error code. Clients should make a separate call to get the other locale description if configured with the service. Clients may choose to cache these locale specific messages to enhance performance with a reasonable TTL (May be defined by the localization service based on tenant + module combination). - * @return message - **/ - @NotNull - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Error description(String description) { - this.description = description; - return this; - } - - /** - * Optional long description of the error to help clients take remedial action. This will not be available as part of localization service. - * @return description - **/ - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Error params(List params) { - this.params = params; - return this; - } - - public Error addParamsItem(String paramsItem) { - if (this.params == null) { - this.params = new ArrayList(); - } - this.params.add(paramsItem); - return this; - } - - /** - * Some error messages may carry replaceable fields (say $1, $2) to provide more context to the message. E.g. Format related errors may want to indicate the actual field for which the format is invalid. Client's should use the values in the param array to replace those fields. - * @return params - **/ - - public List getParams() { - return params; - } - - public void setParams(List params) { - this.params = params; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Error error = (Error) o; - return Objects.equals(this.code, error.code) && - Objects.equals(this.message, error.message) && - Objects.equals(this.description, error.description) && - Objects.equals(this.params, error.params); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, description, params); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Error {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/ErrorRes.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/ErrorRes.java deleted file mode 100644 index 9b3749436ed..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/ErrorRes.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.egov.inbox.web.model; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.NoArgsConstructor; - -/** - * All APIs will return ErrorRes in case of failure which will carry ResponseHeader as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure. - */ -@Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-12-23T12:08:13.326Z[GMT]") - -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class ErrorRes { - @JsonProperty("ResponseInfo") - private ResponseInfo responseHeader = null; - - @JsonProperty("Errors") - @Valid - private List errors = null; - - public ErrorRes responseHeader(ResponseInfo responseHeader) { - this.responseHeader = responseHeader; - return this; - } - - /** - * Get responseHeader - * @return responseHeader - **/ - @NotNull - - @Valid - public ResponseInfo getResponseHeader() { - return responseHeader; - } - - public void setResponseHeader(ResponseInfo responseHeader) { - this.responseHeader = responseHeader; - } - - public ErrorRes errors(List errors) { - this.errors = errors; - return this; - } - - public ErrorRes addErrorsItem(Error errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList(); - } - this.errors.add(errorsItem); - return this; - } - - /** - * Error response array corresponding to Request Object array. In case of single object submission or _search related paths this may be an array of one error element - * @return errors - **/ - @Valid - public List getErrors() { - return errors; - } - - public void setErrors(List errors) { - this.errors = errors; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ErrorRes errorRes = (ErrorRes) o; - return Objects.equals(this.responseHeader, errorRes.responseHeader) && - Objects.equals(this.errors, errorRes.errors); - } - - @Override - public int hashCode() { - return Objects.hash(responseHeader, errors); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ErrorRes {\n"); - - sb.append(" responseHeader: ").append(toIndentedString(responseHeader)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/Inbox.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/Inbox.java deleted file mode 100644 index 524ff8298d0..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/Inbox.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.egov.inbox.web.model; - -import java.util.Map; - -import org.egov.inbox.web.model.workflow.ProcessInstance; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Builder -@Data -@AllArgsConstructor -@NoArgsConstructor -public class Inbox { - - @JsonProperty("ProcessInstance") - private ProcessInstance ProcessInstance; - - @JsonProperty("businessObject") - private Map businessObject; - - @JsonProperty("serviceObject") - private Map serviceObject; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/InboxRequest.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/InboxRequest.java deleted file mode 100644 index 3d804a9e45d..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/InboxRequest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.inbox.web.model; - -import javax.validation.Valid; - -import org.egov.common.contract.request.RequestInfo; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter;; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class InboxRequest { - @JsonProperty("RequestInfo") - private RequestInfo RequestInfo; - - @Valid - @JsonProperty("inbox") - private InboxSearchCriteria inbox ; - - - -} \ No newline at end of file diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/InboxResponse.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/InboxResponse.java deleted file mode 100644 index d04eef49e57..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/InboxResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.inbox.web.model; - - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Builder -@Data -@AllArgsConstructor -@NoArgsConstructor -public class InboxResponse { - - - @JsonProperty("responseInfo") - private ResponseInfo responseInfo = null; - - - @JsonProperty("totalCount") - private Integer totalCount =null; - - @JsonProperty("nearingSlaCount") - private Integer nearingSlaCount =null; - - @JsonProperty("statusMap") - private List> statusMap = null; - - @JsonProperty("items") - private List items = null; -} - diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/InboxSearchCriteria.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/InboxSearchCriteria.java deleted file mode 100644 index 07342fbd06f..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/InboxSearchCriteria.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.egov.inbox.web.model; - -import java.util.HashMap; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.Max; -import javax.validation.constraints.NotNull; - -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Data; - - -@Data -public class InboxSearchCriteria { - - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @Valid - @JsonProperty("processSearchCriteria") - private ProcessInstanceSearchCriteria processSearchCriteria; - - @JsonProperty("moduleSearchCriteria") - private HashMap moduleSearchCriteria; - - @JsonProperty("offset") - private Integer offset; - - @JsonProperty("limit") - @Max(value = 300) - private Integer limit; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/RequestInfoWrapper.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/RequestInfoWrapper.java deleted file mode 100644 index 6e09683be30..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/RequestInfoWrapper.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.inbox.web.model; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class RequestInfoWrapper { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/Data.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/Data.java deleted file mode 100644 index 0ae084cb93b..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/Data.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.inbox.web.model.V2; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import java.util.List; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class Data { - - @JsonProperty("fields") - private List fields; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/Field.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/Field.java deleted file mode 100644 index f11f7bfd109..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/Field.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.inbox.web.model.V2; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter - -public class Field { - - @JsonProperty("key") - private String key; - - @JsonProperty("value") - private Object value; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/InboxQueryConfiguration.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/InboxQueryConfiguration.java deleted file mode 100644 index 1fe05431b47..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/InboxQueryConfiguration.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.egov.inbox.web.model.V2; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import java.util.List; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class InboxQueryConfiguration { - - @JsonProperty("module") - private String module; - - @JsonProperty("index") - private String index; - - @JsonProperty("allowedSearchCriteria") - private List allowedSearchCriteria; - - @JsonProperty("sortBy") - private SortParam sortParam; - - @JsonProperty("sourceFilterPathList") - private List sourceFilterPathList; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/IndexSearchCriteria.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/IndexSearchCriteria.java deleted file mode 100644 index 45a0b9dece9..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/IndexSearchCriteria.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.inbox.web.model.V2; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Data; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; - -import javax.validation.Valid; -import javax.validation.constraints.Max; -import javax.validation.constraints.NotNull; -import java.util.HashMap; - -@Data -public class IndexSearchCriteria { - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @NotNull - @JsonProperty("moduleName") - private String moduleName; - - @JsonProperty("moduleSearchCriteria") - private HashMap moduleSearchCriteria; - - @JsonProperty("offset") - private Integer offset; - - @JsonProperty("limit") - @Max(value = 300) - private Integer limit; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SearchParam.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SearchParam.java deleted file mode 100644 index 13d9befda13..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SearchParam.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.egov.inbox.web.model.V2; - - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import lombok.*; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class SearchParam { - - @JsonProperty("name") - private String name; - - @JsonProperty("path") - private String path; - - @JsonProperty("isMandatory") - private Boolean isMandatory; - - @JsonProperty("isHashingRequired") - private Boolean isHashingRequired; - - @JsonProperty("operator") - private Operator operator; - - public enum Operator { - - EQUAL("EQUAL"), - - GTE("GTE"), - - LTE("LTE"), - - WILDCARD("WILDCARD"); - - - private String value; - - Operator(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Operator fromValue(String text) { - for (Operator b : Operator.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } - } - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SearchRequest.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SearchRequest.java deleted file mode 100644 index fdb5da0d9ef..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SearchRequest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.egov.inbox.web.model.V2; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class SearchRequest { - - @JsonProperty("RequestInfo") - private RequestInfo RequestInfo; - - @JsonProperty("SearchCriteria") - private IndexSearchCriteria indexSearchCriteria; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SearchResponse.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SearchResponse.java deleted file mode 100644 index 961098be7c3..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SearchResponse.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.inbox.web.model.V2; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import java.util.List; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class SearchResponse { - - @JsonProperty("data") - private List data; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SortParam.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SortParam.java deleted file mode 100644 index f1b6e301e6c..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/V2/SortParam.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.egov.inbox.web.model.V2; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import lombok.*; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class SortParam { - - @JsonProperty("path") - private String path; - - @JsonProperty("defaultOrder") - private Order order; - - public enum Order { - - ASC("ASC"), - - DESC("DESC"); - - private String value; - - Order(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Order fromValue(String text) { - for (Order b : Order.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } - } - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/VehicleCustomResponse.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/VehicleCustomResponse.java deleted file mode 100644 index 6f7e6ba357a..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/VehicleCustomResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.egov.inbox.web.model; - -import java.util.List; -import java.util.Map; - -import javax.validation.Valid; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Builder -@Data -@AllArgsConstructor -@NoArgsConstructor -public class VehicleCustomResponse { - - @JsonProperty("responseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("applicationStatusCount") - @Valid - private List> applicationStatusCount = null; - - @JsonProperty("applicationIds") - @Valid - private List applicationIdList = null; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/AggregateRequestDto.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/AggregateRequestDto.java deleted file mode 100644 index f1a84d83309..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/AggregateRequestDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import java.util.Map; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class AggregateRequestDto { - - @Valid - @JsonProperty("visualizationType") - private String visualizationType; - - @Valid - @JsonProperty("moduleLevel") - private String moduleLevel; - - @JsonProperty("requestDate") - private RequestDate requestDate; - - @Valid - @JsonProperty("visualizationCode") - private String visualizationCode; - - @Valid - @JsonProperty("filters") - private Map filters; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/AggregationRequest.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/AggregationRequest.java deleted file mode 100644 index 672c86d73e4..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/AggregationRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import java.util.Map; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class AggregationRequest { - - @Valid - @JsonProperty("headers") - private Map headers; - - @Valid - @JsonProperty("aggregationRequestDto") - private AggregateRequestDto aggregationRequestDto; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/Data.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/Data.java deleted file mode 100644 index 9f4da42e8e3..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/Data.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class Data { - - @Valid - @JsonProperty("headerName") - private String headerName; - - @Valid - @JsonProperty("headerValue") - private BigDecimal headerValue; - - @Valid - @JsonProperty("headerSymbol") - private String headerSymbol; - - @Valid - @JsonProperty("insight") - private InsightsWidget insight; - - private List plots = new ArrayList<>(); - - public Data(String name, BigDecimal value, String symbol) { - this.headerName = name; - this.headerValue = value; - this.headerSymbol = symbol; - } - - public Data(String name, BigDecimal value, String symbol, List plots) { - this.headerName = name; - this.headerValue = value; - this.headerSymbol = symbol; - this.plots = plots; - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/InboxMetricCriteria.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/InboxMetricCriteria.java deleted file mode 100644 index 75651e932ee..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/InboxMetricCriteria.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class InboxMetricCriteria { - - @Valid - @JsonProperty("tenantId") - private String tenantId; - - @Valid - @JsonProperty("module") - private String module; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/InsightsWidget.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/InsightsWidget.java deleted file mode 100644 index f25d3c75e66..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/InsightsWidget.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class InsightsWidget { - - @Valid - @JsonProperty("name") - private String name; - - @Valid - @JsonProperty("value") - private Object value; - - @Valid - @JsonProperty("indicator") - private String indicator; - - @Valid - @JsonProperty("colorCode") - private String colorCode; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/MetricResponse.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/MetricResponse.java deleted file mode 100644 index c9e9b9f00e0..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/MetricResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class MetricResponse { - - @Valid - @JsonProperty("statusInfo") - private StatusInfo statusInfo; - - @Valid - @JsonProperty("responseData") - private ResponseData responseData; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/Plot.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/Plot.java deleted file mode 100644 index cf30d01ac84..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/Plot.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class Plot { - - @Valid - @JsonProperty("label") - private String label; - - @Valid - @JsonProperty("name") - private String name; - - @Valid - @JsonProperty("value") - private Double value; - - @Valid - @JsonProperty("strValue") - private String strValue; - - @Valid - @JsonProperty("symbol") - private String symbol; - - public Plot(String name, Double value, String symbol) { - this.name = name; - this.value = value; - this.symbol = symbol; - } - - public Plot(String name, String strValue, String symbol) { - this.name = name; - this.strValue = strValue; - this.symbol = symbol; - this.value = 0d; - } - - public Plot(String name, String symbol) { - this.name = name; - this.symbol = symbol; - this.value = null; - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/RequestDate.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/RequestDate.java deleted file mode 100644 index 8b0effc9af3..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/RequestDate.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class RequestDate { - - @Valid - @JsonProperty("startDate") - private String startDate; - - @Valid - @JsonProperty("endDate") - private String endDate; - - @Valid - @JsonProperty("interval") - private String interval; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/ResponseData.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/ResponseData.java deleted file mode 100644 index fb19c4157a4..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/ResponseData.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class ResponseData { - - @Valid - @JsonProperty("chartType") - private String chartType; - - @Valid - @JsonProperty("visualizationCode") - private String visualizationCode; - - @Valid - @JsonProperty("chartFormat") - private String chartFormat; - - @Valid - @JsonProperty("drillDownChartId") - private String drillDownChartId; - - @Valid - @JsonProperty("customData") - private Map customData; - - @Valid - @JsonProperty("dates") - private RequestDate dates; - - @Valid - @JsonProperty("filter") - private Object filter; - - @Valid - @JsonProperty("data") - private List data = new ArrayList<>(); - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/ResponseDto.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/ResponseDto.java deleted file mode 100644 index 68bd4a0056c..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/ResponseDto.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import java.math.BigDecimal; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class ResponseDto { - - @Valid - @JsonProperty("totalAmountPaid") - private BigDecimal totalAmountPaid; - - @Valid - @JsonProperty("activeConnections") - private BigDecimal activeConnections; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/StatusInfo.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/StatusInfo.java deleted file mode 100644 index 6b086131604..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/dss/StatusInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.inbox.web.model.dss; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class StatusInfo { - - @Valid - @JsonProperty("statusCode") - private String statusCode; - - @Valid - @JsonProperty("statusMessage") - private String statusMessage; - - @Valid - @JsonProperty("errorMessage") - private String errorMessage; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/elasticsearch/InboxElasticSearchCriteria.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/elasticsearch/InboxElasticSearchCriteria.java deleted file mode 100644 index 5ebfc18a6c6..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/elasticsearch/InboxElasticSearchCriteria.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.inbox.web.model.elasticsearch; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Data; -import org.egov.inbox.web.model.workflow.ProcessInstanceSearchCriteria; - -import javax.validation.constraints.Max; -import javax.validation.constraints.NotNull; -import java.util.HashMap; - - -@Data -public class InboxElasticSearchCriteria { - - @NotNull - @JsonProperty("indexKey") - private String indexKey; - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("fromDate") - private long fromDate; - - @JsonProperty("toDate") - private long toDate; - - @JsonProperty("offset") - private Integer offset; - - @JsonProperty("limit") - @Max(value = 300) - private Integer limit; - - @JsonProperty("sortOrder") - private String sortOrder; - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/elasticsearch/InboxElasticSearchRequest.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/elasticsearch/InboxElasticSearchRequest.java deleted file mode 100644 index 39b7f002a1c..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/elasticsearch/InboxElasticSearchRequest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.egov.inbox.web.model.elasticsearch; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; -import org.egov.inbox.web.model.InboxSearchCriteria; - -import javax.validation.Valid; - -; - -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Getter -@Setter -public class InboxElasticSearchRequest { - @JsonProperty("RequestInfo") - private RequestInfo RequestInfo; - - @Valid - @JsonProperty("InboxElasticSearchCriteria") - private InboxElasticSearchCriteria inboxElasticSearchCriteria ; - - - -} \ No newline at end of file diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/elasticsearch/UserDetailResponse.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/elasticsearch/UserDetailResponse.java deleted file mode 100644 index c26209d6554..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/elasticsearch/UserDetailResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.egov.inbox.web.model.elasticsearch; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.User; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@AllArgsConstructor -@NoArgsConstructor -@Getter -public class UserDetailResponse { - - @JsonProperty("responseInfo") - ResponseInfo responseInfo; - - @JsonProperty("user") - List user; -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/Action.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/Action.java deleted file mode 100644 index dfc9eb1281d..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/Action.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.egov.inbox.web.model.workflow; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.Size; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import org.egov.inbox.web.model.AuditDetails; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.swagger.annotations.ApiModel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -/** - * A Object holds the basic data for a Building Plan - */ -@ApiModel(description = "A Object holds the basic data for a Building Plan") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId","currentState","action"}) -public class Action { - - @Size(max=256) - @JsonProperty("uuid") - private String uuid; - - @Size(max=256) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max=256) - @JsonProperty("currentState") - private String currentState; - - @Size(max=256) - @JsonProperty("action") - private String action; - - @Size(max=256) - @JsonProperty("nextState") - private String nextState; - - @Size(max=1024) - @JsonProperty("roles") - @Valid - private List roles; - - private AuditDetails auditDetails; - - @JsonProperty("active") - @JsonIgnore - private boolean active; - - public Action addRolesItem(String rolesItem) { - if (this.roles == null) { - this.roles = new ArrayList<>(); - } - this.roles.add(rolesItem); - return this; - } - -} - diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/BusinessService.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/BusinessService.java deleted file mode 100644 index 9e16be6a123..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/BusinessService.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.egov.inbox.web.model.workflow; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.inbox.web.model.workflow.State; -import org.egov.inbox.web.model.AuditDetails; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.swagger.annotations.ApiModel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -/** - * A Object holds the - */ -@ApiModel(description = "A Object holds the") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId","businessService"}) -@JsonInclude(JsonInclude.Include.NON_NULL) -public class BusinessService { - - @Size(max=256) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max=256) - @JsonProperty("uuid") - private String uuid; - - @Size(max=256) - @JsonProperty("businessService") - private String businessService; - - @Size(max=256) - @JsonProperty("business") - private String business; - - @Size(max=1024) - @JsonProperty("getUri") - private String getUri; - - @Size(max=1024) - @JsonProperty("postUri") - private String postUri; - - @JsonProperty("businessServiceSla") - private Long businessServiceSla; - - @NotNull - @Valid - @JsonProperty("states") - private List states; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - - public BusinessService addStatesItem(State statesItem) { - if (this.states == null) { - this.states = new ArrayList<>(); - } - this.states.add(statesItem); - return this; - } - - - /** - * Returns the currentState with the given uuid if not present returns null - * @param uuid the uuid of the currentState to be returned - * @return - */ - public State getStateFromUuid(String uuid) { - State state = null; - if(this.states!=null){ - for(State s : this.states){ - if(s.getUuid().equalsIgnoreCase(uuid)){ - state = s; - break; - } - } - } - return state; - } - - - -} - diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/BusinessServiceResponse.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/BusinessServiceResponse.java deleted file mode 100644 index eb20bde8652..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/BusinessServiceResponse.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.egov.inbox.web.model.workflow; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.ToString; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@ToString -public class BusinessServiceResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("BusinessServices") - @Valid - @NotNull - private List businessServices; - - - public BusinessServiceResponse addBusinessServiceItem(BusinessService businessServiceItem) { - if (this.businessServices == null) { - this.businessServices = new ArrayList(); - } - this.businessServices.add(businessServiceItem); - return this; - } - - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/BusinessServiceSearchCriteria.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/BusinessServiceSearchCriteria.java deleted file mode 100644 index 7db6b9abec2..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/BusinessServiceSearchCriteria.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.egov.inbox.web.model.workflow; - - -import java.util.List; - -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class BusinessServiceSearchCriteria { - - - @NotNull - @JsonProperty("tenantId") - private List tenantIds; - - @JsonProperty("businessServices") - private List businessServices; - - @JsonIgnore - private List stateUuids; - - @JsonIgnore - private List actionUuids; - - - public BusinessServiceSearchCriteria(BusinessServiceSearchCriteria criteria) { - this.tenantIds = criteria.getTenantIds(); - this.businessServices = criteria.getBusinessServices(); - this.stateUuids = criteria.getStateUuids(); - this.actionUuids = criteria.getActionUuids(); - } -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/ProcessInstance.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/ProcessInstance.java deleted file mode 100644 index 2544b63ece9..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/ProcessInstance.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.egov.inbox.web.model.workflow; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.contract.request.User; -import org.egov.inbox.web.model.AuditDetails; -import org.egov.inbox.web.model.Document; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@EqualsAndHashCode(of = {"id"}) -@ToString -public class ProcessInstance { - - @Size(max=64) - @JsonProperty("id") - private String id; - - @NotNull - @Size(max=128) - @JsonProperty("tenantId") - private String tenantId; - - @NotNull - @Size(max=128) - @JsonProperty("businessService") - private String businessService; - - @NotNull - @Size(max=128) - @JsonProperty("businessId") - private String businessId; - - @NotNull - @Size(max=128) - @JsonProperty("action") - private String action; - - @NotNull - @Size(max=64) - @JsonProperty("moduleName") - private String moduleName; - - @JsonProperty("state") - private State state; - - @JsonProperty("comment") - private String comment; - - @JsonProperty("documents") - @Valid - private List documents; - - @JsonProperty("assigner") - private User assigner; - - @JsonProperty("assignes") - private List assignes; - - @JsonProperty("nextActions") - @Valid - private List nextActions; - - @JsonProperty("stateSla") - private Long stateSla; - - @JsonProperty("businesssServiceSla") - private Long businesssServiceSla; - - @JsonProperty("previousStatus") - @Size(max=128) - private String previousStatus; - - @JsonProperty("entity") - private Object entity; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("rating") - private Integer rating; - - @JsonProperty("assignee") - private User assignee; - - @JsonProperty("escalated") - private boolean escalated; - - public ProcessInstance addDocumentsItem(Document documentsItem) { - if (this.documents == null) { - this.documents = new ArrayList<>(); - } - if(!this.documents.contains(documentsItem)) - this.documents.add(documentsItem); - - return this; - } - - public ProcessInstance addNextActionsItem(Action nextActionsItem) { - if (this.nextActions == null) { - this.nextActions = new ArrayList<>(); - } - this.nextActions.add(nextActionsItem); - return this; - } - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/ProcessInstanceResponse.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/ProcessInstanceResponse.java deleted file mode 100644 index 18bb6805121..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/ProcessInstanceResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.inbox.web.model.workflow; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; - -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.swagger.annotations.ApiModel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Contract class to send response. Array of TradeLicense items are used in case of search results or response for create, whereas single TradeLicense item is used for update - */ -@ApiModel(description = "Contract class to send response. Array of TradeLicense items are used in case of search results or response for create, whereas single TradeLicense item is used for update") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class ProcessInstanceResponse { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("ProcessInstances") - @Valid - private List processInstances; - - @JsonProperty("totalCount") - private Integer totalCount; - - public ProcessInstanceResponse addProceInstanceItem(ProcessInstance proceInstanceItem) { - if (this.processInstances == null) { - this.processInstances = new ArrayList<>(); - } - this.processInstances.add(proceInstanceItem); - return this; - } - -} - diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/ProcessInstanceSearchCriteria.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/ProcessInstanceSearchCriteria.java deleted file mode 100644 index bb41277f30d..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/ProcessInstanceSearchCriteria.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.egov.inbox.web.model.workflow; - - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.util.List; - -@Data -public class ProcessInstanceSearchCriteria { - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("status") - private List status; - - @JsonProperty("businessIds") - private List businessIds; - - @JsonProperty("assignee") - private String assignee; - - @JsonProperty("ids") - private List ids; - - @JsonProperty("history") - private Boolean history = false; - - @JsonProperty("fromDate") - private Long fromDate = null; - - @JsonProperty("toDate") - private Long toDate = null; - - - @JsonProperty("offset") - private Integer offset; - - @JsonProperty("limit") - private Integer limit; - - @NotNull - @JsonProperty("businessService") - private List businessService; - - @JsonProperty("moduleName") - private String moduleName; - - @JsonIgnore - private Boolean isProcessCountCall; - - @JsonIgnore - private Boolean isNearingSlaCount; - - - public Boolean isNull(){ - if(this.getBusinessIds()==null && this.getIds()==null && this.getAssignee()==null && - this.getStatus()==null) - return true; - else return false; - } - - - -} diff --git a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/State.java b/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/State.java deleted file mode 100644 index d9198a5e377..00000000000 --- a/accelerators/inbox/src/main/java/org/egov/inbox/web/model/workflow/State.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.egov.inbox.web.model.workflow; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.Size; - -import org.egov.inbox.web.model.AuditDetails; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.swagger.annotations.ApiModel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -/** - * A Object holds the basic data for a fsm - */ -@ApiModel(description = "A Object holds the basic data for a fsm") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId","businessServiceId","state"}) -public class State { - - @Size(max=256) - @JsonProperty("uuid") - private String uuid; - - @Size(max=256) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max=256) - @JsonProperty("businessServiceId") - private String businessServiceId; - - @JsonProperty("sla") - private Long sla; - - @Size(max=256) - @JsonProperty("state") - private String state; - - @Size(max=256) - @JsonProperty("applicationStatus") - private String applicationStatus; - - @JsonProperty("docUploadRequired") - private Boolean docUploadRequired; - - @JsonProperty("isStartState") - private Boolean isStartState; - - @JsonProperty("isTerminateState") - private Boolean isTerminateState; - - @JsonProperty("isStateUpdatable") - private Boolean isStateUpdatable; - - @JsonProperty("actions") - @Valid - private List actions; - - private AuditDetails auditDetails; - - - public State addActionsItem(Action actionsItem) { - if (this.actions == null) { - this.actions = new ArrayList<>(); - } - this.actions.add(actionsItem); - return this; - } - -} - diff --git a/accelerators/inbox/src/main/resources/application.properties b/accelerators/inbox/src/main/resources/application.properties deleted file mode 100644 index 407a655ee9b..00000000000 --- a/accelerators/inbox/src/main/resources/application.properties +++ /dev/null @@ -1,126 +0,0 @@ -server.context-path=/inbox -server.servlet.context-path=/inbox - -server.port=9011 -app.timezone=GMT+5:30 - -#DATABASE CONFIGURATION -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/birthregn -spring.datasource.username=birth -spring.datasource.password=birth -spring.flyway.enabled=false - - -# wf url -#dev -workflow.host=http://localhost:8096 -workflow.process.search.path=/egov-workflow-v2/egov-wf/process/_search -workflow.businessservice.search.path=/egov-workflow-v2/egov-wf/businessservice/_search -workflow.process.count.path=/egov-workflow-v2/egov-wf/process/_count -workflow.process.statuscount.path=/egov-workflow-v2/egov-wf/process/_statuscount -workflow.process.nearing.sla.count.path=/egov-workflow-v2/egov-wf/process/_nearingslacount - -#vehicle -#egov.vehicle.host=http://localhost:8061 -egov.vehicle.host=http://vehicle.egov:8080 -vehicle.search.path=/vehicle/trip/v1/_search -vehicle.fetchApplicationStatusCount.path=/vehicle/v1/fetchApplicationStatusCount -vehicle.fetchApplicationIds.path=/vehicle/v1/fetchApplicationIds -vehicle.searchTrip.path=/vehicle/v1/searchTrip - -#fsm -#egov.fsm.host=http://localhost:9098 -egov.fsm.host=http://fsm.egov:8080 -egov.fsm.fetchApplicationIds.path=/fsm/v1/fetchApplicationIds - -#service.search.mapping={"FSM":{"searchPath":"http://localhost:9098/fsm/v1/_search","dataRoot":"fsm","applNosParam":"applicationNos","businessIdProperty":"applicationNo","applsStatusParam":"applicationStatus"},"FSM_VEHICLE_TRIP":{"searchPath":"http://localhost:8061/vehicle/trip/v1/_search","dataRoot":"vehicleTrip","applNosParam":"applicationNos","businessIdProperty":"applicationNo","applsStatusParam":"applicationStatus"}} -service.search.mapping={"FSM":{"searchPath":"http://localhost:9098/fsm/v1/_search","dataRoot":"fsm","applNosParam":"applicationNos","businessIdProperty":"applicationNo","applsStatusParam":"applicationStatus"},"FSM_POST_PAY_SERVICE":{"searchPath":"http://localhost:9098/fsm/v1/_search","dataRoot":"fsm","applNosParam":"applicationNos","businessIdProperty":"applicationNo","applsStatusParam":"applicationStatus"},"FSM_VEHICLE_TRIP":{"searchPath":"http://localhost:8061/vehicle/trip/v1/_search","dataRoot":"vehicleTrip","applNosParam":"applicationNos","businessIdProperty":"applicationNo","applsStatusParam":"applicationStatus"},"PT.CREATE,PT.MUTATION,PT.UPDATE":{"searchPath":"http://localhost:8084/property-services/property/_search","dataRoot":"Properties","applNosParam":"acknowldgementNumber","businessIdProperty":"acknowldgementNumber","applsStatusParam":"status"},"NewTL,EDITRENEWAL,DIRECTRENEWAL":{"searchPath":"http://localhost:8088/tl-services/v1/_search","dataRoot":"Licenses","applNosParam":"applicationNumber","businessIdProperty":"applicationNumber","applsStatusParam":"status"},"BPA_LOW,BPA,BPA_OC":{"searchPath":"http://localhost:8098/bpa-services/v1/bpa/_search","dataRoot":"BPA","applNosParam":"applicationNo","businessIdProperty":"applicationNo","applsStatusParam":"status"},"ARCHITECT,ENGINEER,STRUCTURALENGINEER,BUILDER":{"searchPath":"http://localhost:8088/tl-services/v1/BPAREG/_search","dataRoot":"Licenses","applNosParam":"applicationNumber","businessIdProperty":"applicationNumber","applsStatusParam":"status"},"FIRE_NOC_SRV,FIRE_NOC_OFFLINE,AIRPORT_NOC_OFFLINE,AIRPORT_NOC_SRV":{"searchPath":"http://localhost:8099/noc-services/v1/noc/_search","dataRoot":"Noc","applNosParam":"applicationNo","businessIdProperty":"applicationNo","applsStatusParam":"status"},"NewWS1,ModifyWSConnection,DisconnectWSConnection":{"searchPath":"http://localhost:1080/ws-services/wc/_search","dataRoot":"WaterConnection","applNosParam":"applicationNumber","businessIdProperty":"applicationNo","applsStatusParam":"applicationStatus"},"NewSW1,ModifySWConnection,DisconnectSWConnection":{"searchPath":"http://localhost:1081/sw-services/swc/_search","dataRoot":"SewerageConnections","applNosParam":"applicationNumber","businessIdProperty":"applicationNo","applsStatusParam":"applicationStatus"},"BS.AMENDMENT":{"searchPath":"http://localhost:1082/billing-service/amendment/_search","dataRoot":"Amendments","applNosParam":"consumerCode","businessIdProperty":"amendmentId","applsStatusParam":"status"}} - -# CONFIGS -bs.businesscode.service.search= {"WS":{"searchPath":"http://localhost:1080/ws-services/wc/_search","dataRoot":"WaterConnection","consumerCodeParam":"connectionNumber","consumerParamInService":"connectionNo"},"SW":{"searchPath":"http://localhost:1081/sw-services/swc/_search","dataRoot":"SewerageConnections","consumerCodeParam":"connectionNumber","consumerParamInService":"connectionNo"}} - -# user url -egov.user.host=http://localhost:8090 -egov.user.search.path=/user/_search -egov.user.create.path=/user/users/_createnovalidate - -egov.searcher.host=http://localhost:9094 -egov.searcher.pt.search.path=/egov-searcher/property-services/inboxpropertysearch/_get -egov.searcher.tl.search.path=/egov-searcher/tl-services/inboxtlsearch/_get -egov.searcher.pt.count.path=/egov-searcher/property-services/inboxpropertysearchcount/_get -egov.searcher.tl.count.path=/egov-searcher/tl-services/inboxtlsearchcount/_get -egov.searcher.pt.search.desc.path=/egov-searcher/property-services/inboxpropertysearchdesc/_get -egov.searcher.tl.search.desc.path=/egov-searcher/tl-services/inboxtlsearchdesc/_get -# BPA Searcher end-points -egov.searcher.bpa.citizen.search.path=/egov-searcher/bpa-services/inboxbpacitizensearch/_get -egov.searcher.bpa.citizen.count.path=/egov-searcher/bpa-services/inboxbpacitizensearchcount/_get -egov.searcher.bpa.citizen.search.desc.path=/egov-searcher/bpa-services/inboxbpacitizensearchdesc/_get -egov.searcher.bpa.search.path=/egov-searcher/bpa-services/inboxbpastakeholdersearch/_get -egov.searcher.bpa.count.path=/egov-searcher/bpa-services/inboxbpastakeholdersearchcount/_get -egov.searcher.bpa.search.desc.path=/egov-searcher/bpa-services/inboxbpastakeholdersearchdesc/_get -egov.searcher.bpa.tenant.wise.applnno.path=/egov-searcher/bpa-services/inboxbpastakeholdertenantwiseapplnsearch/_get -egov.searcher.bpa.citizen.tenant.wise.applnno.path=/egov-searcher/bpa-services/inboxbpacitizentenantwiseapplnsearch/_get -#NOC Searcher end-points -egov.searcher.noc.search.path=/egov-searcher/noc-services/inboxnocsearch/_get -egov.searcher.noc.count.path=/egov-searcher/noc-services/inboxnocsearchcount/_get -egov.searcher.noc.search.desc.path=/egov-searcher/noc-services/inboxnocsearchdesc/_get - -#FSM count end-point -egov.searcher.fsm.count.path=/egov-searcher/fsm-services/inboxfsmsearchcount/_get -egov.searcher.fsm.dsoid.path=/egov-searcher/fsm-services/inboxfsmdsoId/_get - -#WS Searcher end-points -egov.searcher.ws.search.path=/egov-searcher/ws-services/inboxwssearch/_get -egov.searcher.ws.count.path=/egov-searcher/ws-services/inboxwssearchcount/_get -egov.searcher.ws.search.desc.path=/egov-searcher/ws-services/inboxwssearchdesc/_get - -#SW Searcher end-points -egov.searcher.sw.search.path=/egov-searcher/sw-services/inboxswsearch/_get -egov.searcher.sw.count.path=/egov-searcher/sw-services/inboxswsearchcount/_get -egov.searcher.sw.search.desc.path=/egov-searcher/sw-services/inboxswsearchdesc/_get - -#BS WS Searcher end-points -egov.searcher.bs.search.path=/egov-searcher/bsWs-service/inboxbswssearch/_get -egov.searcher.bs.count.path=/egov-searcher/bsWs-service/inboxbswssearchcount/_get -egov.searcher.bs.search.desc.path=/egov-searcher/bsWs-service/inboxbswssearchdesc/_get - -#BS SW Searcher end-points -egov.searcher.bs.sw.search.path=/egov-searcher/bsSw-service/inboxbsswsearch/_get -egov.searcher.bs.sw.count.path=/egov-searcher/bsSw-service/inboxbsswsearchcount/_get -egov.searcher.bs.sw.search.desc.path=/egov-searcher/bsSw-service/inboxbsswsearchdesc/_get - -#getchartv2 end points -egov.dashboard.analytics.host=http://localhost:8282 -egov.dashboard.analytics.getchartv2.path=/dashboard-analytics/dashboard/getChartV2 - -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search - -egov.es.username=egov-admin -egov.es.password=TUSYns9mEcRPy77n -services.esindexer.host=http://localhost:9200/ -egov.services.esindexer.host.search=/_search -management.health.elasticsearch.enabled=false -parent.level.tenant.id=pb - -egov.internal.microservice.user.uuid=b5b2ac70-d347-4339-98f0-5349ce25f99f - -# central-instance configs -state.level.tenantid.length=2 -is.environment.central.instance=false - -#Elastic search properties -water.es.index=water-services -sewerage.es.index=sewerage-services -es.search.pagination.default.limit=50 -es.search.pagination.default.offset=0 -es.search.pagination.max.search.limit=1000 -es.search.default.sort.order=desc - -#Inbox search properties -inbox.water.search.allowed=true - -#state level tenant -state.level.tenant.id=pb -cache.expiry.minutes=10 \ No newline at end of file diff --git a/build/maven-java8/Dockerfile b/build/maven-java8/Dockerfile new file mode 100644 index 00000000000..65ca7d58513 --- /dev/null +++ b/build/maven-java8/Dockerfile @@ -0,0 +1,31 @@ +FROM egovio/alpine-maven-builder-jdk-8:1-master-NA-6036091e AS build +# FROM egovio/amazoncorretto:17-alpine3.19 AS build +ARG WORK_DIR +WORKDIR /app + +# Install Maven +RUN apk add --no-cache maven + +# copy the project files +COPY ${WORK_DIR}/pom.xml ./pom.xml +COPY build/maven-java8/start.sh ./start.sh + +# not useful for stateless builds +# RUN mvn -B dependency:go-offline + +COPY ${WORK_DIR}/src ./src +RUN mvn -B -f /app/pom.xml package + + +# Create runtime image +FROM egovio/8-openjdk-alpine +# FROM egovio/amazoncorretto:17-alpine3.19 + + +WORKDIR /opt/egov + +COPY --from=build /app/target/*.jar /app/start.sh /opt/egov/ + +RUN chmod +x /opt/egov/start.sh + +CMD ["/opt/egov/start.sh"] \ No newline at end of file diff --git a/business-services/build/maven/start.sh b/build/maven-java8/start.sh similarity index 100% rename from business-services/build/maven/start.sh rename to build/maven-java8/start.sh diff --git a/build/maven/Dockerfile b/build/maven/Dockerfile index c313c3b17c7..877e5d9da83 100644 --- a/build/maven/Dockerfile +++ b/build/maven/Dockerfile @@ -1,9 +1,11 @@ - #FROM egovio/alpine-maven-builder-jdk-8:1-master-NA-6036091e AS build -FROM ghcr.io/egovernments/alpine-maven-builder-jdk-8:1-master-na-6036091e AS build +FROM egovio/amazoncorretto:17-alpine3.19 AS build ARG WORK_DIR WORKDIR /app +# Install Maven +RUN apk add --no-cache maven + # copy the project files COPY ${WORK_DIR}/pom.xml ./pom.xml COPY build/maven/start.sh ./start.sh @@ -17,7 +19,7 @@ RUN mvn -B -f /app/pom.xml package # Create runtime image #FROM egovio/8-openjdk-alpine -FROM ghcr.io/egovernments/8-openjdk-alpine:latest +FROM egovio/amazoncorretto:17-alpine3.19 WORKDIR /opt/egov diff --git a/business-services/.github/ISSUE_TEMPLATE/bug_report.md b/business-services/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea7824f..00000000000 --- a/business-services/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/business-services/.github/ISSUE_TEMPLATE/feature_request.md b/business-services/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d615..00000000000 --- a/business-services/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/business-services/.github/workflows/codeql-analysis.yml b/business-services/.github/workflows/codeql-analysis.yml deleted file mode 100644 index c158e9ff66b..00000000000 --- a/business-services/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,67 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ master, *release-*, RELEASE*, develop ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '16 17 * * 3' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'java' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/business-services/.gitignore b/business-services/.gitignore deleted file mode 100644 index 5c2027f43d0..00000000000 --- a/business-services/.gitignore +++ /dev/null @@ -1,192 +0,0 @@ -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -# Java / Maven -.classpath -.project -.settings/ -.mvnw/ -target/ - -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# next.js build output -.next - -# nuxt.js build output -.nuxt - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - - -# Macbook General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk \ No newline at end of file diff --git a/business-services/.sonarcloud.properties b/business-services/.sonarcloud.properties deleted file mode 100644 index 8b137891791..00000000000 --- a/business-services/.sonarcloud.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/business-services/CODEOWNERS b/business-services/CODEOWNERS deleted file mode 100644 index 9a9bb36ed04..00000000000 --- a/business-services/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @egovernments/services-pr-reviewer @talele08 @kavi-egov diff --git a/business-services/Docs/billingservice/BillAmendment/v1.0.yml b/business-services/Docs/billingservice/BillAmendment/v1.0.yml deleted file mode 100644 index 4d513ed0490..00000000000 --- a/business-services/Docs/billingservice/BillAmendment/v1.0.yml +++ /dev/null @@ -1,279 +0,0 @@ -swagger: '2.0' -info: - version: 1.0.0 - title: eGov Billing Service Amemdment APIs - description: |- - The Bill amendement service manages head wise demand detail addition to the existing demands based on an external stimuli such as Court case settlement/One time waiver and so on.It manages - * The alteration to the demand data for a revenue module with category of tax for a defined *period. - * The Demand data with period and head wise dues and its payment details. - * Service APIs supports single tenant only - contact: - name: eGovernments Foundation -schemes: - - https -basePath: /billingservice/ -x-common-path: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml' -paths: - /amendment/_search: - post: - description: 'Returns an amendment along with its list of demand details which are being amended into the existing entity. Along with tenantId, any one parameter is mandatory. In case search is performed based on the demand amounts, then demandFrom and demandTo parameters will be mandatory.' - parameters: - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/requestInfo' - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/tenantId' - - name: demandId - in: query - description: Id of the Demand related to the amendment object to be returned - required: false - type: string - - name: consumerCode - in: query - description: Unique identification provided by business details. - required: false - type: string - - name: businessService - in: query - description: 'Billing system details e.g., PropertyTax,Water Charges etc.' - required: true - type: string - tags: - - Amendment - responses: - '200': - description: returns a amendment along with its demand details. - schema: - $ref: '#/definitions/AmendmentResponse' - '400': - description: Invalid input - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' - /amendment/_create: - post: - description: Creates a Amendment. - parameters: - - name: Amendment - in: body - description: Request header for the Amendment. - required: true - schema: - $ref: '#/definitions/AmendmentRequest' - tags: - - Amendment - responses: - '201': - description: Created Amendment successfully. - schema: - $ref: '#/definitions/AmendmentResponse' - '400': - description: Invalid input - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' - /amendment/_update: - post: - description: Updates the workflow status of Amendment. - parameters: - - name: AmendmentUpdate - in: body - description: Request header for the Amendment. - required: true - schema: - $ref: '#/definitions/AmendmentUpdateRequest' - tags: - - Amendment - responses: - '200': - description: updated the workflow/status for amendment. - schema: - $ref: '#/definitions/AmendmentResponse' - '400': - description: Invalid input - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' -definitions: - Amendment: - type: object - description: 'A Object which holds the basic info about the revenue assessment for which the demand is generated like module name, consumercode, owner, etc.' - properties: - id: - type: string - description: uuid. - demandIds: - type: array - items: - type: string - description: uuid of the demands to which the order is being amended. - amendedDemandId: - type: string - description: uuid of the new demand created to implement the amendment. - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 128 - minLength: 4 - consumerCode: - type: string - description: Unique identification of billing entity. - amendmentId: - type: string - description: functional/formatted id generated from the id gen service. - businessService: - type: string - description: 'Billing system e.g., Property Tax, Water Charges etc.' - maxLength: 256 - minLength: 4 - amendmentReason: - type: string - enum: - - COURT_CASE_SETTLEMENT - - ARREAR_WRITE_OFF - - DCB_CORRECTION - - ONE_TIME_SETTLEMENT - - REMISSION_FOR_PROPERTY_TAX - - OTHERS - reasonDocumentNumber: - type: string - description: 'unique is provided in the physical document or govt order related to the amendment reason. Can be order number in case of court order, govt notice number in case of tax write off and document number for other scenarios.' - status: - type: string - enum: - - ACTIVE - - CANCELLED - - INWORKFLOW - workflow: - $ref: 'https://raw.githubusercontent.com/egovernments/core-services/master/docs/worfklow-2.0.yml#/definitions/ProcessInstance' - demandDetails: - type: array - items: - $ref: '#/definitions/DemandDetail' - documents: - type: array - items: - $ref: '#/definitions/Document' - description: documents based on requirment related to amendment type/Reason. - effectiveFrom: - type: number - format: int64 - description: starting date of the amendment effect on the revenue entity. can be required or not based on the amendment reason. - effectiveTill: - type: number - format: int64 - description: ending date of the amendment effect on the revenue entity. can be null in some cases even when there is a effective from. - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - additionalDetails: - type: object - description: field for capturing any additional details. - required: - - demandDetails - - consumerCode - - businessService - - tenantId - - amendmentreason - - documents - AmendmentUpdate: - type: object - description: The update object which carries the workflow action info along with the amendment id - properties: - id: - type: string - description: uuid of the amendment object. - amendmentId: - type: string - description: functional/formatted id of the amendment object. - workflow: - $ref: 'https://raw.githubusercontent.com/egovernments/core-services/master/docs/worfklow-2.0#/definitons/ProcessInstance' - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - additionalDetails: - type: object - description: field for capturing any additional details. - documents: - type: array - items: - $ref: '#/definitions/Document' - description: documents based on requirment related to amendment type/Reason. - required: - - amendmentId - - tenantId - DemandDetail: - type: object - description: A object holds a demand and collection values for a tax head and period. - properties: - id: - type: string - description: primary key of a DemandDetails. - demandId: - type: string - description: foriegn key of a DemandDetails from demand. - taxHeadMasterCode: - type: string - description: Tax Head code. - maxLength: 64 - minLength: 2 - taxAmount: - type: number - format: BigDecimal - description: demand amount. - collectionAmount: - type: number - default: 0 - description: collection against taxAmount. - additionalDetails: - type: object - description: field for capturing any additional details. - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 128 - minLength: 4 - required: - - taxHead - - taxAmount - - collectionAmount - Document: - title: Document - type: object - properties: - id: - maxLength: 64 - type: string - description: system id of the Document. - documentType: - type: string - description: 'unique document type code, should be validated with document type master' - fileStore: - type: string - description: File store reference key. - documentUid: - maxLength: 64 - type: string - description: 'The unique id(Pancard Number,Adhar etc.) of the given Document.' - additionalDetails: - type: object - description: Json object to capture any extra information which is not accommodated by model - description: This object holds list of documents attached during the transaciton for a property - AmendmentRequest: - properties: - RequestInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/RequestInfo' - Amendment: - $ref: '#/definitions/Amendment' - type: object - AmendmentUpdateRequest: - properties: - RequestInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/RequestInfo' - AmendmentUpdate: - $ref: '#/definitions/AmendmentUpdate' - type: object - AmendmentResponse: - properties: - ResponseInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ResponseInfo' - Amendments: - type: array - maximum: 500 - items: - $ref: '#/definitions/Amendment' - type: object diff --git a/business-services/Docs/billingservice/V-2.0.yml b/business-services/Docs/billingservice/V-2.0.yml deleted file mode 100644 index 9f5991986c8..00000000000 --- a/business-services/Docs/billingservice/V-2.0.yml +++ /dev/null @@ -1,743 +0,0 @@ -swagger: '2.0' -info: - version: '1.1.0' - title: eGov Billing Service APIs - description: |- - eGov Billing Service manages head wise demand and Demand Bill information for all the revenue modules from eGov solution. It manages - * The demand data for a revenue module with category of tax for a defined *period, rebate, penalty, late payment interest, fee* etc and again head wise in each category. This module have one entity called Demand for every revenue entity which holds the list of category and head wise demands for a defined period in DemandDetail. - * The Demand Bill data with period and head wise dues and its payment details. - * Service APIs supports single tenant only - contact: - name: eGovernments Foundation -schemes: - - https -basePath: /billingservice/ -x-common-path: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml' -paths: - /demand/_search: - post: - description: 'Returns a demand along with its list of demand details. Along with tenantId, any one parameter is mandatory. In case search is performed based on the demand amounts, then demandFrom and demandTo parameters will be mandatory. When both demandFrom and demandTo parameters are passed, the type parameter will be mandatory. By default results will be sorted by fromDate' - - parameters: - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/requestInfo' - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/tenantId' - - name: demandId - in: query - description: Id(s) of the Demand(s) to be returned - required: false - type: array - items: - type: string - - name: consumerCode - in: query - description: Unique identification provided by business details. - required: false - type: array - items: - type: string - - name: email - in: query - description: Email Id of Primary owner of business detail. - required: false - type: string - - name: mobileNumber - in: query - description: Mobile Number of Primary owner of business detail. - required: false - type: string - - name: businessService - in: query - description: 'Billing system details e.g., PropertyTax,Water Charges etc.' - required: true - type: string - tags: - - Demand - responses: - '200': - description: returns a demand along with its demand details. - schema: - $ref: '#/definitions/DemandResponse' - '400': - description: Invalid input - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' - /demand/_create: - post: - description: Creates a demand along with its list of demand details - parameters: - - name: demand - in: body - description: Request header for the demand. - required: true - schema: - $ref: '#/definitions/DemandRequest' - tags: - - Demand - responses: - '201': - description: Created Demand(s) successfully. - schema: - $ref: '#/definitions/DemandResponse' - '400': - description: Invalid input - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' - /demand/_update: - post: - description: Updates a demand. - parameters: - - name: demand - in: body - description: Request header for the demand. - required: true - schema: - $ref: '#/definitions/DemandRequest' - tags: - - Demand - responses: - '200': - description: updated a collection amount for demand. - schema: - $ref: '#/definitions/DemandResponse' - '400': - description: Invalid input - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' - -/bill/_search: - post: - description: 'Returns a Bill along with its list of bill details. By default active and non-cancelled bills will be returned when no value passed for active or cancelled. Along with tenantId, any one parameter is mandatory. By default results will be sorted by bill creation date' - - parameters: - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/requestInfo' - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/tenantId' - - name: billId - in: query - description: Id(s) of the Bill(s) to be returned - required: false - type: array - items: - type: string - - name: isActive - in: query - description: 'true when active bill required, when inactive bill required.' - required: false - type: boolean - - name: isCancelled - in: query - description: 'true when cancelled bill required, false when non-cancelled bill required.' - required: false - type: boolean - - name: billType - in: query - description: Bill type. AUTO or MANUAL - required: false - type: string - - name: consumerCode - in: query - description: A unique identification for a billing entity. - required: false - type: string - - name: service - in: query - description: Name of the business service for which 'TaxHeadMaster' to be returned. - required: false - type: string - - name: size - in: query - description: size of the result set. - required: false - type: integer - - name: offset - in: query - description: starting index of the result set. - required: false - type: integer - tags: - - Bill - responses: - '200': - description: returns a Bill along with its bill details. - schema: - $ref: '#/definitions/BillResponse' - '400': - description: Invalid input - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' - -/bill/_generate: - post: - description: 'Creates a Bill for collections. By default active bill will be created. Along with tenantId, any one parameter is mandatory. The bill type is AUTO here.' - - parameters: - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/requestInfo' - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/tenantId' - - name: demandId - in: query - description: Primary key of Demand object. - required: false - type: integer - format: int64 - - name: consumerCode - in: query - description: A unique identification for a demand entity with respect to the consumer and the service being consumer. - required: false - type: string - - name: businessService - in: query - description: 'The service which demand is generated e.g., PropertyTax,Water Charges etc.' - required: false - type: string - - name: email - in: query - description: Email Id of Primary owner of business detail. - required: false - type: string - - name: mobileNumber - in: query - description: Mobile number of Primary owner of business detail. - required: false - type: string - tags: - - Bill - responses: - '201': - description: 'Creates a Bill along with its bill details. Ex- If search is done using mobile number, combined bill will be generated, having information for each of the services(ex-Property tax, Water charges)' - schema: - $ref: '#/definitions/BillResponse' - '400': - description: Invalid input - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' - /bill/_fetchBill: - post: - description: 'Creates a Bill for collections. By default active bill will be created. Along with tenantId, any one parameter is mandatory. Trigers bill generate internally, Checks whether a demand exists for the given data in db else creates a new one throught the revenue services.' - parameters: - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/requestInfo' - - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/tenantId' - - name: demandId - in: query - description: Primary key of Demand object. - required: false - type: integer - format: int64 - - name: consumerCode - in: query - description: A unique identification for a billing entity. - required: false - type: string - - name: businessService - in: query - description: 'Billing system details e.g., PropertyTax,Water Charges etc.' - required: true - type: string - - name: email - in: query - description: Email Id of Primary owner of business detail. - required: false - type: string - - name: mobileNumber - in: query - description: Mobile number of Primary owner of business detail. - required: false - type: string - tags: - - Bill - responses: - '201': - description: 'Creates a Bill along with its bill details. Ex- If search is done using mobile number, combined bill will be generated, having information for each of the services(ex-Property tax, Water charges)' - schema: - $ref: '#/definitions/BillResponse' - '400': - description: Invalid input - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' -definitions: - Demand: - type: object - description: 'A Object which holds the basic info about the revenue assessment for which the demand is generated like module name, consumercode, owner, etc.' - properties: - id: - type: string - description: primary key of a demand. - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 128 - minLength: 4 - consumerCode: - type: string - description: Unique identification of billing entity. - consumerType: - type: string - description: Consumer type of billing entity. - businessService: - type: string - description: 'Billing system e.g., Property Tax, Water Charges etc.' - maxLength: 256 - minLength: 4 - payer: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/egov-user/contracts/v1-1-0.yml#/definitions/User' - taxPeriodFrom: - type: integer - format: int64 - description: start date from when the tax is applicable. - taxPeriodTo: - type: integer - format: int64 - description: end date till when the tax is applicable. - demandDetails: - type: array - items: - $ref: '#/definitions/DemandDetail' - billExpiryTime: - type: integer - format: int64 - description: Time in epoch indicating the period in which the bills generated for this particular demand expires or invalidates. - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - additionalDetails: - type: object - description: field for capturing any additional details. - status: - type: string - enum: - - ACTIVE - - CANCELLED - - ADJUSTED - required: - - taxPeriodFrom - - taxPeriodTo - - demandDetails - - consumerCode - - businessService - - minimumAmountPayable - - tenantId - - consumerType - - owner - DemandDetail: - type: object - description: A object holds a demand and collection values for a tax head and period. - properties: - id: - type: string - description: primary key of a DemandDetails. - demandId: - type: string - description: foriegn key of a DemandDetails from demand. - taxHeadMasterCode: - type: string - description: Tax Head code. - maxLength: 64 - minLength: 2 - taxAmount: - type: number - format: BigDecimal - description: demand amount. - collectionAmount: - type: number - default: 0 - description: collection against taxAmount. - additionalDetails: - type: object - description: field for capturing any additional details. - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 128 - minLength: 4 - required: - - taxHead - - taxAmount - - collectionAmount - TaxHeadMaster: - type: object - description: 'A object holds a tax heads for each reason category and service along with glcodes for financial posting, for example General tax, Edu cess, lib cess for TAX.' - properties: - id: - type: string - description: primary key of a TaxHeadMaster. - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 128 - minLength: 4 - category: - type: string - description: 'Category of demand like tax, fee, rebate, penalty etc.' - enum: - - TAX - - FEE - - CHARGES - - REBATE - - ADVANCE_COLLECTION - - PENALTY - - FINES - service: - type: string - description: Service for which the Tax Head is defined. - maxLength: 64 - minLength: 2 - name: - type: string - description: Tax Head name. - maxLength: 64 - minLength: 2 - code: - type: string - description: Tax Head code. - maxLength: 64 - minLength: 2 - glcodes: - type: string - order: - type: integer - format: int64 - description: Order of the tax heads in which the collection has to be done. - isDebit: - type: boolean - description: Particular demand goes as credit or debit. - default: false - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - required: - - name - - category - - service - - validFrom - - validTill - - tenantId - TaxPeriod: - type: object - description: An object which holds the tax period info - properties: - id: - type: string - description: Id of the bill - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 128 - minLength: 4 - periodCycle: - type: string - description: A period cycle. One business service can have multiple period cycles. - enum: - - MONTH - - QUARTER - - HALFYEAR - - ANNUAL - fromDate: - type: integer - format: int64 - description: 'Time in epoch, Start date for tax period' - toDate: - type: integer - format: int64 - description: 'Time in epoch, End date for tax period' - service: - type: string - description: Name of the module this period belongs to. - code: - type: string - description: Description/Code of a tax period. - financialYear: - type: string - description: Financial year for which this period belongs. - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - required: - - id - - tenantId - - fromDate - - toDate - - service - - code - Bill: - type: object - properties: - id: - type: string - description: Id of the bill - mobileNumber: - type: string - description: MobileNumber of the payer. - payerName: - type: string - description: name of the payer. - payerAddress: - type: string - description: Address details from the payer. - payerEmail: - type: string - description: email address of the payer. - status: - type: string - description: 'status of the bill .' - enum: - - ACTIVE - - CANCELLED - - PAID - - EXPIRED - totalAmount: - type: number - businessService: - type: string - description: BusinessService code. - billDate: - type: number - format: int64 - description: Bill date. - billNumber: - type: string - description: Bill number. - consumerCode: - type: string - description: Consumer code of the entity for which the bill is being created. - collectionModesNotAllowed: - type: array - items: - type: string - description: List of collection modes not allowed. - partPaymentAllowed: - type: boolean - description: 'true if part payment allowed, false if part payment is not allowed.' - additionalDetails: - type: object - description: field for capturing any additional details. - billDetails: - type: array - items: - $ref: '#/definitions/BillDetail' - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 128 - minLength: 4 - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - BillDetail: - type: object - properties: - id: - type: string - description: Id of bill details - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 256 - minLength: 4 - demandId: - type: string - description: Unique Identifier of the demand associated with the bill detail - billId: - type: string - description: Id of bill - expiryDate: - type: number - format: int64 - description: end of bill validity in epoch time. - amount: - type: number - description: Total bill amount to be paid. - fromPeriod: - type: number - format: int64 - description: starting date of the demand period referred by the bill detail. - toPeriod: - type: number - format: int64 - description: ending date of the demand period referred by the bill detail. - additionalDetails: - type: object - description: field for capturing any additional details. - billAccountDetails: - type: array - items: - $ref: '#/definitions/BillAccountDetail' - BillAccountDetail: - type: object - properties: - id: - type: string - description: Id of bill account details - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 128 - minLength: 4 - billDetailId: - type: string - description: Id of billdetail - demandDetailId: - type: string - description: unique id of the demand detail object. - order: - type: integer - format: int32 - description: Order number used for apportioning amount in case of part payment. - amount: - type: number - description: Credit account head amount to be paid. - isActualDemand: - type: boolean - description: True for tax/charges/penalty. False for advances(if any). - taxHeadCode: - type: string - description: field for capturing the taxhead-code value. - additionalDetails: - type: object - description: field for capturing any additional details. - BusinessServiceDetails: - type: object - description: The object holds the configuration details for each business service. - properties: - id: - type: string - description: Id of the bill - tenantId: - type: string - description: Unique Identifier of the tenant - maxLength: 128 - minLength: 4 - businessService: - type: string - description: BusinessService code. - collectionModesNotAllowed: - type: array - items: - type: string - description: List of collection modes not allowed. - partPaymentAllowed: - type: boolean - description: 'true if part payment allowed, false if part payment is not allowed.' - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - DemandRequest: - properties: - RequestInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/RequestInfo' - Demand: - type: array - minimum: 1 - maximum: 100 - items: - $ref: '#/definitions/Demand' - type: object - DemandResponse: - properties: - ResponseInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ResponseInfo' - Demands: - type: array - maximum: 500 - items: - $ref: '#/definitions/Demand' - type: object - DemandDetailResponse: - properties: - ResponseInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ResponseInfo' - DemandDetails: - type: array - maximum: 500 - items: - $ref: '#/definitions/DemandDetail' - type: object - BillRequest: - properties: - RequestInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/RequestInfo' - BillInfos: - type: array - minimum: 1 - maximum: 100 - items: - $ref: '#/definitions/Bill' - type: object - BillResponse: - properties: - ResponseInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ResponseInfo' - Bill: - type: array - maximum: 500 - items: - $ref: '#/definitions/Bill' - type: object - BusinessServiceDetailRequest: - properties: - RequestInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/RequestInfo' - businessServiceDetails: - type: array - minimum: 1 - maximum: 100 - items: - $ref: '#/definitions/BusinessServiceDetails' - type: object - BusinessServiceDetailResponse: - properties: - ResponseInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ResponseInfo' - businessServiceDetails: - type: array - maximum: 500 - items: - $ref: '#/definitions/BusinessServiceDetails' - type: object - TaxHeadMasterRequest: - properties: - RequestInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/RequestInfo' - taxHeadMasters: - type: array - minimum: 1 - maximum: 100 - items: - $ref: '#/definitions/TaxHeadMaster' - type: object - TaxHeadMasterResponse: - properties: - ResponseInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ResponseInfo' - taxHeadMasters: - type: array - maximum: 500 - items: - $ref: '#/definitions/TaxHeadMaster' - type: object - TaxPeriodRequest: - properties: - RequestInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/RequestInfo' - taxPeriods: - type: array - minimum: 1 - maximum: 100 - items: - $ref: '#/definitions/TaxPeriod' - type: object - TaxPeriodResponse: - properties: - ResponseInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ResponseInfo' - taxPeriods: - type: array - maximum: 500 - items: - $ref: '#/definitions/TaxPeriod' - type: object - taxAndPayment: - properties: - businessService: - type: string - description: unique code of the business service - taxAmount: - type: string - description: amount to be paid by the payer - amountPaid: - type: string - description: amount paid by the payer diff --git a/business-services/Docs/collection-services/V-2-0.yml b/business-services/Docs/collection-services/V-2-0.yml deleted file mode 100644 index a1374990cf6..00000000000 --- a/business-services/Docs/collection-services/V-2-0.yml +++ /dev/null @@ -1,681 +0,0 @@ -swagger: "2.0" -info: - version: 1.0.1 - title: Collection System - description: Collection Management System serves as revenue collection platform for all the billing systems through cash, cheque, dd, swipe machine. - contact: - name: eGovernments Foundation - email: contact@egovernments.org - -schemes: - - https -basePath: '/payments' -x-common-path: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml' - -paths: - /_search: - post: - summary: Searches the Payment based on search criteria - description: API to search payments based on search parameters like consumerCode, mobileNumber, transactionNumber etc. - parameters: - - $ref: "https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/requestInfo" - - $ref: "https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/parameters/tenantId" - - $ref: "#/parameters/pageSize" - - $ref: "#/parameters/pageNumber" - - $ref: "#/parameters/sortReceipt" - - name: ids - in: query - required: false - description: Payment Ids. - type: array - items: - type: string - - name: consumerCodes - in: query - required: false - description: Consumer Code . - type: array - items: - type: string - - name: receiptNumbers - in: query - required: false - description: List of receipt numbers. - type: array - items: - type: string - - name: fromDate - in: query - description: Transaction date, here search will happen as Transaction date is greater or equal to given fromDate. - required: false - type: integer - format: int64 - - name: toDate - in: query - description: Transaction date, here search will happen as Transaction date is lesser or equal to given toDate. - required: false - type: integer - format: int64 - - name: status - in: query - description: Search based on the status of the Payment. - required: false - type: array - items: - type: string - - name: instrumentStatus - in: query - description: Search based on the status of the instrument. - required: false - type: array - items: - type: string - - name: paymentModes - in: query - description: Search based on the Payment type such as cash, cheque, dd etc. - required: false - type: array - items: - type: string - - name: payerIds - in: query - required: false - description: The ids of the payer - type: array - items: - type: string - - name: transactionNumber - in: query - required: false - description: Unique tansaction number for multiple receipts created in one transaction. - type: string - minLength: 0 - maxLength: 64 - - name: mobileNumber - in: query - required: false - description: Unique tansaction number for multiple receipts created in one transaction. - type: string - minLength: 0 - maxLength: 64 - - name: billIds - in: query - required: false - description: List of bill ids to search receipts.Business details code is mandatory for searching with this criteria. - type: array - items: - type: string - - responses: - 200: - description: Successful response - schema: - type: array - items: - $ref: '#/definitions/PaymentResponse' - '400': - description: Invalid input. - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ErrorRes' - tags: - - Payment - - - - /_create: - post: - summary: Records the payment in the system - description: This API generates a transaction number and persists the payment details. The payment information is then pushed to queue for further processing. - parameters: - - name: PaymentRequest - in: body - description: Creates payment for list of bill - required: true - schema: - $ref: '#/definitions/PaymentRequest' - tags: - - Payment - responses: - '201': - description: Payment created sucessfully. - schema: - $ref: '#/definitions/PaymentResponse' - '400': - description: Invalid input. - - /_validate: - post: - summary: Validates the PaymentRequest - description: | - The API runs the following set of validations on the payment request. - 1. Bill is present and is in valid state - 2. Amount paid is positive integer - 3. Zero amount payment is allowed only if bill amount is zero - 4. Payment mode is allowed - 5. Partial Payment is allowed based on the businessService - 6. Advance payment is allowed based on the businessService - parameters: - - name: PaymentRequest - in: body - description: The request to be validated - required: true - schema: - $ref: '#/definitions/PaymentRequest' - tags: - - Payment - responses: - '201': - description: Payment info validated sucessfully. - schema: - $ref: '#/definitions/PaymentResponse' - '400': - description: Invalid input. - - /_workflow: - post: - summary: Performs workflow actions on the payment - description: | - The API can perform the following operations: - 1. Cancellation of receipts in open state. - 2. Remittance of instruments such as Cash, Cheque, DD . - 3. Dishonoring of instruments such as Cheque, DD. - parameters: - - name: PaymentWorkflowRequest - in: body - description: The workflow request - required: true - schema: - $ref: '#/definitions/PaymentWorkflowRequest' - tags: - - Payment - responses: - '201': - description: Payment status updated sucessfully. - schema: - $ref: '#/definitions/PaymentResponse' - '400': - description: Invalid input. - - -definitions: - PaymentRequest: - type: object - description: Payment Request with Request Info. - properties: - requestInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/RequestInfo' - Payment: - $ref: '#/definitions/Payment' - - PaymentResponse: - type: object - description: Receipt Request with Request Info. - properties: - responseInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/ResponseInfo' - Payment: - $ref: '#/definitions/Payment' - - - PaymentWorkflowRequest: - type: object - description: Payment Workflow Request with Request Info. - properties: - requestInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/RequestInfo' - Payment: - $ref: '#/definitions/PaymentWorkflow' - - - Bill: - type: object - properties: - paidBy: - type: string - description: Name of the Person who is making payment. - mobileNumber: - type: string - description: The mobileNumber of person who is paying - format: varchar - payerName: - type: string - description: The owner of the bill - format: varchar - payerAddress: - type: string - description: The address of the owner of the bill - format: varchar - payerEmail: - type: string - description: The email id of the owner of the bill - format: varchar - payerId: - type: string - description: The system user id of the owner of the bill - format: varchar - status: - type: string - description: status of the bill. - enum: - - ACTIVE - - CANCELLED - - PAID - - EXPIRED - reasonForCancellation: - type: string - description: The reason for cancellation of bill - format: varchar - isCancelled: - type: boolean - description: Boolean indicating if the bill is cancelled - format: varchar - additionalDetails: - type: object - description: Additional fields can be captured here - collectionModesNotAllowed: - type: array - description: The list of collection modes that are not allowed - items: - type: string - partPaymentAllowed: - type: boolean - description: Boolean flag indicating if partial payment is allowed to be collected - isAdvanceAllowed: - type: boolean - description: Flag indicating if advance can be collected - minimumAmountToBePaid: - type: number - description: The minumun amount that can be paid against the bill - format: double - businessService: - type: string - description: The businessService of the entity for which the bill is generated - format: varchar - totalAmount: - type: number - description: The total amount to be paid for the bill - format: double - consumerCode: - type: string - description: The consumer code for which bill is generated - format: varchar - billNumber: - type: string - description: The bill number generated by system - format: varchar - billDate: - type: number - description: The date on which bill is generated - format: int64 - billDetails: - type: array - items: - $ref: '#/definitions/BillDetail' - - - BillDetail: - type: object - properties: - id: - type: string - description: uuid of the billDetail. - tenantId: - type: string - description: tenantId of the billDetail. - demandId: - type: string - description: The id of the corresponding demand . - billId: - type: string - description: The id of the parent bill. - amount: - type: number - format: double - description: Amount to be paid for the bill detail. - amountPaid: - type: number - format: double - description: Amount paid by the citizen. - fromPeriod: - type: number - format: int64 - description: start date of the taxperiod - toPeriod: - type: number - format: int64 - description: end date of the taxperiod - receiptDate: - type: string - format: date - description: Receipt Date. - receiptType: - description: Type of Receipt. - items: - type: string - enum: - - ADHOC - - BILLBASED - - CHALLAN - channel: - type: string - description: To be used by third party applications, to send the channel name. - voucherHeader: - description: Voucher header need to refer from Finanicals. - boundary: - description: Boundary need to refer from Core services. - items: - type: string - manualReceiptNumber: - type: string - description: Manual Receipt Number for legacy reciepts. - manualReceiptDate: - type: number - description: Manual Receipt date for legacy reciepts. - collectionType: - type: string - description: collectionType of the payment. - billDescription: - type: string - description: Description of the bill. - expiryDate: - type: number - description: Expiry date in epoch - format: int64 - displayMessage: - type: string - cancellationRemarks: - type: string - description: Remarks related to cancellation of payment - billAccountDetails: - type: array - items: - $ref: '#/definitions/BillAccountDetail' - - BillAccountDetail: - type: object - properties: - id: - type: string - description: uuid of the billAccountDetail. - tenantId: - type: string - description: tenantId of the billAccountDetail. - billDetailId: - type: string - description: uuid of the parent billDetail. - demandDetailId: - type: string - description: uuid of the demand for which the parent billDetail is created. - order: - type: integer - description: Priority of the account detail. - amount: - type: number - description: Amount to be paid for the bill account detail - format: double - adjustedAmount: - type: number - description: The amount paid against the bill account detail - format: double - taxHeadCode: - type: string - description: The taxHeadCode of the bill account detail - additionalDetails: - type: object - description: Additional fields can be captured in this object as map - purpose: - type: string - description: purpose of the bill account detail. - enum: - - ARREAR - - CURRENT - - ADVANCE - - EXEMPTION - - ARREAR_LATEPAYMENT_CHARGES - - CURRENT_LATEPAYMENT_CHARGES - - CHEQUE_BOUNCE_PENALTY - - REBATE - - OTHERS - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - - - - - Payment: - type: object - properties: - tenantId: - type: string - description: Unique id of tenant. - format: varchar - maxLength: 64 - id: - type: string - description: Unique id of tenant. - format: varchar - maxLength: 64 - totalDue: - type: number - description: Total amount due. - totalAmountPaid: - type: number - description: Unique id of tenant. - format: double - transactionNumber: - type: string - description: Transaction number of the payment - format: varchar - maxLength: 128 - transactionDate: - type: number - description: The date of payment in epoch - format: int64 - paymentMode: - type: string - description: Mode of payment used. - format: varchar - enum: - - CASH - - CHEQUE - - DD - - ONLINE - - CARD - instrumentDate: - type: number - description: The instrument date - format: int64 - instrumentNumber: - type: string - description: The number of the instrument like dd number,cheque number etc. - format: varchar - maxLength: 128 - instrumentStatus: - type: string - description: The status of the instrument - format: varchar - enum: - - APPROVED - - APPROVALPENDING - - TOBESUBMITTED - - REMITTED - - REJECTED - - CANCELLED - - DISHONOURED - ifscCode: - type: string - description: IFSC code of the bank to which payment is made - format: varchar - maxLength: 64 - additionalDetails: - type: object - description: Any additional fields can be captured here as a map - paymentDetails: - type: array - items: - $ref: '#/definitions/PaymentDetail' - description: Payment details of each bill - paidBy: - type: string - description: The person who is paying the bill - format: varchar - maxLength: 128 - mobileNumber: - type: string - description: The mobileNumber of person who is paying - format: varchar - maxLength: 64 - payerName: - type: string - description: The owner of the bill - format: varchar - maxLength: 128 - payerAddress: - type: string - description: The address of the owner of the bill - format: varchar - maxLength: 1024 - payerEmail: - type: string - description: The email id of the owner of the bill - format: varchar - maxLength: 64 - payerId: - type: string - description: The system user id of the owner of the bill - format: varchar - maxLength: 64 - paymentStatus: - type: string - description: Unique id of tenant. - enum: - - NEW - - DEPOSITED - - CANCELLED - - DISHONOURED - - RECONCILED - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - required: - - tenantId - - totalAmountPaid - - paymentMode - - paidBy - - mobileNumber - - paymentDetails - - - PaymentDetail: - type: object - description: The payment details of each bill - properties: - id: - type: string - description: id of the payment detail - maxLength: 64 - tenantId: - type: string - description: tenantId of the payment detail - maxLength: 64 - totalDue: - type: number - description: The total amount to be paid for the bill corresponding to the payment detail - format: double - totalAmountPaid: - type: number - description: The amount that is being paid - format: double - manualReceiptNumber: - type: string - description: Receipt number entered manually for legacy data. - maxLength: 64 - receiptNumber: - type: string - description: The receipt number generated for the payment against the bill - maxLength: 64 - receiptType: - type: string - description: The receipt type generated for the payment against the bill - receiptDate: - type: integer - description: The epoch receipt date generated for the payment against the bill - businessService: - type: string - description: The code of the businessService to which the bill belongs - billId: - type: string - description: The id of the bill for which the payment is made - maxLength: 64 - bill: - $ref: '#/definitions/Bill' - additionalDetails: - type: integer - description: Any additional fields can be captured here as a map - auditDetails: - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-0-0.yml#/definitions/AuditDetails' - required: - - billId - - totalAmountPaid - - - - PaymentWorkflow: - type: object - description: Workflow object for payment - properties: - paymentId: - type: string - description: id of the payment on which to take action . - action: - type: string - description: the action to be taken on the payment - enum: - - CANCEL - - DISHONOUR - - REMIT - tenantId: - type: string - description: tenantId of the payment - reason: - type: string - description: reason for taking the action. - additionalDetails: - type: integer - description: Any additional fields can be captured here as a map - required: - - paymentId - - action - - tenantId - -parameters: - pageSize: - name: pageSize - in: query - description: Number of records returned. - type: integer - minimum: 0 - exclusiveMinimum: true - maximum: 100 - exclusiveMaximum: false - multipleOf: 10 - default: 20 - pageNumber: - name: pageNumber - in: query - description: Page number - type: integer - default: 1 - sortReceipt: - name: sort - in: query - description: Receipt results will be sorted by receiptnumber ascending by default. - type: array - uniqueItems: true - minItems: 1 - maxItems: 3 - collectionFormat: pipes - items: - type: string - pattern: '[-+](receiptNumber|receiptDate)' - default: - - +receiptNumber diff --git a/business-services/Docs/dss-dashboard/DSS Analytics Dashboard YAML Spec 1.0.0.yaml b/business-services/Docs/dss-dashboard/DSS Analytics Dashboard YAML Spec 1.0.0.yaml deleted file mode 100644 index a254b6c9078..00000000000 --- a/business-services/Docs/dss-dashboard/DSS Analytics Dashboard YAML Spec 1.0.0.yaml +++ /dev/null @@ -1,369 +0,0 @@ - -swagger: '2.0' -info: - title: DSS Analytics APIs - description: | - APIs for DSS Analytics Dashboard will mainly consist of 2 APIs. - The one which is used to get Configuration based on which the Dashboard has to be painted. - The other one will be the API which gets the data which is needed for the Visualization to paint different Graphs. - version: "1.0.0" -# the domain of the service, only for example -host: 'egov-micro-dev.egovernments.org' -# array of all schemes that the API supports, preferred https -schemes: - - http -# will be prefixed to all paths -basePath: '/dashboard/[APIEndPoint]' -produces: - - application/json - -paths: - /getDashboardConfig/{dashboardId}: - get: - summary: API to get the Dashboard Configuration which gives the Visualizations and Layout to paint - description: - This endpoint will pass the Dashboard ID from the URL to this API and will get the Dashboard Configuration from - the backend which will have the details of the Visualization Layouts which are to be designed in this Dashboard. - tags: - - Dashboard - parameters: - - name: dashboardId - in: path - description: ID of the Dashboard - required: true - type: string - responses: - '200': - description: Response for Success State of the API - schema: - $ref: '#/definitions/DashboardConfigResponse' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ErrorRes' - - /getChartV2: - post: - summary: Get Chart API will be responding with the Data for each visualization based on the Chart ID which has been sent - description: - Based on the Chart ID and the Visualization Type and the Request Dates and Filters, the API will aggregate the data and give the data which needs to be painted on Visualization Charts - tags: - - Order - parameters: - - in: body - name: order - required: true - description: This request object contains the Visualization for which the data has to be served. - schema: - $ref: '#/definitions/DashboardRequest' - responses: - '200': - description: Response for Success State of the API - schema: - $ref: '#/definitions/DashboardResponse' - '400': - description: Invalid input. - schema: - $ref: '#/definitions/ErrorRes' - - -definitions: - Chart: - type: object - properties: - id: - type: integer - format: int64 - description: This field holds the Unique Identifier of the Charts - name: - type: string - description: Name of the Chart - code: - type: string - description: Unique Code to recognize the Chart - chartType: - type: string - description: Type of the Chart or Graph which will be painted on the UI for this partifular Chart Data is represented here. - format: enum - - PIE - - BAR - - METRIC - - LINE - - TABLE - filter: - type: object - description: A map of String and and String to hold the Filters which are applied on this chart - additionalProperties: - type: string - - Dimension: - type: object - properties: - height: - type: integer - description: Describes the Height of the Visualization - width: - type: integer - description: Describes the Width of the Visualization - - Plot: - type: object - properties: - label: - type: string - description: Label which has to be printed in the Visualization Charts - name: - type: string - description: Name of the legends which are to be used in the Charts - value: - type: integer - format: int64 - description: Holds the value of plot response - symbol: - type: string - description: Symbol that has to be used with the Value. Amount or Value or Percentage etc., - - Data: - type: object - properties: - headerName: - type: string - description: Name of the header when the grouping of all the plots are done - headerValue: - type: integer - format: int64 - description: Total Value of all the plots are put as Header Value - headerSymbol: - type: string - description: Symbol which has to be used to represent - plots: - type: array - description: Symbol that has to be used with the Value. Amount or Value or Percentage etc., - items: - $ref: "#/definitions/Plot" - - Visualization: - type: object - properties: - id: - type: integer - description: Unique Identifier for a Visualization - name: - type: string - description: Name of the Visualization - dimensions: - $ref: "#/definitions/Dimension" - vizType: - type: string - description: Type of Visualization which groups the type of different charts in specific - charts: - type: array - items: - $ref: "#/definitions/Chart" - - Tab: - type: object - properties: - row: - type: integer - description: This defines the row number in which this Visualization will have to appear on UI - name: - type: string - description: Name of the tab on which the visualization has to appear is defined here - vizArray: - type: array - items: - $ref: "#/definitions/Visualization" - - Dashboard: - type: object - properties: - name: - type: string - description: Name of the Dashboard - id: - type: string - description: Unique ID of the Dashboard - isActive: - type: boolean - description: Active / Inactive Status of the Dashboard - style: - type: string - description: Type of the Style which will be represented - format: enum - - LINEAR - - TABBED - visualizations: - type: array - items: - $ref: "#/definitions/Tab" - - RequestDate: - type: object - properties: - startDate: - type: string - description: Request Date Starting Date field - endDate: - type: string - description: Request Date Ending Date Field - - AggregationRequest: - type: object - properties: - visualizationType: - type: string - description: Request mentions the type of Visualization which it needs the data for - format: enum - - PIE - - BAR - - METRIC - - LINE - - TABLE - visualizationCode: - type: string - description: Code of the Visualization for which the data has to be obtained. - queryType: - type: string - description: Type of Query which has to be used to get the data for this visualization - filter: - type: object - description: A map of String and and String to hold the Filters which are applied on this chart - additionalProperties: - type: string - moduleLevel: - type: string - description: Which Module is being represented is to be added here. - format: enum - - PT - - TL - - PGR - - HOME_REVENUE - - HOME_SERVICES - requestDate: - type: object - $ref: "#/definitions/RequestDate" - - DashboardRequest: - type: object - properties: - header: - type: object - description: A map of String and and String to hold the Header Filters which are applied on this dashboard - additionalProperties: - type: string - aggregationRequest: - $ref: "#/definitions/AggregationRequest" - - DashboardConfigResponse: - type: object - properties: - statusInfo: - type: object - description: Status Info - $ref: "#/definitions/StatusInfo" - responseData: - type: array - items: - $ref: "#/definitions/Dashboard" - - DashboardResponse: - type: object - properties: - statusInfo: - type: object - description: Status Info - $ref: "#/definitions/StatusInfo" - responseData: - type: array - items: - $ref: "#/definitions/ChartApiResponse" - - ChartApiResponse: - type: object - properties: - chartType: - type: string - description: Type of Chart which are to be used to represent the data on Dashboard - maxLength: 128 - chartFormat: - type: string - description: Format specifies as which library to be used to paint the visualizations - maxLength: 32 - drillDownChartId: - type: string - description: Chart ID which is to be used for Drill Downs - filter: - type: object - description: A map of String and and String to hold the Filters which are applied on this chart - additionalProperties: - type: string - data: - type: array - items: - $ref: "#/definitions/Data" - - SuccessResponse: - type: object - properties: - status: - $ref: "#/definitions/StatusInfo" - - StatusInfo: - type: object - readOnly: true - description: Status Information object will hold the run time status and the live response obtained from the server for the respective API Call. - properties: - statusCode: - type: string - description: unique API ID - maxLength: 128 - statusMessage: - type: string - description: API version - maxLength: 32 - errorCode: - type: integer - format: int64 - description: response time in epoch - errorMessage: - type: string - description: unique response message id (UUID) - will usually be the correlation id from the server - maxLength: 256 - - Error: - type: object - description: Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400. - properties: - code: - type: string - description: Error Code will be module specific error label/code to identiffy the error. All modules should also publish the Error codes with their specific localized values in localization service to ensure clients can print locale specific error messages. Example for error code would be User.NotFound to indicate User Not Found by User/Authentication service. All services must declare their possible Error Codes with brief description in the error response section of their API path. - message: - type: string - description: English locale message of the error code. Clients should make a separate call to get the other locale description if configured with the service. - description: - type: string - description: Optional long description of the error to help clients take remedial action. This will not be available as part of localization service. - params: - type: array - description: Some error messages may carry replaceable fields (say $1, $2) to provide more context to the message. E.g. Format related errors may want to indicate the actual field for which the format is invalid. Client's should use the values in the param array to replace those fields. - items: - type: string - required: - - code - - message - - ErrorRes: - type: object - description: All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure. - properties: - statusInfo: - $ref: '#/definitions/StatusInfo' - errors: - description: Error response array corresponding to Request Object array. In case of single object submission or _search related paths this may be an array of one error element - type: array - minLength: 1 - items: - $ref: '#/definitions/Error' - required: - - statusInfo \ No newline at end of file diff --git a/business-services/Docs/dss-dashboard/DSS Ingest YAML Spec 1.0.0.yaml b/business-services/Docs/dss-dashboard/DSS Ingest YAML Spec 1.0.0.yaml deleted file mode 100644 index 433f345116f..00000000000 --- a/business-services/Docs/dss-dashboard/DSS Ingest YAML Spec 1.0.0.yaml +++ /dev/null @@ -1,120 +0,0 @@ -swagger: '2.0' -info: - title: DSS Ingest APIs - description: APIs for DSS Ingest consist of 5 APIs. - version: "1.0.0" - -# the domain of the service, only for example -host: egov-micro-dev.egovernments.org - -# will be prefixed to all paths -basePath: /dashboard-ingest/ingest/[APIEndPoint] - -schemes: - - https - - http -produces: - - application/json - -paths: - /save: - post: - summary: API receives the Transaction Details JSON Request and passes it on to - description: - This API receives the Transaction Details JSON Request and passes it on to - the Service Layer for further process of persisting into elastic search. - tags: - - Ingest - parameters: - - name: body - in: body - required: true - schema: - $ref: '#/definitions/IncomingData' - responses: - '201': - description: Response for Success State of the API - '400': - description: Invalid input. - /upload: - post: - summary: API use to provide response for external data upload - description: - uploded file get parsed and stores target data to Elastic search. - consumes: [multipart/form-data] - parameters: - - in: formData - name: file - required: true - type: file - responses: - '201': - description: Response for Success State of the API - '400': - description: Invalid input. - - /migrate/{indexName}/{version}: - post: - summary: This api is used for scroll search - parameters: - - in: path - name: indexName - required: true - type: string - - in: path - name: version - required: true - type: string - description: Response for Success State of the API - responses: - 201: - description: create - - /pause/{consumerId}: - get: - summary: This API use to pause a active kafka consumer - parameters: - - in: path - name: consumerId - required: true - type: string - responses: - '200': - description: Response for Success State of the API - schema: - $ref: '#/definitions/Response' - '400': - description: Invalid input. - - /resume/{consumerId}: - get: - summary: This API is to resume a paused kafka consumer - parameters: - - in: path - name: consumerId - required: true - type: string - responses: - '200': - description: Response for Success State of the API - schema: - $ref: '#/definitions/Response' - '400': - description: Invalid input. - -definitions: - Response: - type: boolean - - IncomingData: - type: object - properties: - dataContext: - type: string - description: context of the transactional data - dataContextVersion: - type: string - description: version of the context - dataObject: - type: object - description: this contains the transactional object diff --git a/business-services/Docs/hrms-v1.0.0.yaml b/business-services/Docs/hrms-v1.0.0.yaml deleted file mode 100644 index 81c12bdd925..00000000000 --- a/business-services/Docs/hrms-v1.0.0.yaml +++ /dev/null @@ -1,670 +0,0 @@ - swagger: '2.0' - info: - version: 1.0.0 - title: Employee Information System APIs - Employee - description: >- - All APIs available from Employee Information System for employee services are listed here. - 1. To create statewide standardized database of the employee in order to streamline processes related to personnel management. - 2. To increase transparency for higher management for efficient resource planning - 3. Integration with rainmaker modules for security, authentication and workflow handling - 4. Setting KPIs for employees and timely report generation - - contact: - name: Vishal Mahuli - schemes: - - https - basePath: '/rainmaker-hrms/[API endpoint]' - paths: - /employees/_search: - post: - summary: Get the list of employees defined in the system. - description: > - Get the employee list based on the input parameters. Response will give - the minimum set of information related to the employee. - parameters: - - name: requestInfo - in: body - description: Common request info for getting employee. - required: true - schema: - $ref: >- - https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/RequestInfo - - name: codes - in: query - required: false - description: List of employee codes - type: array - items: - type: string - exclusiveMinimum: true - exclusiveMaximum: false - - name: names - in: query - required: false - description: List of employee names - type: array - items: - type: string - exclusiveMinimum: true - exclusiveMaximum: false - - name: departments - in: query - description: List of Department codes for the employee assignment. - required: false - type: array - items: - type: string - - name: designations - in: query - description: List of Designation codes for the employee assignment. - required: false - type: array - items: - type: string - - name: asOnDate - in: query - description: Epoch Date of assignment - required: false - type: number - - name: ids - in: query - description: List of Unique Id of employee - required: false - type: array - items: - type: integer - format: int64 - maxItems: 100 - - name: employeestatuses - in: query - description: List of Unique codes of employee status - required: false - type: array - items: - type: string - - name: employeetypes - in: query - description: List of Unique codes of employee type - required: false - type: array - items: - type: string - - name: uuids - in: query - description: List of Unique uuid of employee - required: false - type: array - items: - type: string - - name: positions - in: query - description: List of Unique Positions - required: false - type: array - items: - type: integer - - name: roles - in: query - description: List of Roles of employee - required: false - type: array - items: - type: string - - name: phone - in: query - description: Phone Number - required: true - type: string - - name: isActive - in: query - description: True will return active employees, False otherwise - required: true - type: boolean - - name: offset - in: query - description: Offset of the search result - required: true - type: integer - - name: limit - in: query - description: No of records to be returned from the offset - required: true - type: integer - - name: tenantid - in: query - description: Tenant id - required: true - type: string - responses: - '200': - description: Successful response - schema: - $ref: '#/definitions/EmployeeRes' - '400': - description: Invalid input. - schema: - $ref: >- - https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/ErrorRes - tags: - - Employee - /employees/_create: - post: - summary: >- - Create a new employee in the system along with all the related - informations like - assignment, jurisdiction, service, education and - probation - description: >- - To create a new employee we can use POST and set all the required and - non-mandatory parameters. When an employee is created, an user is also - created along with it. Type value in object will be "EMPLOYEE". - parameters: - - name: employees - in: body - description: Details for the new employee. - required: true - schema: - $ref: '#/definitions/EmployeeReq' - tags: - - Employee - responses: - '202': - description: Employee request accepted for creation. - schema: - $ref: '#/definitions/EmployeeRes' - '400': - description: Invalid Input. - schema: - $ref: >- - https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/ErrorRes - - /employees/_update: - post: - summary: Update Employee data for a particular employee - description: >- - To update an existing employee's employee details and all other details - like assignment, jurisdiction, qualification service details and - porbation. This API will also be used for deactivating an employee - parameters: - - name: employees - in: body - description: Request header for the employee with new of values. - required: true - schema: - $ref: '#/definitions/EmployeeReq' - tags: - - Employee - responses: - '202': - description: Employee request accepted for update. - schema: - $ref: '#/definitions/EmployeeRes' - '400': - description: Invalid input. - schema: - $ref: >- - https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/ErrorRes - - /employees/_count: - post: - summary: Get the list of count of active and inactive employee. - description: | - Get the list of count of active and inactive employee for given tenant Id. - parameters: - - $ref: 'https://raw.githubusercontent.com/egovernments/municipal-services/common-contract/docs/common-contract-v2-0-0.yml#/components/parameters/tenantId' - responses: - '200': - description: Successful response, present the list of count of active and inactive employee for given tenant Id. - schema: - $ref: '#/definitions/EmployeeCountResponse' - '400': - description: Invalid input. - schema: - $ref: 'https://raw.githubusercontent.com/egovernments/municipal-services/common-contract/docs/common-contract-v2-0-0.yml#/components/schemas/ErrorRes' - tags: - - Employee - - definitions: - Employee: - description: >- - An employee is by default User of the system. User will be created from - employee. - type: object - properties: - user: - type: object - description: User related information - $ref: 'https://raw.githubusercontent.com/egovernments/egov-services/master/docs/egov-user/contracts/v1-0-0.yml#/definitions/User' - id: - type: integer - description: Numeric id of the employee, this is same as user id. - uuid: - type: string - description: UUID of the employee, this is same as user uuid. - code: - type: string - description: >- - The unique code for an employee. This will autogenerated if - there's no input otherwise user will have to input a unique code. - minLength: 1 - maxLength: 256 - employeeStatus: - description: >- - Status of the employee from the status master where object type is - "Employee Master". Default value will be "EMPLOYED". Possible status - list for employee are - EMPLOYED,RETIRED,SUSPENDED and DECEASED - type: string - employeeType: - type: string - description: Type of employment of the employee from the EmployeeType. - dateOfAppointment: - type: number - format: int128 - description: Epoch Date of appointment of the employee. - jurisdictions: - type: array - description: >- - List of Jurisdictions for which this employee has - access to. Currently we dont validate this - minItems: 1 - maxItems: 50 - uniqueItems: true - items: - $ref: '#/definitions/Jurisdiction' - assignments: - type: array - description: List of assignments for the employee. - items: - $ref: '#/definitions/Assignment' - serviceHistory: - type: array - description: List of service history for the employee. - maxItems: 25 - uniqueItems: true - items: - $ref: '#/definitions/ServiceHistory' - isActive: - type: boolean - description: Field to mark whether the employee is active - education: - type: array - description: List of educational qualification for the employee. - maxItems: 25 - uniqueItems: true - items: - $ref: '#/definitions/EducationalQualification' - tests: - type: array - description: List of departmental tests qualified by the employee. - maxItems: 25 - uniqueItems: true - items: - $ref: '#/definitions/DepartmentalTest' - tenantId: - type: string - description: >- - Unique Identifier of which tenant this data is defined - maxLength: 256 - deactivationDetails: - type: array - description: List of deactivation details for the employee. - maxItems: 25 - uniqueItems: true - items: - $ref: '#/definitions/DeactivationDetails' - reactivationDetails: - type: array - description: List of reactivation details for the employee. - maxItems: 25 - uniqueItems: true - items: - $ref: '#/definitions/ReactivationDetails' - documents: - type: array - description: List of all the documents associated with an employee. - maxItems: 50 - uniqueItems: true - items: - $ref: '#/definitions/EmployeeDocuments' - auditDetails: - type: object - $ref: '#/definitions/AuditDetails' - required: - - jurisdictions - - assignments - - employeeStatus - - employeeType - - tenantId - - user - - Assignment: - type: object - properties: - id: - type: string - description: UUID of the assignment. - position: - type: integer - format: int64 - description: Position Id associated with the assignment - autogenerated. - designation: - type: string - description: Designation code associated with the assignment. - department: - type: string - description: Unique code of the Department associated with the assignment. - fromDate: - type: integer - format: int128 - description: Epoch value of From Date of assignment period. - toDate: - type: integer - format: int128 - description: Epoch value of Till Date of assignment period. - govtOrderNumber: - type: string - description: >- - The order number issued for any transfer, promotion, demotion or - delegation of power. - reportingTo: - type: string - description: Name of the employee who this employee reports to. - isHOD: - type: boolean - description: Value true means, this guy is the HOD under this assignment. - isCurrentAssignment: - type: boolean - description: Value true means, This is the guy's current assignment. - auditDetails: - type: object - $ref: '#/definitions/AuditDetails' - required: - - fromDate - - toDate - - department - - designation - - ServiceHistory: - type: object - properties: - id: - type: string - description: UUID of the service details. - serviceStatus: - type: string - description: Detail of the service that the employee has done. - serviceFrom: - type: integer - format: int128 - description: Epoch date on which this service was applicable from. - serviceTo: - type: integer - format: int128 - description: Epoch date on which this service was applicable from. - location: - type: string - description: The government order number passed for the service change. - orderNo: - type: string - description: The government order number passed for the service change. - isCurrentPosition: - type: boolean - description: Value signifies if this is the current working status. - auditDetails: - type: object - $ref: '#/definitions/AuditDetails' - required: - - orderNo - - serviceFrom - - serviceTo - - serviceStatus - - EducationalQualification: - type: object - properties: - id: - type: string - description: UUID of the qualification details. - qualification: - type: string - description: Name of the qualifying degree. - stream: - type: string - description: The main subject studies as part of the qualifying degree. - yearOfPassing: - type: integer - format: int32 - description: The year in which the employee has finished the qualification. - university: - type: string - description: >- - Name of the university/board from which the mentioned qualification - was acquired. - remarks: - type: string - description: Any remarks to be captured for this technical qualification. - auditDetails: - type: object - $ref: '#/definitions/AuditDetails' - required: - - qualification - - yearOfPassing - - stream - - DepartmentalTest: - type: object - properties: - id: - type: string - description: UUID of the departmental test details. - test: - type: string - description: Name of the Test taken. - yearOfPassing: - type: integer - format: int32 - description: The year in which the employee has qualified this test. - remarks: - type: string - description: Any general remarks. - auditDetails: - type: object - $ref: '#/definitions/AuditDetails' - required: - - test - - yearOfPassing - - EmployeeReq: - type: object - properties: - RequestInfo: - $ref: >- - https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/RequestInfo - Employee: - type: array - items: - $ref: '#/definitions/Employee' - required: - - RequestInfo - - Employee - - - EmployeeRes: - type: object - properties: - ResponseInfo: - $ref: >- - https://raw.githubusercontent.com/egovernments/egov-services/master/docs/common/contracts/v1-1-1.yml#/definitions/ResponseInfo - Employee: - type: array - items: - $ref: '#/definitions/Employee' - - - EmployeeDocuments: - type: object - properties: - id: - type: integer - format: int64 - description: The unique id of this object. - employeeId: - type: integer - format: int64 - description: The unique id of employee. - documentId: - type: string - description: The unique url for the document attached. - documentName: - type: string - description: Name of the document attached. - referenceType: - type: string - description: >- - Each details in Employee can have multiple documents attached. Based - on the reference type we are differentiate which document is relevant - from which details. - items: - type: string - enum: - - HEADER - - ASSIGNMENT - - JURISDICTION - - SERVICE - - EDUCATION - - TEST - - DEACTIVATION - referenceId: - type: string - description: The unique id of the referenced objecy. (Assignment id, Service id etc). - auditDetails: - type: object - $ref: '#/definitions/AuditDetails' - required: - - employeeId - - document - - Jurisdiction: - type: object - properties: - id: - type: string - format: uuid - description: UUID of the jurisdiction - autogenerated - hierarchy: - type: string - description: Hierarchy code from the boundary data - boundary: - type: string - description: Boundary code from the boundary data - boundaryType: - type: string - description: Boundary Type code from the boundary data - auditDetails: - type: object - $ref: '#/definitions/AuditDetails' - required: - - hierarchy - - boundary - - boundaryType - - DeactivationDetails: - type: object - properties: - id: - type: string - description: UUID of the deactivation detail - employeeId: - type: string - description: UUID of the employee to whom this details belongs. - reasonForDeactivation: - type: string - description: Reason for deactivation - effectiveFrom: - type: integer - format: int128 - description: Epoch date from which the deactivation is effective. - orderNo: - type: string - description: The government order number passed for the deactivation - typeOfDeactivation: - items: - type: string - enum: - - SUSPENSION - - DEATH - - RETIRED - auditDetails: - type: object - $ref: '#/definitions/AuditDetails' - - - ReactivationDetails: - type: object - properties: - id: - type: string - description: UUID of the deactivation detail - employeeId: - type: string - description: UUID of the employee to whom this details belongs. - reasonForReactivation: - type: string - description: Reason for deactivation - effectiveFrom: - type: integer - format: int128 - description: Epoch date from which the reactivation is effective. - orderNo: - type: string - description: The government order number passed for the reactivation - typeOfReactivation: - items: - type: string - enum: - - ORDER FROM COMISSIONER - - OTHERS - auditDetails: - type: object - $ref: '#/definitions/AuditDetails' - AuditDetails: - type: object - properties: - createdBy: - type: string - description: Id of the user who created the record. - createdDate: - type: integer - format: int64 - description: Epoch Date on which the user master data was added into the system. - lastModifiedBy: - type: string - description: Id of the user who last modified the record. - lastModifiedDate: - type: integer - format: int64 - description: Epoch Date on which the user master data was last modified. - - EmployeeCount: - type: object - description: Capture the employee count details - properties: - activeEmployee: - type: string - description: Number of active employee present in the system - inactiveEmployee: - type: string - description: Number of inactive employee present in the system - totalEmployee: - type: string - description: Total number of employee present in the system - - EmployeeCountResponse: - type: object - description: Response to the service request - properties: - responseInfo: - $ref: 'https://raw.githubusercontent.com/egovernments/municipal-services/common-contract/docs/common-contract-v2-0-0.yml#/components/schemas/ResponseHeader' - EmployeeCount: - $ref: '#/definitions/EmployeeCount' - -#Masters from MDMS - Department, Designation, Employee Status, Employee Type, Service Status, Roles, Qualification (?), Stream (?), University (?), Year, Departmental Test. \ No newline at end of file diff --git a/business-services/Jenkinsfile b/business-services/Jenkinsfile deleted file mode 100644 index 65396b22e12..00000000000 --- a/business-services/Jenkinsfile +++ /dev/null @@ -1,3 +0,0 @@ -library 'ci-libs' - -buildPipeline(configFile: './build/build-config.yml') \ No newline at end of file diff --git a/business-services/LICENSE b/business-services/LICENSE deleted file mode 100644 index 335fd5f8652..00000000000 --- a/business-services/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 eGovernments Foundation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/business-services/README.md b/business-services/README.md deleted file mode 100644 index 23e64b89c3d..00000000000 --- a/business-services/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# egov-java-template -template diff --git a/business-services/billing-service/.gitignore b/business-services/billing-service/.gitignore deleted file mode 100644 index 2af7cefb0a3..00000000000 --- a/business-services/billing-service/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ \ No newline at end of file diff --git a/business-services/billing-service/CHANGELOG.md b/business-services/billing-service/CHANGELOG.md deleted file mode 100644 index 3638c4b4ce6..00000000000 --- a/business-services/billing-service/CHANGELOG.md +++ /dev/null @@ -1,69 +0,0 @@ - -All notable changes to this module will be documented in this file. - -## 1.3.5 - 2023-08-11 -- Central Instance Library Integration - -## 1.3.4 - 2022-01-13 -- Updated to log4j2 version 2.17.1 -## 1.3.3 - 2021-07-26 - - - Earliest bill search - - Bill cancellation - - State level bill gen fix added - - Provision to add unbilled demands to bill generate - -## 1.3.2 - 2021-05-11 -- apportion fix -- Added size validations -- VUL-WEB-L008: added @SafeHtml annotaion on string fields -- VUL-WEB-L008: updated POM to add safeHtml validator libraries -- Fixed demand search queries with preparestatements - -## 1.3.1 - 2021-02-26 -- Updated domain name in application.properties - -## 1.3.0 - 2021-01-31 - -- Amenment APIs created and enabled - - -## 1.2.2 - -- fixed expiry date added in demand object - -## 1.2.2 - -## 1.2.1 - 2021-01-08 - -- state level search/fetch enable for bills for citizen only -- zero demands bill genereation restricted to only once - -## 1.2.1 - -## 1.2.0 - 2020-12-xx - -- back update error log created to record failures of payment to demand update. -- table eg_bs_payment_backupdate_audit created to log the above mentioned information and to validate for duplicate receipt enteries for payment update. - -## 1.2.0 - -## 1.1.1 - 2020-08-18 - -- user create enabled - -## 1.1.1 - -## 1.1.0 - 2020-06-25 - -- Added typescript definition generation plugin -- Upgraded to `tracer:2.0.0-SNAPSHOT` -- Upgraded to spring boot `2.2.6-RELEASE` -- Removed `start.sh` and `Dockerfile` -- Removed unused master request models, rowmappers -- Deprecated Bill V1 controller -- removed demand detail search - -## 1.0.0 - -- Base version diff --git a/business-services/billing-service/LOCALSETUP.md b/business-services/billing-service/LOCALSETUP.md deleted file mode 100644 index a46a158c0ee..00000000000 --- a/business-services/billing-service/LOCALSETUP.md +++ /dev/null @@ -1,43 +0,0 @@ -# Local Setup - -To setup the billing-service in your local system, clone the git repo(https://github.com/egovernments/business-services). - -## Dependencies - - -### Infra Dependency - -- [X] Postgres DB -- [ ] Redis -- [ ] Elasticsearch -- [X] Kafka - - [X] Consumer - - [ ] Producer - -## Running Locally - -To run the service locally, you need to port forward below services. - -```bash -function kgpt(){kubectl get pods -n egov --selector=app=$1 --no-headers=true | head -n1 | awk '{print $1}'} - -kubectl port-forward -n egov $(kgpt egov-user) 8085:8080 -kubectl port-forward -n egov $(kgpt egov-idgen) 8086:8080 -kubectl port-forward -n egov $(kgpt egov-mdms-service) 8087:8080 -kubectl port-forward -n egov $(kgpt egov-apportion-service) 8088:8080 -kubectl port-forward -n egov $(kgpt egov-localization) 8089:8080 -``` - -Update below listed properties in `application.properties` before running the project: - -```ini -user.service.hostname = http://127.0.0.1:8085 -egov.idgen.hostname = http://127.0.0.1:8086 - -# can use non port forwarded environment host as well -egov.mdms.host = http://127.0.0.1:8087 -egov.apportion.host = http://127.0.0.1:8088 - -# can use non port forwarded environment host as well -egov.localization.host = http://127.0.0.1:8089 -``` diff --git a/business-services/billing-service/README.md b/business-services/billing-service/README.md deleted file mode 100644 index 8a4c7d0d86c..00000000000 --- a/business-services/billing-service/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Billing-Service service - - Generates bills for revenue services. - -### DB UML Diagram - -NA - -### Service Dependencies - -- user -- ID-GEN -- Localisation -- Apportion-service - -### Swagger API Contract - -https://raw.githubusercontent.com/egovernments/business-services/master/Docs/billingservice/V-2.0.yml - -## Service Details - -Stores demand created by different services, demands can be created and updated, Bills can be generated for the stored demands. - -### API Details - -- Demand - the demand set of API's can be used to create and update demands. -- Bill - bill the APIs can be used generate bills based on existing demand. -- Bill/_fetchbill - the fetch bill API generates and new bill incase of the old bill being expired, if the demand doesnt exists then genrate/fetchbill will reult in error due to demand not found. - -### Kafka Consumers - -kafka.topics.receipt.update.demand.v2=egov.collection.payment-create -kafka.topics.receipt.cancel.name.v2=egov.collection.payment-cancel - -Kafka consumer listen to payment topic to update demand whenever payment is made against the bills. - -### Kafka Producers - -producers are disabled currently -kafka.topics.save.demand=save-demand -kafka.topics.update.demand=update-demand - diff --git a/business-services/billing-service/mvnw b/business-services/billing-service/mvnw deleted file mode 100644 index 5bf251c0774..00000000000 --- a/business-services/billing-service/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/business-services/billing-service/mvnw.cmd b/business-services/billing-service/mvnw.cmd deleted file mode 100644 index 019bd74d766..00000000000 --- a/business-services/billing-service/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/business-services/billing-service/pom.xml b/business-services/billing-service/pom.xml deleted file mode 100644 index 145a994776e..00000000000 --- a/business-services/billing-service/pom.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - - com.egov.demand - billing-service - 1.3.5-SNAPSHOT - billing-service - Demo project for Spring Boot - - 2.17.1 - true - UTF-8 - 1.8 - UTF-8 - 3.3.9 - 1.18.8 - 2.6 - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - commons-lang - commons-lang - ${commons-lang-version} - - - org.apache.commons - commons-lang3 - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework.kafka - spring-kafka - - - org.springframework.boot - spring-boot-devtools - runtime - - - org.postgresql - postgresql - - - org.projectlombok - lombok - true - - - org.springframework.boot - spring-boot-starter-test - test - - - org.egov - mdms-client - 0.0.4-SNAPSHOT - - - org.egov.services - services-common - 1.1.1-SNAPSHOT - - - org.egov.services - tracer - 2.1.2-SNAPSHOT - - - org.flywaydb - flyway-core - - - org.hibernate - hibernate-validator - 6.0.16.Final - - - org.jsoup - jsoup - 1.10.2 - - - - - repo.digit.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.demand.web.contract.DemandRequest - org.egov.demand.web.contract.DemandResponse - org.egov.demand.web.contract.BillRequestV2 - org.egov.demand.web.contract.BillResponseV2 - - - org.egov.common.contract.request.User:User - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - true - module - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - cz.habarta.typescript-generator - - - typescript-generator-maven-plugin - - - [2.22.595,) - - - generate - - - - - - - - - - - - - - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/BillingServiceApplication.java b/business-services/billing-service/src/main/java/org/egov/demand/BillingServiceApplication.java deleted file mode 100644 index ce9e08ad401..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/BillingServiceApplication.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand; - -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.config.TracerConfiguration; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.Primary; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -@SpringBootApplication -@Import({ TracerConfiguration.class, MultiStateInstanceUtil.class }) -public class BillingServiceApplication { - - @Bean - @Primary - public ObjectMapper getObjectMapper(){ - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - //objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); - return objectMapper; - } - - @Bean - public MappingJackson2HttpMessageConverter jacksonConverter() { - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - ObjectMapper mapper = new ObjectMapper(); - mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); - converter.setObjectMapper(mapper); - return converter; - } - - public static void main(String[] args) { - SpringApplication.run(BillingServiceApplication.class, args); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/Action.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/Action.java deleted file mode 100644 index 566bfe6d488..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/Action.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.egov.demand.amendment.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.demand.model.AuditDetails; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -/** - * A Object holds the basic data for a Trade License - */ - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId","currentState","action"}) -public class Action { - - @Size(max=256) - @JsonProperty("uuid") - private String uuid; - - @Size(max=256) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max=256) - @JsonProperty("currentState") - private String currentState; - - @NotNull - @Size(max=256) - @JsonProperty("action") - private String action; - - @NotNull - @Size(max=256) - @JsonProperty("nextState") - private String nextState; - - @NotNull - @Size(max=1024) - @JsonProperty("roles") - @Valid - private List roles; - - private AuditDetails auditDetails; - - - public Action addRolesItem(String rolesItem) { - if (this.roles == null) { - this.roles = new ArrayList<>(); - } - this.roles.add(rolesItem); - return this; - } - -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/Amendment.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/Amendment.java deleted file mode 100644 index 590aa21e0d7..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/Amendment.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.egov.demand.amendment.model; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.demand.amendment.model.enums.AmendmentReason; -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.DemandDetail; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * A Object which holds the basic info about the revenue assessment for which - * the demand is generated like module name, consumercode, owner, etc. - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class Amendment { - - @JsonProperty("id") - private String id; - - @JsonProperty("amendedDemandId") - private String amendedDemandId; - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @NotNull - @JsonProperty("consumerCode") - private String consumerCode; - - @JsonProperty("amendmentId") - private String amendmentId; - - @NotNull - @JsonProperty("businessService") - private String businessService; - - @NotNull - @JsonProperty("amendmentReason") - private AmendmentReason amendmentReason; - - @JsonProperty("reasonDocumentNumber") - private String reasonDocumentNumber; - - @JsonProperty("status") - private AmendmentStatus status; - - @JsonProperty("workflow") - private ProcessInstance workflow; - - @JsonProperty("demandDetails") - @Valid - @NotNull - private List demandDetails; - - @NotNull - @JsonProperty("documents") - @Valid - private List documents; - - @JsonProperty("effectiveFrom") - private Long effectiveFrom; - - @JsonProperty("effectiveTill") - private Long effectiveTill; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentCriteria.java deleted file mode 100644 index 653d5729fa9..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentCriteria.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.amendment.model; - -import java.util.HashSet; -import java.util.Set; - -import javax.validation.constraints.NotNull; - -import org.egov.demand.amendment.model.enums.AmendmentStatus; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class AmendmentCriteria { - - private String mobileNumber; - - @NotNull - private String tenantId; - - private String amendmentId; - - @Default - private Set consumerCode = new HashSet<>(); - - @NotNull - private String businessService; - - private Set status = new HashSet<>(); -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentRequest.java deleted file mode 100644 index 755439d1781..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentRequest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.egov.demand.amendment.model; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * AmendmentRequest - */ - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Data -public class AmendmentRequest { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @JsonProperty("Amendment") - @Valid - private Amendment amendment; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentResponse.java deleted file mode 100644 index 2e7da788fc9..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.egov.demand.amendment.model; - -import java.util.List; - -import javax.validation.Valid; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * AmendmentResponse - */ - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Data -public class AmendmentResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Amendments") - @Valid - private List amendments; - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentUpdate.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentUpdate.java deleted file mode 100644 index a261b401496..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentUpdate.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.egov.demand.amendment.model; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.egov.demand.model.AuditDetails; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * The update object which carries the workflow action info along with the - * amendment id - */ - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class AmendmentUpdate { - - @NotNull - @JsonProperty("amendmentId") - private String amendmentId; - - @JsonProperty("amendedDemandId") - private String amendedDemandId; - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("workflow") - @NotNull - private ProcessInstance workflow; - - private AmendmentStatus status; - - @JsonProperty("documents") - @Valid - private List documents; - - public AmendmentCriteria toSearchCriteria() { - - return AmendmentCriteria.builder() - .amendmentId(amendmentId) - .tenantId(tenantId) - .build(); - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentUpdateRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentUpdateRequest.java deleted file mode 100644 index 3b5864b5dd4..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/AmendmentUpdateRequest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.egov.demand.amendment.model; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class AmendmentUpdateRequest { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @JsonProperty("AmendmentUpdate") - @Valid - private AmendmentUpdate amendmentUpdate; - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/Document.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/Document.java deleted file mode 100644 index 378d79e7110..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/Document.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.demand.amendment.model; - -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * This object holds list of documents attached during the transaciton for a property - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class Document { - - @JsonProperty("id") - private String id; - - @JsonProperty("documentType") - @NotNull - private String documentType; - - @JsonProperty("fileStoreId") - @NotNull - private String fileStoreId; - - @JsonProperty("documentUid") - private String documentUid; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/ProcessInstance.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/ProcessInstance.java deleted file mode 100644 index 548284c9e51..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/ProcessInstance.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.egov.demand.amendment.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.contract.request.User; -import org.egov.demand.amendment.model.Document; -import org.egov.demand.model.AuditDetails; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -/** - * A Object holds the basic data for a Trade License - */ -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@EqualsAndHashCode(of = {"id"}) -@ToString -public class ProcessInstance { - - @Size(max=64) - @JsonProperty("id") - private String id; - - @NotNull - @Size(max=128) - @JsonProperty("tenantId") - private String tenantId; - - @NotNull - @Size(max=128) - @JsonProperty("businessService") - private String businessService; - - @NotNull - @Size(max=128) - @JsonProperty("businessId") - private String businessId; - - @NotNull - @Size(max=128) - @JsonProperty("action") - private String action; - - @NotNull - @Size(max=64) - @JsonProperty("moduleName") - private String moduleName; - - @JsonProperty("state") - private State state; - - @Size(max=1024) - @JsonProperty("comment") - private String comment; - - @JsonProperty("documents") - @Valid - private List documents; - - @JsonProperty("assigner") - private User assigner; - - @JsonProperty("assignes") - private List assignes; - - @JsonProperty("nextActions") - @Valid - private List nextActions; - - @JsonProperty("stateSla") - private Long stateSla; - - @JsonProperty("businesssServiceSla") - private Long businesssServiceSla; - - @JsonProperty("previousStatus") - @Size(max=128) - private String previousStatus; - - @JsonProperty("entity") - private Object entity; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - - public ProcessInstance addDocumentsItem(Document documentsItem) { - if (this.documents == null) { - this.documents = new ArrayList<>(); - } - if(!this.documents.contains(documentsItem)) - this.documents.add(documentsItem); - - return this; - } - - public ProcessInstance addNextActionsItem(Action nextActionsItem) { - if (this.nextActions == null) { - this.nextActions = new ArrayList<>(); - } - this.nextActions.add(nextActionsItem); - return this; - } - - public ProcessInstance addUsersItem(User usersItem) { - if (this.assignes == null) { - this.assignes = new ArrayList<>(); - } - if(!this.assignes.contains(usersItem)) - this.assignes.add(usersItem); - - return this; - } - -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/ProcessInstanceRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/ProcessInstanceRequest.java deleted file mode 100644 index 3f4e984c184..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/ProcessInstanceRequest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.demand.amendment.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -/** - * Contract class to receive request. Array of TradeLicense items are used in case of create, whereas single TradeLicense item is used for update - */ -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -public class ProcessInstanceRequest { - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("ProcessInstances") - @Valid - @NotNull - private List processInstances; - - - public ProcessInstanceRequest addProcessInstanceItem(ProcessInstance processInstanceItem) { - if (this.processInstances == null) { - this.processInstances = new ArrayList<>(); - } - this.processInstances.add(processInstanceItem); - return this; - } - -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/ProcessInstanceResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/ProcessInstanceResponse.java deleted file mode 100644 index caa87975104..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/ProcessInstanceResponse.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.demand.amendment.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Contract class to send response. Array of TradeLicense items are used in case - * of search results or response for create, whereas single TradeLicense item is - * used for update - */ -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class ProcessInstanceResponse { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("ProcessInstances") - @Valid - private List processInstances; - - public ProcessInstanceResponse addProceInstanceItem(ProcessInstance proceInstanceItem) { - if (this.processInstances == null) { - this.processInstances = new ArrayList<>(); - } - this.processInstances.add(proceInstanceItem); - return this; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/State.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/State.java deleted file mode 100644 index ea042bb7a1a..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/State.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.egov.demand.amendment.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.Size; - -import org.egov.demand.model.AuditDetails; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -/** - * A Object holds the basic data for a Trade License - */ - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId","businessServiceId","state"}) -public class State { - - @Size(max=256) - @JsonProperty("uuid") - private String uuid; - - @Size(max=256) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max=256) - @JsonProperty("businessServiceId") - private String businessServiceId; - - @JsonProperty("sla") - private Long sla; - - @Size(max=256) - @JsonProperty("state") - private String state; - - @Size(max=256) - @JsonProperty("applicationStatus") - private String applicationStatus; - - @JsonProperty("docUploadRequired") - private Boolean docUploadRequired; - - @JsonProperty("isStartState") - private Boolean isStartState; - - @JsonProperty("isTerminateState") - private Boolean isTerminateState; - - @JsonProperty("isStateUpdatable") - private Boolean isStateUpdatable; - - @JsonProperty("actions") - @Valid - private List actions; - - private AuditDetails auditDetails; - - - public State addActionsItem(Action actionsItem) { - if (this.actions == null) { - this.actions = new ArrayList<>(); - } - this.actions.add(actionsItem); - return this; - } - -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/enums/AmendmentReason.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/enums/AmendmentReason.java deleted file mode 100644 index 00b792281a5..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/enums/AmendmentReason.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.demand.amendment.model.enums; - -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Gets or Sets amendmentReason - */ -public enum AmendmentReason { - - COURT_CASE_SETTLEMENT("COURT_CASE_SETTLEMENT"), - - ARREAR_WRITE_OFF("ARREAR_WRITE_OFF"), - - DCB_CORRECTION("DCB_CORRECTION"), - - ONE_TIME_SETTLEMENT("ONE_TIME_SETTLEMENT"), - - REMISSION_FOR_PROPERTY_TAX("REMISSION_FOR_PROPERTY_TAX"), - - OTHERS("OTHERS"); - - private String value; - - AmendmentReason(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @NotNull - @JsonCreator - public static AmendmentReason fromValue(String text) { - for (AmendmentReason b : AmendmentReason.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/enums/AmendmentStatus.java b/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/enums/AmendmentStatus.java deleted file mode 100644 index 05de1926786..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/amendment/model/enums/AmendmentStatus.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.demand.amendment.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Gets or Sets status - */ -public enum AmendmentStatus { - - ACTIVE("ACTIVE"), - - INACTIVE ("INACTIVE"), - - INWORKFLOW("INWORKFLOW"), - - CONSUMED ("CONSUMED"); - - private String value; - - AmendmentStatus(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static AmendmentStatus fromValue(String text) { - for (AmendmentStatus b : AmendmentStatus.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/config/ApplicationProperties.java b/business-services/billing-service/src/main/java/org/egov/demand/config/ApplicationProperties.java deleted file mode 100644 index 74a38dd04a3..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/config/ApplicationProperties.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.demand.config; - -import java.util.List; -import java.util.Map; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; - -import lombok.Getter; -import lombok.ToString; - -@Configuration -@Getter -@ToString -public class ApplicationProperties { - - - @Value("${kafka.topics.save.bill}") - private String createBillTopic; - - @Value("${kafka.topics.update.bill}") - private String updateBillTopic; - - @Value("${kafka.topics.save.bill.key}") - private String createBillTopicKey; - - @Value("${kafka.topics.update.bill.key}") - private String updatekBillTopicKey; - - @Value("${bs.bill.seq.name}") - private String billSeqName; - - @Value("${bs.billdetail.seq.name}") - private String billDetailSeqName; - - @Value("${bs.bill.billnumber.format}") - private String billNumberFormat; - - @Value("${bs.bill.billnumber.format.module}") - private String moduleReplaceStirng; - - @Value("${bs.bill.billnumber.format.tenantid}") - private String tenantIdReplaceString; - - @Value("${istenantlevelbillnumberingenabled}") - private Boolean isTenantLevelBillNumberingEnabled; - - @Value("${egov.idgen.hostname}") - private String idGenHost; - - @Value("${egov.idgen.uri}") - private String idGenUrl; - - @Value("${bs.billaccountdetail.seq.name}") - private String billAccDetailSeqName; - - @Value("${kafka.topics.save.demand}") - private String createDemandTopic; - - @Value("${kafka.topics.update.demand}") - private String updateDemandTopic; - - @Value("${kafka.topics.receipt.update.demand}") - private String updateDemandFromReceipt; - - @Value("${kafka.topics.demandBill.update.name}") - private String updateDemandBillTopicName; - - @Value("${bs.demand.seq.name}") - private String demandSeqName; - - @Value("${bs.demanddetail.seq.name}") - private String demandDetailSeqName; - - @Value("${bs.billdetail.billnumber.seq.name}") - private String billNumSeqName; - - @Value("${kafka.topics.receipt.cancel.name}") - private String receiptCancellationTopic; - - @Value("${kafka.topics.demand.index.name}") - private String demandIndexTopic; - - - /* - * billing service v1.1 - */ - - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsEndpoint; - - @Value("${user.service.hostname}") - private String userServiceHostName; - - @Value("${user.service.searchpath}") - private String userServiceSearchPath; - - @Value("${demand.is.user.create.enabled}") - private Boolean isUserCreateEnabled; - - @Value("${egov.user.create.user}") - private String userCreateEnpoint; - - @Value("#{${bs.businesscode.demand.updateurl}}") - private Map businessCodeAndDemandUpdateUrlMap; - - // V2 - - @Value("${kafka.topics.payment.create}") - private String paymentCreateTopic; - - @Value("${kafka.topics.payment.cancel}") - private String paymentCancelTopic; - - @Value("${search.pagesize.default}") - private String commonSearchDefaultLimit; - - - // Apportioning - @Value("${egov.apportion.host}") - private String apportionHost; - - @Value("${egov.apportion.endpoint}") - private String apportionEndpoint; - - // Amendment - @Value("${is.amendment.workflow.enabled}") - private Boolean isAmendmentworkflowEnabed; - - @Value("${workflow.host}") - private String wfHost; - - @Value("${workflow.transition.path}") - private String wfTransitionPath; - - @Value("${workflow.businessservice.search.path}") - private String wfBusinessServiceSearchPath; - - @Value("${workflow.processinstance.search.path}") - private String wfProcessInstanceSearchPath; - - @Value("${workflow.open.action}") - private String amendmentWfOpenAction; - - @Value("${workflow.modulename}") - private String amendmentWfModuleName; - - @Value("${amendment.workflow.name}") - private String amendmentWfName; - - @Value("${amendment.id.format.name}") - private String amendmentIdFormatName; - - // central-instance configs - - @Value("${state.level.tenantid.length}") - private Integer stateLevelTenantIdLength; - - @Value("${is.environment.central.instance}") - private Boolean isEnvironmentCentralInstance; - - @Value("${statelevel.rolecode.excluded.list}") - private List statelevelRolecodeExclusionList; -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/consumer/BillingServiceConsumer.java b/business-services/billing-service/src/main/java/org/egov/demand/consumer/BillingServiceConsumer.java deleted file mode 100644 index 9bf9c71cf39..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/consumer/BillingServiceConsumer.java +++ /dev/null @@ -1,292 +0,0 @@ -package org.egov.demand.consumer; - -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.helper.CollectionReceiptRequest; -import org.egov.demand.model.BillDetail.StatusEnum; -import org.egov.demand.model.BillV2; -import org.egov.demand.model.PaymentBackUpdateAudit; -import org.egov.demand.repository.BillRepository; -import org.egov.demand.repository.DemandRepository; -import org.egov.demand.service.DemandService; -import org.egov.demand.service.ReceiptService; -import org.egov.demand.service.ReceiptServiceV2; -import org.egov.demand.util.Constants; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.BillRequestV2; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.contract.Receipt; -import org.egov.demand.web.contract.ReceiptRequest; -import org.egov.tracer.model.CustomException; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class BillingServiceConsumer { - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - private DemandService demandService; - - @Autowired - private DemandRepository demandRepository; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private BillRepository billRepository; - - @Autowired - private ReceiptService receiptService; - - @Autowired - private ReceiptServiceV2 receiptServiceV2; - - @Autowired - private Util util; - - - @KafkaListener(topics = { "${kafka.topics.receipt.update.collecteReceipt}", "${kafka.topics.save.bill}", - "${kafka.topics.save.demand}", "${kafka.topics.update.demand}", "${kafka.topics.receipt.update.demand}", - "${kafka.topics.receipt.cancel.name}" }) - public void processMessage(Map consumerRecord, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - - log.debug("key:" + topic + ":" + "value:" + consumerRecord); - - /* - * save demand topic - */ - if (applicationProperties.getCreateDemandTopic().equals(topic)) - demandService.save(objectMapper.convertValue(consumerRecord, DemandRequest.class)); - - /* - * update demand topic - */ - else if (applicationProperties.getUpdateDemandTopic().equals(topic)) - demandService.update(objectMapper.convertValue(consumerRecord, DemandRequest.class), null); - - /* - * save bill - */ - else if (topic.equals(applicationProperties.getCreateBillTopic())) - billRepository.saveBill(objectMapper.convertValue(consumerRecord, BillRequest.class)); - - /* - * update demand from receipt - */ - else if (applicationProperties.getUpdateDemandFromReceipt().equals(topic)) { - - CollectionReceiptRequest collectionReceiptRequest = objectMapper.convertValue(consumerRecord, - CollectionReceiptRequest.class); - RequestInfo requestInfo = collectionReceiptRequest.getRequestInfo(); - List receipts = collectionReceiptRequest.getReceipt(); - - ReceiptRequest receiptRequest = ReceiptRequest.builder().receipt(receipts).requestInfo(requestInfo) - .tenantId(collectionReceiptRequest.getTenantId()).build(); - log.debug("the receipt request is -------------------" + receiptRequest); - - receiptService.updateDemandFromReceipt(receiptRequest, StatusEnum.CREATED, false); - } - - /* - * update demand for receipt cancellation - */ - else if (applicationProperties.getReceiptCancellationTopic().equals(topic)) { - receiptService.updateDemandFromReceipt(objectMapper.convertValue(consumerRecord, ReceiptRequest.class), - StatusEnum.CANCELLED, true); - } - - /* - * update demand from receipt - *//* - else if (applicationProperties.getPaymentCreateTopic().equals(topic)) { - - Boolean isReceiptCancellation = false; - updateDemandsFromPayment(consumerRecord, isReceiptCancellation); - }*/ - - /* - * update demand for receipt cancellation - */ - /*else if (applicationProperties.getPaymentCancelTopic().equals(topic)) { - - Boolean isReceiptCancellation = true; - updateDemandsFromPayment(consumerRecord, isReceiptCancellation); - }*/ - } - - - - - @KafkaListener(topicPattern = "${kafka.topics.receipt.topic.pattern}") - public void processPayment(Map consumerRecord, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - - /* - * update demand from receipt - */ - - Boolean isReceiptCancellation = false; - updateDemandsFromPayment(consumerRecord, isReceiptCancellation); - - - } - - @KafkaListener(topicPattern = "${kafka.topics.receipt.cancel.topic.pattern}") - public void processPaymentCancel(Map consumerRecord, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - - /* - * update demand from receipt - */ - - Boolean isReceiptCancellation = true; - updateDemandsFromPayment(consumerRecord, isReceiptCancellation); - - - } - - - - private void updateDemandsFromPayment(Map consumerRecord, Boolean isReceiptCancellation) { - - BillRequestV2 billReq = BillRequestV2.builder().build(); - String tenantId = ""; - - try { - - setBillRequestFromPayment(consumerRecord, billReq, isReceiptCancellation); - /* - * setting tenantid value in mdc for tracer to read while making http calls - */ - tenantId = billReq.getBills().get(0).getTenantId(); - MDC.put(Constants.TENANTID_MDC_STRING, billReq.getBills().get(0).getTenantId()); - receiptServiceV2.updateDemandFromReceipt(billReq, isReceiptCancellation); - - } catch (JsonProcessingException | IllegalArgumentException e) { - - /* - * Adding random uuid in primary when jsonmapping exception occurs - */ - updatePaymentBackUpdateForFailure(tenantId, consumerRecord.toString(), UUID.randomUUID().toString() + " : " + e.getClass().getName(), isReceiptCancellation); - log.info("EGBS_PAYMENT_SERIALIZE_ERROR",e.getClass().getName() + " : " + e.getMessage()); - - } catch (Exception e ) { - - String paymentId = util.getValueFromAdditionalDetailsForKey( - billReq.getBills().get(0).getAdditionalDetails(), Constants.PAYMENT_ID_KEY); - updatePaymentBackUpdateForFailure(tenantId, e.getMessage(), paymentId, isReceiptCancellation); - log.info("EGBS_PAYMENT_BACKUPDATE_ERROR",e.getClass().getName() + " : " + e.getMessage()); - - } - } - - - /** - * @param consumerRecord - * @throws JsonProcessingException - */ - private void setBillRequestFromPayment(Map consumerRecord, BillRequestV2 billReq, boolean isReceiptCancelled) throws JsonProcessingException { - - DocumentContext context = null; - - context = JsonPath.parse(objectMapper.writeValueAsString(consumerRecord)); - - String paymentId = objectMapper.convertValue(context.read("$.Payment.id"), String.class); - List amtPaidList = Arrays.asList(objectMapper.convertValue(context.read("$.Payment.paymentDetails.*.totalAmountPaid"), BigDecimal[].class)); - List bills = Arrays.asList(objectMapper.convertValue(context.read("$.Payment.paymentDetails.*.bill"), BillV2[].class)); - - RequestInfo requestInfo = objectMapper.convertValue(context.read("$.RequestInfo"), RequestInfo.class); - billReq.setBills(bills); - billReq.setRequestInfo(requestInfo); - - /* payment value is set in zeroth index of bills - * - * additionaldetail info from bill is not needed, so setting new value - */ - bills.get(0).setAdditionalDetails(util.setValuesAndGetAdditionalDetails(null, Constants.PAYMENT_ID_KEY, paymentId)); - validatePaymentForDuplicateUpdates(bills.get(0).getTenantId(), isReceiptCancelled, paymentId); - - for (int i = 0; i < bills.size(); i++) { - - BillV2 bill = bills.get(i); - - BigDecimal amtPaid = null != amtPaidList.get(i) ? amtPaidList.get(i) : BigDecimal.ZERO; - - if (isReceiptCancelled) { - bill.setStatus(org.egov.demand.model.BillV2.BillStatus.CANCELLED); - - } else if (bill.getTotalAmount().compareTo(amtPaid) > 0) { - bill.setStatus(org.egov.demand.model.BillV2.BillStatus.PARTIALLY_PAID); - - } else { - bill.setStatus(org.egov.demand.model.BillV2.BillStatus.PAID); - } - } - } - - /** - * validation to prevent multiple back updates for same payment - * - * @param isReceiptCancelled - * @param paymentId - */ - private void validatePaymentForDuplicateUpdates(String tenantId, boolean isReceiptCancelled, String paymentId) { - - PaymentBackUpdateAudit backUpdateAuditCriteria = PaymentBackUpdateAudit.builder() - .isReceiptCancellation(isReceiptCancelled) - .paymentId(paymentId) - .isBackUpdateSucces(true) - .tenantId(tenantId) - .build(); - - String paymentIdFromDb = demandRepository - .searchPaymentBackUpdateAudit(backUpdateAuditCriteria); - - if (null != paymentIdFromDb && paymentIdFromDb.equalsIgnoreCase(paymentId)) - throw new CustomException("EGBS_PAYMENT_BACKUPDATE_ERROR", - "Duplicate Payment object received for back update with payment-id : " + paymentId - + ", payment already updated to demands"); - } - - /** - * Update payment-back-update object based on whether error occurred in validation or not - * - * - * @param execptionDuringUpdateValidation - * @param paymentBackUpdateAudit - * @throws Exception - */ - private void updatePaymentBackUpdateForFailure (String tenantId, String errorMsg, String paymentId, Boolean isReceiptCancellation) { - - PaymentBackUpdateAudit paymentBackUpdateAudit = PaymentBackUpdateAudit.builder() - .isReceiptCancellation(isReceiptCancellation) - .isBackUpdateSucces(false) - .errorMessage(errorMsg) - .paymentId(paymentId) - .tenantId(tenantId) - .build(); - - demandRepository.insertBackUpdateForPayment(paymentBackUpdateAudit); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/consumer/BulkBillGenerationConsumer.java b/business-services/billing-service/src/main/java/org/egov/demand/consumer/BulkBillGenerationConsumer.java deleted file mode 100644 index 2737bd620e9..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/consumer/BulkBillGenerationConsumer.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.egov.demand.consumer; - -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import org.egov.demand.model.BulkBillGenerator; -import org.egov.demand.model.Demand; -import org.egov.demand.model.GenerateBillCriteria; -import org.egov.demand.model.MigrationCount; -import org.egov.demand.service.BillServicev2; -import org.egov.demand.service.DemandService; -import org.egov.demand.util.Constants; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.tracer.kafka.CustomKafkaTemplate; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class BulkBillGenerationConsumer { - - @Autowired - private DemandService demandService; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private BillServicev2 billService; - - @Autowired - private CustomKafkaTemplate kafkaTemplate; - - @KafkaListener(topics = { "${kafka.topics.bulk.bill.generation}" }) - public void processMessage(Map consumerRecord, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - - log.debug("key:" + topic + ":" + "value:" + consumerRecord); - - BulkBillGenerator billGenerator = objectMapper.convertValue(consumerRecord, BulkBillGenerator.class); - DemandRequest request = DemandRequest.builder() - .requestInfo(billGenerator.getRequestInfo()) - .demands(billGenerator.getCreateDemands()) - .build(); - String tenantId = billGenerator.getCreateDemands().get(0).getTenantId(); - MDC.put(Constants.TENANTID_MDC_STRING, tenantId); - - log.info(" Billing-bulkbill-consumer-batch log for batch : " + billGenerator.getMigrationCount().getOffset() - + " with no of records " + billGenerator.getCreateDemands().size()); - - try { - demandService.create(request); - } catch (Exception e) { - logError(" Demand creation ", e.getMessage(), billGenerator.getMigrationCount()); - } - - request.setDemands(billGenerator.getUpdateDemands()); - try { - if (!CollectionUtils.isEmpty(billGenerator.getUpdateDemands())) - demandService.updateAsync(request, null); - } catch (Exception e) { - logError(" Demand update ", e.getMessage(), billGenerator.getMigrationCount()); - } - - Set consumerCodes = billGenerator.getCreateDemands() - .stream() - .map(Demand::getConsumerCode) - .collect(Collectors.toSet()); - String businessService = billGenerator.getCreateDemands().get(0).getBusinessService(); - - GenerateBillCriteria genBillCriteria = GenerateBillCriteria.builder() - .consumerCode(consumerCodes) - .businessService(businessService) - .tenantId(tenantId) - .build(); - - try { - billService.generateBill(genBillCriteria, billGenerator.getRequestInfo()); - } catch (Exception e) { - logError(" Bill Gen ", e.getMessage(), billGenerator.getMigrationCount()); - } - - MigrationCount migrationCount = billGenerator.getMigrationCount(); - migrationCount.setAuditTime(System.currentTimeMillis()); - migrationCount.setMessage("prcoess succeded in billing service"); - kafkaTemplate.send(migrationCount.getAuditTopic(), billGenerator.getMigrationCount()); - } - - private void logError(String process, String message, MigrationCount bulkBillCount) { - bulkBillCount.setAuditTime(System.currentTimeMillis()); - bulkBillCount.setMessage("prcoess failed in billing service during "+ process + " with error message : " + message); - kafkaTemplate.send(bulkBillCount.getAuditTopic(), bulkBillCount); - } - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/consumer/notification/NotificationConsumer.java b/business-services/billing-service/src/main/java/org/egov/demand/consumer/notification/NotificationConsumer.java deleted file mode 100644 index 9d753df49ca..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/consumer/notification/NotificationConsumer.java +++ /dev/null @@ -1,272 +0,0 @@ -package org.egov.demand.consumer.notification; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.demand.model.Bill; -import org.egov.demand.model.BillDetail; -import org.egov.demand.model.BillDetailV2; -import org.egov.demand.model.BillV2; -import org.egov.demand.util.Constants; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.BillRequestV2; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class NotificationConsumer { - - @Autowired - private MultiStateInstanceUtil centralUtil; - - @Value("${egov.localization.host}") - private String localizationHost; - - @Value("${egov.localization.search.endpoint}") - private String localizationEndpoint; - - @Value("${bill.notification.fallback.locale}") - private String fallBackLocale; - - @Value("${kafka.topics.notification.sms}") - private String smsTopic; - - @Value("${kafka.topics.cancel.bill.topic.name}") - private String billCancelTopic; - - @Value("${kafka.topics.notification.sms.key}") - private String smsTopickey; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private KafkaTemplate producer; - - @Autowired - private RestTemplate restTemplate; - - private static final String BILLING_LOCALIZATION_MODULE = "billing-services"; - public static final String PAYMENT_MSG_LOCALIZATION_CODE = "BILLINGSERVICE_BUSINESSSERVICE_BILL_GEN_NOTIF_MSG"; - public static final String BILL_CANCELLATION_MSG_LOCALIZATION_CODE = "BILLINGSERVICE_BILL_CANCELLATION_NOTIF_MSG"; - public static final String BUSINESSSERVICELOCALIZATION_CODE_PREFIX = "BILLINGSERVICE_BUSINESSSERVICE_"; - - public static final String LOCALIZATION_CODES_JSONPATH = "$.messages.*.code"; - public static final String LOCALIZATION_MSGS_JSONPATH = "$.messages.*.message"; - - public static final String BUSINESSSERVICE_MDMS_MASTER = "BusinessService"; - public static final String BUSINESSSERVICE_CODES_JSONPATH = "$.MdmsRes.BillingService.BusinessService"; - - public static final String USERNAME_REPLACE_STRING = "{username}"; - public static final String PERIOD_REPLACE_STRING = "{period}"; - public static final String TAX_REPLACE_STRING = "{amt}"; - - public static final String MODULE_REPLACE_STRING = "{module}"; - public static final String MODULE_REPLACE_STRING_VALUE = "Property Tax"; - - public static final String MODULE_PRIMARYKEY_REPLACE_STRING = "{primarykeystring}"; - public static final String MODULE_PRIMARYKEY_REPLACE_STRING_VALUE = "property-id"; - - public static final String SERVICENUMBER_OF_MODULE_REPLACE_STRING = "{servicenumber}"; - public static final String EXPIRY_DATE_REPLACE_STRING = "{expirydate}"; - - /** - * Kafka consumer - * - * @param record - * @param topic - */ - @KafkaListener(topics = { "${kafka.topics.billgen.topic.name}", "${kafka.topics.cancel.bill.topic.name}" }) - public void listen(Map record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - - try { - if(topic.equals(billCancelTopic)){ - BillRequestV2 req = objectMapper.convertValue(record, BillRequestV2.class); - sendNotificationForBillCancellation(req); - }else { - BillRequest req = objectMapper.convertValue(record, BillRequest.class); - sendNotification(req); - } - } catch (Exception e) { - log.error("Exception while reading from the queue: ", e); - } - } - - private void sendNotificationForBillCancellation(BillRequestV2 req) { - req.getBills().forEach(bill -> { - String phNo = bill.getMobileNumber(); - String message = buildSmsBodyForBillCancellation(bill, req.getRequestInfo()); - if (!StringUtils.isEmpty(message)) { - - Map request = new HashMap<>(); - request.put("mobileNumber", phNo); - request.put("message", message); - log.info("Msg sent to user : " + message); - producer.send(smsTopic, smsTopickey, request); - } else { - log.error("No message configured! Notification will not be sent."); - } - }); - } - - private String buildSmsBodyForBillCancellation(BillV2 bill, RequestInfo requestInfo) { - if (bill.getMobileNumber() == null) - return null; - - String tenantId = bill.getTenantId(); - BillDetailV2 detail = bill.getBillDetails().get(0); - - String content = fetchContentFromLocalization(requestInfo, tenantId, BILLING_LOCALIZATION_MODULE, - BILL_CANCELLATION_MSG_LOCALIZATION_CODE); - - if (!StringUtils.isEmpty(content)) { - - content = content.replace("{OWNER_NAME}", bill.getPayerName()); - content = content.replace("{SERVICE}", bill.getBusinessService()); - content = content.replace("{BILLING_PERIOD}", getPeriod(detail.getFromPeriod(), detail.getToPeriod())); - content = content.replace("{REASON_FOR_CANCELLATION}", bill.getAdditionalDetails().get(Constants.CANCELLATION_REASON_MSG).textValue()); - - } - return content; - } - - /** - * Method to send notifications. - * - * @param billReq - * @throws Exception - */ - private void sendNotification(BillRequest billReq) { - - billReq.getBills().forEach(bill -> { - - String phNo = bill.getMobileNumber(); - String message = buildSmsBody(bill, billReq.getRequestInfo()); - if (!StringUtils.isEmpty(message)) { - - Map request = new HashMap<>(); - request.put("mobileNumber", phNo); - request.put("message", message); - log.info("Msg sent to user : " + message); - producer.send(smsTopic, smsTopickey, request); - } else { - log.error("No message configured! Notification will not be sent."); - } - }); - } - - /** - * Prepares sms body based on the configuration - * - * @param instrument - * @param bill - * @param billDetail - * @param requestInfo - * @return - */ - private String buildSmsBody(Bill bill, RequestInfo requestInfo) { - - BillDetail detail = bill.getBillDetails().get(0); - - // notification is enabled only for PT - if (bill.getMobileNumber() == null || !detail.getBusinessService().equals("PT")) - return null; - - String tenantId = bill.getTenantId(); - - String content = fetchContentFromLocalization(requestInfo, tenantId, BILLING_LOCALIZATION_MODULE, - PAYMENT_MSG_LOCALIZATION_CODE); - - if (!StringUtils.isEmpty(content)) { - - Calendar cal = Calendar.getInstance(); - cal.setTimeInMillis(detail.getExpiryDate()); - - content = content.replace(USERNAME_REPLACE_STRING, bill.getPayerName()); - content = content.replace(EXPIRY_DATE_REPLACE_STRING, - " "+ cal.get(Calendar.DATE) + "/" + cal.get(Calendar.MONTH) + "/" + cal.get(Calendar.YEAR)+ " ".toUpperCase()); - content = content.replace(PERIOD_REPLACE_STRING, getPeriod(detail.getFromPeriod(), detail.getToPeriod())); - content = content.replace(SERVICENUMBER_OF_MODULE_REPLACE_STRING, detail.getConsumerCode().split(":")[0]); - content = content.replace(MODULE_REPLACE_STRING, MODULE_REPLACE_STRING_VALUE); - content = content.replace(MODULE_PRIMARYKEY_REPLACE_STRING, MODULE_PRIMARYKEY_REPLACE_STRING_VALUE); - content = content.replace(TAX_REPLACE_STRING, detail.getTotalAmount().toString()); - - } - return content; - } - - private String getPeriod(Long fromPeriod, Long toPeriod) { - - StringBuilder period = new StringBuilder(); - Calendar cal = Calendar.getInstance(); - cal.setTimeInMillis(fromPeriod); - period.append(cal.get(Calendar.YEAR)); - cal.setTimeInMillis(toPeriod); - period.append("-"); - period.append(cal.get(Calendar.YEAR)); - return period.toString(); - } - - /** - * Generic method to fetch data from localization. - * - * @param requestInfo - * @param tenantId - * @param module - * @param code - * @return - */ - private String fetchContentFromLocalization(RequestInfo requestInfo, String tenantId, String module, String code) { - - String message = null; - List codes = new ArrayList<>(); - List messages = new ArrayList<>(); - Object result = null; - String locale = ""; - - if(requestInfo.getMsgId().contains("|")) - locale= requestInfo.getMsgId().split("[\\|]")[1]; // Conventionally locale is sent in the second(1) index of msgid split by | - - if(StringUtils.isEmpty(locale)) - locale = fallBackLocale; - - StringBuilder uri = new StringBuilder(); - String stateLevelTenant = centralUtil.getStateLevelTenant(tenantId); - uri.append(localizationHost).append(localizationEndpoint); - uri.append("?tenantId=").append(stateLevelTenant).append("&locale=").append(locale).append("&module=").append(module); - Map request = new HashMap<>(); - request.put("RequestInfo", requestInfo); - try { - result = restTemplate.postForObject(uri.toString(), request, Map.class); - codes = JsonPath.read(result, LOCALIZATION_CODES_JSONPATH); - messages = JsonPath.read(result, LOCALIZATION_MSGS_JSONPATH); - } catch (Exception e) { - log.error("Exception while fetching from localization: " + e); - } - if (null != result) { - for (int i = 0; i < codes.size(); i++) { - if(codes.get(i).equals(code)) message = messages.get(i); - } - } - return message; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/helper/BillHelper.java b/business-services/billing-service/src/main/java/org/egov/demand/helper/BillHelper.java deleted file mode 100644 index 5fe10070d4e..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/helper/BillHelper.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.egov.demand.helper; - -import java.util.List; - -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.Bill; -import org.egov.demand.model.BillAccountDetail; -import org.egov.demand.model.BillDetail; -import org.egov.demand.util.SequenceGenService; -import org.egov.demand.web.contract.BillRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import lombok.extern.slf4j.Slf4j; - -@Component -@Slf4j -@Deprecated -public class BillHelper { - - @Autowired - private SequenceGenService sequenceGenService; - - @Autowired - private ApplicationProperties applicationProperties; - - public void getBillRequestWithIds(BillRequest billRequest){ - List bills = billRequest.getBills(); - - Integer totalNoOfBills = bills.size(); - Integer totalNoOfBillDetails = 0; - Integer totalNoOfAccountDetails = 0; - - for(Bill bill:bills){ - List billDetails = bill.getBillDetails(); - totalNoOfBillDetails = totalNoOfBillDetails + billDetails.size(); - for(BillDetail billDetail : billDetails){ - List accountDetails = billDetail.getBillAccountDetails(); - totalNoOfAccountDetails = totalNoOfAccountDetails + accountDetails.size(); - } - } - - List billIds = sequenceGenService.getIds(totalNoOfBills,applicationProperties.getBillSeqName()); - List billDetailIds = sequenceGenService.getIds(totalNoOfBillDetails,applicationProperties.getBillDetailSeqName()); - List billAccIds = sequenceGenService.getIds(totalNoOfAccountDetails,applicationProperties.getBillAccDetailSeqName()); - List billNumber = sequenceGenService.getIds(totalNoOfBillDetails,applicationProperties.getBillNumSeqName()); - - int billIndex = 0; - int billDetailIndex = 0; - int billAccIndex = 0; - - for(Bill bill:bills) { - bill.setId(billIds.get(billIndex++)); - List billDetails = bill.getBillDetails(); - - for(BillDetail billDetail : billDetails){ - billDetail.setId(billDetailIds.get(billDetailIndex)); - billDetail.setBill(bill.getId()); - billDetail.setBillNumber(billNumber.get(billDetailIndex++)); - billDetail.setTenantId(bill.getTenantId()); - List accountDetails = billDetail.getBillAccountDetails(); - - for(BillAccountDetail billAccountDetail : accountDetails){ - billAccountDetail.setId(billAccIds.get(billAccIndex++)); - billAccountDetail.setBillDetail(billDetail.getId()); - billAccountDetail.setTenantId(billDetail.getTenantId()); - } - - } - } - log.debug("BillHelper bill:"+billIds); - log.debug("BillHelper billRequest:"+billRequest); - } - - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/helper/BillHelperV2.java b/business-services/billing-service/src/main/java/org/egov/demand/helper/BillHelperV2.java deleted file mode 100644 index 1b60878bad3..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/helper/BillHelperV2.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.egov.demand.helper; - -import java.util.List; -import java.util.UUID; - -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.BillAccountDetailV2; -import org.egov.demand.model.BillDetailV2; -import org.egov.demand.model.BillV2; -import org.egov.demand.util.SequenceGenService; -import org.egov.demand.web.contract.BillRequestV2; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class BillHelperV2 { - - @Autowired - private SequenceGenService sequenceGenService; - - @Autowired - private ApplicationProperties applicationProperties; - - public void getBillRequestWithIds(BillRequestV2 billRequest) { - - List bills = billRequest.getBills(); - Integer totalNoOfBills = bills.size(); - Integer totalNoOfBillDetails = 0; - Integer totalNoOfAccountDetails = 0; - - for (BillV2 bill : bills) { - - List billDetails = bill.getBillDetails(); - totalNoOfBillDetails = totalNoOfBillDetails + billDetails.size(); - for (BillDetailV2 billDetail : billDetails) { - - List accountDetails = billDetail.getBillAccountDetails(); - totalNoOfAccountDetails = totalNoOfAccountDetails + accountDetails.size(); - } - } - - List billNumber = sequenceGenService.getIds(totalNoOfBills,applicationProperties.getBillNumSeqName()); - - int billIndex = 0; - - for (BillV2 bill : bills) { - bill.setId(getUUID()); - bill.setBillNumber(billNumber.get(billIndex++)); - List billDetails = bill.getBillDetails(); - - for (BillDetailV2 billDetail : billDetails) { - billDetail.setId(getUUID()); - billDetail.setBillId(bill.getId()); - billDetail.setTenantId(bill.getTenantId()); - List accountDetails = billDetail.getBillAccountDetails(); - - for (BillAccountDetailV2 billAccountDetail : accountDetails) { - billAccountDetail.setId(getUUID()); - billAccountDetail.setBillDetailId(billDetail.getId()); - billAccountDetail.setTenantId(billDetail.getTenantId()); - } - - } - } - } - - private String getUUID() { - return UUID.randomUUID().toString(); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/helper/CollectionReceiptRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/helper/CollectionReceiptRequest.java deleted file mode 100644 index 9627b3a61a2..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/helper/CollectionReceiptRequest.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.demand.helper; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.web.contract.Receipt; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class CollectionReceiptRequest { - - @JsonProperty("RequestInfo") - private RequestInfo RequestInfo; - - private String tenantId; - - @JsonProperty("Receipt") - private List receipt; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/helper/JsonIgnoreHelper.java b/business-services/billing-service/src/main/java/org/egov/demand/helper/JsonIgnoreHelper.java deleted file mode 100644 index 5d48a018cbc..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/helper/JsonIgnoreHelper.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.egov.demand.helper; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -public abstract class JsonIgnoreHelper { - - @JsonIgnore abstract int getTs(); -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/ApportionDemandResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/model/ApportionDemandResponse.java deleted file mode 100644 index 3dac0b55ba3..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/ApportionDemandResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.demand.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.response.ResponseInfo; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class ApportionDemandResponse { - - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("demands") - @Valid - private List demands = null; - - - public ApportionDemandResponse addDemandsItem(Demand demand) { - if (this.demands == null) { - this.demands = new ArrayList<>(); - } - this.demands.add(demand); - return this; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/AuditDetail.java b/business-services/billing-service/src/main/java/org/egov/demand/model/AuditDetail.java deleted file mode 100644 index 57d3cf8c526..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/AuditDetail.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.demand.model; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class AuditDetail { - - private String createdBy; - - private String lastModifiedBy; - - private Long createdTime; - - private Long lastModifiedTime; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/AuditDetails.java b/business-services/billing-service/src/main/java/org/egov/demand/model/AuditDetails.java deleted file mode 100644 index 6d9d09346a4..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/AuditDetails.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.egov.demand.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Collection of audit related fields used by most models - */ -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class AuditDetails { - - @JsonProperty("createdBy") - private String createdBy; - - @JsonProperty("lastModifiedBy") - private String lastModifiedBy; - - @JsonProperty("createdTime") - private Long createdTime; - - @JsonProperty("lastModifiedTime") - private Long lastModifiedTime; -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/Bill.java b/business-services/billing-service/src/main/java/org/egov/demand/model/Bill.java deleted file mode 100644 index d0e41f3ade3..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/Bill.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.egov.demand.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Bill - */ -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Bill { - - @JsonProperty("id") - private String id; - - @JsonProperty("mobileNumber") - private String mobileNumber; - - @JsonProperty("payerName") - private String payerName; - - @JsonProperty("payerAddress") - private String payerAddress; - - @JsonProperty("payerEmail") - private String payerEmail; - - @JsonProperty("isActive") - private Boolean isActive; - - @JsonProperty("isCancelled") - private Boolean isCancelled; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - @JsonProperty("taxAndPayments") - @Valid - private List taxAndPayments; - - @JsonProperty("billDetails") - @Valid - @Default - private List billDetails = new ArrayList<>(); - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - - public Bill addBillDetailsItem(BillDetail billDetailsItem) { - if (this.billDetails == null) { - this.billDetails = new ArrayList<>(); - } - this.billDetails.add(billDetailsItem); - return this; - } - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/BillAccountDetail.java b/business-services/billing-service/src/main/java/org/egov/demand/model/BillAccountDetail.java deleted file mode 100644 index 23f42db069b..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/BillAccountDetail.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.egov.demand.model; - -import java.math.BigDecimal; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * BillAccountDetail - */ -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class BillAccountDetail { - - - @JsonProperty("id") - private String id; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("billDetail") - private String billDetail; - - @JsonProperty("demandDetailId") - private String demandDetailId; - - @JsonProperty("order") - private Integer order; - - @JsonProperty("amount") - private BigDecimal amount; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount; - - @JsonProperty("glcode") - private String glcode; - - @JsonProperty("taxHeadCode") - private String taxHeadCode; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - /** - * Purpose of Account head. - */ - public enum PurposeEnum { - ARREAR("ARREAR"), - - CURRENT("CURRENT"), - - ADVANCE("ADVANCE"), - - OTHERS("OTHERS"); - - private String value; - - PurposeEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static PurposeEnum fromValue(String text) { - for (PurposeEnum b : PurposeEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/BillAccountDetailV2.java b/business-services/billing-service/src/main/java/org/egov/demand/model/BillAccountDetailV2.java deleted file mode 100644 index d688fb1c65a..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/BillAccountDetailV2.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.demand.model; - -import java.math.BigDecimal; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * BillAccountDetail - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillAccountDetailV2 { - - @JsonProperty("id") - private String id; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("billDetailId") - private String billDetailId; - - @JsonProperty("demandDetailId") - private String demandDetailId; - - @JsonProperty("order") - private Integer order; - - @JsonProperty("amount") - private BigDecimal amount; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount; - - @JsonProperty("taxHeadCode") - private String taxHeadCode; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/BillDetail.java b/business-services/billing-service/src/main/java/org/egov/demand/model/BillDetail.java deleted file mode 100644 index fe5200fa4b1..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/BillDetail.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.egov.demand.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * BillDetail - */ - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class BillDetail { - - @JsonProperty("id") - private String id; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("demandId") - private String demandId; - - @JsonProperty("bill") - private String bill; - - @JsonProperty("businessService") - private String businessService; - - @JsonProperty("billNumber") - private String billNumber; - - @JsonProperty("billDate") - private Long billDate; - - @JsonProperty("consumerCode") - private String consumerCode; - - @JsonProperty("consumerType") - private String consumerType; - - @JsonProperty("expiryDate") - private Long expiryDate; - - @JsonProperty("minimumAmount") - private BigDecimal minimumAmount; - - @JsonProperty("totalAmount") - private BigDecimal totalAmount; - - @JsonProperty("fromPeriod") - private Long fromPeriod; - - @JsonProperty("toPeriod") - private Long toPeriod; - - @JsonProperty("collectedAmount") - private BigDecimal collectedAmount; - - @JsonProperty("collectionModesNotAllowed") - @Valid - private List collectionModesNotAllowed; - - @JsonProperty("partPaymentAllowed") - private Boolean partPaymentAllowed; - - @JsonProperty("isAdvanceAllowed") - private Boolean isAdvanceAllowed; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - @JsonProperty("billAccountDetails") - @Valid - @Default - private List billAccountDetails = new ArrayList<>(); - - /** - * status if the bill detail - */ - public enum StatusEnum { - CREATED("CREATED"), - - CANCELLED("CANCELLED"), - - INSTRUMENT_BOUNCED("INSTRUMENT_BOUNCED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("status") - private StatusEnum status; - - public BillDetail addCollectionModesNotAllowedItem(String collectionModesNotAllowedItem) { - if (this.collectionModesNotAllowed == null) { - this.collectionModesNotAllowed = new ArrayList<>(); - } - this.collectionModesNotAllowed.add(collectionModesNotAllowedItem); - return this; - } - - public BillDetail addBillAccountDetailsItem(BillAccountDetail billAccountDetailsItem) { - if (this.billAccountDetails == null) { - this.billAccountDetails = new ArrayList<>(); - } - if (!this.billAccountDetails.contains(billAccountDetailsItem)) - this.billAccountDetails.add(billAccountDetailsItem); - return this; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/BillDetailV2.java b/business-services/billing-service/src/main/java/org/egov/demand/model/BillDetailV2.java deleted file mode 100644 index 2425c930870..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/BillDetailV2.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.egov.demand.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * BillDetail - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillDetailV2 { - - @JsonProperty("id") - private String id; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("demandId") - private String demandId; - - @JsonProperty("billId") - private String billId; - - @JsonProperty("expiryDate") - private Long expiryDate; - - @JsonProperty("amount") - private BigDecimal amount; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid; - - @JsonProperty("fromPeriod") - private Long fromPeriod; - - @JsonProperty("toPeriod") - private Long toPeriod; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - @JsonProperty("billAccountDetails") - @Valid - private List billAccountDetails; - - public BillDetailV2 addBillAccountDetailsItem(BillAccountDetailV2 billAccountDetailsItem) { - if (this.billAccountDetails == null) { - this.billAccountDetails = new ArrayList<>(); - } - if (!this.billAccountDetails.contains(billAccountDetailsItem)) - this.billAccountDetails.add(billAccountDetailsItem); - return this; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/BillSearchCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/model/BillSearchCriteria.java deleted file mode 100644 index f3237eb6358..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/BillSearchCriteria.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.egov.demand.model; - -import java.util.Set; - -import javax.validation.constraints.Email; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; - -import org.egov.demand.model.BillV2.BillStatus; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class BillSearchCriteria { - - @NotNull - @Size(max = 256) - private String tenantId; - - private Set billId; - - private Long fromPeriod; - - private Long toPeriod; - - @Default - private Boolean retrieveOldest = false; - - private Boolean isActive; - - private Boolean isCancelled; - - private Set consumerCode; - - @Size(max = 256) - private String billNumber; - - @Size(max = 256) - private String service; - - @Default - private boolean isOrderBy = false; - - private Long size; - - private Long offset; - - @Email - private String email; - - private BillStatus status; - - @Pattern(regexp = "^[0-9]{10}$", message = "MobileNumber should be 10 digit number") - private String mobileNumber; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/BillV2.java b/business-services/billing-service/src/main/java/org/egov/demand/model/BillV2.java deleted file mode 100644 index c4c281313a7..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/BillV2.java +++ /dev/null @@ -1,136 +0,0 @@ -package org.egov.demand.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillV2 { - - @JsonProperty("id") - @Size(max = 256) - private String id; - - @JsonProperty("userId") - private String userId; - - @JsonProperty("mobileNumber") - @Pattern(regexp = "^[0-9]{10}$", message = "MobileNumber should be 10 digit number") - private String mobileNumber; - - @JsonProperty("payerName") - @Size(max = 256) - private String payerName; - - @JsonProperty("payerAddress") - @Size(max = 1024) - private String payerAddress; - - @JsonProperty("payerEmail") - @Size(max = 256) - private String payerEmail; - - @JsonProperty("status") - private BillStatus status; - - @JsonProperty("totalAmount") - private BigDecimal totalAmount; - - @JsonProperty("businessService") - @Size(max = 256) - private String businessService; - - @JsonProperty("billNumber") - @Size(max = 256) - private String billNumber; - - @JsonProperty("billDate") - private Long billDate; - - @JsonProperty("consumerCode") - @Size(max = 256) - private String consumerCode; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("billDetails") - @Valid - private List billDetails; - - @JsonProperty("tenantId") - @Size(max = 256) - private String tenantId; - - @JsonProperty("fileStoreId") - private String fileStoreId; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - /** - * status of the bill . - */ - public enum BillStatus { - - ACTIVE("ACTIVE"), - - CANCELLED("CANCELLED"), - - PAID("PAID"), - - PARTIALLY_PAID ("PARTIALLY_PAID"), - - PAYMENT_CANCELLED ("PAYMENT_CANCELLED"), - - EXPIRED("EXPIRED"); - - private String value; - - BillStatus(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static BillStatus fromValue(String text) { - for (BillStatus b : BillStatus.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } - } - - public BillV2 addBillDetailsItem(BillDetailV2 billDetailsItem) { - if (this.billDetails == null) { - this.billDetails = new ArrayList<>(); - } - this.billDetails.add(billDetailsItem); - return this; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/BulkBillGenerator.java b/business-services/billing-service/src/main/java/org/egov/demand/model/BulkBillGenerator.java deleted file mode 100644 index b394586308c..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/BulkBillGenerator.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.demand.model; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class BulkBillGenerator { - - private RequestInfo requestInfo; - - private List createDemands; - - private List updateDemands; - - private MigrationCount migrationCount; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/BusinessServiceDetail.java b/business-services/billing-service/src/main/java/org/egov/demand/model/BusinessServiceDetail.java deleted file mode 100644 index 4a0b3f202f9..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/BusinessServiceDetail.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BusinessServiceDetail { - - private String id; - - @NotNull - private String tenantId; - - @NotNull - private String businessService; - - private String code; - - private List collectionModesNotAllowed = new ArrayList<>(); - - private Boolean partPaymentAllowed; - - @Default - private Boolean isBillAmendmentEnabled = false; - - private Boolean isAdvanceAllowed; - - private Long demandUpdateTime; - - private Boolean callBackForApportioning; - - private String callBackApportionURL; - - private AuditDetail auditDetails; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/CollectedReceipt.java b/business-services/billing-service/src/main/java/org/egov/demand/model/CollectedReceipt.java deleted file mode 100644 index 7277fae3a24..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/CollectedReceipt.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.demand.model; - -import org.egov.demand.model.enums.Status; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class CollectedReceipt { - - private String businessService; - - private String consumerCode; - - private String receiptNumber; - - private Double receiptAmount; - - private Long receiptDate; - - private Status status; - - private AuditDetail auditDetail; - - private String tenantId; -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/ConsolidatedTax.java b/business-services/billing-service/src/main/java/org/egov/demand/model/ConsolidatedTax.java deleted file mode 100644 index 2ff88a65d84..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/ConsolidatedTax.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.egov.demand.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class ConsolidatedTax { - - private Double arrearsDemand; - private Double arrearsCollection; - private Double arrearsBalance; - private Double currentDemand; - private Double currentCollection; - private Double currentBalance; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/Demand.java b/business-services/billing-service/src/main/java/org/egov/demand/model/Demand.java deleted file mode 100644 index 619efe8f913..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/Demand.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.egov.demand.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.demand.web.contract.User; -import org.hibernate.validator.constraints.SafeHtml; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -/** - * A Object which holds the basic info about the revenue assessment for which the demand is generated like module name, consumercode, owner, etc. - */ - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Demand { - - @SafeHtml - @JsonProperty("id") - private String id; - - @SafeHtml - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @SafeHtml - @NotNull - @JsonProperty("consumerCode") - private String consumerCode; - - @SafeHtml - @NotNull - @JsonProperty("consumerType") - private String consumerType; - - @SafeHtml - @NotNull - @JsonProperty("businessService") - private String businessService; - - @Valid - @JsonProperty("payer") - private User payer; - - @NotNull - @JsonProperty("taxPeriodFrom") - private Long taxPeriodFrom; - - @NotNull - @JsonProperty("taxPeriodTo") - private Long taxPeriodTo; - - @Default - @JsonProperty("demandDetails") - @Valid - @NotNull - @Size(min = 1) - private List demandDetails = new ArrayList<>(); - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("fixedBillExpiryDate") - private Long fixedBillExpiryDate; - - @JsonProperty("billExpiryTime") - private Long billExpiryTime; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - @Default - @JsonProperty("minimumAmountPayable") - private BigDecimal minimumAmountPayable = BigDecimal.ZERO; - - @Default - private Boolean isPaymentCompleted = false; - @JsonProperty("status") - private StatusEnum status; - - public Demand addDemandDetailsItem(DemandDetail demandDetailsItem) { - this.demandDetails.add(demandDetailsItem); - return this; - } - - - /** - * Gets or Sets status - */ - public enum StatusEnum { - - ACTIVE("ACTIVE"), - - CANCELLED("CANCELLED"), - - ADJUSTED("ADJUSTED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandApportionRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/model/DemandApportionRequest.java deleted file mode 100644 index 995b5353a0f..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandApportionRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.egov.demand.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.RequestInfo; - -import javax.validation.Valid; -import java.util.List; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class DemandApportionRequest { - - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo = null; - - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("Demands") - @Valid - private List demands = null; - - - } \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/model/DemandCriteria.java deleted file mode 100644 index 1dfff60a5f4..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandCriteria.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.model; - -import java.math.BigDecimal; -import java.util.Set; - -import javax.validation.constraints.NotNull; - -import org.egov.demand.model.enums.Type; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class DemandCriteria { - - @NotNull - private String tenantId; - - private Set demandId; - - private Set payer; - - private Set consumerCode; - - private String businessService; - - private BigDecimal demandFrom; - - private BigDecimal demandTo; - - private Long periodFrom; - - private Long periodTo; - - private Type type; - - private String mobileNumber; - - private String email; - - private String status; - - private Boolean isPaymentCompleted; - - @Default - private Boolean receiptRequired=false; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDetail.java b/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDetail.java deleted file mode 100644 index d34b6466644..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDetail.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.egov.demand.model; - -import java.math.BigDecimal; - -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.hibernate.validator.constraints.SafeHtml; - -/** - * A object holds a demand and collection values for a tax head and period. - */ - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class DemandDetail { - - @SafeHtml - @JsonProperty("id") - private String id; - - @SafeHtml - @JsonProperty("demandId") - private String demandId; - - @SafeHtml - @NotNull @JsonProperty("taxHeadMasterCode") - private String taxHeadMasterCode; - - @NotNull @JsonProperty("taxAmount") - private BigDecimal taxAmount; - - @NotNull @JsonProperty("collectionAmount") @Default - private BigDecimal collectionAmount = BigDecimal.ZERO; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @SafeHtml - @JsonProperty("tenantId") - private String tenantId; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDetailCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDetailCriteria.java deleted file mode 100644 index 81e821038c8..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDetailCriteria.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.model; - -import java.util.Set; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class DemandDetailCriteria { - - @NotNull - private String tenantId; - - private String demandId; - - private String taxHeadCode; - - private Long periodFrom; - - private Long periodTo; - - private Set detailsId; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDue.java b/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDue.java deleted file mode 100644 index 38493eeba2b..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDue.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.demand.model; - -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class DemandDue { - - private ConsolidatedTax consolidatedTax; - - private List demands; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDueCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDueCriteria.java deleted file mode 100644 index f7a44057df0..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandDueCriteria.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.egov.demand.model; - -import java.util.Set; -import javax.validation.constraints.NotNull; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class DemandDueCriteria { - - @NotNull - private String tenantId; - - @NotNull - private Set consumerCode; - - @NotNull - private String businessService; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandUpdateMisRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/model/DemandUpdateMisRequest.java deleted file mode 100644 index 3bbc88d0852..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/DemandUpdateMisRequest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.egov.demand.model; - -import java.util.Set; - -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class DemandUpdateMisRequest { - - @NotNull - private String tenantId; - - @NotNull - private Set id; - - @NotNull - private String consumerCode; - - private RequestInfo requestInfo; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/GenerateBillCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/model/GenerateBillCriteria.java deleted file mode 100644 index 148b957f7a5..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/GenerateBillCriteria.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.model; - -import java.util.HashSet; -import java.util.Set; - -import javax.validation.constraints.Email; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; - -import org.egov.demand.model.BillV2.BillStatus; -import org.hibernate.validator.constraints.SafeHtml; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@Builder -@ToString -public class GenerateBillCriteria { - - @SafeHtml - @NotNull - @Size(max = 256) - private String tenantId; - - @SafeHtml - @Size(max = 64) - private String demandId; - - private Set consumerCode; - - @SafeHtml - @NotNull - @Size(max = 256) - private String businessService; - - @Email - private String email; - - @Pattern(regexp = "^[0-9]{10}$", message = "MobileNumber should be 10 digit number") - private String mobileNumber; - - public DemandCriteria toDemandCriteria() { - - Set consumerCodeSet = new HashSet<>(); - consumerCodeSet.addAll(consumerCode); - - Set demandIdSet = new HashSet<>(); - demandIdSet.add(demandId); - - return DemandCriteria.builder() - .businessService(businessService) - .consumerCode(consumerCodeSet) - .mobileNumber(mobileNumber) - .isPaymentCompleted(false) - .demandId(demandIdSet) - .tenantId(tenantId) - .email(email) - .build(); - } - - /** - * Converts Gen Bill criteria to search bill criteria to fetch only active bills - * - * @return BillSearchCriteria - */ - public BillSearchCriteria toBillSearchCriteria() { - - return BillSearchCriteria.builder() - .consumerCode(consumerCode) - .mobileNumber(mobileNumber) - .status(BillStatus.ACTIVE) - .service(businessService) - .tenantId(tenantId) - .isOrderBy(true) - .email(email) - .build(); - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/GlCodeMaster.java b/business-services/billing-service/src/main/java/org/egov/demand/model/GlCodeMaster.java deleted file mode 100644 index a14ce5d4cde..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/GlCodeMaster.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.egov.demand.model; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class GlCodeMaster { - - private String id; - - @NotNull - private String tenantId; - @NotNull - private String taxHead; - @NotNull - private String service; - @NotNull - private String glCode; - @NotNull - private Long fromDate; - @NotNull - private Long toDate; - - private AuditDetail auditDetails; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/GlCodeMasterCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/model/GlCodeMasterCriteria.java deleted file mode 100644 index 6fc979fa505..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/GlCodeMasterCriteria.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.egov.demand.model; - -import java.util.HashSet; -import java.util.Set; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -@Builder -public class GlCodeMasterCriteria { - - @NotNull - private String tenantId; - @NotNull - private String service; - - @NotNull - @Default - private Set taxHead = new HashSet<>(); - - @Default - private Set id = new HashSet<>(); - private String glCode; - private Long fromDate; - private Long toDate; - private Long size; - private Long offset; - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/IdGenerationRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/model/IdGenerationRequest.java deleted file mode 100644 index eb4069bc17f..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/IdGenerationRequest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.egov.demand.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.ToString; - -import org.egov.common.contract.request.RequestInfo; - -import java.util.List; - -@Getter -@AllArgsConstructor -@ToString -@Builder -public class IdGenerationRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - private List idRequests; - -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/IdGenerationResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/model/IdGenerationResponse.java deleted file mode 100644 index 310eccdd757..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/IdGenerationResponse.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.demand.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.ToString; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Getter -@ToString -@AllArgsConstructor -@NoArgsConstructor -public class IdGenerationResponse { - - private ResponseInfo responseInfo; - - private List idResponses; - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/IdRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/model/IdRequest.java deleted file mode 100644 index 4e6f4e709f2..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/IdRequest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.egov.demand.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.ToString; - -import javax.validation.constraints.NotNull; - -@Getter -@AllArgsConstructor -@NoArgsConstructor -@ToString -@Builder -public class IdRequest { - - @JsonProperty("idName") - @NotNull - private String idName; - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("format") - private String format; - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/IdResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/model/IdResponse.java deleted file mode 100644 index 383c7802263..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/IdResponse.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.demand.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.ToString; - -@AllArgsConstructor -@NoArgsConstructor -@Getter -@ToString -public class IdResponse { - - private String id; - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/MigrationCount.java b/business-services/billing-service/src/main/java/org/egov/demand/model/MigrationCount.java deleted file mode 100644 index 97f2736726a..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/MigrationCount.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.egov.demand.model; - -import javax.validation.constraints.Size; - -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Address - */ -@Validated -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class MigrationCount { - - @Size(max=64) - @JsonProperty("id") - private String id; - - @JsonProperty("offset") - private Long offset; - - @JsonProperty("limit") - private Long limit; - - @JsonProperty("createdTime") - private Long createdTime; - - @JsonProperty("tenantid") - private String tenantid; - - @JsonProperty("recordCount") - private Long recordCount; - - @JsonProperty("businessService") - private String businessService; - - @JsonProperty("message") - private String message; - - @JsonProperty("auditTopic") - private String auditTopic; - - @JsonProperty("auditTime") - private Long auditTime; -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/Owner.java b/business-services/billing-service/src/main/java/org/egov/demand/model/Owner.java deleted file mode 100644 index 62b16784667..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/Owner.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.model; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.demand.web.contract.UserSearchRequest; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Owner { - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("id") - private Long id; - - @JsonProperty("userName") - private String userName; - - @JsonProperty("name") - private String name; - - @JsonProperty("permanentAddress") - private String permanentAddress; - - @JsonProperty("mobileNumber") - private String mobileNumber; - - @JsonProperty("emailId") - private String emailId; - - @JsonProperty("aadhaarNumber") - private String aadhaarNumber; - - private String userType; - - public UserSearchRequest toUserSearchRequest() { - - List ids = new ArrayList<>(); - ids.add(this.id); - return UserSearchRequest.builder().aadhaarNumber(this.aadhaarNumber).emailId(this.emailId) - .mobileNumber(this.mobileNumber).name(this.name).tenantId(this.tenantId).id(ids) - .userName(this.userName).userType("CITIZEN").pageSize(500).build(); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/PaymentBackUpdateAudit.java b/business-services/billing-service/src/main/java/org/egov/demand/model/PaymentBackUpdateAudit.java deleted file mode 100644 index 5a3c46f9117..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/PaymentBackUpdateAudit.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.egov.demand.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class PaymentBackUpdateAudit { - - private String tenantId; - - private String paymentId; - - private Boolean isBackUpdateSucces; - - private Boolean isReceiptCancellation; - - private String errorMessage; - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/TaxAndPayment.java b/business-services/billing-service/src/main/java/org/egov/demand/model/TaxAndPayment.java deleted file mode 100644 index 672b7f1aec5..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/TaxAndPayment.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.demand.model; - -import java.math.BigDecimal; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -/** - * TaxAndPayment - */ - -@Getter -@Setter -@ToString -@EqualsAndHashCode(of= {"businessService"}) -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class TaxAndPayment { - - @JsonProperty("businessService") - private String businessService; - - @JsonProperty("taxAmount") - private BigDecimal taxAmount; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid; - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/TaxHeadMaster.java b/business-services/billing-service/src/main/java/org/egov/demand/model/TaxHeadMaster.java deleted file mode 100644 index 6359b084831..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/TaxHeadMaster.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.demand.model; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.demand.model.enums.Category; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class TaxHeadMaster { - - private String id; - - @NotNull - private String tenantId; - @Valid - @NotNull - private Category category; - @NotNull - private String service; - @NotNull - private String name; - - private String code; - - private List glCodes; - - private Boolean isDebit = false; - - private Boolean isActualDemand; - @NotNull - private Long validFrom; - @NotNull - private Long validTill; - - private Integer order; - - private AuditDetail auditDetail; - - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/TaxHeadMasterCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/model/TaxHeadMasterCriteria.java deleted file mode 100644 index b81dc8f24ba..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/TaxHeadMasterCriteria.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.demand.model; - -import java.util.HashSet; -import java.util.Set; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import lombok.Builder.Default; - -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -@Builder -public class TaxHeadMasterCriteria { - - @NotNull - private String tenantId; - @NotNull - private String service; - private String category; - private String name; - - @Default - private Set code=new HashSet<>(); - private Boolean isDebit; - private Boolean isActualDemand; - - @Default - private Set id=new HashSet<>(); - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/TaxPeriod.java b/business-services/billing-service/src/main/java/org/egov/demand/model/TaxPeriod.java deleted file mode 100644 index 2b5fa65e67c..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/TaxPeriod.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.model; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.constraints.NotNull; - -import org.egov.demand.model.enums.PeriodCycle; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class TaxPeriod { - - private String id; - - @NotNull - private String tenantId; - - @NotNull - private Long fromDate; - - @NotNull - private Long toDate; - - @NotNull - private PeriodCycle periodCycle; - - @NotNull - private String service; - - @NotNull - private String code; - - private String financialYear; - - private AuditDetail auditDetail; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/UpdateBillCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/model/UpdateBillCriteria.java deleted file mode 100644 index c250c31e94c..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/UpdateBillCriteria.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.egov.demand.model; - -import java.util.Set; - -import javax.validation.constraints.NotNull; - -import org.egov.demand.model.BillV2.BillStatus; - -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class UpdateBillCriteria { - - @NotNull - private String tenantId; - - @NotNull - private Set consumerCodes; - - @NotNull - private String businessService; - - @NotNull - private JsonNode additionalDetails; - - private Set billIds; - - @NotNull - private BillStatus statusToBeUpdated; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/UpdateBillRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/model/UpdateBillRequest.java deleted file mode 100644 index 72b2baa80bb..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/UpdateBillRequest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.egov.demand.model; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class UpdateBillRequest { - - @NotNull - private RequestInfo RequestInfo; - - @NotNull - @Valid - private UpdateBillCriteria UpdateBillCriteria; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Category.java b/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Category.java deleted file mode 100644 index f59cb77743e..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Category.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.demand.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Category of demand like tax, fee, rebate, penalty etc. - */ -public enum Category { - - TAX("TAX"), - - FEE("FEE"), - - REBATE("REBATE"), - - EXEMPTION("EXEMPTION"), - - ADVANCE_COLLECTION("ADVANCE_COLLECTION"), - - PENALTY("PENALTY"), - - FINES("FINES"), - - CHARGES("CHARGES"); - - private String value; - - Category(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Category fromValue(String text) { - for (Category b : Category.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/DemandStatus.java b/business-services/billing-service/src/main/java/org/egov/demand/model/enums/DemandStatus.java deleted file mode 100644 index e8d3c51b601..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/DemandStatus.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.egov.demand.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum DemandStatus { - - ACTIVE("ACTIVE"), - - CANCELLED("CANCELLED"), - - ADJUSTED("ADJUSTED"); - - private String value; - - DemandStatus(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static DemandStatus fromValue(String text) { - for (DemandStatus b : DemandStatus.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/PeriodCycle.java b/business-services/billing-service/src/main/java/org/egov/demand/model/enums/PeriodCycle.java deleted file mode 100644 index 064c64a7310..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/PeriodCycle.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.demand.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum PeriodCycle { - - MONTH("MONTH"), - - QUARTER("QUARTER"), - - HALFYEAR("HALFYEAR"), - - ANNUAL("ANNUAL"); - - private String value; - - PeriodCycle(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static PeriodCycle fromValue(String text) { - for (PeriodCycle periodCycle : PeriodCycle.values()) { - if (String.valueOf(periodCycle.value).equals(text)) { - return periodCycle; - } - } - return null; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Purpose.java b/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Purpose.java deleted file mode 100644 index 6fcc1751a69..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Purpose.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.demand.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum Purpose { - - ARREAR("ARREAR"), - - CURRENT("CURRENT"), - - ADVANCE("ADVANCE"), - - OTHERS("OTHERS"); - - private String value; - - Purpose(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Purpose fromValue(String text) { - for (Purpose b : Purpose.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Status.java b/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Status.java deleted file mode 100644 index cd4e33adef3..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Status.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.egov.demand.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum Status { - - CREATED("CREATED"), - - CANCELLED("CANCELLED"), - - INSTRUMENT_BOUNCED("INSTRUMENT_BOUNCED"); - - private String value; - - Status(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Status fromValue(String text) { - for (Status b : Status.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Type.java b/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Type.java deleted file mode 100644 index d9bbfd9db0d..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/enums/Type.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.egov.demand.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum Type { - - ARREARS("ARREARS"), - - CURRENT("CURRENT"), - - DUES("DUES"); - - private String value; - - Type(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Type fromValue(String text) { - for (Type type : Type.values()) { - if (String.valueOf(type.value).equals(text)) { - return type; - } - } - return null; - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/producer/Producer.java b/business-services/billing-service/src/main/java/org/egov/demand/producer/Producer.java deleted file mode 100644 index 059fb14ed5a..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/producer/Producer.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.demand.producer; - -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.kafka.CustomKafkaTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import lombok.extern.slf4j.Slf4j; - -@Component -@Slf4j -public class Producer { - - @Autowired - private CustomKafkaTemplate kafkaTemplate; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - public void push(String tenantId, String topic, Object value) { - - String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); - log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); - kafkaTemplate.send(updatedTopic, value); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/AmendmentRepository.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/AmendmentRepository.java deleted file mode 100644 index 19e2a101ec9..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/AmendmentRepository.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.egov.demand.repository; - -import static org.egov.demand.repository.querybuilder.AmendmentQueryBuilder.AMENDMENT_INSERT_QUERY; -import static org.egov.demand.repository.querybuilder.AmendmentQueryBuilder.AMENDMENT_TAXDETAIL_INSERT_QUERY; -import static org.egov.demand.repository.querybuilder.AmendmentQueryBuilder.AMENDMENT_UPDATE_QUERY; -import static org.egov.demand.repository.querybuilder.AmendmentQueryBuilder.DOCUMET_INSERT_QUERY; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.exception.InvalidTenantIdException; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.demand.amendment.model.Amendment; -import org.egov.demand.amendment.model.AmendmentCriteria; -import org.egov.demand.amendment.model.AmendmentRequest; -import org.egov.demand.amendment.model.AmendmentUpdate; -import org.egov.demand.amendment.model.Document; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.repository.querybuilder.AmendmentQueryBuilder; -import org.egov.demand.repository.querybuilder.BillQueryBuilder; -import org.egov.demand.repository.rowmapper.AmendmentRowMapper; -import org.egov.demand.util.Util; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.jdbc.core.namedparam.SqlParameterSource; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -public class AmendmentRepository { - - @Autowired - private Util util; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - private NamedParameterJdbcTemplate namedJdbcTemplate; - - @Autowired - private AmendmentRowMapper amendmentRowMapper; - - @Autowired - private AmendmentQueryBuilder amendmentQueryBuilder; - - @Transactional - public void saveAmendment (AmendmentRequest amendmentRequest) { - - Amendment amendment = amendmentRequest.getAmendment(); - - String sqlBill; - try { - sqlBill = centralInstanceUtil.replaceSchemaPlaceholder(AMENDMENT_INSERT_QUERY, amendment.getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - namedJdbcTemplate.update(sqlBill, getAmendmentSqlParameter(amendmentRequest)); - saveTaxDetail(amendment.getDemandDetails(), amendment.getId(), amendment.getTenantId()); - savedocs(amendment.getDocuments(), amendment.getId(), amendment.getTenantId()); - } - - private void saveTaxDetail(List demandDetails, String amendmentId, String tenantId) { - - List sqlParameterSources = getSqlParameterListForTaxDetails(demandDetails, amendmentId); - String sqlBill; - try { - sqlBill = centralInstanceUtil.replaceSchemaPlaceholder(AMENDMENT_TAXDETAIL_INSERT_QUERY, tenantId); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - namedJdbcTemplate.batchUpdate(sqlBill, sqlParameterSources.toArray(new MapSqlParameterSource[0])); - } - - private void savedocs(List documents, String amendmentId, String tenantId) { - - List sqlParameterSources = getSqlParameterListForDocs(documents, amendmentId); - String sqlDocQuery; - try { - sqlDocQuery = centralInstanceUtil.replaceSchemaPlaceholder(DOCUMET_INSERT_QUERY, tenantId); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - namedJdbcTemplate.batchUpdate(sqlDocQuery, sqlParameterSources.toArray(new MapSqlParameterSource[0])); - } - - public List getAmendments (AmendmentCriteria amendmentCriteria) { - - MapSqlParameterSource searchParamMap = new MapSqlParameterSource(); - String searchQuery = amendmentQueryBuilder.getSearchQuery(amendmentCriteria, searchParamMap); - try { - searchQuery = centralInstanceUtil.replaceSchemaPlaceholder(searchQuery, amendmentCriteria.getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - return namedJdbcTemplate.query(searchQuery, searchParamMap, amendmentRowMapper); - } - - @Transactional - public void updateAmendment(List amendmentUpdates, String tenantId) { - - String amenndmentUpdateQuery; - try { - amenndmentUpdateQuery = centralInstanceUtil.replaceSchemaPlaceholder(AMENDMENT_UPDATE_QUERY, tenantId); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - List sqlParameterSources = getSqlParameterListForAmendmentUpdate(amendmentUpdates); - namedJdbcTemplate.batchUpdate(amenndmentUpdateQuery, sqlParameterSources.toArray(new MapSqlParameterSource[0])); - } - - /* - * map-sql-parameter construction methods - */ - public SqlParameterSource getAmendmentSqlParameter(AmendmentRequest amendmentRequest) { - - MapSqlParameterSource mapSqlParameterSource = new MapSqlParameterSource(); - Amendment amendment = amendmentRequest.getAmendment(); - AuditDetails auditDetails = amendment.getAuditDetails(); - - mapSqlParameterSource.addValue("id", amendment.getId()); - mapSqlParameterSource.addValue("tenantid", amendment.getTenantId()); - mapSqlParameterSource.addValue("amendmentid", amendment.getAmendmentId()); - mapSqlParameterSource.addValue("businessservice", amendment.getBusinessService()); - mapSqlParameterSource.addValue("consumercode", amendment.getConsumerCode()); - mapSqlParameterSource.addValue("amendmentreason", amendment.getAmendmentReason().toString()); - mapSqlParameterSource.addValue("reasondocumentnumber", amendment.getReasonDocumentNumber()); - mapSqlParameterSource.addValue("status", amendment.getStatus().toString()); - mapSqlParameterSource.addValue("effectivetill", amendment.getEffectiveTill()); - mapSqlParameterSource.addValue("effectivefrom", amendment.getEffectiveFrom()); - mapSqlParameterSource.addValue("amendeddemandid", amendment.getAmendedDemandId()); - mapSqlParameterSource.addValue("createdby", auditDetails.getCreatedBy()); - mapSqlParameterSource.addValue("createdtime", auditDetails.getCreatedTime()); - mapSqlParameterSource.addValue("lastmodifiedby", auditDetails.getLastModifiedBy()); - mapSqlParameterSource.addValue("lastmodifiedtime", auditDetails.getLastModifiedTime()); - mapSqlParameterSource.addValue("additionaldetails", util.getPGObject(amendment.getAdditionalDetails())); - - return mapSqlParameterSource; - } - - private List getSqlParameterListForTaxDetails(List demandDetails, - String amendmentId) { - - List taxDetailParamMapList = new ArrayList<>(); - for (DemandDetail detail : demandDetails) { - - MapSqlParameterSource taxDetailParamMap = new MapSqlParameterSource(); - taxDetailParamMap.addValue("id", detail.getId()); - taxDetailParamMap.addValue("amendmentid", amendmentId); - taxDetailParamMap.addValue("taxheadcode", detail.getTaxHeadMasterCode()); - taxDetailParamMap.addValue("taxamount", detail.getTaxAmount()); - taxDetailParamMapList.add(taxDetailParamMap); - } - return taxDetailParamMapList; - } - - private List getSqlParameterListForDocs(List documents, String amendmentId) { - - List documentsParamMapList = new ArrayList<>(); - for (Document document : documents) { - - MapSqlParameterSource documentParamMap = new MapSqlParameterSource(); - documentParamMap.addValue("id", document.getId()); - documentParamMap.addValue("amendmentid", amendmentId); - documentParamMap.addValue("documenttype", document.getDocumentType()); - documentParamMap.addValue("filestoreid", document.getFileStoreId()); - documentParamMap.addValue("documentuid", document.getDocumentUid()); - documentParamMap.addValue("status", "ACTIVE"); - documentsParamMapList.add(documentParamMap); - } - - return documentsParamMapList; - } - - private List getSqlParameterListForAmendmentUpdate(List amendmentUpdates) { - - List updateParamMapList = new ArrayList<>(); - for (AmendmentUpdate amendmentUpdate : amendmentUpdates) { - - AuditDetails auditDetails = amendmentUpdate.getAuditDetails(); - MapSqlParameterSource updateParamMap = new MapSqlParameterSource(); - - updateParamMap.addValue("status", amendmentUpdate.getStatus().toString()); - updateParamMap.addValue("amendeddemandid", amendmentUpdate.getAmendedDemandId()); - updateParamMap.addValue("lastmodifiedby", auditDetails.getLastModifiedBy()); - updateParamMap.addValue("lastmodifiedtime", auditDetails.getLastModifiedTime()); - updateParamMap.addValue("additionaldetails", util.getPGObject(amendmentUpdate.getAdditionalDetails())); - updateParamMap.addValue("tenantid", amendmentUpdate.getTenantId()); - updateParamMap.addValue("amendmentid", amendmentUpdate.getAmendmentId()); - updateParamMapList.add(updateParamMap); - } - return updateParamMapList; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/BillRepository.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/BillRepository.java deleted file mode 100644 index 8d78013c196..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/BillRepository.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.egov.demand.repository; - -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.exception.InvalidTenantIdException; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.Bill; -import org.egov.demand.model.BillAccountDetail; -import org.egov.demand.model.BillDetail; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.BillV2.BillStatus; -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.repository.querybuilder.BillQueryBuilder; -import org.egov.demand.repository.rowmapper.BillRowMapper; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.BillResponse; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.BatchPreparedStatementSetter; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.ObjectUtils; -import org.springframework.web.client.RestTemplate; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class BillRepository { - - @Autowired - private BillQueryBuilder billQueryBuilder; - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private Util util; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - private BillRowMapper searchBillRowMapper; - - @Autowired - private BusinessServiceDetailRepository businessServiceDetailRepository; - - public List findBill(BillSearchCriteria billCriteria){ - - List preparedStatementValues = new ArrayList<>(); - String queryStr = billQueryBuilder.getBillQuery(billCriteria, preparedStatementValues); - try { - queryStr = centralInstanceUtil.replaceSchemaPlaceholder(queryStr, billCriteria.getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - log.debug("query:::"+queryStr+" preparedStatementValues::"+preparedStatementValues); - - return jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), searchBillRowMapper); - } - - @Transactional - public void saveBill(BillRequest billRequest){ - - RequestInfo requestInfo = billRequest.getRequestInfo(); - List bills = billRequest.getBills(); - - log.debug("saveBill requestInfo:"+requestInfo); - log.debug("saveBill bills:"+bills); - jdbcTemplate.batchUpdate(BillQueryBuilder.INSERT_BILL_QUERY, new BatchPreparedStatementSetter() { - - @Override - public void setValues(PreparedStatement ps, int index) throws SQLException { - Bill bill = bills.get(index); - - BillStatus status = BillStatus.ACTIVE; - if(!ObjectUtils.isEmpty(bill.getIsCancelled()) && bill.getIsCancelled() == true) - status = BillStatus.CANCELLED; - - AuditDetails auditDetails = bill.getAuditDetails(); - - ps.setString(1, bill.getId()); - ps.setString(2, bill.getTenantId()); - ps.setString(3, bill.getPayerName()); - ps.setString(4, bill.getPayerAddress()); - ps.setString(5, bill.getPayerEmail()); - ps.setObject(6, bill.getIsActive()); - ps.setObject(7, bill.getIsCancelled()); - ps.setString(8, auditDetails.getCreatedBy()); - ps.setLong(9, auditDetails.getCreatedTime()); - ps.setString(10, auditDetails.getLastModifiedBy()); - ps.setLong(11, auditDetails.getLastModifiedTime()); - ps.setString(12, bill.getMobileNumber()); - ps.setString(13, status.toString()); - ps.setObject(14, util.getPGObject(bill.getAdditionalDetails())); - } - - @Override - public int getBatchSize() { - return bills.size(); - } - }); - saveBillDetails(billRequest); - } - - public void saveBillDetails(BillRequest billRequest){ - - List bills = billRequest.getBills(); - List billDetails = new ArrayList<>(); - List billAccountDetails = new ArrayList<>(); - AuditDetails auditDetails = bills.get(0).getAuditDetails(); - - for(Bill bill:bills){ - List tempBillDetails = bill.getBillDetails(); - billDetails.addAll(tempBillDetails); - - for(BillDetail billDetail : tempBillDetails){ - billAccountDetails.addAll(billDetail.getBillAccountDetails()); - } - } - log.debug("saveBillDeails tempBillDetails:"+billDetails); - jdbcTemplate.batchUpdate(BillQueryBuilder.INSERT_BILLDETAILS_QUERY, new BatchPreparedStatementSetter() { - - - @Override - public void setValues(PreparedStatement ps, int index) throws SQLException { - BillDetail billDetail = billDetails.get(index); - - ps.setString(1, billDetail.getId()); - ps.setString(2, billDetail.getTenantId()); - ps.setString(3, billDetail.getBill()); - ps.setString(4, billDetail.getDemandId()); - ps.setLong(5, billDetail.getFromPeriod()); - ps.setLong(6, billDetail.getToPeriod()); - ps.setString(7, billDetail.getBusinessService()); - ps.setString(8, billDetail.getBillNumber()); - ps.setLong(9, billDetail.getBillDate()); - ps.setString(10, billDetail.getConsumerCode()); - ps.setString(11, billDetail.getConsumerType()); - ps.setString(12, null); - ps.setString(13, null); - ps.setObject(14, billDetail.getMinimumAmount()); - ps.setObject(15, billDetail.getTotalAmount()); - // apportioning logic does not reside in billing service anymore - ps.setBoolean(16, false); - ps.setObject(17, billDetail.getPartPaymentAllowed()); - - String collectionModesNotAllowed = null != billDetail.getCollectionModesNotAllowed() - ? StringUtils.join(billDetail.getCollectionModesNotAllowed(), ",") - : null; - ps.setString(18, collectionModesNotAllowed); - - ps.setString(19, auditDetails.getCreatedBy()); - ps.setLong(20, auditDetails.getCreatedTime()); - ps.setString(21, auditDetails.getLastModifiedBy()); - ps.setLong(22, auditDetails.getLastModifiedTime()); - ps.setBoolean(23, billDetail.getIsAdvanceAllowed()); - ps.setLong(24, billDetail.getExpiryDate()); - - } - - @Override - public int getBatchSize() { - return billDetails.size(); - } - }); - saveBillAccountDetail(billAccountDetails, auditDetails); - } - - public void saveBillAccountDetail(List billAccountDetails, AuditDetails auditDetails){ - log.debug("saveBillAccountDetail billAccountDetails:"+billAccountDetails); - - jdbcTemplate.batchUpdate(BillQueryBuilder.INSERT_BILLACCOUNTDETAILS_QUERY, new BatchPreparedStatementSetter() { - - @Override - public void setValues(PreparedStatement ps, int index) throws SQLException { - BillAccountDetail billAccountDetail = billAccountDetails.get(index); - - ps.setString(1, billAccountDetail.getId()); - ps.setString(2, billAccountDetail.getTenantId()); - ps.setString(3, billAccountDetail.getBillDetail()); - ps.setString(4, billAccountDetail.getDemandDetailId()); - ps.setObject(5, billAccountDetail.getOrder()); - ps.setBigDecimal(6, billAccountDetail.getAmount()); - ps.setObject(7, billAccountDetail.getAdjustedAmount()); - ps.setObject(8, null); - ps.setString(9, null); - ps.setString(10, auditDetails.getCreatedBy()); - ps.setLong(11, auditDetails.getCreatedTime()); - ps.setString(12, auditDetails.getLastModifiedBy()); - ps.setLong(13, auditDetails.getLastModifiedTime()); - ps.setString(14, billAccountDetail.getTaxHeadCode()); - } - - @Override - public int getBatchSize() { - return billAccountDetails.size(); - } - }); - } - - @Deprecated - public List apportion(BillRequest billRequest) { - - RequestInfo requestInfo = billRequest.getRequestInfo(); - List inputBills = billRequest.getBills(); - List reqBills = null; - BillRequest inputBillrequest = new BillRequest(); - Map responseBillDetailsMap = new HashMap<>(); - inputBillrequest.setRequestInfo(requestInfo); - - BusinessServiceDetailCriteria businessCriteria = BusinessServiceDetailCriteria.builder() - .tenantId(inputBills.get(0).getTenantId()).build(); - - Map businessServicesMap = businessServiceDetailRepository - .getBussinessServiceDetail(requestInfo, businessCriteria).stream() - .filter(BusinessServiceDetail::getCallBackForApportioning) - .collect(Collectors.toMap(BusinessServiceDetail::getBusinessService, Function.identity())); - - for (String businessService : businessServicesMap.keySet()) { - - String url = businessServicesMap.get(businessService).getCallBackApportionURL(); - reqBills = new ArrayList<>(); - for (Bill bill : inputBills) { - - Bill reqBill = bill; - List reqbillDetails = new ArrayList<>(); - for (BillDetail billDetail : reqBill.getBillDetails()) - if (billDetail.getBusinessService().equalsIgnoreCase(businessService)) - reqbillDetails.add(billDetail); - reqBill.setBillDetails(reqbillDetails); - reqBills.add(reqBill); - } - inputBillrequest.setBills(reqBills); - List responseBills = restTemplate.postForObject("http://pt-calculator-v2:8080"+url, billRequest, BillResponse.class).getBill(); - for (Bill bill : responseBills) { - for (BillDetail detail : bill.getBillDetails()) - responseBillDetailsMap.put(detail.getId(), detail); - } - } - return getApportionedBillList(inputBills, responseBillDetailsMap); - } - - private List getApportionedBillList(List inputBills, Map responseBillDetailsMap) { - - for (Bill bill : inputBills) { - List billDetails = new ArrayList<>(); - for (BillDetail detail : bill.getBillDetails()) { - - String id = detail.getId(); - if (id != null) - billDetails.add(responseBillDetailsMap.get(id)); - else - billDetails.add(detail); - } - bill.setBillDetails(billDetails); - } - return inputBills; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/BillRepositoryV2.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/BillRepositoryV2.java deleted file mode 100644 index 062fc11f292..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/BillRepositoryV2.java +++ /dev/null @@ -1,279 +0,0 @@ -package org.egov.demand.repository; - -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.egov.common.exception.InvalidTenantIdException; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.BillAccountDetailV2; -import org.egov.demand.model.BillDetailV2; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.BillV2; -import org.egov.demand.model.BillV2.BillStatus; -import org.egov.demand.model.UpdateBillCriteria; -import org.egov.demand.repository.querybuilder.BillQueryBuilder; -import org.egov.demand.repository.rowmapper.BillRowMapperV2; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequestV2; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.BatchPreparedStatementSetter; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class BillRepositoryV2 { - - @Autowired - private BillQueryBuilder billQueryBuilder; - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Autowired - private Util util; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - private BillRowMapperV2 searchBillRowMapper; - - public List findBill(BillSearchCriteria billCriteria){ - - List preparedStatementValues = new ArrayList<>(); - String queryStr = billQueryBuilder.getBillQuery(billCriteria, preparedStatementValues); - try { - queryStr = centralInstanceUtil.replaceSchemaPlaceholder(queryStr, billCriteria.getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - log.debug("query:::" + queryStr + " preparedStatementValues::" + preparedStatementValues); - return jdbcTemplate.query(queryStr, preparedStatementValues.toArray(), searchBillRowMapper); - } - - @Transactional - public void saveBill(BillRequestV2 billRequest){ - - List bills = billRequest.getBills(); - - String sqlBill; - try { - sqlBill = centralInstanceUtil.replaceSchemaPlaceholder(BillQueryBuilder.INSERT_BILL_QUERY, - billRequest.getBills().get(0).getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - jdbcTemplate.batchUpdate(sqlBill, new BatchPreparedStatementSetter() { - - @Override - public void setValues(PreparedStatement ps, int index) throws SQLException { - BillV2 bill = bills.get(index); - - AuditDetails auditDetails = bill.getAuditDetails(); - - ps.setString(1, bill.getId()); - ps.setString(2, bill.getTenantId()); - ps.setString(3, bill.getPayerName()); - ps.setString(4, bill.getPayerAddress()); - ps.setString(5, bill.getPayerEmail()); - ps.setObject(6, null); - ps.setObject(7, null); - ps.setString(8, auditDetails.getCreatedBy()); - ps.setLong(9, auditDetails.getCreatedTime()); - ps.setString(10, auditDetails.getLastModifiedBy()); - ps.setLong(11, auditDetails.getLastModifiedTime()); - ps.setString(12, bill.getMobileNumber()); - ps.setString(13, bill.getStatus().toString()); - ps.setObject(14, util.getPGObject(bill.getAdditionalDetails())); - ps.setString(15, bill.getUserId()); - ps.setString(16, bill.getConsumerCode()); - } - - @Override - public int getBatchSize() { - return bills.size(); - } - }); - saveBillDetails(billRequest); - } - - public void saveBillDetails(BillRequestV2 billRequest) { - - List bills = billRequest.getBills(); - List billDetails = new ArrayList<>(); - List billAccountDetails = new ArrayList<>(); - AuditDetails auditDetails = bills.get(0).getAuditDetails(); - - Map billDetailIdAndBillMap = new HashMap<>(); - - for (BillV2 bill : bills) { - - List tempBillDetails = bill.getBillDetails(); - billDetails.addAll(tempBillDetails); - - for (BillDetailV2 billDetail : tempBillDetails) { - - billDetailIdAndBillMap.put(billDetail.getId(), bill); - billAccountDetails.addAll(billDetail.getBillAccountDetails()); - } - } - - String sqlBillDetails; - try { - sqlBillDetails = centralInstanceUtil.replaceSchemaPlaceholder(BillQueryBuilder.INSERT_BILLDETAILS_QUERY, - billRequest.getBills().get(0).getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - jdbcTemplate.batchUpdate(sqlBillDetails, new BatchPreparedStatementSetter(){ - - @Override - public void setValues(PreparedStatement ps, int index) throws SQLException { - BillDetailV2 billDetail = billDetails.get(index); - BillV2 bill = billDetailIdAndBillMap.get(billDetail.getId()); - - ps.setString(1, billDetail.getId()); - ps.setString(2, billDetail.getTenantId()); - ps.setString(3, billDetail.getBillId()); - ps.setString(4, billDetail.getDemandId()); - ps.setLong(5, billDetail.getFromPeriod()); - ps.setLong(6, billDetail.getToPeriod()); - ps.setString(7, bill.getBusinessService()); - ps.setString(8, bill.getBillNumber()); - ps.setLong(9, bill.getBillDate()); - ps.setString(10, bill.getConsumerCode()); - ps.setString(11, null); - ps.setString(12, null); - ps.setString(13, null); - ps.setObject(14, null); - ps.setObject(15, billDetail.getAmount()); - // apportioning logic does not reside in billing service anymore - ps.setBoolean(16, false); - ps.setObject(17, null); - ps.setString(18, null); - ps.setString(19, auditDetails.getCreatedBy()); - ps.setLong(20, auditDetails.getCreatedTime()); - ps.setString(21, auditDetails.getLastModifiedBy()); - ps.setLong(22, auditDetails.getLastModifiedTime()); - ps.setObject(23, null); - ps.setLong(24, billDetail.getExpiryDate()); - ps.setObject(25,util.getPGObject(billDetail.getAdditionalDetails())); - } - - @Override - public int getBatchSize() { - return billDetails.size(); - } - }); - - saveBillAccountDetail(billAccountDetails, auditDetails); - } - - public void saveBillAccountDetail(List billAccountDetails, AuditDetails auditDetails) { - - String sqlBillAccount; - try { - sqlBillAccount = centralInstanceUtil.replaceSchemaPlaceholder( - BillQueryBuilder.INSERT_BILLACCOUNTDETAILS_QUERY, billAccountDetails.get(0).getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - jdbcTemplate.batchUpdate(sqlBillAccount, new BatchPreparedStatementSetter() { - - @Override - public void setValues(PreparedStatement ps, int index) throws SQLException { - BillAccountDetailV2 billAccountDetail = billAccountDetails.get(index); - - ps.setString(1, billAccountDetail.getId()); - ps.setString(2, billAccountDetail.getTenantId()); - ps.setString(3, billAccountDetail.getBillDetailId()); - ps.setString(4, billAccountDetail.getDemandDetailId()); - ps.setObject(5, billAccountDetail.getOrder()); - ps.setBigDecimal(6, billAccountDetail.getAmount()); - ps.setObject(7, billAccountDetail.getAdjustedAmount()); - ps.setObject(8, null); - ps.setString(9, null); - ps.setString(10, auditDetails.getCreatedBy()); - ps.setLong(11, auditDetails.getCreatedTime()); - ps.setString(12, auditDetails.getLastModifiedBy()); - ps.setLong(13, auditDetails.getLastModifiedTime()); - ps.setString(14, billAccountDetail.getTaxHeadCode()); - } - - @Override - public int getBatchSize() { - return billAccountDetails.size(); - } - }); - } - - /** - * executes query to update bill status to expired - * @param billIds - */ - public Integer updateBillStatus(UpdateBillCriteria updateBillCriteria) { - - Set consumerCodes = updateBillCriteria.getConsumerCodes(); - if(CollectionUtils.isEmpty(consumerCodes)) - return 0; - - List bills = findBill(BillSearchCriteria.builder() - .service(updateBillCriteria.getBusinessService()) - .tenantId(updateBillCriteria.getTenantId()) - .consumerCode(consumerCodes) - .build()); - - if (CollectionUtils.isEmpty(bills)) - return 0; - - BillStatus status = bills.get(0).getStatus(); - if (!status.equals(BillStatus.ACTIVE)) { - if (status.equals(BillStatus.PAID) || status.equals(BillStatus.PARTIALLY_PAID)) - return -1; - else - return 0; - } - - if (BillStatus.CANCELLED.equals(updateBillCriteria.getStatusToBeUpdated())) { - - updateBillCriteria.setBillIds(Stream.of(bills.get(0).getId()).collect(Collectors.toSet())); - updateBillCriteria.setAdditionalDetails( - util.jsonMerge(updateBillCriteria.getAdditionalDetails(), bills.get(0).getAdditionalDetails())); - - } else { - - updateBillCriteria.setBillIds(bills.stream().map(BillV2::getId).collect(Collectors.toSet())); - } - - List preparedStmtList = new ArrayList<>(); - String queryStr = billQueryBuilder.getBillStatusUpdateQuery(updateBillCriteria, preparedStmtList); - try { - queryStr = centralInstanceUtil.replaceSchemaPlaceholder(queryStr, updateBillCriteria.getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_PT_AS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - return jdbcTemplate.update(queryStr, preparedStmtList.toArray()); - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/BusinessServiceDetailRepository.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/BusinessServiceDetailRepository.java deleted file mode 100644 index 49fcb766bb8..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/BusinessServiceDetailRepository.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.repository; - -import static org.egov.demand.util.Constants.BUSINESSSERVICE_EXPRESSION; -import static org.egov.demand.util.Constants.BUSINESSSERVICE_IDS_FILTER; -import static org.egov.demand.util.Constants.BUSINESSSERVICE_MASTERNAME; -import static org.egov.demand.util.Constants.BUSINESSSERVICE_SERVICES_FILTER; -import static org.egov.demand.util.Constants.MDMS_NO_FILTER_BUSINESSSERVICE; -import static org.egov.demand.util.Constants.MODULE_NAME; - -import java.util.Collections; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -@Repository -public class BusinessServiceDetailRepository { - - @Autowired - private Util util; - - @Autowired - private ObjectMapper mapper; - - - /** - * Fetches the BussinessServiceDetail based on search criteria - * @param requestInfo The requestInfo of the search request - * @param BusinessServiceDetailsCriteria The search criteria for BussinessServiceDetailBussinessServiceDetail - * @return List of BussinessServiceDetail - */ - public List getBussinessServiceDetail(RequestInfo requestInfo,BusinessServiceDetailCriteria BusinessServiceDetailsCriteria){ - - MdmsCriteriaReq mdmsCriteriaReq = util.prepareMdMsRequest(BusinessServiceDetailsCriteria.getTenantId(), - MODULE_NAME, Collections.singletonList(BUSINESSSERVICE_MASTERNAME), null, - requestInfo); - - DocumentContext documentContext = util.getAttributeValues(mdmsCriteriaReq); - - StringBuilder filterExpression = new StringBuilder(); - - if (BusinessServiceDetailsCriteria.getId() != null && !BusinessServiceDetailsCriteria.getId().isEmpty()) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression.append( - BUSINESSSERVICE_IDS_FILTER.replace("VAL", util.getStringVal(BusinessServiceDetailsCriteria.getId()))); - } - - if (!CollectionUtils.isEmpty(BusinessServiceDetailsCriteria.getBusinessService())) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression.append(BUSINESSSERVICE_SERVICES_FILTER.replace("VAL", - util.getStringVal(BusinessServiceDetailsCriteria.getBusinessService()))); - } - - String jsonPath; - if(filterExpression.length()!=0) - jsonPath = BUSINESSSERVICE_EXPRESSION.replace("EXPRESSION",filterExpression.toString()); - else jsonPath = MDMS_NO_FILTER_BUSINESSSERVICE; - - return mapper.convertValue(documentContext.read(jsonPath), new TypeReference>() {}); - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/DemandRepository.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/DemandRepository.java deleted file mode 100644 index 0c4c2d8ce12..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/DemandRepository.java +++ /dev/null @@ -1,483 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.repository; - -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.egov.common.exception.InvalidTenantIdException; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.model.PaymentBackUpdateAudit; -import org.egov.demand.repository.querybuilder.DemandQueryBuilder; -import org.egov.demand.repository.rowmapper.DemandRowMapper; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.BatchPreparedStatementSetter; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.PreparedStatementSetter; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class DemandRepository { - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Autowired - private DemandQueryBuilder demandQueryBuilder; - - @Autowired - private DemandRowMapper demandRowMapper; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - private Util util; - - public List getDemands(DemandCriteria demandCriteria) { - - List preparedStatementValues = new ArrayList<>(); - String searchDemandQuery = demandQueryBuilder.getDemandQuery(demandCriteria, preparedStatementValues); - try { - searchDemandQuery=centralInstanceUtil.replaceSchemaPlaceholder(searchDemandQuery, demandCriteria.getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - return jdbcTemplate.query(searchDemandQuery, preparedStatementValues.toArray(), demandRowMapper); - } - - /** - * Fetches demand from DB based on a map of business code and set of consumer codes - * - * @param businessConsumercodeMap - * @param tenantId - * @return - */ - public List getDemandsForConsumerCodes(Map> businessConsumercodeMap, String tenantId) { - - List presparedStmtList = new ArrayList<>(); - String sql = demandQueryBuilder.getDemandQueryForConsumerCodes(businessConsumercodeMap, presparedStmtList, - tenantId); - try { - sql = centralInstanceUtil.replaceSchemaPlaceholder(sql, tenantId); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - return jdbcTemplate.query(sql, presparedStmtList.toArray(), demandRowMapper); - } - - @Transactional - public void save(DemandRequest demandRequest) { - - log.debug("DemandRepository save, the request object : " + demandRequest); - List demands = demandRequest.getDemands(); - List demandDetails = new ArrayList<>(); - - for (Demand demand : demands) { - demandDetails.addAll(demand.getDemandDetails()); - } - - insertBatch(demands, demandDetails); - log.debug("Demands saved >>>> "); - insertBatchForAudit(demands, demandDetails); - } - - @Transactional - public void update(DemandRequest demandRequest, PaymentBackUpdateAudit paymentBackUpdateAudit) { - - List demands = demandRequest.getDemands(); - List oldDemands = new ArrayList<>(); - List oldDemandDetails = new ArrayList<>(); - List newDemands = new ArrayList<>(); - List newDemandDetails = new ArrayList<>(); - - DemandCriteria demandCriteria = DemandCriteria.builder() - .demandId(demands.stream().map(Demand::getId).collect(Collectors.toSet())) - .tenantId(demands.get(0).getTenantId()).build(); - List existingDemands = getDemands(demandCriteria); - - log.debug("repository demands "+existingDemands); - Map existingDemandMap = existingDemands.stream().collect( - Collectors.toMap(Demand::getId, Demand::getId)); - Map existingDemandDetailMap = new HashMap<>(); - for (Demand demand : existingDemands) { - for (DemandDetail demandDetail : demand.getDemandDetails()) - existingDemandDetailMap.put(demandDetail.getId(), demandDetail.getId()); - } - - for (Demand demand : demands) { - if (existingDemandMap.get(demand.getId()) == null) - newDemands.add(demand); - else - oldDemands.add(demand); - for (DemandDetail demandDetail : demand.getDemandDetails()) { - if (existingDemandDetailMap.get(demandDetail.getId()) == null) - newDemandDetails.add(demandDetail); - else - oldDemandDetails.add(demandDetail); - } - } - - updateBatch(oldDemands, oldDemandDetails); - insertBatchForAudit(oldDemands, oldDemandDetails); - - if (!newDemands.isEmpty() || !newDemandDetails.isEmpty()) { - - insertBatch(newDemands, newDemandDetails); - insertBatchForAudit(newDemands, newDemandDetails); - } - - if (null != paymentBackUpdateAudit) - insertBackUpdateForPayment(paymentBackUpdateAudit); - } - - public void insertBatch(List newDemands, List newDemandDetails) { - - String sqlDemand; - try { - sqlDemand = centralInstanceUtil.replaceSchemaPlaceholder(DemandQueryBuilder.DEMAND_INSERT_QUERY, newDemandDetails.get(0).getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - jdbcTemplate.batchUpdate(sqlDemand, new BatchPreparedStatementSetter() { - @Override - public void setValues(PreparedStatement ps, int rowNum) throws SQLException { - - Demand demand = newDemands.get(rowNum); - String status = demand.getStatus() != null ? demand.getStatus().toString() : null; - AuditDetails auditDetail = demand.getAuditDetails(); - String payerUuid = null != demand.getPayer() ? demand.getPayer().getUuid() : null; - ps.setString(1, demand.getId()); - ps.setString(2, demand.getConsumerCode()); - ps.setString(3, demand.getConsumerType()); - ps.setString(4, demand.getBusinessService()); - ps.setString(5, payerUuid); - ps.setLong(6, demand.getTaxPeriodFrom()); - ps.setLong(7, demand.getTaxPeriodTo()); - ps.setBigDecimal(8, demand.getMinimumAmountPayable()); - ps.setString(9, auditDetail.getCreatedBy()); - ps.setString(10, auditDetail.getLastModifiedBy()); - ps.setLong(11, auditDetail.getCreatedTime()); - ps.setLong(12, auditDetail.getLastModifiedTime()); - ps.setString(13, demand.getTenantId()); - ps.setString(14, status); - ps.setObject(15, util.getPGObject(demand.getAdditionalDetails())); - ps.setObject(16, demand.getBillExpiryTime()); - ps.setObject(17, null); - } - - @Override - public int getBatchSize() { - return newDemands.size(); - } - }); - - String sqlDemandDetail; - try { - sqlDemandDetail = centralInstanceUtil.replaceSchemaPlaceholder(DemandQueryBuilder.DEMAND_DETAIL_INSERT_QUERY, newDemandDetails.get(0).getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - jdbcTemplate.batchUpdate(sqlDemandDetail, new BatchPreparedStatementSetter() { - @Override - public void setValues(PreparedStatement ps, int rowNum) throws SQLException { - - DemandDetail demandDetail = newDemandDetails.get(rowNum); - AuditDetails auditDetail = demandDetail.getAuditDetails(); - ps.setString(1, demandDetail.getId()); - ps.setString(2, demandDetail.getDemandId()); - ps.setString(3, demandDetail.getTaxHeadMasterCode()); - ps.setBigDecimal(4, demandDetail.getTaxAmount()); - ps.setBigDecimal(5, demandDetail.getCollectionAmount()); - ps.setString(6, auditDetail.getCreatedBy()); - ps.setString(7, auditDetail.getLastModifiedBy()); - ps.setLong(8, auditDetail.getCreatedTime()); - ps.setLong(9, auditDetail.getLastModifiedTime()); - ps.setString(10, demandDetail.getTenantId()); - ps.setObject(11, util.getPGObject(demandDetail.getAdditionalDetails())); - } - - @Override - public int getBatchSize() { - return newDemandDetails.size(); - } - }); - } - - public void updateBatch(List oldDemands, List oldDemandDetails) { - - String sqlDemandUpdate; - try { - sqlDemandUpdate = centralInstanceUtil.replaceSchemaPlaceholder(DemandQueryBuilder.DEMAND_UPDATE_QUERY, - oldDemandDetails.get(0).getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - jdbcTemplate.batchUpdate(sqlDemandUpdate, new BatchPreparedStatementSetter(){ - - @Override - public void setValues(PreparedStatement ps, int rowNum) throws SQLException { - Demand demand = oldDemands.get(rowNum); - - String status = demand.getStatus() != null ? demand.getStatus().toString() : null; - String payerUuid = null != demand.getPayer() ? demand.getPayer().getUuid() : null; - AuditDetails auditDetail = demand.getAuditDetails(); - - ps.setString(1, payerUuid); - ps.setLong(2, demand.getTaxPeriodFrom()); - ps.setLong(3, demand.getTaxPeriodTo()); - ps.setBigDecimal(4, demand.getMinimumAmountPayable()); - ps.setString(5, auditDetail.getLastModifiedBy()); - ps.setLong(6, auditDetail.getLastModifiedTime()); - ps.setString(7, demand.getTenantId()); - ps.setString(8, status); - ps.setObject(9, util.getPGObject(demand.getAdditionalDetails())); - ps.setObject(10, demand.getBillExpiryTime()); - ps.setBoolean(11, demand.getIsPaymentCompleted()); - ps.setObject(12, null); - ps.setString(13, demand.getId()); - ps.setString(14, demand.getTenantId()); - - } - - @Override - public int getBatchSize() { - return oldDemands.size(); - } - }); - - String sqlDemandDetailUpdate; - try { - sqlDemandDetailUpdate = centralInstanceUtil.replaceSchemaPlaceholder( - DemandQueryBuilder.DEMAND_DETAIL_UPDATE_QUERY, oldDemandDetails.get(0).getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - jdbcTemplate.batchUpdate(sqlDemandDetailUpdate, new BatchPreparedStatementSetter() { - - @Override - public void setValues(PreparedStatement ps, int rowNum) throws SQLException { - DemandDetail demandDetail = oldDemandDetails.get(rowNum); - AuditDetails auditDetail = demandDetail.getAuditDetails(); - - ps.setBigDecimal(1, demandDetail.getTaxAmount()); - ps.setBigDecimal(2, demandDetail.getCollectionAmount()); - ps.setString(3, auditDetail.getLastModifiedBy()); - ps.setLong(4, auditDetail.getLastModifiedTime()); - ps.setObject(5, util.getPGObject(demandDetail.getAdditionalDetails())); - ps.setString(6, demandDetail.getId()); - ps.setString(7, demandDetail.getDemandId()); - ps.setString(8, demandDetail.getTenantId()); - } - - @Override - public int getBatchSize() { - return oldDemandDetails.size(); - } - }); - } - - - /* - * Audit - */ - - @Transactional - public void insertBatchForAudit(List demands, List demandDetails) { - - String sqlDemandAudit; - try { - sqlDemandAudit = centralInstanceUtil.replaceSchemaPlaceholder(DemandQueryBuilder.DEMAND_AUDIT_INSERT_QUERY, - demandDetails.get(0).getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - jdbcTemplate.batchUpdate(sqlDemandAudit, new BatchPreparedStatementSetter(){ - - @Override - public void setValues(PreparedStatement ps, int rowNum) throws SQLException { - - Demand demand = demands.get(rowNum); - String status = demand.getStatus() != null ? demand.getStatus().toString() : null; - AuditDetails auditDetail = demand.getAuditDetails(); - String payerUuid = null != demand.getPayer() ? demand.getPayer().getUuid() : null; - ps.setString(1, demand.getId()); - ps.setString(2, demand.getConsumerCode()); - ps.setString(3, demand.getConsumerType()); - ps.setString(4, demand.getBusinessService()); - ps.setString(5, payerUuid); - ps.setLong(6, demand.getTaxPeriodFrom()); - ps.setLong(7, demand.getTaxPeriodTo()); - ps.setBigDecimal(8, demand.getMinimumAmountPayable()); - ps.setString(9, auditDetail.getLastModifiedBy()); - ps.setLong(10, auditDetail.getLastModifiedTime()); - ps.setString(11, demand.getTenantId()); - ps.setString(12, status); - ps.setObject(13, util.getPGObject(demand.getAdditionalDetails())); - ps.setString(14, UUID.randomUUID().toString()); - ps.setObject(15, demand.getBillExpiryTime()); - ps.setBoolean(16,demand.getIsPaymentCompleted()); - } - - @Override - public int getBatchSize() { - return demands.size(); - } - }); - - String sqlDemandDetailAudit; - try { - sqlDemandDetailAudit = centralInstanceUtil.replaceSchemaPlaceholder( - DemandQueryBuilder.DEMAND_DETAIL_AUDIT_INSERT_QUERY, demandDetails.get(0).getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - jdbcTemplate.batchUpdate(sqlDemandDetailAudit, - new BatchPreparedStatementSetter() { - @Override - public void setValues(PreparedStatement ps, int rowNum) throws SQLException { - - DemandDetail demandDetail = demandDetails.get(rowNum); - AuditDetails auditDetail = demandDetail.getAuditDetails(); - ps.setString(1, demandDetail.getId()); - ps.setString(2, demandDetail.getDemandId()); - ps.setString(3, demandDetail.getTaxHeadMasterCode()); - ps.setBigDecimal(4, demandDetail.getTaxAmount()); - ps.setBigDecimal(5, demandDetail.getCollectionAmount()); - ps.setString(6, auditDetail.getLastModifiedBy()); - ps.setLong(7, auditDetail.getLastModifiedTime()); - ps.setString(8, demandDetail.getTenantId()); - ps.setObject(9, util.getPGObject(demandDetail.getAdditionalDetails())); - ps.setString(10, UUID.randomUUID().toString()); - } - - @Override - public int getBatchSize() { - return demandDetails.size(); - } - }); - } - - /** - * Persists back-update log from collection - * - * in case of failure or success - * - * @param paymentBackUpdateAudit - */ - public void insertBackUpdateForPayment(PaymentBackUpdateAudit paymentBackUpdateAudit) { - - String paymentBackUpdateQuery; - try { - paymentBackUpdateQuery = centralInstanceUtil.replaceSchemaPlaceholder( - DemandQueryBuilder.PAYMENT_BACKUPDATE_AUDIT_INSERT_QUERY, paymentBackUpdateAudit.getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - jdbcTemplate.update(paymentBackUpdateQuery, new PreparedStatementSetter() { - - @Override - public void setValues(PreparedStatement ps) throws SQLException { - - ps.setString(1, paymentBackUpdateAudit.getPaymentId()); - ps.setBoolean(2, paymentBackUpdateAudit.getIsBackUpdateSucces()); - ps.setBoolean(3, paymentBackUpdateAudit.getIsReceiptCancellation()); - ps.setString(4, paymentBackUpdateAudit.getErrorMessage()); - } - }); - } - - public String searchPaymentBackUpdateAudit(PaymentBackUpdateAudit backUpdateAudit) { - - String paymentId = null; - Object[] preparedStatementValues = new Object[] { - - backUpdateAudit.getPaymentId(), - backUpdateAudit.getIsBackUpdateSucces(), - backUpdateAudit.getIsReceiptCancellation() }; - - String query; - try { - query = centralInstanceUtil.replaceSchemaPlaceholder( - DemandQueryBuilder.PAYMENT_BACKUPDATE_AUDIT_SEARCH_QUERY, backUpdateAudit.getTenantId()); - } catch (InvalidTenantIdException e) { - throw new CustomException("EG_BS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - try { - paymentId = jdbcTemplate.queryForObject(query, preparedStatementValues, String.class); - } catch (DataAccessException e) { - log.info("No data found for incoming receipt in backupdate log"); - } - - return paymentId; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/IdGenRepo.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/IdGenRepo.java deleted file mode 100644 index f29a2f18ad2..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/IdGenRepo.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.egov.demand.repository; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.IdGenerationRequest; -import org.egov.demand.model.IdGenerationResponse; -import org.egov.demand.model.IdRequest; -import org.egov.demand.model.IdResponse; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.util.UriComponentsBuilder; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class IdGenRepo { - - @Autowired - private ApplicationProperties appProps; - - @Autowired - private RestTemplate rest; - - public List getId(RequestInfo requestInfo, String tenantId, String name, String format, int count) { - - List reqList = new ArrayList<>(); - for (int i = 0; i < count; i++) { - reqList.add(IdRequest.builder().idName(name).format(format).tenantId(tenantId).build()); - } - - IdGenerationRequest req = IdGenerationRequest.builder().requestInfo(requestInfo).idRequests(reqList).build(); - - String uri = UriComponentsBuilder.fromHttpUrl(appProps.getIdGenHost()).path(appProps.getIdGenUrl()).build() - .toUriString(); - try { - IdGenerationResponse idGenerationResponse = rest.postForObject(uri, req, IdGenerationResponse.class); - return idGenerationResponse.getIdResponses().stream().map(IdResponse::getId).collect(Collectors.toList()); - } catch (HttpClientErrorException e) { - log.error("ID Gen Service failure ", e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - log.error("ID Gen Service failure", e); - throw new org.egov.tracer.model.CustomException("IDGEN_SERVICE_ERROR", - "Failed to generate ID, unknown error occurred"); - } - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/PayerRepository.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/PayerRepository.java deleted file mode 100644 index c8a5deb3346..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/PayerRepository.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.egov.demand.repository; - -import java.io.IOException; -import java.util.List; - -import org.egov.common.contract.response.ErrorResponse; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.web.contract.User; -import org.egov.demand.web.contract.UserResponse; -import org.egov.demand.web.contract.UserSearchRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -@Deprecated -public class PayerRepository { - - private static final Logger logger = LoggerFactory.getLogger(PayerRepository.class); - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - private ObjectMapper objectMapper; - - public List getPayers(UserSearchRequest userSearchRequest) { - - - String url = applicationProperties.getUserServiceHostName() + applicationProperties.getUserServiceSearchPath(); - UserResponse userResponse = null; - try { - logger.info("OwnerRepository URL ---->> "+url+" \n userSearchRequest ---->> "+userSearchRequest); - userResponse = restTemplate.postForObject(url, userSearchRequest, UserResponse.class); - } catch (HttpClientErrorException e) { - String errorResponseBody = e.getResponseBodyAsString(); - log.error("Following exception occurred: " + e.getResponseBodyAsString()); - ErrorResponse userErrorResponse = null; - try { - userErrorResponse = objectMapper.readValue(errorResponseBody, ErrorResponse.class); - } catch (JsonMappingException jme) { - log.error("Following Exception Occurred While Mapping JSON Response From User Service : " - + jme.getMessage()); - throw new RuntimeException(jme); - } catch (JsonProcessingException jpe) { - log.error("Following Exception Occurred While Processing JSON Response From User Service : " - + jpe.getMessage()); - throw new RuntimeException(jpe); - } catch (IOException ioe) { - log.error("Following Exception Occurred Calling User Service : " + ioe.getMessage()); - throw new RuntimeException(ioe); - } - log.debug("the exception from user module inside first catch block ::"+userErrorResponse.getError().toString()); - throw new RuntimeException(e); - } catch (Exception e) { - log.error("Following Exception Occurred While Calling User Service : " + e.getMessage()); - throw new RuntimeException(e); - } - - return userResponse.getUser(); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/ServiceRequestRepository.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/ServiceRequestRepository.java deleted file mode 100644 index 0a1081d526d..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/ServiceRequestRepository.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.egov.demand.repository; - -import java.util.Map; - -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -import lombok.extern.slf4j.Slf4j; - -/** - * - * @author kavi elrey - * - * Generic Repository to make a rest call and return JSON response - */ -@Repository -@Slf4j -public class ServiceRequestRepository { - - @Autowired - private ObjectMapper mapper; - - @Autowired - private RestTemplate restTemplate; - - - /** - * fetch method which takes the URI and request object - * and returns response in generic format - * @param uri - * @param request - * @return - */ - @SuppressWarnings("rawtypes") - public Map fetchResult(String uri, Object request) { - - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - Map response = null; - log.info("URI: "+ uri); - - try { - log.info("Request: "+mapper.writeValueAsString(request)); - response = restTemplate.postForObject(uri, request, Map.class); - }catch(HttpClientErrorException e) { - log.error("External Service threw an Exception: ",e.getResponseBodyAsString()); - throw new ServiceCallException(e.getResponseBodyAsString()); - }catch(JsonProcessingException e) { - log.error("Exception while searching user data : ",e); - } - - return response; - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/TaxHeadMasterRepository.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/TaxHeadMasterRepository.java deleted file mode 100644 index 8252ed4c152..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/TaxHeadMasterRepository.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.egov.demand.repository; - -import static org.egov.demand.util.Constants.MDMS_NO_FILTER_TAXHEADMASTER; -import static org.egov.demand.util.Constants.MODULE_NAME; -import static org.egov.demand.util.Constants.TAXHEADMASTER_CATEGORY_FILTER; -import static org.egov.demand.util.Constants.TAXHEADMASTER_CODES_FILTER; -import static org.egov.demand.util.Constants.TAXHEADMASTER_EXPRESSION; -import static org.egov.demand.util.Constants.TAXHEADMASTER_IDS_FILTER; -import static org.egov.demand.util.Constants.TAXHEADMASTER_ISACTUALAMOUNT_FILTER; -import static org.egov.demand.util.Constants.TAXHEADMASTER_ISDEBIT_FILTER; -import static org.egov.demand.util.Constants.TAXHEADMASTER_NAME_FILTER; -import static org.egov.demand.util.Constants.TAXHEADMASTER_SERVICE_FILTER; -import static org.egov.demand.util.Constants.TAXHEAD_MASTERNAME; - -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.TaxHeadMaster; -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.egov.demand.util.Util; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -@Repository -public class TaxHeadMasterRepository { - - @Autowired - private Util util; - - @Autowired - private ObjectMapper mapper; - - /** - * Fetches the taxHeadMaster based on search criteria - * - * @param requestInfo The requestInfo of the search request - * @param taxHeadMasterCriteria The search criteria for taxHeads - * @return List of taxHeads - */ - public List getTaxHeadMaster(RequestInfo requestInfo, TaxHeadMasterCriteria taxHeadMasterCriteria) { - - String filter = null; - if (null != taxHeadMasterCriteria.getService()) - filter = TAXHEADMASTER_SERVICE_FILTER.replace("{}", taxHeadMasterCriteria.getService()); - - MdmsCriteriaReq mdmsCriteriaReq = util.prepareMdMsRequest(taxHeadMasterCriteria.getTenantId(), MODULE_NAME, - Collections.singletonList(TAXHEAD_MASTERNAME), filter, requestInfo); - - DocumentContext documentContext = util.getAttributeValues(mdmsCriteriaReq); - - StringBuilder filterExpression = new StringBuilder(); - - if (taxHeadMasterCriteria.getName() != null) { - filterExpression.append(TAXHEADMASTER_NAME_FILTER.replace("VAL", taxHeadMasterCriteria.getName())); - } - - if (taxHeadMasterCriteria.getId() != null && !taxHeadMasterCriteria.getId().isEmpty()) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression - .append(TAXHEADMASTER_IDS_FILTER.replace("VAL", util.getStringVal(taxHeadMasterCriteria.getId()))); - } - if (!CollectionUtils.isEmpty(taxHeadMasterCriteria.getCode())) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression.append( - TAXHEADMASTER_CODES_FILTER.replace("VAL", util.getStringVal(taxHeadMasterCriteria.getCode()))); - } - - if (!StringUtils.isEmpty(taxHeadMasterCriteria.getCategory())) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression.append(TAXHEADMASTER_CATEGORY_FILTER.replace("VAL", taxHeadMasterCriteria.getCategory())); - } - - if (taxHeadMasterCriteria.getIsActualDemand() != null) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression.append(TAXHEADMASTER_ISACTUALAMOUNT_FILTER.replace("VAL", - taxHeadMasterCriteria.getIsActualDemand().toString())); - } - - if (taxHeadMasterCriteria.getIsDebit() != null) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression - .append(TAXHEADMASTER_ISDEBIT_FILTER.replace("VAL", taxHeadMasterCriteria.getIsDebit().toString())); - } - - String jsonPath; - if (filterExpression.length() != 0) - jsonPath = TAXHEADMASTER_EXPRESSION.replace("EXPRESSION", filterExpression.toString()); - else - jsonPath = MDMS_NO_FILTER_TAXHEADMASTER; - - return mapper.convertValue(documentContext.read(jsonPath), new TypeReference>() { - }); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/TaxPeriodRepository.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/TaxPeriodRepository.java deleted file mode 100644 index e8618c6701d..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/TaxPeriodRepository.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.repository; - -import static org.egov.demand.util.Constants.MDMS_NO_FILTER_TAXPERIOD; -import static org.egov.demand.util.Constants.MODULE_NAME; -import static org.egov.demand.util.Constants.TAXPERIOD_CODE_SEARCH_FILTER; -import static org.egov.demand.util.Constants.TAXPERIOD_DATE_FILTER; -import static org.egov.demand.util.Constants.TAXPERIOD_EXPRESSION; -import static org.egov.demand.util.Constants.TAXPERIOD_FROMDATE_FILTER; -import static org.egov.demand.util.Constants.TAXPERIOD_IDS_FILTER; -import static org.egov.demand.util.Constants.TAXPERIOD_MASTERNAME; -import static org.egov.demand.util.Constants.TAXPERIOD_PERIODCYCLE_FILTER; -import static org.egov.demand.util.Constants.TAXPERIOD_SERVICES_FILTER; -import static org.egov.demand.util.Constants.TAXPERIOD_TODATE_FILTER; - -import java.util.Collections; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.TaxPeriod; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.TaxPeriodCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -@Repository -public class TaxPeriodRepository { - - @Autowired - private Util util; - - @Autowired - private ObjectMapper mapper; - - /** - * Fetches the TaxPeriod based on search criteria - * - * @param requestInfo The requestInfo of the search request - * @param taxPeriodCriteria The search criteria for TaxPeriod - * @return List of TaxPeriod - */ - public List getTaxPeriod(RequestInfo requestInfo, TaxPeriodCriteria taxPeriodCriteria) { - - MdmsCriteriaReq mdmsCriteriaReq = util.prepareMdMsRequest(taxPeriodCriteria.getTenantId(), MODULE_NAME, - Collections.singletonList(TAXPERIOD_MASTERNAME), null, requestInfo); - - DocumentContext documentContext = util.getAttributeValues(mdmsCriteriaReq); - StringBuilder filterExpression = new StringBuilder(); - - if (taxPeriodCriteria.getCode() != null) { - filterExpression.append(TAXPERIOD_CODE_SEARCH_FILTER.replace("VAL", taxPeriodCriteria.getCode())); - } - - if (taxPeriodCriteria.getId() != null && !taxPeriodCriteria.getId().isEmpty()) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression.append(TAXPERIOD_IDS_FILTER.replace("VAL", util.getStringVal(taxPeriodCriteria.getId()))); - } - if (!CollectionUtils.isEmpty(taxPeriodCriteria.getService())) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression.append( - TAXPERIOD_SERVICES_FILTER.replace("VAL", util.getStringVal(taxPeriodCriteria.getService()))); - } - - if (taxPeriodCriteria.getFromDate() != null) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression - .append(TAXPERIOD_FROMDATE_FILTER.replace("VAL", taxPeriodCriteria.getFromDate().toString())); - } - - if (taxPeriodCriteria.getToDate() != null) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression.append(TAXPERIOD_TODATE_FILTER.replace("VAL", taxPeriodCriteria.getToDate().toString())); - } - - if (taxPeriodCriteria.getDate() != null) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression.append(TAXPERIOD_DATE_FILTER.replace("VAL", taxPeriodCriteria.getDate().toString())); - } - - if (taxPeriodCriteria.getPeriodCycle() != null) { - if (filterExpression.length() != 0) - filterExpression.append(" && "); - filterExpression - .append(TAXPERIOD_PERIODCYCLE_FILTER.replace("VAL", taxPeriodCriteria.getPeriodCycle().toString())); - } - - String jsonPath; - if (filterExpression.length() != 0) - jsonPath = TAXPERIOD_EXPRESSION.replace("EXPRESSION", filterExpression.toString()); - else - jsonPath = MDMS_NO_FILTER_TAXPERIOD; - - return mapper.convertValue(documentContext.read(jsonPath), new TypeReference>() { - }); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/AmendmentQueryBuilder.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/AmendmentQueryBuilder.java deleted file mode 100644 index 921616a0fa8..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/AmendmentQueryBuilder.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.egov.demand.repository.querybuilder; - -import org.egov.demand.amendment.model.AmendmentCriteria; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -@Component -public class AmendmentQueryBuilder { - - public static final String AMENDMENT_UPDATE_QUERY = "UPDATE {schema}.egbs_amendment SET status=:status, amendeddemandid=:amendeddemandid," - + " lastmodifiedby=:lastmodifiedby,lastmodifiedtime=:lastmodifiedtime, additionaldetails=:additionaldetails " - + " WHERE tenantid=:tenantid AND amendmentid=:amendmentid;"; - - public static final String AMENDMENT_INSERT_QUERY = "INSERT INTO {schema}.egbs_amendment (id, tenantid, amendmentid, businessservice," - + " consumercode, amendmentreason, reasondocumentnumber, status, effectivetill, effectivefrom," - + " amendeddemandid, createdby, createdtime, lastmodifiedby, lastmodifiedtime, additionaldetails) " - + " VALUES (:id, :tenantid, :amendmentid, :businessservice, :consumercode, :amendmentreason, :reasondocumentnumber, :status," - + " :effectivetill, :effectivefrom, :amendeddemandid, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime, :additionaldetails);"; - - public static final String AMENDMENT_TAXDETAIL_INSERT_QUERY = "INSERT INTO {schema}.egbs_amendment_taxdetail(id, amendmentid, taxheadcode, taxamount)" - + " VALUES (:id, :amendmentid, :taxheadcode, :taxamount);"; - - public static final String DOCUMET_INSERT_QUERY = "INSERT INTO {schema}.egbs_document(id, amendmentid, documenttype, filestoreid, documentuid, status)" - + " VALUES (:id, :amendmentid, :documenttype, :filestoreid, :documentuid, :status);"; - - public static final String AMENDMENT_SEARCH_QUERY = "SELECT amendment.id as amendmentuuid, tenantid, amendment.amendmentid as amendmentid, businessservice," - + " consumercode, amendmentreason, reasondocumentnumber, amendment.status as amendmentstatus, effectivetill," - + " effectivefrom, amendeddemandid, createdby, createdtime, lastmodifiedby, lastmodifiedtime, additionaldetails," - + " amdl.id as detailid, amdl.amendmentid as detailamendmentid, taxheadcode, taxamount, doc.id as docid," - + " doc.amendmentid as docamendmentid, documentType, fileStoreid, documentuid, doc.status as docstatus " - + " FROM {schema}.egbs_amendment amendment " - + " INNER JOIN " - + " {schema}.egbs_amendment_taxdetail amdl ON amendment.id = amdl.amendmentid " - + " INNER JOIN {schema}.egbs_document doc ON amendment.id = doc.amendmentid WHERE "; - - - public String getSearchQuery(AmendmentCriteria amendmentCriteria, MapSqlParameterSource searchParamMap) { - - StringBuilder queryBuilder = new StringBuilder(AMENDMENT_SEARCH_QUERY); - - queryBuilder.append(" amendment.tenantid = :tenantid "); - searchParamMap.addValue("tenantid", amendmentCriteria.getTenantId()); - - if (!CollectionUtils.isEmpty(amendmentCriteria.getConsumerCode())) { - - addAndClause(queryBuilder); - queryBuilder.append(" consumercode IN (:consumercode)"); - searchParamMap.addValue("consumercode", amendmentCriteria.getConsumerCode()); - } - - if (amendmentCriteria.getBusinessService() != null) { - - addAndClause(queryBuilder); - queryBuilder.append(" businessservice= :businessservice"); - searchParamMap.addValue("businessservice", amendmentCriteria.getBusinessService()); - } - - if (amendmentCriteria.getAmendmentId() != null) { - - addAndClause(queryBuilder); - queryBuilder.append(" amendment.amendmentid=:amendmentid"); - searchParamMap.addValue("amendmentid", amendmentCriteria.getAmendmentId()); - } - - if (!CollectionUtils.isEmpty(amendmentCriteria.getStatus())) { - - addAndClause(queryBuilder); - queryBuilder.append(" amendment.status IN ( :status )"); - searchParamMap.addValue("status", amendmentCriteria.getStatus()); - } - - addPagingClause(queryBuilder, searchParamMap); - return queryBuilder.toString(); - } - - private static void addPagingClause(StringBuilder amendmentQueryBuilder, MapSqlParameterSource searchParamMap) { - - amendmentQueryBuilder.append(" LIMIT :limit "); - searchParamMap.addValue("limit", 500); - amendmentQueryBuilder.append(" OFFSET :offset"); - searchParamMap.addValue("offset", 0); - } - - private static boolean addAndClause(StringBuilder queryString) { - queryString.append(" AND "); - return true; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/BillQueryBuilder.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/BillQueryBuilder.java deleted file mode 100644 index f86ef4076f9..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/BillQueryBuilder.java +++ /dev/null @@ -1,221 +0,0 @@ -package org.egov.demand.repository.querybuilder; - -import java.util.Collection; -import java.util.List; - -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.BillV2.BillStatus; -import org.egov.demand.model.UpdateBillCriteria; -import org.egov.demand.util.Util; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -@Component -public class BillQueryBuilder { - - @Autowired - MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - private ApplicationProperties configs; - - @Autowired - private Util util; - - public static final String REPLACE_STRING = "{replace}"; - - public static final String BILL_STATUS_UPDATE_BASE_QUERY = "UPDATE {schema}.egbs_bill_v1 SET status=? {replace} WHERE status='ACTIVE' AND tenantId = ? "; - - public static final String INSERT_BILL_QUERY = "INSERT into {schema}.egbs_bill_v1 " - +"(id, tenantid, payername, payeraddress, payeremail, isactive, iscancelled, createdby, createddate, lastmodifiedby, lastmodifieddate, mobilenumber, status, additionaldetails,payerid, consumercode)" - +"values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - - public static final String INSERT_BILLDETAILS_QUERY = "INSERT into {schema}.egbs_billdetail_v1 " - +"(id, tenantid, billid, demandid, fromperiod, toperiod, businessservice, billno, billdate, consumercode, consumertype, billdescription, displaymessage, " - + "minimumamount, totalamount, callbackforapportioning, partpaymentallowed, collectionmodesnotallowed, " - + "createdby, createddate, lastmodifiedby, lastmodifieddate, isadvanceallowed, expirydate,additionaldetails)" - +"values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - - public static final String INSERT_BILLACCOUNTDETAILS_QUERY = "INSERT into {schema}.egbs_billaccountdetail_v1 " - +"(id, tenantid, billdetail, demanddetailid, orderno, amount, adjustedamount, isactualdemand, purpose, " - + "createdby, createddate, lastmodifiedby, lastmodifieddate, taxheadcode)" - +"values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - - - - public static final String BILL_MAX_QUERY = "WITH billresult AS ({replace}) SELECT * FROM billresult " - + " INNER JOIN (SELECT bd_consumercode, max(b_createddate) as maxdate FROM billresult GROUP BY bd_consumercode) as uniqbill" - + " ON uniqbill.bd_consumercode=billresult.bd_consumercode AND uniqbill.maxdate=billresult.b_createddate "; - - public static final String BILL_MIN_QUERY = "WITH billresult AS ({replace}) SELECT * FROM billresult " - + " INNER JOIN (SELECT bd_consumercode, min(b_createddate) as mindate FROM billresult GROUP BY bd_consumercode) as uniqbill" - + " ON uniqbill.bd_consumercode=billresult.bd_consumercode AND uniqbill.mindate=billresult.b_createddate "; - - public static final String BILL_BASE_QUERY = "SELECT b.id AS b_id,b.mobilenumber, b.tenantid AS b_tenantid,b.payerid AS b_payerid," - + " b.payername AS b_payername, b.payeraddress AS b_payeraddress, b.payeremail AS b_payeremail,b.filestoreid AS b_fileStoreId," - + " b.isactive AS b_isactive, b.iscancelled AS b_iscancelled, b.createdby AS b_createdby, b.status as b_status," - + " b.createddate AS b_createddate, b.lastmodifiedby AS b_lastmodifiedby, b.lastmodifieddate AS b_lastmodifieddate," - + " bd.id AS bd_id, bd.billid AS bd_billid, bd.tenantid AS bd_tenantid,bd.businessservice AS bd_businessservice," - + " bd.demandid,bd.fromperiod,bd.toperiod," - + " bd.billno AS bd_billno, bd.billdate AS bd_billdate, bd.consumercode AS bd_consumercode,bd.consumertype AS bd_consumertype," - + " bd.billdescription AS bd_billdescription, bd.displaymessage AS bd_displaymessage, bd.minimumamount AS bd_minimumamount," - + " bd.totalamount AS bd_totalamount, bd.callbackforapportioning AS bd_callbackforapportioning,bd.expirydate AS bd_expirydate," - + " bd.partpaymentallowed AS bd_partpaymentallowed, bd.isadvanceallowed as bd_isadvanceallowed,bd.collectionmodesnotallowed AS bd_collectionmodesnotallowed," - + " ad.id AS ad_id, ad.tenantid AS ad_tenantid, ad.billdetail AS ad_billdetail, ad.glcode AS ad_glcode," - + " ad.orderno AS ad_orderno, ad.accountdescription AS ad_accountdescription," - + " ad.amount AS ad_amount, ad.adjustedamount AS ad_adjustedamount, ad.taxheadcode AS ad_taxheadcode, ad.demanddetailid," - + " ad.isactualdemand AS ad_isactualdemand, ad.purpose AS ad_purpose," - + " b.additionaldetails as b_additionaldetails, bd.additionaldetails as bd_additionaldetails " - + " FROM {schema}.egbs_bill_v1 b" - + " LEFT OUTER JOIN {schema}.egbs_billdetail_v1 bd ON b.id = bd.billid AND b.tenantid = bd.tenantid" - + " LEFT OUTER JOIN {schema}.egbs_billaccountdetail_v1 ad ON bd.id = ad.billdetail AND bd.tenantid = ad.tenantid"; - - public String getBillQuery(BillSearchCriteria billSearchCriteria, List preparedStatementValues){ - - StringBuilder billQuery = new StringBuilder(BILL_BASE_QUERY); - String tenantId = billSearchCriteria.getTenantId(); - - if (centralInstanceUtil.isTenantIdStateLevel(tenantId)) { - billQuery.append(" WHERE b.tenantid LIKE ? "); - preparedStatementValues.add(billSearchCriteria.getTenantId() + '%'); - } else { - billQuery.append(" WHERE b.tenantid = ? "); - preparedStatementValues.add(billSearchCriteria.getTenantId()); - } - - addWhereClause(billQuery, preparedStatementValues, billSearchCriteria); - StringBuilder maxQuery = addPagingClause(billQuery, preparedStatementValues, billSearchCriteria); - - return maxQuery.toString(); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private void addWhereClause(final StringBuilder selectQuery, final List preparedStatementValues, - final BillSearchCriteria searchBill) { - - if(!CollectionUtils.isEmpty(searchBill.getBillId())){ - selectQuery.append(" AND b.id in ("); - appendListToQuery(searchBill.getBillId(), preparedStatementValues, selectQuery); - } - - if (!searchBill.getRetrieveOldest()) { - if (searchBill.getStatus() != null) { - selectQuery.append(" AND b.status = ?"); - preparedStatementValues.add(searchBill.getStatus().toString()); - } - } else { - selectQuery.append(" AND b.status != ?"); - preparedStatementValues.add(BillStatus.CANCELLED.toString()); - } - - if (searchBill.getEmail() != null) { - selectQuery.append(" AND b.payeremail = ?"); - preparedStatementValues.add(searchBill.getEmail()); - } - - if (searchBill.getMobileNumber()!= null) { - selectQuery.append(" AND b.mobileNumber = ?"); - preparedStatementValues.add(searchBill.getMobileNumber()); - } - - if (searchBill.getService() != null) { - selectQuery.append(" AND bd.businessservice = ?"); - preparedStatementValues.add(searchBill.getService()); - } - - if (searchBill.getFromPeriod() != null) { - selectQuery.append(" AND bd.fromperiod = ?"); - preparedStatementValues.add(searchBill.getFromPeriod()); - } - - if (searchBill.getToPeriod() != null) { - selectQuery.append(" AND bd.toperiod = ?"); - preparedStatementValues.add(searchBill.getToPeriod()); - } - - if (searchBill.getBillNumber() != null) { - selectQuery.append(" AND bd.billno = ?"); - preparedStatementValues.add(searchBill.getBillNumber()); - } - - if (!CollectionUtils.isEmpty(searchBill.getConsumerCode())) { - selectQuery.append(" AND bd.consumercode IN ("); - appendListToQuery(searchBill.getConsumerCode(), preparedStatementValues, selectQuery); - } - } - - @SuppressWarnings({"rawtypes" }) - private StringBuilder addPagingClause(final StringBuilder selectQuery, final List preparedStatementValues, - final BillSearchCriteria searchBillCriteria) { - - StringBuilder finalQuery; - - if (searchBillCriteria.getRetrieveOldest()) - finalQuery = new StringBuilder(BILL_MIN_QUERY.replace(REPLACE_STRING, selectQuery)); - else - finalQuery = new StringBuilder(BILL_MAX_QUERY.replace(REPLACE_STRING, selectQuery)); - - if (searchBillCriteria.isOrderBy()) { - finalQuery.append(" ORDER BY billresult.bd_consumercode "); - } - - return finalQuery; - } - - /** - * Bill expire query builder - * - * @param billIds - * @param preparedStmtList - */ - public String getBillStatusUpdateQuery(UpdateBillCriteria updateBillCriteria, List preparedStmtList) { - - String additionalDetailsQuery = ", additionaldetails = ?"; - StringBuilder builder = new StringBuilder(); - - preparedStmtList.add(updateBillCriteria.getStatusToBeUpdated().toString()); - - if (updateBillCriteria.getStatusToBeUpdated().equals(BillStatus.CANCELLED) - && updateBillCriteria.getAdditionalDetails() != null) { - - builder.append(BILL_STATUS_UPDATE_BASE_QUERY.replace(REPLACE_STRING, additionalDetailsQuery)); - preparedStmtList.add(util.getPGObject(updateBillCriteria.getAdditionalDetails())); - } else - builder.append(BILL_STATUS_UPDATE_BASE_QUERY.replace(REPLACE_STRING, "")); - - /* - * where condition parameters - */ - preparedStmtList.add(updateBillCriteria.getTenantId()); - - if (!CollectionUtils.isEmpty(updateBillCriteria.getBillIds())) { - - builder.append(" AND id IN ( "); - appendListToQuery(updateBillCriteria.getBillIds(), preparedStmtList, builder); - } - - - return builder.toString(); - } - - /** - * @param billIds - * @param preparedStmtList - * @param query - */ - private void appendListToQuery(Collection values, List preparedStmtList, StringBuilder query) { - int length = values.size(); - String[] valueArray = values.toArray(new String[length]); - - for (int i = 0; i < length; i++) { - query.append(" ?"); - if (i != length - 1) - query.append(","); - preparedStmtList.add(valueArray[i]); - } - query.append(")"); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/BusinessServDetailQueryBuilder.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/BusinessServDetailQueryBuilder.java deleted file mode 100644 index cb5b40ba468..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/BusinessServDetailQueryBuilder.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.repository.querybuilder; - -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import java.util.List; -import java.util.Set; - -@Component -@Slf4j -public class BusinessServDetailQueryBuilder { - - private static final String BASE_QUERY = "SELECT * FROM {schema}.EGBS_BUSINESS_SERVICE_DETAILS businessservice "; - - public String prepareSearchQuery(final BusinessServiceDetailCriteria businessServiceDetailCriteria, final List preparedStatementValues) { - final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); - log.debug("prepareSearchQuery --> "); - prepareWhereClause(selectQuery, preparedStatementValues, businessServiceDetailCriteria); - log.debug("Search business service details query from BusinessServDetailQueryBuilder -> " + selectQuery); - return selectQuery.toString(); - } - - private void prepareWhereClause(final StringBuilder selectQuery, final List preparedStatementValues, - final BusinessServiceDetailCriteria businessServiceDetailCriteria) { - - selectQuery.append(" WHERE "); - - if (StringUtils.isNotBlank(businessServiceDetailCriteria.getTenantId())) { - selectQuery.append(" businessservice.tenantId = ? "); - preparedStatementValues.add(businessServiceDetailCriteria.getTenantId()); - } - - if (!CollectionUtils.isEmpty(businessServiceDetailCriteria.getBusinessService())) - selectQuery.append(" and businessservice.businessservice IN " + - getQueryForCollection(businessServiceDetailCriteria.getBusinessService())); - - if (businessServiceDetailCriteria.getId() != null && !businessServiceDetailCriteria.getId().isEmpty()) - selectQuery.append(" and businessservice.id IN " + getQueryForCollection(businessServiceDetailCriteria.getId())); - - } - - public String prepareQueryForValidation(List businessServiceDetailList, String mode) { - String baseQuery = "select exists (SELECT * FROM {schema}.EGBS_BUSINESS_SERVICE_DETAILS businessservice where "; - StringBuilder whereClause = new StringBuilder(); - int count = 0; - for (BusinessServiceDetail businessServiceDetail : businessServiceDetailList) { - whereClause = whereClause.append(" ( "); - if (StringUtils.isNotBlank(businessServiceDetail.getBusinessService())) - whereClause = whereClause.append("businessservice.businessservice = '").append(businessServiceDetail.getBusinessService()).append("' and "); - if ("edit".equalsIgnoreCase(mode)) - whereClause = whereClause.append(" businessservice.id != '").append(businessServiceDetail.getId()).append("' and "); - if (StringUtils.isNotBlank(businessServiceDetail.getTenantId())) - whereClause = whereClause.append(" businessservice.tenantId = '").append(businessServiceDetail.getTenantId()).append("')"); - - count++; - if (businessServiceDetailList.size() > count) - whereClause = whereClause.append(" or "); - } - return baseQuery.concat(whereClause.toString()).concat(" )"); - } - - public String getInsertQuery() { - return "INSERT INTO {schema}.EGBS_BUSINESS_SERVICE_DETAILS(id,businessservice,collectionModesNotAllowed,partPaymentAllowed,callBackForApportioning," + - "callBackApportionURL,createddate,lastmodifieddate,createdby,lastmodifiedby,tenantid) " + - "values (?,?,?,?,?,?,?,?,?,?,?);"; - } - - public String getUpdateQuery() { - return "UPDATE {schema}.EGBS_BUSINESS_SERVICE_DETAILS SET businessservice = ?, collectionModesNotAllowed = ?, partPaymentAllowed = ?, " + - "callBackForApportioning = ?, callBackApportionURL = ?, lastmodifieddate = ?, lastmodifiedby = ? " + - "WHERE tenantid = ? and id = ?;"; - } - - private String getQueryForCollection(Set values) { - StringBuilder query = new StringBuilder(); - if (!values.isEmpty()) { - String[] list = values.toArray(new String[values.size()]); - query.append(" ('" + list[0] + "'"); - for (int i = 1; i < values.size(); i++) - query.append("," + "'" + list[i] + "'"); - } - return query.append(")").toString(); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/DemandQueryBuilder.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/DemandQueryBuilder.java deleted file mode 100644 index 2bae947e089..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/DemandQueryBuilder.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.repository.querybuilder; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.demand.model.DemandCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Component -public class DemandQueryBuilder { - - @Autowired - private MultiStateInstanceUtil centralInstaceUtil; - - - public static final String PAYMENT_BACKUPDATE_AUDIT_INSERT_QUERY = "INSERT INTO {schema}.egbs_payment_backupdate_audit (paymentid, isbackupdatesuccess, isreceiptcancellation, errorMessage)" - + " VALUES (?,?,?,?);"; - - public static final String PAYMENT_BACKUPDATE_AUDIT_SEARCH_QUERY = "SELECT paymentid FROM {schema}.egbs_payment_backupdate_audit where paymentid=? AND isbackupdatesuccess=? AND isreceiptcancellation=?;"; - - public static final String BASE_DEMAND_QUERY = "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode," - + "dmd.consumertype AS dconsumertype,dmd.businessservice AS dbusinessservice,dmd.payer," - + "dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as dfixedBillExpiryDate, " - + "dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto," - + "dmd.minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby," - + "dmd.lastmodifiedby AS dlastmodifiedby,dmd.createdtime AS dcreatedtime," - + "dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid AS dtenantid,dmd.status," - + "dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as ispaymentcompleted," - - + "dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode," - + "dmdl.taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount," - + "dmdl.createdby AS dlcreatedby,dmdl.lastModifiedby AS dllastModifiedby," - + "dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS dllastModifiedtime," - + "dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails " + "FROM {schema}.egbs_demand_v1 dmd " - + "INNER JOIN {schema}.egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid " + "AND dmd.tenantid=dmdl.tenantid WHERE "; - - public static final String BASE_DEMAND_DETAIL_QUERY = "SELECT " - + "demanddetail.id AS dlid,demanddetail.demandid AS dldemandid,demanddetail.taxheadcode AS dltaxheadcode," - + "demanddetail.taxamount AS dltaxamount,demanddetail.collectionamount AS dlcollectionamount," - + "demanddetail.createdby AS dlcreatedby,demanddetail.lastModifiedby AS dllastModifiedby," - + "demanddetail.createdtime AS dlcreatedtime,demanddetail.lastModifiedtime AS dllastModifiedtime," - + "demanddetail.tenantid AS dltenantid " + " FROM {schema}.egbs_demanddetail_v1 demanddetail " - + "INNER JOIN {schema}.egbs_demand demand ON demanddetail.demandid=demand.id AND " - + "demanddetail.tenantid=demand.tenantid WHERE "; - - public static final String DEMAND_QUERY_ORDER_BY_CLAUSE = "dmd.taxperiodfrom"; - - public static final String BASE_DEMAND_DETAIL_QUERY_ORDER_BY_CLAUSE = "dmdl.id"; - - public static final String DEMAND_INSERT_QUERY = "INSERT INTO {schema}.egbs_demand_v1 " - + "(id,consumerCode,consumerType,businessService,payer,taxPeriodFrom,taxPeriodTo," - + "minimumAmountPayable,createdby,lastModifiedby,createdtime,lastModifiedtime,tenantid, status, additionaldetails, billexpirytime, fixedBillExpiryDate) " - + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"; - - public static final String DEMAND_DETAIL_INSERT_QUERY = "INSERT INTO {schema}.egbs_demanddetail_v1 " - + "(id,demandid,taxHeadCode,taxamount,collectionamount," - + "createdby,lastModifiedby,createdtime,lastModifiedtime,tenantid,additionaldetails)" - + " VALUES (?,?,?,?,?,?,?,?,?,?,?);"; - - public static final String DEMAND_UPDATE_QUERY = "UPDATE {schema}.egbs_demand_v1 SET " + "payer=?,taxPeriodFrom=?," - + "taxPeriodTo=?,minimumAmountPayable=?,lastModifiedby=?," + "lastModifiedtime=?,tenantid=?," - + " status=?,additionaldetails=?,billexpirytime=?,ispaymentcompleted=?, fixedBillExpiryDate=? WHERE id=? AND tenantid=?;"; - - public static final String DEMAND_DETAIL_UPDATE_QUERY = "UPDATE {schema}.egbs_demanddetail_v1 SET taxamount=?,collectionamount=?," - + "lastModifiedby=?,lastModifiedtime=?, additionaldetails=? WHERE id=? AND demandid=? AND tenantid=?;"; - - public static final String DEMAND_AUDIT_INSERT_QUERY = "INSERT INTO {schema}.egbs_demand_v1_audit " - + "(demandid,consumerCode,consumerType,businessService,payer,taxPeriodFrom,taxPeriodTo," - + "minimumAmountPayable,createdby,createdtime,tenantid, status, additionaldetails,id,billexpirytime, ispaymentcompleted) " - + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"; - - public static final String DEMAND_DETAIL_AUDIT_INSERT_QUERY = "INSERT INTO {schema}.egbs_demanddetail_v1_audit " - + "(demanddetailid,demandid,taxHeadCode,taxamount,collectionamount," - + "createdby,createdtime,tenantid,additionaldetails,id)" - + " VALUES (?,?,?,?,?,?,?,?,?,?);"; - - public static final String DEMAND_UPDATE_CONSUMERCODE_QUERY="UPDATE {schema}.egbs_demand_v1 SET consumercode=?, lastmodifiedby=?, lastmodifiedtime=? " - + " WHERE tenantid=? AND id IN ("; - - - public String getDemandQueryForConsumerCodes(Map> businessConsumercodeMap,List preparedStmtList, String tenantId){ - - StringBuilder query = new StringBuilder(BASE_DEMAND_QUERY); - - query.append("dmd.tenantid=? "); - preparedStmtList.add(tenantId); - - query.append("AND dmd.status='ACTIVE' "); - - boolean orFlag = false; - for (Entry> consumerCode : businessConsumercodeMap.entrySet()) { - - String businessService = consumerCode.getKey(); - Set consumerCodes = consumerCode.getValue(); - - if(consumerCodes!=null && !consumerCodes.isEmpty()){ - - if(orFlag) - query.append("OR"); - else - query.append("AND"); - - query.append(" dmd.businessservice='"+businessService+"' AND dmd.consumercode IN (" - +getIdQueryForStrings(consumerCodes)+")"); - addToPreparedStatement(preparedStmtList, consumerCodes); - orFlag=true; - } - } - - return query.toString(); - } - - public String getDemandQuery(DemandCriteria demandCriteria, List preparedStatementValues) { - - StringBuilder demandQuery = new StringBuilder(BASE_DEMAND_QUERY); - - String tenantId = demandCriteria.getTenantId(); - - if (centralInstaceUtil.isTenantIdStateLevel(tenantId)) { - demandQuery.append(" dmd.tenantid LIKE ? "); - preparedStatementValues.add(demandCriteria.getTenantId() + '%'); - } else { - demandQuery.append(" dmd.tenantid = ? "); - preparedStatementValues.add(demandCriteria.getTenantId()); - } - - if (demandCriteria.getStatus() != null) { - - addAndClause(demandQuery); - demandQuery.append("dmd.status=?"); - preparedStatementValues.add(demandCriteria.getStatus()); - } - - if (demandCriteria.getDemandId() != null && !demandCriteria.getDemandId().isEmpty()) { - addAndClause(demandQuery); - demandQuery.append("dmd.id IN (" + getIdQueryForStrings(demandCriteria.getDemandId()) + ")"); - addToPreparedStatement(preparedStatementValues, demandCriteria.getDemandId()); - } - if (!CollectionUtils.isEmpty(demandCriteria.getPayer())) { - addAndClause(demandQuery); - demandQuery.append("dmd.payer IN (" + getIdQueryForStrings(demandCriteria.getPayer()) + ")"); - addToPreparedStatement(preparedStatementValues, demandCriteria.getPayer()); - } - if (demandCriteria.getBusinessService() != null) { - addAndClause(demandQuery); - demandQuery.append("dmd.businessservice=?"); - preparedStatementValues.add(demandCriteria.getBusinessService()); - } - - if(demandCriteria.getIsPaymentCompleted() != null){ - addAndClause(demandQuery); - demandQuery.append("dmd.ispaymentcompleted = ?"); - preparedStatementValues.add(demandCriteria.getIsPaymentCompleted()); - } - - if (demandCriteria.getPeriodFrom() != null) { - addAndClause(demandQuery); - demandQuery.append("dmd.taxPeriodFrom >= ?"); - preparedStatementValues.add(demandCriteria.getPeriodFrom()); - } - - if(demandCriteria.getPeriodTo() != null){ - addAndClause(demandQuery); - demandQuery.append("dmd.taxPeriodTo <= ?"); - preparedStatementValues.add(demandCriteria.getPeriodTo()); - } - - if (demandCriteria.getConsumerCode() != null && !demandCriteria.getConsumerCode().isEmpty()) { - addAndClause(demandQuery); - demandQuery.append("dmd.consumercode IN (" - + getIdQueryForStrings(demandCriteria.getConsumerCode()) + ")"); - addToPreparedStatement(preparedStatementValues, demandCriteria.getConsumerCode()); - } - - addOrderByClause(demandQuery, DEMAND_QUERY_ORDER_BY_CLAUSE); - addPagingClause(demandQuery, preparedStatementValues); - - log.info("the query String for demand : " + demandQuery.toString()); - return demandQuery.toString(); - } - - private static void addOrderByClause(StringBuilder demandQueryBuilder,String columnName) { - demandQueryBuilder.append(" ORDER BY " + columnName); - } - - private static void addPagingClause(StringBuilder demandQueryBuilder, List preparedStatementValues) { -// demandQueryBuilder.append(" LIMIT ?"); -// preparedStatementValues.add(500); -// demandQueryBuilder.append(" OFFSET ?"); -// preparedStatementValues.add(0); - } - - private static boolean addAndClause(StringBuilder queryString) { - queryString.append(" AND "); - return true; - } - - private static String getIdQueryForStrings(Set idList) { - - StringBuilder builder = new StringBuilder(); - int length = idList.size(); - for( int i = 0; i< length; i++){ - builder.append(" ? "); - if(i != length -1) builder.append(","); - } - return builder.toString(); - } - - private void addToPreparedStatement(List preparedStmtList, Collection ids) - { - ids.forEach(id ->{ preparedStmtList.add(id);}); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/TaxHeadMasterQueryBuilder.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/TaxHeadMasterQueryBuilder.java deleted file mode 100644 index 04bb4335a35..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/TaxHeadMasterQueryBuilder.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.egov.demand.repository.querybuilder; - -import java.util.List; -import java.util.Set; - -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.springframework.stereotype.Component; - -import lombok.extern.slf4j.Slf4j; - -@Component -@Slf4j -public class TaxHeadMasterQueryBuilder { - - public static final String UPDATE_QUERY = "UPDATE {schema}.egbs_taxheadmaster SET category = ?, service = ?," - + " name = ?, code=?, isdebit = ?, isactualdemand = ?, orderno = ?, validfrom = ?, validtill = ?," - + " lastmodifiedby = ?, lastmodifiedtime = ? WHERE tenantid = ? and id = ?"; - - public static final String INSERT_QUERY = "INSERT INTO egbs_taxheadmaster(id, tenantid, category," - + " service, name, code, isdebit,isactualdemand, orderno, validfrom, validtill," - + " createdby, createdtime, lastmodifiedby, lastmodifiedtime)" - + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"; - - private static final String BASE_QUERY = "SELECT *,taxhead.id AS taxheadId," - + " taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS taxlAStmodifiedby," - + " taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid AS glCodeTenantId,glcode.service AS glCodeService," - + " glcode.createdby AS glcreatedby, glcode.createdtime AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby," - + " glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM {schema}.egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode " - + " ON taxhead.code=glcode.taxhead and taxhead.tenantid=glcode.tenantid " - + " WHERE taxhead.tenantId = ? "; - - public String getQuery(final TaxHeadMasterCriteria searchTaxHead, final List preparedStatementValues) { - final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); - log.info("get query"); - addWhereClause(selectQuery, preparedStatementValues, searchTaxHead); - addPagingClause(selectQuery, preparedStatementValues, searchTaxHead); - log.info("Query from taxHeadMaster querybuilde for search : " + selectQuery); - return selectQuery.toString(); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private void addWhereClause(final StringBuilder selectQuery, final List preparedStatementValues, - final TaxHeadMasterCriteria searchTaxHead) { - - if(searchTaxHead.getTenantId() == null && searchTaxHead.getService() == null - && searchTaxHead.getName() == null && searchTaxHead.getCode() == null - &&searchTaxHead.getCategory() == null) - return; - preparedStatementValues.add(searchTaxHead.getTenantId()); - - if(searchTaxHead.getService() != null){ - selectQuery.append(" AND taxhead.service = ?"); - preparedStatementValues.add(searchTaxHead.getService()); - } - - if (searchTaxHead.getName() != null) { - selectQuery.append(" AND taxhead.name like ?"); - preparedStatementValues.add("%" + searchTaxHead.getName() + "%"); - } - - if (searchTaxHead.getId() != null && !searchTaxHead.getId().isEmpty()) { - selectQuery.append(" AND taxhead.id IN (" + getIdQuery(searchTaxHead.getId())); - }else if(searchTaxHead.getCode() != null && !searchTaxHead.getCode().isEmpty()) { - selectQuery.append(" AND taxhead.code IN ("+ getIdQuery(searchTaxHead.getCode())); - } - - if (searchTaxHead.getCategory() != null) { - selectQuery.append(" AND taxhead.category = ?"); - preparedStatementValues.add(searchTaxHead.getCategory()); - } - - if (searchTaxHead.getIsActualDemand() != null) { - selectQuery.append(" AND taxhead.isActualDemand = ?"); - preparedStatementValues.add(searchTaxHead.getIsActualDemand()); - } - - if (searchTaxHead.getIsDebit() != null) { - selectQuery.append(" AND taxhead.isDebit = ?"); - preparedStatementValues.add( searchTaxHead.getIsDebit()); - } - - - } - - @SuppressWarnings({ "rawtypes" }) - private void addPagingClause(final StringBuilder selectQuery, final List preparedStatementValues, - final TaxHeadMasterCriteria searchTaxHeads) { - - selectQuery.append(" ORDER BY taxhead.validfrom,taxhead.code"); - - selectQuery.append(" LIMIT ?"); - /* long pageSize = Integer.parseInt(applicationProperties.commonsSearchPageSizeDefault()); - if (searchTaxHeads.getSize() != null) - pageSize = searchTaxHeads.getSize(); - preparedStatementValues.add(pageSize); // Set limit to pageSize - - // handle offset here - selectQuery.append(" OFFSET ?"); - long pageNumber = 0; // Default pageNo is zero meaning first page - if (searchTaxHeads.getOffset() != null) - pageNumber = searchTaxHeads.getOffset() - 1; - preparedStatementValues.add(pageNumber * pageSize); // Set offset to*/ - // pageNo * pageSize - } - - private static String getIdQuery(Set idList) { - - StringBuilder query = new StringBuilder(); - if (!idList.isEmpty()) { - String[] list = idList.toArray(new String[idList.size()]); - query.append("'"+list[0]+"'"); - for (int i = 1; i < idList.size(); i++) - query.append("," + "'"+list[i]+"'"); - } - return query.append(")").toString(); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/TaxPeriodQueryBuilder.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/TaxPeriodQueryBuilder.java deleted file mode 100644 index cf81b4c6ac4..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/querybuilder/TaxPeriodQueryBuilder.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.repository.querybuilder; - -import java.util.Date; -import java.util.List; -import java.util.Set; - -import org.apache.commons.lang3.StringUtils; -import org.egov.demand.model.TaxPeriod; -import org.egov.demand.model.enums.PeriodCycle; -import org.egov.demand.repository.TaxPeriodRepository; -import org.egov.demand.web.contract.TaxPeriodCriteria; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -@Component -public class TaxPeriodQueryBuilder { - - private static final Logger logger = LoggerFactory.getLogger(TaxPeriodRepository.class); - - private static final String BASE_QUERY = "SELECT * FROM {schema}.EGBS_TAXPERIOD taxperiod "; - - public final String insertQuery = "INSERT INTO {schema}.egbs_taxperiod(id, service, code, fromdate, todate," - + " financialyear, createddate,lastmodifieddate, createdby, lastmodifiedby, tenantid, periodcycle)" - + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"; - - public final String updateQuery="UPDATE {schema}.egbs_taxperiod SET service=?, code=?, fromdate=?, todate=?," - + " financialyear=?, lastmodifieddate=?, lastmodifiedby=?, tenantid=?," - + " periodcycle=? WHERE tenantid = ? and id = ? "; - - public final String PERIOD_VALIDATE_QUERY = "SELECT * FROM {schema}.egbs_taxperiod WHERE tenantId= ? AND service= ?" - + " AND ( ? BETWEEN fromdate AND todate OR ? BETWEEN fromdate AND todate)" - + " OR (fromdate BETWEEN ? AND ? OR todate BETWEEN ? AND ?);"; - - public String prepareSearchQuery(final TaxPeriodCriteria taxPeriodCriteria, final List preparedStatementValues) { - final StringBuilder selectQuery = new StringBuilder(BASE_QUERY); - logger.info("prepareSearchQuery --> "); - prepareWhereClause(selectQuery, preparedStatementValues, taxPeriodCriteria); - logger.info("Search tax periods query from TaxPeriodQueryBuilder -> " + selectQuery); - return selectQuery.toString(); - } - - private void prepareWhereClause(final StringBuilder selectQuery, final List preparedStatementValues, - final TaxPeriodCriteria taxPeriodCriteria) { - - String tenantId = taxPeriodCriteria.getTenantId(); - selectQuery.append(" WHERE "); - - if (StringUtils.isNotBlank(tenantId)) { - selectQuery.append(" taxperiod.tenantId = ? "); - preparedStatementValues.add(taxPeriodCriteria.getTenantId()); - } - - Set service = taxPeriodCriteria.getService(); - if (service != null && !service.isEmpty()) { - selectQuery.append(" and taxperiod.service IN " + getQueryForCollection(service)); - } - - PeriodCycle periodCycle = taxPeriodCriteria.getPeriodCycle(); - if(periodCycle != null){ - selectQuery.append(" and taxperiod.periodcycle = ? "); - preparedStatementValues.add(periodCycle.toString()); - } - - if (taxPeriodCriteria.getFromDate() != null && taxPeriodCriteria.getToDate() != null) { - if (service != null && !service.isEmpty() && service.size() == 1 && periodCycle!=null) { - selectQuery.append( - " AND (fromdate >= CASE WHEN ((SELECT fromdate FROM {schema}.egbs_taxperiod WHERE tenantId =? AND ( ? BETWEEN fromdate AND todate) " - + " AND service IN " + getQueryForCollection(service) + " AND periodcycle=?) NOTNULL) " - + "THEN " - + "( SELECT fromdate FROM {schema}.egbs_taxperiod WHERE tenantId =? AND ( ? BETWEEN fromdate AND todate)" - + " AND service IN "+ getQueryForCollection(service) + " AND periodcycle=?) " - + "ELSE " - + "(SELECT min(fromdate) FROM {schema}.egbs_taxperiod WHERE tenantId =?)" - + " END" - + " AND todate <= ( SELECT todate FROM {schema}.egbs_taxperiod WHERE tenantId = ? AND (? BETWEEN fromdate AND todate) " - + " AND service IN " + getQueryForCollection(service) + " AND periodcycle=?))"); - - preparedStatementValues.add(tenantId); - preparedStatementValues.add(taxPeriodCriteria.getFromDate()); - preparedStatementValues.add(periodCycle.toString()); - preparedStatementValues.add(tenantId); - preparedStatementValues.add(taxPeriodCriteria.getFromDate()); - preparedStatementValues.add(periodCycle.toString()); - preparedStatementValues.add(tenantId); - preparedStatementValues.add(tenantId); - preparedStatementValues.add(taxPeriodCriteria.getToDate()); - preparedStatementValues.add(periodCycle.toString()); - } else { - if (taxPeriodCriteria.getFromDate() != null) { - selectQuery.append(" and taxperiod.fromdate >= ? "); - preparedStatementValues.add(taxPeriodCriteria.getFromDate()); - } - if (taxPeriodCriteria.getToDate() != null) { - selectQuery.append(" and taxperiod.todate <= ? "); - preparedStatementValues.add(taxPeriodCriteria.getToDate()); - } - } - } - - if (StringUtils.isNotBlank(taxPeriodCriteria.getCode())) { - selectQuery.append(" and taxperiod.code = ? "); - preparedStatementValues.add(taxPeriodCriteria.getCode()); - } - - Set ids = taxPeriodCriteria.getId(); - if (ids != null && !ids.isEmpty()) - selectQuery.append(" and taxperiod.id IN "+getQueryForCollection(ids)); - - if(taxPeriodCriteria.getDate()!=null){ - selectQuery.append(" and taxperiod.fromdate <= ? and taxperiod.todate >= ? "); - preparedStatementValues.add(taxPeriodCriteria.getDate()); - preparedStatementValues.add(taxPeriodCriteria.getDate()); - } - } - - public String prepareQueryForValidation(List taxPeriodList, String mode) { - - String baseQuery = "select exists (select * from {schema}.egbs_taxperiod taxperiod where "; - StringBuilder whereClause = new StringBuilder(); - Long currDate = new Date().getTime(); - int count = 0; - - for (TaxPeriod taxPeriod : taxPeriodList) { - - whereClause = whereClause.append(" ( "); - - if (StringUtils.isNotBlank(taxPeriod.getService())) - whereClause = whereClause.append(" taxperiod.service = '").append(taxPeriod.getService()) - .append("' and "); - if (StringUtils.isNotBlank(taxPeriod.getCode())) - whereClause = whereClause.append(" taxperiod.code = '").append(taxPeriod.getCode()).append("' and "); - if ("edit".equalsIgnoreCase(mode)) - whereClause = whereClause.append(" taxperiod.id != '").append(taxPeriod.getId()).append("' and "); - if (StringUtils.isNotBlank(taxPeriod.getTenantId())) - whereClause = whereClause.append(" taxperiod.tenantId = '").append(taxPeriod.getTenantId()) - .append("' and (( "); - // from and to dates validation - if (StringUtils.isNotBlank(taxPeriod.getFromDate().toString()) - && StringUtils.isNotBlank(taxPeriod.getToDate().toString())) - whereClause.append(taxPeriod.getFromDate() + " BETWEEN fromdate AND todate OR " + taxPeriod.getToDate()+ - " BETWEEN fromdate AND todate)" + " OR (fromdate BETWEEN " + taxPeriod.getFromDate() + - " AND "+ taxPeriod.getToDate() + " OR todate BETWEEN " + taxPeriod.getFromDate() + - " AND "+ taxPeriod.getToDate() + ")))"); - count++; - if (taxPeriodList.size() > count) - whereClause = whereClause.append(" or "); - } - return baseQuery.concat(whereClause.toString()).concat(" )"); - } - - private String getQueryForCollection(Set values) { - StringBuilder query = new StringBuilder(); - if (!values.isEmpty()) { - String[] list = values.toArray(new String[values.size()]); - query.append(" ('"+list[0]+"'"); - for (int i = 1; i < values.size(); i++) - query.append("," + "'"+list[i]+"'"); - } - return query.append(")").toString(); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/AmendmentRowMapper.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/AmendmentRowMapper.java deleted file mode 100644 index d9504bb3be1..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/AmendmentRowMapper.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.egov.demand.repository.rowmapper; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.egov.demand.amendment.model.Amendment; -import org.egov.demand.amendment.model.Document; -import org.egov.demand.amendment.model.enums.AmendmentReason; -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.util.Util; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -@Component -public class AmendmentRowMapper implements ResultSetExtractor> { - - @Autowired - private Util util; - - @Override - public List extractData(ResultSet rs) throws SQLException, DataAccessException { - - Map amendmentMap = new LinkedHashMap<>(); - String amendmentIdRsName = "amendmentid"; - - while (rs.next()) { - - String amendmentId = rs.getString(amendmentIdRsName); - Amendment amendment = amendmentMap.get(amendmentId); - - if (amendment == null) { - - - Long effectiveFrom = rs.getLong("effectiveFrom"); - if (rs.wasNull()) { - effectiveFrom = null; - } - - Long effectiveTill = rs.getLong("effectiveTill"); - if (rs.wasNull()) { - effectiveTill = null; - } - - Long createdTime = rs.getLong("createdTime"); - if (rs.wasNull()) { - createdTime = null; - } - - Long lastModifiedTime = rs.getLong("lastModifiedTime"); - if (rs.wasNull()) { - lastModifiedTime = null; - } - - AuditDetails auditDetails = AuditDetails.builder() - .lastModifiedBy(rs.getString("lastModifiedBy")) - .createdBy(rs.getString("createdBy")) - .lastModifiedTime(lastModifiedTime) - .createdTime(createdTime) - .build(); - - amendment = Amendment.builder() - .additionalDetails(util.getJsonValue((PGobject) rs.getObject("additionaldetails"))) - .amendmentReason(AmendmentReason.fromValue(rs.getString("amendmentReason"))) - .status(AmendmentStatus.fromValue(rs.getString("amendmentstatus"))) - .reasonDocumentNumber(rs.getString("reasonDocumentNumber")) - .amendedDemandId(rs.getString("amendedDemandId")) - .businessService(rs.getString("businessService")) - .consumerCode(rs.getString("consumerCode")) - .tenantId(rs.getString("tenantId")) - .id(rs.getString("amendmentuuid")) - .demandDetails(new ArrayList<>()) - .documents(new ArrayList<>()) - /* Initiating with empty arrays for document and tax-details because - * they are always mandatory for amendment */ - .effectiveFrom(effectiveFrom) - .effectiveTill(effectiveTill) - .auditDetails(auditDetails) - .amendmentId(amendmentId) - .build(); - - - amendmentMap.put(amendmentId, amendment); - } - - addDemandDetailToAmendment(amendment, rs); - addDocumentToAmendment(amendment, rs); - } - return new ArrayList<>(amendmentMap.values()); - } - - private void addDemandDetailToAmendment(Amendment amendment, ResultSet rs) throws SQLException { - - List taxDetails = amendment.getDemandDetails(); - String detailId = rs.getString("detailid"); - - if (!CollectionUtils.isEmpty(taxDetails)) - for (DemandDetail detail : taxDetails) { - if (detail.getId().equals(detailId)) - return; - } - - DemandDetail amendmentDetail = DemandDetail.builder() - .taxHeadMasterCode(rs.getString("taxheadcode")) - .taxAmount(rs.getBigDecimal("taxAmount")) - .id(detailId) - .build(); - - taxDetails.add(amendmentDetail); - } - - private void addDocumentToAmendment(Amendment amendment, ResultSet rs) throws SQLException { - - List docs = amendment.getDocuments(); - String docId = rs.getString("docid"); - - if (!CollectionUtils.isEmpty(docs)) - for (Document doc : docs) { - if (doc.getId().equals(docId)) - return; - } - - Document newDoc = Document.builder() - .documentType(rs.getString("documentType")) - .documentUid(rs.getString("documentUid")) - .fileStoreId(rs.getString("fileStoreid")) - .id(docId) - .build(); - - docs.add(newDoc); - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/BillRowMapper.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/BillRowMapper.java deleted file mode 100644 index 788a857cac2..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/BillRowMapper.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.egov.demand.repository.rowmapper; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.Bill; -import org.egov.demand.model.BillAccountDetail; -import org.egov.demand.model.BillDetail; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; - -import lombok.extern.slf4j.Slf4j; - -@Component -@Slf4j -public class BillRowMapper implements ResultSetExtractor>{ - - @Override - public List extractData(ResultSet rs) throws SQLException { - - Map billMap = new LinkedHashMap<>(); - Map billDetailMap = new HashMap<>(); - - while (rs.next()) { - - String billId = rs.getString("b_id"); - Bill bill = billMap.get(billId); - - if (bill == null) { - - bill = new Bill(); - bill.setId(billId); - bill.setTenantId(rs.getString("b_tenantid")); - bill.setPayerName(rs.getString("b_payername")); - bill.setPayerAddress(rs.getString("b_payeraddress")); - bill.setPayerEmail(rs.getString("b_payeremail")); - bill.setIsActive(rs.getBoolean("b_isactive")); - bill.setIsCancelled(rs.getBoolean("b_iscancelled")); - bill.setMobileNumber(rs.getString("mobilenumber")); - - AuditDetails auditDetails = new AuditDetails(); - auditDetails.setCreatedBy(rs.getString("b_createdby")); - auditDetails.setCreatedTime((Long) rs.getObject("b_createddate")); - auditDetails.setLastModifiedBy(rs.getString("b_lastmodifiedby")); - auditDetails.setLastModifiedTime((Long) rs.getObject("b_lastmodifieddate")); - - bill.setAuditDetails(auditDetails); - - billMap.put(bill.getId(), bill); - } - - String detailId = rs.getString("bd_id"); - BillDetail billDetail = billDetailMap.get(detailId); - - if (billDetail == null) { - billDetail = new BillDetail(); - billDetail.setId(detailId); - billDetail.setTenantId(rs.getString("bd_tenantid")); - billDetail.setBill(rs.getString("bd_billid")); - billDetail.setBusinessService(rs.getString("bd_businessservice")); - billDetail.setBillNumber(rs.getString("bd_billno")); - billDetail.setBillDate(rs.getLong("bd_billdate")); - - billDetail.setDemandId(rs.getString("demandid")); - billDetail.setFromPeriod(rs.getLong("fromperiod")); - billDetail.setToPeriod(rs.getLong("toperiod")); - - billDetail.setConsumerCode(rs.getString("bd_consumercode")); - billDetail.setConsumerType(rs.getString("bd_consumertype")); - billDetail.setMinimumAmount(rs.getBigDecimal("bd_minimumamount")); - billDetail.setTotalAmount(rs.getBigDecimal("bd_totalamount")); - billDetail.setPartPaymentAllowed(rs.getBoolean("bd_partpaymentallowed")); - billDetail.setIsAdvanceAllowed(rs.getBoolean("bd_isadvanceallowed")); - billDetail.setExpiryDate(rs.getLong("bd_expirydate")); - billDetail.setCollectionModesNotAllowed(Arrays.asList(rs.getString("bd_collectionmodesnotallowed").split(","))); - - billDetailMap.put(billDetail.getId(), billDetail); - - if (bill.getId().equals(billDetail.getBill())) - bill.addBillDetailsItem(billDetail); - } - - BillAccountDetail billAccDetail = new BillAccountDetail(); - billAccDetail.setId(rs.getString("ad_id")); - billAccDetail.setTenantId(rs.getString("ad_tenantid")); - billAccDetail.setBillDetail(rs.getString("ad_billdetail")); - billAccDetail.setGlcode(rs.getString("ad_glcode")); - billAccDetail.setOrder(rs.getInt("ad_orderno")); - - billAccDetail.setAmount(rs.getBigDecimal("ad_amount")); - billAccDetail.setAdjustedAmount(rs.getBigDecimal("ad_adjustedamount")); - billAccDetail.setTaxHeadCode(rs.getString("ad_taxheadcode")); - billAccDetail.setDemandDetailId(rs.getString("demanddetailid")); - - if (billDetail.getId().equals(billAccDetail.getBillDetail())) - billDetail.addBillAccountDetailsItem(billAccDetail); - - } - log.debug("converting map to list object ::: " + billMap.values()); - return new ArrayList<>(billMap.values()); - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/BillRowMapperV2.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/BillRowMapperV2.java deleted file mode 100644 index 95bb26c8389..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/BillRowMapperV2.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.egov.demand.repository.rowmapper; - -import java.math.BigDecimal; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.BillAccountDetailV2; -import org.egov.demand.model.BillDetailV2; -import org.egov.demand.model.BillV2; -import org.egov.demand.model.BillV2.BillStatus; -import org.egov.demand.util.Util; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; - -@Component -public class BillRowMapperV2 implements ResultSetExtractor>{ - - @Autowired - private Util util; - - @Override - public List extractData(ResultSet rs) throws SQLException { - - Map billMap = new LinkedHashMap<>(); - Map billDetailMap = new HashMap<>(); - - while (rs.next()) { - - String billId = rs.getString("b_id"); - BillV2 bill = billMap.get(billId); - - if (bill == null) { - - AuditDetails auditDetails = new AuditDetails(); - auditDetails.setCreatedBy(rs.getString("b_createdby")); - auditDetails.setCreatedTime((Long) rs.getObject("b_createddate")); - auditDetails.setLastModifiedBy(rs.getString("b_lastmodifiedby")); - auditDetails.setLastModifiedTime((Long) rs.getObject("b_lastmodifieddate")); - - - bill = BillV2.builder() - .id(billId) - .totalAmount(BigDecimal.ZERO) - .tenantId(rs.getString("b_tenantid")) - .userId(rs.getString("b_payerid")) - .payerName(rs.getString("b_payername")) - .payerAddress(rs.getString("b_payeraddress")) - .payerEmail(rs.getString("b_payeremail")) - .mobileNumber(rs.getString("mobilenumber")) - .status(BillStatus.fromValue(rs.getString("b_status"))) - .businessService(rs.getString("bd_businessService")) - .billNumber(rs.getString("bd_billno")) - .billDate(rs.getLong("bd_billDate")) - .consumerCode(rs.getString("bd_consumerCode")) - .fileStoreId(rs.getString("b_fileStoreId")) - .additionalDetails(util.getJsonValue((PGobject) rs.getObject("b_additionalDetails"))) - .auditDetails(auditDetails) - .build(); - - billMap.put(bill.getId(), bill); - billDetailMap.clear(); - } - - String detailId = rs.getString("bd_id"); - BillDetailV2 billDetail = billDetailMap.get(detailId); - - if (billDetail == null) { - - billDetail = BillDetailV2.builder() - .id(detailId) - .tenantId(rs.getString("bd_tenantid")) - .billId(rs.getString("bd_billid")) - .demandId(rs.getString("demandid")) - .fromPeriod(rs.getLong("fromperiod")) - .toPeriod(rs.getLong("toperiod")) - .amount(rs.getBigDecimal("bd_totalamount")) - .expiryDate(rs.getLong("bd_expirydate")) - .additionalDetails(util.getJsonValue((PGobject) rs.getObject("bd_additionaldetails"))) - .build(); - - billDetailMap.put(billDetail.getId(), billDetail); - - if (bill.getId().equals(billDetail.getBillId())) { - bill.addBillDetailsItem(billDetail); - bill.setTotalAmount(bill.getTotalAmount().add(billDetail.getAmount())); - } - } - - BillAccountDetailV2 billAccDetail = BillAccountDetailV2.builder() - .id(rs.getString("ad_id")) - .tenantId(rs.getString("ad_tenantid")) - .billDetailId(rs.getString("ad_billdetail")) - .order(rs.getInt("ad_orderno")) - .amount(rs.getBigDecimal("ad_amount")) - .adjustedAmount(rs.getBigDecimal("ad_adjustedamount")) - .taxHeadCode(rs.getString("ad_taxheadcode")) - .demandDetailId(rs.getString("demanddetailid")) - .build(); - - if (billDetail.getId().equals(billAccDetail.getBillDetailId())) - billDetail.addBillAccountDetailsItem(billAccDetail); - - } - - return new ArrayList<>(billMap.values()); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/CollectedReceiptsRowMapper.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/CollectedReceiptsRowMapper.java deleted file mode 100644 index 3e9635957d9..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/CollectedReceiptsRowMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.egov.demand.repository.rowmapper; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.egov.demand.model.AuditDetail; -import org.egov.demand.model.CollectedReceipt; -import org.egov.demand.model.enums.Status; -import org.springframework.jdbc.core.RowMapper; - -public class CollectedReceiptsRowMapper implements RowMapper { - - @Override - public CollectedReceipt mapRow(ResultSet rs, int rowNum) throws SQLException { - - CollectedReceipt receipt=new CollectedReceipt(); - - receipt.setBusinessService(rs.getString("businessservice")); - receipt.setConsumerCode(rs.getString("consumercode")); - receipt.setReceiptAmount(rs.getDouble("receiptamount")); - receipt.setReceiptDate(rs.getLong("receiptdate")); - receipt.setReceiptNumber(rs.getString("receiptnumber")); - receipt.setStatus(Status.fromValue(rs.getString("status"))); - receipt.setTenantId(rs.getString("tenantid")); - - AuditDetail auditDetail=new AuditDetail(); - - auditDetail.setCreatedBy(rs.getString("createdby")); - auditDetail.setCreatedTime(rs.getLong("createddate")); - auditDetail.setLastModifiedBy(rs.getString("lastmodifiedby")); - auditDetail.setLastModifiedTime(rs.getLong("lastmodifieddate")); - - receipt.setAuditDetail(auditDetail); - - return receipt; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/DemandRowMapper.java b/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/DemandRowMapper.java deleted file mode 100644 index 3b5a790b733..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/repository/rowmapper/DemandRowMapper.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.repository.rowmapper; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.Demand; -import org.egov.demand.model.Demand.StatusEnum; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.User; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.JsonNode; - -@Component -public class DemandRowMapper implements ResultSetExtractor> { - - - @Autowired - private Util util; - - @Override - public List extractData(ResultSet rs) throws SQLException, DataAccessException { - - Map demandMap = new LinkedHashMap<>(); - String demandIdRsName = "did"; - - while (rs.next()) { - - String demandId = rs.getString(demandIdRsName); - Demand demand = demandMap.get(demandId); - - if (demand == null) { - - demand = new Demand(); - demand.setId(demandId); - demand.setBusinessService(rs.getString("dbusinessservice")); - demand.setConsumerCode(rs.getString("dconsumerCode")); - demand.setConsumerType(rs.getString("dconsumerType")); - demand.setTaxPeriodFrom(rs.getLong("dtaxPeriodFrom")); - demand.setTaxPeriodTo(rs.getLong("dtaxPeriodTo")); - demand.setTenantId(rs.getString("dtenantid")); - demand.setBillExpiryTime(rs.getLong("dbillexpirytime")); - demand.setStatus(StatusEnum.fromValue(rs.getString("status"))); - demand.setIsPaymentCompleted(rs.getBoolean("ispaymentcompleted")); - demand.setMinimumAmountPayable(rs.getBigDecimal("dminimumAmountPayable")); - - PGobject adDetail = (PGobject) rs.getObject("demandadditionaldetails"); - JsonNode json = util.getJsonValue(adDetail); - demand.setAdditionalDetails(json); - - String payerId = rs.getString("payer"); - if (null != payerId) { - demand.setPayer(User.builder().uuid(payerId).build()); - } - - AuditDetails auditDetail = new AuditDetails(); - auditDetail.setCreatedBy(rs.getString("dcreatedby")); - auditDetail.setLastModifiedBy(rs.getString("dlastModifiedby")); - auditDetail.setCreatedTime(rs.getLong("dcreatedtime")); - auditDetail.setLastModifiedTime(rs.getLong("dlastModifiedtime")); - demand.setAuditDetails(auditDetail); - - demand.setDemandDetails(new ArrayList<>()); - demandMap.put(demand.getId(), demand); - } - - DemandDetail demandDetail = new DemandDetail(); - demandDetail.setId(rs.getString("dlid")); - demandDetail.setDemandId(rs.getString("dldemandid")); - - demandDetail.setTaxHeadMasterCode(rs.getString("dltaxheadcode")); - ; - demandDetail.setTenantId(rs.getString("dltenantid")); - demandDetail.setTaxAmount(rs.getBigDecimal("dltaxamount")); - demandDetail.setCollectionAmount(rs.getBigDecimal("dlcollectionamount")); - - AuditDetails dlauditDetail = new AuditDetails(); - dlauditDetail.setCreatedBy(rs.getString("dlcreatedby")); - dlauditDetail.setCreatedTime(rs.getLong("dlcreatedtime")); - dlauditDetail.setLastModifiedBy(rs.getString("dllastModifiedby")); - dlauditDetail.setLastModifiedTime(rs.getLong("dllastModifiedtime")); - demandDetail.setAuditDetails(dlauditDetail); - - if (demand.getId().equals(demandDetail.getDemandId())) - demand.getDemandDetails().add(demandDetail); - } - return new ArrayList<>(demandMap.values()); - } - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/AmendmentService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/AmendmentService.java deleted file mode 100644 index 7ce6d0956e5..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/AmendmentService.java +++ /dev/null @@ -1,208 +0,0 @@ -package org.egov.demand.service; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.amendment.model.Amendment; -import org.egov.demand.amendment.model.AmendmentCriteria; -import org.egov.demand.amendment.model.AmendmentRequest; -import org.egov.demand.amendment.model.AmendmentUpdate; -import org.egov.demand.amendment.model.AmendmentUpdateRequest; -import org.egov.demand.amendment.model.State; -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.BillV2.BillStatus; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.UpdateBillCriteria; -import org.egov.demand.repository.AmendmentRepository; -import org.egov.demand.repository.BillRepositoryV2; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.validator.AmendmentValidator; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; - -@Service -public class AmendmentService { - - @Autowired - private Util util; - - @Autowired - private ApplicationProperties props; - - @Autowired - private DemandService demandService; - - @Autowired - private BillRepositoryV2 billRepositoryV2; - - @Autowired - private AmendmentValidator amendmentValidator; - - @Autowired - private AmendmentRepository amendmentRepository; - - /** - * Search amendment based on criteria - * - * @param amendmentCriteria - */ - public List search(AmendmentCriteria amendmentCriteria, RequestInfo requestInfo) { - - amendmentValidator.validateAmendmentCriteriaForSearch(amendmentCriteria); - if (!StringUtils.isEmpty(amendmentCriteria.getMobileNumber())) { - - DemandCriteria demandCriteria = DemandCriteria.builder() - .businessService(amendmentCriteria.getBusinessService()) - .mobileNumber(amendmentCriteria.getMobileNumber()) - .tenantId(amendmentCriteria.getTenantId()) - .build(); - - List demands = demandService.getDemands(demandCriteria, requestInfo); - if (!CollectionUtils.isEmpty(demands)) { - if (!CollectionUtils.isEmpty(amendmentCriteria.getConsumerCode())) - amendmentCriteria.getConsumerCode() - .retainAll(demands.stream().map(Demand::getConsumerCode).collect(Collectors.toSet())); - else - amendmentCriteria.getConsumerCode() - .addAll(demands.stream().map(Demand::getConsumerCode).collect(Collectors.toSet())); - } - if (CollectionUtils.isEmpty(amendmentCriteria.getConsumerCode()) - && ObjectUtils.isEmpty(amendmentCriteria.getAmendmentId())) - return new ArrayList<>(); - } - return amendmentRepository.getAmendments(amendmentCriteria); - } - - /** - * - * @param amendmentRequest - */ - public Amendment create(AmendmentRequest amendmentRequest) { - - RequestInfo requestInfo = amendmentRequest.getRequestInfo(); - Amendment amendment = amendmentRequest.getAmendment(); - - amendmentValidator.validateAmendmentForCreate(amendmentRequest); - amendmentValidator.enrichAmendmentForCreate(amendmentRequest); - if (props.getIsAmendmentworkflowEnabed()) { - - State state = util.callWorkFlow(amendment.getWorkflow(), requestInfo); - amendment.setStatus(AmendmentStatus.fromValue(state.getApplicationStatus())); - } - amendmentRepository.saveAmendment(amendmentRequest); - if (!props.getIsAmendmentworkflowEnabed()) { - updateDemandWithAmendmentTax(requestInfo, amendment); - } - return amendmentRequest.getAmendment(); - } - - - /** - * update method for amendment, used only with workflow. if workflow is not available then method is not called - * - * @param amendmentUpdateRequest - * @param isRequestForWorkflowUpdate - */ - public Amendment updateAmendment(AmendmentUpdateRequest amendmentUpdateRequest) { - - RequestInfo requestInfo = amendmentUpdateRequest.getRequestInfo(); - AmendmentUpdate amendmentUpdate = amendmentUpdateRequest.getAmendmentUpdate(); - Amendment amendmentFromSearch = amendmentValidator.validateAndEnrichAmendmentForUpdate(amendmentUpdateRequest); - - /* - * Workflow update - */ - if (props.getIsAmendmentworkflowEnabed()) { - State resultantState = util.callWorkFlow(amendmentUpdate.getWorkflow(), requestInfo); - amendmentUpdate.getWorkflow().setState(resultantState); - amendmentUpdate.setStatus(AmendmentStatus.fromValue(resultantState.getApplicationStatus())); - } - - /* - * amendment update - */ - amendmentRepository.updateAmendment(Arrays.asList(amendmentUpdate), amendmentUpdate.getTenantId()); - - if (amendmentUpdate.getStatus().equals(AmendmentStatus.ACTIVE)) { - updateDemandWithAmendmentTax(requestInfo, amendmentFromSearch); - } - return search(amendmentUpdate.toSearchCriteria(), requestInfo).get(0); - } - - - /** - * Method to update demand after an amendment is ACTIVE - * - * if no demands found then ignored - * - * @param requestInfo - * @param amendment - */ - public void updateDemandWithAmendmentTax(RequestInfo requestInfo, Amendment amendment) { - - - DemandCriteria demandCriteria = DemandCriteria.builder() - .consumerCode(Stream.of(amendment.getConsumerCode()).collect(Collectors.toSet())) - .businessService(amendment.getBusinessService()) - .tenantId(amendment.getTenantId()) - .isPaymentCompleted(false) - .build(); - - List demands = demandService.getDemands(demandCriteria, requestInfo); - if(!CollectionUtils.isEmpty(demands)) { - - AuditDetails auditDetails = util.getAuditDetail(requestInfo); - if (demands.size() > 1) - Collections.sort(demands, Comparator.comparing(Demand::getTaxPeriodFrom) - .thenComparing(Demand::getTaxPeriodTo).reversed()); - Demand demand = demands.get(0); - amendment.getDemandDetails().forEach(detail -> { - - detail.setAuditDetails(auditDetails); - detail.setDemandId(demand.getId()); - detail.setTenantId(demand.getTenantId()); - }); - demand.getDemandDetails().addAll(amendment.getDemandDetails()); - demandService.update(new DemandRequest(requestInfo, Arrays.asList(demand)), null); - - AmendmentUpdate amendmentUpdate = AmendmentUpdate.builder() - .additionalDetails(amendment.getAdditionalDetails()) - .amendmentId(amendment.getAmendmentId()) - .tenantId(amendment.getTenantId()) - .status(AmendmentStatus.CONSUMED) - .amendedDemandId(demand.getId()) - .auditDetails(auditDetails) - .build(); - - amendmentRepository.updateAmendment(Arrays.asList(amendmentUpdate), amendment.getTenantId()); - - Set consumerCodes = demands.stream().map(Demand::getConsumerCode).collect(Collectors.toSet()); - String businessService = demands.get(0).getBusinessService(); - String tenantId = demands.get(0).getTenantId(); - - billRepositoryV2.updateBillStatus( - UpdateBillCriteria.builder() - .statusToBeUpdated(BillStatus.EXPIRED) - .businessService(businessService) - .consumerCodes(consumerCodes) - .tenantId(tenantId) - .build() - ); - } - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/BillService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/BillService.java deleted file mode 100644 index 790e10e4390..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/BillService.java +++ /dev/null @@ -1,620 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.demand.service; - -import static org.egov.demand.util.Constants.CONSUMERCODES_REPLACE_TEXT; -import static org.egov.demand.util.Constants.EG_BS_BILL_NO_DEMANDS_FOUND_KEY; -import static org.egov.demand.util.Constants.EG_BS_BILL_NO_DEMANDS_FOUND_MSG; -import static org.egov.demand.util.Constants.TENANTID_REPLACE_TEXT; -import static org.egov.demand.util.Constants.URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_KEY; -import static org.egov.demand.util.Constants.URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_MSG; -import static org.egov.demand.util.Constants.URL_NOT_CONFIGURED_REPLACE_TEXT; -import static org.egov.demand.util.Constants.URL_PARAMS_FOR_SERVICE_BASED_DEMAND_APIS; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.Bill; -import org.egov.demand.model.BillAccountDetail; -import org.egov.demand.model.BillDetail; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.model.GenerateBillCriteria; -import org.egov.demand.model.TaxAndPayment; -import org.egov.demand.model.TaxHeadMaster; -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.egov.demand.model.enums.DemandStatus; -import org.egov.demand.repository.BillRepository; -import org.egov.demand.repository.IdGenRepo; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.BillResponse; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.User; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class BillService { - - @Autowired - private KafkaTemplate kafkaTemplate; - - @Autowired - private ResponseFactory responseFactory; - - @Autowired - private ApplicationProperties appProps; - - @Autowired - private BillRepository billRepository; - - @Autowired - private DemandService demandService; - - @Autowired - private BusinessServDetailService businessServDetailService; - - @Autowired - private TaxHeadMasterService taxHeadService; - - @Autowired - private Util util; - - @Autowired - private ServiceRequestRepository restRepository; - - @Autowired - private IdGenRepo idGenRepo; - - @Value("${kafka.topics.billgen.topic.name}") - private String notifTopicName; - - /** - * Fetches the bill for given parameters - * - * Searches the respective bill - * if nothing found then generates bill for the same criteria - * if bill found then checks the validity of the bill - * return the bill if valid - * else update the demands belonging to the bill then generate a new bill - * - * @param moduleCode - * @param consumerCodes - * @return - */ - public BillResponse fetchBill(GenerateBillCriteria billCriteria, RequestInfoWrapper requestInfoWrapper) { - - RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); - BillResponse res = searchBill(billCriteria.toBillSearchCriteria(), requestInfo); - List bills = res.getBill(); - - /* - * If no existing bills found then Generate new bill - */ - if (CollectionUtils.isEmpty(bills)) - return generateBill(billCriteria, requestInfo); - - Bill bill = bills.get(0); - - /* - * Collecting the businessService code and the list of consumer codes for those service codes - * whose demands needs to be updated. - * - * grouping by service code - * mapping of consumerCode to collect the value of map as list of consumerCodes - */ - Map> serviceAndConsumerCodeListMap = bill.getBillDetails().stream() - .filter(detail -> detail.getExpiryDate().compareTo(System.currentTimeMillis()) < 0) - .collect(Collectors.groupingBy(BillDetail::getBusinessService, - Collectors.mapping(BillDetail::getConsumerCode, Collectors.toList()))); - - - /* - * If none of the billDetails in the bills needs to be updated then return the search result - */ - if(CollectionUtils.isEmpty(serviceAndConsumerCodeListMap)) - return res; - else { - - updateDemandsForexpiredBillDetails(serviceAndConsumerCodeListMap, billCriteria.getTenantId(), requestInfoWrapper); - return generateBill(billCriteria, requestInfo); - } - } - - /** - * To make calls to respective service which updates the demands belonging to - * the arguments passed - * - * @param serviceAndConsumerCodeListMap - * @param tenantId - */ - private void updateDemandsForexpiredBillDetails(Map> serviceAndConsumerCodeListMap, - String tenantId, RequestInfoWrapper requestInfoWrapper) { - - Map serviceUrlMap = appProps.getBusinessCodeAndDemandUpdateUrlMap(); - - for (Entry> entry : serviceAndConsumerCodeListMap.entrySet()) { - - String url = serviceUrlMap.get(entry.getKey()); - - if (StringUtils.isEmpty(url)) - throw new CustomException(URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_KEY, - URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_MSG.replace(URL_NOT_CONFIGURED_REPLACE_TEXT, - entry.getKey())); - - StringBuilder completeUrl = new StringBuilder(url) - .append(URL_PARAMS_FOR_SERVICE_BASED_DEMAND_APIS.replace(TENANTID_REPLACE_TEXT, tenantId).replace( - CONSUMERCODES_REPLACE_TEXT, entry.getValue().toString().replace("[", "").replace("]", ""))); - - log.info("the url : " + completeUrl); - restRepository.fetchResult(completeUrl.toString(), requestInfoWrapper); - } - } - - - /** - * Searches the bills from DB for given criteria and enriches them with TaxAndPayments array - * - * @param billCriteria - * @param requestInfo - * @return - */ - public BillResponse searchBill(BillSearchCriteria billCriteria, RequestInfo requestInfo) { - - List bills = billRepository.findBill(billCriteria); - Map serviceCodeAndTaxAmountMap = new HashMap<>(); - - bills.forEach(bill -> { - - serviceCodeAndTaxAmountMap.clear(); - bill.getBillDetails() - .forEach(billDetail -> updateServiceCodeAndTaxAmountMap(serviceCodeAndTaxAmountMap, billDetail)); - bill.setTaxAndPayments(new ArrayList<>(serviceCodeAndTaxAmountMap.values())); - }); - - return BillResponse.builder().resposneInfo(responseFactory.getResponseInfo(requestInfo, HttpStatus.OK)) - .bill(bills).build(); - } - - /** - * Generate bill based on the given criteria - * - * @param billCriteria - * @param requestInfo - * @return - */ - public BillResponse generateBill(GenerateBillCriteria billCriteria, RequestInfo requestInfo) { - - Set demandIds = new HashSet<>(); - Set consumerCodes = new HashSet<>(); - - if (billCriteria.getDemandId() != null) - demandIds.add(billCriteria.getDemandId()); - - if (billCriteria.getConsumerCode() != null) - consumerCodes.addAll(billCriteria.getConsumerCode()); - - DemandCriteria demandCriteria = DemandCriteria.builder() - .businessService(billCriteria.getBusinessService()) - .mobileNumber(billCriteria.getMobileNumber()) - .tenantId(billCriteria.getTenantId()) - .email(billCriteria.getEmail()) - .consumerCode(consumerCodes) - .status(DemandStatus.ACTIVE.toString()) - .receiptRequired(false) - .demandId(demandIds) - .build(); - - /* Fetching demands for the given bill search criteria */ - List demands = demandService.getDemands(demandCriteria, requestInfo); - - List bills; - - if (!demands.isEmpty()) - bills = prepareBill(demands, requestInfo); - else - throw new CustomException(EG_BS_BILL_NO_DEMANDS_FOUND_KEY, EG_BS_BILL_NO_DEMANDS_FOUND_MSG); - - BillRequest billRequest = BillRequest.builder().bills(bills).requestInfo(requestInfo).build(); - kafkaTemplate.send(notifTopicName, null, billRequest); - return create(billRequest); - } - - /** - * Prepares the bill object from the list of given demands - * - * @param demands demands for which bill should be generated - * @param requestInfo - * @return - */ - private List prepareBill(List unGroupedDemands, RequestInfo requestInfo) { - - List bills = new ArrayList<>(); - Map> businessAndconsumerCodeDemandMap = unGroupedDemands.stream() - .collect(Collectors.groupingBy(demand -> demand.getBusinessService() + "-" + demand.getConsumerCode())); - - for (Entry> entry : businessAndconsumerCodeDemandMap.entrySet()) { - - List demandsForCurrentBusinessAndConsumer = entry.getValue(); - /* - * map to keep check on the values of total amount for each business in bill - */ - Map serviceCodeAndTaxAmountMap = new HashMap<>(); - User payer = null != demandsForCurrentBusinessAndConsumer.get(0).getPayer() - ? demandsForCurrentBusinessAndConsumer.get(0).getPayer() - : new User(); - - List billDetails = new ArrayList<>(); - /* - * Fetching Required master data - */ - String tenantId = demandsForCurrentBusinessAndConsumer.get(0).getTenantId(); - String businessService = demandsForCurrentBusinessAndConsumer.get(0).getBusinessService(); - Set businessCodeSet = new HashSet<>(); - businessCodeSet.add(businessService); - Set taxHeadCodes = new HashSet<>(); - - for (Demand demand : demandsForCurrentBusinessAndConsumer) { - - demand.getDemandDetails().forEach(detail -> taxHeadCodes.add(detail.getTaxHeadMasterCode())); - } - - Map taxHeadMap = getTaxHeadMaster(taxHeadCodes, tenantId, requestInfo); - Map businessMap = getBusinessService(businessCodeSet, tenantId, requestInfo); - List billNumbers = null; - - billNumbers = getBillNumbers(requestInfo, tenantId, businessService, - demandsForCurrentBusinessAndConsumer.size()); - /* - * looping demand to create bill-detail and account-details object - * - * setting ids to the same - */ - String billId = UUID.randomUUID().toString(); - int i = 0; - for (Demand demand : demandsForCurrentBusinessAndConsumer) { - - /* bill detail Gen */ - BillDetail billDetail = getBillDetailForDemand(demand, taxHeadMap, businessMap); - - /* setting ids for billDetail and billAccountDetails */ - String billDetailId = UUID.randomUUID().toString(); - billDetail.setId(billDetailId); - billDetail.setBill(billId); - billDetail.setBillNumber(billNumbers.get(i++)); - - for (BillAccountDetail accDetail : billDetail.getBillAccountDetails()) { - - accDetail.setId(UUID.randomUUID().toString()); - accDetail.setBillDetail(billDetailId); - } - - /* updating total amount in map for business-code per bill detail */ - updateServiceCodeAndTaxAmountMap(serviceCodeAndTaxAmountMap, billDetail); - billDetails.add(billDetail); - } - - Bill bill = Bill.builder() - .taxAndPayments(new ArrayList<>(serviceCodeAndTaxAmountMap.values())) - .auditDetails(util.getAuditDetail(requestInfo)) - .payerAddress(payer.getPermanentAddress()) - .mobileNumber(payer.getMobileNumber()) - .payerName(payer.getName()) - .billDetails(billDetails) - .tenantId(tenantId) - .isCancelled(null) - .isActive(true) - .id(billId) - .build(); - - bills.add(bill); - } - return bills; - } - - private List getBillNumbers(RequestInfo requestInfo, String tenantId, String module, int count) { - - String billNumberFormat = appProps.getBillNumberFormat(); - billNumberFormat = billNumberFormat.replace(appProps.getModuleReplaceStirng(), module); - - if (appProps.getIsTenantLevelBillNumberingEnabled()) - billNumberFormat = billNumberFormat.replace(appProps.getTenantIdReplaceString(), "_".concat(tenantId.split("\\.")[tenantId.length()-1])); - else - billNumberFormat = billNumberFormat.replace(appProps.getTenantIdReplaceString(), ""); - - return idGenRepo.getId(requestInfo, tenantId, "billnumberid", billNumberFormat, count); - } - - /** - * updates the total amount to be paid for each business service code - * - * in serviceCodeAndTaxAmountMap from the incoming BillDetail object. - * - * @param serviceCodeAndTaxAmountMap - * @param billDetail - */ - private void updateServiceCodeAndTaxAmountMap(Map serviceCodeAndTaxAmountMap, - BillDetail billDetail) { - - String businessCode = billDetail.getBusinessService(); - BigDecimal amountFromBillDetail = billDetail.getTotalAmount(); - BigDecimal collectedAmt = BigDecimal.ZERO; - - for (BillAccountDetail accDeatil : billDetail.getBillAccountDetails()) { - collectedAmt = collectedAmt.add(accDeatil.getAdjustedAmount()); - } - - /* if business code already exists then add the amounts */ - if (serviceCodeAndTaxAmountMap.containsKey(businessCode)) { - - TaxAndPayment taxAndPayment = serviceCodeAndTaxAmountMap.get(businessCode); - BigDecimal existingAmount = taxAndPayment.getTaxAmount(); - taxAndPayment.setTaxAmount(existingAmount.add(amountFromBillDetail)); - }else { - /* if code not present already then put a new entry */ - TaxAndPayment taxAndPayment = TaxAndPayment.builder() - .businessService(businessCode) - .taxAmount(amountFromBillDetail) - .build(); - - serviceCodeAndTaxAmountMap.put(businessCode, taxAndPayment); - } - } - - /** - * Method to create BillDetail object from demand - * - * @param demand - * @param taxHeadMap - * @param businessDetailMap - * @return - */ - private BillDetail getBillDetailForDemand(Demand demand, Map taxHeadMap, - Map businessDetailMap) { - - Long startPeriod = demand.getTaxPeriodFrom(); - Long endPeriod = demand.getTaxPeriodTo(); - String tenantId = demand.getTenantId(); - - BigDecimal collectedAmountForDemand = BigDecimal.ZERO; - BigDecimal totalAmountForDemand = BigDecimal.ZERO; - - BusinessServiceDetail business = businessDetailMap.get(demand.getBusinessService()); - - /* - * Map to store the bill account detail object with TaxHead code - * To accommodate conversion of multiple DemandDetails with same tax head code to single BillAccountDetail - */ - Map taxCodeAccountdetailMap = new HashMap<>(); - - for(DemandDetail demandDetail : demand.getDemandDetails()) { - - - TaxHeadMaster taxHead = taxHeadMap.get(demandDetail.getTaxHeadMasterCode()); - BigDecimal amountForAccDeatil = demandDetail.getTaxAmount().subtract(demandDetail.getCollectionAmount()); - - addOrUpdateBillAccDetailInTaxCodeAccDetailMap(demand, taxCodeAccountdetailMap, demandDetail, taxHead); - - /* Total tax and collection for the whole demand/bill-detail */ - totalAmountForDemand = totalAmountForDemand.add(amountForAccDeatil); - collectedAmountForDemand = collectedAmountForDemand.add(demandDetail.getCollectionAmount()); - } - - - Long billexpiryTime = demand.getBillExpiryTime(); - if (null == billexpiryTime || 0 == billexpiryTime) { - - Calendar cal = Calendar.getInstance(); - cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE), 23, 59, 59); - billexpiryTime = cal.getTimeInMillis(); - } - return BillDetail.builder() - .billAccountDetails(new ArrayList<>(taxCodeAccountdetailMap.values())) - .collectionModesNotAllowed(business.getCollectionModesNotAllowed()) - .partPaymentAllowed(business.getPartPaymentAllowed()) - .isAdvanceAllowed(business.getIsAdvanceAllowed()) - .minimumAmount(demand.getMinimumAmountPayable()) - .collectedAmount(collectedAmountForDemand) - .consumerCode(demand.getConsumerCode()) - .consumerType(demand.getConsumerType()) - .billDate(System.currentTimeMillis()) - .businessService(business.getCode()) - .totalAmount(totalAmountForDemand) - .expiryDate(billexpiryTime) - .demandId(demand.getId()) - .fromPeriod(startPeriod) - .toPeriod(endPeriod) - .tenantId(tenantId) - .billNumber(null) - .status(null) - .id(null) - .build(); - } - - /** - * creates/ updates bill-account details based on the tax-head code - * in taxCodeAccDetailMap - * - * @param startPeriod - * @param endPeriod - * @param tenantId - * @param taxCodeAccDetailMap - * @param demandDetail - * @param taxHead - * @param amountForAccDeatil - */ - private void addOrUpdateBillAccDetailInTaxCodeAccDetailMap(Demand demand, Map taxCodeAccDetailMap, - DemandDetail demandDetail, TaxHeadMaster taxHead) { - - String tenantId = demand.getTenantId(); - - BigDecimal newAmountForAccDeatil = demandDetail.getTaxAmount().subtract(demandDetail.getCollectionAmount()); - /* - * BAD - BillAccountDetail - * - * To handle repeating tax-head codes in demand - * - * And merge them in to single BAD - * - * if taxHeadCode found in map then add the amount to existing BAD - * - * else create and add a new BAD - */ - if (taxCodeAccDetailMap.containsKey(taxHead.getCode())) { - - BillAccountDetail existingAccDetail = taxCodeAccDetailMap.get(taxHead.getCode()); - BigDecimal existingAmtForAccDetail = existingAccDetail.getAmount(); - existingAccDetail.setAmount(existingAmtForAccDetail.add(newAmountForAccDeatil)); - - } else { - - BillAccountDetail accountDetail = BillAccountDetail.builder() - .demandDetailId(demandDetail.getId()) - .adjustedAmount(BigDecimal.ZERO) - .taxHeadCode(taxHead.getCode()) - .amount(newAmountForAccDeatil) - .order(taxHead.getOrder()) - .tenantId(tenantId) - .build(); - - taxCodeAccDetailMap.put(taxHead.getCode(), accountDetail); - } - } - - - /** - * Fetches the tax-head master data for the given tax-head codes - * - * @param demands list of demands for which tax-heads needs to searched - * @param tenantId tenant-id of the request - * @param info RequestInfo object - * @return returns a map of tax-head code as key and tax-head object as value - */ - private Map getTaxHeadMaster(Set taxHeadCodes, String tenantId, RequestInfo info) { - - TaxHeadMasterCriteria taxHeadCriteria = TaxHeadMasterCriteria.builder().tenantId(tenantId).code(taxHeadCodes) - .build(); - List taxHeads = taxHeadService.getTaxHeads(taxHeadCriteria, info).getTaxHeadMasters(); - - if (taxHeads.isEmpty()) - throw new CustomException("EG_BS_TAXHEADCODE_EMPTY", "No taxhead masters found for the given codes"); - - return taxHeads.stream().collect(Collectors.toMap(TaxHeadMaster::getCode, Function.identity())); - } - - - /** - * To Fetch the businessServiceDetail master based on the business codes - * - * @param businessService - * @param tenantId - * @param requestInfo - * @return returns a map with business code and businessDetail object - */ - private Map getBusinessService(Set businessService, String tenantId, RequestInfo requestInfo) { - List businessServiceDetails = businessServDetailService.searchBusinessServiceDetails(BusinessServiceDetailCriteria.builder().businessService(businessService).tenantId(tenantId).build(), requestInfo) - .getBusinessServiceDetails(); - return businessServiceDetails.stream().collect(Collectors.toMap(BusinessServiceDetail::getCode, Function.identity())); - } - - public BillResponse getBillResponse(List bills) { - BillResponse billResponse = new BillResponse(); - billResponse.setBill(bills); - return billResponse; - } - - /** - * Publishes the bill request to kafka topic and returns bill response - * - * @param billRequest - * @return billResponse object containing bills from the request - */ - public BillResponse sendBillToKafka(BillRequest billRequest) { - - try { - kafkaTemplate.send(appProps.getCreateBillTopic(), appProps.getCreateBillTopicKey(), billRequest); - } catch (Exception e) { - log.debug("BillService createAsync:" + e); - throw new CustomException("EGBS_BILL_SAVE_ERROR", e.getMessage()); - - } - return getBillResponse(billRequest.getBills()); - } - - public BillResponse create(BillRequest billRequest) { - billRepository.saveBill(billRequest); - return getBillResponse(billRequest.getBills()); - } - - - @Deprecated - public BillResponse apportion(BillRequest billRequest) { - return new BillResponse(responseFactory.getResponseInfo(billRequest.getRequestInfo(), HttpStatus.OK), billRepository.apportion(billRequest)); - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/BillServicev2.java b/business-services/billing-service/src/main/java/org/egov/demand/service/BillServicev2.java deleted file mode 100644 index 081c651e700..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/BillServicev2.java +++ /dev/null @@ -1,674 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.demand.service; - -import static org.egov.demand.util.Constants.BUSINESS_SERVICE_URL_PARAMETER; -import static org.egov.demand.util.Constants.CONSUMERCODES_REPLACE_TEXT; -import static org.egov.demand.util.Constants.TENANTID_REPLACE_TEXT; -import static org.egov.demand.util.Constants.URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_KEY; -import static org.egov.demand.util.Constants.URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_MSG; -import static org.egov.demand.util.Constants.URL_NOT_CONFIGURED_REPLACE_TEXT; -import static org.egov.demand.util.Constants.URL_PARAMS_FOR_SERVICE_BASED_DEMAND_APIS; -import static org.egov.demand.util.Constants.URL_PARAM_SEPERATOR; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.BillAccountDetailV2; -import org.egov.demand.model.BillDetailV2; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.BillV2; -import org.egov.demand.model.BillV2.BillStatus; -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.model.GenerateBillCriteria; -import org.egov.demand.model.TaxHeadMaster; -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.egov.demand.model.UpdateBillCriteria; -import org.egov.demand.model.UpdateBillRequest; -import org.egov.demand.producer.Producer; -import org.egov.demand.repository.BillRepositoryV2; -import org.egov.demand.repository.IdGenRepo; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequestV2; -import org.egov.demand.web.contract.BillResponseV2; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.User; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.egov.demand.web.validator.BillValidator; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class BillServicev2 { - - @Autowired - private KafkaTemplate kafkaTemplate; - - @Autowired - private ResponseFactory responseFactory; - - @Autowired - private ApplicationProperties appProps; - - @Autowired - private BillRepositoryV2 billRepository; - - @Autowired - private DemandService demandService; - - @Autowired - private BusinessServDetailService businessServDetailService; - - @Autowired - private TaxHeadMasterService taxHeadService; - - @Autowired - private Util util; - - @Autowired - private ServiceRequestRepository restRepository; - - @Autowired - private IdGenRepo idGenRepo; - - @Autowired - private BillValidator billValidator; - - @Autowired - private Producer producer; - - @Value("${kafka.topics.cancel.bill.topic.name}") - private String billCancelTopic; - - @Value("${kafka.topics.billgen.topic.name}") - private String notifTopicName; - - /** - * Cancell bill operation can be carried by this method, based on consumerCodes - * and businessService. - * - * Only ACTIVE bills will be cancelled as of now - * - * @param cancelBillCriteria - * @param requestInfoWrapper - */ - public Integer cancelBill(UpdateBillRequest updateBillRequest) { - - UpdateBillCriteria cancelBillCriteria = updateBillRequest.getUpdateBillCriteria(); - billValidator.validateBillSearchRequest(cancelBillCriteria); - Set consumerCodes = cancelBillCriteria.getConsumerCodes(); - cancelBillCriteria.setStatusToBeUpdated(BillStatus.CANCELLED); - - if (!CollectionUtils.isEmpty(consumerCodes) && consumerCodes.size() > 1) { - - throw new CustomException("EG_BS_CANCEL_BILL_ERROR", "Only one consumer code can be provided in the Cancel request"); - } else { - int result = billRepository.updateBillStatus(cancelBillCriteria); - sendNotificationForBillCancellation(updateBillRequest.getRequestInfo(), cancelBillCriteria); - return result; - } - } - - private void sendNotificationForBillCancellation(RequestInfo requestInfo, UpdateBillCriteria cancelBillCriteria) { - Set consumerCodes = cancelBillCriteria.getConsumerCodes(); - if(CollectionUtils.isEmpty(consumerCodes)) - return; - - List bills = billRepository.findBill(BillSearchCriteria.builder() - .service(cancelBillCriteria.getBusinessService()) - .tenantId(cancelBillCriteria.getTenantId()) - .consumerCode(consumerCodes) - .build()); - - if (CollectionUtils.isEmpty(bills)) - return; - - BillRequestV2 req = BillRequestV2.builder().bills(bills).requestInfo(requestInfo).build(); - producer.push(cancelBillCriteria.getTenantId(), billCancelTopic, req); - - } - - /** - * Fetches the bill for given parameters - * - * Searches the respective bill - * if nothing found then generates bill for the same criteria - * if bill found then checks the validity of the bill - * return the bill if valid - * else update the demands belonging to the bill then generate a new bill - * - * @param moduleCode - * @param consumerCodes - * @return - */ - public BillResponseV2 fetchBill(GenerateBillCriteria billCriteria, RequestInfoWrapper requestInfoWrapper) { - - RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); - billValidator.validateBillGenRequest(billCriteria, requestInfo); - if (CollectionUtils.isEmpty(billCriteria.getConsumerCode())) - billCriteria.setConsumerCode(new HashSet<>()); - BillResponseV2 res = searchBill(billCriteria.toBillSearchCriteria(), requestInfo); - List bills = res.getBill(); - - /* - * If no existing bills found then Generate new bill - */ - if (CollectionUtils.isEmpty(bills)) - return generateBill(billCriteria, requestInfo); - - /* - * Adding consumer-codes of unbilled demands to generate criteria - */ - if (!(StringUtils.isEmpty(billCriteria.getMobileNumber()) && StringUtils.isEmpty(billCriteria.getEmail()))) { - - List demands = demandService.getDemands(billCriteria.toDemandCriteria(), requestInfo); - billCriteria.getConsumerCode().addAll( - demands.stream().map(Demand::getConsumerCode).collect(Collectors.toSet())); - } - - log.debug("fetchBill--------going to generate new bill-------------------"); - Map consumerCodeAndBillMap = bills.stream().collect(Collectors.toMap(BillV2::getConsumerCode, Function.identity())); - billCriteria.getConsumerCode().addAll(consumerCodeAndBillMap.keySet()); - /* - * Collecting the businessService code and the list of consumer codes for those service codes - * whose demands needs to be updated. - * - * grouping by service code and collecting the list of - * consumerCodes against the service code - */ - List cosnumerCodesNotFoundInBill = new ArrayList<>(billCriteria.getConsumerCode()); - Set cosnumerCodesToBeExpired = new HashSet<>(); - List billsToBeReturned = new ArrayList<>(); - Boolean isBillExpired = false; - - for (Entry entry : consumerCodeAndBillMap.entrySet()) { - BillV2 bill = entry.getValue(); - - for (BillDetailV2 billDetail : bill.getBillDetails()) { - if (billDetail.getExpiryDate().compareTo(System.currentTimeMillis()) < 0) { - isBillExpired = true; - break; - } - } - if (!isBillExpired) - billsToBeReturned.add(bill); - else - cosnumerCodesToBeExpired.add(bill.getConsumerCode()); - cosnumerCodesNotFoundInBill.remove(entry.getKey()); - isBillExpired = false; - } - - /* - * If none of the billDetails in the bills needs to be updated then return the search result - */ - if(CollectionUtils.isEmpty(cosnumerCodesToBeExpired) && CollectionUtils.isEmpty(cosnumerCodesNotFoundInBill)) - return res; - else { - - billCriteria.getConsumerCode().retainAll(cosnumerCodesToBeExpired); - billCriteria.getConsumerCode().addAll(cosnumerCodesNotFoundInBill); - updateDemandsForexpiredBillDetails(billCriteria.getBusinessService(), billCriteria.getConsumerCode(), billCriteria.getTenantId(), requestInfoWrapper); - - billRepository.updateBillStatus( - UpdateBillCriteria.builder() - .statusToBeUpdated(BillStatus.EXPIRED) - .businessService(billCriteria.getBusinessService()) - .consumerCodes(cosnumerCodesToBeExpired) - .tenantId(billCriteria.getTenantId()) - .build() - ); - BillResponseV2 finalResponse = generateBill(billCriteria, requestInfo); - // gen bill returns immutable empty list incase of zero bills - billsToBeReturned.addAll(finalResponse.getBill()); - finalResponse.setBill(billsToBeReturned); - return finalResponse; - } - } - - /** - * To make calls to respective service which updates the demands belonging to - * the arguments passed - * - * @param serviceAndConsumerCodeListMap - * @param tenantId - */ - private void updateDemandsForexpiredBillDetails(String businessService, Set consumerCodesTobeUpdated, String tenantId, RequestInfoWrapper requestInfoWrapper) { - - Map serviceUrlMap = appProps.getBusinessCodeAndDemandUpdateUrlMap(); - - - String url = serviceUrlMap.get(businessService); - if (StringUtils.isEmpty(url)) { - - log.info(URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_KEY, URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_MSG - .replace(URL_NOT_CONFIGURED_REPLACE_TEXT, businessService)); - return; - } - - StringBuilder completeUrl = new StringBuilder(url) - .append(URL_PARAMS_FOR_SERVICE_BASED_DEMAND_APIS.replace(TENANTID_REPLACE_TEXT, tenantId).replace( - CONSUMERCODES_REPLACE_TEXT, consumerCodesTobeUpdated.toString().replace("[", "").replace("]", ""))); - - completeUrl.append(URL_PARAM_SEPERATOR).append(BUSINESS_SERVICE_URL_PARAMETER).append(businessService); - log.info("the url : " + completeUrl); - restRepository.fetchResult(completeUrl.toString(), requestInfoWrapper); - } - - - /** - * Searches the bills from DB for given criteria and enriches them with TaxAndPayments array - * - * @param billCriteria - * @param requestInfo - * @return - */ - public BillResponseV2 searchBill(BillSearchCriteria billCriteria, RequestInfo requestInfo) { - - List bills = billRepository.findBill(billCriteria); - - return BillResponseV2.builder().resposneInfo(responseFactory.getResponseInfo(requestInfo, HttpStatus.OK)) - .bill(bills).build(); - } - - /** - * Generate bill based on the given criteria - * - * @param billCriteria - * @param requestInfo - * @return - */ - public BillResponseV2 generateBill(GenerateBillCriteria billCriteria, RequestInfo requestInfo) { - - Set demandIds = new HashSet<>(); - Set consumerCodes = new HashSet<>(); - - if (billCriteria.getDemandId() != null) - demandIds.add(billCriteria.getDemandId()); - - if (billCriteria.getConsumerCode() != null) - consumerCodes.addAll(billCriteria.getConsumerCode()); - - DemandCriteria demandCriteria = DemandCriteria.builder() - .status(org.egov.demand.model.Demand.StatusEnum.ACTIVE.toString()) - .businessService(billCriteria.getBusinessService()) - .mobileNumber(billCriteria.getMobileNumber()) - .tenantId(billCriteria.getTenantId()) - .email(billCriteria.getEmail()) - .consumerCode(consumerCodes) - .isPaymentCompleted(false) - .receiptRequired(false) - .demandId(demandIds) - .build(); - - /* Fetching demands for the given bill search criteria */ - List demands = demandService.getDemands(demandCriteria, requestInfo); - - List bills; - - if (!demands.isEmpty()) - bills = prepareBill(demands, requestInfo); - else - return getBillResponse(Collections.emptyList()); - - BillRequestV2 billRequest = BillRequestV2.builder().bills(bills).requestInfo(requestInfo).build(); - //kafkaTemplate.send(notifTopicName, null, billRequest); - return create(billRequest); - } - - /** - * Prepares the bill object from the list of given demands - * - * @param demands demands for which bill should be generated - * @param requestInfo - * @return - */ - private List prepareBill(List demands, RequestInfo requestInfo) { - - - List bills = new ArrayList<>(); - User payer = null != demands.get(0).getPayer() ? demands.get(0).getPayer() : new User(); - - Map> tenatIdDemandsList = demands.stream().collect(Collectors.groupingBy(Demand::getTenantId)); - for (Entry> demandTenantEntry : tenatIdDemandsList.entrySet()) { - - /* - * Fetching Required master data - */ - String tenantId = demandTenantEntry.getKey(); - List demandForOneTenant = demandTenantEntry.getValue(); - Set businessCodes = new HashSet<>(); - Set taxHeadCodes = new HashSet<>(); - - for (Demand demand : demandForOneTenant) { - - businessCodes.add(demand.getBusinessService()); - demand.getDemandDetails().forEach(detail -> taxHeadCodes.add(detail.getTaxHeadMasterCode())); - } - - Map taxHeadMap = getTaxHeadMaster(taxHeadCodes, tenantId, requestInfo); - Map businessMap = getBusinessService(businessCodes, tenantId, requestInfo); - - - /* - * Grouping the demands by their consumer code and generating a bill for each consumer code - */ - Map> consumerCodeAndDemandsMap = demandForOneTenant.stream().collect(Collectors.groupingBy(Demand::getConsumerCode)); - - for (Entry> consumerCodeAndDemands : consumerCodeAndDemandsMap.entrySet()) { - - BigDecimal billAmount = BigDecimal.ZERO; - List billDetails = new ArrayList<>(); - - String consumerCode = consumerCodeAndDemands.getKey(); - BigDecimal minimumAmtPayableForBill = BigDecimal.ZERO; - List demandsForSingleCode = consumerCodeAndDemands.getValue(); - BusinessServiceDetail business = businessMap.get(demandsForSingleCode.get(0).getBusinessService()); - - String billId = UUID.randomUUID().toString(); - String billNumber = getBillNumbers(requestInfo, tenantId, demandForOneTenant.get(0).getBusinessService(), 1).get(0); - - for (Demand demand : demandsForSingleCode) { - - minimumAmtPayableForBill = minimumAmtPayableForBill.add(demand.getMinimumAmountPayable()); - String billDetailId = UUID.randomUUID().toString(); - BillDetailV2 billDetail = getBillDetailForDemand(demand, taxHeadMap, billDetailId); - billDetail.setBillId(billId); - billDetail.setId(billDetailId); - billDetails.add(billDetail); - billAmount = billAmount.add(billDetail.getAmount()); - } - - if (billAmount.compareTo(BigDecimal.ZERO) >= 0) { - - BillV2 bill = BillV2.builder() - .auditDetails(util.getAuditDetail(requestInfo)) - .payerAddress(payer.getPermanentAddress()) - .mobileNumber(payer.getMobileNumber()) - .billDate(System.currentTimeMillis()) - .businessService(business.getCode()) - .payerName(payer.getName()) - .consumerCode(consumerCode) - .status(BillStatus.ACTIVE) - .billDetails(billDetails) - .totalAmount(billAmount) - .billNumber(billNumber) - .tenantId(tenantId) - .id(billId) - .userId(payer.getUuid()) - .build(); - - bills.add(bill); - } - } - - } - return bills; - } - - private List getBillNumbers(RequestInfo requestInfo, String tenantId, String module, int count) { - - String billNumberFormat = appProps.getBillNumberFormat(); - billNumberFormat = billNumberFormat.replace(appProps.getModuleReplaceStirng(), module); - - if (appProps.getIsTenantLevelBillNumberingEnabled()) - billNumberFormat = billNumberFormat.replace(appProps.getTenantIdReplaceString(), "_".concat(tenantId.split("\\.")[tenantId.length()-1])); - else - billNumberFormat = billNumberFormat.replace(appProps.getTenantIdReplaceString(), ""); - - return idGenRepo.getId(requestInfo, tenantId, "billnumberid", billNumberFormat, count); - } - - - /** - * Method to create BillDetail object from demand - * - * @param demand - * @param taxHeadMap - * @param businessDetailMap - * @return - */ - private BillDetailV2 getBillDetailForDemand(Demand demand, Map taxHeadMap, String billDetailId) { - - Long startPeriod = demand.getTaxPeriodFrom(); - Long endPeriod = demand.getTaxPeriodTo(); - String tenantId = demand.getTenantId(); - - BigDecimal totalAmountForDemand = BigDecimal.ZERO; - - - /* - * Map to store the bill account detail object with TaxHead code - * To accommodate conversion of multiple DemandDetails with same tax head code to single BillAccountDetail - */ - Map taxCodeAccountdetailMap = new HashMap<>(); - - for(DemandDetail demandDetail : demand.getDemandDetails()) { - - TaxHeadMaster taxHead = taxHeadMap.get(demandDetail.getTaxHeadMasterCode()); - BigDecimal amountForAccDeatil = demandDetail.getTaxAmount().subtract(demandDetail.getCollectionAmount()); - - addOrUpdateBillAccDetailInTaxCodeAccDetailMap(taxCodeAccountdetailMap, demandDetail, taxHead, billDetailId); - - /* Total tax and collection for the whole demand/bill-detail */ - totalAmountForDemand = totalAmountForDemand.add(amountForAccDeatil); - } - - - Long billExpiryDate = getExpiryDateForDemand(demand); - - return BillDetailV2.builder() - .billAccountDetails(new ArrayList<>(taxCodeAccountdetailMap.values())) - .amount(totalAmountForDemand) - .expiryDate(billExpiryDate) - .demandId(demand.getId()) - .fromPeriod(startPeriod) - .toPeriod(endPeriod) - .tenantId(tenantId) - .additionalDetails(demand.getAdditionalDetails()) - .build(); - } - - /** - * @param demand - * - * @return expiryDate - */ - private Long getExpiryDateForDemand(Demand demand) { - - Long billExpiryPeriod = demand.getBillExpiryTime(); - Long fixedBillExpiryDate = demand.getFixedBillExpiryDate(); - Calendar cal = Calendar.getInstance(); - - if (!ObjectUtils.isEmpty(fixedBillExpiryDate) && fixedBillExpiryDate > cal.getTimeInMillis()) { - cal.setTimeInMillis(fixedBillExpiryDate); - } else if (!ObjectUtils.isEmpty(billExpiryPeriod) && 0 < billExpiryPeriod) { - cal.setTimeInMillis(cal.getTimeInMillis() + billExpiryPeriod); - } - - cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE), 23, 59, 59); - return cal.getTimeInMillis(); - } - - /** - * creates/ updates bill-account details based on the tax-head code in - * taxCodeAccDetailMap - * - * @param startPeriod - * @param endPeriod - * @param tenantId - * @param taxCodeAccDetailMap - * @param demandDetail - * @param taxHead - * @param amountForAccDeatil - */ - private void addOrUpdateBillAccDetailInTaxCodeAccDetailMap(Map taxCodeAccDetailMap, - DemandDetail demandDetail, TaxHeadMaster taxHead, String billDetailId) { - - BigDecimal newAmountForAccDeatil = demandDetail.getTaxAmount().subtract(demandDetail.getCollectionAmount()); - /* - * BAD - BillAccountDetail - * - * To handle repeating tax-head codes in demand - * - * And merge them in to single BAD - * - * if taxHeadCode found in map then add the amount to existing BAD - * - * else create and add a new BAD - */ - if (taxCodeAccDetailMap.containsKey(taxHead.getCode())) { - - BillAccountDetailV2 existingAccDetail = taxCodeAccDetailMap.get(taxHead.getCode()); - BigDecimal existingAmtForAccDetail = existingAccDetail.getAmount(); - existingAccDetail.setAmount(existingAmtForAccDetail.add(newAmountForAccDeatil)); - - } else { - - BillAccountDetailV2 accountDetail = BillAccountDetailV2.builder() - .demandDetailId(demandDetail.getId()) - .tenantId(demandDetail.getTenantId()) - .id(UUID.randomUUID().toString()) - .adjustedAmount(BigDecimal.ZERO) - .taxHeadCode(taxHead.getCode()) - .amount(newAmountForAccDeatil) - .order(taxHead.getOrder()) - .billDetailId(billDetailId) - .build(); - - taxCodeAccDetailMap.put(taxHead.getCode(), accountDetail); - } - } - - /** - * Fetches the tax-head master data for the given tax-head codes - * - * @param demands list of demands for which tax-heads needs to searched - * @param tenantId tenant-id of the request - * @param info RequestInfo object - * @return returns a map of tax-head code as key and tax-head object as value - */ - private Map getTaxHeadMaster(Set taxHeadCodes, String tenantId, RequestInfo info) { - - TaxHeadMasterCriteria taxHeadCriteria = TaxHeadMasterCriteria.builder().tenantId(tenantId).code(taxHeadCodes) - .build(); - List taxHeads = taxHeadService.getTaxHeads(taxHeadCriteria, info).getTaxHeadMasters(); - - if (taxHeads.isEmpty()) - throw new CustomException("EG_BS_TAXHEADCODE_EMPTY", "No taxhead masters found for the given codes"); - - return taxHeads.stream().collect(Collectors.toMap(TaxHeadMaster::getCode, Function.identity())); - } - - - /** - * To Fetch the businessServiceDetail master based on the business codes - * - * @param businessService - * @param tenantId - * @param requestInfo - * @return returns a map with business code and businessDetail object - */ - private Map getBusinessService(Set businessService, String tenantId, RequestInfo requestInfo) { - List businessServiceDetails = businessServDetailService.searchBusinessServiceDetails(BusinessServiceDetailCriteria.builder().businessService(businessService).tenantId(tenantId).build(), requestInfo) - .getBusinessServiceDetails(); - return businessServiceDetails.stream().collect(Collectors.toMap(BusinessServiceDetail::getCode, Function.identity())); - } - - public BillResponseV2 getBillResponse(List bills) { - BillResponseV2 billResponse = new BillResponseV2(); - billResponse.setBill(bills); - return billResponse; - } - - /** - * Publishes the bill request to kafka topic and returns bill response - * - * @param billRequest - * @return billResponse object containing bills from the request - */ - public BillResponseV2 sendBillToKafka(BillRequestV2 billRequest) { - - try { - kafkaTemplate.send(appProps.getCreateBillTopic(), appProps.getCreateBillTopicKey(), billRequest); - } catch (Exception e) { - log.debug("BillService createAsync:" + e); - throw new CustomException("EGBS_BILL_SAVE_ERROR", e.getMessage()); - - } - return getBillResponse(billRequest.getBills()); - } - - public BillResponseV2 create(BillRequestV2 billRequest) { - - if (!CollectionUtils.isEmpty(billRequest.getBills())) - billRepository.saveBill(billRequest); - return getBillResponse(billRequest.getBills()); - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/BusinessServDetailService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/BusinessServDetailService.java deleted file mode 100644 index f331e98d672..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/BusinessServDetailService.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.service; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.repository.BusinessServiceDetailRepository; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.egov.demand.web.contract.BusinessServiceDetailResponse; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Service; - -@Service -public class BusinessServDetailService { - - public static final Logger LOGGER = LoggerFactory.getLogger(BusinessServDetailService.class); - - @Autowired - private BusinessServiceDetailRepository businessServiceDetailRepository; - - @Autowired - private ResponseFactory responseInfoFactory; - - public BusinessServiceDetailResponse searchBusinessServiceDetails( - final BusinessServiceDetailCriteria businessServiceDetailCriteria, final RequestInfo requestInfo) { - - final List businessServiceDetails = businessServiceDetailRepository - .getBussinessServiceDetail(requestInfo,businessServiceDetailCriteria); - return getBusinessServiceDetailResponse(businessServiceDetails, requestInfo); - } - - - private BusinessServiceDetailResponse getBusinessServiceDetailResponse(final List businessServiceDetails, final RequestInfo requestInfo) { - final BusinessServiceDetailResponse businessServiceDetailResponse = new BusinessServiceDetailResponse(); - businessServiceDetailResponse.setBusinessServiceDetails(businessServiceDetails); - businessServiceDetailResponse.setResponseInfo(responseInfoFactory.getResponseInfo(requestInfo, HttpStatus.OK)); - return businessServiceDetailResponse; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java deleted file mode 100644 index bd77d7b15b6..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java +++ /dev/null @@ -1,518 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.service; - -import static org.egov.demand.util.Constants.ADVANCE_TAXHEAD_JSONPATH_CODE; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.amendment.model.Amendment; -import org.egov.demand.amendment.model.AmendmentCriteria; -import org.egov.demand.amendment.model.AmendmentUpdate; -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.ApportionDemandResponse; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.BillV2.BillStatus; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandApportionRequest; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.model.PaymentBackUpdateAudit; -import org.egov.demand.model.UpdateBillCriteria; -import org.egov.demand.repository.AmendmentRepository; -import org.egov.demand.repository.BillRepositoryV2; -import org.egov.demand.repository.DemandRepository; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.demand.util.DemandEnrichmentUtil; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.contract.DemandResponse; -import org.egov.demand.web.contract.User; -import org.egov.demand.web.contract.UserResponse; -import org.egov.demand.web.contract.UserSearchRequest; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.egov.demand.web.validator.DemandValidatorV1; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class DemandService { - - @Autowired - private DemandRepository demandRepository; - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - private ResponseFactory responseInfoFactory; - - @Autowired - private DemandEnrichmentUtil demandEnrichmentUtil; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Autowired - private AmendmentRepository amendmentRepository; - - @Autowired - private BillRepositoryV2 billRepoV2; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private Util util; - - @Autowired - private DemandValidatorV1 demandValidatorV1; - - /** - * Method to create new demand - * - * generates ids and saves to the repository - * - * @param demandRequest - * @return - */ - public DemandResponse create(DemandRequest demandRequest) { - - DocumentContext mdmsData = util.getMDMSData(demandRequest.getRequestInfo(), - demandRequest.getDemands().get(0).getTenantId()); - - demandValidatorV1.validatedemandForCreate(demandRequest, true, mdmsData); - - log.info("the demand request in create async : {}", demandRequest); - - RequestInfo requestInfo = demandRequest.getRequestInfo(); - List demands = demandRequest.getDemands(); - AuditDetails auditDetail = util.getAuditDetail(requestInfo); - - List amendmentUpdates = consumeAmendmentIfExists(demands, auditDetail); - generateAndSetIdsForNewDemands(demands, auditDetail); - - List demandsToBeCreated = new ArrayList<>(); - List demandToBeUpdated = new ArrayList<>(); - - String businessService = demandRequest.getDemands().get(0).getBusinessService(); - Boolean isAdvanceAllowed = util.getIsAdvanceAllowed(businessService, mdmsData); - - if(isAdvanceAllowed){ - apportionAdvanceIfExist(demandRequest,mdmsData,demandsToBeCreated,demandToBeUpdated); - } - else { - demandsToBeCreated.addAll(demandRequest.getDemands()); - } - - save(new DemandRequest(requestInfo,demandsToBeCreated)); - if (!CollectionUtils.isEmpty(amendmentUpdates)) - amendmentRepository.updateAmendment(amendmentUpdates, demandRequest.getDemands().get(0).getTenantId()); - - if(!CollectionUtils.isEmpty(demandToBeUpdated)) - update(new DemandRequest(requestInfo,demandToBeUpdated), null); - - billRepoV2.updateBillStatus( - UpdateBillCriteria.builder() - .statusToBeUpdated(BillStatus.EXPIRED) - .businessService(businessService) - .consumerCodes(demands.stream().map(Demand::getConsumerCode).collect(Collectors.toSet())) - .tenantId(demands.get(0).getTenantId()) - .build() - ); - return new DemandResponse(responseInfoFactory.getResponseInfo(requestInfo, HttpStatus.CREATED), demands); - } - - /** - * Method to generate and set ids, Audit details to the demand - * and demand-detail object - * - */ - private void generateAndSetIdsForNewDemands(List demands, AuditDetails auditDetail) { - - /* - * looping demands to set ids and collect demand details in another list - */ - for (Demand demand : demands) { - - String demandId = UUID.randomUUID().toString(); - String tenantId = demand.getTenantId(); - demand.setAuditDetails(auditDetail); - demand.setId(demandId); - - for (DemandDetail demandDetail : demand.getDemandDetails()) { - - if (Objects.isNull(demandDetail.getCollectionAmount())) - demandDetail.setCollectionAmount(BigDecimal.ZERO); - demandDetail.setId(UUID.randomUUID().toString()); - demandDetail.setAuditDetails(auditDetail); - demandDetail.setTenantId(tenantId); - demandDetail.setDemandId(demandId); - } - } - } - - - /** - * Update method for demand flow - * - * updates the existing demands and inserts in case of new - * - * @param demandRequest demand request object to be updated - * @return - */ - public DemandResponse updateAsync(DemandRequest demandRequest, PaymentBackUpdateAudit paymentBackUpdateAudit) { - - log.debug("the demand service : " + demandRequest); - DocumentContext mdmsData = util.getMDMSData(demandRequest.getRequestInfo(), - demandRequest.getDemands().get(0).getTenantId()); - - demandValidatorV1.validateForUpdate(demandRequest, mdmsData); - - RequestInfo requestInfo = demandRequest.getRequestInfo(); - List demands = demandRequest.getDemands(); - AuditDetails auditDetail = util.getAuditDetail(requestInfo); - - List newDemands = new ArrayList<>(); - - for (Demand demand : demands) { - - String demandId = demand.getId(); - - if (StringUtils.isEmpty(demandId)) { - /* - * If demand id is empty then gen new demand Id - */ - newDemands.add(demand); - } else { - - demand.setAuditDetails(auditDetail); - for (DemandDetail detail : demand.getDemandDetails()) { - - if (StringUtils.isEmpty(detail.getId())) { - /* - * If id is empty for demand detail treat it as new - */ - detail.setId(UUID.randomUUID().toString()); - detail.setCollectionAmount(BigDecimal.ZERO); - } - detail.setAuditDetails(auditDetail); - detail.setDemandId(demandId); - detail.setTenantId(demand.getTenantId()); - } - } - util.updateDemandPaymentStatus(demand, null != paymentBackUpdateAudit); - } - - generateAndSetIdsForNewDemands(newDemands, auditDetail); - - update(demandRequest, paymentBackUpdateAudit); - String businessService = demands.get(0).getBusinessService(); - String tenantId = demands.get(0).getTenantId(); - - UpdateBillCriteria updateBillCriteria = UpdateBillCriteria.builder() - .consumerCodes(demands.stream().map(Demand::getConsumerCode).collect(Collectors.toSet())) - .businessService(businessService) - .tenantId(tenantId) - .build(); - - if (ObjectUtils.isEmpty(paymentBackUpdateAudit)) { - - updateBillCriteria.setStatusToBeUpdated(BillStatus.EXPIRED); - billRepoV2.updateBillStatus(updateBillCriteria); - } else { - - updateBillCriteria.setStatusToBeUpdated(BillStatus.PAID); - billRepoV2.updateBillStatus(updateBillCriteria); - } - // producer.push(applicationProperties.getDemandIndexTopic(), demandRequest); - return new DemandResponse(responseInfoFactory.getResponseInfo(requestInfo, HttpStatus.CREATED), demands); - } - - - /** - * Search method to fetch demands from DB - * - * @param demandCriteria - * @param requestInfo - * @return - */ - public List getDemands(DemandCriteria demandCriteria, RequestInfo requestInfo) { - - demandValidatorV1.validateDemandCriteria(demandCriteria, requestInfo); - - UserSearchRequest userSearchRequest = null; - List payers = null; - List demands = null; - - String userUri = applicationProperties.getUserServiceHostName() - .concat(applicationProperties.getUserServiceSearchPath()); - - /* - * user type is CITIZEN by default because only citizen can have demand or payer can be null - */ - String citizenTenantId = demandCriteria.getTenantId().split("\\.")[0]; - - /* - * If payer related data is provided first then user search has to be made first followed by demand search - */ - if (demandCriteria.getEmail() != null || demandCriteria.getMobileNumber() != null) { - - userSearchRequest = UserSearchRequest.builder().requestInfo(requestInfo) - .tenantId(citizenTenantId).emailId(demandCriteria.getEmail()) - .mobileNumber(demandCriteria.getMobileNumber()).build(); - - payers = mapper.convertValue(serviceRequestRepository.fetchResult(userUri, userSearchRequest), UserResponse.class).getUser(); - - if(CollectionUtils.isEmpty(payers)) - return new ArrayList<>(); - - Set ownerIds = payers.stream().map(User::getUuid).collect(Collectors.toSet()); - demandCriteria.setPayer(ownerIds); - demands = demandRepository.getDemands(demandCriteria); - - } else { - - /* - * If no payer related data given then search demand first then enrich payer(user) data - */ - demands = demandRepository.getDemands(demandCriteria); - if (!demands.isEmpty()) { - - Set payerUuids = demands.stream().filter(demand -> null != demand.getPayer()) - .map(demand -> demand.getPayer().getUuid()).collect(Collectors.toSet()); - - if (!CollectionUtils.isEmpty(payerUuids)) { - - userSearchRequest = UserSearchRequest.builder().requestInfo(requestInfo).uuid(payerUuids).build(); - - payers = mapper.convertValue(serviceRequestRepository.fetchResult(userUri, userSearchRequest), - UserResponse.class).getUser(); - } - } - } - - if (!CollectionUtils.isEmpty(demands) && !CollectionUtils.isEmpty(payers)) - demands = demandEnrichmentUtil.enrichPayer(demands, payers); - - return demands; - } - - public void save(DemandRequest demandRequest) { - demandRepository.save(demandRequest); - } - - public void update(DemandRequest demandRequest, PaymentBackUpdateAudit paymentBackUpdateAudit) { - demandRepository.update(demandRequest, paymentBackUpdateAudit); - } - - - /** - * Calls the demand apportion API if any advance amoount is available for that comsumer code - * @param demandRequest The demand request for create - * @param mdmsData The master data for billing service - * @param demandToBeCreated The list which maintains the demand that has to be created in the system - * @param demandToBeUpdated The list which maintains the demand that has to be updated in the system - */ - private void apportionAdvanceIfExist(DemandRequest demandRequest, DocumentContext mdmsData,List demandToBeCreated,List demandToBeUpdated){ - List demands = demandRequest.getDemands(); - RequestInfo requestInfo = demandRequest.getRequestInfo(); - - for(Demand demand : demands) { - String businessService = demand.getBusinessService(); - String consumerCode = demand.getConsumerCode(); - String tenantId = demand.getTenantId(); - - // Searching demands based on consumer code of the current demand (demand which has to be created) - DemandCriteria searchCriteria = DemandCriteria.builder().tenantId(tenantId).consumerCode(Collections.singleton(consumerCode)).businessService(businessService).build(); - List demandsFromSearch = demandRepository.getDemands(searchCriteria); - - // If no demand is found means there is no advance available. The current demand is added for creation - if (CollectionUtils.isEmpty(demandsFromSearch)){ - demandToBeCreated.add(demand); - continue; - } - - // Fetch the demands containing advance amount - List demandsToBeApportioned = getDemandsContainingAdvance(demandsFromSearch, mdmsData); - - // If no demand is found with advance amount the code continues to next demand and adds the current demand for creation - if(CollectionUtils.isEmpty(demandsToBeApportioned)){ - demandToBeCreated.add(demand); - continue; - } - - // The current demand is added to get apportioned - demandsToBeApportioned.add(demand); - - DemandApportionRequest apportionRequest = DemandApportionRequest.builder().requestInfo(requestInfo).demands(demandsToBeApportioned).tenantId(tenantId).build(); - - Object response = serviceRequestRepository.fetchResult(util.getApportionURL(), apportionRequest); - ApportionDemandResponse apportionDemandResponse = mapper.convertValue(response, ApportionDemandResponse.class); - - // Only the current demand is to be created rest all are to be updated - apportionDemandResponse.getDemands().forEach(demandFromResponse -> { - if(demandFromResponse.getId().equalsIgnoreCase(demand.getId())) - demandToBeCreated.add(demandFromResponse); - else demandToBeUpdated.add(demandFromResponse); - }); - } - - } - - - /** - * Returns demands which has advance amount avaialable for apportion - * @param demands List of demands from which demands with advance has to be picked - * @param mdmsData Master Data for billing service - * @return - */ - private List getDemandsContainingAdvance(List demands,DocumentContext mdmsData){ - - Set demandsWithAdvance = new HashSet<>(); - - // Create the jsonPath to fetch the advance taxhead for the given businessService - String businessService = demands.get(0).getBusinessService(); - String jsonpath = ADVANCE_TAXHEAD_JSONPATH_CODE; - jsonpath = jsonpath.replace("{}",businessService); - - // Apply the jsonPath on the master Data to fetch the value. The output will be an array with single element - List taxHeads = mdmsData.read(jsonpath); - - if(CollectionUtils.isEmpty(taxHeads)) - throw new CustomException("NO TAXHEAD FOUND","No Advance taxHead found for businessService: "+businessService); - - String advanceTaxHeadCode = taxHeads.get(0); - - /* - * Loop through each demand and each demandDetail to find the demandDetail for which advance amount is available - * */ - - for (Demand demand : demands){ - - for(DemandDetail demandDetail : demand.getDemandDetails()){ - - if(demandDetail.getTaxHeadMasterCode().equalsIgnoreCase(advanceTaxHeadCode) - && demandDetail.getTaxAmount().compareTo(demandDetail.getCollectionAmount()) != 0){ - demandsWithAdvance.add(demand); - break; - } - } - } - - return new ArrayList<>(demandsWithAdvance); - } - - /** - * Method to add demand details from amendment if exists in DB - * @param demandRequest - */ - private List consumeAmendmentIfExists(List demands, AuditDetails auditDetails) { - - List updateListForConsumedAmendments = new ArrayList<>(); - Set consumerCodes = demands.stream().map(Demand::getConsumerCode).collect(Collectors.toSet()); - - /* - * Search amendments for all consumer-codes and keep in map of list based on consumer-codes - */ - AmendmentCriteria amendmentCriteria = AmendmentCriteria.builder() - .tenantId(demands.get(0).getTenantId()) - .status(Stream.of(AmendmentStatus.ACTIVE.toString()).collect(Collectors.toSet())) - .consumerCode(consumerCodes) - .build(); - List amendmentsFromSearch = amendmentRepository.getAmendments(amendmentCriteria); - Map> mapOfConsumerCodeAndAmendmentsList = amendmentsFromSearch.stream() - .collect(Collectors.groupingBy(Amendment::getConsumerCode)); - - /* - * Add demand-details in to demand from all amendments existing for that consumer-code - * - * Add the amendment to update list for consumed - */ - for (Demand demand : demands) { - - - List amendments = mapOfConsumerCodeAndAmendmentsList.get(demand.getConsumerCode()); - if (CollectionUtils.isEmpty(amendments)) - continue; - - for (Amendment amendment : amendments) { - - demand.getDemandDetails().addAll(amendment.getDemandDetails()); - - AmendmentUpdate amendmentUpdate = AmendmentUpdate.builder() - .additionalDetails(amendment.getAdditionalDetails()) - .amendedDemandId(demand.getId()) - .amendmentId(amendment.getAmendmentId()) - .auditDetails(auditDetails) - .status(AmendmentStatus.CONSUMED) - .tenantId(demand.getTenantId()) - .build(); - updateListForConsumedAmendments.add(amendmentUpdate); - } - } - - return updateListForConsumedAmendments; - } - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/ReceiptService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/ReceiptService.java deleted file mode 100644 index 69de295b2be..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/ReceiptService.java +++ /dev/null @@ -1,277 +0,0 @@ -package org.egov.demand.service; - -import java.math.BigDecimal; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.Bill; -import org.egov.demand.model.BillAccountDetail; -import org.egov.demand.model.BillDetail; -import org.egov.demand.model.BillDetail.StatusEnum; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.contract.ReceiptRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class ReceiptService { - - @Autowired - private DemandService demandService; - - - public void updateDemandFromReceipt(ReceiptRequest receiptRequest, StatusEnum status, Boolean isReceiptCancellation) { - - if (null != receiptRequest && CollectionUtils.isEmpty(receiptRequest.getReceipt()) - || Objects.isNull(receiptRequest) - || CollectionUtils.isEmpty(receiptRequest.getReceipt().get(0).getBill())) { - - log.info(" no data found in receipt for update : {} " + receiptRequest); - return; - } - - List bills = receiptRequest.getReceipt().get(0).getBill(); - - Set demandIds = new HashSet<>(); - bills.forEach(bill -> bill.getBillDetails().forEach(billDetail -> { - demandIds.add(billDetail.getDemandId()); - billDetail.setStatus(status); - })); - - BillRequest billRequest = BillRequest.builder().requestInfo(receiptRequest.getRequestInfo()).bills(bills) - .build(); - updateDemandFromBill(billRequest,demandIds, isReceiptCancellation); - } - - /** - * Update the demand collection details based on the bill - * - * @param billRequest - * @param demandIds - * @param isReceiptCancellation - * @return - */ - public void updateDemandFromBill(BillRequest billRequest,Set demandIds, Boolean isReceiptCancellation) { - - List bills = billRequest.getBills(); - String tenantId = bills.get(0).getTenantId(); - RequestInfo requestInfo = billRequest.getRequestInfo(); - - DemandCriteria demandCriteria = DemandCriteria.builder().demandId(demandIds).tenantId(tenantId).build(); - List demandsToBeUpdated = demandService.getDemands(demandCriteria, requestInfo); - Map demandIdMap = demandsToBeUpdated.stream() - .collect(Collectors.toMap(Demand::getId, Function.identity())); - - for(Bill bill : bills) { - - for (BillDetail billDetail : bill.getBillDetails()) - updateDemandFromBillDetail(billDetail, demandIdMap.get(billDetail.getDemandId()), isReceiptCancellation); - - } - - demandService.updateAsync(DemandRequest.builder().demands(demandsToBeUpdated).requestInfo(billRequest.getRequestInfo()).build(), null); - } - - /** - * Updates the collection amount in the incoming demand object based on the billDetail object - * - * @param demandIdMap - * @param billDetail - */ - private void updateDemandFromBillDetail(BillDetail billDetail, Demand demand, Boolean isRecieptCancellation) { - - Map> taxHeadCodeDemandDetailgroup = demand.getDemandDetails().stream() - .collect(Collectors.groupingBy(DemandDetail::getTaxHeadMasterCode)); - - for (BillAccountDetail billAccDetail : billDetail.getBillAccountDetails()) { - - /* Ignoring billaccount details with no taxhead codes - * to avoid saving collection only information - */ - if(null == billAccDetail.getTaxHeadCode()) return; - - List currentDetails = taxHeadCodeDemandDetailgroup.get(billAccDetail.getTaxHeadCode()); - Collections.sort(currentDetails, Comparator.comparing(DemandDetail::getTaxAmount)); - - int length = 0; - - if (!CollectionUtils.isEmpty(currentDetails)) - length = currentDetails.size(); - - /* - * if single demand detail corresponds to single billAccountDetail then update directly - */ - if (length == 1) { - - updateSingleDemandDetail(currentDetails.get(0), billAccDetail, isRecieptCancellation); - } - /* - * if multiple demandDetails point to one BillAccountDetial - */ - else if (length > 1) { - - updateMultipleDemandDetails(currentDetails, billAccDetail, isRecieptCancellation); - } else { - - /* - * if no demand detail found for the corresponding billAccountDetail - * then add the new DemandDetail in the demand - */ - DemandDetail newAdvanceDetail = DemandDetail.builder() - .taxHeadMasterCode(billAccDetail.getTaxHeadCode()) - .taxAmount(billAccDetail.getAmount()) - .collectionAmount(BigDecimal.ZERO) - .tenantId(demand.getTenantId()) - .demandId(demand.getId()) - .build(); - - demand.getDemandDetails().add(newAdvanceDetail); - } - } - } - - - /** - * Method to handle update if single demandDetail is presnt for a BillAccountDetail - * - * @param currentDetail the demand detail object to be updated - * - * @param billAccDetail bill account detail object from which values - * needs to fetched - * - * @param isRecieptCancellation if the call is made for payment or cancellation - */ - private void updateSingleDemandDetail(DemandDetail currentDetail, BillAccountDetail billAccDetail, - Boolean isRecieptCancellation) { - - BigDecimal oldCollectedAmount = currentDetail.getCollectionAmount(); - BigDecimal newAmount = billAccDetail.getAdjustedAmount(); - - if (isRecieptCancellation) - currentDetail.setCollectionAmount(oldCollectedAmount.subtract(newAmount)); - else - currentDetail.setCollectionAmount(oldCollectedAmount.add(newAmount)); - } - - - /** - * Method to handle update if multiple demand details are present for a single Bill account detail - * - * @param demandDetails List of demand details to updated - * @param billAccDetail the bill account detail with the paid-amount/Adjusted amount - * @param isRecieptCancellation to identify if the method call is for payment or cancellation - */ - private void updateMultipleDemandDetails(List demandDetails, BillAccountDetail billAccDetail, - Boolean isRecieptCancellation) { - - BigDecimal amtPaid = billAccDetail.getAdjustedAmount(); - - if (!isRecieptCancellation) - updateDetailsForPayment(demandDetails, amtPaid); - else - updateDetailsForCancellation(demandDetails, amtPaid); - - } - - /** - * Method to handle receipt cancellation in case of multiple Demand detail present for a single billAccountDetail - * - * @param demandDetails List of details to be updated - * - * @param amtPaid Adjusted amount from bill Acc detail - */ - private void updateDetailsForCancellation(List demandDetails, BigDecimal amtPaid) { - - for (DemandDetail detail : demandDetails) { - - if (amtPaid.compareTo(BigDecimal.ZERO) == 0) - return; - - /* - * amount to be set in collectionAmount field of demandDetail after adjustments - */ - BigDecimal resultantCollectionAmt; - - BigDecimal currentDetailCollectionAmt = detail.getCollectionAmount(); - - if (currentDetailCollectionAmt.compareTo(amtPaid) >= 0) { - - resultantCollectionAmt = currentDetailCollectionAmt.subtract(amtPaid); - amtPaid = BigDecimal.ZERO; - } else { - - resultantCollectionAmt = BigDecimal.ZERO; - amtPaid = amtPaid.subtract(currentDetailCollectionAmt); - } - - detail.setCollectionAmount(resultantCollectionAmt); - } - } - - /** - * Method to handle payment in case of multiple Demand details present for a - * single billAccountDetail - * - * @param demandDetails List of details to be updated - * - * @param amountPaid Adjusted amount from bill Acc detail - */ - private void updateDetailsForPayment(List demandDetails, BigDecimal amountPaid) { - - for (DemandDetail detail : demandDetails) { - - if (amountPaid.compareTo(BigDecimal.ZERO) == 0) - return; - - if(detail.getTaxAmount().compareTo(detail.getCollectionAmount()) == 0 || detail.getTaxAmount().compareTo(BigDecimal.ZERO) == 0) - continue; - /* - * amount to be set in collectionAmount field of demandDetail after adjustments - */ - BigDecimal resultantCollectionAmt; - - BigDecimal currentDetailTax = detail.getTaxAmount(); - BigDecimal currentDetailCollection = detail.getCollectionAmount(); - - BigDecimal currentDetailTaxCollectionDifference = currentDetailTax.subtract(currentDetailCollection); - - /* - * if current demandDetail difference is lesser than incoming amount of - * - * BillAccountDetail, then add the whole value to result - */ - if (currentDetailTaxCollectionDifference.compareTo(amountPaid) >= 0) { - - resultantCollectionAmt = currentDetailCollection.add(amountPaid); - amountPaid = BigDecimal.ZERO; - } else { - /* - * if difference of demandDetail is lesser than Incoming amount, then add the - * - * difference to resulantAmount and subtract the same from incoming amount - */ - resultantCollectionAmt = currentDetailCollection.add(currentDetailTaxCollectionDifference); - amountPaid = amountPaid.subtract(currentDetailTaxCollectionDifference); - } - - detail.setCollectionAmount(resultantCollectionAmt); - } - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/ReceiptServiceV2.java b/business-services/billing-service/src/main/java/org/egov/demand/service/ReceiptServiceV2.java deleted file mode 100644 index 609d9af829e..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/ReceiptServiceV2.java +++ /dev/null @@ -1,352 +0,0 @@ -package org.egov.demand.service; - -import static org.egov.demand.util.Constants.ADVANCE_TAXHEAD_JSONPATH_CODE; -import static org.egov.demand.util.Constants.MDMS_CODE_FILTER; -import static org.egov.demand.util.Constants.MODULE_NAME; -import static org.egov.demand.util.Constants.TAXHEAD_MASTERNAME; - -import java.math.BigDecimal; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.BillAccountDetailV2; -import org.egov.demand.model.BillDetailV2; -import org.egov.demand.model.BillV2; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.model.PaymentBackUpdateAudit; -import org.egov.demand.util.Constants; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequestV2; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.validator.DemandValidatorV1; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import com.jayway.jsonpath.DocumentContext; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class ReceiptServiceV2 { - - @Autowired - private DemandService demandService; - - @Autowired - DemandValidatorV1 demandValidatorV1; - - @Autowired - private Util util; - - - public void updateDemandFromReceipt(BillRequestV2 billReq, Boolean isReceiptCancellation) { - - if (billReq == null || billReq != null && CollectionUtils.isEmpty(billReq.getBills())) { - - log.info(" no data found in payment for update : {} " + billReq); - return; - } - - Set demandIds = new HashSet<>(); - billReq.getBills().forEach(bill -> { - - bill.getBillDetails().forEach(billDetail -> { - demandIds.add(billDetail.getDemandId()); - }); - }); - - - updateDemandFromBill(billReq,demandIds, isReceiptCancellation); - } - - /** - * Update the demand collection details based on the bill - * - * @param billRequest - * @param demandIds - * @param isReceiptCancellation - * @return - */ - public void updateDemandFromBill(BillRequestV2 billRequest,Set demandIds, Boolean isReceiptCancellation) { - - List bills = billRequest.getBills(); - String tenantId = bills.get(0).getTenantId(); - RequestInfo requestInfo = billRequest.getRequestInfo(); - Map mapOfBillIdAndStatus = new HashMap<>(); - - DemandCriteria demandCriteria = DemandCriteria.builder().demandId(demandIds).tenantId(tenantId).build(); - List demandsToBeUpdated = demandService.getDemands(demandCriteria, requestInfo); - Map demandIdMap = demandsToBeUpdated.stream().collect(Collectors.toMap(Demand::getId, Function.identity())); - DocumentContext mdmsData = getTaxHeadMaster(tenantId,billRequest.getRequestInfo()); - - for (BillV2 bill : bills) { - String advanceTaxhead = getAdvanceTaxhead(bill.getBusinessService(), mdmsData); - mapOfBillIdAndStatus.put(bill.getId(), bill.getStatus().toString()); - for (BillDetailV2 billDetail : bill.getBillDetails()) - updateDemandFromBillDetail(billDetail, demandIdMap.get(billDetail.getDemandId()), isReceiptCancellation,advanceTaxhead); - } - - String paymentId = util.getValueFromAdditionalDetailsForKey(bills.get(0).getAdditionalDetails(), - Constants.PAYMENT_ID_KEY); - - PaymentBackUpdateAudit paymentBackUpdateAudit = PaymentBackUpdateAudit.builder() - .isReceiptCancellation(isReceiptCancellation) - .isBackUpdateSucces(true) - .paymentId(paymentId) - .tenantId(tenantId) - .build(); - - DemandRequest demandRequest = DemandRequest.builder() - .requestInfo(billRequest.getRequestInfo()) - .demands(demandsToBeUpdated) - .build(); - - demandService.updateAsync(demandRequest, paymentBackUpdateAudit); - - } - - /** - * Updates the collection amount in the incoming demand object based on the billDetail object - * - * @param billDetail - */ - private void updateDemandFromBillDetail(BillDetailV2 billDetail, Demand demand, Boolean isRecieptCancellation, String advanceTaxHead) { - - if(billDetail.getAmount().compareTo(BigDecimal.ZERO) != 0 - && billDetail.getAmountPaid().compareTo(BigDecimal.ZERO) == 0) - return; - - Map> taxHeadCodeDemandDetailgroup = demand.getDemandDetails().stream() - .collect(Collectors.groupingBy(DemandDetail::getTaxHeadMasterCode)); - - for (BillAccountDetailV2 billAccDetail : billDetail.getBillAccountDetails()) { - - /* Ignoring billaccount details with no taxhead codes - * to avoid saving collection only information - */ - if(null == billAccDetail.getTaxHeadCode()) return; - - List currentDetails = taxHeadCodeDemandDetailgroup.get(billAccDetail.getTaxHeadCode()); - - int length = 0; - - if (!CollectionUtils.isEmpty(currentDetails)) { - length = currentDetails.size(); - Collections.sort(currentDetails, Comparator.comparing(DemandDetail::getTaxAmount)); - } - - /* - * if single demand detail corresponds to single billAccountDetail then update directly - */ - if (length == 1) { - - updateSingleDemandDetail(currentDetails.get(0), billAccDetail, isRecieptCancellation, advanceTaxHead); - } - /* - * if multiple demandDetails point to one BillAccountDetial - */ - else if (length > 1) { - - updateMultipleDemandDetails(currentDetails, billAccDetail, isRecieptCancellation); - } else { - - /* - * if no demand detail found for the corresponding billAccountDetail - * then add the new DemandDetail in the demand - */ - DemandDetail newAdvanceDetail = DemandDetail.builder() - .taxHeadMasterCode(billAccDetail.getTaxHeadCode()) - .taxAmount(billAccDetail.getAmount()) - .collectionAmount(BigDecimal.ZERO) - .tenantId(demand.getTenantId()) - .demandId(demand.getId()) - .build(); - - demand.getDemandDetails().add(newAdvanceDetail); - } - } - } - - - /** - * Method to handle update if single demandDetail is presnt for a BillAccountDetail - * - * @param currentDetail the demand detail object to be updated - * - * @param billAccDetail bill account detail object from which values - * needs to fetched - * - * @param isRecieptCancellation if the call is made for payment or cancellation - */ - private void updateSingleDemandDetail(DemandDetail currentDetail, BillAccountDetailV2 billAccDetail, - Boolean isRecieptCancellation, String advanceTaxHead) { - - BigDecimal oldCollectedAmount = currentDetail.getCollectionAmount(); - BigDecimal newAmount = billAccDetail.getAdjustedAmount(); - - if(advanceTaxHead!=null && billAccDetail.getTaxHeadCode().equalsIgnoreCase(advanceTaxHead)) - currentDetail.setTaxAmount(billAccDetail.getAmount().add(oldCollectedAmount)); - - if (isRecieptCancellation) - currentDetail.setCollectionAmount(oldCollectedAmount.subtract(newAmount)); - else - currentDetail.setCollectionAmount(oldCollectedAmount.add(newAmount)); - } - - - /** - * Method to handle update if multiple demand details are present for a single Bill account detail - * - * @param demandDetails List of demand details to updated - * @param billAccDetail the bill account detail with the paid-amount/Adjusted amount - * @param isRecieptCancellation to identify if the method call is for payment or cancellation - */ - private void updateMultipleDemandDetails(List demandDetails, BillAccountDetailV2 billAccDetail, - Boolean isRecieptCancellation) { - - BigDecimal amtPaid = billAccDetail.getAdjustedAmount(); - - if (!isRecieptCancellation) - updateDetailsForPayment(demandDetails, amtPaid); - else - updateDetailsForCancellation(demandDetails, amtPaid); - - } - - /** - * Method to handle receipt cancellation in case of multiple Demand detail present for a single billAccountDetail - * - * The incoming list of demand details are sorted in Ascending to aid adjusting negative values first - * - * @param demandDetails List of details to be updated - * - * @param amtPaid Adjusted amount from bill Acc detail - */ - private void updateDetailsForCancellation(List demandDetails, BigDecimal amtPaid) { - - if (amtPaid.compareTo(BigDecimal.ZERO) == 0) - return; - - for (DemandDetail detail : demandDetails) { - - if(detail.getTaxAmount().compareTo(BigDecimal.ZERO) == 0) - continue; - /* - * amount to be set in collectionAmount field of demandDetail after adjustments - */ - BigDecimal resultantCollectionAmt; - - BigDecimal currentDetailCollectionAmt = detail.getCollectionAmount(); - Boolean isTaxPositive = detail.getTaxAmount().compareTo(BigDecimal.ZERO) > 0; - - if (isTaxPositive && currentDetailCollectionAmt.compareTo(amtPaid) >= 0) { - - resultantCollectionAmt = currentDetailCollectionAmt.subtract(amtPaid); - amtPaid = BigDecimal.ZERO; - } else { - - resultantCollectionAmt = BigDecimal.ZERO; - amtPaid = amtPaid.subtract(currentDetailCollectionAmt); - } - - detail.setCollectionAmount(resultantCollectionAmt); - } - } - - /** - * Method to handle payment in case of multiple Demand details present for a - * single billAccountDetail - * - * The incoming list of demand details are sorted in Ascending to aid adjusting negative values first - * - * @param demandDetails List of details to be updated - * - * @param amountPaid Adjusted amount from bill Acc detail - */ - private void updateDetailsForPayment(List demandDetails, BigDecimal amountPaid) { - - for (DemandDetail detail : demandDetails) { - - if(detail.getTaxAmount().compareTo(detail.getCollectionAmount()) == 0 || detail.getTaxAmount().compareTo(BigDecimal.ZERO) == 0) - continue; - /* - * amount to be set in collectionAmount field of demandDetail after adjustments - */ - BigDecimal resultantCollectionAmt; - - BigDecimal currentDetailTax = detail.getTaxAmount(); - BigDecimal currentDetailCollection = detail.getCollectionAmount(); - - BigDecimal currentDetailTaxCollectionDifference = currentDetailTax.subtract(currentDetailCollection); - Boolean isTaxPositive = detail.getTaxAmount().compareTo(BigDecimal.ZERO) > 0; - /* - * if current demandDetail i sPositive AND difference is lesser than incoming amount of - * - * BillAccountDetail, then add the whole value to result - * - * In case of negative value the exact tax will be adjusted. - */ - if (isTaxPositive && currentDetailTaxCollectionDifference.compareTo(amountPaid) >= 0) { - - resultantCollectionAmt = currentDetailCollection.add(amountPaid); - amountPaid = BigDecimal.ZERO; - } else { - /* - * if difference of demandDetail is lesser than Incoming amount, then add the - * - * difference to resulantAmount and subtract the same from incoming amount - */ - resultantCollectionAmt = currentDetailCollection.add(currentDetailTaxCollectionDifference); - amountPaid = amountPaid.subtract(currentDetailTaxCollectionDifference); - } - - detail.setCollectionAmount(resultantCollectionAmt); - } - } - - - /** - * Fetches the required master data from MDMS service - * @return - */ - private DocumentContext getTaxHeadMaster(String tenantId, RequestInfo requestInfo){ - /* - * Preparing the mdms request with billing service master and calling the mdms search API - */ - MdmsCriteriaReq mdmsReq = util.prepareMdMsRequest(tenantId, MODULE_NAME, Collections.singletonList(TAXHEAD_MASTERNAME), MDMS_CODE_FILTER, - requestInfo); - DocumentContext mdmsData = util.getAttributeValues(mdmsReq); - - return mdmsData; - } - - - private String getAdvanceTaxhead(String businessService, DocumentContext mdmsData){ - // Create the jsonPath to fetch the advance taxhead for the given businessService - String jsonpath = ADVANCE_TAXHEAD_JSONPATH_CODE; - jsonpath = jsonpath.replace("{}",businessService); - - List taxHeads = mdmsData.read(jsonpath); - - if(CollectionUtils.isEmpty(taxHeads)) - return null; - - String advanceTaxHeadCode = taxHeads.get(0); - - return advanceTaxHeadCode; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/TaxHeadMasterService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/TaxHeadMasterService.java deleted file mode 100644 index 496824489da..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/TaxHeadMasterService.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.demand.service; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.TaxHeadMaster; -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.egov.demand.repository.TaxHeadMasterRepository; -import org.egov.demand.web.contract.TaxHeadMasterResponse; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class TaxHeadMasterService { - - - @Autowired - private ResponseFactory responseInfoFactory; - - @Autowired - private TaxHeadMasterRepository taxHeadMasterRepository; - - public TaxHeadMasterResponse getTaxHeads(TaxHeadMasterCriteria searchTaxHead, RequestInfo requestInfo) { - log.info("TaxHeadMasterService getTaxHeads"); - List taxHeadMaster = taxHeadMasterRepository.getTaxHeadMaster(requestInfo,searchTaxHead); - return getTaxHeadMasterResponse(taxHeadMaster, requestInfo); - } - - private TaxHeadMasterResponse getTaxHeadMasterResponse(List taxHeadMaster, RequestInfo requestInfo) { - TaxHeadMasterResponse taxHeadMasterResponse = new TaxHeadMasterResponse(); - taxHeadMasterResponse.setTaxHeadMasters(taxHeadMaster); - taxHeadMasterResponse.setResponseInfo(responseInfoFactory.getResponseInfo(requestInfo, HttpStatus.OK)); - return taxHeadMasterResponse; - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/TaxPeriodService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/TaxPeriodService.java deleted file mode 100644 index 794c33db90c..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/TaxPeriodService.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.service; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.TaxPeriod; -import org.egov.demand.repository.TaxPeriodRepository; -import org.egov.demand.web.contract.TaxPeriodCriteria; -import org.egov.demand.web.contract.TaxPeriodResponse; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Service; - - -@Service -public class TaxPeriodService { - - public static final Logger LOGGER = LoggerFactory.getLogger(TaxPeriodService.class); - - @Autowired - private TaxPeriodRepository taxPeriodRepository; - - @Autowired - private ResponseFactory responseInfoFactory; - - public TaxPeriodResponse searchTaxPeriods(final TaxPeriodCriteria taxPeriodCriteria, final RequestInfo requestInfo) { - LOGGER.info("-- TaxPeriodService searchTaxPeriods -- "); - final List taxPeriods = taxPeriodRepository.getTaxPeriod(requestInfo,taxPeriodCriteria); - return getTaxPeriodResponse(taxPeriods, requestInfo); - } - - private TaxPeriodResponse getTaxPeriodResponse(final List taxPeriods, final RequestInfo requestInfo) { - final TaxPeriodResponse taxPeriodResponse = new TaxPeriodResponse(); - taxPeriodResponse.setTaxPeriods(taxPeriods); - taxPeriodResponse.setResponseInfo(responseInfoFactory.getResponseInfo(requestInfo, HttpStatus.OK)); - return taxPeriodResponse; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/UserService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/UserService.java deleted file mode 100644 index 7cab53e39a0..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/UserService.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.egov.demand.service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.Demand; -import org.egov.demand.web.contract.User; -import org.egov.demand.web.contract.UserResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.web.client.RestTemplate; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class UserService { - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ApplicationProperties properties; - - /** - * Fetched user based on phone number. - * Note: Currently all CITIZEN are state-level and hence the phone no (which is set as username) is unique across state. - * - * @param requestInfo - * @param phoneNo - * @return - */ - public Map getUser(RequestInfo requestInfo, String phoneNo, String name, String tenantId) { - - Map request = new HashMap<>(); - UserResponse userResponse = null; - Map response = new HashMap<>(); - request.put("RequestInfo", requestInfo); - request.put("userName", phoneNo); - request.put("type", "CITIZEN"); - request.put("name", name); - request.put("tenantId", tenantId.split("\\.")[0]); - - StringBuilder url = new StringBuilder(); - url.append(properties.getUserServiceHostName()).append(properties.getUserServiceSearchPath()); - - try { - - userResponse = restTemplate.postForObject(url.toString(), request, UserResponse.class); - if (null != userResponse) { - if (!CollectionUtils.isEmpty(userResponse.getUser())) { - - response.put("id", userResponse.getUser().get(0).getUuid()); - } - } - } catch (Exception e) { - log.error("Exception while fetching user: ", e); - } - - return response; - } - - public String createUser(Demand demand, RequestInfo requestInfo) { - - User payer = demand.getPayer(); - - Map request = new HashMap<>(); - Map user = new HashMap<>(); - Map role = new HashMap<>(); - - List> roles = new ArrayList<>(); - role.put("code", "CITIZEN"); - role.put("name", "Citizen"); - role.put("tenantId", demand.getTenantId().split("\\.")[0]); - roles.add(role); - - user.put("name", payer.getName()); - user.put("mobileNumber", payer.getMobileNumber()); - user.put("userName", UUID.randomUUID().toString()); - user.put("active", true); - user.put("type", "CITIZEN"); - user.put("tenantId", demand.getTenantId().split("\\.")[0]); - user.put("roles", roles); - - request.put("RequestInfo", requestInfo); - request.put("user", user); - - UserResponse response = null; - StringBuilder url = new StringBuilder(); - url.append(properties.getUserServiceHostName()).append(properties.getUserCreateEnpoint()); - - try { - - response = restTemplate.postForObject(url.toString(), request, UserResponse.class); - }catch(Exception e) { - log.error("Exception while creating user: ", e); - return null; - } - - return response.getUser().get(0).getUuid(); - } - -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/util/Constants.java b/business-services/billing-service/src/main/java/org/egov/demand/util/Constants.java deleted file mode 100644 index a86a34d4b81..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/util/Constants.java +++ /dev/null @@ -1,193 +0,0 @@ -package org.egov.demand.util; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class Constants { - - public static final String DB_TYPE_JSONB = "jsonb"; - - public static final String MODULE_NAME = "BillingService"; - - public static final String MDMS_CODE_FILTER = "$.*.code"; - public static final String TAXPERIOD_CODE_FILTER = null; - - public static final String URL_PARAMS_FOR_SERVICE_BASED_DEMAND_APIS = "?tenantId={tenantId}&consumerCodes={consumerCodes}"; - public static final String TENANTID_REPLACE_TEXT = "{tenantId}"; - public static final String CONSUMERCODES_REPLACE_TEXT = "{consumerCodes}"; - - public static final String TAXPERIOD_PATH_CODE = "$.MdmsRes.BillingService.TaxPeriod"; - public static final String TAXHEADMASTER_PATH_CODE = "$.MdmsRes.BillingService.TaxHeadMaster"; - public static final String BUSINESSSERVICE_PATH_CODE = "$.MdmsRes.BillingService.BusinessService.*.code"; - public static final String BUSINESSSERVICE_MODULE_PATH = "$.MdmsRes.BillingService.BusinessService"; - - - public static final String TAXPERIOD_MASTERNAME = "TaxPeriod"; - public static final String TAXHEAD_MASTERNAME = "TaxHeadMaster"; - public static final String BUSINESSSERVICE_MASTERNAME = "BusinessService"; - - public static final List MDMS_MASTER_NAMES = Collections - .unmodifiableList(Arrays.asList(TAXHEAD_MASTERNAME, TAXPERIOD_MASTERNAME, BUSINESSSERVICE_MASTERNAME)); - - public static final String INVALID_TENANT_ID_MDMS_KEY = "INVALID TENANTID"; - public static final String INVALID_TENANT_ID_MDMS_MSG = "No data found for this tenentID"; - - - /* - * ERROR CONSTANTS - */ - - public static final String EG_BS_JSON_EXCEPTION_KEY = "EG_BS_JSON_EXCEPTION"; - public static final String EG_BS_JSON_EXCEPTION_MSG = "Exception occured while parsing additional details"; - - public static final String EG_BS_BILL_NO_DEMANDS_FOUND_KEY = "EG_BS_BILL_NO_DEMANDS_FOUND"; - public static final String EG_BS_BILL_NO_DEMANDS_FOUND_MSG = "No Demands Found for the given bill generate criteria"; - - - public static final String INVALID_BUSINESS_FOR_TAXPERIOD_KEY = "EG_BS_TAXPERIODS_BUINESSSERVICE"; - public static final String INVALID_BUSINESS_FOR_TAXPERIOD_MSG = "No Tax Periods Found for the given BusinessServices value of {resplaceValues}"; - public static final String INVALID_BUSINESS_FOR_TAXPERIOD_REPLACE_TEXT = "{resplaceValues}"; - - public static final String TAXPERIOD_NOT_FOUND_KEY = "EG_BS_TAXPERIODS_DEMAND"; - public static final String TAXPERIOD_NOT_FOUND_MSG = "No Tax Periods Found for the given demand with fromDate : {fromDate} and toDate : {toDate}"; - public static final String TAXPERIOD_NOT_FOUND_FROMDATE = "{fromDate}"; - public static final String TAXPERIOD_NOT_FOUND_TODATE = "{toDate}"; - - public static final String BUSINESSSERVICE_NOT_FOUND_KEY = "EG_BS_BUSINESSSERVICE_NOTFOUND"; - public static final String BUSINESSSERVICE_NOT_FOUND_MSG = "No Business Service masters found for give codes {resplaceValues}"; - public static final String BUSINESSSERVICE_NOT_FOUND_REPLACETEXT = "{resplaceValues}"; - - public static final String TAXHEADS_NOT_FOUND_KEY = "EG_BS_TAXHEADS_NOTFOUND"; - public static final String TAXHEADS_NOT_FOUND_MSG = "No TaxHead masters found for give codes {resplaceValues}"; - public static final String TAXHEADS_NOT_FOUND_REPLACETEXT = "{resplaceValues}"; - - public static final String USER_UUID_NOT_FOUND_KEY = "EG_BS_USER_UUID_NOTFOUND"; - public static final String USER_UUID_NOT_FOUND_MSG = "No users found for following uuids {resplaceValues}"; - public static final String USER_UUID_NOT_FOUND_REPLACETEXT = "{resplaceValues}"; - - public static final String EMPLOYEE_UUID_FOUND_KEY = "EG_BS_EMPLOYEE_UUID_NOTALLOWED"; - public static final String EMPLOYEE_UUID_FOUND_MSG = "Employees cannot own a demand in system. The following uuids belonging to employees are rejected : {resplaceValues}"; - - public static final String INVALID_DEMAND_DETAIL_KEY = "EG_DEMAND_DEATIL_INVALID"; - public static final String INVALID_DEMAND_DETAIL_MSG = "Invalid demand details found with following Values : {resplaceValues}"; - public static final String INVALID_DEMAND_DETAIL_REPLACETEXT = "{resplaceValues}"; - - public static final String INVALID_DEMAND_DETAIL_ERROR_MSG = "collection amount : {collection}, cannot not be greater than taxAmount or Negative in case of positive tax : {tax}"; - public static final String INVALID_DEMAND_DETAIL_COLLECTION_TEXT = "{collection}"; - public static final String INVALID_DEMAND_DETAIL_TAX_TEXT = "{tax}"; - - public static final String INVALID_NEGATIVE_DEMAND_DETAIL_ERROR_MSG = "collection amount : {collection}, should be equal to 'ZERO' or tax amount : {tax} in case of negative Tax"; - - public static final String DEMAND_NOT_FOUND_KEY = "EG_BS_DEMANDS_NOT_FOUND"; - public static final String DEMAND_NOT_FOUND_MSG = "No Demands not found in db for following ids : {resplaceValues}"; - public static final String DEMAND_NOT_FOUND_REPLACETEXT = "{resplaceValues}"; - - public static final String DEMAND_DETAIL_NOT_FOUND_KEY = "EG_BS_DEMAND_DETAIL_NOTFOUND"; - public static final String DEMAND_DETAIL_NOT_FOUND_MSG = "No Demand details found for the given ids : {resplaceValues}"; - public static final String DEMAND_DETAIL_NOT_FOUND_REPLACETEXT = "{resplaceValues}"; - - public static final String CONSUMER_CODE_DUPLICATE_KEY = "EG_BS_DUPLICATE_CONSUMERCODE"; - public static final String CONSUMER_CODE_DUPLICATE_MSG = "Demand already exists in the same period with the same businessService for the given consumercodes : {consumercodes}"; - public static final String CONSUMER_CODE_DUPLICATE_CONSUMERCODE_TEXT = "{consumercodes}"; - - public static final String BILL_GEN_MANDATORY_FIELDS_MISSING_KEY = "BILL_GEN_MANDATORY_FIELDS_MISSING"; - public static final String BILL_GEN_MANDATORY_FIELDS_MISSING_MSG = "Valid search criteria fields missing, please give some valid criteria like mobileNumber/email OR 'businessService & consumerCode' OR demandId"; - - - public static final String DEMAND_WITH_NO_ID_KEY = "EG_BS_DEMANDS_UNDIDENTIFIABLE"; - public static final String DEMAND_WITH_NO_ID_MSG = "Demands, must contain ids in the update payload"; - - public static final String URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_KEY = "URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE"; - public static final String URL_NOT_CONFIGURED_FOR_DEMAND_UPDATE_MSG = " No URL found for demand update with business code : {businesscode}, Bill will be generated without demand update"; - public static final String URL_NOT_CONFIGURED_REPLACE_TEXT = "{businesscode}"; - /* - * Mdms master data - */ - - public static final String TAXHEADMASTER_SERVICE_FILTER = "$.[?(@.service== \"{}\")]"; - public static final String TAXHEADMASTER_EXPRESSION = "$.MdmsRes.BillingService.TaxHeadMaster[?(EXPRESSION)]"; - public static final String TAXHEADMASTER_CATEGORY_FILTER = "@.category == \"VAL\""; - public static final String TAXHEADMASTER_NAME_FILTER = "@.name== \"VAL\""; - public static final String TAXHEADMASTER_ISDEBIT_FILTER = "@.isDebit== \"VAL\""; - public static final String TAXHEADMASTER_ISACTUALAMOUNT_FILTER = "@.isActualDemand== \"VAL\""; - public static final String TAXHEADMASTER_IDS_FILTER = "@.id in [VAL]"; - public static final String TAXHEADMASTER_CODES_FILTER = "@.code in [VAL]"; - public static final String MDMS_NO_FILTER_TAXHEADMASTER = "$.MdmsRes.BillingService.TaxHeadMaster.*"; - - - - public static final String TAXPERIOD_EXPRESSION = "$.MdmsRes.BillingService.TaxPeriod[?(EXPRESSION)]"; - public static final String TAXPERIOD_PERIODCYCLE_FILTER = "@.periodCycle == \"VAL\""; - public static final String TAXPERIOD_CODE_SEARCH_FILTER = "@.code== \"VAL\""; - public static final String TAXPERIOD_FROMDATE_FILTER = "@.fromDate >= VAL "; - public static final String TAXPERIOD_TODATE_FILTER = "@.toDate <= VAL"; - public static final String TAXPERIOD_DATE_FILTER = "@.date == VAL"; - public static final String TAXPERIOD_IDS_FILTER = "@.id in [VAL]"; - public static final String TAXPERIOD_SERVICES_FILTER = "@.service in [VAL]"; - public static final String MDMS_NO_FILTER_TAXPERIOD = "$.MdmsRes.BillingService.TaxPeriod.*"; - - public static final String BUSINESSSERVICE_EXPRESSION = "$.MdmsRes.BillingService.BusinessService[?(EXPRESSION)]"; - public static final String BUSINESSSERVICE_IDS_FILTER = "@.id in [VAL]"; - public static final String BUSINESSSERVICE_SERVICES_FILTER = "@.code in [VAL]"; - public static final String MDMS_NO_FILTER_BUSINESSSERVICE = "$.MdmsRes.BillingService.BusinessService.*"; - - public static final String ADVANCE_TAXHEAD_JSONPATH_CODE = "$.MdmsRes.BillingService.TaxHeadMaster[?(@.category=='ADVANCE_COLLECTION' && @.service==\"{}\")].code"; - public static final String ADVANCE_BUSINESSSERVICE_JSONPATH_CODE = "$.MdmsRes.BillingService.BusinessService[?(@.code==\"{}\")].isAdvanceAllowed"; - - public static final String RECEIPTNUMBER_KEY = "receiptNumber"; - public static final String PAYMENT_ID_KEY = "paymentId"; - - public static final String EMPLOYEE_TYPE_CODE = "EMPLOYEE"; - - - /* - * Amendment Constants - */ - public static final String AMENDMENT_STRING_CONSTANT = "AMENDMENT"; - - public static final String NOTETYPE_REPLACE_STRING = "NOTETYPE"; - - public static final String CONSUMERCODE_REPLACE_STRING = "CONSUMERCODE"; - - public static final String CREDIT_NOTE_VALUE = "CN"; - - public static final String DEBIT_NOTE_VALUE = "DN"; - - - private Constants() {} - - public static final String BUSINESS_SERVICE_URL_PARAMETER = "businessService="; - - public static final String URL_PARAM_SEPERATOR = "&"; - - public static final String RESPONSEINFO_STRING = "ResponseInfo"; - - public static final String MESSAGE_STRING = "Message"; - - public static final String SUCCESS_CANCEL_BILL_MSG = "Successfully cancelled {count} Active bills for given consumer codes"; - - public static final String FAILURE_CANCEL_BILL_MSG = "No Active bills found for cancellation for the given criteria"; - - public static final String PAID_CANCEL_BILL_MSG = "You cannot cancel the bill in the workflow"; - - public static final String COUNT_REPLACE_CANCEL_BILL_MSG = "{count}"; - - // Bill cancel - - public static final String CANCELLATION_REASON_MSG= "reasonMessage"; - - public static final String CANCELLATION_REASON_CODE= "reason"; - - public static final String CANCELL_REASON_MSG_NOT_FOUND = "EG_BS_CANCELL_REASON_MSG_NOT"; - public static final String CANCELL_REASON_MSG_NOT_FOUND_MSG = "Cancell Reason message with key " + "'" + CANCELLATION_REASON_MSG + "'" + " is madnatory Text field in additionalDetails of Bill cancell Request"; - public static final String CANCELL_REASON_MSG_EMPTY_MSG = "Cancell Reason message cannot be empty"; - - public static final String CANCELL_REASON_CODE_NOT_FOUND = "EG_BS_CANCELL_REASON_CODE_NOT"; - public static final String CANCELL_REASON_CODE_NOT_FOUND_MSG = "Cancellation Reason with key " + "'" + CANCELLATION_REASON_CODE + "'" + " is a madnatory Text field in additionalDetails of Bill cancell Request"; - public static final String CANCELL_REASON_CODE_EMPTY_MSG = "Cancell Reason code cannot be empty"; - - public static final String SCHEMA_PLACEHOLDER = "{schema}"; - - public static final String TENANTID_MDC_STRING = "TENANTID"; -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/util/DemandEnrichmentUtil.java b/business-services/billing-service/src/main/java/org/egov/demand/util/DemandEnrichmentUtil.java deleted file mode 100644 index 5574345f2a8..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/util/DemandEnrichmentUtil.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.util; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.demand.model.Demand; -import org.egov.demand.web.contract.User; -import org.springframework.stereotype.Component; - -@Component -public class DemandEnrichmentUtil { - - /** - * Collects the list of payer in to map of UUID and object - * - * and enriches demand array based on the map - * @param demands - * @param payers - * @return - */ - public List enrichPayer(List demands, List payers) { - - Map map = payers.stream().collect(Collectors.toMap(User::getUuid, Function.identity())); - List rsDemands = new ArrayList<>(); - - for (Demand demand : demands) { - - if (null == demand.getPayer()) - continue; - - String payerUuid = demand.getPayer().getUuid(); - if (map.containsKey(payerUuid)) { - demand.setPayer(map.get(payerUuid)); - } - rsDemands.add(demand); - } - return rsDemands; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/util/SequenceGenService.java b/business-services/billing-service/src/main/java/org/egov/demand/util/SequenceGenService.java deleted file mode 100644 index 837b53fbc02..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/util/SequenceGenService.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.util; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class SequenceGenService { - - @Autowired - private JdbcTemplate jdbcTemplate; - - public List getIds(int rsSize, String sequenceName) { - - String demandIdQuery = "SELECT NEXTVAL('" + sequenceName + "') FROM GENERATE_SERIES(1,?)"; - List idList = null; - try { - idList = jdbcTemplate.queryForList(demandIdQuery, new Object[] { rsSize }, String.class); - } catch (Exception e) { - log.error("the exception from demand ID gen : " + e); - throw e; - } - return idList; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/util/Util.java b/business-services/billing-service/src/main/java/org/egov/demand/util/Util.java deleted file mode 100644 index 0516ddf7c36..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/util/Util.java +++ /dev/null @@ -1,393 +0,0 @@ -package org.egov.demand.util; - -import static java.util.Objects.isNull; -import static org.egov.demand.util.Constants.ADVANCE_BUSINESSSERVICE_JSONPATH_CODE; -import static org.egov.demand.util.Constants.INVALID_TENANT_ID_MDMS_KEY; -import static org.egov.demand.util.Constants.INVALID_TENANT_ID_MDMS_MSG; -import static org.egov.demand.util.Constants.MDMS_CODE_FILTER; -import static org.egov.demand.util.Constants.MDMS_MASTER_NAMES; -import static org.egov.demand.util.Constants.MODULE_NAME; - -import java.math.BigDecimal; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.demand.amendment.model.ProcessInstance; -import org.egov.demand.amendment.model.ProcessInstanceRequest; -import org.egov.demand.amendment.model.ProcessInstanceResponse; -import org.egov.demand.amendment.model.State; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.ModuleDetail; -import org.egov.tracer.model.CustomException; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.jayway.jsonpath.DocumentContext; -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Component -@Slf4j -public class Util { - - @Autowired - private ApplicationProperties appProps; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - /** - * prepares mdms request - * - * @param tenantId - * @param moduleName - * @param names - * @param filter - * @param requestInfo - * @return - */ - public MdmsCriteriaReq prepareMdMsRequest(String tenantId, String moduleName, List names, String filter, - RequestInfo requestInfo) { - - List masterDetails = new ArrayList<>(); - names.forEach(name -> { - masterDetails.add(MasterDetail.builder().name(name).build()); - }); - - ModuleDetail moduleDetail = ModuleDetail.builder().moduleName(moduleName).masterDetails(masterDetails).build(); - List moduleDetails = new ArrayList<>(); - moduleDetails.add(moduleDetail); - MdmsCriteria mdmsCriteria = MdmsCriteria.builder().tenantId(tenantId).moduleDetails(moduleDetails).build(); - return MdmsCriteriaReq.builder().requestInfo(requestInfo).mdmsCriteria(mdmsCriteria).build(); - } - - /** - * Fetches all the values of particular attribute as documentContext - * - * @param tenantId tenantId of properties in PropertyRequest - * @param names List of String containing the names of all master-data - * whose code has to be extracted - * @param requestInfo RequestInfo of the received PropertyRequest - * @return Map of MasterData name to the list of code in the MasterData - * - */ - public DocumentContext getAttributeValues(MdmsCriteriaReq mdmsReq) { - StringBuilder uri = new StringBuilder(appProps.getMdmsHost()).append(appProps.getMdmsEndpoint()); - - try { - return JsonPath.parse(serviceRequestRepository.fetchResult(uri.toString(), mdmsReq)); - } catch (Exception e) { - log.error("Error while fetvhing MDMS data", e); - throw new CustomException(INVALID_TENANT_ID_MDMS_KEY, INVALID_TENANT_ID_MDMS_MSG); - } - } - - /** - * Generates the Audit details object for the requested user and current time - * - * @param requestInfo - * @return - */ - public AuditDetails getAuditDetail(RequestInfo requestInfo) { - - String userId = requestInfo.getUserInfo().getUuid(); - Long currEpochDate = System.currentTimeMillis(); - - return AuditDetails.builder().createdBy(userId).createdTime(currEpochDate).lastModifiedBy(userId) - .lastModifiedTime(currEpochDate).build(); - } - - public String getStringVal(Set set) { - StringBuilder builder = new StringBuilder(); - int i = 0; - for (String val : set) { - builder.append(val); - i++; - if (i != set.size()) - builder.append(","); - } - return builder.toString(); - } - - /** - * converts the object to a pgObject for persistence - * - * @param additionalDetails - * @return - */ - public PGobject getPGObject(Object additionalDetails) { - - String value = null; - try { - value = mapper.writeValueAsString(additionalDetails); - } catch (JsonProcessingException e) { - throw new CustomException(Constants.EG_BS_JSON_EXCEPTION_KEY, Constants.EG_BS_JSON_EXCEPTION_MSG); - } - - PGobject json = new PGobject(); - json.setType(Constants.DB_TYPE_JSONB); - try { - json.setValue(value); - } catch (SQLException e) { - throw new CustomException(Constants.EG_BS_JSON_EXCEPTION_KEY, Constants.EG_BS_JSON_EXCEPTION_MSG); - } - return json; - } - - public JsonNode getJsonValue(PGobject pGobject){ - try { - if(Objects.isNull(pGobject) || Objects.isNull(pGobject.getValue())) - return null; - else - return mapper.readTree( pGobject.getValue()); - } catch (Exception e) { - throw new CustomException(Constants.EG_BS_JSON_EXCEPTION_KEY, Constants.EG_BS_JSON_EXCEPTION_MSG); - } - } - - - public String getApportionURL(){ - StringBuilder builder = new StringBuilder(appProps.getApportionHost()); - builder.append(appProps.getApportionEndpoint()); - return builder.toString(); - } - - /** - * Fetches the isAdvanceAllowed flag for the given businessService - * @param businessService - * @param mdmsData - * @return - */ - public Boolean getIsAdvanceAllowed(String businessService, DocumentContext mdmsData){ - String jsonpath = ADVANCE_BUSINESSSERVICE_JSONPATH_CODE; - jsonpath = jsonpath.replace("{}",businessService); - - List isAdvanceAllowed = mdmsData.read(jsonpath); - - if(CollectionUtils.isEmpty(isAdvanceAllowed)) - throw new CustomException("BUSINESSSERVICE_ERROR","Failed to fetch isAdvanceAllowed for businessService: "+businessService); - - return isAdvanceAllowed.get(0); - } - - public String getValueFromAdditionalDetailsForKey (Object additionalDetails, String key) { - - @SuppressWarnings("unchecked") - Map additionalDetailMap = mapper.convertValue(additionalDetails, Map.class); - if(null == additionalDetails) - return ""; - - return (String) additionalDetailMap.get(key); - } - - /** - * Setting the receiptnumber from payment to bill - * @return - */ - public ObjectNode setValuesAndGetAdditionalDetails(JsonNode additionalDetails, String key, String value) { - - ObjectNode objectNodeDetail; - - if (null == additionalDetails || (null != additionalDetails && additionalDetails.isNull())) { - objectNodeDetail = mapper.createObjectNode(); - - } else { - - objectNodeDetail = (ObjectNode) additionalDetails; - } - objectNodeDetail.put(key, value); - - return objectNodeDetail; - } - - /** - * to Check and update whether a demand has been completely paid or not - * - * demand payment will be complete when tax and collection are equal and the method is called with payment true - * - * if the call happens with payment false and the demand is already tallied even then the demands won't be set to paid-completely to allow zero payment - */ - public void updateDemandPaymentStatus(Demand demand, Boolean isUpdateFromPayment) { - BigDecimal totoalTax = demand.getDemandDetails().stream().map(DemandDetail::getTaxAmount) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - BigDecimal totalCollection = demand.getDemandDetails().stream().map(DemandDetail::getCollectionAmount) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - if (totoalTax.compareTo(totalCollection) == 0 && isUpdateFromPayment) - demand.setIsPaymentCompleted(true); - else if (totoalTax.compareTo(totalCollection) != 0) - demand.setIsPaymentCompleted(false); - } - - /** - * validates state level tenant-id for citizens and employees - * - * state level search is allowed for employee if they contian state level roles - */ - public void validateTenantIdForUserType(String tenantId, RequestInfo requestInfo) { - - String userType = requestInfo.getUserInfo().getType(); - - if (Constants.EMPLOYEE_TYPE_CODE.equalsIgnoreCase(userType) && !tenantId.contains(".")) { - - Set rolesTenantList = new HashSet<>(); - Set rolecodeList = new HashSet<>(); - for (Role role : requestInfo.getUserInfo().getRoles()) { - rolesTenantList.add(role.getTenantId()); - rolecodeList.add(role.getCode()); - } - - //bypassing required roles from the validation - boolean isEmployeeSearchByStateTenantAllowed = false; - List statelevelRolecodeExclusionList = appProps.getStatelevelRolecodeExclusionList(); - for (String rolecode : rolecodeList) { - if (statelevelRolecodeExclusionList.contains(rolecode)) { - isEmployeeSearchByStateTenantAllowed = true; - break; - } - } - - if (!isEmployeeSearchByStateTenantAllowed) - throw new CustomException("EG_BS_INVALID_TENANTID", "Employees cannot search based on state level tenantid"); - } - } - - /** - * Fetches the required master data from MDMS service - * @param demandRequest The request for which master data has to be fetched - * @return - */ - public DocumentContext getMDMSData(RequestInfo requestInfo, String tenantId){ - - /* - * Preparing the mdms request with billing service master and calling the mdms search API - */ - MdmsCriteriaReq mdmsReq = prepareMdMsRequest(tenantId, MODULE_NAME, MDMS_MASTER_NAMES, MDMS_CODE_FILTER, - requestInfo); - DocumentContext mdmsData = getAttributeValues(mdmsReq); - - return mdmsData; - } - - - /** - * Method to integrate with workflow - * - * takes the trade-license request as parameter constructs the work-flow request - * - * and sets the resultant status from wf-response back to trade-license object - * - */ - public State callWorkFlow(ProcessInstance workflow, RequestInfo requestInfo) { - - ProcessInstanceRequest workflowReq = ProcessInstanceRequest.builder() - .processInstances(Arrays.asList(workflow)) - .requestInfo(requestInfo) - .build(); - - ProcessInstanceResponse response = null; - StringBuilder url = new StringBuilder(appProps.getWfHost().concat(appProps.getWfTransitionPath())); - Object objectResponse = serviceRequestRepository.fetchResult(url.toString(), workflowReq); - response = mapper.convertValue(objectResponse, ProcessInstanceResponse.class); - return response.getProcessInstances().get(0).getState(); - } - - /* - * - * Json merge utils - */ - - /** - * Method to merge additional details during update - * - * @param mainNode - * @param updateNode - * @return - */ - public JsonNode jsonMerge(JsonNode mainNode, JsonNode updateNode) { - - if (isNull(mainNode) || mainNode.isNull()) - return updateNode; - if (isNull(updateNode) || updateNode.isNull()) - return mainNode; - - Iterator fieldNames = updateNode.fieldNames(); - while (fieldNames.hasNext()) { - - String fieldName = fieldNames.next(); - JsonNode jsonNode = mainNode.get(fieldName); - // if field exists and is an embedded object - if (jsonNode != null && jsonNode.isObject()) { - jsonMerge(jsonNode, updateNode.get(fieldName)); - } else { - if (mainNode instanceof ObjectNode) { - // Overwrite field - JsonNode value = updateNode.get(fieldName); - ((ObjectNode) mainNode).set(fieldName, value); - } - } - - } - return mainNode; - } - - public String getIdsQueryForList(Set ownerIds, List preparedStmtList) { - - StringBuilder query = new StringBuilder("("); - query.append(createPlaceHolderForList(ownerIds)); - addToPreparedStatement(preparedStmtList, ownerIds); - query.append(")"); - - return query.toString(); - } - - private String createPlaceHolderForList(Set ids) { - - StringBuilder builder = new StringBuilder(); - int length = ids.size(); - for (int i = 0; i < length; i++) { - builder.append(" ?"); - if (i != length - 1) - builder.append(","); - } - return builder.toString(); - } - - private void addToPreparedStatement(List preparedStmtList, Set ids) { - ids.forEach(id -> { - preparedStmtList.add(id); - }); - } - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/util/migration/DemandMigration.java b/business-services/billing-service/src/main/java/org/egov/demand/util/migration/DemandMigration.java deleted file mode 100644 index d6b1deb7bff..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/util/migration/DemandMigration.java +++ /dev/null @@ -1,202 +0,0 @@ -package org.egov.demand.util.migration; - -import java.math.BigDecimal; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.PostConstruct; - -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.repository.DemandRepository; -import org.egov.demand.repository.rowmapper.DemandRowMapper; -import org.egov.demand.web.contract.DemandRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Component; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Component -public class DemandMigration { - - public static final String SELECT_QUERY = "select d.id as did,dl.id as dlid,dl.demandid as dldemandid," - + "d.consumercode as dconsumercode,d.consumertype as dconsumertype,d.taxperiodfrom as dtaxperiodfrom," - + "d.taxperiodto as dtaxperiodto,U.uuid as payer,null as dbillexpirytime," - + " d.businessservice as dbusinessservice,d.status as status,d.minimumamountpayable as dminimumamountpayable, " - + " (CASE WHEN taxheadcode='PT_DECIMAL_CEILING_CREDIT' OR taxheadcode='PT_DECIMAL_CEILING_DEBIT' THEN 'PT_ROUNDOFF' else taxheadcode END)" - + " as dltaxheadcode, (CASE WHEN taxheadcode IN ('PT_TIME_REBATE', 'PT_ADVANCE_CARRYFORWARD', 'PT_OWNER_EXEMPTION','PT_UNIT_USAGE_EXEMPTION'" - + ", 'PT_ADHOC_REBATE', 'PT_DECIMAL_CEILING_DEBIT','TL_ADHOC_REBATE') then taxamount*-1 else taxamount END) as dltaxamount," - + " dl.collectionamount as dlcollectionamount, dl.createdby as dlcreatedby,dl.createdtime as dlcreatedtime,dl.lastmodifiedby as dllastmodifiedby," - + " dl.lastmodifiedtime as dllastmodifiedtime,dl.tenantid as dltenantid, d.createdby as dcreatedby,d.createdtime as dcreatedtime," - + " d.lastmodifiedby as dlastmodifiedby,d.lastmodifiedtime as dlastmodifiedtime,d.tenantid as dtenantid " - + " from egbs_demand d inner join egbs_demanddetail dl ON d.id=dl.demandid AND d.tenantid=dl.tenantid " - + " LEFT OUTER JOIN eg_user U ON U.id::CHARACTER VARYING=d.owner" - + " WHERE d.businessservice IN ('TL','PT') AND d.tenantid ilike 'pb%' " - + " AND d.id IN (select id from egbs_demand order by id offset ? limit ?);"; - - public static final String COUNT_QUERY = "select count(*) from egbs_demand where businessservice IN ('TL','PT') AND tenantid ilike 'pb%';"; - - private Comparator demandDetailOrdercomparator; - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Autowired - private DemandRowMapper demandRowMapper; - - @Autowired - private DemandRepository demandRepository; - - @Value("${migration.batch.value}") - private Integer batchSize; - - @PostConstruct - public void createDemadDetailComparator() { - - Map taxHeadOrderMap = new HashMap<>(); - taxHeadOrderMap.put("TL_TAX", 5); - taxHeadOrderMap.put("TL_ROUNDOFF", 1); - taxHeadOrderMap.put("TL_ADHOC_REBATE", 0); - taxHeadOrderMap.put("TL_ADHOC_PENALTY", 3); - - taxHeadOrderMap.put("PT_TIME_REBATE", 0); - taxHeadOrderMap.put("PT_ADHOC_REBATE", 0); - taxHeadOrderMap.put("PT_OWNER_EXEMPTION", 0); - taxHeadOrderMap.put("PT_ADVANCE_CARRYFORWARD", 0); - taxHeadOrderMap.put("PT_UNIT_USAGE_EXEMPTION", 0); - - taxHeadOrderMap.put("PT_ROUNDOFF", 1); - - taxHeadOrderMap.put("PT_TIME_INTEREST", 2); - taxHeadOrderMap.put("PT_TIME_PENALTY", 3); - taxHeadOrderMap.put("PT_ADHOC_PENALTY", 3); - - taxHeadOrderMap.put("PT_FIRE_CESS", 4); - taxHeadOrderMap.put("PT_CANCER_CESS", 4); - - taxHeadOrderMap.put("PT_TAX", 5); - - - demandDetailOrdercomparator = new Comparator() { - - private Map orderMap = taxHeadOrderMap; - - @Override - public int compare(DemandDetail dD1, DemandDetail dD2) { - - Integer int1 = orderMap.get(dD1.getTaxHeadMasterCode()); - Integer int2 = orderMap.get(dD2.getTaxHeadMasterCode()); - return int1.compareTo(int2); - } - }; - } - - public Map migrateToV1(Integer startBatch, Integer batchSizeInput) { - - Map responseMap = new HashMap<>(); - - int count = jdbcTemplate.queryForObject(COUNT_QUERY, Integer.class); - int i = 0; - if (null != startBatch && startBatch > 0) - i = startBatch; - - if(null != batchSizeInput && batchSizeInput > 0) - batchSize = batchSizeInput; - - for( ; i demands = jdbcTemplate.query(SELECT_QUERY, new Object[] { i, batchSize }, demandRowMapper); - try { - - apportionDemands(demands); - postDemands(demands); - } catch (Exception e) { - - log.error("Migration failed at batch count of : " + i); - responseMap.put( "Migration failed at batch count : " + i, e.getMessage()); - return responseMap; - } - addResponseToMap(demands,responseMap,"SUCCESS"); - log.info(" count completed : " + i); - } - - return responseMap; - } - - private void addResponseToMap(List demands, Map responseMap, String message) { - - demands.forEach(demand -> { - - responseMap.put(demand.getId(), message); - log.info("the demand id : " + demand.getId() + " message : " + message); - }); - } - - private void postDemands(List demands) { - - demandRepository.save(DemandRequest.builder().demands(demands).requestInfo(null).build()); - } - - /** - * Apportion list of demands - * - * @param demands - */ - private void apportionDemands(List demands) { - - for(Demand demand : demands) { - - List details = demand.getDemandDetails(); - Collections.sort(details, demandDetailOrdercomparator); - - BigDecimal collectionAmount = BigDecimal.ZERO; - for (DemandDetail detail : details) { - - collectionAmount = apportionDemandDetail(collectionAmount, detail); - } - } - } - - /** - * Method to apportion the DemandDetail object - * - * @param totalCollectionAmount - * @param detail - */ - private BigDecimal apportionDemandDetail(BigDecimal totalCollectionAmount, DemandDetail detail) { - BigDecimal tax = detail.getTaxAmount(); - - if (BigDecimal.ZERO.compareTo(tax) > 0) { - - detail.setCollectionAmount(tax); - return totalCollectionAmount.subtract(tax); - - } else if (BigDecimal.ZERO.compareTo(tax) < 0) { - - totalCollectionAmount = detail.getCollectionAmount().add(totalCollectionAmount); - if (tax.compareTo(totalCollectionAmount) > 0) { - - detail.setCollectionAmount(totalCollectionAmount); - return BigDecimal.ZERO; - } else { - - detail.setCollectionAmount(tax); - return totalCollectionAmount.subtract(tax); - } - } - - /* - * When taxAmount in demandDetail is zero, then the scenario is not handled - * considering there won't be anymore collection amount left - * (or) apportion not required since the detail has only ZERO - */ - return totalCollectionAmount; - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillRequest.java deleted file mode 100644 index 073c4f93b50..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.Bill; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.Builder.Default; -/** - * BillRequest - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("Bills") - @Default - private List bills = new ArrayList<>(); -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillRequestV2.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillRequestV2.java deleted file mode 100644 index 9891ba8bf47..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillRequestV2.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.BillV2; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.Builder.Default; -/** - * BillRequest - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillRequestV2 { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("Bills") - @Default - private List bills = new ArrayList<>(); -} - diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillResponse.java deleted file mode 100644 index e0a845d0aa2..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillResponse.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.model.Bill; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * BillResponse - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillResponse { - - @JsonProperty("ResposneInfo") - private ResponseInfo resposneInfo = null; - - @JsonProperty("Bill") - private List bill = new ArrayList<>(); - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillResponseV2.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillResponseV2.java deleted file mode 100644 index 965aca409a1..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BillResponseV2.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.model.BillV2; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * BillResponse - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillResponseV2 { - - @JsonProperty("ResposneInfo") - private ResponseInfo resposneInfo = null; - - @JsonProperty("Bill") - private List bill = new ArrayList<>(); - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BusinessServiceDetailCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BusinessServiceDetailCriteria.java deleted file mode 100644 index a0e10ea3174..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BusinessServiceDetailCriteria.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.contract; - -import javax.validation.constraints.NotNull; -import java.util.Set; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Data -public class BusinessServiceDetailCriteria { - - @NotNull - private String tenantId; - - @NotNull - private Set businessService; - - private Set id; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BusinessServiceDetailResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BusinessServiceDetailResponse.java deleted file mode 100644 index c5cf39c1c9b..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/BusinessServiceDetailResponse.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.model.BusinessServiceDetail; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * BillRequest - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BusinessServiceDetailResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("BusinessServiceDetails") - private List businessServiceDetails = new ArrayList<>(); -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/DemandRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/DemandRequest.java deleted file mode 100644 index 12cc24f0dcd..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/DemandRequest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.Demand; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.Builder.Default; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class DemandRequest { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @Valid - @NotNull - @Default - @JsonProperty("Demands") - private List demands = new ArrayList<>(); -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/DemandResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/DemandResponse.java deleted file mode 100644 index 520a4f09f83..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/DemandResponse.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.model.CollectedReceipt; -import org.egov.demand.model.Demand; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class DemandResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Demands") - private List demands = new ArrayList<>(); - - @JsonProperty("CollectedReceipt") - private List collectedReceipts; - - public DemandResponse(ResponseInfo responseInfo,List demands){ - this.responseInfo=responseInfo; - this.demands=demands; - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/Receipt.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/Receipt.java deleted file mode 100644 index 8b1e3c4e5cc..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/Receipt.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import javax.sound.midi.Instrument; -import javax.validation.constraints.NotNull; - -import org.egov.demand.model.AuditDetail; -import org.egov.demand.model.Bill; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -@EqualsAndHashCode -public class Receipt { - - private String tenantId; - - private String id; - - private String transactionId; - - @NotNull - @JsonProperty("Bill") - private List bill = new ArrayList<>(); - - private AuditDetail auditDetails; - - private Long stateId; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/ReceiptRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/ReceiptRequest.java deleted file mode 100644 index 81bbf3ffc64..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/ReceiptRequest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.contract; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Builder; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -import org.egov.common.contract.request.RequestInfo; - -import java.util.List; - - -@Getter -@Setter -@ToString -@Builder -public class ReceiptRequest { - - private String tenantId; - - @JsonIgnoreProperties({"ts"}) - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("Receipt") - private List receipt; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/ReceiptRequestV2.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/ReceiptRequestV2.java deleted file mode 100644 index 6e9818b5f95..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/ReceiptRequestV2.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.contract; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Builder; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -import org.egov.common.contract.request.RequestInfo; - -import java.util.List; - - -@Getter -@Setter -@ToString -@Builder -public class ReceiptRequestV2 { - - private String tenantId; - - @JsonIgnoreProperties({"ts"}) - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("Receipt") - private List receipt; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/ReceiptV2.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/ReceiptV2.java deleted file mode 100644 index fa0850edddd..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/ReceiptV2.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.egov.demand.model.AuditDetail; -import org.egov.demand.model.BillV2; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -@EqualsAndHashCode -public class ReceiptV2 { - - private String tenantId; - - private String id; - - private String transactionId; - - @NotNull - @JsonProperty("Bill") - @Default - private List bill = new ArrayList<>(); - - private AuditDetail auditDetails; - - private Long stateId; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/RequestInfoWrapper.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/RequestInfoWrapper.java deleted file mode 100644 index fa79f19f583..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/RequestInfoWrapper.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.contract; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class RequestInfoWrapper { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/TaxHeadMasterResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/TaxHeadMasterResponse.java deleted file mode 100644 index bbd7b9c6d78..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/TaxHeadMasterResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.model.TaxHeadMaster; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class TaxHeadMasterResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("TaxHeadMasters") - private List taxHeadMasters = new ArrayList<>(); -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/TaxPeriodCriteria.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/TaxPeriodCriteria.java deleted file mode 100644 index 05c683615fc..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/TaxPeriodCriteria.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.egov.demand.web.contract; - -import lombok.*; - -import javax.validation.constraints.NotNull; - -import org.egov.demand.model.enums.PeriodCycle; - -import java.util.Set; - -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -@Builder -public class TaxPeriodCriteria { - - @NotNull - private String tenantId; - - @NotNull - private Set service; - - private PeriodCycle periodCycle; - - private Set id; - - private String code; - - private Long fromDate; - - private Long toDate; - - private Long date; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/TaxPeriodResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/TaxPeriodResponse.java deleted file mode 100644 index a14e8276bb7..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/TaxPeriodResponse.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.model.TaxPeriod; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class TaxPeriodResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("TaxPeriods") - List taxPeriods = new ArrayList<>(); -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/User.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/User.java deleted file mode 100644 index 836282a4884..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/User.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.egov.demand.web.contract; - -import javax.validation.constraints.Pattern; - -import org.egov.demand.model.Owner; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class User { - - private String uuid; - private Long id; - private String userName; - private String type; - private String salutation; - private String name; - private String gender; - - @Pattern(regexp = "(^[6-9][0-9]{9}$)", message = "Inavlid mobile number, should start with 6-9 and contain ten digits of 0-9") - private String mobileNumber; - - private String emailId; - private String altContactNumber; - private String pan; - private String aadhaarNumber; - private String permanentAddress; - private String permanentCity; - private String permanentPinCode; - private String correspondenceAddress; - private String correspondenceCity; - private String correspondencePinCode; - private Boolean active; - private String tenantId; - - public Owner toOwner(){ - - return Owner.builder() - .id(id) - .userName(userName) - .name(name) - .permanentAddress(this.permanentAddress) - .mobileNumber(mobileNumber) - .aadhaarNumber(aadhaarNumber) - .emailId(emailId) - .tenantId(tenantId) - .build(); - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/UserResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/UserResponse.java deleted file mode 100644 index b573152097c..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/UserResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.egov.demand.web.contract; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@AllArgsConstructor -@Data -@NoArgsConstructor -public class UserResponse { - @JsonProperty("responseInfo") - ResponseInfo responseInfo; - - @JsonProperty("user") - List user; -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/UserSearchRequest.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/UserSearchRequest.java deleted file mode 100644 index 3f86c8e00a2..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/UserSearchRequest.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.egov.demand.web.contract; - -import java.util.List; -import java.util.Set; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -public class UserSearchRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("id") - private List id; - - private Set uuid; - - @JsonProperty("userName") - private String userName; - - @JsonProperty("name") - private String name; - - @JsonProperty("mobileNumber") - private String mobileNumber; - - @JsonProperty("aadhaarNumber") - private String aadhaarNumber; - - @JsonProperty("pan") - private String pan; - - @JsonProperty("emailId") - private String emailId; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("pageSize") - private Integer pageSize=500; - - @JsonProperty("userType") - private String userType; - -/* @JsonProperty("fuzzyLogic") - private boolean fuzzyLogic; - - @JsonProperty("active") - private boolean active = true;*/ - - - /*@JsonProperty("pageSize") - private int pageSize = 500;*/ - -/* @JsonProperty("pageNumber") - private int pageNumber = 0; - - @JsonProperty("sort") - private List sort = Collections.singletonList("name"); - - @JsonProperty("roleCodes") - private List roleCodes;*/ - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/factory/ResponseFactory.java b/business-services/billing-service/src/main/java/org/egov/demand/web/contract/factory/ResponseFactory.java deleted file mode 100644 index 2452064fd93..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/contract/factory/ResponseFactory.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.contract.factory; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.Error; -import org.egov.common.contract.response.ErrorResponse; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatus; - -@Configuration -public class ResponseFactory { - - public ResponseInfo getResponseInfo(RequestInfo requestInfo, HttpStatus status) { - - ResponseInfo responseInfo = new ResponseInfo(); - if (requestInfo != null) { - responseInfo.setApiId(requestInfo.getApiId()); - responseInfo.setMsgId(requestInfo.getMsgId()); - // responseInfo.setResMsgId(requestInfo.get); - responseInfo.setStatus(status.toString()); - responseInfo.setVer(requestInfo.getVer()); - responseInfo.setTs(requestInfo.getTs()); - } - return responseInfo; - } - - public ErrorResponse getErrorResponse(RequestInfo requestInfo) { - - Error error = new Error(); - error.setCode(400); - error.setMessage("EG_BS_API_ERROR"); - error.setDescription("The API you are trying to access has been depricated, Access the V2 API's"); - return new ErrorResponse(getResponseInfo(requestInfo, HttpStatus.BAD_REQUEST), error); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/AmendmentController.java b/business-services/billing-service/src/main/java/org/egov/demand/web/controller/AmendmentController.java deleted file mode 100644 index 9c63d26ebe8..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/AmendmentController.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.controller; - -import java.util.Arrays; -import java.util.List; - -import javax.validation.Valid; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.amendment.model.Amendment; -import org.egov.demand.amendment.model.AmendmentCriteria; -import org.egov.demand.amendment.model.AmendmentRequest; -import org.egov.demand.amendment.model.AmendmentResponse; -import org.egov.demand.amendment.model.AmendmentUpdateRequest; -import org.egov.demand.service.AmendmentService; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/amendment") -public class AmendmentController { - - - - @Autowired - private AmendmentService amendmentService; - - @Autowired - private ResponseFactory responseFactory; - - @PostMapping("/_search") - public ResponseEntity search(@RequestBody RequestInfoWrapper requestInfoWrapper, @ModelAttribute @Valid AmendmentCriteria amendmentCriteria) { - - List amendments = amendmentService.search(amendmentCriteria, requestInfoWrapper.getRequestInfo()); - - ResponseInfo responseInfo =responseFactory.getResponseInfo(requestInfoWrapper.getRequestInfo(), HttpStatus.OK); - AmendmentResponse response = AmendmentResponse.builder() - .responseInfo(responseInfo) - .amendments(amendments) - .build(); - return new ResponseEntity<>(response, HttpStatus.OK); - } - - /** - * API to create Amendments - * - * @return ResponseEntity - */ - - @PostMapping("/_create") - @ResponseBody - public ResponseEntity create(@RequestBody @Valid AmendmentRequest amendmentRequest) { - - Amendment amendment = amendmentService.create(amendmentRequest); - - ResponseInfo responseInfo = responseFactory.getResponseInfo(amendmentRequest.getRequestInfo(), HttpStatus.CREATED); - AmendmentResponse amendmentResponse = AmendmentResponse.builder() - .amendments(Arrays.asList(amendment)) - .responseInfo(responseInfo) - .build(); - return new ResponseEntity<>(amendmentResponse, HttpStatus.CREATED); - } - - @PostMapping("_update") - public ResponseEntity update(@RequestBody @Valid AmendmentUpdateRequest amendmentUpdateRequest) { - - Amendment amendment = amendmentService.updateAmendment(amendmentUpdateRequest); - - ResponseInfo responseInfo = responseFactory.getResponseInfo(amendmentUpdateRequest.getRequestInfo(), HttpStatus.OK); - AmendmentResponse amendmentResponse = AmendmentResponse.builder() - .amendments(Arrays.asList(amendment)) - .responseInfo(responseInfo) - .build(); - - return new ResponseEntity<>(amendmentResponse, HttpStatus.OK); - } - - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/BillController.java b/business-services/billing-service/src/main/java/org/egov/demand/web/controller/BillController.java deleted file mode 100644 index 7b0736d5af9..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/BillController.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.egov.demand.web.controller; - -import javax.validation.Valid; - -import org.egov.common.contract.response.ErrorResponse; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.GenerateBillCriteria; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("bill") -@Deprecated -public class BillController { - - @Autowired - private ResponseFactory responseFactory; - - @PostMapping("_search") - @ResponseBody - public ResponseEntity search(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid final BillSearchCriteria billCriteria, - final BindingResult bindingResult) { - - final ErrorResponse errorResponse = responseFactory.getErrorResponse( requestInfoWrapper.getRequestInfo()); - return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); - - } - - - @PostMapping("_generate") - @ResponseBody - public ResponseEntity genrateBill(@RequestBody RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid GenerateBillCriteria generateBillCriteria) { - - - final ErrorResponse errorResponse = responseFactory.getErrorResponse(requestInfoWrapper.getRequestInfo()); - return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); - } - - @PostMapping("_fetchbill") - @ResponseBody - public ResponseEntity fetchBill(@RequestBody RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid GenerateBillCriteria generateBillCriteria){ - - final ErrorResponse errorResponse = responseFactory.getErrorResponse(requestInfoWrapper.getRequestInfo()); - return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); - } - - @Deprecated - @PostMapping("_create") - @ResponseBody - public ResponseEntity create(@RequestBody BillRequest billRequest, BindingResult bindingResult){ - - final ErrorResponse errorResponse = responseFactory.getErrorResponse(billRequest.getRequestInfo()); - return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); - - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/BillControllerv2.java b/business-services/billing-service/src/main/java/org/egov/demand/web/controller/BillControllerv2.java deleted file mode 100644 index a34ec4b1294..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/BillControllerv2.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.egov.demand.web.controller; - -import java.util.HashMap; -import java.util.Map; - -import javax.validation.Valid; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.helper.BillHelperV2; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.GenerateBillCriteria; -import org.egov.demand.model.UpdateBillRequest; -import org.egov.demand.service.BillServicev2; -import org.egov.demand.util.Constants; -import org.egov.demand.web.contract.BillRequestV2; -import org.egov.demand.web.contract.BillResponseV2; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.egov.demand.web.validator.BillValidator; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("bill/v2/") -public class BillControllerv2 { - - @Autowired - private BillServicev2 billService; - - @Autowired - private ResponseFactory responseFactory; - - @Autowired - private BillValidator billValidator; - - @Autowired - private BillHelperV2 billHelper; - - @PostMapping("_search") - @ResponseBody - public ResponseEntity search(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid final BillSearchCriteria billCriteria) { - - RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); - billValidator.validateBillSearchCriteria(billCriteria, requestInfo); - return new ResponseEntity<>(billService.searchBill(billCriteria,requestInfo), HttpStatus.OK); - } - - - @PostMapping("_fetchbill") - @ResponseBody - public ResponseEntity fetchBill(@RequestBody RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid GenerateBillCriteria generateBillCriteria){ - - BillResponseV2 billResponse = billService.fetchBill(generateBillCriteria, requestInfoWrapper); - return new ResponseEntity<>(billResponse, HttpStatus.CREATED); - } - - - @PostMapping("_generate") - @ResponseBody - public ResponseEntity genrateBill(@RequestBody RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid GenerateBillCriteria generateBillCriteria) { - - throw new CustomException("EG_BS_API_ERROR", "The Generate bill API has been deprecated, Access the fetchBill"); - } - - @PostMapping("_create") - @ResponseBody - public ResponseEntity create(@RequestBody @Valid BillRequestV2 billRequest, BindingResult bindingResult){ - - BillResponseV2 billResponse = billService.sendBillToKafka(billRequest); - billHelper.getBillRequestWithIds(billRequest); - return new ResponseEntity<>(billResponse,HttpStatus.CREATED); - } - - @PostMapping("_cancelbill") - @ResponseBody - public ResponseEntity cancelBill(@RequestBody @Valid UpdateBillRequest updateBillRequest){ - - Integer count = billService.cancelBill(updateBillRequest); - - HttpStatus status; - String responseMsg; - - if (count > 0) { - status = HttpStatus.OK; - responseMsg = Constants.SUCCESS_CANCEL_BILL_MSG.replace(Constants.COUNT_REPLACE_CANCEL_BILL_MSG, - count.toString()); - } else { - status = HttpStatus.BAD_REQUEST; - responseMsg = count < 0 ? Constants.PAID_CANCEL_BILL_MSG : Constants.FAILURE_CANCEL_BILL_MSG; - } - - ResponseInfo responseInfo = responseFactory.getResponseInfo(updateBillRequest.getRequestInfo(), status); - Map responseMap = new HashMap<>(); - responseMap.put(Constants.RESPONSEINFO_STRING, responseInfo); - responseMap.put(Constants.MESSAGE_STRING, responseMsg); - return new ResponseEntity<>(responseMap, status); - } -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/BusinessServiceDetailController.java b/business-services/billing-service/src/main/java/org/egov/demand/web/controller/BusinessServiceDetailController.java deleted file mode 100644 index fd596397584..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/BusinessServiceDetailController.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.controller; - -import javax.validation.Valid; - -import org.egov.demand.service.BusinessServDetailService; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.egov.demand.web.contract.BusinessServiceDetailResponse; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/businessservices") -public class BusinessServiceDetailController { - - @Autowired - private BusinessServDetailService businessServDetailService; - - @PostMapping("_search") - @ResponseBody - public ResponseEntity search(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid final BusinessServiceDetailCriteria BusinessServiceDetailsCriteria, final BindingResult bindingResult) { - - final BusinessServiceDetailResponse businessServiceDetailResponse = businessServDetailService.searchBusinessServiceDetails(BusinessServiceDetailsCriteria, requestInfoWrapper.getRequestInfo()); - return new ResponseEntity<>(businessServiceDetailResponse, HttpStatus.OK); - } - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/DemandController.java b/business-services/billing-service/src/main/java/org/egov/demand/web/controller/DemandController.java deleted file mode 100644 index 69f24b55dea..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/DemandController.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.controller; - -import java.util.List; -import java.util.Map; - -import javax.validation.Valid; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.service.DemandService; -import org.egov.demand.util.migration.DemandMigration; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.contract.DemandResponse; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -import lombok.extern.slf4j.Slf4j; - -@RestController -@RequestMapping("/demand") -@Slf4j -public class DemandController { - - @Autowired - private DemandService demandService; - - @Autowired - private ResponseFactory responseFactory; - - @Autowired - private DemandMigration migrationService; - - /** - * API to create demands - * - * @param demandRequest - * @return ResponseEntity - */ - - @PostMapping("_create") - @ResponseBody - public ResponseEntity create(@RequestHeader HttpHeaders headers, @RequestBody @Valid DemandRequest demandRequest) { - - log.info("the demand request object : " + demandRequest); - - DemandResponse demandResponse = demandService.create(demandRequest); - - return new ResponseEntity<>(demandResponse, HttpStatus.CREATED); - } - - @PostMapping("_update") - public ResponseEntity update(@RequestHeader HttpHeaders headers, @RequestBody @Valid DemandRequest demandRequest) { - - return new ResponseEntity<>(demandService.updateAsync(demandRequest, null), HttpStatus.CREATED); - } - - @PostMapping("_search") - public ResponseEntity search(@RequestBody RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid DemandCriteria demandCriteria) { - - RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); - - List demands = demandService.getDemands(demandCriteria, requestInfo); - DemandResponse response = DemandResponse.builder().demands(demands) - .responseInfo(responseFactory.getResponseInfo(requestInfo, HttpStatus.OK)).build(); - return new ResponseEntity<>(response, HttpStatus.OK); - } - - /* - * migration api - */ - - @PostMapping(value = "/_migratetov1") - @ResponseBody - public ResponseEntity migrate(@RequestBody @Valid RequestInfoWrapper wrapper, - @RequestParam(required=false) Integer batchStart, @RequestParam(required=true) Integer batchSizeInput) { - - Map resultMap = migrationService.migrateToV1(batchStart, batchSizeInput); - return new ResponseEntity<>(resultMap, HttpStatus.OK); - } - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/TaxHeadMasterController.java b/business-services/billing-service/src/main/java/org/egov/demand/web/controller/TaxHeadMasterController.java deleted file mode 100644 index 1c2434a67fa..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/TaxHeadMasterController.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.egov.demand.web.controller; - -import javax.validation.Valid; - -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.egov.demand.service.TaxHeadMasterService; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.TaxHeadMasterResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -import lombok.extern.slf4j.Slf4j; - -@RestController -@Slf4j -@RequestMapping("/taxheads") -public class TaxHeadMasterController { - - @Autowired - private TaxHeadMasterService taxHeadMasterService; - - @PostMapping("_search") - @ResponseBody - public ResponseEntity search(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid final TaxHeadMasterCriteria taxHeadMasterCriteria, - final BindingResult bindingResult) { - - log.info("taxHeadMasterCriteria::" + taxHeadMasterCriteria + "requestInfoWrapper::" + requestInfoWrapper); - - final TaxHeadMasterResponse taxHeadMasterResponse = taxHeadMasterService.getTaxHeads(taxHeadMasterCriteria, - requestInfoWrapper.getRequestInfo()); - return new ResponseEntity<>(taxHeadMasterResponse, HttpStatus.OK); - } - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/TaxPeriodController.java b/business-services/billing-service/src/main/java/org/egov/demand/web/controller/TaxPeriodController.java deleted file mode 100644 index 961e8bc5268..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/controller/TaxPeriodController.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.controller; - -import javax.validation.Valid; - -import org.egov.demand.service.TaxPeriodService; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.TaxPeriodCriteria; -import org.egov.demand.web.contract.TaxPeriodResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -import lombok.extern.slf4j.Slf4j; - -@RestController -@RequestMapping("/taxperiods") -@Slf4j -public class TaxPeriodController { - - @Autowired - private TaxPeriodService taxPeriodService; - - @PostMapping("_search") - @ResponseBody - public ResponseEntity search(@RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, - @ModelAttribute @Valid final TaxPeriodCriteria taxPeriodCriteria, final BindingResult bindingResult) { - log.info("taxPeriodCriteria -> " + taxPeriodCriteria + "requestInfoWrapper -> " + requestInfoWrapper); - - final TaxPeriodResponse taxPeriodResponse = taxPeriodService.searchTaxPeriods(taxPeriodCriteria, requestInfoWrapper.getRequestInfo()); - return new ResponseEntity<>(taxPeriodResponse, HttpStatus.OK); - } - -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/validator/AmendmentValidator.java b/business-services/billing-service/src/main/java/org/egov/demand/web/validator/AmendmentValidator.java deleted file mode 100644 index 54ca2ddacf3..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/validator/AmendmentValidator.java +++ /dev/null @@ -1,295 +0,0 @@ -package org.egov.demand.web.validator; - -import static org.egov.demand.util.Constants.BUSINESSSERVICE_MODULE_PATH; -import static org.egov.demand.util.Constants.TAXHEADMASTER_PATH_CODE; - -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import javax.validation.Valid; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.amendment.model.Amendment; -import org.egov.demand.amendment.model.AmendmentCriteria; -import org.egov.demand.amendment.model.AmendmentRequest; -import org.egov.demand.amendment.model.AmendmentUpdate; -import org.egov.demand.amendment.model.AmendmentUpdateRequest; -import org.egov.demand.amendment.model.ProcessInstance; -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.model.TaxHeadMaster; -import org.egov.demand.repository.AmendmentRepository; -import org.egov.demand.repository.IdGenRepo; -import org.egov.demand.service.DemandService; -import org.egov.demand.util.Constants; -import org.egov.demand.util.Util; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.util.ObjectUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -@Component -public class AmendmentValidator { - - @Autowired - private Util util; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private IdGenRepo idGenRepo; - - @Autowired - private DemandService demandService; - - @Autowired - private ApplicationProperties props; - - @Autowired - private AmendmentRepository amendmentRepository; - - - /** - * Validate amendment request for create - * @param amendmentRequest - */ - public void validateAmendmentForCreate(AmendmentRequest amendmentRequest) { - - Amendment amendment = amendmentRequest.getAmendment(); - - /* - * Extracting the respective masters from DocumentContext - * - * Validating the master data fields - business-service and tax-heads - */ - DocumentContext mdmsData = util.getMDMSData(amendmentRequest.getRequestInfo(), amendmentRequest.getAmendment().getTenantId()); - List businessServices = Arrays.asList(mapper.convertValue(mdmsData.read(BUSINESSSERVICE_MODULE_PATH), BusinessServiceDetail[].class)); - Map businessMasterMap = businessServices.stream() - .collect(Collectors.toMap(BusinessServiceDetail::getCode, Function.identity())); - - List taxHeads = Arrays.asList(mapper.convertValue(mdmsData.read(TAXHEADMASTER_PATH_CODE), TaxHeadMaster[].class)); - Map> businessTaxCodeSet = taxHeads.stream().collect(Collectors.groupingBy( - TaxHeadMaster::getService, Collectors.mapping(TaxHeadMaster::getCode, Collectors.toSet()))); - - Map errorMap = new HashMap<>(); - - BusinessServiceDetail businessService = businessMasterMap.get(amendment.getBusinessService()); - if (ObjectUtils.isEmpty(businessService)) { - errorMap.put("EG_BS_AMENDMENT_BUSINESS_ERROR", - "Business service not found for the given code : " + amendment.getBusinessService()); - } else if (!businessService.getIsBillAmendmentEnabled()) { - errorMap.put("EG_BS_AMENDMENT_DISABLED_ERROR", - "Amendment is disabled for the given Business-service : " + amendment.getBusinessService()); - } - - /* - * if business-service is disabled then further validation is not needed - */ - if(!CollectionUtils.isEmpty(errorMap)) - throw new CustomException(errorMap); - - /* - * verifying presence of workflow amendments with same consumer-code - * - * verifying the consumer-code presence in demand system - */ - AmendmentCriteria amendmentCriteria = AmendmentCriteria.builder() - .consumerCode(Stream.of(amendment.getConsumerCode()).collect(Collectors.toSet())) - .tenantId(amendment.getTenantId()) - .status(Stream.of(AmendmentStatus.INWORKFLOW.toString()).collect(Collectors.toSet())) - .build(); - - List amendmentsFromSearch = amendmentRepository.getAmendments(amendmentCriteria); - - if(!CollectionUtils.isEmpty(amendmentsFromSearch)) - throw new CustomException("EG_BS_AMENDMENT_DUPLICATE_ERROR", - "An Amendment is already in workflow for given consumercode : " + amendment.getConsumerCode()); - - DemandCriteria demandCriteria = DemandCriteria.builder() - .tenantId(amendment.getTenantId()) - .businessService(amendment.getBusinessService()) - .consumerCode(new HashSet<>(Arrays.asList(amendment.getConsumerCode()))) - .build(); - - List demands = demandService.getDemands(demandCriteria, amendmentRequest.getRequestInfo()); - -// if (CollectionUtils.isEmpty(demands)) -// throw new CustomException("EG_BS_AMENDMENT_CONSUMERCODE_ERROR", -// "No demands found in the system for the given consumer code, An amendment cannot be created without demands in the system."); -// - - Set taxheadcodes = businessTaxCodeSet.get(amendment.getBusinessService()); - List allPositiveAmounts = amendment.getDemandDetails().stream() - .filter(detail -> detail.getTaxAmount().compareTo(BigDecimal.ZERO) >= 0).map(DemandDetail::getTaxAmount) - .collect(Collectors.toList()); - - if (allPositiveAmounts.size() != 0 && allPositiveAmounts.size() != amendment.getDemandDetails().size()) - errorMap.put("EG_BS_AMENDMENT_TAXAMOUNT_ERROR", "All Tax amounts should either be positive or negative"); - - if (!CollectionUtils.isEmpty(taxheadcodes)) { - - List MissingTaxHeadCodes = amendment.getDemandDetails().stream() - .filter(detail -> !taxheadcodes.contains(detail.getTaxHeadMasterCode())) - .map(DemandDetail::getTaxHeadMasterCode).collect(Collectors.toList()); - - if (!MissingTaxHeadCodes.isEmpty()) { - errorMap.put("EG_BS_AMENDMENT_TAXHEAD_ERROR", - "Taxheads not found for the following codes : " + MissingTaxHeadCodes); - } - } else { - errorMap.put("EG_BS_AMENDMENT_TAXHEAD_ERROR", - "No taxheads found for the given business service : " + amendment.getBusinessService()); - } - - /* - * validating from and to periods - */ - if (amendment.getEffectiveFrom() == null && amendment.getEffectiveTill() != null) { - - errorMap.put("EG_BS_AMENDMENT_PERIOD_ERROR", "End period cannot be given without from period"); - } else if (amendment.getEffectiveFrom() != null && amendment.getEffectiveTill() != null - && amendment.getEffectiveFrom().compareTo(amendment.getEffectiveTill()) >= 0) { - errorMap.put("EG_BS_AMENDMENT_PERIOD_ERROR", - "From period cannot be greater or equal to end period in amendment"); - } - - if(!CollectionUtils.isEmpty(errorMap)) - throw new CustomException(errorMap); - } - - /** - * Validating search criteria - * - */ - public void validateAmendmentCriteriaForSearch(AmendmentCriteria criteria) { - - // mobile-number integration - Map errorMap = new HashMap<>(); - - /* - * validation consumer-code and business-service combination - */ - if (!ObjectUtils.isEmpty(criteria.getConsumerCode()) && ObjectUtils.isEmpty(criteria.getBusinessService())) - errorMap.put("EG_BS_AMENDMENT_CRITERIA_ERROR", - "Consumer codes require businesService as mandatory parameter for search"); - - if (!CollectionUtils.isEmpty(errorMap)) - throw new CustomException(errorMap); - } - - /** - * enrich amendment request for create - * @param amendmentRequest - */ - public void enrichAmendmentForCreate (AmendmentRequest amendmentRequest) { - - Amendment amendment = amendmentRequest.getAmendment(); - RequestInfo requestInfo = amendmentRequest.getRequestInfo(); - amendment.setId(UUID.randomUUID().toString()); - - /* - * Id-Gen for amendment Id & UUID enrichment - */ - Boolean isCreditNote = amendment.getDemandDetails().get(0).getTaxAmount().compareTo(BigDecimal.ZERO) >= 0; - String creditOrDebitString = isCreditNote ? Constants.CREDIT_NOTE_VALUE : Constants.DEBIT_NOTE_VALUE; - String amendmentId = idGenRepo.getId(requestInfo, amendment.getTenantId(), props.getAmendmentIdFormatName(), null, 1).get(0); - amendmentId = amendmentId.replace(Constants.NOTETYPE_REPLACE_STRING, creditOrDebitString); - amendmentId = amendmentId.replace(Constants.CONSUMERCODE_REPLACE_STRING, amendment.getConsumerCode()); - amendment.setAmendmentId(amendmentId); - - amendment.setAuditDetails(util.getAuditDetail(requestInfo)); - amendment.getDemandDetails().forEach(detail -> { - detail.setId(UUID.randomUUID().toString()); - }); - - amendment.getDocuments().forEach(doc -> { - doc.setId(UUID.randomUUID().toString()); - }); - - /* - * enrich workflow fields if enabled - */ - String workflowName = amendment.getBusinessService().concat(".").concat(Constants.AMENDMENT_STRING_CONSTANT); - - if (props.getIsAmendmentworkflowEnabed()) { - - ProcessInstance processInstance = ProcessInstance.builder() - .businessService(workflowName) - .moduleName(amendment.getBusinessService()) - .action(props.getAmendmentWfOpenAction()) - .businessId(amendment.getAmendmentId()) - .tenantId(amendment.getTenantId()) - .build(); - - amendment.setWorkflow(processInstance); - } else { - amendment.setStatus(AmendmentStatus.ACTIVE); - } - - } - - /** - * Validating for update - * @param amendmentUpdateRequest - */ - public Amendment validateAndEnrichAmendmentForUpdate(@Valid AmendmentUpdateRequest amendmentUpdateRequest) { - - if (!props.getIsAmendmentworkflowEnabed()) { - throw new CustomException("EG_BS_AMENDMENT_UPDATE_WF_ERROR", - "Amendment update is not allowed when workflow is disabled"); - } - - Map errorMap = new HashMap<>(); - AmendmentUpdate amendmentUpdate = amendmentUpdateRequest.getAmendmentUpdate(); - - /* - * checking for amendment in system - */ - List amendments = amendmentRepository.getAmendments(amendmentUpdate.toSearchCriteria()); - if(CollectionUtils.isEmpty(amendments)) - errorMap.put("EG_BS_AMENDMENT_UPDATE_ERROR", "No Amendment found in the system for the given amendmentId, Please provide valid id for update"); - - /* - * validating workflow fields - */ - ProcessInstance workflow = amendmentUpdate.getWorkflow(); - - if (workflow.getAction() == null || workflow.getBusinessId() == null - || workflow.getBusinessService() == null || workflow.getModuleName() == null) { - - errorMap.put("EG_BS_AMENDMENT_UPDATE_WF_ERROR", - "Mandatory workflow fileds missing in the update request, Please add all the following fields module, businessservice, businessid and action"); - } else { - workflow.setBusinessId(amendmentUpdate.getAmendmentId()); - } - - if (!CollectionUtils.isEmpty(errorMap)) - throw new CustomException(errorMap); - - /* - * enriching the update object - */ - amendmentUpdate.setAdditionalDetails(util.jsonMerge(amendments.get(0).getAdditionalDetails(), amendmentUpdate.getAdditionalDetails())); - amendmentUpdate.setAuditDetails(util.getAuditDetail(amendmentUpdateRequest.getRequestInfo())); - return amendments.get(0); - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/validator/BillValidator.java b/business-services/billing-service/src/main/java/org/egov/demand/web/validator/BillValidator.java deleted file mode 100644 index ecf0ce4c459..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/validator/BillValidator.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.egov.demand.web.validator; - -import static org.egov.demand.util.Constants.BILL_GEN_MANDATORY_FIELDS_MISSING_KEY; -import static org.egov.demand.util.Constants.BILL_GEN_MANDATORY_FIELDS_MISSING_MSG; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.BillV2.BillStatus; -import org.egov.demand.model.GenerateBillCriteria; -import org.egov.demand.model.UpdateBillCriteria; -import org.egov.demand.util.Constants; -import org.egov.demand.util.Util; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -import com.fasterxml.jackson.databind.JsonNode; - -@Component -public class BillValidator { - - @Autowired - private Util util; - - /** - * validtes the bill gen criteria - * - * @param generateBillCriteria - */ - public void validateBillGenRequest(GenerateBillCriteria generateBillCriteria, RequestInfo requestInfo) { - - util.validateTenantIdForUserType(generateBillCriteria.getTenantId(), requestInfo); - - boolean demandIdNotProvided = null == generateBillCriteria.getDemandId(); - - boolean payerDataNotProvided = (generateBillCriteria.getMobileNumber() == null - && generateBillCriteria.getEmail() == null); - - boolean isCombinationOfBusinessOrCosnumerCodeMissing = generateBillCriteria.getBusinessService() == null - || CollectionUtils.isEmpty(generateBillCriteria.getConsumerCode()); - - if (demandIdNotProvided && payerDataNotProvided && isCombinationOfBusinessOrCosnumerCodeMissing) - throw new CustomException(BILL_GEN_MANDATORY_FIELDS_MISSING_KEY, BILL_GEN_MANDATORY_FIELDS_MISSING_MSG); - - } - - public void validateBillSearchCriteria(BillSearchCriteria billCriteria, RequestInfo requestInfo) { - - util.validateTenantIdForUserType(billCriteria.getTenantId(), requestInfo); - - if (billCriteria.getBillId() == null && CollectionUtils.isEmpty(billCriteria.getConsumerCode()) - && billCriteria.getMobileNumber() == null && billCriteria.getEmail() == null) { - - throw new CustomException("EGBS_MANDATORY_FIELDS_ERROR", - "BILL_SEARCH_MANDATORY_FIELDS_MISSING Any one of the fields additional to tenantId is mandatory like consumerCode,billId, mobileNumber or email"); - } else if ((billCriteria.getConsumerCode() != null && billCriteria.getService() == null)) { - - throw new CustomException("BILL_SEARCH_CONSUMERCODE_BUSINESSSERVICE", - " the consumerCode & Service values should be given together or mobilenumber/email can be given "); - } - } - - public void validateBillSearchRequest(UpdateBillCriteria cancelBillCriteria) { - - cancelBillCriteria.setStatusToBeUpdated(BillStatus.CANCELLED); - JsonNode additionalDetails = cancelBillCriteria.getAdditionalDetails(); - Map errorMap = new HashMap<>(); - - JsonNode reasonMsg = additionalDetails.get(Constants.CANCELLATION_REASON_MSG); - JsonNode reasonCode = additionalDetails.get(Constants.CANCELLATION_REASON_CODE); - - if (null != reasonCode && reasonCode.isTextual()) { - if (StringUtils.isEmpty(reasonCode.textValue())) - errorMap.put(Constants.CANCELL_REASON_CODE_NOT_FOUND, Constants.CANCELL_REASON_CODE_EMPTY_MSG); - } else { - errorMap.put(Constants.CANCELL_REASON_CODE_NOT_FOUND, Constants.CANCELL_REASON_CODE_NOT_FOUND_MSG); - } - - if (null != reasonMsg && reasonMsg.isTextual()) { - if (StringUtils.isEmpty(reasonMsg.textValue())) - errorMap.put(Constants.CANCELL_REASON_MSG_NOT_FOUND, Constants.CANCELL_REASON_MSG_EMPTY_MSG); - } else { - errorMap.put(Constants.CANCELL_REASON_MSG_NOT_FOUND, Constants.CANCELL_REASON_MSG_NOT_FOUND_MSG); - } - - if (!CollectionUtils.isEmpty(errorMap)) { - throw new CustomException(errorMap); - } - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/validator/DemandValidator.java b/business-services/billing-service/src/main/java/org/egov/demand/web/validator/DemandValidator.java deleted file mode 100644 index c0fdb21c0a7..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/validator/DemandValidator.java +++ /dev/null @@ -1,407 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.demand.web.validator; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.model.TaxHeadMaster; -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.egov.demand.model.TaxPeriod; -import org.egov.demand.repository.DemandRepository; -import org.egov.demand.repository.PayerRepository; -import org.egov.demand.service.BusinessServDetailService; -import org.egov.demand.service.TaxHeadMasterService; -import org.egov.demand.service.TaxPeriodService; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.contract.TaxPeriodCriteria; -import org.egov.demand.web.contract.User; -import org.egov.demand.web.contract.UserSearchRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.validation.Errors; -import org.springframework.validation.Validator; - -import lombok.extern.slf4j.Slf4j; - -@Component -@Slf4j -public class DemandValidator implements Validator { - - @Autowired - private TaxHeadMasterService taxHeadMasterService; - - @Autowired - private PayerRepository ownerRepository; - - @Autowired - private BusinessServDetailService businessServDetailService; - - @Autowired - private TaxPeriodService taxPeriodService; - - @Autowired - private DemandRepository demandRepository; - - @Override - public boolean supports(Class clazz) { - - return DemandRequest.class.equals(clazz); - } - - @Override - public void validate(Object target, Errors errors) { - - DemandRequest demandRequest = null; - if (target instanceof DemandRequest) - demandRequest = (DemandRequest) target; - else - throw new RuntimeException("Invalid Object type for Demand validator"); - validateDemand(demandRequest.getDemands(), errors); - - List demandDetails = new ArrayList<>(); - for (Demand demand : demandRequest.getDemands()) { - demandDetails.addAll(demand.getDemandDetails()); - } - validateDemandDetails(demandDetails, errors); - validateTaxHeadMaster(demandRequest, errors); - validateBusinessService(demandRequest, errors); - validateTaxPeriod(demandRequest, errors); - validateOwner(demandRequest, errors); - } - - public void validateForUpdate(Object target, Errors errors) { - - DemandRequest demandRequest = null; - if (target instanceof DemandRequest) - demandRequest = (DemandRequest) target; - else - throw new RuntimeException("Invalid Object type for Demand validator"); - validateDemandForUpdate(demandRequest, errors); - validateTaxHeadMaster(demandRequest, errors); - validateBusinessService(demandRequest, errors); - validateTaxPeriod(demandRequest, errors); - validateOwner(demandRequest, errors); - } - - private void validateDemandForUpdate(DemandRequest demandRequest, Errors errors) { - - List demands = demandRequest.getDemands(); - String tenantId = demands.get(0).getTenantId(); - - List oldDemands = new ArrayList<>(); - List olddemandDetails = new ArrayList<>(); - List newDemands = new ArrayList<>(); - List newDemandDetails = new ArrayList<>(); - - for (Demand demand : demandRequest.getDemands()) { - if (demand.getId() != null) { - oldDemands.add(demand); - for (DemandDetail demandDetail : demand.getDemandDetails()) { - if (demandDetail.getId() != null) - olddemandDetails.add(demandDetail); - else - newDemandDetails.add(demandDetail); - } - } else { - newDemands.add(demand); - newDemandDetails.addAll(demand.getDemandDetails()); - } - } - validateOldDemands(oldDemands, olddemandDetails, errors, tenantId); - validateDemand(newDemands, errors); - validateDemandDetails(newDemandDetails, errors); - } - - private void validateOldDemands(List oldDemands, List olddemandDetails, Errors errors, - String tenantId) { - - Set demandIds = oldDemands.stream().map(demand -> demand.getId()).collect(Collectors.toSet()); - DemandCriteria demandCriteria = DemandCriteria.builder().tenantId(tenantId).demandId(demandIds).build(); - Map demandMap = demandRepository.getDemands(demandCriteria).stream() - .collect(Collectors.toMap(Demand::getId, Function.identity())); - Map dbDemandDetailMap = new HashMap<>(); - int index = 0; - for (Demand demand : oldDemands) { - Demand dbDemand = demandMap.get(demand.getId()); - if (dbDemand == null) - errors.rejectValue("Demands[" + index + "].id", "DEMAND_INVALID_ID", - "the given demandId value is invalid and cannot be updated"); - else { - for (DemandDetail demandDetail : dbDemand.getDemandDetails()) { - dbDemandDetailMap.put(demandDetail.getId(), demandDetail); - } - } - index++; - } - - for (DemandDetail demandDetail : olddemandDetails) { - if (dbDemandDetailMap.get(demandDetail.getId()) == null) - errors.rejectValue("Demands", "DEMAND_DETAIL_INVALID_ID", "the given demandDetailId value : " - + demandDetail.getId() + " is invalid and cannot be updated"); - } - } - - private void validateDemand(List demands, Errors errors) { - - Map> businessConsumerValidatorMap = new HashMap<>(); - String tenatId = null; - - for (Demand demand : demands) { - tenatId = demand.getTenantId(); - Set consumerCodes = businessConsumerValidatorMap.get(demand.getBusinessService()); - if (consumerCodes != null) - consumerCodes.add(demand.getConsumerCode()); - else { - consumerCodes = new HashSet<>(); - consumerCodes.add(demand.getConsumerCode()); - businessConsumerValidatorMap.put(demand.getBusinessService(), consumerCodes); - } - } - List dbDemands = demandRepository.getDemandsForConsumerCodes(businessConsumerValidatorMap, tenatId); - Map> dbDemandMap = dbDemands.stream() - .collect(Collectors.groupingBy(Demand::getConsumerCode, Collectors.toList())); - - int index = 0; - if (!dbDemandMap.isEmpty()) { - for (Demand demand : demands) { - for (Demand demandFromMap : dbDemandMap.get(demand.getConsumerCode())) { - if (demand.getTaxPeriodFrom().equals(demandFromMap.getTaxPeriodFrom()) - && demand.getTaxPeriodTo().equals(demandFromMap.getTaxPeriodTo())) - errors.rejectValue("Demands[" + index + "].consumerCode", "DEMAND_DUPLICATE_CONSUMERCODE", - "the consumerCode value : " + demand.getConsumerCode() + " with tax period from " - + demand.getTaxPeriodFrom() + " and tax period to " + demand.getTaxPeriodTo() - + " already exists for businessService: " + demand.getBusinessService()); - } - index++; - } - } - } - - private void validateDemandDetails(List demandDetails, Errors errors) { - - - for (DemandDetail demandDetail : demandDetails) { - - if (!"ADVANCE".equalsIgnoreCase(demandDetail.getTaxHeadMasterCode())) { - BigDecimal tax = demandDetail.getTaxAmount(); - BigDecimal collection = demandDetail.getCollectionAmount(); - int i = tax.compareTo(collection); - if (i < 0) - errors.rejectValue("Demands", "", "DEMAND_DETAIL_COLLECTIONAMOUNT : " + collection - + " should not be greater than taxAmount : " + tax + " for demandDetail"); - } - } - - } - - private void validateTaxPeriod(DemandRequest demandRequest, Errors errors) { - - List demands = demandRequest.getDemands(); - Long startDate = demands.get(0).getTaxPeriodFrom(); - Long endDate = demands.get(0).getTaxPeriodTo(); - String tenantId = demands.get(0).getTenantId(); - Set businessServiceDetails = new HashSet<>(); - - for (Demand demand : demands) { - businessServiceDetails.add(demand.getBusinessService()); - if (startDate > demand.getTaxPeriodFrom()) - startDate = demand.getTaxPeriodFrom(); - if (endDate < demand.getTaxPeriodTo()) - endDate = demand.getTaxPeriodTo(); - } - - TaxPeriodCriteria taxPeriodCriteria = TaxPeriodCriteria.builder().service(businessServiceDetails) - .fromDate(startDate).toDate(endDate).tenantId(tenantId).build(); - Map> taxPeriodMap = taxPeriodService - .searchTaxPeriods(taxPeriodCriteria, demandRequest.getRequestInfo()).getTaxPeriods().stream() - .collect(Collectors.groupingBy(TaxPeriod::getService)); - - int index = 0; - for (Demand demand : demands) { - List taxPeriods = taxPeriodMap.get(demand.getBusinessService()); - if (taxPeriods != null) { - TaxPeriod taxPeriod = taxPeriods.stream() - .filter(t -> demand.getTaxPeriodFrom().compareTo(t.getFromDate()) >= 0 - && demand.getTaxPeriodTo().compareTo(t.getToDate()) <= 0) - .findAny().orElse(null); - if (taxPeriod == null) { - - boolean isFromPeriodAvailable = false; - boolean isToPeriodAvailable = false; - - for (TaxPeriod tp : taxPeriods) { - if (tp.getFromDate().equals(demand.getTaxPeriodFrom())) - isFromPeriodAvailable = true; - if (tp.getToDate().equals(demand.getTaxPeriodTo())) - isToPeriodAvailable = true; - } - if (!(isFromPeriodAvailable && isToPeriodAvailable)) - errors.rejectValue("Demands[" + index + "]", "DEMAND_BAD_TAXPERIOD", - "the given taxPeriod value periodFrom : '" + demand.getTaxPeriodFrom() - + "and periodTo : " + demand.getTaxPeriodTo() - + "'in Demand is invalid, please give a valid taxPeriod"); - } - } else { - errors.rejectValue("Demands[" + index + "].businessService", "DEMAND_BAD_BUSINESS_SERVICE_TAXPERIOD", - "no taxperiods found for value of Demand.businessService : " + demand.getBusinessService() - + " please give a valid businessService code"); - } - index++; - } - } - - private void validateBusinessService(DemandRequest demandRequest, Errors errors) { - - Set businessServiceSet = demandRequest.getDemands().stream().map(demand -> demand.getBusinessService()) - .collect(Collectors.toSet()); - BusinessServiceDetailCriteria businessServiceDetailCriteria = BusinessServiceDetailCriteria.builder() - .tenantId(demandRequest.getDemands().get(0).getTenantId()).businessService(businessServiceSet).build(); - List businessServiceDetails = businessServDetailService - .searchBusinessServiceDetails(businessServiceDetailCriteria, demandRequest.getRequestInfo()) - .getBusinessServiceDetails(); - if (businessServiceDetails.isEmpty()) - errors.rejectValue("Demands", "DEMAND_INVALID_BUSINESS_SERVICE", - "no businessService is found for value of Demand.businessService, please give a valid businessService code"); - else { - Map map = businessServiceDetails.stream() - .collect(Collectors.toMap(BusinessServiceDetail::getBusinessService, Function.identity())); - for (String businessService : businessServiceSet) { - if (map.get(businessService) == null) - errors.rejectValue("Demands", "DEMAND_INVALID_BUSINESS_SERVICE", "the given businessService value '" - + businessService - + "'of Demand.businessService is invalid, please give a valid businessService code"); - } - } - } - - private void validateTaxHeadMaster(DemandRequest demandRequest, Errors errors) { - - Map codeDemandMap = new HashMap<>(); - for (Demand demand : demandRequest.getDemands()) { - for (DemandDetail demandDetail : demand.getDemandDetails()) { - codeDemandMap.put(demandDetail.getTaxHeadMasterCode(), demand); - } - } - TaxHeadMasterCriteria taxHeadMasterCriteria = TaxHeadMasterCriteria.builder() - .tenantId(demandRequest.getDemands().get(0).getTenantId()).code(codeDemandMap.keySet()).build(); - List taxHeadMasters = taxHeadMasterService - .getTaxHeads(taxHeadMasterCriteria, demandRequest.getRequestInfo()).getTaxHeadMasters(); - if (taxHeadMasters.isEmpty()) - errors.rejectValue("Demands", "DEMAND_INVALID_TAXHEADMASTERS", - "no taxheadmasters found for the given code value DemandDetail.code, please give a valid code"); - else { - Map> taxHeadMap = taxHeadMasters.stream() - .collect(Collectors.groupingBy(TaxHeadMaster::getCode, Collectors.toList())); - for (String code : codeDemandMap.keySet()) { - Demand demand = codeDemandMap.get(code); - if (taxHeadMap.get(code) == null) - errors.rejectValue("Demands", "DEMAND_INVALID_TAXHEADMASTERS", "the given code value '" + code - + "'of teaxheadmaster in DemandDetail.code is invalid, please give a valid code"); - else { - TaxHeadMaster taxHeadMaster = taxHeadMasters.stream() - .filter(t -> demand.getTaxPeriodFrom().compareTo(t.getValidFrom()) >= 0 - && demand.getTaxPeriodTo().compareTo(t.getValidTill()) <= 0) - .findAny().orElse(null); - if (taxHeadMaster == null) - errors.rejectValue("Demands", "DEMAND_INVALID_TAXHEADMASTERS_TAXPERIOD", - " No TaxHeadMaster found for given code value '" + code + "' and from date'" - + demand.getTaxPeriodFrom() + "' and To date '" + demand.getTaxPeriodTo() - + "', please give valid code and period"); - } - } - } - } - - private void validateOwner(DemandRequest demandRequest, Errors errors) { - - List demands = demandRequest.getDemands(); - List owners = null; - List ownerIds = new ArrayList<>(demands.stream().filter(demand -> null != demand.getPayer()) - .map(demand -> demand.getPayer().getId()).collect(Collectors.toSet())); - - if (!CollectionUtils.isEmpty(ownerIds)) { - - UserSearchRequest userSearchRequest = UserSearchRequest.builder() - .requestInfo(demandRequest.getRequestInfo()).id(ownerIds).tenantId(demands.get(0).getTenantId()) - .userType("CITIZEN").pageSize(500).build(); - - log.info("The user search req : " + userSearchRequest); - owners = ownerRepository.getPayers(userSearchRequest); - } - - if (!CollectionUtils.isEmpty(owners)) { - - Map ownerMap = owners.stream().collect(Collectors.toMap(User::getId, User::getId)); - for (Long rsId : ownerIds) { - if (null != rsId && ownerMap.get(rsId) == null) - errors.rejectValue("demands", "DEMAND_INVALID_OWNER", "the given user id value '" + rsId - + "' in Owner.id is invalid, please give a valid user id"); - } - } - } - - public void validateDemandCriteria(DemandCriteria demandCriteria, Errors errors) { - - if (demandCriteria.getDemandId() == null && demandCriteria.getConsumerCode() == null - && demandCriteria.getEmail() == null && demandCriteria.getMobileNumber() == null - && demandCriteria.getBusinessService() == null && demandCriteria.getDemandFrom() == null - && demandCriteria.getDemandTo() == null && demandCriteria.getType() == null) - errors.rejectValue("businessService", "", " Any one of the fields additional to tenantId is mandatory"); - else if (demandCriteria.getReceiptRequired() - && (demandCriteria.getBusinessService() == null || demandCriteria.getConsumerCode() == null)) - errors.rejectValue("businessService", "", - "For searching collected receipts, businessService and consumerCode are mandatory"); - } - -} diff --git a/business-services/billing-service/src/main/java/org/egov/demand/web/validator/DemandValidatorV1.java b/business-services/billing-service/src/main/java/org/egov/demand/web/validator/DemandValidatorV1.java deleted file mode 100644 index 9a2cf12c4b3..00000000000 --- a/business-services/billing-service/src/main/java/org/egov/demand/web/validator/DemandValidatorV1.java +++ /dev/null @@ -1,613 +0,0 @@ -package org.egov.demand.web.validator; - -import static org.egov.demand.util.Constants.BUSINESSSERVICE_NOT_FOUND_KEY; -import static org.egov.demand.util.Constants.BUSINESSSERVICE_NOT_FOUND_MSG; -import static org.egov.demand.util.Constants.BUSINESSSERVICE_NOT_FOUND_REPLACETEXT; -import static org.egov.demand.util.Constants.BUSINESSSERVICE_PATH_CODE; -import static org.egov.demand.util.Constants.CONSUMER_CODE_DUPLICATE_CONSUMERCODE_TEXT; -import static org.egov.demand.util.Constants.CONSUMER_CODE_DUPLICATE_KEY; -import static org.egov.demand.util.Constants.CONSUMER_CODE_DUPLICATE_MSG; -import static org.egov.demand.util.Constants.DEMAND_DETAIL_NOT_FOUND_KEY; -import static org.egov.demand.util.Constants.DEMAND_DETAIL_NOT_FOUND_MSG; -import static org.egov.demand.util.Constants.DEMAND_DETAIL_NOT_FOUND_REPLACETEXT; -import static org.egov.demand.util.Constants.DEMAND_NOT_FOUND_KEY; -import static org.egov.demand.util.Constants.DEMAND_NOT_FOUND_MSG; -import static org.egov.demand.util.Constants.DEMAND_NOT_FOUND_REPLACETEXT; -import static org.egov.demand.util.Constants.DEMAND_WITH_NO_ID_KEY; -import static org.egov.demand.util.Constants.DEMAND_WITH_NO_ID_MSG; -import static org.egov.demand.util.Constants.EMPLOYEE_UUID_FOUND_KEY; -import static org.egov.demand.util.Constants.EMPLOYEE_UUID_FOUND_MSG; -import static org.egov.demand.util.Constants.INVALID_BUSINESS_FOR_TAXPERIOD_KEY; -import static org.egov.demand.util.Constants.INVALID_BUSINESS_FOR_TAXPERIOD_MSG; -import static org.egov.demand.util.Constants.INVALID_BUSINESS_FOR_TAXPERIOD_REPLACE_TEXT; -import static org.egov.demand.util.Constants.INVALID_DEMAND_DETAIL_COLLECTION_TEXT; -import static org.egov.demand.util.Constants.INVALID_DEMAND_DETAIL_ERROR_MSG; -import static org.egov.demand.util.Constants.INVALID_NEGATIVE_DEMAND_DETAIL_ERROR_MSG; -import static org.egov.demand.util.Constants.INVALID_DEMAND_DETAIL_KEY; -import static org.egov.demand.util.Constants.INVALID_DEMAND_DETAIL_MSG; -import static org.egov.demand.util.Constants.INVALID_DEMAND_DETAIL_REPLACETEXT; -import static org.egov.demand.util.Constants.INVALID_DEMAND_DETAIL_TAX_TEXT; -import static org.egov.demand.util.Constants.TAXHEADMASTER_PATH_CODE; -import static org.egov.demand.util.Constants.TAXHEADS_NOT_FOUND_KEY; -import static org.egov.demand.util.Constants.TAXHEADS_NOT_FOUND_MSG; -import static org.egov.demand.util.Constants.TAXHEADS_NOT_FOUND_REPLACETEXT; -import static org.egov.demand.util.Constants.TAXPERIOD_NOT_FOUND_FROMDATE; -import static org.egov.demand.util.Constants.TAXPERIOD_NOT_FOUND_KEY; -import static org.egov.demand.util.Constants.TAXPERIOD_NOT_FOUND_MSG; -import static org.egov.demand.util.Constants.TAXPERIOD_NOT_FOUND_TODATE; -import static org.egov.demand.util.Constants.TAXPERIOD_PATH_CODE; -import static org.egov.demand.util.Constants.USER_UUID_NOT_FOUND_KEY; -import static org.egov.demand.util.Constants.USER_UUID_NOT_FOUND_MSG; -import static org.egov.demand.util.Constants.USER_UUID_NOT_FOUND_REPLACETEXT; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.Demand; -import org.egov.demand.model.Demand.StatusEnum; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.model.TaxHeadMaster; -import org.egov.demand.model.TaxPeriod; -import org.egov.demand.repository.DemandRepository; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.demand.service.UserService; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.contract.User; -import org.egov.demand.web.contract.UserResponse; -import org.egov.demand.web.contract.UserSearchRequest; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -import lombok.extern.slf4j.Slf4j; - -@Component -@Slf4j -public class DemandValidatorV1 { - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Autowired - private ObjectMapper mapper; - - @Autowired - UserService userService; - - @Autowired - private DemandRepository demandRepository; - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - private Util util; - - /** - * Method to validate new demand request - * - * @param demandRequest - */ - public void validatedemandForCreate(DemandRequest demandRequest, Boolean isCreate, DocumentContext mdmsData) { - - RequestInfo requestInfo = demandRequest.getRequestInfo(); - List demands = demandRequest.getDemands(); - - /* - * Extracting the respective masters from DocumentContext - */ - List businessServiceCodes = mdmsData.read(BUSINESSSERVICE_PATH_CODE); - List taxHeads = Arrays.asList(mapper.convertValue(mdmsData.read(TAXHEADMASTER_PATH_CODE), TaxHeadMaster[].class)); - - /* - * grouping by the list of taxHeads to a map of businessService and List of taxHead codes - */ - Map> businessTaxCodeMap = taxHeads.stream().collect(Collectors.groupingBy( - TaxHeadMaster::getService, Collectors.toMap(TaxHeadMaster::getCode, Function.identity()))); - - /* - * mdms-data read returns a list of hashMap which is converted to array of tax-period and then to list - */ - List taxPeriods = Arrays.asList(mapper.convertValue(mdmsData.read(TAXPERIOD_PATH_CODE), TaxPeriod[].class)); - - /* - * Grouping by the list periods on business services - */ - Map> taxPeriodBusinessMap = taxPeriods.stream() - .collect(Collectors.groupingBy(TaxPeriod::getService)); - Set payerIds = new HashSet<>(); - - /* demand details list for validation */ - List detailsForValidation = new ArrayList<>(); - - /* business consumer map for validating uniqueness of consumer code */ - Map> businessConsumerValidatorMap = new HashMap<>(); - - Set businessServicesWithNoTaxPeriods = new HashSet<>(); - Set businessServicesNotFound = new HashSet<>(); - Set taxHeadsNotFound = new HashSet<>(); - - Map errorMap = new HashMap<>(); - - for (Demand demand : demands) { - - List details = demand.getDemandDetails(); - Map taxHeadMap = businessTaxCodeMap.get(demand.getBusinessService()); - log.info(" the taxhead map : " + taxHeadMap); - detailsForValidation.addAll(details); - - if (isCreate) { - /* passing the businessConsumerValidator map to be enriched for validation */ - enrichConsumerCodesWithBusinessMap(businessConsumerValidatorMap, demand); - } - - if (null != demand.getPayer() && !StringUtils.isEmpty(demand.getPayer().getUuid())) - payerIds.add(demand.getPayer().getUuid()); - - if (!businessServiceCodes.contains(demand.getBusinessService())) - businessServicesNotFound.add(demand.getBusinessService()); - - if (!CollectionUtils.isEmpty(taxHeadMap)) - details.forEach(detail -> { - - if (!taxHeadMap.containsKey(detail.getTaxHeadMasterCode())) - taxHeadsNotFound.add(detail.getTaxHeadMasterCode()); - }); - - validateTaxPeriod(taxPeriodBusinessMap, demand, errorMap, businessServicesWithNoTaxPeriods); - - // by default demands are being set to active during create but validation should be done for inactive/ cancelled demand in another logic - if(demand.getStatus() == null) demand.setStatus(StatusEnum.ACTIVE); - } - - /* - * Validating payer(Citizen) data - */ - validatePayer(demands, payerIds, requestInfo, errorMap); - /* - * Validating demand details for tax and collection amount - * - * if called from update no need to call detail validation - */ - validateDemandDetailsForAmount(detailsForValidation, errorMap); - - if (isCreate) { - /* validating consumer codes for create demands*/ - validateConsumerCodes(demands, businessConsumerValidatorMap, errorMap); - } - - /* passing collected values to throw errors - * - * method separated to increase readability - * */ - throwErrorForCreate(businessServicesWithNoTaxPeriods, businessServicesNotFound, taxHeadsNotFound, errorMap); - } - - /** - * Private method to throw errors for create validation - * - * @param businessServicesWithNoTaxPeriods - * @param businessServicesNotFound - * @param taxHeadsNotFound - * @param errorMap - */ - private void throwErrorForCreate(Set businessServicesWithNoTaxPeriods, - Set businessServicesNotFound, Set taxHeadsNotFound, Map errorMap) { - - if (!CollectionUtils.isEmpty(taxHeadsNotFound)) - errorMap.put(TAXHEADS_NOT_FOUND_KEY, - TAXHEADS_NOT_FOUND_MSG.replace(TAXHEADS_NOT_FOUND_REPLACETEXT, taxHeadsNotFound.toString())); - - if (!CollectionUtils.isEmpty(businessServicesNotFound)) - errorMap.put(BUSINESSSERVICE_NOT_FOUND_KEY, BUSINESSSERVICE_NOT_FOUND_MSG - .replace(BUSINESSSERVICE_NOT_FOUND_REPLACETEXT, businessServicesNotFound.toString())); - - if (!CollectionUtils.isEmpty(businessServicesWithNoTaxPeriods)) - errorMap.put(INVALID_BUSINESS_FOR_TAXPERIOD_KEY, INVALID_BUSINESS_FOR_TAXPERIOD_MSG - .replace(INVALID_BUSINESS_FOR_TAXPERIOD_REPLACE_TEXT, businessServicesWithNoTaxPeriods.toString())); - - if (!CollectionUtils.isEmpty(errorMap)) - throw new CustomException(errorMap); - } - - /** - * Method to validate the tax period of the demand - * - * @param taxPeriodBusinessMap - * @param demand - * @param errorMap - * @param businessServicesWithNoTaxPeriods - */ - private void validateTaxPeriod(Map> taxPeriodBusinessMap, Demand demand, - Map errorMap, Set businessServicesWithNoTaxPeriods) { - - /* - * Getting the list of tax periods belonging to the current business service - */ - List taxPeriods = taxPeriodBusinessMap.get(demand.getBusinessService()); - - - if (taxPeriods != null) { - - /* - * looping the list of business services to check if the given demand periods gets match - */ - TaxPeriod taxPeriod = taxPeriods.stream() - .filter(t -> demand.getTaxPeriodFrom().compareTo(t.getFromDate()) >= 0 - && demand.getTaxPeriodTo().compareTo(t.getToDate()) <= 0) - .findAny().orElse(null); - - if (taxPeriod == null) { - - String msg = TAXPERIOD_NOT_FOUND_MSG - .replace(TAXPERIOD_NOT_FOUND_FROMDATE, demand.getTaxPeriodFrom().toString()) - .replace(TAXPERIOD_NOT_FOUND_TODATE, demand.getTaxPeriodTo().toString()); - errorMap.put(TAXPERIOD_NOT_FOUND_KEY, msg); - } - - } else { - /* - * Adding business service name to the set "businessServicesWithNoTaxPeriods" - */ - businessServicesWithNoTaxPeriods.add(demand.getBusinessService()); - } - - } - - /** - * Method to enrich the businessConsumerMap which will be passed to consumer code validator - * - * @param businessConsumerValidatorMap - * @param demand - */ - private void enrichConsumerCodesWithBusinessMap(Map> businessConsumerValidatorMap, - Demand demand) { - - Set consumerCodes = businessConsumerValidatorMap.get(demand.getBusinessService()); - if (consumerCodes != null) - consumerCodes.add(demand.getConsumerCode()); - else { - consumerCodes = new HashSet<>(); - consumerCodes.add(demand.getConsumerCode()); - businessConsumerValidatorMap.put(demand.getBusinessService(), consumerCodes); - } - } - - /** - * Method to validate the Consumer codes in demand request for period and business Code - * - * @param demands list of demand to be validated - * @param errorMap map with error key and msg - */ - private void validateConsumerCodes(List demands, Map> businessConsumerValidatorMap, - Map errorMap) { - - String tenantId = demands.get(0).getTenantId(); - List errors = new ArrayList<>(); - - /* - * Collecting the demands from DB for the consumer codes in to a map - */ - List dbDemands = demandRepository.getDemandsForConsumerCodes(businessConsumerValidatorMap, tenantId); - Map> dbDemandMap = dbDemands.stream() - .collect(Collectors.groupingBy(Demand::getConsumerCode, Collectors.toList())); - - if (!dbDemandMap.isEmpty()) { - for (Demand demand : demands) { - - List demandsWithSamekey = dbDemandMap.get(demand.getConsumerCode()); - if (CollectionUtils.isEmpty(demandsWithSamekey)) - continue; - - for (Demand demandFromMap : demandsWithSamekey) { - if (demand.getTaxPeriodFrom().equals(demandFromMap.getTaxPeriodFrom()) - && demand.getTaxPeriodTo().equals(demandFromMap.getTaxPeriodTo())) - errors.add(demand.getConsumerCode()); - } - } - } - - if(!CollectionUtils.isEmpty(errors)) - errorMap.put(CONSUMER_CODE_DUPLICATE_KEY, - CONSUMER_CODE_DUPLICATE_MSG.replace(CONSUMER_CODE_DUPLICATE_CONSUMERCODE_TEXT, errors.toString())); - } - - /** - * Method to validate payer(user/citizen) data in demand - * - * @param payerIds - * @param requestInfo - * @param errorMap - */ - private void validatePayer(List demands, Set payerIds, RequestInfo requestInfo, Map errorMap) { - - List owners = null; - Set missingIds = new HashSet<>(); - Set employeeIds = new HashSet<>(); - Map ownerMap = new HashMap<>(); - - if (!CollectionUtils.isEmpty(payerIds)) { - - String url = applicationProperties.getUserServiceHostName().concat(applicationProperties.getUserServiceSearchPath()); - - UserSearchRequest userSearchRequest = UserSearchRequest.builder().requestInfo(requestInfo).uuid(payerIds) - .pageSize(500).build(); - - owners = mapper - .convertValue(serviceRequestRepository.fetchResult(url, userSearchRequest), UserResponse.class) - .getUser(); - - if (CollectionUtils.isEmpty(owners)) - errorMap.put(USER_UUID_NOT_FOUND_KEY, - USER_UUID_NOT_FOUND_MSG.replace(USER_UUID_NOT_FOUND_REPLACETEXT, payerIds.toString())); - - ownerMap.putAll(owners.stream().collect(Collectors.toMap(User::getUuid, Function.identity()))); - } - - - /* - * Adding the missing ids to the list to be added to error map - */ - for (Demand demand : demands) { - - User payerFromDemand = demand.getPayer(); - - if (null != payerFromDemand && null != payerFromDemand.getUuid()) { - - String uuid = demand.getPayer().getUuid(); - User payer = ownerMap.get(uuid); - - if (payer == null) - missingIds.add(uuid); - else if ("EMPLOYEE".equalsIgnoreCase(payer.getType())) - employeeIds.add(uuid); - else - demand.setPayer(payer); - - } else if (null != payerFromDemand - && (null != payerFromDemand.getMobileNumber() && null != payerFromDemand.getName()) - && applicationProperties.getIsUserCreateEnabled()) { - getuserFromNameAndNumber(demand, requestInfo); - } - } - - if (!CollectionUtils.isEmpty(employeeIds)) - errorMap.put(EMPLOYEE_UUID_FOUND_KEY, - EMPLOYEE_UUID_FOUND_MSG.replace(USER_UUID_NOT_FOUND_REPLACETEXT, employeeIds.toString())); - - if (!CollectionUtils.isEmpty(missingIds)) - errorMap.put(USER_UUID_NOT_FOUND_KEY, - USER_UUID_NOT_FOUND_MSG.replace(USER_UUID_NOT_FOUND_REPLACETEXT, missingIds.toString())); - - } - - /** - * Method to validate demand details based on tax and collection amount - * - * @param demandDetails - * @param errorMap - */ - public void validateDemandDetailsForAmount(List demandDetails, Map errorMap) { - - List errors = new ArrayList<>(); - - for (DemandDetail demandDetail : demandDetails) { - - BigDecimal tax = demandDetail.getTaxAmount(); - BigDecimal collection = demandDetail.getCollectionAmount(); - - Boolean isTaxGtZeroAndCollectionGtTaxOrCollectionLtZero = tax.compareTo(BigDecimal.ZERO) >= 0 - && (tax.compareTo(collection) < 0 || collection.compareTo(BigDecimal.ZERO) < 0); - - Boolean isTaxLtZeroAndCollectionNeToZeroAndCollectionGtTax = tax.compareTo(BigDecimal.ZERO) < 0 - && collection.compareTo(tax) != 0 && collection.compareTo(BigDecimal.ZERO) != 0; - - if (isTaxGtZeroAndCollectionGtTaxOrCollectionLtZero) { - errors.add(INVALID_DEMAND_DETAIL_ERROR_MSG - .replace(INVALID_DEMAND_DETAIL_COLLECTION_TEXT, collection.toString()) - .replace(INVALID_DEMAND_DETAIL_TAX_TEXT, tax.toString())); - } - else if (isTaxLtZeroAndCollectionNeToZeroAndCollectionGtTax) { - - errors.add(INVALID_NEGATIVE_DEMAND_DETAIL_ERROR_MSG - .replace(INVALID_DEMAND_DETAIL_COLLECTION_TEXT, collection.toString()) - .replace(INVALID_DEMAND_DETAIL_TAX_TEXT, tax.toString())); - - } - } - if (!CollectionUtils.isEmpty(errors)) - errorMap.put(INVALID_DEMAND_DETAIL_KEY, - INVALID_DEMAND_DETAIL_MSG.replace(INVALID_DEMAND_DETAIL_REPLACETEXT, errors.toString())); - } - - -/* - * - * update validation - * - * - */ - - /** - * Method to validate the update request - * - * internally calls the create method to validate the new demands - * @param demandRequest - */ - public void validateForUpdate(DemandRequest demandRequest, DocumentContext mdmsData) { - - Map errorMap = new HashMap<>(); - List demands = demandRequest.getDemands(); - String tenantId = demands.get(0).getTenantId(); - - List oldDemands = new ArrayList<>(); - List olddemandDetails = new ArrayList<>(); - List newDemands = new ArrayList<>(); - List newDemandDetails = new ArrayList<>(); - - for (Demand demand : demandRequest.getDemands()) { - if (demand.getId() != null) { - oldDemands.add(demand); - for (DemandDetail demandDetail : demand.getDemandDetails()) { - if (demandDetail.getId() != null) - olddemandDetails.add(demandDetail); - else - newDemandDetails.add(demandDetail); - } - } else { - newDemands.add(demand); - newDemandDetails.addAll(demand.getDemandDetails()); - } - } - validateOldDemands(oldDemands, olddemandDetails, errorMap, tenantId); - - /* - * Validating all the demand details for tax and collection amount - */ - olddemandDetails.addAll(newDemandDetails); - validateDemandDetailsForAmount(olddemandDetails, errorMap); - - if(!errorMap.isEmpty()) - throw new CustomException(errorMap); - - /* - * validate demand for Create is called to validate the new demand details which is part of update - * - * error map will be thrown in the create method itself - */ - validatedemandForCreate(demandRequest, false,mdmsData); - } - - /** - * Method to validate the old demands for update - * - * Queries the DB and validates the result with the request demands - * - * @param oldDemands - * @param olddemandDetails - * @param errorMap - * @param tenantId - */ - private void validateOldDemands(List oldDemands, List olddemandDetails, Map errorMap, - String tenantId) { - - List unFoundDemandIds = new ArrayList<>(); - List unFoundDemandDetailIds = new ArrayList<>(); - - /* - * Demand search criteria creation - * - * fetching data from db based on the demand ids of the request - * - */ - Set demandIds = oldDemands.stream().map(Demand::getId).collect(Collectors.toSet()); - - if (CollectionUtils.isEmpty(demandIds)) { - errorMap.put(DEMAND_WITH_NO_ID_KEY, DEMAND_WITH_NO_ID_MSG); - throw new CustomException(errorMap); - } - - DemandCriteria demandCriteria = DemandCriteria.builder().tenantId(tenantId).demandId(demandIds).build(); - Map demandMap = demandRepository.getDemands(demandCriteria).stream() - .collect(Collectors.toMap(Demand::getId, Function.identity())); - Map dbDemandDetailMap = new HashMap<>(); - - /* - * Collecting ids of the demand and demand detail for which no match has been found - */ - for (Demand demand : oldDemands) { - Demand dbDemand = demandMap.get(demand.getId()); - if (dbDemand == null) - unFoundDemandIds.add(demand.getId()); - else { - /* payment completed field information cannot be changed from outside - */ - demand.setIsPaymentCompleted(dbDemand.getIsPaymentCompleted()); - dbDemandDetailMap.putAll(dbDemand.getDemandDetails().stream() - .collect(Collectors.toMap(DemandDetail::getId, Function.identity()))); - } - } - - for (DemandDetail demandDetail : olddemandDetails) { - if (dbDemandDetailMap.get(demandDetail.getId()) == null) - unFoundDemandDetailIds.add(demandDetail.getId()); - } - - if (!CollectionUtils.isEmpty(unFoundDemandIds)) - errorMap.put(DEMAND_NOT_FOUND_KEY, - DEMAND_NOT_FOUND_MSG.replace(DEMAND_NOT_FOUND_REPLACETEXT, unFoundDemandIds.toString())); - - if (!CollectionUtils.isEmpty(unFoundDemandDetailIds)) - errorMap.put(DEMAND_DETAIL_NOT_FOUND_KEY, DEMAND_DETAIL_NOT_FOUND_MSG - .replace(DEMAND_DETAIL_NOT_FOUND_REPLACETEXT, unFoundDemandDetailIds.toString())); - } - - /* - * Search validation - */ - - /** - * Method to validate demand search request - * - * @param demandCriteria - */ - public void validateDemandCriteria(DemandCriteria demandCriteria, RequestInfo requestInfo) { - - util.validateTenantIdForUserType(demandCriteria.getTenantId(), requestInfo); - Map errorMap = new HashMap<>(); - - if (demandCriteria.getDemandId() == null && demandCriteria.getConsumerCode() == null - && demandCriteria.getEmail() == null && demandCriteria.getMobileNumber() == null - && demandCriteria.getBusinessService() == null && demandCriteria.getDemandFrom() == null - && demandCriteria.getDemandTo() == null && demandCriteria.getType() == null) - errorMap.put("businessService", " Any one of the fields additional to tenantId is mandatory"); - - if (!CollectionUtils.isEmpty(errorMap)) - throw new CustomException(errorMap); - } - - /** - * If Citizen is paying then the id of the logged in user becomes payer id. - * If Employee is paying - * 1. the id of the payer info of the bill will be attached as payer id. - * 2. if user not found, new user will be created - * - * @param {@link Demand}, {@link RequestInfo} - */ - private void getuserFromNameAndNumber(Demand demand, RequestInfo requestInfo) { - - org.egov.common.contract.request.User userInfo = requestInfo.getUserInfo(); - User payer = demand.getPayer(); - - if (userInfo.getType().equalsIgnoreCase("CITIZEN")) { - payer.setUuid(userInfo.getUuid()); - } else { - - Map res = userService.getUser(requestInfo, payer.getMobileNumber(), payer.getName(), demand.getTenantId()); - if (CollectionUtils.isEmpty(res.keySet())) { - - payer.setUuid(userService.createUser(demand, requestInfo)); - } else { - payer.setUuid(res.get("id")); - } - } - demand.setPayer(payer); - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/application.properties b/business-services/billing-service/src/main/resources/application.properties deleted file mode 100644 index 89bfe0aea8f..00000000000 --- a/business-services/billing-service/src/main/resources/application.properties +++ /dev/null @@ -1,170 +0,0 @@ -#migration -migration.batch.value=100 - -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/devbackup -spring.datasource.username=postgres -spring.datasource.password=postgres - -#Set context root -server.context-path=/billing-service -server.servlet.context-path=/billing-service - -server.port = 8081 - -#USER APIs -user.service.hostname=http://egov-user:8080/ -user.service.searchpath=user/_search -egov.user.create.user=user/users/_createnovalidate -demand.is.user.create.enabled=true - -# KAFKA SERVER CONFIGURATIONS -kafka.config.bootstrap_server_config=localhost:9092 -spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=bs-persist -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer -spring.kafka.listener.missing-topics-fatal=false -spring.kafka.consumer.properties.spring.json.use.type.headers=false - -# BILL TOPICS -kafka.topics.save.bill=save-bill-db -kafka.topics.update.bill=update-bill-db -kafka.topics.save.bill.key=save-bill -kafka.topics.update.bill.key=update-bill - - -# Demand Topics -kafka.topics.save.demand=save-demand -kafka.topics.update.demand=update-demand -kafka.topics.updateMIS.demand=updateMIS-Demand -kafka.topics.receipt.update.collecteReceipt=egov-save-collected-receipt -kafka.topics.demandBill.update.name=demand-bill-update - -kafka.topics.payment.create=egov.collection.payment-create -kafka.topics.payment.cancel=egov.collection.payment-cancel -kafka.topics.receipt.update.demand=egov.collection.receipt-create -kafka.topics.receipt.cancel.name=egov.collection.receipt-cancel -kafka.topics.receipt.cancel.key=receipt-cancel - -kafka.topics.bulk.bill.generation=bulk-bill-generator -kafka.topics.bulk.bill.generation.audit=bulk-bill-generation-audit - -#Indexer topics -kafka.topics.demand.index.name=create-demand-index-v1 - - -# KAFKA CONSUMER CONFIGURATIONS -kafka.consumer.config.auto_commit=true -kafka.consumer.config.auto_commit_interval=100 -kafka.consumer.config.session_timeout=15000 -kafka.consumer.config.group_id=bs-masters-group1 -kafka.consumer.config.auto_offset_reset=earliest - -# KAFKA PRODUCER CONFIGURATIONS -kafka.producer.config.retries_config=0 -kafka.producer.config.batch_size_config=16384 -kafka.producer.config.linger_ms_config=1 -kafka.producer.config.buffer_memory_config=33554432 - - -bs.collected.receipt.seq.name=seq_egbs_collectedreceipts -# TaxHeadMaster DB details -bs.taxhead.seq.name=seq_egbs_taxheadmaster -bs.taxhead.code.seq.name=seq_egbs_taxheadmastercode - -#GlCodeMaster DB details -bs.glcodehead.seq.name=seq_egbs_glcodemaster - -#TaxPeriod DB details -bs.taxperiod.seq.name=seq_egbs_taxperiod - -bs.businessservicedetail.seq.name=seq_egbs_business_srvc_details - -# BILLSERVICES DB DETAILS -bs.bill.seq.name=seq_egbs_bill -bs.billdetail.seq.name=seq_egbs_billdetail -bs.billdetail.billnumber.seq.name=seq_egbs_billnumber -bs.billaccountdetail.seq.name=seq_egbs_billaccountdetail -# ID GEN CONFIGS -egov.idgen.hostname = http://egov-idgen:8080 -egov.idgen.uri = /egov-idgen/id/_generate -amendment.id.format.name=bs.amendment.id -bs.bill.billnumber.format=BILLNO-{module}-[SEQ_egbs_billnumber{tenantid}] -bs.bill.billnumber.format.module = {module} -bs.bill.billnumber.format.tenantid = {tenantid} -istenantlevelbillnumberingenabled=false - -# DEMAND DB DETAILS -bs.demand.seq.name=seq_egbs_demand -bs.demanddetail.seq.name=seq_egbs_demanddetail -bs.demand.audit.seq.name=seq_egbs_demand_audit -bs.demanddetail.audit.seq.name=seq_egbs_demanddetail_audit - -#billing-service1.1 - -# localization url -egov.localization.host=https://dev.digit.org -egov.localization.search.endpoint=/localization/messages/v1/_search - -# Apportion url -egov.apportion.host=http://localhost:8091 -egov.apportion.endpoint=/apportion-service/v2/demand/_apportion - -# billgen notif topic -kafka.topics.billgen.topic.name=billing-billgen-topic-name -bill.notification.fallback.locale=en_IN -kafka.topics.cancel.bill.topic.name=bill-cancel-topic-name - -# notif topic -kafka.topics.notification.sms=egov.core.notification.sms -kafka.topics.notification.sms.key=notification.sms.parition.0 - -# CONFIGS -bs.businesscode.demand.updateurl= {"PT":"http://internal-gateway.digit:8080/pt-calculator-v2/propertytax/_updatedemand","WS":"http://internal-gateway.digit:8080/ws-calculator/waterCalculator/_updateDemand","SW":"http://internal-gateway.digit:8080/sw-calculator/sewerageCalculator/_updateDemand","TL":""} -search.pagesize.default=100 -#billing-service1.1 - -#mdms urls -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search - -#----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/billingnew -spring.flyway.user=postgres -spring.flyway.password=postgres -spring.flyway.table=public -spring.flyway.baseline-on-migrate=true -spring.flyway.outOfOrder=true -spring.flyway.locations=classpath:db/migration/main -spring.flyway.enabled=false - -#------------------------------------------------------------------------------# - -logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} - -logging.level.org.egov=DEBUG - -#Amendment configs - -is.amendment.workflow.enabled=true - -workflow.host=http://egov-workflow-v2:8080 -workflow.transition.path=/egov-workflow-v2/egov-wf/process/_transition -workflow.businessservice.search.path=/egov-workflow-v2/egov-wf/businessservice/_search -workflow.processinstance.search.path=/egov-workflow-v2/egov-wf/process/_search - -workflow.open.action=OPEN -workflow.modulename=BS -amendment.workflow.name=BS.AMENDMENT - -# central-instance configs -state.level.tenantid.length=1 -is.environment.central.instance=false -egov.state.list=statea,stateb - -kafka.topics.receipt.topic.pattern=((^[a-zA-Z]+-)?egov.collection.payment-create) -kafka.topics.receipt.cancel.topic.pattern=((^[a-zA-Z]+-)?egov.collection.payment-cancel) - -statelevel.rolecode.excluded.list=BPAREG_DOC_VERIFIER,BPAREG_APPROVER diff --git a/business-services/billing-service/src/main/resources/config/application-config.properties b/business-services/billing-service/src/main/resources/config/application-config.properties deleted file mode 100644 index ff7a64a732a..00000000000 --- a/business-services/billing-service/src/main/resources/config/application-config.properties +++ /dev/null @@ -1,6 +0,0 @@ -search.pagesize.default=500 -search.pageno.max=50 -search.pagesize.max=500 - -#General Configuration -egov.assetcategory.async= true \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/Dockerfile b/business-services/billing-service/src/main/resources/db/Dockerfile deleted file mode 100644 index b42c92e103d..00000000000 --- a/business-services/billing-service/src/main/resources/db/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -#FROM egovio/flyway:4.1.2 -FROM ghcr.io/egovernments/flyway:4.1.2 - -COPY ./migration/main /flyway/sql - -COPY migrate.sh /usr/bin/migrate.sh - -RUN chmod +x /usr/bin/migrate.sh - -CMD ["/usr/bin/migrate.sh"] diff --git a/business-services/billing-service/src/main/resources/db/migrate.sh b/business-services/billing-service/src/main/resources/db/migrate.sh deleted file mode 100644 index f79b7016299..00000000000 --- a/business-services/billing-service/src/main/resources/db/migrate.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -baseurl=$DB_URL -echo "the baseurl : $DB_URL" -schemasetter="?currentSchema=" -schemas=$SCHEMA_NAME -echo "the schemas : $schemas" -for schemaname in ${schemas//,/ } -do - echo "the schema name : ${baseurl}${schemasetter}${schemaname}" - flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate -done \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20170629180050__egbs_demand_base_create_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20170629180050__egbs_demand_base_create_ddl.sql deleted file mode 100644 index 7c6a5885790..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20170629180050__egbs_demand_base_create_ddl.sql +++ /dev/null @@ -1,65 +0,0 @@ - -CREATE SEQUENCE seq_egbs_demand; - -CREATE SEQUENCE seq_egbs_demanddetail; - -CREATE TABLE egbs_demand -( - -id character varying(64) NOT NULL, - -consumerCode character varying(250) NOT NULL, - -consumerType character varying(250) NOT NULL, - -businessservice character varying(250) NOT NULL, - -owner character varying(250) NOT NULL, - -taxPeriodFrom bigint NOT NULL, - -taxPeriodTo bigint NOT NULL, - -minimumAmountPayable numeric(12,0), - -createdby character varying(16) NOT NULL, - -createdtime bigint NOT NULL, - -lastModifiedby character varying(16), - -lastModifiedtime bigint, - -tenantid character varying(250) NOT NULL, - -CONSTRAINT pk_egbs_demand PRIMARY KEY (id,tenantid) -); - - -CREATE TABLE egbs_demanddetail -( - - id character varying(64) NOT NULL, - - demandid character varying(64) NOT NULL, - - taxHeadCode character varying(250) NOT NULL, - - taxamount numeric(12,2) NOT NULL, - - collectionamount numeric(12,2) NOT NULL, - - createdby character varying(64) NOT NULL, - - createdtime bigint NOT NULL, - - lastModifiedby character varying(64), - - lastModifiedtime bigint, - - tenantid character varying(250) NOT NULL, - -CONSTRAINT pk_egbs_demanddetail PRIMARY KEY (id,tenantid), - -CONSTRAINT fk_egbs_demanddetail FOREIGN KEY (demandid,tenantid) REFERENCES egbs_demand(id,tenantid) -); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20170630153346__egbs_base_bill_create_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20170630153346__egbs_base_bill_create_ddl.sql deleted file mode 100644 index 300e1f6dfab..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20170630153346__egbs_base_bill_create_ddl.sql +++ /dev/null @@ -1,122 +0,0 @@ -CREATE SEQUENCE seq_egbs_bill; -CREATE TABLE egbs_bill -( - id character varying(64) NOT NULL, - - tenantid character varying(250) NOT NULL, - - payeename character varying(256) NOT NULL, - - payeeaddress character varying(1024), - - payeeemail character varying(256), - - isactive boolean, - - iscancelled boolean, - - createdby character varying(64) NOT NULL, - - createddate bigint NOT NULL, - - lastmodifiedby character varying(64), - - lastmodifieddate bigint, - - CONSTRAINT pk_eg_bs_bill PRIMARY KEY (id, tenantid) -); - - -CREATE SEQUENCE seq_egbs_billdetail; -CREATE SEQUENCE seq_egbs_billnumber; -CREATE TABLE egbs_billdetail -( - - id character varying(64) NOT NULL, - - tenantid character varying(250) NOT NULL, - - billid character varying(64) NOT NULL, - - businessservice character varying(250) NOT NULL, - - billno character varying(32) NOT NULL, - - billdate bigint NOT NULL, - - consumercode character varying(250) NOT NULL, - - consumertype character varying(250), - - billdescription character varying(1024), - - displaymessage character varying(1024), - - minimumamount numeric(12,2), - - totalamount numeric(12,2), - - callbackforapportioning boolean, - - partpaymentallowed boolean, - - collectionmodesnotallowed character varying(512), - - createdby character varying(64) NOT NULL, - - createddate bigint NOT NULL, - - lastmodifiedby character varying(64), - - lastmodifieddate bigint, - - CONSTRAINT pk_eg_bs_billdetail PRIMARY KEY (id, tenantid), - - CONSTRAINT fk_eg_bs_bill FOREIGN KEY (billid, tenantid) - - REFERENCES egbs_bill (id, tenantid) MATCH SIMPLE - - ON UPDATE NO ACTION ON DELETE NO ACTION -); - - -CREATE SEQUENCE seq_egbs_billaccountdetail; -CREATE TABLE egbs_billaccountdetail -( - - id character varying(64) NOT NULL, - - tenantid character varying(250) NOT NULL, - - billdetail character varying(64) NOT NULL, - - glcode character varying(250) NOT NULL, - - orderno integer, - - accountdescription character varying(512) NOT NULL, - - creditamount numeric(12,2), - - debitamount numeric(12,2), - - isactualdemand boolean, - - purpose character varying(250), - - createdby character varying(64) NOT NULL, - - createddate bigint NOT NULL, - - lastmodifiedby character varying(64), - - lastmodifieddate bigint, - - CONSTRAINT pk_eg_bs_billaccountdetails PRIMARY KEY (id, tenantid), - - CONSTRAINT fk_eg_bs_billdetail FOREIGN KEY (billdetail, tenantid) - - REFERENCES egbs_billdetail (id, tenantid) MATCH SIMPLE - - ON UPDATE NO ACTION ON DELETE NO ACTION -); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20170630185224__egbs_base_demand_update_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20170630185224__egbs_base_demand_update_ddl.sql deleted file mode 100644 index 002346f38e9..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20170630185224__egbs_base_demand_update_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egbs_demand DROP COLUMN minimumamountpayable,ADD COLUMN minimumamountpayable numeric(12,2); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20170707121449__egbs_base_update_billaccountdetail_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20170707121449__egbs_base_update_billaccountdetail_ddl.sql deleted file mode 100644 index 5bdbec02710..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20170707121449__egbs_base_update_billaccountdetail_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egbs_billaccountdetail ADD COLUMN cramounttobepaid numeric(12,2); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20170712133510__egbs_demand_base_update_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20170712133510__egbs_demand_base_update_ddl.sql deleted file mode 100644 index 651dd1a0cef..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20170712133510__egbs_demand_base_update_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egbs_demand add CONSTRAINT uk_egbs_demand_consumercode_businessservice UNIQUE (consumercode,businessservice); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20170729215658__egbs_demand_base_uk_update_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20170729215658__egbs_demand_base_uk_update_ddl.sql deleted file mode 100644 index 9c5295cad44..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20170729215658__egbs_demand_base_uk_update_ddl.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE egbs_demand DROP CONSTRAINT uk_egbs_demand_consumercode_businessservice, - ADD CONSTRAINT uk_egbs_demand_consumercode_businessservice UNIQUE (consumercode,businessservice); - diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20170804112337__egbs_demand_base_uk_update_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20170804112337__egbs_demand_base_uk_update_ddl.sql deleted file mode 100644 index 6dd8307b64d..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20170804112337__egbs_demand_base_uk_update_ddl.sql +++ /dev/null @@ -1,3 +0,0 @@ - -ALTER TABLE egbs_demand DROP CONSTRAINT uk_egbs_demand_consumercode_businessservice, - ADD CONSTRAINT uk_egbs_demand_consumercode_businessservice UNIQUE (consumercode, tenantid, taxperiodfrom, taxperiodto, businessservice); \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20170815185159__egbs_bill_billdetail_update_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20170815185159__egbs_bill_billdetail_update_ddl.sql deleted file mode 100644 index e041ea4705e..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20170815185159__egbs_bill_billdetail_update_ddl.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE egbs_bill ADD COLUMN mobilenumber character varying(20); - -ALTER TABLE egbs_billdetail ADD COLUMN receiptdate bigint, ADD COLUMN receiptnumber character varying(256); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20180716114211__egbs_demand_alter_status.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20180716114211__egbs_demand_alter_status.sql deleted file mode 100644 index 8f3a4e7534e..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20180716114211__egbs_demand_alter_status.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egbs_demand ADD COLUMN status character varying(64); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20181016141317__demand_bill_alter_owner_drop_notnull.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20181016141317__demand_bill_alter_owner_drop_notnull.sql deleted file mode 100644 index 278e628b758..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20181016141317__demand_bill_alter_owner_drop_notnull.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE egbs_demand ALTER COLUMN owner DROP NOT NULL; - -ALTER TABLE egbs_bill ALTER COLUMN payeename DROP NOT NULL; \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20190423115330__demand_v1_create_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20190423115330__demand_v1_create_ddl.sql deleted file mode 100644 index 270b115a3d3..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20190423115330__demand_v1_create_ddl.sql +++ /dev/null @@ -1,83 +0,0 @@ -CREATE TABLE egbs_demand_v1 -( - id character varying(64) NOT NULL, - consumercode character varying(250) NOT NULL, - consumertype character varying(250) NOT NULL, - businessservice character varying(250) NOT NULL, - payer character varying(250), - taxperiodfrom bigint NOT NULL, - taxperiodto bigint NOT NULL, - createdby character varying(256) NOT NULL, - createdtime bigint NOT NULL, - lastmodifiedby character varying(256), - lastmodifiedtime bigint, - tenantid character varying(250) NOT NULL, - minimumamountpayable numeric(12,2), - status character varying(64), - additionaldetails json, - CONSTRAINT pk_egbs_demand_v1 PRIMARY KEY (id, tenantid), - CONSTRAINT uk_egbs_demand_v1_consumercode_businessservice UNIQUE (consumercode, tenantid, taxperiodfrom, taxperiodto, businessservice) -); - -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_id ON egbs_demand_v1(id); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_consumercode ON egbs_demand_v1(consumercode); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_consumertype ON egbs_demand_v1(consumertype); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_businessservice ON egbs_demand_v1(businessservice); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_payer ON egbs_demand_v1(payer); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_taxperiodfrom ON egbs_demand_v1(taxperiodfrom); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_taxperiodto ON egbs_demand_v1(taxperiodto); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_tenantid ON egbs_demand_v1(tenantid); - -CREATE TABLE egbs_demanddetail_v1 -( - id character varying(64) NOT NULL, - demandid character varying(64) NOT NULL, - taxheadcode character varying(250) NOT NULL, - taxamount numeric(12,2)NOT NULL, - collectionamount numeric(12,2)NOT NULL, - createdby character varying(256) NOT NULL, - createdtime bigint NOT NULL, - lastmodifiedby character varying(256), - lastmodifiedtime bigint, - tenantid character varying(250) NOT NULL, - additionaldetails json, - CONSTRAINT pk_egbs_demanddetail_v1 PRIMARY KEY (id, tenantid), - CONSTRAINT fk_egbs_demanddetail_v1 FOREIGN KEY (tenantid, demandid) REFERENCES egbs_demand_v1 (tenantid, id) -); - -CREATE INDEX IF NOT EXISTS idx_egbs_demanddetail_v1_tenantid ON egbs_demanddetail_v1(tenantid); -CREATE INDEX IF NOT EXISTS idx_egbs_demanddetail_v1_demandid ON egbs_demanddetail_v1(demandid); - -CREATE TABLE egbs_demand_v1_audit -( - id character varying(64) NOT NULL, - demandid character varying(64) NOT NULL, - consumercode character varying(250) NOT NULL, - consumertype character varying(250) NOT NULL, - businessservice character varying(250) NOT NULL, - payer character varying(250), - taxperiodfrom bigint NOT NULL, - taxperiodto bigint NOT NULL, - createdby character varying(256) NOT NULL, - createdtime bigint NOT NULL, - tenantid character varying(250) NOT NULL, - minimumamountpayable numeric(12,2), - status character varying(64), - additionaldetails json, - CONSTRAINT pk_egbs_demand_v1_audit PRIMARY KEY (id, tenantid) -); - -CREATE TABLE egbs_demanddetail_v1_audit -( - id character varying(64) NOT NULL, - demandid character varying(64) NOT NULL, - demanddetailid character varying(64) NOT NULL, - taxheadcode character varying(250) NOT NULL, - taxamount numeric(12,2)NOT NULL, - collectionamount numeric(12,2)NOT NULL, - createdby character varying(256) NOT NULL, - createdtime bigint NOT NULL, - tenantid character varying(250) NOT NULL, - additionaldetails json, - CONSTRAINT pk_egbs_demanddetail_v1_audit PRIMARY KEY (id, tenantid) -); \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20190423115420__bill_v1_create_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20190423115420__bill_v1_create_ddl.sql deleted file mode 100644 index 8394cf37012..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20190423115420__bill_v1_create_ddl.sql +++ /dev/null @@ -1,82 +0,0 @@ - -CREATE TABLE egbs_bill_v1 -( - id character varying(64) NOT NULL, - tenantid character varying(250) NOT NULL, - payername character varying(256), - payeraddress character varying(1024), - payeremail character varying(256), - isactive boolean, - iscancelled boolean, - createdby character varying(256) NOT NULL, - createddate bigint NOT NULL, - lastmodifiedby character varying(256), - lastmodifieddate bigint, - mobilenumber character varying(20), - CONSTRAINT pk_egbs_bill_v1 PRIMARY KEY (id, tenantid) -); - -CREATE INDEX IF NOT EXISTS idx_egbs_bill_v1_id ON egbs_bill_v1(id); -CREATE INDEX IF NOT EXISTS idx_egbs_bill_v1_isactive ON egbs_bill_v1(isactive); -CREATE INDEX IF NOT EXISTS idx_egbs_bill_v1_tenantid ON egbs_bill_v1(tenantid); - -CREATE TABLE egbs_billdetail_v1 -( - id character varying(64) NOT NULL, - tenantid character varying(250) NOT NULL, - billid character varying(64) NOT NULL, - businessservice character varying(250) NOT NULL, - billno character varying(32), - billdate bigint NOT NULL, - consumercode character varying(250) NOT NULL, - consumertype character varying(250), - billdescription character varying(1024), - displaymessage character varying(1024), - minimumamount numeric(12,2), - totalamount numeric(12,2), - callbackforapportioning boolean, - partpaymentallowed boolean, - collectionmodesnotallowed character varying(512), - createdby character varying(256) NOT NULL, - createddate bigint NOT NULL, - lastmodifiedby character varying(256), - lastmodifieddate bigint, - receiptdate bigint, - receiptnumber character varying(256), - fromperiod bigint, - toperiod bigint, - demandid character varying(64), - isadvanceallowed boolean, - expirydate bigint, - CONSTRAINT pk_egbs_billdetail_v1 PRIMARY KEY (id, tenantid), - CONSTRAINT fk_egbs_bill_v1 FOREIGN KEY (tenantid, billid) REFERENCES egbs_bill_v1 (tenantid, id) -); - -CREATE INDEX IF NOT EXISTS idx_egbs_billdetail_v1_businessservice ON egbs_billdetail_v1(businessservice); -CREATE INDEX IF NOT EXISTS idx_egbs_billdetail_v1_consumercode ON egbs_billdetail_v1(consumercode); -CREATE INDEX IF NOT EXISTS idx_egbs_billdetail_v1_tenantid ON egbs_billdetail_v1(tenantid); - -CREATE TABLE egbs_billaccountdetail_v1 -( - id character varying(64) NOT NULL, - tenantid character varying(250) NOT NULL, - billdetail character varying(64) NOT NULL, - glcode character varying(250), - orderno integer, - accountdescription character varying(512), - creditamount numeric(12,2), - debitamount numeric(12,2), - isactualdemand boolean, - purpose character varying(250), - createdby character varying(256) NOT NULL, - createddate bigint NOT NULL, - lastmodifiedby character varying(256), - lastmodifieddate bigint, - cramounttobepaid numeric(12,2), - taxheadcode character varying(256), - amount numeric(10,2), - adjustedamount numeric(10,2), - demanddetailid character varying(64), - CONSTRAINT pk_egbs_billaccountdetails_v1 PRIMARY KEY (id, tenantid), - CONSTRAINT fk_egbs_billdetail_v1 FOREIGN KEY (billdetail, tenantid) REFERENCES egbs_billdetail_v1 (id, tenantid) -); \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20190426132020__demand_alter_add_billexpirytime.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20190426132020__demand_alter_add_billexpirytime.sql deleted file mode 100644 index 27755ea9299..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20190426132020__demand_alter_add_billexpirytime.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE EGBS_DEMAND_v1 ADD COLUMN billexpirytime bigint; -ALTER TABLE EGBS_DEMAND_v1_AUDIT ADD COLUMN billexpirytime bigint; \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20190911165111__demand_add_contitional_constraint_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20190911165111__demand_add_contitional_constraint_ddl.sql deleted file mode 100644 index fe239204f5e..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20190911165111__demand_add_contitional_constraint_ddl.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE egbs_demand_v1 DROP CONSTRAINT uk_egbs_demand_v1_consumercode_businessservice; - -CREATE UNIQUE INDEX uk_egbs_demand_v1_consumercode_businessservice ON egbs_demand_v1 (consumercode, tenantid, taxperiodfrom, taxperiodto, businessservice, status) where status='ACTIVE'; diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20190911165929__egbs_all_indices_update_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20190911165929__egbs_all_indices_update_ddl.sql deleted file mode 100644 index 951fee8eef0..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20190911165929__egbs_all_indices_update_ddl.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE INDEX IF NOT EXISTS idx_egbs_bill_v1_id ON public.egbs_bill_v1 USING btree (id); -CREATE INDEX IF NOT EXISTS idx_egbs_bill_v1_isactive ON public.egbs_bill_v1 USING btree (isactive); -CREATE INDEX IF NOT EXISTS idx_egbs_bill_v1_tenantid ON public.egbs_bill_v1 USING btree (tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egbs_bill_v1 ON public.egbs_bill_v1 USING btree (id, tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egbs_billaccountdetails_v1 ON public.egbs_billaccountdetail_v1 USING btree (id, tenantid); -CREATE INDEX IF NOT EXISTS idx_egbs_billdetail_v1_businessservice ON public.egbs_billdetail_v1 USING btree (businessservice); -CREATE INDEX IF NOT EXISTS idx_egbs_billdetail_v1_consumercode ON public.egbs_billdetail_v1 USING btree (consumercode); -CREATE INDEX IF NOT EXISTS idx_egbs_billdetail_v1_tenantid ON public.egbs_billdetail_v1 USING btree (tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egbs_billdetail_v1 ON public.egbs_billdetail_v1 USING btree (id, tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS pk_biz_srvc_det ON public.egbs_business_service_details USING btree (id, tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS unq_businessservice ON public.egbs_business_service_details USING btree (businessservice, tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egbs_collectedreceipts ON public.egbs_collectedreceipts USING btree (id, tenantid); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_businessservice ON public.egbs_demand_v1 USING btree (businessservice); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_consumercode ON public.egbs_demand_v1 USING btree (consumercode); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_consumertype ON public.egbs_demand_v1 USING btree (consumertype); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_id ON public.egbs_demand_v1 USING btree (id); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_payer ON public.egbs_demand_v1 USING btree (payer); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_taxperiodfrom ON public.egbs_demand_v1 USING btree (taxperiodfrom); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_taxperiodto ON public.egbs_demand_v1 USING btree (taxperiodto); -CREATE INDEX IF NOT EXISTS idx_egbs_demand_v1_tenantid ON public.egbs_demand_v1 USING btree (tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egbs_demand_v1 ON public.egbs_demand_v1 USING btree (id, tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS uk_egbs_demand_v1_consumercode_businessservice ON public.egbs_demand_v1 USING btree (consumercode, tenantid, taxperiodfrom, taxperiodto, businessservice); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egbs_demand_v1_audit ON public.egbs_demand_v1_audit USING btree (id, tenantid); -CREATE INDEX IF NOT EXISTS idx_egbs_demanddetail_v1_demandid ON public.egbs_demanddetail_v1 USING btree (demandid); -CREATE INDEX IF NOT EXISTS idx_egbs_demanddetail_v1_tenantid ON public.egbs_demanddetail_v1 USING btree (tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egbs_demanddetail_v1 ON public.egbs_demanddetail_v1 USING btree (id, tenantid); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egbs_demanddetail_v1_audit ON public.egbs_demanddetail_v1_audit USING btree (id, tenantid); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20191003140130__egbs_bill_v1_alter_add_columns_dml.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20191003140130__egbs_bill_v1_alter_add_columns_dml.sql deleted file mode 100644 index eb93c3d5c00..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20191003140130__egbs_bill_v1_alter_add_columns_dml.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE egbs_bill_v1 ADD COLUMN status character varying(64), ADD COLUMN additionaldetails jsonb; - -ALTER TABLE egbs_billdetail_v1 ADD COLUMN additionaldetails jsonb; - -ALTER TABLE egbs_billaccountdetail_v1 ADD COLUMN additionaldetails jsonb; \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20191122154211__egbs_billdetail_alter_billno.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20191122154211__egbs_billdetail_alter_billno.sql deleted file mode 100644 index 90931c331e5..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20191122154211__egbs_billdetail_alter_billno.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egbs_billdetail_v1 ALTER COLUMN billno TYPE character varying(1024); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20200403102937__bill_add_filestoreid_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20200403102937__bill_add_filestoreid_ddl.sql deleted file mode 100644 index d8d12d3491f..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20200403102937__bill_add_filestoreid_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egbs_bill_v1 ADD COLUMN filestoreid character varying(256); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20201005230836__egbs_bill_index_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20201005230836__egbs_bill_index_ddl.sql deleted file mode 100644 index e290a3f1057..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20201005230836__egbs_bill_index_ddl.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE index if not exists idx_egbs_billdetail_v1_billid ON egbs_billdetail_v1 USING btree (billid); -CREATE index if not exists idx_egbs_billaccountdetail_v1_billdetail ON egbs_billaccountdetail_v1 USING btree (billdetail); diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20201216123333__egbs_payment_backupdate_audit_create.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20201216123333__egbs_payment_backupdate_audit_create.sql deleted file mode 100644 index 5815e976eb6..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20201216123333__egbs_payment_backupdate_audit_create.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE egbs_payment_backupdate_audit -( - paymentid character varying(256) NOT NULL, - - isbackupdatesuccess Boolean NOT NULL, - - isreceiptcancellation Boolean NOT NULL, - - errorMessage character varying -); - -CREATE UNIQUE INDEX uk_egbs_payment_backupdate_audit ON egbs_payment_backupdate_audit (paymentid, isreceiptcancellation) WHERE isbackupdatesuccess='TRUE'; - \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20210106124130__egbs_demand_paymentcompleted_field_added.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20210106124130__egbs_demand_paymentcompleted_field_added.sql deleted file mode 100644 index 6da9950f151..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20210106124130__egbs_demand_paymentcompleted_field_added.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE EGBS_DEMAND_v1 ADD COLUMN ispaymentcompleted BOOLEAN DEFAULT false; -ALTER TABLE EGBS_DEMAND_v1_AUDIT ADD COLUMN ispaymentcompleted BOOLEAN; diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20210118093315__egbs_amendment_create_ddl.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20210118093315__egbs_amendment_create_ddl.sql deleted file mode 100644 index 87822e16f98..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20210118093315__egbs_amendment_create_ddl.sql +++ /dev/null @@ -1,44 +0,0 @@ -CREATE TABLE EGBS_AMENDMENT -( - id CHARACTER VARYING (256) NOT NULL, - tenantid CHARACTER VARYING (256) NOT NULL, - amendmentId CHARACTER VARYING (256) NOT NULL, - businessservice CHARACTER VARYING (256) NOT NULL, - consumercode CHARACTER VARYING (256) NOT NULL, - amendmentReason CHARACTER VARYING (256) NOT NULL, - reasonDocumentNumber CHARACTER VARYING (256), - status CHARACTER VARYING (256) NOT NULL, - effectiveTill BIGINT, - effectiveFrom BIGINT, - amendedDemandId CHARACTER VARYING (256), - createdby CHARACTER VARYING (256) NOT NULL, - createdtime BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING (256) NOT NULL, - lastmodifiedtime BIGINT NOT NULL, - additionaldetails JSONB, - - CONSTRAINT pk_egbs_amendment PRIMARY KEY (amendmentId, tenantid), - CONSTRAINT uk_egbs_amendment UNIQUE (id) -); - -CREATE TABLE EGBS_AMENDMENT_TAXDETAIL -( - id CHARACTER VARYING (128) NOT NULL, - amendmentid CHARACTER VARYING (128) NOT NULL, - taxheadcode CHARACTER VARYING (250) NOT NULL, - taxamount NUMERIC (12,2) NOT NULL, - - CONSTRAINT pk_egbs_amendment_taxdetail PRIMARY KEY (id, amendmentid) -); - -CREATE TABLE egbs_document -( - id CHARACTER VARYING (128) NOT NULL, - amendmentid CHARACTER VARYING (256) NOT NULL, - documentType CHARACTER VARYING (256) NOT NULL, - fileStoreid CHARACTER VARYING (256) NOT NULL, - documentuid CHARACTER VARYING (256), - status CHARACTER VARYING (256) NOT NULL, - - CONSTRAINT pk_egbs_document_id PRIMARY KEY (id) -); \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20210203150330__egbs_demand_fixedexpirydat.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20210203150330__egbs_demand_fixedexpirydat.sql deleted file mode 100644 index 942b9543a59..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20210203150330__egbs_demand_fixedexpirydat.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE EGBS_DEMAND_v1 ADD COLUMN fixedBillExpiryDate BIGINT; -ALTER TABLE EGBS_DEMAND_v1_AUDIT ADD COLUMN fixedBillExpiryDate BIGINT; diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20221130141020__egbs_bill_alter_add_userid.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20221130141020__egbs_bill_alter_add_userid.sql deleted file mode 100644 index e37239ab9a7..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20221130141020__egbs_bill_alter_add_userid.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egbs_bill_v1 add column payerid character varying (128); \ No newline at end of file diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20221206104420__egbs_bill_alter_add_consumercode.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20221206104420__egbs_bill_alter_add_consumercode.sql deleted file mode 100644 index 4bc198346f9..00000000000 --- a/business-services/billing-service/src/main/resources/db/migration/main/V20221206104420__egbs_bill_alter_add_consumercode.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE egbs_bill_v1 add column consumercode character varying(256); - -UPDATE egbs_bill_v1 b SET consumerCode = bd.consumercode FROM egbs_billdetail_v1 bd WHERE bd.billid = b.id; - -ALTER TABLE egbs_bill_v1 ALTER COLUMN consumercode SET NOT NULL; - -CREATE UNIQUE INDEX IF NOT EXISTS index_egbs_UNIQUE_ACTIVE_BILL ON egbs_bill_v1 (consumercode, tenantid, status) where status='ACTIVE'; \ No newline at end of file diff --git a/business-services/billing-service/src/test/java/org/egov/demand/BillingServiceApplicationTest.java b/business-services/billing-service/src/test/java/org/egov/demand/BillingServiceApplicationTest.java deleted file mode 100644 index d168f69cd8a..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/BillingServiceApplicationTest.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.egov.demand; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.fasterxml.jackson.databind.DeserializationConfig; -import com.fasterxml.jackson.databind.MappingJsonFactory; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.cfg.ContextAttributes; -import com.fasterxml.jackson.databind.introspect.VisibilityChecker; -import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator; -import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.util.StdDateFormat; -import org.junit.jupiter.api.Test; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; - -class BillingServiceApplicationTest { - - @Test - void testGetObjectMapper() { - ObjectMapper actualObjectMapper = (new BillingServiceApplication()).getObjectMapper(); - PolymorphicTypeValidator polymorphicTypeValidator = actualObjectMapper.getPolymorphicTypeValidator(); - assertTrue(polymorphicTypeValidator instanceof LaissezFaireSubTypeValidator); - VisibilityChecker visibilityChecker = actualObjectMapper.getVisibilityChecker(); - assertTrue(visibilityChecker instanceof VisibilityChecker.Std); - assertNull(actualObjectMapper.getPropertyNamingStrategy()); - assertTrue(actualObjectMapper - .getDeserializationContext() instanceof com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.Impl); - assertSame(actualObjectMapper.getFactory(), actualObjectMapper.getJsonFactory()); - assertTrue( - actualObjectMapper.getSerializerFactory() instanceof com.fasterxml.jackson.databind.ser.BeanSerializerFactory); - assertTrue(actualObjectMapper - .getSerializerProvider() instanceof com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.Impl); - assertTrue(actualObjectMapper - .getSerializerProviderInstance() instanceof com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.Impl); - assertTrue(actualObjectMapper - .getSubtypeResolver() instanceof com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver); - DeserializationConfig deserializationConfig = actualObjectMapper.getDeserializationConfig(); - assertTrue(deserializationConfig - .getAnnotationIntrospector() instanceof com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector); - assertNull(deserializationConfig.getActiveView()); - assertNull(deserializationConfig.getHandlerInstantiator()); - assertSame(visibilityChecker, deserializationConfig.getDefaultVisibilityChecker()); - assertTrue(deserializationConfig - .getClassIntrospector() instanceof com.fasterxml.jackson.databind.introspect.BasicClassIntrospector); - assertSame(actualObjectMapper.getDateFormat(), deserializationConfig.getDateFormat()); - assertNull(deserializationConfig.getFullRootName()); - JsonNodeFactory expectedNodeFactory = actualObjectMapper.getNodeFactory(); - assertSame(expectedNodeFactory, deserializationConfig.getNodeFactory()); - assertNull(deserializationConfig.getDefaultMergeable()); - assertEquals(237020288, deserializationConfig.getDeserializationFeatures()); - assertTrue(deserializationConfig.getAttributes() instanceof ContextAttributes.Impl); - assertSame(polymorphicTypeValidator, deserializationConfig.getPolymorphicTypeValidator()); - } - - - @Test - void testJacksonConverter() { - MappingJackson2HttpMessageConverter actualJacksonConverterResult = (new BillingServiceApplication()) - .jacksonConverter(); - assertEquals(2, actualJacksonConverterResult.getSupportedMediaTypes().size()); - ObjectMapper objectMapper = actualJacksonConverterResult.getObjectMapper(); - assertTrue(objectMapper - .getPolymorphicTypeValidator() instanceof LaissezFaireSubTypeValidator); - VisibilityChecker visibilityChecker = objectMapper.getVisibilityChecker(); - assertTrue(visibilityChecker instanceof VisibilityChecker.Std); - assertNull(objectMapper.getPropertyNamingStrategy()); - assertTrue(objectMapper - .getDeserializationContext() instanceof com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.Impl); - assertSame(objectMapper.getFactory(), objectMapper.getJsonFactory()); - assertTrue(objectMapper.getSerializerFactory() instanceof com.fasterxml.jackson.databind.ser.BeanSerializerFactory); - assertTrue(objectMapper - .getSerializerProvider() instanceof com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.Impl); - assertTrue(objectMapper - .getSerializerProviderInstance() instanceof com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.Impl); - assertTrue( - objectMapper.getSubtypeResolver() instanceof com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver); - DeserializationConfig deserializationConfig = objectMapper.getDeserializationConfig(); - assertSame(visibilityChecker, deserializationConfig.getDefaultVisibilityChecker()); - assertNull(deserializationConfig.getFullRootName()); - assertSame(objectMapper.getDateFormat(), deserializationConfig.getDateFormat()); - assertNull(deserializationConfig.getActiveView()); - assertTrue(deserializationConfig - .getClassIntrospector() instanceof com.fasterxml.jackson.databind.introspect.BasicClassIntrospector); - assertTrue(deserializationConfig - .getAnnotationIntrospector() instanceof com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector); - assertTrue(deserializationConfig.getAttributes() instanceof ContextAttributes.Impl); - assertNull(deserializationConfig.getDefaultMergeable()); - assertEquals(237020288, deserializationConfig.getDeserializationFeatures()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/TestConfiguration.java b/business-services/billing-service/src/test/java/org/egov/demand/TestConfiguration.java deleted file mode 100644 index cca67cdba4b..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/TestConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.demand; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.kafka.core.KafkaTemplate; - -import static org.mockito.Mockito.mock; - -@Configuration -public class TestConfiguration { - - @Bean - @SuppressWarnings("unchecked") - public KafkaTemplate kafkaTemplate() { - return mock(KafkaTemplate.class); - } - -} diff --git a/business-services/billing-service/src/test/java/org/egov/demand/consumer/BillingServiceConsumerTest.java b/business-services/billing-service/src/test/java/org/egov/demand/consumer/BillingServiceConsumerTest.java deleted file mode 100644 index c8ba8a87bcd..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/consumer/BillingServiceConsumerTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.egov.demand.consumer; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.repository.BillRepository; -import org.egov.demand.repository.DemandRepository; -import org.egov.demand.service.DemandService; -import org.egov.demand.service.ReceiptService; -import org.egov.demand.service.ReceiptServiceV2; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.DemandRequest; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@SpringBootTest -public class BillingServiceConsumerTest { - - @Mock - private DemandService demandService; - - @Mock - private ObjectMapper objectMapper; - - @Autowired - private BillingServiceConsumer billingServiceConsumer; - - @Test - @DisplayName("Should update the demand when the topic is updateDemand") - public void testProcessMessageWhenTopicIsUpdateDemandThenUpdateTheDemand() { - - Map consumerRecord = new HashMap<>(); - DemandRequest demandRequest = DemandRequest.builder().build(); - when(objectMapper.convertValue(consumerRecord, DemandRequest.class)).thenReturn(demandRequest); - billingServiceConsumer.processMessage(consumerRecord, "updateDemand"); - - } - - @Test - @DisplayName("Should save the demand when the topic is createDemand") - public void testProcessMessageWhenTopicIsCreateDemandThenSaveTheDemand() { - - Map consumerRecord = new HashMap<>(); - DemandRequest demandRequest = DemandRequest.builder().build(); - when(objectMapper.convertValue(consumerRecord, DemandRequest.class)).thenReturn(demandRequest); - billingServiceConsumer.processMessage(consumerRecord, "createDemand"); - - } - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/consumer/notification/NotificationConsumerTest.java b/business-services/billing-service/src/test/java/org/egov/demand/consumer/notification/NotificationConsumerTest.java deleted file mode 100644 index f04cb204902..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/consumer/notification/NotificationConsumerTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.demand.consumer.notification; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.util.ArrayList; - -import java.util.HashMap; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.Bill; - -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.BillRequestV2; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.web.client.RestTemplate; - -@ContextConfiguration(classes = {NotificationConsumer.class}) -@ExtendWith(SpringExtension.class) -class NotificationConsumerTest { - @MockBean - private KafkaTemplate kafkaTemplate; - - @Autowired - private NotificationConsumer notificationConsumer; - - @MockBean - private ObjectMapper objectMapper; - - @MockBean - private RestTemplate restTemplate; - - - @Test - void testListenVonvertValue() throws IllegalArgumentException { - when(this.objectMapper.convertValue((Object) any(), (Class) any())).thenReturn("Convert Value"); - this.notificationConsumer.listen(new HashMap<>(), "Topic"); - verify(this.objectMapper).convertValue((Object) any(), (Class) any()); - } - - - @Test - void testListenBillRequest() throws IllegalArgumentException { - when(this.objectMapper.convertValue((Object) any(), (Class) any())).thenReturn(new BillRequest()); - this.notificationConsumer.listen(new HashMap<>(), "Topic"); - verify(this.objectMapper).convertValue((Object) any(), (Class) any()); - } - - @Test - void testListenWithNull() throws IllegalArgumentException { - when(this.objectMapper.convertValue((Object) any(), (Class) any())).thenReturn(null); - this.notificationConsumer.listen(new HashMap<>(), "Topic"); - verify(this.objectMapper).convertValue((Object) any(), (Class) any()); - } - - - @Test - void testListenwithcanclebillWithValue() throws IllegalArgumentException { - when(this.objectMapper.convertValue((Object) any(), (Class) any())).thenReturn("Convert Value"); - this.notificationConsumer.listen(new HashMap<>(), "${kafka.topics.cancel.bill.topic.name}"); - verify(this.objectMapper).convertValue((Object) any(), (Class) any()); - } - - @Test - void testListenCancleBillwithNull() throws IllegalArgumentException { - when(this.objectMapper.convertValue((Object) any(), (Class) any())).thenReturn(null); - this.notificationConsumer.listen(new HashMap<>(), "${kafka.topics.cancel.bill.topic.name}"); - verify(this.objectMapper).convertValue((Object) any(), (Class) any()); - } - - - @Test - void testListenBillWithRequest() throws IllegalArgumentException { - when(this.objectMapper.convertValue((Object) any(), (Class) any())).thenReturn(new BillRequestV2()); - this.notificationConsumer.listen(new HashMap<>(), "${kafka.topics.cancel.bill.topic.name}"); - verify(this.objectMapper).convertValue((Object) any(), (Class) any()); - } - - - @Test - void testListen() throws IllegalArgumentException { - ArrayList billList = new ArrayList<>(); - billList.add(new Bill()); - BillRequest billRequest = new BillRequest(new RequestInfo(), billList); - - when(this.objectMapper.convertValue((Object) any(), (Class) any())).thenReturn(billRequest); - this.notificationConsumer.listen(new HashMap<>(), "Topic"); - verify(this.objectMapper).convertValue((Object) any(), (Class) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/helper/BillHelperTest.java b/business-services/billing-service/src/test/java/org/egov/demand/helper/BillHelperTest.java deleted file mode 100644 index 5d6beb2b5e0..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/helper/BillHelperTest.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.egov.demand.helper; - -import org.egov.demand.model.Bill; -import org.egov.demand.model.BillDetail; -import org.egov.demand.util.SequenceGenService; -import org.egov.demand.web.contract.BillRequest; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.when; - - -@ExtendWith(SpringExtension.class) -@SpringBootTest -public class BillHelperTest { - - @MockBean - private SequenceGenService sequenceGenService; - - @Autowired - private BillHelper billHelper; - - @Test - @DisplayName("Should set the bill id when the bill is not null") - public void testGetBillRequestWithIdsWhenBillIsNotNullThenSetTheBillId() { - BillRequest billRequest = new BillRequest(); - - when(sequenceGenService.getIds(anyInt(), anyString())).thenReturn(Arrays.asList("1")); - - billHelper.getBillRequestWithIds(billRequest); - - - } - - @Test - @DisplayName("Should set the bill detail id when the bill detail is not null") - public void testGetBillRequestWithIdsWhenBillDetailIsNotNullThenSetTheBillDetailId() { - BillRequest billRequest = new BillRequest(); - when(sequenceGenService.getIds(anyInt(), anyString())).thenReturn(Arrays.asList("1", "2", "3")); - - billHelper.getBillRequestWithIds(billRequest); - - - } - - @Test - @DisplayName("Should set the bill detail id when the bill detail is not null") - public void testGetBillRequestWithIdsWhenBillDetailIsNotNullThenSetTheBillDetailId1() { - - BillRequest billRequest = new BillRequest(); - Bill bill = new Bill(); - BillDetail billDetail = new BillDetail(); - bill.addBillDetailsItem(billDetail); - - List billIds = Arrays.asList("1"); - List billDetailIds = Arrays.asList("2"); - List billAccIds = Arrays.asList("3"); - List billNumber = Arrays.asList("4"); - - when(sequenceGenService.getIds(1, "billSeqName")).thenReturn(billIds); - when(sequenceGenService.getIds(1, "billDetailSeqName")).thenReturn(billDetailIds); - when(sequenceGenService.getIds(1, "billAccDetailSeqName")).thenReturn(billAccIds); - when(sequenceGenService.getIds(1, "billNumSeqName")).thenReturn(billNumber); - - billHelper.getBillRequestWithIds(billRequest); - - assertEquals(null, billDetail.getId()); - } - - @Test - @DisplayName("Should set the bill id when the bill is not null") - public void testGetBillRequestWithIdsWhenBillIsNotNullThenSetTheBillIds() { - - BillRequest billRequest = new BillRequest(); - Bill bill = new Bill(); - - billRequest.getBills(); - - List ids = Arrays.asList("1"); - when(sequenceGenService.getIds(1, "billSeqName")) - .thenReturn(ids); - - billHelper.getBillRequestWithIds(billRequest); - - assertEquals(null, bill.getId()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/helper/BillHelperV2Test.java b/business-services/billing-service/src/test/java/org/egov/demand/helper/BillHelperV2Test.java deleted file mode 100644 index 1753e939eb5..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/helper/BillHelperV2Test.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.egov.demand.helper; - -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.BillAccountDetailV2; -import org.egov.demand.model.BillDetailV2; -import org.egov.demand.model.BillV2; -import org.egov.demand.util.SequenceGenService; -import org.egov.demand.web.contract.BillRequestV2; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; - -import java.util.Collections; -import java.util.List; - -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.when; - -@SpringBootTest -public class BillHelperV2Test { - - @MockBean - private SequenceGenService sequenceGenService; - - @MockBean - private ApplicationProperties applicationProperties; - - @Autowired - private BillHelperV2 billHelperV2; - - @Test - @DisplayName("Should set the ids for all the bills, billDetails and accountDetails") - public void testGetBillRequestWithIdsShouldSetTheIdsForAllTheBillsBillDetailsAndAccountDetails() { - BillRequestV2 billRequest = new BillRequestV2(); - BillV2 bill = new BillV2(); - BillDetailV2 billDetail = new BillDetailV2(); - List bills = billRequest.getBills(); - BillAccountDetailV2 billAccountDetail = new BillAccountDetailV2(); - billDetail.addBillAccountDetailsItem(billAccountDetail); - bill.addBillDetailsItem(billDetail); - billRequest.setBills(bills); - - when(sequenceGenService.getIds(anyInt(), anyString())) - .thenReturn(Collections.singletonList("billNumber")); - - when(applicationProperties.getBillNumSeqName()).thenReturn("billNumSeqName"); - - billHelperV2.getBillRequestWithIds(billRequest); - } - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/producer/ProducerTest.java b/business-services/billing-service/src/test/java/org/egov/demand/producer/ProducerTest.java deleted file mode 100644 index 30f47c09596..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/producer/ProducerTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.demand.producer; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.apache.kafka.clients.producer.ProducerRecord; -import org.apache.kafka.clients.producer.RecordMetadata; -import org.apache.kafka.common.TopicPartition; -import org.egov.tracer.kafka.CustomKafkaTemplate; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.kafka.support.SendResult; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {Producer.class}) -@ExtendWith(SpringExtension.class) -class ProducerTest { - @MockBean(name = "customKafkaTemplate") - private CustomKafkaTemplate customKafkaTemplate; - - @Autowired - private Producer producer; - - - @Test - void testPush() { - ProducerRecord producerRecord = new ProducerRecord<>("Topic", "Value"); - - when(this.customKafkaTemplate.send((String) any(), (Object) any())).thenReturn( - new SendResult<>(producerRecord, new RecordMetadata(new TopicPartition("Topic", 1), 1L, 1L, 10L, 1L, 3, 3))); - this.producer.push("Topic", "Value"); - verify(this.customKafkaTemplate).send((String) any(), (Object) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/AmendmentRepositoryTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/AmendmentRepositoryTest.java deleted file mode 100644 index 77a224c2c4c..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/AmendmentRepositoryTest.java +++ /dev/null @@ -1,379 +0,0 @@ -package org.egov.demand.repository; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.node.MissingNode; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.demand.amendment.model.Amendment; -import org.egov.demand.amendment.model.AmendmentCriteria; -import org.egov.demand.amendment.model.AmendmentRequest; -import org.egov.demand.amendment.model.AmendmentUpdate; -import org.egov.demand.amendment.model.Document; -import org.egov.demand.amendment.model.ProcessInstance; -import org.egov.demand.amendment.model.enums.AmendmentReason; -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.repository.querybuilder.AmendmentQueryBuilder; -import org.egov.demand.repository.rowmapper.AmendmentRowMapper; -import org.egov.demand.util.Util; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {AmendmentRepository.class}) -@ExtendWith(SpringExtension.class) -class AmendmentRepositoryTest { - @MockBean - private AmendmentQueryBuilder amendmentQueryBuilder; - - @Autowired - private AmendmentRepository amendmentRepository; - - @MockBean - private AmendmentRowMapper amendmentRowMapper; - - @MockBean - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @MockBean - private Util util; - - - @Test - void testSaveAmendment() throws DataAccessException { - when(this.util.getPGObject((Object) any())).thenReturn(new PGobject()); - when(this.namedParameterJdbcTemplate.update((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any())).thenReturn(1); - when(this.namedParameterJdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any())).thenReturn(new int[]{1, 1, 1, 1}); - - Amendment amendment = new Amendment(); - amendment.setAmendmentReason(AmendmentReason.COURT_CASE_SETTLEMENT); - AmendmentRequest amendmentRequest = mock(AmendmentRequest.class); - ProcessInstance workflow = new ProcessInstance(); - ArrayList demandDetails = new ArrayList<>(); - ArrayList documents = new ArrayList<>(); - AuditDetails auditDetails = new AuditDetails(); - when(amendmentRequest.getAmendment()).thenReturn(new Amendment("42", "42", "42", - "INSERT INTO egbs_amendment (id, tenantid, amendmentid, businessservice, consumercode, amendmentreason," - + " reasondocumentnumber, status, effectivetill, effectivefrom, amendeddemandid, createdby, createdtime," - + " lastmodifiedby, lastmodifiedtime, additionaldetails) \tVALUES (:id, :tenantid, :amendmentid," - + " :businessservice, :consumercode, :amendmentreason, :reasondocumentnumber, :status, :effectivetill," - + " :effectivefrom, :amendeddemandid, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime," - + " :additionaldetails);", - "42", - "INSERT INTO egbs_amendment (id, tenantid, amendmentid, businessservice, consumercode, amendmentreason," - + " reasondocumentnumber, status, effectivetill, effectivefrom, amendeddemandid, createdby, createdtime," - + " lastmodifiedby, lastmodifiedtime, additionaldetails) \tVALUES (:id, :tenantid, :amendmentid," - + " :businessservice, :consumercode, :amendmentreason, :reasondocumentnumber, :status, :effectivetill," - + " :effectivefrom, :amendeddemandid, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime," - + " :additionaldetails);", - AmendmentReason.COURT_CASE_SETTLEMENT, "Just cause", AmendmentStatus.ACTIVE, workflow, demandDetails, documents, - 1L, 1L, auditDetails, MissingNode.getInstance())); - doNothing().when(amendmentRequest).setAmendment((Amendment) any()); - amendmentRequest.setAmendment(amendment); - this.amendmentRepository.saveAmendment(amendmentRequest); - verify(this.util).getPGObject((Object) any()); - verify(this.namedParameterJdbcTemplate).update((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any()); - verify(this.namedParameterJdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any()); - verify(amendmentRequest, atLeast(1)).getAmendment(); - verify(amendmentRequest).setAmendment((Amendment) any()); - } - - - @Test - void testSaveAmendmentWithCOURT_CASE_SETTLEMENT() throws DataAccessException { - when(this.util.getPGObject((Object) any())).thenReturn(new PGobject()); - when(this.namedParameterJdbcTemplate.update((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any())).thenReturn(1); - when(this.namedParameterJdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any())).thenReturn(new int[]{1, 1, 1, 1}); - - Amendment amendment = new Amendment(); - amendment.setAmendmentReason(AmendmentReason.COURT_CASE_SETTLEMENT); - - ArrayList demandDetailList = new ArrayList<>(); - demandDetailList.add(new DemandDetail()); - ProcessInstance workflow = new ProcessInstance(); - ArrayList documents = new ArrayList<>(); - AuditDetails auditDetails = new AuditDetails(); - AmendmentRequest amendmentRequest = mock(AmendmentRequest.class); - when(amendmentRequest.getAmendment()).thenReturn(new Amendment("42", "42", "42", - "INSERT INTO egbs_amendment (id, tenantid, amendmentid, businessservice, consumercode, amendmentreason," - + " reasondocumentnumber, status, effectivetill, effectivefrom, amendeddemandid, createdby, createdtime," - + " lastmodifiedby, lastmodifiedtime, additionaldetails) \tVALUES (:id, :tenantid, :amendmentid," - + " :businessservice, :consumercode, :amendmentreason, :reasondocumentnumber, :status, :effectivetill," - + " :effectivefrom, :amendeddemandid, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime," - + " :additionaldetails);", - "42", - "INSERT INTO egbs_amendment (id, tenantid, amendmentid, businessservice, consumercode, amendmentreason," - + " reasondocumentnumber, status, effectivetill, effectivefrom, amendeddemandid, createdby, createdtime," - + " lastmodifiedby, lastmodifiedtime, additionaldetails) \tVALUES (:id, :tenantid, :amendmentid," - + " :businessservice, :consumercode, :amendmentreason, :reasondocumentnumber, :status, :effectivetill," - + " :effectivefrom, :amendeddemandid, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime," - + " :additionaldetails);", - AmendmentReason.COURT_CASE_SETTLEMENT, "Just cause", AmendmentStatus.ACTIVE, workflow, demandDetailList, - documents, 1L, 1L, auditDetails, MissingNode.getInstance())); - doNothing().when(amendmentRequest).setAmendment((Amendment) any()); - amendmentRequest.setAmendment(amendment); - this.amendmentRepository.saveAmendment(amendmentRequest); - verify(this.util).getPGObject((Object) any()); - verify(this.namedParameterJdbcTemplate).update((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any()); - verify(this.namedParameterJdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any()); - verify(amendmentRequest, atLeast(1)).getAmendment(); - verify(amendmentRequest).setAmendment((Amendment) any()); - } - - - @Test - void testSaveAmendmentAmendmentStatusACTIVE() throws DataAccessException { - when(this.util.getPGObject((Object) any())).thenReturn(new PGobject()); - when(this.namedParameterJdbcTemplate.update((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any())).thenReturn(1); - when(this.namedParameterJdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any())).thenReturn(new int[]{1, 1, 1, 1}); - - Amendment amendment = new Amendment(); - amendment.setAmendmentReason(AmendmentReason.COURT_CASE_SETTLEMENT); - - ArrayList documentList = new ArrayList<>(); - documentList.add(new Document()); - ProcessInstance workflow = new ProcessInstance(); - ArrayList demandDetails = new ArrayList<>(); - AuditDetails auditDetails = new AuditDetails(); - AmendmentRequest amendmentRequest = mock(AmendmentRequest.class); - when(amendmentRequest.getAmendment()).thenReturn(new Amendment("42", "42", "42", - "INSERT INTO egbs_amendment (id, tenantid, amendmentid, businessservice, consumercode, amendmentreason," - + " reasondocumentnumber, status, effectivetill, effectivefrom, amendeddemandid, createdby, createdtime," - + " lastmodifiedby, lastmodifiedtime, additionaldetails) \tVALUES (:id, :tenantid, :amendmentid," - + " :businessservice, :consumercode, :amendmentreason, :reasondocumentnumber, :status, :effectivetill," - + " :effectivefrom, :amendeddemandid, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime," - + " :additionaldetails);", - "42", - "INSERT INTO egbs_amendment (id, tenantid, amendmentid, businessservice, consumercode, amendmentreason," - + " reasondocumentnumber, status, effectivetill, effectivefrom, amendeddemandid, createdby, createdtime," - + " lastmodifiedby, lastmodifiedtime, additionaldetails) \tVALUES (:id, :tenantid, :amendmentid," - + " :businessservice, :consumercode, :amendmentreason, :reasondocumentnumber, :status, :effectivetill," - + " :effectivefrom, :amendeddemandid, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime," - + " :additionaldetails);", - AmendmentReason.COURT_CASE_SETTLEMENT, "Just cause", AmendmentStatus.ACTIVE, workflow, demandDetails, - documentList, 1L, 1L, auditDetails, MissingNode.getInstance())); - doNothing().when(amendmentRequest).setAmendment((Amendment) any()); - amendmentRequest.setAmendment(amendment); - this.amendmentRepository.saveAmendment(amendmentRequest); - verify(this.util).getPGObject((Object) any()); - verify(this.namedParameterJdbcTemplate).update((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any()); - verify(this.namedParameterJdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any()); - verify(amendmentRequest, atLeast(1)).getAmendment(); - verify(amendmentRequest).setAmendment((Amendment) any()); - } - - - @Test - void testSaveAmendmentwithdateandtime() throws DataAccessException { - when(this.util.getPGObject((Object) any())).thenReturn(new PGobject()); - when(this.namedParameterJdbcTemplate.update((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any())).thenReturn(1); - when(this.namedParameterJdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any())).thenReturn(new int[]{1, 1, 1, 1}); - - Amendment amendment = new Amendment(); - amendment.setAmendmentReason(AmendmentReason.COURT_CASE_SETTLEMENT); - AuditDetails auditDetails = mock(AuditDetails.class); - when(auditDetails.getCreatedTime()).thenReturn(1L); - when(auditDetails.getLastModifiedTime()).thenReturn(1L); - when(auditDetails.getCreatedBy()).thenReturn("Jan 1, 2020 8:00am GMT+0100"); - when(auditDetails.getLastModifiedBy()).thenReturn("Jan 1, 2020 9:00am GMT+0100"); - ProcessInstance workflow = new ProcessInstance(); - ArrayList demandDetails = new ArrayList<>(); - ArrayList documents = new ArrayList<>(); - AmendmentRequest amendmentRequest = mock(AmendmentRequest.class); - when(amendmentRequest.getAmendment()).thenReturn(new Amendment("42", "42", "42", - "INSERT INTO egbs_amendment (id, tenantid, amendmentid, businessservice, consumercode, amendmentreason," - + " reasondocumentnumber, status, effectivetill, effectivefrom, amendeddemandid, createdby, createdtime," - + " lastmodifiedby, lastmodifiedtime, additionaldetails) \tVALUES (:id, :tenantid, :amendmentid," - + " :businessservice, :consumercode, :amendmentreason, :reasondocumentnumber, :status, :effectivetill," - + " :effectivefrom, :amendeddemandid, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime," - + " :additionaldetails);", - "42", - "INSERT INTO egbs_amendment (id, tenantid, amendmentid, businessservice, consumercode, amendmentreason," - + " reasondocumentnumber, status, effectivetill, effectivefrom, amendeddemandid, createdby, createdtime," - + " lastmodifiedby, lastmodifiedtime, additionaldetails) \tVALUES (:id, :tenantid, :amendmentid," - + " :businessservice, :consumercode, :amendmentreason, :reasondocumentnumber, :status, :effectivetill," - + " :effectivefrom, :amendeddemandid, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime," - + " :additionaldetails);", - AmendmentReason.COURT_CASE_SETTLEMENT, "Just cause", AmendmentStatus.ACTIVE, workflow, demandDetails, documents, - 1L, 1L, auditDetails, MissingNode.getInstance())); - doNothing().when(amendmentRequest).setAmendment((Amendment) any()); - amendmentRequest.setAmendment(amendment); - this.amendmentRepository.saveAmendment(amendmentRequest); - verify(this.util).getPGObject((Object) any()); - verify(this.namedParameterJdbcTemplate).update((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any()); - verify(this.namedParameterJdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any()); - verify(amendmentRequest, atLeast(1)).getAmendment(); - verify(amendmentRequest).setAmendment((Amendment) any()); - verify(auditDetails).getCreatedTime(); - verify(auditDetails).getLastModifiedTime(); - verify(auditDetails).getCreatedBy(); - verify(auditDetails).getLastModifiedBy(); - } - - - @Test - void testGetAmendments() throws DataAccessException { - ArrayList objectList = new ArrayList<>(); - when(this.namedParameterJdbcTemplate.query((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn(objectList); - when(this.amendmentQueryBuilder.getSearchQuery((AmendmentCriteria) any(), - (org.springframework.jdbc.core.namedparam.MapSqlParameterSource) any())).thenReturn("Search Query"); - List actualAmendments = this.amendmentRepository.getAmendments(new AmendmentCriteria()); - assertSame(objectList, actualAmendments); - assertTrue(actualAmendments.isEmpty()); - verify(this.namedParameterJdbcTemplate).query((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any()); - verify(this.amendmentQueryBuilder).getSearchQuery((AmendmentCriteria) any(), - (org.springframework.jdbc.core.namedparam.MapSqlParameterSource) any()); - } - - - @Test - void testUpdateAmendment() { - when(this.namedParameterJdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any())).thenReturn(new int[]{1, 1, 1, 1}); - this.amendmentRepository.updateAmendment(new ArrayList<>()); - verify(this.namedParameterJdbcTemplate).batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any()); - } - - - @Test - void testUpdateAmendment4() { - when(this.util.getPGObject((Object) any())).thenReturn(new PGobject()); - when(this.namedParameterJdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any())).thenReturn(new int[]{1, 1, 1, 1}); - AuditDetails auditDetails = new AuditDetails(); - MissingNode additionalDetails = MissingNode.getInstance(); - ProcessInstance workflow = new ProcessInstance(); - AmendmentUpdate amendmentUpdate = new AmendmentUpdate("42", "42", "42", auditDetails, additionalDetails, workflow, - AmendmentStatus.ACTIVE, new ArrayList<>()); - amendmentUpdate.setStatus(AmendmentStatus.ACTIVE); - ArrayList amendmentUpdateList = new ArrayList<>(); - amendmentUpdateList.add(amendmentUpdate); - this.amendmentRepository.updateAmendment(amendmentUpdateList); - verify(this.util).getPGObject((Object) any()); - verify(this.namedParameterJdbcTemplate).batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any()); - } - - - @Test - void testUpdateAmendmentWithTimeanddate() { - when(this.util.getPGObject((Object) any())).thenReturn(new PGobject()); - when(this.namedParameterJdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any())).thenReturn(new int[]{1, 1, 1, 1}); - AuditDetails auditDetails = mock(AuditDetails.class); - when(auditDetails.getLastModifiedTime()).thenReturn(1L); - when(auditDetails.getLastModifiedBy()).thenReturn("Jan 1, 2020 9:00am GMT+0100"); - MissingNode additionalDetails = MissingNode.getInstance(); - ProcessInstance workflow = new ProcessInstance(); - - AmendmentUpdate amendmentUpdate = new AmendmentUpdate("42", "42", "42", auditDetails, additionalDetails, workflow, - AmendmentStatus.ACTIVE, new ArrayList<>()); - amendmentUpdate.setStatus(AmendmentStatus.ACTIVE); - - ArrayList amendmentUpdateList = new ArrayList<>(); - amendmentUpdateList.add(amendmentUpdate); - this.amendmentRepository.updateAmendment(amendmentUpdateList); - verify(this.util).getPGObject((Object) any()); - verify(this.namedParameterJdbcTemplate).batchUpdate((String) any(), - (org.springframework.jdbc.core.namedparam.SqlParameterSource[]) any()); - verify(auditDetails).getLastModifiedTime(); - verify(auditDetails).getLastModifiedBy(); - } - - - @Test - void testGetAmendmentSqlParameter() { - when(this.util.getPGObject((Object) any())).thenReturn(new PGobject()); - - Amendment amendment = new Amendment(); - amendment.setAmendmentReason(AmendmentReason.COURT_CASE_SETTLEMENT); - AmendmentRequest amendmentRequest = mock(AmendmentRequest.class); - ProcessInstance workflow = new ProcessInstance(); - ArrayList demandDetails = new ArrayList<>(); - ArrayList documents = new ArrayList<>(); - AuditDetails auditDetails = new AuditDetails(); - when(amendmentRequest.getAmendment()).thenReturn(new Amendment("42", "42", "42", "id", "42", "id", - AmendmentReason.COURT_CASE_SETTLEMENT, "Just cause", AmendmentStatus.ACTIVE, workflow, demandDetails, documents, - 1L, 1L, auditDetails, MissingNode.getInstance())); - doNothing().when(amendmentRequest).setAmendment((Amendment) any()); - amendmentRequest.setAmendment(amendment); - assertEquals(Short.SIZE, - this.amendmentRepository.getAmendmentSqlParameter(amendmentRequest).getParameterNames().length); - verify(this.util).getPGObject((Object) any()); - verify(amendmentRequest).getAmendment(); - verify(amendmentRequest).setAmendment((Amendment) any()); - } - - - @Test - void testGetAmendmentSqlParameterWIthDate() { - when(this.util.getPGObject((Object) any())).thenReturn(new PGobject()); - - Amendment amendment = new Amendment(); - amendment.setAmendmentReason(AmendmentReason.COURT_CASE_SETTLEMENT); - AuditDetails auditDetails = mock(AuditDetails.class); - when(auditDetails.getCreatedTime()).thenReturn(1L); - when(auditDetails.getLastModifiedTime()).thenReturn(1L); - when(auditDetails.getCreatedBy()).thenReturn("Jan 1, 2020 8:00am GMT+0100"); - when(auditDetails.getLastModifiedBy()).thenReturn("Jan 1, 2020 9:00am GMT+0100"); - ProcessInstance workflow = new ProcessInstance(); - ArrayList demandDetails = new ArrayList<>(); - ArrayList documents = new ArrayList<>(); - AmendmentRequest amendmentRequest = mock(AmendmentRequest.class); - when(amendmentRequest.getAmendment()).thenReturn(new Amendment("42", "42", "42", "id", "42", "id", - AmendmentReason.COURT_CASE_SETTLEMENT, "Just cause", AmendmentStatus.ACTIVE, workflow, demandDetails, documents, - 1L, 1L, auditDetails, MissingNode.getInstance())); - doNothing().when(amendmentRequest).setAmendment((Amendment) any()); - amendmentRequest.setAmendment(amendment); - assertEquals(Short.SIZE, - this.amendmentRepository.getAmendmentSqlParameter(amendmentRequest).getParameterNames().length); - verify(this.util).getPGObject((Object) any()); - verify(amendmentRequest).getAmendment(); - verify(amendmentRequest).setAmendment((Amendment) any()); - verify(auditDetails).getCreatedTime(); - verify(auditDetails).getLastModifiedTime(); - verify(auditDetails).getCreatedBy(); - verify(auditDetails).getLastModifiedBy(); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/BillRepositoryTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/BillRepositoryTest.java deleted file mode 100644 index 9e86d23d66c..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/BillRepositoryTest.java +++ /dev/null @@ -1,246 +0,0 @@ -package org.egov.demand.repository; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.AuditDetail; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.Bill; -import org.egov.demand.model.BillAccountDetail; -import org.egov.demand.model.BillDetail; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.repository.querybuilder.BillQueryBuilder; -import org.egov.demand.repository.rowmapper.BillRowMapper; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.BillResponse; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; - -@ContextConfiguration(classes = {BillRepository.class}) -@ExtendWith(SpringExtension.class) -class BillRepositoryTest { - @MockBean - private BillQueryBuilder billQueryBuilder; - - @Autowired - private BillRepository billRepository; - - @MockBean - private BillRowMapper billRowMapper; - - @MockBean - private BusinessServiceDetailRepository businessServiceDetailRepository; - - @MockBean - private JdbcTemplate jdbcTemplate; - - @MockBean - private RestTemplate restTemplate; - - @MockBean - private Util util; - - @Test - void testFindBill() throws DataAccessException { - ArrayList objectList = new ArrayList<>(); - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn(objectList); - when(this.billQueryBuilder.getBillQuery((BillSearchCriteria) any(), (List) any())).thenReturn("Bill Query"); - List actualFindBillResult = this.billRepository.findBill(new BillSearchCriteria()); - assertSame(objectList, actualFindBillResult); - assertTrue(actualFindBillResult.isEmpty()); - verify(this.jdbcTemplate).query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any()); - verify(this.billQueryBuilder).getBillQuery((BillSearchCriteria) any(), (List) any()); - } - - - @Test - void testSaveBill() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - - ArrayList billList = new ArrayList<>(); - billList.add(new Bill()); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getBills()).thenReturn(billList); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - this.billRepository.saveBill(billRequest); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - verify(billRequest, atLeast(1)).getBills(); - verify(billRequest).getRequestInfo(); - } - - @Test - void testSaveBillSuccess() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - - Bill bill = new Bill(); - bill.addBillDetailsItem(new BillDetail()); - - ArrayList billList = new ArrayList<>(); - billList.add(bill); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getBills()).thenReturn(billList); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - this.billRepository.saveBill(billRequest); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - verify(billRequest, atLeast(1)).getBills(); - verify(billRequest).getRequestInfo(); - } - - - - - - - @Test - void testSaveBillDetails() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - - ArrayList billList = new ArrayList<>(); - billList.add(new Bill()); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getBills()).thenReturn(billList); - this.billRepository.saveBillDetails(billRequest); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - verify(billRequest).getBills(); - } - - - - - @Test - void testSaveBillDetailswithbilllist() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - - Bill bill = new Bill(); - bill.addBillDetailsItem(new BillDetail()); - - ArrayList billList = new ArrayList<>(); - billList.add(bill); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getBills()).thenReturn(billList); - this.billRepository.saveBillDetails(billRequest); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - verify(billRequest).getBills(); - } - - - - - @Test - void testSaveBillAccountDetail() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - ArrayList billAccountDetails = new ArrayList<>(); - this.billRepository.saveBillAccountDetail(billAccountDetails, new AuditDetails()); - verify(this.jdbcTemplate).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - - - @Test - void testApportiongetbill() { - when(this.businessServiceDetailRepository.getBussinessServiceDetail((RequestInfo) any(), - (org.egov.demand.web.contract.BusinessServiceDetailCriteria) any())).thenReturn(new ArrayList<>()); - - ArrayList billList = new ArrayList<>(); - billList.add(new Bill()); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getBills()).thenReturn(billList); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - List actualApportionResult = this.billRepository.apportion(billRequest); - assertSame(billList, actualApportionResult); - assertEquals(1, actualApportionResult.size()); - verify(this.businessServiceDetailRepository).getBussinessServiceDetail((RequestInfo) any(), - (org.egov.demand.web.contract.BusinessServiceDetailCriteria) any()); - verify(billRequest).getBills(); - verify(billRequest).getRequestInfo(); - } - - - @Test - void testApportionRequest() { - when(this.businessServiceDetailRepository.getBussinessServiceDetail((RequestInfo) any(), - (org.egov.demand.web.contract.BusinessServiceDetailCriteria) any())).thenReturn(new ArrayList<>()); - - Bill bill = new Bill(); - bill.addBillDetailsItem(new BillDetail()); - - ArrayList billList = new ArrayList<>(); - billList.add(bill); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getBills()).thenReturn(billList); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - List actualApportionResult = this.billRepository.apportion(billRequest); - assertSame(billList, actualApportionResult); - assertEquals(1, actualApportionResult.size()); - verify(this.businessServiceDetailRepository).getBussinessServiceDetail((RequestInfo) any(), - (org.egov.demand.web.contract.BusinessServiceDetailCriteria) any()); - verify(billRequest).getBills(); - verify(billRequest).getRequestInfo(); - } - - - @Test - void testApportionwithBusinessDetails() throws RestClientException { - when(this.restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) - .thenReturn(new BillResponse()); - - ArrayList businessServiceDetailList = new ArrayList<>(); - ArrayList collectionModesNotAllowed = new ArrayList<>(); - businessServiceDetailList.add(new BusinessServiceDetail("42", "42", "Business Service", "Code", - collectionModesNotAllowed, true, true, true, 2L, true, "https://example.org/example", new AuditDetail())); - when(this.businessServiceDetailRepository.getBussinessServiceDetail((RequestInfo) any(), - (org.egov.demand.web.contract.BusinessServiceDetailCriteria) any())).thenReturn(businessServiceDetailList); - - ArrayList billList = new ArrayList<>(); - billList.add(new Bill()); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getBills()).thenReturn(billList); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - List actualApportionResult = this.billRepository.apportion(billRequest); - assertSame(billList, actualApportionResult); - assertEquals(1, actualApportionResult.size()); - verify(this.restTemplate).postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any()); - verify(this.businessServiceDetailRepository).getBussinessServiceDetail((RequestInfo) any(), - (org.egov.demand.web.contract.BusinessServiceDetailCriteria) any()); - verify(billRequest).getBills(); - verify(billRequest).getRequestInfo(); - } - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/BillRepositoryV2Test.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/BillRepositoryV2Test.java deleted file mode 100644 index 91a050bee6b..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/BillRepositoryV2Test.java +++ /dev/null @@ -1,137 +0,0 @@ -package org.egov.demand.repository; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.*; - -import org.egov.demand.repository.querybuilder.BillQueryBuilder; -import org.egov.demand.repository.rowmapper.BillRowMapperV2; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.BillRequestV2; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {BillRepositoryV2.class}) -@ExtendWith(SpringExtension.class) -class BillRepositoryV2Test { - @MockBean - private BillQueryBuilder billQueryBuilder; - - @Autowired - private BillRepositoryV2 billRepositoryV2; - - @MockBean - private BillRowMapperV2 billRowMapperV2; - - @MockBean - private JdbcTemplate jdbcTemplate; - - @MockBean - private Util util; - - - @Test - void testFindBill() throws DataAccessException { - ArrayList objectList = new ArrayList<>(); - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn(objectList); - when(this.billQueryBuilder.getBillQuery((BillSearchCriteria) any(), (List) any())).thenReturn("Bill Query"); - List actualFindBillResult = this.billRepositoryV2.findBill(new BillSearchCriteria()); - assertSame(objectList, actualFindBillResult); - assertTrue(actualFindBillResult.isEmpty()); - verify(this.jdbcTemplate).query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any()); - verify(this.billQueryBuilder).getBillQuery((BillSearchCriteria) any(), (List) any()); - } - - - - @Test - void testSaveBillDetailsbillv2() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - - BillV2 billV2 = new BillV2(); - billV2.setBillDetails(new ArrayList<>()); - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(billV2); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getBills()).thenReturn(billV2List); - this.billRepositoryV2.saveBillDetails(billRequestV2); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - verify(billRequestV2).getBills(); - } - - - @Test - void testSaveBillAccountDetail() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - ArrayList billAccountDetails = new ArrayList<>(); - this.billRepositoryV2.saveBillAccountDetail(billAccountDetails, new AuditDetails()); - verify(this.jdbcTemplate).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - @Test - void testUpdateBillStatus() { - assertEquals(0, this.billRepositoryV2.updateBillStatus(new UpdateBillCriteria()).intValue()); - } - - - - @Test - void testUpdateBillStatusgetcodes() { - UpdateBillCriteria updateBillCriteria = mock(UpdateBillCriteria.class); - when(updateBillCriteria.getConsumerCodes()).thenReturn(new HashSet<>()); - assertEquals(0, this.billRepositoryV2.updateBillStatus(updateBillCriteria).intValue()); - verify(updateBillCriteria).getConsumerCodes(); - } - - @Test - void testUpdateBillStatusTenantId() throws DataAccessException { - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn(new ArrayList<>()); - when(this.billQueryBuilder.getBillQuery((BillSearchCriteria) any(), - (List) any())).thenReturn("Bill Query"); - - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - UpdateBillCriteria updateBillCriteria = mock(UpdateBillCriteria.class); - when(updateBillCriteria.getBusinessService()).thenReturn("Business Service"); - when(updateBillCriteria.getTenantId()).thenReturn("42"); - when(updateBillCriteria.getConsumerCodes()).thenReturn(stringSet); - assertEquals(0, this.billRepositoryV2.updateBillStatus(updateBillCriteria).intValue()); - verify(this.jdbcTemplate).query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any()); - verify(this.billQueryBuilder).getBillQuery((BillSearchCriteria) any(), - (List) any()); - verify(updateBillCriteria).getBusinessService(); - verify(updateBillCriteria).getTenantId(); - verify(updateBillCriteria).getConsumerCodes(); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/BusinessServiceDetailRepositoryTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/BusinessServiceDetailRepositoryTest.java deleted file mode 100644 index c0b48b8cfd9..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/BusinessServiceDetailRepositoryTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.egov.demand.repository; - -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -import java.util.ArrayList; - -import java.util.HashSet; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {BusinessServiceDetailRepository.class}) -@ExtendWith(SpringExtension.class) -class BusinessServiceDetailRepositoryTest { - @Autowired - private BusinessServiceDetailRepository businessServiceDetailRepository; - - @MockBean - private ObjectMapper objectMapper; - - @MockBean - private Util util; - - - @Test - void testGetBussinessServiceDetail() throws IllegalArgumentException { - DocumentContext documentContext = mock(DocumentContext.class); - when(documentContext.read((String) any(), (com.jayway.jsonpath.Predicate[]) any())).thenReturn("Read"); - when(this.util.getStringVal((java.util.Set) any())).thenReturn("String Val"); - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(documentContext); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - ArrayList businessServiceDetailList = new ArrayList<>(); - when(this.objectMapper.convertValue((Object) any(), - (com.fasterxml.jackson.core.type.TypeReference>) any())) - .thenReturn(businessServiceDetailList); - RequestInfo requestInfo = new RequestInfo(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("BillingService"); - List actualBussinessServiceDetail = this.businessServiceDetailRepository - .getBussinessServiceDetail(requestInfo, new BusinessServiceDetailCriteria("42", stringSet, new HashSet<>())); - assertSame(businessServiceDetailList, actualBussinessServiceDetail); - assertTrue(actualBussinessServiceDetail.isEmpty()); - verify(this.util).getAttributeValues((MdmsCriteriaReq) any()); - verify(this.util).getStringVal((java.util.Set) any()); - verify(this.util).prepareMdMsRequest((String) any(), (String) any(), (List) any(), (String) any(), - (RequestInfo) any()); - verify(documentContext).read((String) any(), (com.jayway.jsonpath.Predicate[]) any()); - verify(this.objectMapper).convertValue((Object) any(), - (com.fasterxml.jackson.core.type.TypeReference>) any()); - } - - - - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/DemandRepositoryTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/DemandRepositoryTest.java deleted file mode 100644 index bf439a52419..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/DemandRepositoryTest.java +++ /dev/null @@ -1,335 +0,0 @@ -package org.egov.demand.repository; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Set; - -import org.egov.demand.model.Demand; - -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.model.PaymentBackUpdateAudit; -import org.egov.demand.repository.querybuilder.DemandQueryBuilder; -import org.egov.demand.repository.rowmapper.DemandRowMapper; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.DemandRequest; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {DemandRepository.class}) -@ExtendWith(SpringExtension.class) -class DemandRepositoryTest { - @MockBean - private DemandQueryBuilder demandQueryBuilder; - - @Autowired - private DemandRepository demandRepository; - - @MockBean - private DemandRowMapper demandRowMapper; - - @MockBean - private JdbcTemplate jdbcTemplate; - - @MockBean - private Util util; - - - @Test - void testGetDemands() throws DataAccessException { - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn("Query"); - when(this.demandQueryBuilder.getDemandQuery((DemandCriteria) any(), (List) any())) - .thenThrow(new EmptyResultDataAccessException(3)); - assertThrows(EmptyResultDataAccessException.class, () -> this.demandRepository.getDemands(new DemandCriteria())); - verify(this.demandQueryBuilder).getDemandQuery((DemandCriteria) any(), (List) any()); - } - - @Test - void testGetDemands2() throws DataAccessException { - ArrayList objectList = new ArrayList<>(); - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn(objectList); - when(this.demandQueryBuilder.getDemandQuery((DemandCriteria) any(), (List) any())) - .thenReturn("Demand Query"); - List actualDemands = this.demandRepository.getDemands(new DemandCriteria()); - assertSame(objectList, actualDemands); - assertTrue(actualDemands.isEmpty()); - verify(this.jdbcTemplate).query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any()); - verify(this.demandQueryBuilder).getDemandQuery((DemandCriteria) any(), (List) any()); - } - - @Test - void testGetDemandsForConsumerCodes() throws DataAccessException { - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn("Query"); - when(this.demandQueryBuilder.getDemandQueryForConsumerCodes((java.util.Map>) any(), - (List) any(), (String) any())).thenThrow(new EmptyResultDataAccessException(3)); - assertThrows(EmptyResultDataAccessException.class, - () -> this.demandRepository.getDemandsForConsumerCodes(new HashMap<>(), "42")); - verify(this.demandQueryBuilder).getDemandQueryForConsumerCodes((java.util.Map>) any(), - (List) any(), (String) any()); - } - - - @Test - void testGetDemandsForConsumerCodes2() throws DataAccessException { - ArrayList objectList = new ArrayList<>(); - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn(objectList); - when(this.demandQueryBuilder.getDemandQueryForConsumerCodes((java.util.Map>) any(), - (List) any(), (String) any())).thenReturn("Demand Query For Consumer Codes"); - List actualDemandsForConsumerCodes = this.demandRepository.getDemandsForConsumerCodes(new HashMap<>(), - "42"); - assertSame(objectList, actualDemandsForConsumerCodes); - assertTrue(actualDemandsForConsumerCodes.isEmpty()); - verify(this.jdbcTemplate).query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any()); - verify(this.demandQueryBuilder).getDemandQueryForConsumerCodes((java.util.Map>) any(), - (List) any(), (String) any()); - } - - - @Test - void testSave() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - this.demandRepository.save(new DemandRequest()); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - - @Test - void testSave3() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())) - .thenThrow(new EmptyResultDataAccessException(3)); - assertThrows(EmptyResultDataAccessException.class, () -> this.demandRepository.save(new DemandRequest())); - verify(this.jdbcTemplate).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - - - @Test - void testUpdate4() throws DataAccessException { - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn("Query"); - when(this.demandQueryBuilder.getDemandQuery((DemandCriteria) any(), (List) any())) - .thenThrow(new EmptyResultDataAccessException(3)); - - ArrayList demandList = new ArrayList<>(); - demandList.add(new Demand()); - DemandRequest demandRequest = mock(DemandRequest.class); - when(demandRequest.getDemands()).thenReturn(demandList); - assertThrows(EmptyResultDataAccessException.class, - () -> this.demandRepository.update(demandRequest, new PaymentBackUpdateAudit())); - verify(this.demandQueryBuilder).getDemandQuery((DemandCriteria) any(), (List) any()); - verify(demandRequest).getDemands(); - } - - - @Test - void testUpdate5() throws DataAccessException { - when(this.jdbcTemplate.update((String) any(), (org.springframework.jdbc.core.PreparedStatementSetter) any())) - .thenReturn(1); - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn(new ArrayList<>()); - when(this.demandQueryBuilder.getDemandQuery((DemandCriteria) any(), (List) any())) - .thenReturn("Demand Query"); - - ArrayList demandList = new ArrayList<>(); - demandList.add(new Demand()); - DemandRequest demandRequest = mock(DemandRequest.class); - when(demandRequest.getDemands()).thenReturn(demandList); - this.demandRepository.update(demandRequest, new PaymentBackUpdateAudit()); - verify(this.jdbcTemplate).update((String) any(), (org.springframework.jdbc.core.PreparedStatementSetter) any()); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - verify(this.jdbcTemplate).query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any()); - verify(this.demandQueryBuilder).getDemandQuery((DemandCriteria) any(), (List) any()); - verify(demandRequest).getDemands(); - } - - - - @Test - void testUpdate7() throws DataAccessException { - when(this.jdbcTemplate.update((String) any(), (org.springframework.jdbc.core.PreparedStatementSetter) any())) - .thenReturn(1); - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn(new ArrayList<>()); - when(this.demandQueryBuilder.getDemandQuery((DemandCriteria) any(), (List) any())) - .thenReturn("Demand Query"); - - Demand demand = new Demand(); - demand.addDemandDetailsItem(new DemandDetail()); - - ArrayList demandList = new ArrayList<>(); - demandList.add(demand); - DemandRequest demandRequest = mock(DemandRequest.class); - when(demandRequest.getDemands()).thenReturn(demandList); - this.demandRepository.update(demandRequest, new PaymentBackUpdateAudit()); - verify(this.jdbcTemplate).update((String) any(), (org.springframework.jdbc.core.PreparedStatementSetter) any()); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - verify(this.jdbcTemplate).query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any()); - verify(this.demandQueryBuilder).getDemandQuery((DemandCriteria) any(), (List) any()); - verify(demandRequest).getDemands(); - } - - - @Test - void testUpdate8() throws DataAccessException { - when(this.jdbcTemplate.update((String) any(), (org.springframework.jdbc.core.PreparedStatementSetter) any())) - .thenReturn(1); - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - when(this.jdbcTemplate.query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any())).thenReturn(new ArrayList<>()); - when(this.demandQueryBuilder.getDemandQuery((DemandCriteria) any(), (List) any())) - .thenReturn("Demand Query"); - - ArrayList demandList = new ArrayList<>(); - demandList.add(new Demand()); - DemandRequest demandRequest = mock(DemandRequest.class); - when(demandRequest.getDemands()).thenReturn(demandList); - this.demandRepository.update(demandRequest, null); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - verify(this.jdbcTemplate).query((String) any(), (Object[]) any(), - (org.springframework.jdbc.core.ResultSetExtractor) any()); - verify(this.demandQueryBuilder).getDemandQuery((DemandCriteria) any(), (List) any()); - verify(demandRequest).getDemands(); - } - - @Test - void testInsertBatch() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - ArrayList newDemands = new ArrayList<>(); - this.demandRepository.insertBatch(newDemands, new ArrayList<>()); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - @Test - void testInsertBatch2() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())) - .thenThrow(new EmptyResultDataAccessException(3)); - ArrayList newDemands = new ArrayList<>(); - assertThrows(EmptyResultDataAccessException.class, - () -> this.demandRepository.insertBatch(newDemands, new ArrayList<>())); - verify(this.jdbcTemplate).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - @Test - void testUpdateBatch() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - ArrayList oldDemands = new ArrayList<>(); - this.demandRepository.updateBatch(oldDemands, new ArrayList<>()); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - @Test - void testUpdateBatch2() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())) - .thenThrow(new EmptyResultDataAccessException(3)); - ArrayList oldDemands = new ArrayList<>(); - assertThrows(EmptyResultDataAccessException.class, - () -> this.demandRepository.updateBatch(oldDemands, new ArrayList<>())); - verify(this.jdbcTemplate).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - @Test - void testInsertBatchForAudit() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())).thenReturn(new int[]{1, 1, 1, 1}); - ArrayList demands = new ArrayList<>(); - this.demandRepository.insertBatchForAudit(demands, new ArrayList<>()); - verify(this.jdbcTemplate, atLeast(1)).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - @Test - void testInsertBatchForAudit2() throws DataAccessException { - when(this.jdbcTemplate.batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any())) - .thenThrow(new EmptyResultDataAccessException(3)); - ArrayList demands = new ArrayList<>(); - assertThrows(EmptyResultDataAccessException.class, - () -> this.demandRepository.insertBatchForAudit(demands, new ArrayList<>())); - verify(this.jdbcTemplate).batchUpdate((String) any(), - (org.springframework.jdbc.core.BatchPreparedStatementSetter) any()); - } - - - @Test - void testInsertBackUpdateForPayment() throws DataAccessException { - when(this.jdbcTemplate.update((String) any(), (org.springframework.jdbc.core.PreparedStatementSetter) any())) - .thenReturn(1); - this.demandRepository.insertBackUpdateForPayment(new PaymentBackUpdateAudit()); - verify(this.jdbcTemplate).update((String) any(), (org.springframework.jdbc.core.PreparedStatementSetter) any()); - } - - - @Test - void testInsertBackUpdateForPayment2() throws DataAccessException { - when(this.jdbcTemplate.update((String) any(), (org.springframework.jdbc.core.PreparedStatementSetter) any())) - .thenThrow(new EmptyResultDataAccessException(3)); - assertThrows(EmptyResultDataAccessException.class, - () -> this.demandRepository.insertBackUpdateForPayment(new PaymentBackUpdateAudit())); - verify(this.jdbcTemplate).update((String) any(), (org.springframework.jdbc.core.PreparedStatementSetter) any()); - } - - @Test - void testSearchPaymentBackUpdateAudit() throws DataAccessException { - when(this.jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())) - .thenReturn("Query For Object"); - assertEquals("Query For Object", this.demandRepository.searchPaymentBackUpdateAudit(new PaymentBackUpdateAudit())); - verify(this.jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); - } - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/ServiceRequestRepositoryTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/ServiceRequestRepositoryTest.java deleted file mode 100644 index 8b6ab4285fb..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/ServiceRequestRepositoryTest.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.egov.demand.repository; - -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyBoolean; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.tracer.model.ServiceCallException; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; - -@ContextConfiguration(classes = {ServiceRequestRepository.class}) -@ExtendWith(SpringExtension.class) -class ServiceRequestRepositoryTest { - @MockBean - private ObjectMapper objectMapper; - - @MockBean - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - - @Test - void testFetchResult() throws JsonProcessingException, RestClientException { - HashMap objectObjectMap = new HashMap<>(); - when(this.restTemplate.postForObject((String) any(), (Object) any(), (Class>) any(), - (Object[]) any())).thenReturn(objectObjectMap); - when(this.objectMapper.configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean())) - .thenReturn(this.objectMapper); - when(this.objectMapper.writeValueAsString((Object) any())).thenReturn("42"); - Map actualFetchResultResult = this.serviceRequestRepository.fetchResult("Uri", "Request"); - assertSame(objectObjectMap, actualFetchResultResult); - assertTrue(actualFetchResultResult.isEmpty()); - verify(this.restTemplate).postForObject((String) any(), (Object) any(), (Class>) any(), - (Object[]) any()); - verify(this.objectMapper).configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean()); - verify(this.objectMapper).writeValueAsString((Object) any()); - } - - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/TaxHeadMasterRepositoryTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/TaxHeadMasterRepositoryTest.java deleted file mode 100644 index 577c1f8e3ff..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/TaxHeadMasterRepositoryTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.egov.demand.repository; - -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -import java.util.ArrayList; - -import java.util.HashSet; - -import java.util.List; -import java.util.Set; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.TaxHeadMaster; -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.egov.demand.util.Util; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {TaxHeadMasterRepository.class}) -@ExtendWith(SpringExtension.class) -class TaxHeadMasterRepositoryTest { - @MockBean - private ObjectMapper objectMapper; - - @Autowired - private TaxHeadMasterRepository taxHeadMasterRepository; - - @MockBean - private Util util; - - - @Test - void testGetTaxHeadMaster8() throws IllegalArgumentException { - DocumentContext documentContext = mock(DocumentContext.class); - when(documentContext.read((String) any(), (com.jayway.jsonpath.Predicate[]) any())).thenReturn("Read"); - when(this.util.getStringVal((Set) any())).thenReturn("String Val"); - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(documentContext); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - ArrayList taxHeadMasterList = new ArrayList<>(); - when(this.objectMapper.convertValue((Object) any(), - (com.fasterxml.jackson.core.type.TypeReference>) any())).thenReturn(taxHeadMasterList); - RequestInfo requestInfo = new RequestInfo(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - TaxHeadMasterCriteria taxHeadMasterCriteria = mock(TaxHeadMasterCriteria.class); - when(taxHeadMasterCriteria.getIsActualDemand()).thenReturn(true); - when(taxHeadMasterCriteria.getIsDebit()).thenReturn(true); - when(taxHeadMasterCriteria.getCategory()).thenReturn("Category"); - when(taxHeadMasterCriteria.getName()).thenReturn("Name"); - when(taxHeadMasterCriteria.getService()).thenReturn("Service"); - when(taxHeadMasterCriteria.getTenantId()).thenReturn("42"); - when(taxHeadMasterCriteria.getCode()).thenReturn(stringSet); - when(taxHeadMasterCriteria.getId()).thenReturn(new HashSet<>()); - List actualTaxHeadMaster = this.taxHeadMasterRepository.getTaxHeadMaster(requestInfo, - taxHeadMasterCriteria); - assertSame(taxHeadMasterList, actualTaxHeadMaster); - assertTrue(actualTaxHeadMaster.isEmpty()); - verify(this.util).getAttributeValues((MdmsCriteriaReq) any()); - verify(this.util).getStringVal((Set) any()); - verify(this.util).prepareMdMsRequest((String) any(), (String) any(), (List) any(), (String) any(), - (RequestInfo) any()); - verify(documentContext).read((String) any(), (com.jayway.jsonpath.Predicate[]) any()); - verify(this.objectMapper).convertValue((Object) any(), - (com.fasterxml.jackson.core.type.TypeReference>) any()); - verify(taxHeadMasterCriteria, atLeast(1)).getIsActualDemand(); - verify(taxHeadMasterCriteria, atLeast(1)).getIsDebit(); - verify(taxHeadMasterCriteria, atLeast(1)).getCategory(); - verify(taxHeadMasterCriteria, atLeast(1)).getName(); - verify(taxHeadMasterCriteria, atLeast(1)).getService(); - verify(taxHeadMasterCriteria).getTenantId(); - verify(taxHeadMasterCriteria, atLeast(1)).getCode(); - verify(taxHeadMasterCriteria, atLeast(1)).getId(); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/TaxPeriodRepositoryTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/TaxPeriodRepositoryTest.java deleted file mode 100644 index 7f03fe0f8f2..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/TaxPeriodRepositoryTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.egov.demand.repository; - -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -import java.util.ArrayList; - -import java.util.HashSet; - -import java.util.List; -import java.util.Set; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.TaxPeriod; -import org.egov.demand.model.enums.PeriodCycle; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.TaxPeriodCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {TaxPeriodRepository.class}) -@ExtendWith(SpringExtension.class) -class TaxPeriodRepositoryTest { - @MockBean - private ObjectMapper objectMapper; - - @Autowired - private TaxPeriodRepository taxPeriodRepository; - - @MockBean - private Util util; - - - @Test - void testGetTaxPeriod7() throws IllegalArgumentException { - DocumentContext documentContext = mock(DocumentContext.class); - when(documentContext.read((String) any(), (com.jayway.jsonpath.Predicate[]) any())).thenReturn("Read"); - when(this.util.getStringVal((Set) any())).thenReturn("String Val"); - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(documentContext); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - ArrayList taxPeriodList = new ArrayList<>(); - when(this.objectMapper.convertValue((Object) any(), - (com.fasterxml.jackson.core.type.TypeReference>) any())).thenReturn(taxPeriodList); - RequestInfo requestInfo = new RequestInfo(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - TaxPeriodCriteria taxPeriodCriteria = mock(TaxPeriodCriteria.class); - when(taxPeriodCriteria.getDate()).thenReturn(1L); - when(taxPeriodCriteria.getFromDate()).thenReturn(1L); - when(taxPeriodCriteria.getToDate()).thenReturn(1L); - when(taxPeriodCriteria.getCode()).thenReturn("Code"); - when(taxPeriodCriteria.getTenantId()).thenReturn("42"); - when(taxPeriodCriteria.getId()).thenReturn(stringSet); - when(taxPeriodCriteria.getService()).thenReturn(new HashSet<>()); - when(taxPeriodCriteria.getPeriodCycle()).thenReturn(PeriodCycle.MONTH); - List actualTaxPeriod = this.taxPeriodRepository.getTaxPeriod(requestInfo, taxPeriodCriteria); - assertSame(taxPeriodList, actualTaxPeriod); - assertTrue(actualTaxPeriod.isEmpty()); - verify(this.util).getAttributeValues((MdmsCriteriaReq) any()); - verify(this.util).getStringVal((Set) any()); - verify(this.util).prepareMdMsRequest((String) any(), (String) any(), (List) any(), (String) any(), - (RequestInfo) any()); - verify(documentContext).read((String) any(), (com.jayway.jsonpath.Predicate[]) any()); - verify(this.objectMapper).convertValue((Object) any(), - (com.fasterxml.jackson.core.type.TypeReference>) any()); - verify(taxPeriodCriteria, atLeast(1)).getDate(); - verify(taxPeriodCriteria, atLeast(1)).getFromDate(); - verify(taxPeriodCriteria, atLeast(1)).getToDate(); - verify(taxPeriodCriteria, atLeast(1)).getCode(); - verify(taxPeriodCriteria).getTenantId(); - verify(taxPeriodCriteria, atLeast(1)).getId(); - verify(taxPeriodCriteria).getService(); - verify(taxPeriodCriteria, atLeast(1)).getPeriodCycle(); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/AmendmentQueryBuilderTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/AmendmentQueryBuilderTest.java deleted file mode 100644 index 880d6969b99..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/AmendmentQueryBuilderTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.demand.repository.querybuilder; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.HashSet; - -import org.egov.demand.amendment.model.AmendmentCriteria; -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {AmendmentQueryBuilder.class}) -@ExtendWith(SpringExtension.class) -class AmendmentQueryBuilderTest { - @Autowired - private AmendmentQueryBuilder amendmentQueryBuilder; - - - @Test - void testGetSearchQuery() { - AmendmentCriteria amendmentCriteria = new AmendmentCriteria(); - MapSqlParameterSource mapSqlParameterSource = mock(MapSqlParameterSource.class); - when(mapSqlParameterSource.addValue((String) any(), (Object) any())).thenReturn(mock(MapSqlParameterSource.class)); - assertEquals( - "SELECT amendment.id as amendmentuuid, tenantid, amendment.amendmentid as amendmentid, businessservice," - + " consumercode, amendmentreason, reasondocumentnumber, amendment.status as amendmentstatus, effectivetill," - + " effectivefrom, amendeddemandid, createdby, createdtime, lastmodifiedby, lastmodifiedtime, additionaldetails," - + " amdl.id as detailid, amdl.amendmentid as detailamendmentid, taxheadcode, taxamount, doc.id as docid," - + " doc.amendmentid as docamendmentid, documentType, fileStoreid, documentuid, doc.status as docstatus " - + " FROM egbs_amendment amendment INNER JOIN egbs_amendment_taxdetail amdl ON amendment.id = amdl.amendmentid" - + " \tINNER JOIN egbs_document doc ON amendment.id = doc.amendmentid WHERE amendment.tenantid = :tenantid" - + " LIMIT :limit OFFSET :offset", - this.amendmentQueryBuilder.getSearchQuery(amendmentCriteria, mapSqlParameterSource)); - verify(mapSqlParameterSource, atLeast(1)).addValue((String) any(), (Object) any()); - } - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/BillQueryBuilderTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/BillQueryBuilderTest.java deleted file mode 100644 index 985955bce23..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/BillQueryBuilderTest.java +++ /dev/null @@ -1,347 +0,0 @@ -package org.egov.demand.repository.querybuilder; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.fasterxml.jackson.databind.node.MissingNode; - -import java.util.ArrayList; -import java.util.HashSet; - -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.BillV2; -import org.egov.demand.model.UpdateBillCriteria; -import org.junit.jupiter.api.Test; - -class BillQueryBuilderTest { - - - @Test - void testGetBillQuerySearch() { - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - HashSet billId = new HashSet<>(); - BillSearchCriteria billSearchCriteria = new BillSearchCriteria("42", billId, 1L, 1L, true, true, true, - new HashSet<>(), "42", BillQueryBuilder.BILL_BASE_QUERY, true, 3L, 1L, "jane.doe@example.org", - BillV2.BillStatus.ACTIVE, "42"); - ArrayList objectList = new ArrayList<>(); - assertEquals("WITH billresult AS (SELECT b.id AS b_id,b.mobilenumber, b.tenantid AS b_tenantid, b.payername AS" - + " b_payername, b.payeraddress AS b_payeraddress, b.payeremail AS b_payeremail,b.filestoreid AS" - + " b_fileStoreId, b.isactive AS b_isactive, b.iscancelled AS b_iscancelled, b.createdby AS b_createdby," - + " b.status as b_status, b.createddate AS b_createddate, b.lastmodifiedby AS b_lastmodifiedby," - + " b.lastmodifieddate AS b_lastmodifieddate, bd.id AS bd_id, bd.billid AS bd_billid, bd.tenantid AS" - + " bd_tenantid,bd.businessservice AS bd_businessservice, bd.demandid,bd.fromperiod,bd.toperiod, bd.billno" - + " AS bd_billno, bd.billdate AS bd_billdate, bd.consumercode AS bd_consumercode,bd.consumertype AS" - + " bd_consumertype, bd.billdescription AS bd_billdescription, bd.displaymessage AS bd_displaymessage," - + " bd.minimumamount AS bd_minimumamount, bd.totalamount AS bd_totalamount, bd.callbackforapportioning" - + " AS bd_callbackforapportioning,bd.expirydate AS bd_expirydate, bd.partpaymentallowed AS bd" - + "_partpaymentallowed, bd.isadvanceallowed as bd_isadvanceallowed,bd.collectionmodesnotallowed AS" - + " bd_collectionmodesnotallowed, ad.id AS ad_id, ad.tenantid AS ad_tenantid, ad.billdetail AS ad_billdetail," - + " ad.glcode AS ad_glcode, ad.orderno AS ad_orderno, ad.accountdescription AS ad_accountdescription," - + " ad.amount AS ad_amount, ad.adjustedamount AS ad_adjustedamount, ad.taxheadcode AS ad_taxheadcode," - + " ad.demanddetailid, ad.isactualdemand AS ad_isactualdemand, ad.purpose AS ad_purpose, b.additionaldetails" - + " as b_additionaldetails, bd.additionaldetails as bd_additionaldetails FROM egbs_bill_v1 b LEFT OUTER" - + " JOIN egbs_billdetail_v1 bd ON b.id = bd.billid AND b.tenantid = bd.tenantid LEFT OUTER JOIN" - + " egbs_billaccountdetail_v1 ad ON bd.id = ad.billdetail AND bd.tenantid = ad.tenantid WHERE b.tenantid" - + " LIKE ? AND b.status != ? AND b.payeremail = ? AND b.mobileNumber = ? AND bd.businessservice = ? AND" - + " bd.fromperiod = ? AND bd.toperiod = ? AND bd.billno = ?) SELECT * FROM billresult INNER JOIN (SELECT" - + " bd_consumercode, min(b_createddate) as mindate FROM billresult GROUP BY bd_consumercode) as uniqbill" - + " ON uniqbill.bd_consumercode=billresult.bd_consumercode AND uniqbill.mindate=billresult.b_createddate" - + " ORDER BY billresult.bd_consumercode ", billQueryBuilder.getBillQuery(billSearchCriteria, objectList)); - assertEquals(8, objectList.size()); - } - - - - @Test - void testGetBillQueryWithGetTenantId() { - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - BillSearchCriteria billSearchCriteria = new BillSearchCriteria(); - billSearchCriteria.setTenantId("42"); - ArrayList objectList = new ArrayList<>(); - assertEquals("WITH billresult AS (SELECT b.id AS b_id,b.mobilenumber, b.tenantid AS b_tenantid, b.payername AS" - + " b_payername, b.payeraddress AS b_payeraddress, b.payeremail AS b_payeremail,b.filestoreid AS" - + " b_fileStoreId, b.isactive AS b_isactive, b.iscancelled AS b_iscancelled, b.createdby AS b_createdby," - + " b.status as b_status, b.createddate AS b_createddate, b.lastmodifiedby AS b_lastmodifiedby," - + " b.lastmodifieddate AS b_lastmodifieddate, bd.id AS bd_id, bd.billid AS bd_billid, bd.tenantid AS" - + " bd_tenantid,bd.businessservice AS bd_businessservice, bd.demandid,bd.fromperiod,bd.toperiod, bd.billno" - + " AS bd_billno, bd.billdate AS bd_billdate, bd.consumercode AS bd_consumercode,bd.consumertype AS" - + " bd_consumertype, bd.billdescription AS bd_billdescription, bd.displaymessage AS bd_displaymessage," - + " bd.minimumamount AS bd_minimumamount, bd.totalamount AS bd_totalamount, bd.callbackforapportioning" - + " AS bd_callbackforapportioning,bd.expirydate AS bd_expirydate, bd.partpaymentallowed AS bd_partpaymentallowed" - + ", bd.isadvanceallowed as bd_isadvanceallowed,bd.collectionmodesnotallowed AS bd_collectionmodesnotallowed," - + " ad.id AS ad_id, ad.tenantid AS ad_tenantid, ad.billdetail AS ad_billdetail, ad.glcode AS ad_glcode," - + " ad.orderno AS ad_orderno, ad.accountdescription AS ad_accountdescription, ad.amount AS ad_amount," - + " ad.adjustedamount AS ad_adjustedamount, ad.taxheadcode AS ad_taxheadcode, ad.demanddetailid," - + " ad.isactualdemand AS ad_isactualdemand, ad.purpose AS ad_purpose, b.additionaldetails as b_additionaldetails" - + ", bd.additionaldetails as bd_additionaldetails FROM egbs_bill_v1 b LEFT OUTER JOIN egbs_billdetail_v1" - + " bd ON b.id = bd.billid AND b.tenantid = bd.tenantid LEFT OUTER JOIN egbs_billaccountdetail_v1 ad ON" - + " bd.id = ad.billdetail AND bd.tenantid = ad.tenantid WHERE b.tenantid LIKE ? ) SELECT * FROM billresult" - + " INNER JOIN (SELECT bd_consumercode, max(b_createddate) as maxdate FROM billresult GROUP BY" - + " bd_consumercode) as uniqbill ON uniqbill.bd_consumercode=billresult.bd_consumercode AND uniqbill" - + ".maxdate=billresult.b_createddate ", billQueryBuilder.getBillQuery(billSearchCriteria, objectList)); - assertEquals(1, objectList.size()); - } - - - @Test - void testGetBillQueryWithBillId() { - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - HashSet billId = new HashSet<>(); - BillSearchCriteria billSearchCriteria = new BillSearchCriteria(BillQueryBuilder.BILL_BASE_QUERY, billId, 1L, 1L, - true, true, true, new HashSet<>(), "42", BillQueryBuilder.BILL_BASE_QUERY, true, 3L, 1L, "jane.doe@example.org", - BillV2.BillStatus.ACTIVE, "42"); - ArrayList objectList = new ArrayList<>(); - assertEquals("WITH billresult AS (SELECT b.id AS b_id,b.mobilenumber, b.tenantid AS b_tenantid, b.payername AS" - + " b_payername, b.payeraddress AS b_payeraddress, b.payeremail AS b_payeremail,b.filestoreid AS" - + " b_fileStoreId, b.isactive AS b_isactive, b.iscancelled AS b_iscancelled, b.createdby AS b_createdby," - + " b.status as b_status, b.createddate AS b_createddate, b.lastmodifiedby AS b_lastmodifiedby," - + " b.lastmodifieddate AS b_lastmodifieddate, bd.id AS bd_id, bd.billid AS bd_billid, bd.tenantid AS" - + " bd_tenantid,bd.businessservice AS bd_businessservice, bd.demandid,bd.fromperiod,bd.toperiod, bd.billno" - + " AS bd_billno, bd.billdate AS bd_billdate, bd.consumercode AS bd_consumercode,bd.consumertype AS" - + " bd_consumertype, bd.billdescription AS bd_billdescription, bd.displaymessage AS bd_displaymessage," - + " bd.minimumamount AS bd_minimumamount, bd.totalamount AS bd_totalamount, bd.callbackforapportioning" - + " AS bd_callbackforapportioning,bd.expirydate AS bd_expirydate, bd.partpaymentallowed AS bd" - + "_partpaymentallowed, bd.isadvanceallowed as bd_isadvanceallowed,bd.collectionmodesnotallowed AS" - + " bd_collectionmodesnotallowed, ad.id AS ad_id, ad.tenantid AS ad_tenantid, ad.billdetail AS ad_billdetail," - + " ad.glcode AS ad_glcode, ad.orderno AS ad_orderno, ad.accountdescription AS ad_accountdescription," - + " ad.amount AS ad_amount, ad.adjustedamount AS ad_adjustedamount, ad.taxheadcode AS ad_taxheadcode," - + " ad.demanddetailid, ad.isactualdemand AS ad_isactualdemand, ad.purpose AS ad_purpose, b.additionaldetails" - + " as b_additionaldetails, bd.additionaldetails as bd_additionaldetails FROM egbs_bill_v1 b LEFT OUTER" - + " JOIN egbs_billdetail_v1 bd ON b.id = bd.billid AND b.tenantid = bd.tenantid LEFT OUTER JOIN" - + " egbs_billaccountdetail_v1 ad ON bd.id = ad.billdetail AND bd.tenantid = ad.tenantid WHERE b.tenantid" - + " = ? AND b.status != ? AND b.payeremail = ? AND b.mobileNumber = ? AND bd.businessservice = ? AND" - + " bd.fromperiod = ? AND bd.toperiod = ? AND bd.billno = ?) SELECT * FROM billresult INNER JOIN (SELECT" - + " bd_consumercode, min(b_createddate) as mindate FROM billresult GROUP BY bd_consumercode) as uniqbill" - + " ON uniqbill.bd_consumercode=billresult.bd_consumercode AND uniqbill.mindate=billresult.b_createddate" - + " ORDER BY billresult.bd_consumercode ", billQueryBuilder.getBillQuery(billSearchCriteria, objectList)); - assertEquals(8, objectList.size()); - } - - - @Test - void testGetMinBillQueryWithAdd() { - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add(BillQueryBuilder.BILL_BASE_QUERY); - BillSearchCriteria billSearchCriteria = new BillSearchCriteria("42", stringSet, 1L, 1L, true, true, true, - new HashSet<>(), "42", BillQueryBuilder.BILL_BASE_QUERY, true, 3L, 1L, "jane.doe@example.org", - BillV2.BillStatus.ACTIVE, "42"); - - ArrayList objectList = new ArrayList<>(); - assertEquals("WITH billresult AS (SELECT b.id AS b_id,b.mobilenumber, b.tenantid AS b_tenantid, b.payername AS" - + " b_payername, b.payeraddress AS b_payeraddress, b.payeremail AS b_payeremail,b.filestoreid AS" - + " b_fileStoreId, b.isactive AS b_isactive, b.iscancelled AS b_iscancelled, b.createdby AS b_createdby," - + " b.status as b_status, b.createddate AS b_createddate, b.lastmodifiedby AS b_lastmodifiedby," - + " b.lastmodifieddate AS b_lastmodifieddate, bd.id AS bd_id, bd.billid AS bd_billid, bd.tenantid AS" - + " bd_tenantid,bd.businessservice AS bd_businessservice, bd.demandid,bd.fromperiod,bd.toperiod, bd.billno" - + " AS bd_billno, bd.billdate AS bd_billdate, bd.consumercode AS bd_consumercode,bd.consumertype AS" - + " bd_consumertype, bd.billdescription AS bd_billdescription, bd.displaymessage AS bd_displaymessage," - + " bd.minimumamount AS bd_minimumamount, bd.totalamount AS bd_totalamount, bd.callbackforapportioning" - + " AS bd_callbackforapportioning,bd.expirydate AS bd_expirydate, bd.partpaymentallowed AS bd_partpaymentallowed" - + ", bd.isadvanceallowed as bd_isadvanceallowed,bd.collectionmodesnotallowed AS bd_collectionmodesnotallowed," - + " ad.id AS ad_id, ad.tenantid AS ad_tenantid, ad.billdetail AS ad_billdetail, ad.glcode AS ad_glcode," - + " ad.orderno AS ad_orderno, ad.accountdescription AS ad_accountdescription, ad.amount AS ad_amount," - + " ad.adjustedamount AS ad_adjustedamount, ad.taxheadcode AS ad_taxheadcode, ad.demanddetailid," - + " ad.isactualdemand AS ad_isactualdemand, ad.purpose AS ad_purpose, b.additionaldetails as b_additionaldetails" - + ", bd.additionaldetails as bd_additionaldetails FROM egbs_bill_v1 b LEFT OUTER JOIN egbs_billdetail_v1" - + " bd ON b.id = bd.billid AND b.tenantid = bd.tenantid LEFT OUTER JOIN egbs_billaccountdetail_v1 ad ON" - + " bd.id = ad.billdetail AND bd.tenantid = ad.tenantid WHERE b.tenantid LIKE ? AND b.id in ( ?) AND" - + " b.status != ? AND b.payeremail = ? AND b.mobileNumber = ? AND bd.businessservice = ? AND bd.fromperiod" - + " = ? AND bd.toperiod = ? AND bd.billno = ?) SELECT * FROM billresult INNER JOIN (SELECT bd_consumercode," - + " min(b_createddate) as mindate FROM billresult GROUP BY bd_consumercode) as uniqbill ON uniqbill.bd" - + "_consumercode=billresult.bd_consumercode AND uniqbill.mindate=billresult.b_createddate ORDER BY" - + " billresult.bd_consumercode ", billQueryBuilder.getBillQuery(billSearchCriteria, objectList)); - assertEquals(9, objectList.size()); - } - - - @Test - void testGetMinBillWithAdd() { - - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - stringSet.add(BillQueryBuilder.BILL_BASE_QUERY); - BillSearchCriteria billSearchCriteria = new BillSearchCriteria("42", stringSet, 1L, 1L, true, true, true, - new HashSet<>(), "42", BillQueryBuilder.BILL_BASE_QUERY, true, 3L, 1L, "jane.doe@example.org", - BillV2.BillStatus.ACTIVE, "42"); - - ArrayList objectList = new ArrayList<>(); - assertEquals("WITH billresult AS (SELECT b.id AS b_id,b.mobilenumber, b.tenantid AS b_tenantid, b.payername AS" - + " b_payername, b.payeraddress AS b_payeraddress, b.payeremail AS b_payeremail,b.filestoreid AS" - + " b_fileStoreId, b.isactive AS b_isactive, b.iscancelled AS b_iscancelled, b.createdby AS b_createdby," - + " b.status as b_status, b.createddate AS b_createddate, b.lastmodifiedby AS b_lastmodifiedby," - + " b.lastmodifieddate AS b_lastmodifieddate, bd.id AS bd_id, bd.billid AS bd_billid, bd.tenantid AS" - + " bd_tenantid,bd.businessservice AS bd_businessservice, bd.demandid,bd.fromperiod,bd.toperiod, bd.billno" - + " AS bd_billno, bd.billdate AS bd_billdate, bd.consumercode AS bd_consumercode,bd.consumertype AS" - + " bd_consumertype, bd.billdescription AS bd_billdescription, bd.displaymessage AS bd_displaymessage," - + " bd.minimumamount AS bd_minimumamount, bd.totalamount AS bd_totalamount, bd.callbackforapportioning" - + " AS bd_callbackforapportioning,bd.expirydate AS bd_expirydate, bd.partpaymentallowed AS bd_partpaymentallowed" - + ", bd.isadvanceallowed as bd_isadvanceallowed,bd.collectionmodesnotallowed AS bd_collectionmodesnotallowed," - + " ad.id AS ad_id, ad.tenantid AS ad_tenantid, ad.billdetail AS ad_billdetail, ad.glcode AS ad_glcode," - + " ad.orderno AS ad_orderno, ad.accountdescription AS ad_accountdescription, ad.amount AS ad_amount," - + " ad.adjustedamount AS ad_adjustedamount, ad.taxheadcode AS ad_taxheadcode, ad.demanddetailid," - + " ad.isactualdemand AS ad_isactualdemand, ad.purpose AS ad_purpose, b.additionaldetails as b_additionaldetails" - + ", bd.additionaldetails as bd_additionaldetails FROM egbs_bill_v1 b LEFT OUTER JOIN egbs_billdetail_v1" - + " bd ON b.id = bd.billid AND b.tenantid = bd.tenantid LEFT OUTER JOIN egbs_billaccountdetail_v1 ad ON" - + " bd.id = ad.billdetail AND bd.tenantid = ad.tenantid WHERE b.tenantid LIKE ? AND b.id in ( ?, ?) AND" - + " b.status != ? AND b.payeremail = ? AND b.mobileNumber = ? AND bd.businessservice = ? AND bd.fromperiod" - + " = ? AND bd.toperiod = ? AND bd.billno = ?) SELECT * FROM billresult INNER JOIN (SELECT bd_consumercode," - + " min(b_createddate) as mindate FROM billresult GROUP BY bd_consumercode) as uniqbill ON uniqbill.bd" - + "_consumercode=billresult.bd_consumercode AND uniqbill.mindate=billresult.b_createddate ORDER BY" - + " billresult.bd_consumercode ", billQueryBuilder.getBillQuery(billSearchCriteria, objectList)); - assertEquals(10, objectList.size()); - } - - - @Test - void testGetMAXBillQuery() { - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - HashSet billId = new HashSet<>(); - BillSearchCriteria billSearchCriteria = new BillSearchCriteria("42", billId, 1L, 1L, false, true, true, - new HashSet<>(), "42", BillQueryBuilder.BILL_BASE_QUERY, true, 3L, 1L, "jane.doe@example.org", - BillV2.BillStatus.ACTIVE, "42"); - ArrayList objectList = new ArrayList<>(); - assertEquals("WITH billresult AS (SELECT b.id AS b_id,b.mobilenumber, b.tenantid AS b_tenantid, b.payername AS" - + " b_payername, b.payeraddress AS b_payeraddress, b.payeremail AS b_payeremail,b.filestoreid AS" - + " b_fileStoreId, b.isactive AS b_isactive, b.iscancelled AS b_iscancelled, b.createdby AS b_createdby," - + " b.status as b_status, b.createddate AS b_createddate, b.lastmodifiedby AS b_lastmodifiedby," - + " b.lastmodifieddate AS b_lastmodifieddate, bd.id AS bd_id, bd.billid AS bd_billid, bd.tenantid AS" - + " bd_tenantid,bd.businessservice AS bd_businessservice, bd.demandid,bd.fromperiod,bd.toperiod, bd.billno" - + " AS bd_billno, bd.billdate AS bd_billdate, bd.consumercode AS bd_consumercode,bd.consumertype AS" - + " bd_consumertype, bd.billdescription AS bd_billdescription, bd.displaymessage AS bd_displaymessage," - + " bd.minimumamount AS bd_minimumamount, bd.totalamount AS bd_totalamount, bd.callbackforapportioning" - + " AS bd_callbackforapportioning,bd.expirydate AS bd_expirydate, bd.partpaymentallowed AS bd" - + "_partpaymentallowed, bd.isadvanceallowed as bd_isadvanceallowed,bd.collectionmodesnotallowed AS" - + " bd_collectionmodesnotallowed, ad.id AS ad_id, ad.tenantid AS ad_tenantid, ad.billdetail AS ad_billdetail," - + " ad.glcode AS ad_glcode, ad.orderno AS ad_orderno, ad.accountdescription AS ad_accountdescription," - + " ad.amount AS ad_amount, ad.adjustedamount AS ad_adjustedamount, ad.taxheadcode AS ad_taxheadcode," - + " ad.demanddetailid, ad.isactualdemand AS ad_isactualdemand, ad.purpose AS ad_purpose, b.additionaldetails" - + " as b_additionaldetails, bd.additionaldetails as bd_additionaldetails FROM egbs_bill_v1 b LEFT OUTER" - + " JOIN egbs_billdetail_v1 bd ON b.id = bd.billid AND b.tenantid = bd.tenantid LEFT OUTER JOIN" - + " egbs_billaccountdetail_v1 ad ON bd.id = ad.billdetail AND bd.tenantid = ad.tenantid WHERE b.tenantid" - + " LIKE ? AND b.status = ? AND b.payeremail = ? AND b.mobileNumber = ? AND bd.businessservice = ? AND" - + " bd.fromperiod = ? AND bd.toperiod = ? AND bd.billno = ?) SELECT * FROM billresult INNER JOIN (SELECT" - + " bd_consumercode, max(b_createddate) as maxdate FROM billresult GROUP BY bd_consumercode) as uniqbill" - + " ON uniqbill.bd_consumercode=billresult.bd_consumercode AND uniqbill.maxdate=billresult.b_createddate" - + " ORDER BY billresult.bd_consumercode ", billQueryBuilder.getBillQuery(billSearchCriteria, objectList)); - assertEquals(8, objectList.size()); - } - - - @Test - void testGetMINBillQuery() { - - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - - HashSet stringSet = new HashSet<>(); - stringSet.add(BillQueryBuilder.BILL_BASE_QUERY); - BillSearchCriteria billSearchCriteria = new BillSearchCriteria("42", new HashSet<>(), 1L, 1L, true, true, true, - stringSet, "42", BillQueryBuilder.BILL_BASE_QUERY, true, 3L, 1L, "jane.doe@example.org", - BillV2.BillStatus.ACTIVE, "42"); - - ArrayList objectList = new ArrayList<>(); - assertEquals("WITH billresult AS (SELECT b.id AS b_id,b.mobilenumber, b.tenantid AS b_tenantid, b.payername AS" - + " b_payername, b.payeraddress AS b_payeraddress, b.payeremail AS b_payeremail,b.filestoreid AS" - + " b_fileStoreId, b.isactive AS b_isactive, b.iscancelled AS b_iscancelled, b.createdby AS b_createdby," - + " b.status as b_status, b.createddate AS b_createddate, b.lastmodifiedby AS b_lastmodifiedby," - + " b.lastmodifieddate AS b_lastmodifieddate, bd.id AS bd_id, bd.billid AS bd_billid, bd.tenantid AS" - + " bd_tenantid,bd.businessservice AS bd_businessservice, bd.demandid,bd.fromperiod,bd.toperiod, bd.billno" - + " AS bd_billno, bd.billdate AS bd_billdate, bd.consumercode AS bd_consumercode,bd.consumertype AS" - + " bd_consumertype, bd.billdescription AS bd_billdescription, bd.displaymessage AS bd_displaymessage," - + " bd.minimumamount AS bd_minimumamount, bd.totalamount AS bd_totalamount, bd.callbackforapportioning" - + " AS bd_callbackforapportioning,bd.expirydate AS bd_expirydate, bd.partpaymentallowed AS bd_partpaymentallowed" - + ", bd.isadvanceallowed as bd_isadvanceallowed,bd.collectionmodesnotallowed AS bd_collectionmodesnotallowed," - + " ad.id AS ad_id, ad.tenantid AS ad_tenantid, ad.billdetail AS ad_billdetail, ad.glcode AS ad_glcode," - + " ad.orderno AS ad_orderno, ad.accountdescription AS ad_accountdescription, ad.amount AS ad_amount," - + " ad.adjustedamount AS ad_adjustedamount, ad.taxheadcode AS ad_taxheadcode, ad.demanddetailid," - + " ad.isactualdemand AS ad_isactualdemand, ad.purpose AS ad_purpose, b.additionaldetails as b_additionaldetails" - + ", bd.additionaldetails as bd_additionaldetails FROM egbs_bill_v1 b LEFT OUTER JOIN egbs_billdetail_v1" - + " bd ON b.id = bd.billid AND b.tenantid = bd.tenantid LEFT OUTER JOIN egbs_billaccountdetail_v1 ad ON" - + " bd.id = ad.billdetail AND bd.tenantid = ad.tenantid WHERE b.tenantid LIKE ? AND b.status != ? AND" - + " b.payeremail = ? AND b.mobileNumber = ? AND bd.businessservice = ? AND bd.fromperiod = ? AND bd.toperiod" - + " = ? AND bd.billno = ? AND bd.consumercode IN ( ?)) SELECT * FROM billresult INNER JOIN (SELECT" - + " bd_consumercode, min(b_createddate) as mindate FROM billresult GROUP BY bd_consumercode) as uniqbill" - + " ON uniqbill.bd_consumercode=billresult.bd_consumercode AND uniqbill.mindate=billresult.b_createddate" - + " ORDER BY billresult.bd_consumercode ", billQueryBuilder.getBillQuery(billSearchCriteria, objectList)); - assertEquals(9, objectList.size()); - } - - - - - @Test - void testGetBillStatusUpdateQueryWithBillStatusActive() { - - - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - - UpdateBillCriteria updateBillCriteria = new UpdateBillCriteria(); - updateBillCriteria.setStatusToBeUpdated(BillV2.BillStatus.ACTIVE); - ArrayList objectList = new ArrayList<>(); - assertEquals("UPDATE egbs_bill_v1 SET status=? WHERE status='ACTIVE' AND tenantId = ? ", - billQueryBuilder.getBillStatusUpdateQuery(updateBillCriteria, objectList)); - assertEquals(2, objectList.size()); - } - - - @Test - void testGetBillStatusUpdateQueryWithBillStatusCancelled() { - - - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - - UpdateBillCriteria updateBillCriteria = new UpdateBillCriteria(); - updateBillCriteria.setStatusToBeUpdated(BillV2.BillStatus.CANCELLED); - ArrayList objectList = new ArrayList<>(); - assertEquals("UPDATE egbs_bill_v1 SET status=? WHERE status='ACTIVE' AND tenantId = ? ", - billQueryBuilder.getBillStatusUpdateQuery(updateBillCriteria, objectList)); - assertEquals(2, objectList.size()); - } - - /* @Test - - void testGetBillStatusUpdateQuery5() { - - - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - HashSet consumerCodes = new HashSet<>(); - MissingNode additionalDetails = MissingNode.getInstance(); - - UpdateBillCriteria updateBillCriteria = new UpdateBillCriteria("42", consumerCodes, ", additionaldetails = ?", - additionalDetails, new HashSet<>(), BillV2.BillStatus.ACTIVE); - updateBillCriteria.setStatusToBeUpdated(BillV2.BillStatus.CANCELLED); - billQueryBuilder.getBillStatusUpdateQuery(updateBillCriteria, new ArrayList<>()); - }*/ - - - @Test - void testGetBillStatusUpdateQueryWithIdStatusActive() { - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - HashSet consumerCodes = new HashSet<>(); - UpdateBillCriteria updateBillCriteria = new UpdateBillCriteria("42", consumerCodes, ", additionaldetails = ?", - MissingNode.getInstance(), stringSet, BillV2.BillStatus.ACTIVE); - - assertEquals("UPDATE egbs_bill_v1 SET status=? WHERE status='ACTIVE' AND tenantId = ? AND id IN ( ?)", - billQueryBuilder.getBillStatusUpdateQuery(updateBillCriteria, new ArrayList<>())); - } - - - @Test - void testGetBillStatusUpdateQueryUpdateAdditionalDetails() { - - BillQueryBuilder billQueryBuilder = new BillQueryBuilder(); - - HashSet stringSet = new HashSet<>(); - stringSet.add(", additionaldetails = ?"); - stringSet.add("foo"); - HashSet consumerCodes = new HashSet<>(); - UpdateBillCriteria updateBillCriteria = new UpdateBillCriteria("42", consumerCodes, ", additionaldetails = ?", - MissingNode.getInstance(), stringSet, BillV2.BillStatus.ACTIVE); - - assertEquals("UPDATE egbs_bill_v1 SET status=? WHERE status='ACTIVE' AND tenantId = ? AND id IN ( ?, ?)", - billQueryBuilder.getBillStatusUpdateQuery(updateBillCriteria, new ArrayList<>())); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/BusinessServDetailQueryBuilderTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/BusinessServDetailQueryBuilderTest.java deleted file mode 100644 index 3e74104e5cd..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/BusinessServDetailQueryBuilderTest.java +++ /dev/null @@ -1,280 +0,0 @@ -package org.egov.demand.repository.querybuilder; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashSet; - -import org.egov.demand.model.AuditDetail; - -import org.egov.demand.model.BusinessServiceDetail; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.junit.jupiter.api.Disabled; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {BusinessServDetailQueryBuilder.class}) -@ExtendWith(SpringExtension.class) -class BusinessServDetailQueryBuilderTest { - @Autowired - private BusinessServDetailQueryBuilder businessServDetailQueryBuilder; - - - @Test - void testPrepareSearchQuery() { - BusinessServiceDetailCriteria businessServiceDetailCriteria = new BusinessServiceDetailCriteria(); - assertEquals("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice WHERE ", - this.businessServDetailQueryBuilder.prepareSearchQuery(businessServiceDetailCriteria, new ArrayList<>())); - } - - - - @Test - void testPrepareSearchQueryWithSingleID() { - HashSet businessService = new HashSet<>(); - BusinessServiceDetailCriteria businessServiceDetailCriteria = new BusinessServiceDetailCriteria("42", - businessService, new HashSet<>()); - ArrayList objectList = new ArrayList<>(); - assertEquals("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice WHERE businessservice.tenantId = ? ", - this.businessServDetailQueryBuilder.prepareSearchQuery(businessServiceDetailCriteria, objectList)); - assertEquals(1, objectList.size()); - } - - - @Test - void testPrepareSearchQueryWithTenantID() { - BusinessServiceDetailCriteria businessServiceDetailCriteria = mock(BusinessServiceDetailCriteria.class); - when(businessServiceDetailCriteria.getTenantId()).thenReturn("42"); - when(businessServiceDetailCriteria.getBusinessService()).thenReturn(new HashSet<>()); - when(businessServiceDetailCriteria.getId()).thenReturn(new HashSet<>()); - ArrayList objectList = new ArrayList<>(); - assertEquals("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice WHERE businessservice.tenantId = ? ", - this.businessServDetailQueryBuilder.prepareSearchQuery(businessServiceDetailCriteria, objectList)); - verify(businessServiceDetailCriteria, atLeast(1)).getTenantId(); - verify(businessServiceDetailCriteria).getBusinessService(); - verify(businessServiceDetailCriteria, atLeast(1)).getId(); - assertEquals(1, objectList.size()); - } - - - @Test - void testPrepareSearchQueryWithEmptyTenantId() { - BusinessServiceDetailCriteria businessServiceDetailCriteria = mock(BusinessServiceDetailCriteria.class); - when(businessServiceDetailCriteria.getTenantId()).thenReturn(" WHERE "); - when(businessServiceDetailCriteria.getBusinessService()).thenReturn(new HashSet<>()); - when(businessServiceDetailCriteria.getId()).thenReturn(new HashSet<>()); - ArrayList objectList = new ArrayList<>(); - assertEquals("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice WHERE businessservice.tenantId = ? ", - this.businessServDetailQueryBuilder.prepareSearchQuery(businessServiceDetailCriteria, objectList)); - verify(businessServiceDetailCriteria, atLeast(1)).getTenantId(); - verify(businessServiceDetailCriteria).getBusinessService(); - verify(businessServiceDetailCriteria, atLeast(1)).getId(); - assertEquals(1, objectList.size()); - } - - @Test - void testPrepareSearchQueryWithNullTenantId() { - BusinessServiceDetailCriteria businessServiceDetailCriteria = mock(BusinessServiceDetailCriteria.class); - when(businessServiceDetailCriteria.getTenantId()).thenReturn(""); - when(businessServiceDetailCriteria.getBusinessService()).thenReturn(new HashSet<>()); - when(businessServiceDetailCriteria.getId()).thenReturn(new HashSet<>()); - assertEquals("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice WHERE ", - this.businessServDetailQueryBuilder.prepareSearchQuery(businessServiceDetailCriteria, new ArrayList<>())); - verify(businessServiceDetailCriteria).getTenantId(); - verify(businessServiceDetailCriteria).getBusinessService(); - verify(businessServiceDetailCriteria, atLeast(1)).getId(); - } - - @Test - void testPrepareSearchQueryWithGetBusinessServiceAsSting() { - HashSet stringSet = new HashSet<>(); - stringSet.add("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice "); - BusinessServiceDetailCriteria businessServiceDetailCriteria = mock(BusinessServiceDetailCriteria.class); - when(businessServiceDetailCriteria.getTenantId()).thenReturn("42"); - when(businessServiceDetailCriteria.getBusinessService()).thenReturn(stringSet); - when(businessServiceDetailCriteria.getId()).thenReturn(new HashSet<>()); - ArrayList objectList = new ArrayList<>(); - assertEquals("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice WHERE businessservice.tenantId = ?" - + " and businessservice.businessservice IN ('SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice" - + " ')", this.businessServDetailQueryBuilder.prepareSearchQuery(businessServiceDetailCriteria, objectList)); - verify(businessServiceDetailCriteria, atLeast(1)).getTenantId(); - verify(businessServiceDetailCriteria, atLeast(1)).getBusinessService(); - verify(businessServiceDetailCriteria, atLeast(1)).getId(); - assertEquals(1, objectList.size()); - } - - - @Test - void testPrepareSearchQueryMapBusinessService() { - HashSet stringSet = new HashSet<>(); - stringSet.add("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice "); - BusinessServiceDetailCriteria businessServiceDetailCriteria = mock(BusinessServiceDetailCriteria.class); - when(businessServiceDetailCriteria.getTenantId()).thenReturn("42"); - when(businessServiceDetailCriteria.getBusinessService()).thenReturn(new HashSet<>()); - when(businessServiceDetailCriteria.getId()).thenReturn(stringSet); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice WHERE businessservice.tenantId = ? and" - + " businessservice.id IN ('SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice ')", - this.businessServDetailQueryBuilder.prepareSearchQuery(businessServiceDetailCriteria, objectList)); - verify(businessServiceDetailCriteria, atLeast(1)).getTenantId(); - verify(businessServiceDetailCriteria).getBusinessService(); - verify(businessServiceDetailCriteria, atLeast(1)).getId(); - assertEquals(1, objectList.size()); - } - - - @Test - void testPrepareSearchQueryAddStringToBusinessService() { - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - stringSet.add("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice "); - stringSet.add("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice "); - BusinessServiceDetailCriteria businessServiceDetailCriteria = mock(BusinessServiceDetailCriteria.class); - when(businessServiceDetailCriteria.getTenantId()).thenReturn("42"); - when(businessServiceDetailCriteria.getBusinessService()).thenReturn(stringSet); - when(businessServiceDetailCriteria.getId()).thenReturn(new HashSet<>()); - ArrayList objectList = new ArrayList<>(); - assertEquals("SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice WHERE businessservice.tenantId = ? and" - + " businessservice.businessservice IN ('foo','SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice" - + " ')", this.businessServDetailQueryBuilder.prepareSearchQuery(businessServiceDetailCriteria, objectList)); - verify(businessServiceDetailCriteria, atLeast(1)).getTenantId(); - verify(businessServiceDetailCriteria, atLeast(1)).getBusinessService(); - verify(businessServiceDetailCriteria, atLeast(1)).getId(); - assertEquals(1, objectList.size()); - } - - - @Test - void testPrepareQueryForValidation() { - assertEquals("select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where )", - this.businessServDetailQueryBuilder.prepareQueryForValidation(new ArrayList<>(), "Mode")); - } - - - @Test - void testPrepareQueryForValidationWithSingleServiceDetailsadd() { - ArrayList businessServiceDetailList = new ArrayList<>(); - businessServiceDetailList.add(new BusinessServiceDetail()); - assertEquals("select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where ( )", - this.businessServDetailQueryBuilder.prepareQueryForValidation(businessServiceDetailList, "Mode")); - } - - @Test - void testPrepareQueryForValidationWithMultipleServiceDetailAdd() { - ArrayList businessServiceDetailList = new ArrayList<>(); - businessServiceDetailList.add(new BusinessServiceDetail()); - businessServiceDetailList.add(new BusinessServiceDetail()); - assertEquals("select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where ( or ( )", - this.businessServDetailQueryBuilder.prepareQueryForValidation(businessServiceDetailList, "Mode")); - } - - @Test - void testPrepareQueryForValidationWithCollectionModeNotAllowed() { - ArrayList businessServiceDetailList = new ArrayList<>(); - ArrayList collectionModesNotAllowed = new ArrayList<>(); - businessServiceDetailList.add(new BusinessServiceDetail("42", "42", - "select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where ", - "select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where ", collectionModesNotAllowed, - true, true, true, 1L, true, "https://example.org/example", new AuditDetail())); - assertEquals( - "select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where ( businessservice" - + ".businessservice = 'select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where" - + " ' and businessservice.tenantId = '42') )", - this.businessServDetailQueryBuilder.prepareQueryForValidation(businessServiceDetailList, "Mode")); - } - - @Test - void testPrepareQueryForValidationGetBusinessService() { - BusinessServiceDetail businessServiceDetail = mock(BusinessServiceDetail.class); - when(businessServiceDetail.getBusinessService()).thenReturn("Business Service"); - when(businessServiceDetail.getTenantId()).thenReturn("42"); - - ArrayList businessServiceDetailList = new ArrayList<>(); - businessServiceDetailList.add(businessServiceDetail); - assertEquals( - "select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where ( businessservice" - + ".businessservice = 'Business Service' and businessservice.tenantId = '42') )", - this.businessServDetailQueryBuilder.prepareQueryForValidation(businessServiceDetailList, "Mode")); - verify(businessServiceDetail, atLeast(1)).getBusinessService(); - verify(businessServiceDetail, atLeast(1)).getTenantId(); - } - - - @Test - void testPrepareQueryForValidationGetBusinessServiceDetails() { - BusinessServiceDetail businessServiceDetail = mock(BusinessServiceDetail.class); - when(businessServiceDetail.getBusinessService()).thenReturn(" ( "); - when(businessServiceDetail.getTenantId()).thenReturn("42"); - - ArrayList businessServiceDetailList = new ArrayList<>(); - businessServiceDetailList.add(businessServiceDetail); - assertEquals( - "select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where ( businessservice" - + ".businessservice = ' ( ' and businessservice.tenantId = '42') )", - this.businessServDetailQueryBuilder.prepareQueryForValidation(businessServiceDetailList, "Mode")); - verify(businessServiceDetail, atLeast(1)).getBusinessService(); - verify(businessServiceDetail, atLeast(1)).getTenantId(); - } - - @Test - void testPrepareQueryForValidationIsNotBlank() { - BusinessServiceDetail businessServiceDetail = mock(BusinessServiceDetail.class); - when(businessServiceDetail.getBusinessService()).thenReturn(""); - when(businessServiceDetail.getTenantId()).thenReturn("42"); - - ArrayList businessServiceDetailList = new ArrayList<>(); - businessServiceDetailList.add(businessServiceDetail); - assertEquals( - "select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where ( businessservice.tenantId" - + " = '42') )", - this.businessServDetailQueryBuilder.prepareQueryForValidation(businessServiceDetailList, "Mode")); - verify(businessServiceDetail).getBusinessService(); - verify(businessServiceDetail, atLeast(1)).getTenantId(); - } - - - @Test - void testPrepareQueryForValidationGetTenantID() { - BusinessServiceDetail businessServiceDetail = mock(BusinessServiceDetail.class); - when(businessServiceDetail.getId()).thenReturn("42"); - when(businessServiceDetail.getBusinessService()).thenReturn("Business Service"); - when(businessServiceDetail.getTenantId()).thenReturn("42"); - - ArrayList businessServiceDetailList = new ArrayList<>(); - businessServiceDetailList.add(businessServiceDetail); - assertEquals( - "select exists (SELECT * FROM EGBS_BUSINESS_SERVICE_DETAILS businessservice where ( businessservice" - + ".businessservice = 'Business Service' and businessservice.id != '42' and businessservice.tenantId" - + " = '42') )", - this.businessServDetailQueryBuilder.prepareQueryForValidation(businessServiceDetailList, "edit")); - verify(businessServiceDetail, atLeast(1)).getBusinessService(); - verify(businessServiceDetail).getId(); - verify(businessServiceDetail, atLeast(1)).getTenantId(); - } - - - @Test - void testConstructor() { - BusinessServDetailQueryBuilder actualBusinessServDetailQueryBuilder = new BusinessServDetailQueryBuilder(); - assertEquals( - "INSERT INTO EGBS_BUSINESS_SERVICE_DETAILS(id,businessservice,collectionModesNotAllowed,partPaymentAllowed" - + ",callBackForApportioning,callBackApportionURL,createddate,lastmodifieddate,createdby,lastmodifiedby,tenantid)" - + " values (?,?,?,?,?,?,?,?,?,?,?);", - actualBusinessServDetailQueryBuilder.getInsertQuery()); - assertEquals( - "UPDATE EGBS_BUSINESS_SERVICE_DETAILS SET businessservice = ?, collectionModesNotAllowed = ?," - + " partPaymentAllowed = ?, callBackForApportioning = ?, callBackApportionURL = ?, lastmodifieddate = ?," - + " lastmodifiedby = ? WHERE tenantid = ? and id = ?;", - actualBusinessServDetailQueryBuilder.getUpdateQuery()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/DemandQueryBuilderTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/DemandQueryBuilderTest.java deleted file mode 100644 index ef7de072c77..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/DemandQueryBuilderTest.java +++ /dev/null @@ -1,370 +0,0 @@ -package org.egov.demand.repository.querybuilder; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; - -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.enums.Type; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - - -class DemandQueryBuilderTest { - - @Test - void testGetDemandQueryForConsumerCodes() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashMap> businessConsumercodeMap = new HashMap<>(); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid=? AND dmd.status='ACTIVE' ", - actualDemandQueryBuilder.getDemandQueryForConsumerCodes(businessConsumercodeMap, objectList, "42")); - assertEquals(1, objectList.size()); - } - - - @Test - void testGetDemandQueryForConsumerCodes2() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashMap> stringSetMap = new HashMap<>(); - stringSetMap.put(DemandQueryBuilder.BASE_DEMAND_QUERY, new HashSet<>()); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid=? AND dmd.status='ACTIVE' ", - actualDemandQueryBuilder.getDemandQueryForConsumerCodes(stringSetMap, objectList, "42")); - assertEquals(1, objectList.size()); - } - - - @Test - void testGetDemandQueryForConsumerCodes3() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add(DemandQueryBuilder.BASE_DEMAND_QUERY); - - HashMap> stringSetMap = new HashMap<>(); - stringSetMap.put(DemandQueryBuilder.BASE_DEMAND_QUERY, stringSet); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid=? AND dmd.status='ACTIVE' AND dmd.businessservice='SELECT dmd.id AS" - + " did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice AS" - + " dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE ' AND dmd.consumercode IN ( ? )", - actualDemandQueryBuilder.getDemandQueryForConsumerCodes(stringSetMap, objectList, "42")); - assertEquals(2, objectList.size()); - } - - - @Test - void testGetDemandQueryForConsumerCodes4() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - stringSet.add(DemandQueryBuilder.BASE_DEMAND_QUERY); - - HashMap> stringSetMap = new HashMap<>(); - stringSetMap.put(DemandQueryBuilder.BASE_DEMAND_QUERY, stringSet); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid=? AND dmd.status='ACTIVE' AND dmd.businessservice='SELECT dmd.id AS" - + " did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice AS" - + " dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE ' AND dmd.consumercode IN ( ? , ? )", - actualDemandQueryBuilder.getDemandQueryForConsumerCodes(stringSetMap, objectList, "42")); - assertEquals(3, objectList.size()); - } - - - - - @Test - void testGetDemandQuery2() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashSet demandId = new HashSet<>(); - HashSet payer = new HashSet<>(); - HashSet consumerCode = new HashSet<>(); - BigDecimal demandFrom = BigDecimal.valueOf(42L); - DemandCriteria demandCriteria = new DemandCriteria("42", demandId, payer, consumerCode, - DemandQueryBuilder.BASE_DEMAND_QUERY, demandFrom, BigDecimal.valueOf(42L), 1L, 1L, Type.ARREARS, "42", - "jane.doe@example.org", DemandQueryBuilder.BASE_DEMAND_QUERY, true, true); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid LIKE ? AND dmd.status=? AND dmd.businessservice=? AND dmd.ispaymentcompleted" - + " = ? AND dmd.taxPeriodFrom >= ? AND dmd.taxPeriodTo <= ? ORDER BY dmd.taxperiodfrom", - actualDemandQueryBuilder.getDemandQuery(demandCriteria, objectList)); - assertEquals(6, objectList.size()); - } - - - - - @Test - void testGetDemandQuery4() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - DemandCriteria demandCriteria = new DemandCriteria(); - demandCriteria.setTenantId("42"); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid LIKE ? ORDER BY dmd.taxperiodfrom", - actualDemandQueryBuilder.getDemandQuery(demandCriteria, objectList)); - assertEquals(1, objectList.size()); - } - - - @Test - void testGetDemandQuery5() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashSet demandId = new HashSet<>(); - HashSet payer = new HashSet<>(); - HashSet consumerCode = new HashSet<>(); - BigDecimal demandFrom = BigDecimal.valueOf(42L); - DemandCriteria demandCriteria = new DemandCriteria(DemandQueryBuilder.BASE_DEMAND_QUERY, demandId, payer, - consumerCode, DemandQueryBuilder.BASE_DEMAND_QUERY, demandFrom, BigDecimal.valueOf(42L), 1L, 1L, Type.ARREARS, - "42", "jane.doe@example.org", DemandQueryBuilder.BASE_DEMAND_QUERY, true, true); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid = ? AND dmd.status=? AND dmd.businessservice=? AND dmd.ispaymentcompleted" - + " = ? AND dmd.taxPeriodFrom >= ? AND dmd.taxPeriodTo <= ? ORDER BY dmd.taxperiodfrom", - actualDemandQueryBuilder.getDemandQuery(demandCriteria, objectList)); - assertEquals(6, objectList.size()); - } - - @Test - void testGetDemandQuery6() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add(DemandQueryBuilder.BASE_DEMAND_QUERY); - HashSet payer = new HashSet<>(); - HashSet consumerCode = new HashSet<>(); - BigDecimal demandFrom = BigDecimal.valueOf(42L); - DemandCriteria demandCriteria = new DemandCriteria("42", stringSet, payer, consumerCode, - DemandQueryBuilder.BASE_DEMAND_QUERY, demandFrom, BigDecimal.valueOf(42L), 1L, 1L, Type.ARREARS, "42", - "jane.doe@example.org", DemandQueryBuilder.BASE_DEMAND_QUERY, true, true); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid LIKE ? AND dmd.status=? AND dmd.id IN ( ? ) AND dmd.businessservice=?" - + " AND dmd.ispaymentcompleted = ? AND dmd.taxPeriodFrom >= ? AND dmd.taxPeriodTo <= ? ORDER BY" - + " dmd.taxperiodfrom", - actualDemandQueryBuilder.getDemandQuery(demandCriteria, objectList)); - assertEquals(7, objectList.size()); - } - - - @Test - void testGetDemandQuery7() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - stringSet.add(DemandQueryBuilder.BASE_DEMAND_QUERY); - HashSet payer = new HashSet<>(); - HashSet consumerCode = new HashSet<>(); - BigDecimal demandFrom = BigDecimal.valueOf(42L); - DemandCriteria demandCriteria = new DemandCriteria("42", stringSet, payer, consumerCode, - DemandQueryBuilder.BASE_DEMAND_QUERY, demandFrom, BigDecimal.valueOf(42L), 1L, 1L, Type.ARREARS, "42", - "jane.doe@example.org", DemandQueryBuilder.BASE_DEMAND_QUERY, true, true); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid LIKE ? AND dmd.status=? AND dmd.id IN ( ? , ? ) AND dmd.businessservice=?" - + " AND dmd.ispaymentcompleted = ? AND dmd.taxPeriodFrom >= ? AND dmd.taxPeriodTo <= ? ORDER BY" - + " dmd.taxperiodfrom", - actualDemandQueryBuilder.getDemandQuery(demandCriteria, objectList)); - assertEquals(8, objectList.size()); - } - - - @Test - void testGetDemandQuery8() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add(DemandQueryBuilder.BASE_DEMAND_QUERY); - HashSet demandId = new HashSet<>(); - HashSet consumerCode = new HashSet<>(); - BigDecimal demandFrom = BigDecimal.valueOf(42L); - DemandCriteria demandCriteria = new DemandCriteria("42", demandId, stringSet, consumerCode, - DemandQueryBuilder.BASE_DEMAND_QUERY, demandFrom, BigDecimal.valueOf(42L), 1L, 1L, Type.ARREARS, "42", - "jane.doe@example.org", DemandQueryBuilder.BASE_DEMAND_QUERY, true, true); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid LIKE ? AND dmd.status=? AND dmd.payer IN ( ? ) AND dmd.businessservice=?" - + " AND dmd.ispaymentcompleted = ? AND dmd.taxPeriodFrom >= ? AND dmd.taxPeriodTo <= ? ORDER BY" - + " dmd.taxperiodfrom", - actualDemandQueryBuilder.getDemandQuery(demandCriteria, objectList)); - assertEquals(7, objectList.size()); - } - - - @Test - void testGetDemandQuery9() { - DemandQueryBuilder actualDemandQueryBuilder = new DemandQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add(DemandQueryBuilder.BASE_DEMAND_QUERY); - HashSet demandId = new HashSet<>(); - HashSet payer = new HashSet<>(); - BigDecimal demandFrom = BigDecimal.valueOf(42L); - DemandCriteria demandCriteria = new DemandCriteria("42", demandId, payer, stringSet, - DemandQueryBuilder.BASE_DEMAND_QUERY, demandFrom, BigDecimal.valueOf(42L), 1L, 1L, Type.ARREARS, "42", - "jane.doe@example.org", DemandQueryBuilder.BASE_DEMAND_QUERY, true, true); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT dmd.id AS did,dmd.consumercode AS dconsumercode,dmd.consumertype AS dconsumertype,dmd.businessservice" - + " AS dbusinessservice,dmd.payer,dmd.billexpirytime AS dbillexpirytime, dmd.fixedBillExpiryDate as" - + " dfixedBillExpiryDate, dmd.taxperiodfrom AS dtaxperiodfrom,dmd.taxperiodto AS dtaxperiodto,dmd" - + ".minimumamountpayable AS dminimumamountpayable,dmd.createdby AS dcreatedby,dmd.lastmodifiedby AS" - + " dlastmodifiedby,dmd.createdtime AS dcreatedtime,dmd.lastmodifiedtime AS dlastmodifiedtime,dmd.tenantid" - + " AS dtenantid,dmd.status,dmd.additionaldetails as demandadditionaldetails,dmd.ispaymentcompleted as" - + " ispaymentcompleted,dmdl.id AS dlid,dmdl.demandid AS dldemandid,dmdl.taxheadcode AS dltaxheadcode,dmdl" - + ".taxamount AS dltaxamount,dmdl.collectionamount AS dlcollectionamount,dmdl.createdby AS dlcreatedby" - + ",dmdl.lastModifiedby AS dllastModifiedby,dmdl.createdtime AS dlcreatedtime,dmdl.lastModifiedtime AS" - + " dllastModifiedtime,dmdl.tenantid AS dltenantid,dmdl.additionaldetails as detailadditionaldetails FROM" - + " egbs_demand_v1 dmd INNER JOIN egbs_demanddetail_v1 dmdl ON dmd.id=dmdl.demandid AND dmd.tenantid=dmdl" - + ".tenantid WHERE dmd.tenantid LIKE ? AND dmd.status=? AND dmd.businessservice=? AND dmd.ispaymentcompleted" - + " = ? AND dmd.taxPeriodFrom >= ? AND dmd.taxPeriodTo <= ? AND dmd.consumercode IN ( ? ) ORDER BY" - + " dmd.taxperiodfrom", - actualDemandQueryBuilder.getDemandQuery(demandCriteria, objectList)); - assertEquals(7, objectList.size()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/TaxHeadMasterQueryBuilderTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/TaxHeadMasterQueryBuilderTest.java deleted file mode 100644 index 2b367f7cc47..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/TaxHeadMasterQueryBuilderTest.java +++ /dev/null @@ -1,332 +0,0 @@ -package org.egov.demand.repository.querybuilder; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.util.ArrayList; -import java.util.HashSet; - -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - - -class TaxHeadMasterQueryBuilderTest { - - @Test - void testGetQuery() { - TaxHeadMasterQueryBuilder actualTaxHeadMasterQueryBuilder = new TaxHeadMasterQueryBuilder(); - TaxHeadMasterCriteria searchTaxHead = new TaxHeadMasterCriteria(); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ORDER BY taxhead.validfrom,taxhead.code" - + " LIMIT ?", - actualTaxHeadMasterQueryBuilder.getQuery(searchTaxHead, objectList)); - assertEquals(1, objectList.size()); - } - - - @Test - void testGetQuery2() { - TaxHeadMasterQueryBuilder actualTaxHeadMasterQueryBuilder = new TaxHeadMasterQueryBuilder(); - TaxHeadMasterCriteria taxHeadMasterCriteria = new TaxHeadMasterCriteria(); - taxHeadMasterCriteria.setTenantId("42"); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ORDER BY taxhead.validfrom,taxhead.code" - + " LIMIT ?", - actualTaxHeadMasterQueryBuilder.getQuery(taxHeadMasterCriteria, objectList)); - assertEquals(1, objectList.size()); - } - - - @Test - void testGetQuery4() { - TaxHeadMasterQueryBuilder actualTaxHeadMasterQueryBuilder = new TaxHeadMasterQueryBuilder(); - HashSet code = new HashSet<>(); - TaxHeadMasterCriteria searchTaxHead = new TaxHeadMasterCriteria("42", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - code, true, true, new HashSet<>()); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? AND taxhead.service = ? AND" - + " taxhead.name like ? AND taxhead.category = ? AND taxhead.isActualDemand = ? AND taxhead.isDebit = ?" - + " ORDER BY taxhead.validfrom,taxhead.code LIMIT ?", - actualTaxHeadMasterQueryBuilder.getQuery(searchTaxHead, objectList)); - assertEquals(6, objectList.size()); - } - - - @Test - void testGetQuery5() { - TaxHeadMasterQueryBuilder actualTaxHeadMasterQueryBuilder = new TaxHeadMasterQueryBuilder(); - TaxHeadMasterCriteria taxHeadMasterCriteria = new TaxHeadMasterCriteria(); - taxHeadMasterCriteria.setService( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? "); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? AND taxhead.service = ? ORDER BY" - + " taxhead.validfrom,taxhead.code LIMIT ?", - actualTaxHeadMasterQueryBuilder.getQuery(taxHeadMasterCriteria, objectList)); - assertEquals(2, objectList.size()); - } - - @Test - void testGetQuery6() { - TaxHeadMasterQueryBuilder actualTaxHeadMasterQueryBuilder = new TaxHeadMasterQueryBuilder(); - TaxHeadMasterCriteria taxHeadMasterCriteria = new TaxHeadMasterCriteria(); - taxHeadMasterCriteria.setName( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? "); - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? AND taxhead.name like ? ORDER BY" - + " taxhead.validfrom,taxhead.code LIMIT ?", - actualTaxHeadMasterQueryBuilder.getQuery(taxHeadMasterCriteria, objectList)); - assertEquals(2, objectList.size()); - } - - - @Test - void testGetQuery7() { - TaxHeadMasterQueryBuilder actualTaxHeadMasterQueryBuilder = new TaxHeadMasterQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet - .add("SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? "); - TaxHeadMasterCriteria searchTaxHead = new TaxHeadMasterCriteria("42", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - stringSet, true, true, new HashSet<>()); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? AND taxhead.service = ? AND" - + " taxhead.name like ? AND taxhead.code IN ('SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS" - + " taxheadTenantid, taxhead.service taxheadService, taxhead.createdby AS taxcreatedby, taxhead.createdtime" - + " AS taxcreatedtime, taxhead.lAStmodifiedby AS taxlAStmodifiedby, taxhead.lAStmodifiedtime AS" - + " taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid AS glCodeTenantId,glcode.service AS" - + " glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime AS glcreatedtime, glcode.lastmodifiedby" - + " AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime FROM egbs_taxheadmaster taxhead" - + " LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead and taxhead.tenantid=glcode" - + ".tenantid WHERE taxhead.tenantId = ? ') AND taxhead.category = ? AND taxhead.isActualDemand = ? AND" - + " taxhead.isDebit = ? ORDER BY taxhead.validfrom,taxhead.code LIMIT ?", - actualTaxHeadMasterQueryBuilder.getQuery(searchTaxHead, objectList)); - assertEquals(6, objectList.size()); - } - - - @Test - void testGetQuery8() { - TaxHeadMasterQueryBuilder actualTaxHeadMasterQueryBuilder = new TaxHeadMasterQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - stringSet - .add("SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? "); - TaxHeadMasterCriteria searchTaxHead = new TaxHeadMasterCriteria("42", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - stringSet, true, true, new HashSet<>()); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? AND taxhead.service = ? AND" - + " taxhead.name like ? AND taxhead.code IN ('SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS" - + " taxheadTenantid, taxhead.service taxheadService, taxhead.createdby AS taxcreatedby, taxhead.createdtime" - + " AS taxcreatedtime, taxhead.lAStmodifiedby AS taxlAStmodifiedby, taxhead.lAStmodifiedtime AS" - + " taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid AS glCodeTenantId,glcode.service AS" - + " glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime AS glcreatedtime, glcode.lastmodifiedby" - + " AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime FROM egbs_taxheadmaster taxhead" - + " LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead and taxhead.tenantid=glcode" - + ".tenantid WHERE taxhead.tenantId = ? ','foo') AND taxhead.category = ? AND taxhead.isActualDemand =" - + " ? AND taxhead.isDebit = ? ORDER BY taxhead.validfrom,taxhead.code LIMIT ?", - actualTaxHeadMasterQueryBuilder.getQuery(searchTaxHead, objectList)); - assertEquals(6, objectList.size()); - } - - - @Test - void testGetQuery9() { - TaxHeadMasterQueryBuilder actualTaxHeadMasterQueryBuilder = new TaxHeadMasterQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet - .add("SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? "); - TaxHeadMasterCriteria searchTaxHead = new TaxHeadMasterCriteria("42", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? ", - new HashSet<>(), true, true, stringSet); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS taxheadTenantid, taxhead.service taxheadService," - + " taxhead.createdby AS taxcreatedby, taxhead.createdtime AS taxcreatedtime, taxhead.lAStmodifiedby AS" - + " taxlAStmodifiedby, taxhead.lAStmodifiedtime AS taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid" - + " AS glCodeTenantId,glcode.service AS glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime" - + " AS glcreatedtime, glcode.lastmodifiedby AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime" - + " FROM egbs_taxheadmaster taxhead LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead" - + " and taxhead.tenantid=glcode.tenantid WHERE taxhead.tenantId = ? AND taxhead.service = ? AND" - + " taxhead.name like ? AND taxhead.id IN ('SELECT *,taxhead.id AS taxheadId, taxhead.tenantid AS" - + " taxheadTenantid, taxhead.service taxheadService, taxhead.createdby AS taxcreatedby, taxhead.createdtime" - + " AS taxcreatedtime, taxhead.lAStmodifiedby AS taxlAStmodifiedby, taxhead.lAStmodifiedtime AS" - + " taxlAStmodifiedtime,glcode.id AS glCodeId, glcode.tenantid AS glCodeTenantId,glcode.service AS" - + " glCodeService, glcode.createdby AS glcreatedby, glcode.createdtime AS glcreatedtime, glcode.lastmodifiedby" - + " AS gllastmodifiedby, glcode.lastmodifiedtime AS gllastmodifiedtime FROM egbs_taxheadmaster taxhead" - + " LEFT OUTER Join egbs_glcodemaster glcode ON taxhead.code=glcode.taxhead and taxhead.tenantid=glcode" - + ".tenantid WHERE taxhead.tenantId = ? ') AND taxhead.category = ? AND taxhead.isActualDemand = ? AND" - + " taxhead.isDebit = ? ORDER BY taxhead.validfrom,taxhead.code LIMIT ?", - actualTaxHeadMasterQueryBuilder.getQuery(searchTaxHead, objectList)); - assertEquals(6, objectList.size()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/TaxPeriodQueryBuilderTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/TaxPeriodQueryBuilderTest.java deleted file mode 100644 index ebd28cc2384..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/querybuilder/TaxPeriodQueryBuilderTest.java +++ /dev/null @@ -1,242 +0,0 @@ -package org.egov.demand.repository.querybuilder; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.util.ArrayList; -import java.util.HashSet; - -import org.egov.demand.model.AuditDetail; - -import org.egov.demand.model.TaxPeriod; -import org.egov.demand.model.enums.PeriodCycle; -import org.egov.demand.web.contract.TaxPeriodCriteria; -import org.junit.jupiter.api.Disabled; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - - -class TaxPeriodQueryBuilderTest { - @Autowired - private TaxPeriodQueryBuilder taxPeriodQueryBuilder; - - @Test - void testPrepareSearchQuery() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria(); - assertEquals("SELECT * FROM EGBS_TAXPERIOD taxperiod WHERE ", - actualTaxPeriodQueryBuilder.prepareSearchQuery(taxPeriodCriteria, new ArrayList<>())); - } - - @Test - void testPrepareSearchQuery3() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - HashSet service = new HashSet<>(); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria("42", service, PeriodCycle.MONTH, new HashSet<>(), - "SELECT * FROM EGBS_TAXPERIOD taxperiod ", 1L, 1L, 1L); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT * FROM EGBS_TAXPERIOD taxperiod WHERE taxperiod.tenantId = ? and taxperiod.periodcycle = ?" - + " and taxperiod.fromdate >= ? and taxperiod.todate <= ? and taxperiod.code = ? and taxperiod.fromdate" - + " <= ? and taxperiod.todate >= ? ", - actualTaxPeriodQueryBuilder.prepareSearchQuery(taxPeriodCriteria, objectList)); - assertEquals(7, objectList.size()); - } - - - @Test - void testPrepareSearchQuery4() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria(); - taxPeriodCriteria.setFromDate(1L); - assertEquals("SELECT * FROM EGBS_TAXPERIOD taxperiod WHERE ", - actualTaxPeriodQueryBuilder.prepareSearchQuery(taxPeriodCriteria, new ArrayList<>())); - } - - - @Test - void testPrepareSearchQuery5() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - HashSet service = new HashSet<>(); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria(" WHERE ", service, PeriodCycle.MONTH, new HashSet<>(), - "SELECT * FROM EGBS_TAXPERIOD taxperiod ", 1L, 1L, 1L); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT * FROM EGBS_TAXPERIOD taxperiod WHERE taxperiod.tenantId = ? and taxperiod.periodcycle = ?" - + " and taxperiod.fromdate >= ? and taxperiod.todate <= ? and taxperiod.code = ? and taxperiod.fromdate" - + " <= ? and taxperiod.todate >= ? ", - actualTaxPeriodQueryBuilder.prepareSearchQuery(taxPeriodCriteria, objectList)); - assertEquals(7, objectList.size()); - } - - - @Test - void testPrepareSearchQuery6() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - HashSet service = new HashSet<>(); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria("", service, PeriodCycle.MONTH, new HashSet<>(), - "SELECT * FROM EGBS_TAXPERIOD taxperiod ", 1L, 1L, 1L); - - ArrayList objectList = new ArrayList<>(); - assertEquals("SELECT * FROM EGBS_TAXPERIOD taxperiod WHERE and taxperiod.periodcycle = ? and taxperiod.fromdate" - + " >= ? and taxperiod.todate <= ? and taxperiod.code = ? and taxperiod.fromdate <= ? and taxperiod.todate" - + " >= ? ", actualTaxPeriodQueryBuilder.prepareSearchQuery(taxPeriodCriteria, objectList)); - assertEquals(6, objectList.size()); - } - - - @Test - void testPrepareSearchQuery7() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add("SELECT * FROM EGBS_TAXPERIOD taxperiod "); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria("42", stringSet, PeriodCycle.MONTH, new HashSet<>(), - "SELECT * FROM EGBS_TAXPERIOD taxperiod ", 1L, 1L, 1L); - - ArrayList objectList = new ArrayList<>(); - assertEquals("SELECT * FROM EGBS_TAXPERIOD taxperiod WHERE taxperiod.tenantId = ? and taxperiod.service IN " - + " ('SELECT * FROM EGBS_TAXPERIOD taxperiod ') and taxperiod.periodcycle = ? AND (fromdate >= CASE" - + " WHEN ((SELECT fromdate FROM egbs_taxperiod WHERE tenantId =? AND ( ? BETWEEN fromdate AND todate) " - + " AND service IN ('SELECT * FROM EGBS_TAXPERIOD taxperiod ') AND periodcycle=?) NOTNULL) THEN ( SELECT" - + " fromdate FROM egbs_taxperiod WHERE tenantId =? AND ( ? BETWEEN fromdate AND todate) AND service IN" - + " ('SELECT * FROM EGBS_TAXPERIOD taxperiod ') AND periodcycle=?) ELSE (SELECT min(fromdate) FROM" - + " egbs_taxperiod WHERE tenantId =?) END AND todate <= ( SELECT todate FROM egbs_taxperiod WHERE tenantId" - + " = ? AND (? BETWEEN fromdate AND todate) AND service IN ('SELECT * FROM EGBS_TAXPERIOD taxperiod" - + " ') AND periodcycle=?)) and taxperiod.code = ? and taxperiod.fromdate <= ? and taxperiod.todate >= ?" + " ", - actualTaxPeriodQueryBuilder.prepareSearchQuery(taxPeriodCriteria, objectList)); - assertEquals(15, objectList.size()); - } - - - @Test - void testPrepareSearchQuery8() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - stringSet.add("SELECT * FROM EGBS_TAXPERIOD taxperiod "); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria("42", stringSet, PeriodCycle.MONTH, new HashSet<>(), - "SELECT * FROM EGBS_TAXPERIOD taxperiod ", 1L, 1L, 1L); - - ArrayList objectList = new ArrayList<>(); - assertEquals("SELECT * FROM EGBS_TAXPERIOD taxperiod WHERE taxperiod.tenantId = ? and taxperiod.service IN " - + " ('SELECT * FROM EGBS_TAXPERIOD taxperiod ','foo') and taxperiod.periodcycle = ? and taxperiod.fromdate" - + " >= ? and taxperiod.todate <= ? and taxperiod.code = ? and taxperiod.fromdate <= ? and taxperiod.todate" - + " >= ? ", actualTaxPeriodQueryBuilder.prepareSearchQuery(taxPeriodCriteria, objectList)); - assertEquals(7, objectList.size()); - } - - - @Test - void testPrepareSearchQuery9() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add("SELECT * FROM EGBS_TAXPERIOD taxperiod "); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria("42", new HashSet<>(), PeriodCycle.MONTH, stringSet, - "SELECT * FROM EGBS_TAXPERIOD taxperiod ", 1L, 1L, 1L); - - ArrayList objectList = new ArrayList<>(); - assertEquals("SELECT * FROM EGBS_TAXPERIOD taxperiod WHERE taxperiod.tenantId = ? and taxperiod.periodcycle =" - + " ? and taxperiod.fromdate >= ? and taxperiod.todate <= ? and taxperiod.code = ? and taxperiod.id" - + " IN ('SELECT * FROM EGBS_TAXPERIOD taxperiod ') and taxperiod.fromdate <= ? and taxperiod.todate" - + " >= ? ", actualTaxPeriodQueryBuilder.prepareSearchQuery(taxPeriodCriteria, objectList)); - assertEquals(7, objectList.size()); - } - - - @Test - void testPrepareSearchQuery10() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - HashSet stringSet = new HashSet<>(); - stringSet.add("SELECT * FROM EGBS_TAXPERIOD taxperiod "); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria("42", stringSet, null, new HashSet<>(), - "SELECT * FROM EGBS_TAXPERIOD taxperiod ", 1L, 1L, 1L); - - ArrayList objectList = new ArrayList<>(); - assertEquals( - "SELECT * FROM EGBS_TAXPERIOD taxperiod WHERE taxperiod.tenantId = ? and taxperiod.service IN " - + " ('SELECT * FROM EGBS_TAXPERIOD taxperiod ') and taxperiod.fromdate >= ? and taxperiod.todate <= ? " - + " and taxperiod.code = ? and taxperiod.fromdate <= ? and taxperiod.todate >= ? ", - actualTaxPeriodQueryBuilder.prepareSearchQuery(taxPeriodCriteria, objectList)); - assertEquals(6, objectList.size()); - } - - - @Test - void testPrepareQueryForValidation() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - assertEquals("select exists (select * from egbs_taxperiod taxperiod where )", - actualTaxPeriodQueryBuilder.prepareQueryForValidation(new ArrayList<>(), "Mode")); - } - - - - @Test - void testPrepareQueryForValidation4() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - TaxPeriod taxPeriod = new TaxPeriod("42", "42", 1L, 1L, PeriodCycle.MONTH, "Service", "Code", "Financial Year", - new AuditDetail()); - taxPeriod.setFromDate(0L); - - ArrayList taxPeriodList = new ArrayList<>(); - taxPeriodList.add(taxPeriod); - assertEquals( - "select exists (select * from egbs_taxperiod taxperiod where ( taxperiod.service = 'Service' and " - + " taxperiod.code = 'Code' and taxperiod.tenantId = '42' and (( 0 BETWEEN fromdate AND todate OR 1" - + " BETWEEN fromdate AND todate) OR (fromdate BETWEEN 0 AND 1 OR todate BETWEEN 0 AND 1))) )", - actualTaxPeriodQueryBuilder.prepareQueryForValidation(taxPeriodList, "Mode")); - } - - @Test - void testPrepareQueryForValidation5() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - TaxPeriod taxPeriod = new TaxPeriod("42", " ( ", 1L, 1L, PeriodCycle.MONTH, "Service", "Code", "Financial Year", - new AuditDetail()); - taxPeriod.setFromDate(0L); - - ArrayList taxPeriodList = new ArrayList<>(); - taxPeriodList.add(taxPeriod); - assertEquals( - "select exists (select * from egbs_taxperiod taxperiod where ( taxperiod.service = 'Service' and " - + " taxperiod.code = 'Code' and taxperiod.tenantId = ' ( ' and (( 0 BETWEEN fromdate AND todate OR 1" - + " BETWEEN fromdate AND todate) OR (fromdate BETWEEN 0 AND 1 OR todate BETWEEN 0 AND 1))) )", - actualTaxPeriodQueryBuilder.prepareQueryForValidation(taxPeriodList, "Mode")); - } - - - @Test - void testPrepareQueryForValidation6() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - TaxPeriod taxPeriod = new TaxPeriod("42", "", 1L, 1L, PeriodCycle.MONTH, "Service", "Code", "Financial Year", - new AuditDetail()); - taxPeriod.setFromDate(0L); - - ArrayList taxPeriodList = new ArrayList<>(); - taxPeriodList.add(taxPeriod); - assertEquals("select exists (select * from egbs_taxperiod taxperiod where ( taxperiod.service = 'Service' and " - + " taxperiod.code = 'Code' and 0 BETWEEN fromdate AND todate OR 1 BETWEEN fromdate AND todate) OR (fromdate" - + " BETWEEN 0 AND 1 OR todate BETWEEN 0 AND 1))) )", - actualTaxPeriodQueryBuilder.prepareQueryForValidation(taxPeriodList, "Mode")); - } - - - @Test - void testPrepareQueryForValidation7() { - TaxPeriodQueryBuilder actualTaxPeriodQueryBuilder = new TaxPeriodQueryBuilder(); - TaxPeriod taxPeriod = new TaxPeriod("42", "42", 1L, 1L, PeriodCycle.MONTH, "Service", "Code", "Financial Year", - new AuditDetail()); - taxPeriod.setFromDate(0L); - - ArrayList taxPeriodList = new ArrayList<>(); - taxPeriodList.add(taxPeriod); - assertEquals("select exists (select * from egbs_taxperiod taxperiod where ( taxperiod.service = 'Service' and " - + " taxperiod.code = 'Code' and taxperiod.id != '42' and taxperiod.tenantId = '42' and (( 0 BETWEEN" - + " fromdate AND todate OR 1 BETWEEN fromdate AND todate) OR (fromdate BETWEEN 0 AND 1 OR todate BETWEEN" - + " 0 AND 1))) )", actualTaxPeriodQueryBuilder.prepareQueryForValidation(taxPeriodList, "edit")); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/AmendmentRowMapperTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/AmendmentRowMapperTest.java deleted file mode 100644 index 14d47ec1532..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/AmendmentRowMapperTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.egov.demand.repository.rowmapper; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.node.MissingNode; - -import java.math.BigDecimal; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.egov.demand.util.Util; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.postgresql.util.PGInterval; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {AmendmentRowMapper.class}) -@ExtendWith(SpringExtension.class) -class AmendmentRowMapperTest { - @Autowired - private AmendmentRowMapper amendmentRowMapper; - - @MockBean - private Util util; - - @Test - void testExtractData() throws SQLException, DataAccessException { - when(this.util.getJsonValue((org.postgresql.util.PGobject) any())).thenReturn(MissingNode.getInstance()); - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.wasNull()).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getObject((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getString((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getBigDecimal((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getLong((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false); - assertThrows(EmptyResultDataAccessException.class, () -> this.amendmentRowMapper.extractData(resultSet)); - verify(resultSet).next(); - verify(resultSet).getString((String) any()); - } -@Test - void testExtractData2() throws SQLException, DataAccessException { - when(this.util.getJsonValue((org.postgresql.util.PGobject) any())).thenReturn(MissingNode.getInstance()); - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.wasNull()).thenReturn(true); - when(resultSet.getObject((String) any())).thenReturn(new PGInterval()); - when(resultSet.getString((String) any())).thenReturn("String"); - when(resultSet.getBigDecimal((String) any())).thenReturn(BigDecimal.valueOf(42L)); - when(resultSet.getLong((String) any())).thenReturn(1L); - when(resultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false); - assertEquals(1, this.amendmentRowMapper.extractData(resultSet).size()); - verify(this.util).getJsonValue((org.postgresql.util.PGobject) any()); - verify(resultSet, atLeast(1)).next(); - verify(resultSet, atLeast(1)).wasNull(); - verify(resultSet).getObject((String) any()); - verify(resultSet, atLeast(1)).getString((String) any()); - verify(resultSet).getBigDecimal((String) any()); - verify(resultSet, atLeast(1)).getLong((String) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/BillRowMapperTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/BillRowMapperTest.java deleted file mode 100644 index 329645f80e5..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/BillRowMapperTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.egov.demand.repository.rowmapper; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.junit.jupiter.api.Disabled; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {BillRowMapper.class}) -@ExtendWith(SpringExtension.class) -class BillRowMapperTest { - @Autowired - private BillRowMapper billRowMapper; - - - @Test - void testExtractData() throws SQLException { - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.getBoolean((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getObject((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getString((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getBigDecimal((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getLong((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false); - assertThrows(EmptyResultDataAccessException.class, () -> this.billRowMapper.extractData(resultSet)); - verify(resultSet).next(); - verify(resultSet).getString((String) any()); - } - - - @Test - void testExtractData2() throws SQLException { - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.getInt((String) any())).thenReturn(1); - when(resultSet.getBoolean((String) any())).thenReturn(true); - when(resultSet.getObject((String) any())).thenReturn(1L); - when(resultSet.getString((String) any())).thenReturn("String"); - when(resultSet.getBigDecimal((String) any())).thenReturn(BigDecimal.valueOf(42L)); - when(resultSet.getLong((String) any())).thenReturn(1L); - when(resultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false); - assertEquals(1, this.billRowMapper.extractData(resultSet).size()); - verify(resultSet, atLeast(1)).getBoolean((String) any()); - verify(resultSet, atLeast(1)).next(); - verify(resultSet, atLeast(1)).getInt((String) any()); - verify(resultSet, atLeast(1)).getObject((String) any()); - verify(resultSet, atLeast(1)).getString((String) any()); - verify(resultSet, atLeast(1)).getBigDecimal((String) any()); - verify(resultSet, atLeast(1)).getLong((String) any()); - } - - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/BillRowMapperV2Test.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/BillRowMapperV2Test.java deleted file mode 100644 index ac2f35cbb32..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/BillRowMapperV2Test.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.egov.demand.repository.rowmapper; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.node.MissingNode; - -import java.math.BigDecimal; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.egov.demand.util.Util; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {BillRowMapperV2.class}) -@ExtendWith(SpringExtension.class) -class BillRowMapperV2Test { - @Autowired - private BillRowMapperV2 billRowMapperV2; - - @MockBean - private Util util; - - @Test - void testExtractData() throws SQLException { - when(this.util.getJsonValue((org.postgresql.util.PGobject) any())).thenReturn(MissingNode.getInstance()); - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.getObject((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getString((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getBigDecimal((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getLong((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false); - assertThrows(EmptyResultDataAccessException.class, () -> this.billRowMapperV2.extractData(resultSet)); - verify(resultSet).next(); - verify(resultSet).getString((String) any()); - } - - - @Test - void testExtractData2() throws SQLException { - when(this.util.getJsonValue((org.postgresql.util.PGobject) any())).thenReturn(MissingNode.getInstance()); - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.getInt((String) any())).thenReturn(1); - when(resultSet.getObject((String) any())).thenReturn(null); - when(resultSet.getString((String) any())).thenReturn("String"); - when(resultSet.getBigDecimal((String) any())).thenReturn(BigDecimal.valueOf(42L)); - when(resultSet.getLong((String) any())).thenReturn(1L); - when(resultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false); - assertEquals(1, this.billRowMapperV2.extractData(resultSet).size()); - verify(this.util, atLeast(1)).getJsonValue((org.postgresql.util.PGobject) any()); - verify(resultSet, atLeast(1)).next(); - verify(resultSet, atLeast(1)).getInt((String) any()); - verify(resultSet, atLeast(1)).getObject((String) any()); - verify(resultSet, atLeast(1)).getString((String) any()); - verify(resultSet, atLeast(1)).getBigDecimal((String) any()); - verify(resultSet, atLeast(1)).getLong((String) any()); - } - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/CollectedReceiptsRowMapperTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/CollectedReceiptsRowMapperTest.java deleted file mode 100644 index 8a0f3505f87..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/CollectedReceiptsRowMapperTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.egov.demand.repository.rowmapper; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.egov.demand.model.AuditDetail; -import org.egov.demand.model.CollectedReceipt; -import org.junit.jupiter.api.Test; - -class CollectedReceiptsRowMapperTest { - - @Test - void testMapRow() throws SQLException { - CollectedReceiptsRowMapper collectedReceiptsRowMapper = new CollectedReceiptsRowMapper(); - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.getDouble((String) any())).thenReturn(10.0d); - when(resultSet.getString((String) any())).thenReturn("String"); - when(resultSet.getLong((String) any())).thenReturn(1L); - CollectedReceipt actualMapRowResult = collectedReceiptsRowMapper.mapRow(resultSet, 10); - assertEquals("String", actualMapRowResult.getTenantId()); - assertEquals("String", actualMapRowResult.getBusinessService()); - assertEquals(10.0d, actualMapRowResult.getReceiptAmount().doubleValue()); - assertEquals(1L, actualMapRowResult.getReceiptDate().longValue()); - assertEquals("String", actualMapRowResult.getConsumerCode()); - assertNull(actualMapRowResult.getStatus()); - assertEquals("String", actualMapRowResult.getReceiptNumber()); - AuditDetail auditDetail = actualMapRowResult.getAuditDetail(); - assertEquals("String", auditDetail.getLastModifiedBy()); - assertEquals(1L, auditDetail.getLastModifiedTime().longValue()); - assertEquals("String", auditDetail.getCreatedBy()); - assertEquals(1L, auditDetail.getCreatedTime().longValue()); - verify(resultSet).getDouble((String) any()); - verify(resultSet, atLeast(1)).getString((String) any()); - verify(resultSet, atLeast(1)).getLong((String) any()); - } - - - @Test - void testMapRow2() throws SQLException { - CollectedReceiptsRowMapper collectedReceiptsRowMapper = new CollectedReceiptsRowMapper(); - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.getDouble((String) any())).thenThrow(new SQLException()); - when(resultSet.getString((String) any())).thenThrow(new SQLException()); - when(resultSet.getLong((String) any())).thenThrow(new SQLException()); - assertThrows(SQLException.class, () -> collectedReceiptsRowMapper.mapRow(resultSet, 10)); - verify(resultSet).getString((String) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/DemandRowMapperTest.java b/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/DemandRowMapperTest.java deleted file mode 100644 index e775578bae3..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/repository/rowmapper/DemandRowMapperTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.egov.demand.repository.rowmapper; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.node.MissingNode; - -import java.math.BigDecimal; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.egov.demand.util.Util; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.postgresql.util.PGInterval; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {DemandRowMapper.class}) -@ExtendWith(SpringExtension.class) -class DemandRowMapperTest { - @Autowired - private DemandRowMapper demandRowMapper; - - @MockBean - private Util util; - - - @Test - void testExtractData() throws SQLException, DataAccessException { - when(this.util.getJsonValue((org.postgresql.util.PGobject) any())).thenReturn(MissingNode.getInstance()); - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.getBoolean((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getObject((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getString((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getBigDecimal((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.getLong((String) any())).thenThrow(new EmptyResultDataAccessException(3)); - when(resultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false); - assertThrows(EmptyResultDataAccessException.class, () -> this.demandRowMapper.extractData(resultSet)); - verify(resultSet).next(); - verify(resultSet).getString((String) any()); - } - - - @Test - void testExtractData2() throws SQLException, DataAccessException { - when(this.util.getJsonValue((org.postgresql.util.PGobject) any())).thenReturn(MissingNode.getInstance()); - ResultSet resultSet = mock(ResultSet.class); - when(resultSet.getBoolean((String) any())).thenReturn(true); - when(resultSet.getObject((String) any())).thenReturn(new PGInterval()); - when(resultSet.getString((String) any())).thenReturn("String"); - when(resultSet.getBigDecimal((String) any())).thenReturn(BigDecimal.valueOf(42L)); - when(resultSet.getLong((String) any())).thenReturn(1L); - when(resultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false); - assertEquals(1, this.demandRowMapper.extractData(resultSet).size()); - verify(this.util).getJsonValue((org.postgresql.util.PGobject) any()); - verify(resultSet).getBoolean((String) any()); - verify(resultSet, atLeast(1)).next(); - verify(resultSet).getObject((String) any()); - verify(resultSet, atLeast(1)).getString((String) any()); - verify(resultSet, atLeast(1)).getBigDecimal((String) any()); - verify(resultSet, atLeast(1)).getLong((String) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/AmendmentServiceTest.java b/business-services/billing-service/src/test/java/org/egov/demand/service/AmendmentServiceTest.java deleted file mode 100644 index 6a48d88d14f..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/AmendmentServiceTest.java +++ /dev/null @@ -1,199 +0,0 @@ -package org.egov.demand.service; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.amendment.model.*; -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.repository.AmendmentRepository; -import org.egov.demand.repository.BillRepositoryV2; -import org.egov.demand.util.Util; -import org.egov.demand.web.validator.AmendmentValidator; -import org.egov.tracer.model.CustomException; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.util.CollectionUtils; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; - -@ExtendWith(SpringExtension.class) -@SpringBootTest -public class AmendmentServiceTest { - - @MockBean - private Util util; - - @MockBean - private ApplicationProperties props; - - @MockBean - private DemandService demandService; - - @MockBean - private BillRepositoryV2 billRepositoryV2; - - @MockBean - private AmendmentValidator amendmentValidator; - - @MockBean - private AmendmentRepository amendmentRepository; - - @Autowired - private AmendmentService amendmentService; - - - @Test - @DisplayName("Should update the demand with amendment tax when the demand is not empty") - public void testUpdateDemandWithAmendmentTaxWhenDemandIsNotEmpty() { - - RequestInfo requestInfo = new RequestInfo(); - Amendment amendment = - Amendment.builder() - .consumerCode("consumerCode") - .businessService("businessService") - .tenantId("tenantId") - .build(); - - DemandCriteria demandCriteria = - DemandCriteria.builder() - .consumerCode(Stream.of(amendment.getConsumerCode()).collect(Collectors.toSet())) - .businessService(amendment.getBusinessService()) - .tenantId(amendment.getTenantId()) - .isPaymentCompleted(false) - .build(); - - Demand demand = - Demand.builder() - .id("id") - .consumerCode("consumerCode") - .businessService("businessService") - .tenantId("tenantId") - .build(); - - when(demandService.getDemands(demandCriteria, requestInfo)).thenReturn(Arrays.asList(demand)); - - - - - } - - @Test - @DisplayName("Should update the amendment when the status is active") - public void testUpdateAmendmentWhenStatusIsActive() { - - RequestInfo requestInfo = new RequestInfo(); - AmendmentUpdate amendmentUpdate = - AmendmentUpdate.builder().status(AmendmentStatus.ACTIVE).build(); - AmendmentUpdateRequest amendmentUpdateRequest = - AmendmentUpdateRequest.builder() - .requestInfo(requestInfo) - .amendmentUpdate(amendmentUpdate) - .build(); - - Amendment amendmentFromSearch = Amendment.builder().build(); - - when(amendmentValidator.validateAndEnrichAmendmentForUpdate(amendmentUpdateRequest)) - .thenReturn(amendmentFromSearch); - - - } - - @Test - @DisplayName("Should update the amendment when the status is inactive") - public void testUpdateAmendmentWhenStatusIsInactive() { - - RequestInfo requestInfo = new RequestInfo(); - AmendmentUpdateRequest amendmentUpdateRequest = - AmendmentUpdateRequest.builder() - .requestInfo(requestInfo) - .amendmentUpdate( - AmendmentUpdate.builder() - .amendmentId("1") - .tenantId("ap.kurnool") - .status(AmendmentStatus.INACTIVE) - .build()) - .build(); - - Amendment amendmentFromSearch = - Amendment.builder() - .amendmentId("1") - .tenantId("ap.kurnool") - .status(AmendmentStatus.ACTIVE) - .build(); - - when(amendmentValidator.validateAndEnrichAmendmentForUpdate(amendmentUpdateRequest)) - .thenReturn(amendmentFromSearch); - - - } - - @Test - @DisplayName("Should throws an exception when the tenantId is null") - public void testCreateWhenTenantIdIsNullThenThrowsException() { - - AmendmentRequest amendmentRequest = - AmendmentRequest.builder() - .amendment(Amendment.builder().tenantId(null).build()) - .requestInfo(RequestInfo.builder().build()) - .build(); - - when(amendmentService.create(amendmentRequest)).thenReturn(null); - - } - - @Test - @DisplayName("Should return empty list when the mobile number is not present in any demand") - public void testSearchWhenMobileNumberIsNotPresentInAnyDemandThenReturnEmptyList() { - - AmendmentCriteria amendmentCriteria = - AmendmentCriteria.builder().mobileNumber("1234567890").build(); - - when(demandService.getDemands(any(), any())).thenReturn(Collections.emptyList()); - - List amendments = amendmentService.search(amendmentCriteria, null); - - assertEquals(0, amendments.size()); - } - - @Test - @DisplayName( - "Should return empty list when the mobile number is present in demands but consumer code is not present in any demand") - public void - testSearchWhenMobileNumberIsPresentInDemandsButConsumerCodeIsNotPresentInAnyDemandThenReturnEmptyList() { - - AmendmentCriteria amendmentCriteria = - AmendmentCriteria.builder() - .mobileNumber("1234567890") - - .build(); - - DemandCriteria demandCriteria = - DemandCriteria.builder() - .mobileNumber("1234567890") - - .build(); - - when(amendmentRepository.getAmendments(amendmentCriteria)) - .thenReturn(Collections.singletonList(Amendment.builder().build())); - - when(demandService.getDemands(demandCriteria, null)).thenReturn(Collections.emptyList()); - - List amendments = amendmentService.search(amendmentCriteria, null); - - assertTrue(CollectionUtils.isEmpty(amendments)); - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/BillServiceTest.java b/business-services/billing-service/src/test/java/org/egov/demand/service/BillServiceTest.java deleted file mode 100644 index 86536585ec4..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/BillServiceTest.java +++ /dev/null @@ -1,245 +0,0 @@ -package org.egov.demand.service; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.*; -import org.egov.demand.repository.BillRepository; -import org.egov.demand.repository.IdGenRepo; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.BillResponse; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.tracer.model.CustomException; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.when; - - -@ExtendWith(SpringExtension.class) -@SpringBootTest -class BillServiceTest { - - @MockBean - private BillRepository billRepository; - - @Autowired - private BillService billService; - - @MockBean - private BusinessServDetailService businessServDetailService; - - @MockBean - private DemandService demandService; - - @MockBean - private IdGenRepo idGenRepo; - - @MockBean - private KafkaTemplate kafkaTemplate; - - @MockBean - private ServiceRequestRepository serviceRequestRepository; - - @MockBean - private TaxHeadMasterService taxHeadMasterService; - - @MockBean - private Util util; - - @Test - @DisplayName("Should throws an exception when the demands is empty") - public void testGenerateBillWhenDemandsIsEmptyThenThrowsException() { - - GenerateBillCriteria billCriteria = - GenerateBillCriteria.builder().tenantId("default").businessService("TL").build(); - - RequestInfo requestInfo = - RequestInfo.builder() - .apiId("org.egov.tl") - .ver("1.0") - .action("POST") - .did("4354648646") - .key("xyz") - .msgId("654654") - .authToken("345678f") - .build(); - - DemandCriteria demandCriteria = new DemandCriteria(); - demandCriteria.setEmail("ak@gmail.com"); - demandCriteria.setTenantId("12"); - - when(demandService.getDemands(demandCriteria, requestInfo)).thenReturn(Collections.emptyList()); - - assertThrows( - CustomException.class, - () -> { - billService.generateBill(billCriteria, requestInfo); - }); - } - - @Test - @DisplayName("Should returns the bill response when the demands is not empty") - public void testGenerateBillWhenDemandsIsNotEmptyThenReturnsTheBillResponse() { - - GenerateBillCriteria billCriteria = - GenerateBillCriteria.builder().businessService("TL").tenantId("default").build(); - - DemandCriteria demandCriteria = new DemandCriteria(); - demandCriteria.setEmail("ak@gmail.com"); - demandCriteria.setTenantId("12"); - - List demands = new ArrayList<>(); - demands.add(Demand.builder().build()); - RequestInfo requestInfo = new RequestInfo(); - when(demandService.getDemands(demandCriteria, requestInfo)).thenReturn(demands); - } - - @Test - @DisplayName("Should return the bill when the bill is already generated") - public void testFetchBillWhenBillIsAlreadyGeneratedThenReturnTheBill() { - - GenerateBillCriteria billCriteria = - GenerateBillCriteria.builder().businessService("TL").tenantId("default").build(); - - Bill bill = Bill.builder().id("1").build(); - - BillResponse billResponse = - BillResponse.builder().bill(Collections.singletonList(bill)).build(); - - RequestInfo requestInfo = RequestInfo.builder().build(); - - List bills = Collections.singletonList(bill); - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - - } - - @Test - @DisplayName( - "Should return the bill when the bill is already generated and there are no expired bills") - public void testFetchBillWhenBillIsAlreadyGeneratedAndThereAreNoExpiredBillsThenReturnTheBill() { - - GenerateBillCriteria billCriteria = - GenerateBillCriteria.builder().businessService("TL").tenantId("default").build(); - - BillSearchCriteria billSearchCriteria = billCriteria.toBillSearchCriteria(); - - BillDetail billDetail = - BillDetail.builder() - .businessService("TL") - .consumerCode("TL-1") - .expiryDate(System.currentTimeMillis() + 100000) - .build(); - - Bill bill = Bill.builder().billDetails(Collections.singletonList(billDetail)).build(); - - BillResponse billResponse = - BillResponse.builder().bill(Collections.singletonList(bill)).build(); - - when(billRepository.findBill(billSearchCriteria)).thenReturn(null); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - - RequestInfo requestInfo = new RequestInfo(); -/* - BillResponse actualBillResponse = billService.generateBill(billCriteria, requestInfo ); - - assertEquals(billResponse, actualBillResponse);*/ - } - - @Test - @DisplayName("Should return bill response when the bill request is valid") - public void testApportionWhenBillRequestIsValidThenReturnBillResponse() { - - BillRequest billRequest = new BillRequest(); - Bill bill = Bill.builder().build(); - List bills = Collections.singletonList(bill); - - when(billRepository.apportion(billRequest)).thenReturn(bills); - - BillResponse billResponse = billService.create(billRequest); - - } - - @Test - @DisplayName("Should save the bill") - public void testCreateShouldSaveTheBill() { - - BillRequest billRequest = BillRequest.builder().build(); - BillResponse billResponse = BillResponse.builder().build(); - - } - - @Test - @DisplayName("Should return the bill response") - public void testCreateShouldReturnTheBillResponse() { - - BillRequest billRequest = BillRequest.builder().build(); - BillResponse billResponse = BillResponse.builder().build(); - - BillResponse actualBillResponse = billService.create(billRequest); - - - } - - @Test - - void testFetchBill() { - GenerateBillCriteria billCriteria = new GenerateBillCriteria(); - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - - } - - @Test - - void testSearchBill() { - - BillSearchCriteria billCriteria = new BillSearchCriteria(); - billService.searchBill(billCriteria, new RequestInfo()); - } - - @Test - - void testGenerateBill() { - - - GenerateBillCriteria billCriteria = new GenerateBillCriteria(); - BillResponse response = new BillResponse(); - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - /* when(billService.fetchBill(billCriteria, requestInfoWrapper)).thenReturn(response);*/ - } - - @Test - void testGetBillResponse() { - - BillService billService = new BillService(); - BillResponse actualBillResponse = billService.getBillResponse(new ArrayList<>()); - assertTrue(actualBillResponse.getBill().isEmpty()); - assertNull(actualBillResponse.getResposneInfo()); - } - - @Test - void testSendBillToKafka() { - - BillService billService = new BillService(); - assertThrows(CustomException.class, () -> billService.sendBillToKafka(new BillRequest())); - } - - @Test - void testCreate() { - - this.billService.create(new BillRequest()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/BillServicev2Test.java b/business-services/billing-service/src/test/java/org/egov/demand/service/BillServicev2Test.java deleted file mode 100644 index c3a7aa37fa3..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/BillServicev2Test.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.egov.demand.service; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.*; -import org.egov.demand.producer.Producer; -import org.egov.demand.repository.BillRepositoryV2; -import org.egov.demand.repository.IdGenRepo; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequestV2; -import org.egov.demand.web.contract.BillResponseV2; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.validator.BillValidator; -import org.egov.tracer.model.CustomException; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import java.util.*; - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.when; - -@ExtendWith(SpringExtension.class) -@SpringBootTest -class BillServicev2Test { - - @MockBean - private BillRepositoryV2 billRepositoryV2; - - @Autowired - private BillServicev2 billServicev2; - - @MockBean - private BillValidator billValidator; - - @MockBean - private BusinessServDetailService businessServDetailService; - - @MockBean - private DemandService demandService; - - @MockBean - private IdGenRepo idGenRepo; - - @MockBean - private KafkaTemplate kafkaTemplate; - - @MockBean - private Producer producer; - - @MockBean - private ServiceRequestRepository serviceRequestRepository; - - @MockBean - private TaxHeadMasterService taxHeadMasterService; - - @MockBean - private Util util; - - @MockBean - private BillRequestV2 billRequestV2; - - @Test - @DisplayName("Should throws an exception when the consumerCodes is empty") - public void testCancelBillWhenConsumerCodesIsEmptyThenThrowsException() { - - UpdateBillRequest updateBillRequest = - UpdateBillRequest.builder().UpdateBillCriteria - ( - UpdateBillCriteria.builder().consumerCodes(Collections.emptySet()).build()) - .build(); - - - - when(billServicev2.cancelBill(updateBillRequest)).thenReturn(0); - } - - @Test - @DisplayName("Should throws an exception when the consumerCodes size is greater than 1") - public void testCancelBillWhenConsumerCodesSizeIsGreaterThanOneThenThrowsException() { - - UpdateBillRequest updateBillRequest = - UpdateBillRequest.builder() - .UpdateBillCriteria( - UpdateBillCriteria.builder() - .consumerCodes(new HashSet<>(Arrays.asList("1"))) - .build()) - .build(); - - when(billServicev2.cancelBill(updateBillRequest)).thenReturn(null); - } - - @Test - @DisplayName("Should return the bill when the bill is not expired") - public void testFetchBillWhenBillIsNotExpired() { - - GenerateBillCriteria billCriteria = - GenerateBillCriteria.builder().businessService("TL").tenantId("default").build(); - - - RequestInfoWrapper requestInfoWrapper= new RequestInfoWrapper(); - - BillV2 billV2 = BillV2.builder().consumerCode("consumerCode").build(); - - BillResponseV2 billResponseV2 = - BillResponseV2.builder().bill(Collections.singletonList(billV2)).build(); - - when(billRepositoryV2.findBill(billCriteria.toBillSearchCriteria())) - .thenReturn(Collections.singletonList(billV2)); - - - when(billServicev2.fetchBill(billCriteria,requestInfoWrapper)).thenReturn(null); - } - - @Test - @DisplayName("Should return the bill when the bill is expired") - public void testFetchBillWhenBillIsExpired() { - - GenerateBillCriteria billCriteria = - GenerateBillCriteria.builder() - .businessService("TL") - .tenantId("default") - .consumerCode(Collections.singleton("1")) - .build(); - - BillV2 billV2 = - BillV2.builder() - .id(String.valueOf(1L)) - .billNumber("1") - .consumerCode("1") - .tenantId("default") - .businessService("TL") - .billDetails( - Collections.singletonList( - BillDetailV2.builder() - .id(String.valueOf(1L)) - .expiryDate(System.currentTimeMillis() - 1) - .build())) - .build(); - - BillResponseV2 billResponseV2 = - BillResponseV2.builder().bill(Collections.singletonList(billV2)).build(); - - when(billRepositoryV2.findBill(billCriteria.toBillSearchCriteria())) - .thenReturn(Collections.singletonList(billV2)); - - when(demandService.getDemands(billCriteria.toDemandCriteria(), null)) - .thenReturn(Collections.emptyList()); - - when(billRepositoryV2.updateBillStatus( - UpdateBillCriteria.builder() - .statusToBeUpdated(BillV2.BillStatus.EXPIRED) - .businessService("TL") - .consumerCodes(Collections.singleton("1")) - .tenantId("default") - .build())) - .thenReturn(1); - - when(billRepositoryV2.findBill(billCriteria.toBillSearchCriteria())) - .thenReturn(Collections.emptyList()); - - RequestInfo requestInfo = new RequestInfo(); - when(demandService.getDemands(billCriteria.toDemandCriteria(), requestInfo)) - .thenReturn(Collections.emptyList()); - -RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - - - when(billServicev2.fetchBill(billCriteria,requestInfoWrapper)).thenReturn(null); - - } - - @Test - void testGetBillResponse() { - - BillServicev2 billServicev2 = new BillServicev2(); - BillResponseV2 actualBillResponse = billServicev2.getBillResponse(new ArrayList<>()); - assertTrue(actualBillResponse.getBill().isEmpty()); - assertNull(actualBillResponse.getResposneInfo()); - } - - @Test - void testSendBillToKafka() { - - BillServicev2 billServicev2 = new BillServicev2(); - assertThrows(CustomException.class, () -> billServicev2.sendBillToKafka(new BillRequestV2())); - } - - @Test - void testCreate() { - - BillServicev2 billServicev2 = new BillServicev2(); - BillResponseV2 actualCreateResult = billServicev2.create(new BillRequestV2()); - assertTrue(actualCreateResult.getBill().isEmpty()); - assertNull(actualCreateResult.getResposneInfo()); - } - - @Test - void testCreate3() { - BillServicev2 billServicev2 = new BillServicev2(); - BillResponseV2 actualCreateResult = billServicev2.create(new BillRequestV2()); - assertNull(actualCreateResult.getResposneInfo()); - assertTrue(actualCreateResult.getBill().isEmpty()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/BusinessServDetailServiceTest.java b/business-services/billing-service/src/test/java/org/egov/demand/service/BusinessServDetailServiceTest.java deleted file mode 100644 index 96c90601b88..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/BusinessServDetailServiceTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.egov.demand.service; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.repository.BusinessServiceDetailRepository; -import org.egov.demand.web.contract.BusinessServiceDetailCriteria; -import org.egov.demand.web.contract.BusinessServiceDetailResponse; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {BusinessServDetailService.class, ResponseFactory.class}) -@ExtendWith(SpringExtension.class) -class BusinessServDetailServiceTest { - @Autowired - private BusinessServDetailService businessServDetailService; - - @MockBean - private BusinessServiceDetailRepository businessServiceDetailRepository; - - /** - * Method under test: {@link BusinessServDetailService#searchBusinessServiceDetails(BusinessServiceDetailCriteria, RequestInfo)} - */ - @Test - void testSearchBusinessServiceDetails() { - when(this.businessServiceDetailRepository.getBussinessServiceDetail((RequestInfo) any(), - (BusinessServiceDetailCriteria) any())).thenReturn(new ArrayList<>()); - BusinessServiceDetailCriteria businessServiceDetailCriteria = new BusinessServiceDetailCriteria(); - BusinessServiceDetailResponse actualSearchBusinessServiceDetailsResult = this.businessServDetailService - .searchBusinessServiceDetails(businessServiceDetailCriteria, new RequestInfo()); - assertTrue(actualSearchBusinessServiceDetailsResult.getBusinessServiceDetails().isEmpty()); - ResponseInfo responseInfo = actualSearchBusinessServiceDetailsResult.getResponseInfo(); - assertNull(responseInfo.getApiId()); - assertNull(responseInfo.getVer()); - assertNull(responseInfo.getTs()); - assertEquals("200 OK", responseInfo.getStatus()); - assertNull(responseInfo.getMsgId()); - verify(this.businessServiceDetailRepository).getBussinessServiceDetail((RequestInfo) any(), - (BusinessServiceDetailCriteria) any()); - } - - /** - * Method under test: {@link BusinessServDetailService#searchBusinessServiceDetails(BusinessServiceDetailCriteria, RequestInfo)} - */ - @Test - void testSearchBusinessServiceDetails2() { - when(this.businessServiceDetailRepository.getBussinessServiceDetail((RequestInfo) any(), - (BusinessServiceDetailCriteria) any())).thenReturn(new ArrayList<>()); - assertTrue(this.businessServDetailService.searchBusinessServiceDetails(new BusinessServiceDetailCriteria(), null) - .getBusinessServiceDetails() - .isEmpty()); - verify(this.businessServiceDetailRepository).getBussinessServiceDetail((RequestInfo) any(), - (BusinessServiceDetailCriteria) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/DemandServiceTest.java b/business-services/billing-service/src/test/java/org/egov/demand/service/DemandServiceTest.java deleted file mode 100644 index 5705f445505..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/DemandServiceTest.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.egov.demand.service; - -import com.jayway.jsonpath.DocumentContext; -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.PaymentBackUpdateAudit; -import org.egov.demand.repository.BillRepositoryV2; -import org.egov.demand.repository.DemandRepository; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.demand.util.DemandEnrichmentUtil; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.contract.User; -import org.egov.demand.web.contract.UserSearchRequest; -import org.egov.demand.web.validator.DemandValidatorV1; -import org.egov.tracer.model.CustomException; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.*; - -@ExtendWith(SpringExtension.class) -@SpringBootTest -public class DemandServiceTest { - - @MockBean - private DemandRepository demandRepository; - - @MockBean - private BillRepositoryV2 billRepoV2; - - @Autowired - private DemandService demandService; - - @MockBean - private Util util; - - @MockBean - private DemandValidatorV1 demandValidatorV1; - - @MockBean - private ServiceRequestRepository serviceRequestRepository; - - @MockBean - private DemandEnrichmentUtil demandEnrichmentUtil; - - @Test - @DisplayName("Should return a response with the demands when the demands are valid") - public void testCreateWhenDemandsAreValidThenReturnResponseWithDemands() { - DemandRequest demandRequest = DemandRequest.builder().build(); - RequestInfo requestInfo = demandRequest.getRequestInfo(); - - DocumentContext mdmsData = util.getMDMSData(requestInfo, "1"); - when(util.getMDMSData(requestInfo, "1")).thenReturn(mdmsData); - /* demandService.create(demandRequest); -*/ - - } - - @Test - @DisplayName("Should throw an exception when the demands are invalid") - public void testCreateWhenDemandsAreInvalidThenThrowException() { - DemandRequest demandRequest = DemandRequest.builder().build(); - RequestInfo requestInfo = new RequestInfo(); - DocumentContext mdmsData = util.getMDMSData(requestInfo , "1"); - - when(util.getMDMSData(requestInfo , "1")).thenReturn(mdmsData); - - doThrow(new CustomException("INVALID_DEMAND", "Invalid demand")) - .when(demandValidatorV1) - .validatedemandForCreate(demandRequest, true, mdmsData); - - - } - - @Test - @DisplayName("Should the demand when the demand is found") - public void testUpdateWhenDemandIsFound() { - DemandRequest demandRequest = DemandRequest.builder().build(); - PaymentBackUpdateAudit paymentBackUpdateAudit = PaymentBackUpdateAudit.builder().build(); - demandService.update(demandRequest, paymentBackUpdateAudit); - verify(demandRepository).update(demandRequest, paymentBackUpdateAudit); - } - - @Test - @DisplayName("Should throws an exception when the demand is not found") - public void testUpdateWhenDemandIsNotFoundThenThrowsException() { - DemandRequest demandRequest = DemandRequest.builder().build(); - RequestInfo requestInfo = new RequestInfo(); - DocumentContext mdmsData = util.getMDMSData(requestInfo , "1"); - - PaymentBackUpdateAudit paymentBackUpdateAudit = PaymentBackUpdateAudit.builder().build(); - - demandValidatorV1.validateForUpdate(demandRequest,mdmsData); - when(demandRepository.getDemands(any(DemandCriteria.class))) - .thenReturn(Collections.emptyList()); - - demandService.update(demandRequest,paymentBackUpdateAudit); - } - - @Test - @DisplayName("Should s the demand") - public void testSave() { - DemandRequest demandRequest = DemandRequest.builder().build(); - demandService.save(demandRequest); - verify(demandRepository).save(demandRequest); - } - - @Test - @DisplayName("Should return demands when the demand criteria is valid") - public void testGetDemandsWhenDemandCriteriaIsValidThenReturnDemands() { - DemandCriteria demandCriteria = DemandCriteria.builder().tenantId("ap.kurnool").build(); - RequestInfo requestInfo = RequestInfo.builder().build(); - - List demands = new ArrayList<>(); - List payers = new ArrayList<>(); - demands.add(Demand.builder().id(String.valueOf(1L)).build()); - - when(demandRepository.getDemands(demandCriteria)).thenReturn(demands); - - when(demandEnrichmentUtil.enrichPayer(demands ,payers)).thenReturn(demands); - - List actualDemands = demandService.getDemands(demandCriteria, requestInfo); - - assertEquals(demands, actualDemands); - - } - - @Test - public void UserSearchReq(){ - UserSearchRequest userSearchRequest = new UserSearchRequest(); - when(serviceRequestRepository.fetchResult("https://primehubstore.com",userSearchRequest)).thenReturn(null); - - } - - @Test - @DisplayName("Should throw an exception when the demand criteria is invalid") - public void testGetDemandsWhenDemandCriteriaIsInvalidThenThrowException() { - DemandCriteria demandCriteria = DemandCriteria.builder().build(); - RequestInfo requestInfo = RequestInfo.builder().build(); - - doThrow(new CustomException("INVALID_DEMAND_CRITERIA", "Invalid demand criteria")) - .when(demandValidatorV1) - .validateDemandCriteria(demandCriteria, requestInfo); - - assertThrows( - CustomException.class, - () -> { - demandService.getDemands(demandCriteria, requestInfo); - }); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/ReceiptServiceTest.java b/business-services/billing-service/src/test/java/org/egov/demand/service/ReceiptServiceTest.java deleted file mode 100644 index db53a037ded..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/ReceiptServiceTest.java +++ /dev/null @@ -1,339 +0,0 @@ -package org.egov.demand.service; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashSet; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.AuditDetail; -import org.egov.demand.model.Bill; -import org.egov.demand.model.BillAccountDetail; -import org.egov.demand.model.BillDetail; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandDetail; - -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.DemandResponse; -import org.egov.demand.web.contract.Receipt; -import org.egov.demand.web.contract.ReceiptRequest; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {ReceiptService.class}) -@ExtendWith(SpringExtension.class) -class ReceiptServiceTest { - @MockBean - private DemandService demandService; - - @Autowired - private ReceiptService receiptService; - - - @Test - void testUpdateDemandFromReceipt() { - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getReceipt()).thenReturn(new ArrayList<>()); - this.receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.CREATED, true); - verify(receiptRequest).getReceipt(); - } - - - @Test - void testUpdateDemandFromReceipt2() { - ArrayList receiptList = new ArrayList<>(); - receiptList.add(new Receipt()); - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getReceipt()).thenReturn(receiptList); - this.receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.CREATED, true); - verify(receiptRequest, atLeast(1)).getReceipt(); - } - - - @Test - void testUpdateDemandFromReceipt3() { - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getReceipt()).thenReturn(new ArrayList<>()); - this.receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.CANCELLED, true); - verify(receiptRequest).getReceipt(); - } - - - @Test - void testUpdateDemandFromReceipt4() { - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getReceipt()).thenReturn(new ArrayList<>()); - this.receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.INSTRUMENT_BOUNCED, true); - verify(receiptRequest).getReceipt(); - } - - - @Test - void testUpdateDemandFromReceipt5() { - - ArrayList receiptList = new ArrayList<>(); - receiptList.add(null); - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getReceipt()).thenReturn(receiptList); - /* receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.CREATED, true); - verify(receiptRequest).getReceipt();*/ - } - - - @Test - void testUpdateDemandFromReceipt6() { - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - ArrayList billList = new ArrayList<>(); - billList.add(new Bill()); - Receipt e = new Receipt("42", "42", "42", billList, new AuditDetail(), 123L); - - ArrayList receiptList = new ArrayList<>(); - receiptList.add(e); - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(receiptRequest.getReceipt()).thenReturn(receiptList); - this.receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.CREATED, true); - verify(this.demandService).getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any()); - verify(this.demandService).updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any()); - verify(receiptRequest, atLeast(1)).getReceipt(); - verify(receiptRequest).getRequestInfo(); - } - - - @Test - void testUpdateDemandFromReceipt7() { - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - ArrayList billList = new ArrayList<>(); - billList.add(new Bill()); - billList.add(new Bill()); - Receipt e = new Receipt("42", "42", "42", billList, new AuditDetail(), 123L); - - ArrayList receiptList = new ArrayList<>(); - receiptList.add(e); - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(receiptRequest.getReceipt()).thenReturn(receiptList); - this.receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.CREATED, true); - verify(this.demandService).getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any()); - verify(this.demandService).updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any()); - verify(receiptRequest, atLeast(1)).getReceipt(); - verify(receiptRequest).getRequestInfo(); - } - - @Test - - void testUpdateDemandFromReceipt8() { - - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - ArrayList billList = new ArrayList<>(); - billList.add(null); - Receipt e = new Receipt("42", "42", "42", billList, new AuditDetail(), 123L); - - ArrayList receiptList = new ArrayList<>(); - receiptList.add(e); - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(receiptRequest.getReceipt()).thenReturn(receiptList); - /* this.receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.CREATED, true); -*/ - } - - - @Test - - void testUpdateDemandFromReceipt9() { - - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - Bill bill = new Bill(); - bill.addBillDetailsItem(new BillDetail()); - - ArrayList billList = new ArrayList<>(); - billList.add(bill); - Receipt e = new Receipt("42", "42", "42", billList, new AuditDetail(), 123L); - - ArrayList receiptList = new ArrayList<>(); - receiptList.add(e); - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(receiptRequest.getReceipt()).thenReturn(receiptList); - /* this.receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.CREATED, true); -*/ - } - - - @Test - - void testUpdateDemandFromReceipt10() { - - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - Bill bill = new Bill(); - bill.addBillDetailsItem(new BillDetail()); - bill.addBillDetailsItem(new BillDetail()); - - ArrayList billList = new ArrayList<>(); - billList.add(bill); - Receipt e = new Receipt("42", "42", "42", billList, new AuditDetail(), 123L); - - ArrayList receiptList = new ArrayList<>(); - receiptList.add(e); - ReceiptRequest receiptRequest = mock(ReceiptRequest.class); - when(receiptRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(receiptRequest.getReceipt()).thenReturn(receiptList); - /*this.receiptService.updateDemandFromReceipt(receiptRequest, BillDetail.StatusEnum.CREATED, true);*/ - } - - - - @Test - - void testUpdateDemandFromBill3() { - - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getBills()).thenReturn(new ArrayList<>()); - /* this.receiptService.updateDemandFromBill(billRequest, new HashSet<>(), true); -*/ - } - - - @Test - void testUpdateDemandFromBill4() { - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - ArrayList billList = new ArrayList<>(); - billList.add(new Bill()); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequest.getBills()).thenReturn(billList); - this.receiptService.updateDemandFromBill(billRequest, new HashSet<>(), true); - verify(this.demandService).getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any()); - verify(this.demandService).updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any()); - verify(billRequest).getBills(); - verify(billRequest, atLeast(1)).getRequestInfo(); - } - - - @Test - - void testUpdateDemandFromBill5() { - - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - ArrayList billList = new ArrayList<>(); - billList.add(null); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequest.getBills()).thenReturn(billList); - /* this.receiptService.updateDemandFromBill(billRequest, new HashSet<>(), true); -*/ - } - - - @Test - - void testUpdateDemandFromBill6() { - - - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - Bill bill = new Bill(); - bill.addBillDetailsItem(new BillDetail()); - - ArrayList billList = new ArrayList<>(); - billList.add(bill); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequest.getBills()).thenReturn(billList); - /* this.receiptService.updateDemandFromBill(billRequest, new HashSet<>(), true); -*/ - } - - - @Test - - void testUpdateDemandFromBill7() { - - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - ArrayList billList = new ArrayList<>(); - billList.add(new Bill()); - billList.add(null); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequest.getBills()).thenReturn(billList); - /* this.receiptService.updateDemandFromBill(billRequest, new HashSet<>(), true); -*/ - } - - - @Test - void testUpdateDemandFromBill8() { - ArrayList demandList = new ArrayList<>(); - demandList.add(new Demand()); - when(this.demandService.getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(demandList); - when(this.demandService.updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any())).thenReturn(new DemandResponse()); - - Bill bill = new Bill(); - bill.addBillDetailsItem(new BillDetail()); - - ArrayList billList = new ArrayList<>(); - billList.add(bill); - BillRequest billRequest = mock(BillRequest.class); - when(billRequest.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequest.getBills()).thenReturn(billList); - this.receiptService.updateDemandFromBill(billRequest, new HashSet<>(), true); - verify(this.demandService).getDemands((org.egov.demand.model.DemandCriteria) any(), (RequestInfo) any()); - verify(this.demandService).updateAsync((org.egov.demand.web.contract.DemandRequest) any(), - (org.egov.demand.model.PaymentBackUpdateAudit) any()); - verify(billRequest).getBills(); - verify(billRequest, atLeast(1)).getRequestInfo(); - } - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/ReceiptServiceV2Test.java b/business-services/billing-service/src/test/java/org/egov/demand/service/ReceiptServiceV2Test.java deleted file mode 100644 index 27f0821ff88..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/ReceiptServiceV2Test.java +++ /dev/null @@ -1,434 +0,0 @@ -package org.egov.demand.service; - -import com.fasterxml.jackson.databind.node.MissingNode; -import com.jayway.jsonpath.JsonPath; -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.*; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.BillRequestV2; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; - -@ExtendWith(SpringExtension.class) -@SpringBootTest -public class ReceiptServiceV2Test { - - @Mock - private DemandService demandService; - - @InjectMocks - private ReceiptServiceV2 receiptServiceV2; - - @Mock - private Util util; - - @Test - @DisplayName("Should update the demand when the bill is not empty") - public void testUpdateDemandFromBillWhenBillIsNotEmpty() { - BillRequestV2 billRequest = - BillRequestV2.builder() - .requestInfo(RequestInfo.builder().build()) - .bills( - Collections.singletonList( - BillV2.builder() - .id("1") - .tenantId("ap.kurnool") - .businessService("TL") - - .billDetails( - Collections.singletonList( - BillDetailV2.builder() - .demandId("1") - .amountPaid(BigDecimal.valueOf(100)) - .billAccountDetails( - Collections.singletonList( - BillAccountDetailV2.builder() - .taxHeadCode("TL_TAX") - .amount(BigDecimal.valueOf(100)) - .adjustedAmount(BigDecimal.valueOf(100)) - .build())) - .build())) - .build())) - .build(); - - Demand demand = - Demand.builder() - .id("1") - .tenantId("ap.kurnool") - .demandDetails( - Collections.singletonList( - DemandDetail.builder() - .taxHeadMasterCode("TL_TAX") - .taxAmount(BigDecimal.valueOf(100)) - .collectionAmount(BigDecimal.ZERO) - .build())) - .build(); - - when(demandService.getDemands(any(), any())).thenReturn(Collections.singletonList(demand)); - - when(util.getValueFromAdditionalDetailsForKey(any(), any())).thenReturn("1"); - - when(util.prepareMdMsRequest(any(), any(), any(), any(), any())) - .thenReturn(MdmsCriteriaReq.builder().build()); - - when(util.getAttributeValues(any())).thenReturn(JsonPath.parse("{}")); - - /* receiptServiceV2.updateDemandFromBill(billRequest, Collections.singleton("1"), false); - */ - assertEquals("1", demand.getId()); - assertEquals("ap.kurnool", demand.getTenantId()); - - assertEquals("TL_TAX", demand.getDemandDetails().get(0).getTaxHeadMasterCode()); - assertEquals(BigDecimal.valueOf(100), demand.getDemandDetails().get(0).getTaxAmount()); - assertEquals(BigDecimal.valueOf(0), demand.getDemandDetails().get(0).getCollectionAmount()); - } - - @Test - @DisplayName("Should not update the demand when the bill is empty") - public void testUpdateDemandFromBillWhenBillIsEmpty() { - - - verify(demandService, never()).updateAsync(any(), any()); - } - - @Test - @DisplayName("Should update the demand when the bill is not empty") - public void testUpdateDemandFromReceiptWhenBillIsNotEmpty() { - BillRequestV2 billRequestV2 = BillRequestV2.builder().build(); - Demand demand = - Demand.builder() - .id("1") - .tenantId("default") - .demandDetails( - Collections.singletonList( - DemandDetail.builder() - .taxHeadMasterCode("TL_TAX") - .taxAmount(BigDecimal.valueOf(100)) - .collectionAmount(BigDecimal.ZERO) - .build())) - .build(); - - when(demandService.getDemands(any(), any())).thenReturn(Collections.singletonList(demand)); - - receiptServiceV2.updateDemandFromReceipt(billRequestV2, false); - - assertEquals(demand.getDemandDetails().get(0).getCollectionAmount(), BigDecimal.valueOf(0)); - } - - @Test - @DisplayName("Should not update the demand when the bill is empty") - public void testUpdateDemandFromReceiptWhenBillIsEmpty() { - BillRequestV2 billRequestV2 = BillRequestV2.builder().build(); - receiptServiceV2.updateDemandFromReceipt(billRequestV2, false); - verify(demandService, never()).getDemands(any(), any()); - } - - - - @Test - @DisplayName("Should not update the demand when the bill is empty") - public void testUpdateDemandFromBillWhenBillIsEmpty2() { - BillRequestV2 billRequest = BillRequestV2.builder().build(); - ReceiptServiceV2 receiptServiceV2 =mock(ReceiptServiceV2.class); - - receiptServiceV2.updateDemandFromBill(billRequest, new HashSet<>(), false); - - verify(demandService, never()).getDemands(any(), any()); - } - - @Test - void testUpdateDemandFromReceipt() { - - this.receiptServiceV2.updateDemandFromReceipt(new BillRequestV2(), true); - } - - @Test - void testUpdateDemandFromReceipt2() { - - this.receiptServiceV2.updateDemandFromReceipt(null, true); - } - - @Test - void testUpdateDemandFromReceipt3() { - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getBills()).thenReturn(new ArrayList<>()); - this.receiptServiceV2.updateDemandFromReceipt(billRequestV2, true); - verify(billRequestV2).getBills(); - } - - @Test - void testUpdateDemandFromReceipt4() { - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(new BillV2()); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getBills()).thenReturn(billV2List); - } - - @Test - void testUpdateDemandFromReceipt5() { - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(null); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getBills()).thenReturn(billV2List); - } - - @Test - void testUpdateDemandFromReceipt6() { - - - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(null); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (java.util.List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - when(this.demandService.getDemands((DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - - ArrayList billV2List = new ArrayList<>(); - BigDecimal totalAmount = BigDecimal.valueOf(42L); - MissingNode additionalDetails = MissingNode.getInstance(); - ArrayList billDetails = new ArrayList<>(); - billV2List.add(new BillV2("42", "42", "Payer Name", "42 Main St", "jane.doe@example.org", BillV2.BillStatus.ACTIVE, - totalAmount, "Business Service", "42", 1L, "Consumer Code", additionalDetails, billDetails, "42", "42", - new AuditDetails())); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequestV2.getBills()).thenReturn(billV2List); - } - - @Test - void testUpdateDemandFromReceipt7() { - - - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(null); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (java.util.List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - when(this.demandService.getDemands((DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - - ArrayList billDetailV2List = new ArrayList<>(); - billDetailV2List.add(new BillDetailV2()); - BigDecimal totalAmount = BigDecimal.valueOf(42L); - MissingNode additionalDetails = MissingNode.getInstance(); - BillV2 e = new BillV2("42", "42", "Payer Name", "42 Main St", "jane.doe@example.org", BillV2.BillStatus.ACTIVE, - totalAmount, "Business Service", "42", 1L, "Consumer Code", additionalDetails, billDetailV2List, "42", "42", - new AuditDetails()); - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(e); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequestV2.getBills()).thenReturn(billV2List); - } - - @Test - void testUpdateDemandFromBill3() { - - - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getBills()).thenReturn(new ArrayList<>()); - } - - @Test - void testUpdateDemandFromBill4() { - - - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(null); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (java.util.List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - when(this.demandService.getDemands((DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(new BillV2()); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequestV2.getBills()).thenReturn(billV2List); - } - - @Test - void testUpdateDemandFromBill5() { - - - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(null); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (java.util.List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - when(this.demandService.getDemands((DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - - ArrayList billV2List = new ArrayList<>(); - BigDecimal totalAmount = BigDecimal.valueOf(42L); - MissingNode additionalDetails = MissingNode.getInstance(); - ArrayList billDetails = new ArrayList<>(); - billV2List.add(new BillV2("42", "42", "BillingService", "42 Main St", "jane.doe@example.org", - BillV2.BillStatus.ACTIVE, totalAmount, "BillingService", "42", 2L, "BillingService", additionalDetails, - billDetails, "42", "42", new AuditDetails())); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequestV2.getBills()).thenReturn(billV2List); - } - - @Test - void testUpdateDemandFromBill6() { - - - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(null); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (java.util.List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - when(this.demandService.getDemands((DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(new ArrayList<>()); - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(null); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequestV2.getBills()).thenReturn(billV2List); - } - - @Test - void testUpdateDemandFromBill7() { - - - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(null); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (java.util.List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - - ArrayList demandList = new ArrayList<>(); - demandList.add(new Demand()); - demandList.add(new Demand()); - when(this.demandService.getDemands((DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(demandList); - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(new BillV2()); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequestV2.getBills()).thenReturn(billV2List); - } - - @Test - void testUpdateDemandFromBill8() { - - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(null); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (java.util.List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - - Demand demand = new Demand(); - demand.addDemandDetailsItem(new DemandDetail()); - - ArrayList demandList = new ArrayList<>(); - demandList.add(demand); - demandList.add(new Demand()); - when(this.demandService.getDemands((DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(demandList); - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(new BillV2()); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequestV2.getBills()).thenReturn(billV2List); - - } - - @Test - void testUpdateDemandFromBill9() { - - when(this.util.getAttributeValues((MdmsCriteriaReq) any())).thenReturn(null); - when(this.util.prepareMdMsRequest((String) any(), (String) any(), (java.util.List) any(), (String) any(), - (RequestInfo) any())).thenReturn(new MdmsCriteriaReq()); - - Demand demand = new Demand(); - demand.addDemandDetailsItem(new DemandDetail()); - demand.addDemandDetailsItem(new DemandDetail()); - - ArrayList demandList = new ArrayList<>(); - demandList.add(demand); - demandList.add(new Demand()); - when(this.demandService.getDemands((DemandCriteria) any(), (RequestInfo) any())) - .thenReturn(demandList); - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(new BillV2()); - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getRequestInfo()).thenReturn(new RequestInfo()); - when(billRequestV2.getBills()).thenReturn(billV2List); - } - - @Test - @DisplayName("Should update the demand when the bill is not empty") - public void testUpdateDemandFromReceiptWhenBillIsNotEmpty1() { - - BillRequestV2 billRequest = BillRequestV2.builder().build(); - - receiptServiceV2.updateDemandFromReceipt(billRequest, false); - - } - - @Test - @DisplayName("Should not update the demand when the bill is empty") - public void testUpdateDemandFromReceiptWhenBillIsEmpty2() { - - BillRequestV2 billRequest = BillRequestV2.builder().build(); - receiptServiceV2.updateDemandFromReceipt(billRequest, false); - verify(demandService, times(0)).update(any(DemandRequest.class), any()); - } - - @Test - void testUpdateDemandFromReceipt1() { - - this.receiptServiceV2.updateDemandFromReceipt(new BillRequestV2(), true); - } - - @Test - void testUpdateDemandFromReceipth() { - this.receiptServiceV2.updateDemandFromReceipt(null, true); - } - - @Test - void testUpdateDemandFromReceiptd() { - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - when(billRequestV2.getBills()).thenReturn(new ArrayList<>()); - this.receiptServiceV2.updateDemandFromReceipt(billRequestV2, true); - - } - - @Test - void testUpdateDemandFromReceiptj() { - - BillRequestV2 billRequestV2 = mock(BillRequestV2.class); - ArrayList billV2List = new ArrayList<>(); - billV2List.add(new BillV2()); - when(billRequestV2.getBills()).thenReturn(new ArrayList<>()); - this.receiptServiceV2.updateDemandFromReceipt(billRequestV2, true); - - } - - @Test - @DisplayName("Should not update the demand when the bill is empty") - public void testUpdateDemandFromReceiptWhenBillIsEmpty1() { - - BillRequestV2 billRequest = BillRequestV2.builder().build(); - receiptServiceV2.updateDemandFromReceipt(billRequest, false); - verify(demandService, times(0)).update(any(DemandRequest.class), any()); - } - - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/TaxHeadMasterServiceTest.java b/business-services/billing-service/src/test/java/org/egov/demand/service/TaxHeadMasterServiceTest.java deleted file mode 100644 index 63334e4cbde..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/TaxHeadMasterServiceTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.egov.demand.service; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.model.TaxHeadMasterCriteria; -import org.egov.demand.repository.TaxHeadMasterRepository; -import org.egov.demand.web.contract.TaxHeadMasterResponse; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {TaxHeadMasterService.class, ResponseFactory.class}) -@ExtendWith(SpringExtension.class) -class TaxHeadMasterServiceTest { - @MockBean - private TaxHeadMasterRepository taxHeadMasterRepository; - - @Autowired - private TaxHeadMasterService taxHeadMasterService; - - /** - * Method under test: {@link TaxHeadMasterService#getTaxHeads(TaxHeadMasterCriteria, RequestInfo)} - */ - @Test - void testGetTaxHeads() { - when(this.taxHeadMasterRepository.getTaxHeadMaster((RequestInfo) any(), (TaxHeadMasterCriteria) any())) - .thenReturn(new ArrayList<>()); - TaxHeadMasterCriteria searchTaxHead = new TaxHeadMasterCriteria(); - TaxHeadMasterResponse actualTaxHeads = this.taxHeadMasterService.getTaxHeads(searchTaxHead, new RequestInfo()); - assertTrue(actualTaxHeads.getTaxHeadMasters().isEmpty()); - ResponseInfo responseInfo = actualTaxHeads.getResponseInfo(); - assertNull(responseInfo.getVer()); - assertNull(responseInfo.getTs()); - assertEquals("200 OK", responseInfo.getStatus()); - assertNull(responseInfo.getMsgId()); - assertNull(responseInfo.getApiId()); - verify(this.taxHeadMasterRepository).getTaxHeadMaster((RequestInfo) any(), (TaxHeadMasterCriteria) any()); - } - - /** - * Method under test: {@link TaxHeadMasterService#getTaxHeads(TaxHeadMasterCriteria, RequestInfo)} - */ - @Test - void testGetTaxHeads2() { - when(this.taxHeadMasterRepository.getTaxHeadMaster((RequestInfo) any(), (TaxHeadMasterCriteria) any())) - .thenReturn(new ArrayList<>()); - assertTrue(this.taxHeadMasterService.getTaxHeads(new TaxHeadMasterCriteria(), null).getTaxHeadMasters().isEmpty()); - verify(this.taxHeadMasterRepository).getTaxHeadMaster((RequestInfo) any(), (TaxHeadMasterCriteria) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/TaxPeriodServiceTest.java b/business-services/billing-service/src/test/java/org/egov/demand/service/TaxPeriodServiceTest.java deleted file mode 100644 index 4781a259541..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/TaxPeriodServiceTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.egov.demand.service; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.demand.repository.TaxPeriodRepository; -import org.egov.demand.web.contract.TaxPeriodCriteria; -import org.egov.demand.web.contract.TaxPeriodResponse; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {TaxPeriodService.class, ResponseFactory.class}) -@ExtendWith(SpringExtension.class) -class TaxPeriodServiceTest { - @MockBean - private TaxPeriodRepository taxPeriodRepository; - - @Autowired - private TaxPeriodService taxPeriodService; - - /** - * Method under test: {@link TaxPeriodService#searchTaxPeriods(TaxPeriodCriteria, RequestInfo)} - */ - @Test - void testSearchTaxPeriods() { - when(this.taxPeriodRepository.getTaxPeriod((RequestInfo) any(), (TaxPeriodCriteria) any())) - .thenReturn(new ArrayList<>()); - TaxPeriodCriteria taxPeriodCriteria = new TaxPeriodCriteria(); - TaxPeriodResponse actualSearchTaxPeriodsResult = this.taxPeriodService.searchTaxPeriods(taxPeriodCriteria, - new RequestInfo()); - assertTrue(actualSearchTaxPeriodsResult.getTaxPeriods().isEmpty()); - ResponseInfo responseInfo = actualSearchTaxPeriodsResult.getResponseInfo(); - assertNull(responseInfo.getVer()); - assertNull(responseInfo.getTs()); - assertEquals("200 OK", responseInfo.getStatus()); - assertNull(responseInfo.getMsgId()); - assertNull(responseInfo.getApiId()); - verify(this.taxPeriodRepository).getTaxPeriod((RequestInfo) any(), (TaxPeriodCriteria) any()); - } - - /** - * Method under test: {@link TaxPeriodService#searchTaxPeriods(TaxPeriodCriteria, RequestInfo)} - */ - @Test - void testSearchTaxPeriods2() { - when(this.taxPeriodRepository.getTaxPeriod((RequestInfo) any(), (TaxPeriodCriteria) any())) - .thenReturn(new ArrayList<>()); - assertTrue(this.taxPeriodService.searchTaxPeriods(new TaxPeriodCriteria(), null).getTaxPeriods().isEmpty()); - verify(this.taxPeriodRepository).getTaxPeriod((RequestInfo) any(), (TaxPeriodCriteria) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/service/UserServiceTest.java b/business-services/billing-service/src/test/java/org/egov/demand/service/UserServiceTest.java deleted file mode 100644 index b4c4c5851ab..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/service/UserServiceTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.egov.demand.service; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.Demand; -import org.egov.demand.model.Owner; -import org.egov.demand.web.contract.User; -import org.egov.demand.web.contract.UserResponse; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.web.client.RestTemplate; - -import java.util.Collections; -import java.util.Map; - - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.when; - -@SpringBootTest -public class UserServiceTest { - - @MockBean - private RestTemplate restTemplate; - - @Autowired - private UserService userService; - - - @Test - @DisplayName("Should return the user when the user exists") - public void testGetUserWhenUserExists() { - - UserResponse userResponse = new UserResponse(); - userResponse.setUser(Collections.singletonList(new User())); - when(restTemplate.postForObject(anyString(), any(), eq(UserResponse.class))).thenReturn(userResponse); - Map response = userService.getUser(new RequestInfo(), "1234567890", "test", "default"); - assertTrue(response.containsKey("id")); - } - - @Test - @DisplayName("Should return empty map when the user does not exist") - public void testGetUserWhenUserDoesNotExist() { - - RequestInfo requestInfo = new RequestInfo(); - String phoneNo = "1234567890"; - String name = "test"; - String tenantId = "default"; - - UserResponse userResponse = new UserResponse(); - userResponse.setUser(Collections.emptyList()); - - when(restTemplate.postForObject(anyString(), any(), eq(UserResponse.class))).thenReturn(userResponse); - - Map response = userService.getUser(requestInfo, phoneNo, name, tenantId); - - assertTrue(response.isEmpty()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/util/DemandEnrichmentUtilTest.java b/business-services/billing-service/src/test/java/org/egov/demand/util/DemandEnrichmentUtilTest.java deleted file mode 100644 index 61747c1e02d..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/util/DemandEnrichmentUtilTest.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.egov.demand.util; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import org.egov.demand.model.AuditDetails; - -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.web.contract.User; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {DemandEnrichmentUtil.class}) -@ExtendWith(SpringExtension.class) -class DemandEnrichmentUtilTest { - @Autowired - private DemandEnrichmentUtil demandEnrichmentUtil; - - - @Test - void testEnrichPayer() { - ArrayList demands = new ArrayList<>(); - assertTrue(this.demandEnrichmentUtil.enrichPayer(demands, new ArrayList<>()).isEmpty()); - } - - - @Test - void testEnrichPayer2() { - ArrayList demandList = new ArrayList<>(); - demandList.add(new Demand()); - assertTrue(this.demandEnrichmentUtil.enrichPayer(demandList, new ArrayList<>()).isEmpty()); - } - - - @Test - void testEnrichPayer3() { - ArrayList demandList = new ArrayList<>(); - User payer = new User(); - ArrayList demandDetails = new ArrayList<>(); - AuditDetails auditDetails = new AuditDetails(); - demandList - .add(new Demand("42", "42", "Consumer Code", "Consumer Type", "Business Service", payer, 1L, 1L, demandDetails, - auditDetails, 1L, 1L, "Additional Details", BigDecimal.valueOf(42L), true, Demand.StatusEnum.ACTIVE)); - assertEquals(1, this.demandEnrichmentUtil.enrichPayer(demandList, new ArrayList<>()).size()); - } - - - - - - @Test - void testEnrichPayer5() { - Demand demand = mock(Demand.class); - when(demand.getPayer()).thenReturn(new User()); - - ArrayList demandList = new ArrayList<>(); - demandList.add(demand); - assertEquals(1, this.demandEnrichmentUtil.enrichPayer(demandList, new ArrayList<>()).size()); - verify(demand, atLeast(1)).getPayer(); - } - - - @Test - void testEnrichPayer6() { - Demand demand = mock(Demand.class); - doNothing().when(demand).setPayer((User) any()); - when(demand.getPayer()).thenReturn(new User()); - - ArrayList demandList = new ArrayList<>(); - demandList.add(demand); - - ArrayList userList = new ArrayList<>(); - userList.add(new User()); - assertEquals(1, this.demandEnrichmentUtil.enrichPayer(demandList, userList).size()); - verify(demand, atLeast(1)).getPayer(); - verify(demand).setPayer((User) any()); - } - - - -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/util/SequenceGenServiceTest.java b/business-services/billing-service/src/test/java/org/egov/demand/util/SequenceGenServiceTest.java deleted file mode 100644 index 09fdb3ac076..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/util/SequenceGenServiceTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.egov.demand.util; - -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {SequenceGenService.class}) -@ExtendWith(SpringExtension.class) -class SequenceGenServiceTest { - @MockBean - private JdbcTemplate jdbcTemplate; - - @Autowired - private SequenceGenService sequenceGenService; - - - @Test - void testGetIds() throws DataAccessException { - ArrayList stringList = new ArrayList<>(); - when(this.jdbcTemplate.queryForList((String) any(), (Object[]) any(), (Class) any())) - .thenReturn(stringList); - List actualIds = this.sequenceGenService.getIds(3, "Sequence Name"); - assertSame(stringList, actualIds); - assertTrue(actualIds.isEmpty()); - verify(this.jdbcTemplate).queryForList((String) any(), (Object[]) any(), (Class) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/util/UtilTest.java b/business-services/billing-service/src/test/java/org/egov/demand/util/UtilTest.java deleted file mode 100644 index a44bb9e0c42..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/util/UtilTest.java +++ /dev/null @@ -1,587 +0,0 @@ -package org.egov.demand.util; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import ch.qos.logback.core.util.COWArrayList; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.MappingIterator; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.JsonNodeType; -import com.fasterxml.jackson.databind.node.MissingNode; -import com.jayway.jsonpath.DocumentContext; - -import java.math.BigDecimal; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Scanner; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.common.contract.request.User; -import org.egov.demand.amendment.model.ProcessInstance; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.ModuleDetail; -import org.egov.tracer.model.CustomException; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.postgresql.util.PGInterval; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - - -class UtilTest { - @MockBean - private Boolean aBoolean; - - @MockBean - private ObjectMapper objectMapper; - - @MockBean - private ServiceRequestRepository serviceRequestRepository; - - @Autowired - private Util util; - - - @Test - void testPrepareMdMsRequest() { - - - Util util = new Util(); - ArrayList stringList = new ArrayList<>(); - RequestInfo requestInfo = new RequestInfo(); - MdmsCriteriaReq actualPrepareMdMsRequestResult = util.prepareMdMsRequest("42", "Module Name", stringList, "Filter", - requestInfo); - assertSame(requestInfo, actualPrepareMdMsRequestResult.getRequestInfo()); - MdmsCriteria mdmsCriteria = actualPrepareMdMsRequestResult.getMdmsCriteria(); - assertEquals("42", mdmsCriteria.getTenantId()); - List moduleDetails = mdmsCriteria.getModuleDetails(); - assertEquals(1, moduleDetails.size()); - ModuleDetail getResult = moduleDetails.get(0); - assertEquals(stringList, getResult.getMasterDetails()); - assertEquals("Module Name", getResult.getModuleName()); - } - - - @Test - void testPrepareMdMsRequest2() { - - Util util = new Util(); - - ArrayList stringList = new ArrayList<>(); - stringList.add("foo"); - RequestInfo requestInfo = new RequestInfo(); - MdmsCriteriaReq actualPrepareMdMsRequestResult = util.prepareMdMsRequest("42", "Module Name", stringList, "Filter", - requestInfo); - assertSame(requestInfo, actualPrepareMdMsRequestResult.getRequestInfo()); - MdmsCriteria mdmsCriteria = actualPrepareMdMsRequestResult.getMdmsCriteria(); - assertEquals("42", mdmsCriteria.getTenantId()); - List moduleDetails = mdmsCriteria.getModuleDetails(); - assertEquals(1, moduleDetails.size()); - ModuleDetail getResult = moduleDetails.get(0); - List masterDetails = getResult.getMasterDetails(); - assertEquals(1, masterDetails.size()); - assertEquals("Module Name", getResult.getModuleName()); - MasterDetail getResult1 = masterDetails.get(0); - assertNull(getResult1.getFilter()); - assertEquals("foo", getResult1.getName()); - } - - - @Test - void testPrepareMdMsRequest3() { - - - Util util = new Util(); - - ArrayList stringList = new ArrayList<>(); - stringList.add("foo"); - stringList.add("foo"); - RequestInfo requestInfo = new RequestInfo(); - MdmsCriteriaReq actualPrepareMdMsRequestResult = util.prepareMdMsRequest("42", "Module Name", stringList, "Filter", - requestInfo); - assertSame(requestInfo, actualPrepareMdMsRequestResult.getRequestInfo()); - MdmsCriteria mdmsCriteria = actualPrepareMdMsRequestResult.getMdmsCriteria(); - assertEquals("42", mdmsCriteria.getTenantId()); - List moduleDetails = mdmsCriteria.getModuleDetails(); - assertEquals(1, moduleDetails.size()); - ModuleDetail getResult = moduleDetails.get(0); - List masterDetails = getResult.getMasterDetails(); - assertEquals(2, masterDetails.size()); - assertEquals("Module Name", getResult.getModuleName()); - MasterDetail getResult1 = masterDetails.get(1); - assertEquals("foo", getResult1.getName()); - MasterDetail getResult2 = masterDetails.get(0); - assertEquals("foo", getResult2.getName()); - assertNull(getResult2.getFilter()); - assertNull(getResult1.getFilter()); - } - - - - - @Test - void testGetAuditDetail2() { - - - Util util = new Util(); - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setUserInfo(new User()); - AuditDetails actualAuditDetail = util.getAuditDetail(requestInfo); - assertNull(actualAuditDetail.getCreatedBy()); - assertNull(actualAuditDetail.getLastModifiedBy()); - } - - @Test - void testGetAuditDetail4() { - - Util util = new Util(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getUserInfo()).thenReturn(new User()); - AuditDetails actualAuditDetail = util.getAuditDetail(requestInfo); - assertNull(actualAuditDetail.getCreatedBy()); - assertNull(actualAuditDetail.getLastModifiedBy()); - verify(requestInfo).getUserInfo(); - } - - - @Test - void testGetStringVal() { - - - Util util = new Util(); - assertEquals("", util.getStringVal(new HashSet<>())); - } - - - @Test - void testGetStringVal2() { - - - Util util = new Util(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - assertEquals("foo", util.getStringVal(stringSet)); - } - - @Test - void testGetStringVal3() { - - - Util util = new Util(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("42"); - stringSet.add("foo"); - assertEquals("foo,42", util.getStringVal(stringSet)); - } - - - - - @Test - void testGetJsonValue() { - - - Util util = new Util(); - assertNull(util.getJsonValue(new PGobject())); - } - - - @Test - void testGetJsonValue2() { - - Util util = new Util(); - assertThrows(CustomException.class, () -> util.getJsonValue(new PGInterval())); - } - - - @Test - void testGetJsonValue3() { - - assertNull((new Util()).getJsonValue(null)); - } - - - @Test - void testGetJsonValue4() { - - Util util = new Util(); - PGInterval pgInterval = mock(PGInterval.class); - when(pgInterval.getValue()).thenReturn("42"); - assertThrows(CustomException.class, () -> util.getJsonValue(pgInterval)); - verify(pgInterval, atLeast(1)).getValue(); - } - - - @Test - void testGetJsonValue5() { - - - Util util = new Util(); - PGInterval pgInterval = mock(PGInterval.class); - when(pgInterval.getValue()).thenThrow(new CustomException("Code", "An error occurred")); - assertThrows(CustomException.class, () -> util.getJsonValue(pgInterval)); - verify(pgInterval).getValue(); - } - - - - - @Test - void testGetIsAdvanceAllowed2() { - - Util util = new Util(); - DocumentContext documentContext = mock(DocumentContext.class); - when(documentContext.read((String) any(), (com.jayway.jsonpath.Predicate[]) any())).thenReturn(new ArrayList<>()); - assertThrows(CustomException.class, () -> util.getIsAdvanceAllowed("Business Service", documentContext)); - verify(documentContext).read((String) any(), (com.jayway.jsonpath.Predicate[]) any()); - } - - - - @Test - void testUpdateDemandPaymentStatus() { - - Util util = new Util(); - Demand demand = new Demand(); - util.updateDemandPaymentStatus(demand, true); - assertTrue(demand.getIsPaymentCompleted()); - } - - - - - @Test - void testUpdateDemandPaymentStatus4() { - - - Util util = new Util(); - Demand demand = mock(Demand.class); - when(demand.getDemandDetails()).thenReturn(new ArrayList<>()); - doNothing().when(demand).setIsPaymentCompleted((Boolean) any()); - util.updateDemandPaymentStatus(demand, true); - verify(demand, atLeast(1)).getDemandDetails(); - verify(demand).setIsPaymentCompleted((Boolean) any()); - } - - - @Test - void testUpdateDemandPaymentStatus5() { - - - Util util = new Util(); - Demand demand = mock(Demand.class); - when(demand.getDemandDetails()).thenReturn(new ArrayList<>()); - doNothing().when(demand).setIsPaymentCompleted((Boolean) any()); - util.updateDemandPaymentStatus(demand, false); - verify(demand, atLeast(1)).getDemandDetails(); - } - - - @Test - void testUpdateDemandPaymentStatus6() { - - Util util = new Util(); - - DemandDetail demandDetail = new DemandDetail(); - demandDetail.setTaxAmount(BigDecimal.valueOf(42L)); - ArrayList demandDetailList = new ArrayList<>(); - demandDetailList.add(demandDetail); - Demand demand = mock(Demand.class); - when(demand.getDemandDetails()).thenReturn(demandDetailList); - doNothing().when(demand).setIsPaymentCompleted((Boolean) any()); - util.updateDemandPaymentStatus(demand, true); - verify(demand, atLeast(1)).getDemandDetails(); - verify(demand).setIsPaymentCompleted((Boolean) any()); - } - - - @Test - void testValidateTenantIdForUserType3() { - Util util = new Util(); - User user = new User(); - user.setRoles(new ArrayList<>()); - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setUserInfo(user); - util.validateTenantIdForUserType("42", requestInfo); - assertSame(user, requestInfo.getUserInfo()); - } - - - @Test - void testValidateTenantIdForUserType4() { - Util util = new Util(); - User user = mock(User.class); - when(user.getType()).thenReturn("Type"); - when(user.getRoles()).thenReturn(new ArrayList<>()); - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setUserInfo(user); - util.validateTenantIdForUserType("42", requestInfo); - verify(user).getType(); - verify(user).getRoles(); - } - - - @Test - void testValidateTenantIdForUserType5() { - - Util util = new Util(); - User user = mock(User.class); - when(user.getType()).thenReturn(Constants.EMPLOYEE_TYPE_CODE); - when(user.getRoles()).thenReturn(new ArrayList<>()); - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setUserInfo(user); - util.validateTenantIdForUserType("42", requestInfo); - verify(user).getType(); - verify(user).getRoles(); - } - - - @Test - void testValidateTenantIdForUserType6() { - - Util util = new Util(); - - ArrayList roleList = new ArrayList<>(); - roleList.add(new Role()); - User user = mock(User.class); - when(user.getType()).thenReturn("Type"); - when(user.getRoles()).thenReturn(roleList); - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setUserInfo(user); - util.validateTenantIdForUserType("42", requestInfo); - verify(user).getType(); - verify(user).getRoles(); - } - - - - - @Test - void testJsonMerge() { - - - Util util = new Util(); - MissingNode mainNode = MissingNode.getInstance(); - MissingNode instance = MissingNode.getInstance(); - assertSame(instance, util.jsonMerge(mainNode, instance)); - } - - - @Test - void testJsonMerge2() { - - - Util util = new Util(); - MissingNode instance = MissingNode.getInstance(); - assertSame(instance, util.jsonMerge(null, instance)); - } - - @Test - void testJsonMerge3() { - - Util util = new Util(); - ArrayNode arrayNode = mock(ArrayNode.class); - when(arrayNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - util.jsonMerge(arrayNode, MissingNode.getInstance()); - verify(arrayNode).getNodeType(); - } - - - @Test - void testJsonMerge4() { - - Util util = new Util(); - ArrayNode arrayNode = mock(ArrayNode.class); - when(arrayNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - util.jsonMerge(arrayNode, null); - verify(arrayNode).getNodeType(); - } - - @Test - void testJsonMerge5() { - - Util util = new Util(); - ArrayNode arrayNode = mock(ArrayNode.class); - when(arrayNode.get((String) any())).thenReturn(MissingNode.getInstance()); - when(arrayNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - ArrayNode arrayNode1 = mock(ArrayNode.class); - when(arrayNode1.getNodeType()).thenReturn(JsonNodeType.ARRAY); - when(arrayNode1.fieldNames()).thenReturn(new Scanner("Source")); - util.jsonMerge(arrayNode, arrayNode1); - verify(arrayNode).get((String) any()); - verify(arrayNode).getNodeType(); - verify(arrayNode1).getNodeType(); - verify(arrayNode1).fieldNames(); - } - - - @Test - void testJsonMerge6() { - - Util util = new Util(); - ArrayNode arrayNode = mock(ArrayNode.class); - when(arrayNode.get((String) any())).thenThrow(new CustomException("Code", "An error occurred")); - when(arrayNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - ArrayNode arrayNode1 = mock(ArrayNode.class); - when(arrayNode1.getNodeType()).thenReturn(JsonNodeType.ARRAY); - when(arrayNode1.fieldNames()).thenReturn(new Scanner("Source")); - assertThrows(CustomException.class, () -> util.jsonMerge(arrayNode, arrayNode1)); - verify(arrayNode).get((String) any()); - verify(arrayNode).getNodeType(); - verify(arrayNode1).getNodeType(); - verify(arrayNode1).fieldNames(); - } - - - @Test - void testJsonMerge7() { - - Util util = new Util(); - ArrayNode arrayNode = mock(ArrayNode.class); - when(arrayNode.get((String) any())).thenReturn(null); - when(arrayNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - ArrayNode arrayNode1 = mock(ArrayNode.class); - when(arrayNode1.getNodeType()).thenReturn(JsonNodeType.ARRAY); - when(arrayNode1.fieldNames()).thenReturn(new Scanner("Source")); - util.jsonMerge(arrayNode, arrayNode1); - verify(arrayNode).get((String) any()); - verify(arrayNode).getNodeType(); - verify(arrayNode1).getNodeType(); - verify(arrayNode1).fieldNames(); - } - - - @Test - void testJsonMerge8() { - - - Util util = new Util(); - JsonNode jsonNode = mock(JsonNode.class); - when(jsonNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - when(jsonNode.isObject()).thenReturn(true); - ArrayNode arrayNode = mock(ArrayNode.class); - when(arrayNode.get((String) any())).thenReturn(jsonNode); - when(arrayNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - ArrayNode arrayNode1 = mock(ArrayNode.class); - when(arrayNode1.get((String) any())).thenReturn(MissingNode.getInstance()); - when(arrayNode1.getNodeType()).thenReturn(JsonNodeType.ARRAY); - when(arrayNode1.fieldNames()).thenReturn(new Scanner("Source")); - util.jsonMerge(arrayNode, arrayNode1); - verify(arrayNode).get((String) any()); - verify(arrayNode).getNodeType(); - verify(jsonNode).getNodeType(); - verify(jsonNode).isObject(); - verify(arrayNode1).get((String) any()); - verify(arrayNode1).getNodeType(); - verify(arrayNode1).fieldNames(); - } - - @Test - void testJsonMerge9() { - - Util util = new Util(); - JsonNode jsonNode = mock(JsonNode.class); - when(jsonNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - when(jsonNode.isObject()).thenReturn(true); - ArrayNode arrayNode = mock(ArrayNode.class); - when(arrayNode.get((String) any())).thenReturn(jsonNode); - when(arrayNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - ArrayNode arrayNode1 = mock(ArrayNode.class); - when(arrayNode1.get((String) any())).thenThrow(new CustomException("Code", "An error occurred")); - when(arrayNode1.getNodeType()).thenReturn(JsonNodeType.ARRAY); - when(arrayNode1.fieldNames()).thenReturn(new Scanner("Source")); - assertThrows(CustomException.class, () -> util.jsonMerge(arrayNode, arrayNode1)); - verify(arrayNode).get((String) any()); - verify(arrayNode).getNodeType(); - verify(jsonNode).isObject(); - verify(arrayNode1).get((String) any()); - verify(arrayNode1).getNodeType(); - verify(arrayNode1).fieldNames(); - } - - @Test - void testJsonMerge10() { - - - Util util = new Util(); - ArrayNode arrayNode = mock(ArrayNode.class); - when(arrayNode.get((String) any())).thenReturn(mock(JsonNode.class)); - when(arrayNode.getNodeType()).thenReturn(JsonNodeType.ARRAY); - ArrayNode arrayNode1 = mock(ArrayNode.class); - when(arrayNode1.get((String) any())).thenReturn(MissingNode.getInstance()); - when(arrayNode1.getNodeType()).thenReturn(JsonNodeType.ARRAY); - when(arrayNode1.fieldNames()).thenReturn(MappingIterator.emptyIterator()); - util.jsonMerge(arrayNode, arrayNode1); - verify(arrayNode).getNodeType(); - verify(arrayNode1).getNodeType(); - verify(arrayNode1).fieldNames(); - } - - - - @Test - void testGetIdsQueryForList() { - - Util util = new Util(); - HashSet ownerIds = new HashSet<>(); - assertEquals("()", util.getIdsQueryForList(ownerIds, new ArrayList<>())); - } - - @Test - void testGetIdsQueryForList2() { - - Util util = new Util(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("("); - ArrayList objectList = new ArrayList<>(); - assertEquals("( ?)", util.getIdsQueryForList(stringSet, objectList)); - assertEquals(1, objectList.size()); - } - - @Test - void testGetIdsQueryForList3() { - - Util util = new Util(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - stringSet.add("("); - ArrayList objectList = new ArrayList<>(); - assertEquals("( ?, ?)", util.getIdsQueryForList(stringSet, objectList)); - assertEquals(2, objectList.size()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/util/migration/DemandMigrationTest.java b/business-services/billing-service/src/test/java/org/egov/demand/util/migration/DemandMigrationTest.java deleted file mode 100644 index e50f6d6630b..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/util/migration/DemandMigrationTest.java +++ /dev/null @@ -1,136 +0,0 @@ -package org.egov.demand.util.migration; - -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.repository.DemandRepository; -import org.egov.demand.repository.rowmapper.DemandRowMapper; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - - -@SpringBootTest -public class DemandMigrationTest { - - @Autowired - private DemandMigration demandMigration; - - @Mock - private DemandMigration demandMigration1; - - - - @Test - @DisplayName("Should apportion the demand details when the tax amount is negative") - public void testMigrateToV1WhenTaxAmountIsNegativeThenApportionDemandDetails() { - - Demand demand = Demand.builder() - .id("1") - .businessService("TL") - .minimumAmountPayable(BigDecimal.valueOf(100)) - .demandDetails(Arrays.asList( - DemandDetail.builder() - .id("1") - .taxAmount(BigDecimal.valueOf(-100)) - .collectionAmount(BigDecimal.valueOf(100)) - .build(), - DemandDetail.builder() - .id("2") - .taxAmount(BigDecimal.valueOf(-50)) - .collectionAmount(BigDecimal.valueOf(50)) - .build())) - .build(); - - List demands = Arrays.asList(demand); - - - assertEquals(BigDecimal.valueOf(-100), demands.get(0).getDemandDetails().get(0).getTaxAmount()); - assertEquals(BigDecimal.valueOf(100), demands.get(0).getDemandDetails().get(0).getCollectionAmount()); - - assertEquals(BigDecimal.valueOf(-50), demands.get(0).getDemandDetails().get(1).getTaxAmount()); - assertEquals(BigDecimal.valueOf(50), demands.get(0).getDemandDetails().get(1).getCollectionAmount()); - } - - @Test - @DisplayName("Should apportion the demand details when the tax amount is positive") - public void testMigrateToV1WhenTaxAmountIsPositiveThenApportionDemandDetails() { - - Demand demand = Demand.builder() - .id("1") - .demandDetails(Arrays.asList( - DemandDetail.builder() - .taxAmount(BigDecimal.valueOf(100)) - .collectionAmount(BigDecimal.valueOf(100)) - .build(), - DemandDetail.builder() - .taxAmount(BigDecimal.valueOf(-50)) - .collectionAmount(BigDecimal.valueOf(50)) - .build(), - DemandDetail.builder() - .taxAmount(BigDecimal.valueOf(-50)) - .collectionAmount(BigDecimal.valueOf(50)) - .build())) - .build(); - - List demands = Arrays.asList(demand); - - - assertEquals(BigDecimal.valueOf(100), demands.get(0).getDemandDetails().get(0).getCollectionAmount()); - assertEquals(BigDecimal.valueOf(50), demands.get(0).getDemandDetails().get(1).getCollectionAmount()); - assertEquals(BigDecimal.valueOf(50), demands.get(0).getDemandDetails().get(2).getCollectionAmount()); - } - - @Test - @DisplayName("Should create a comparator with the given order") - public void testCreateDemadDetailComparatorShouldCreateComparatorWithGivenOrder() { - - - demandMigration.createDemadDetailComparator(); - - List demandDetails = new ArrayList<>(); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_DECIMAL_CEILING_CREDIT").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_DECIMAL_CEILING_DEBIT").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_ROUNDOFF").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_TAX").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_TIME_INTEREST").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_TIME_PENALTY").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_ADHOC_PENALTY").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_FIRE_CESS").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_CANCER_CESS").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_TIME_REBATE").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_ADHOC_REBATE").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_OWNER_EXEMPTION").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_ADVANCE_CARRYFORWARD").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("PT_UNIT_USAGE_EXEMPTION").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("TL_TAX").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("TL_ROUNDOFF").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("TL_ADHOC_REBATE").build()); - demandDetails.add(DemandDetail.builder().taxHeadMasterCode("TL_ADHOC_PENALTY").build()); - - - assertEquals("PT_DECIMAL_CEILING_CREDIT", demandDetails.get(0).getTaxHeadMasterCode()); - assertEquals("PT_DECIMAL_CEILING_DEBIT", demandDetails.get(1).getTaxHeadMasterCode()); - assertEquals("PT_ROUNDOFF", demandDetails.get(2).getTaxHeadMasterCode()); - assertEquals("PT_TAX", demandDetails.get(3).getTaxHeadMasterCode()); - - assertEquals("PT_TIME_INTEREST", demandDetails.get(4).getTaxHeadMasterCode()); - assertEquals("PT_TIME_PENALTY", demandDetails.get(5).getTaxHeadMasterCode()); - assertEquals("PT_ADHOC_PENALTY", demandDetails.get(6).getTaxHeadMasterCode()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/contract/factory/ResponseFactoryTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/contract/factory/ResponseFactoryTest.java deleted file mode 100644 index 5934bd5ea10..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/contract/factory/ResponseFactoryTest.java +++ /dev/null @@ -1,493 +0,0 @@ -package org.egov.demand.web.contract.factory; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.Error; -import org.egov.common.contract.response.ErrorResponse; -import org.egov.common.contract.response.ResponseInfo; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {ResponseFactory.class}) -@ExtendWith(SpringExtension.class) -class ResponseFactoryTest { - @Autowired - private ResponseFactory responseFactory; - - @Test - void testGetResponseInfo() { - ResponseFactory responseFactory = new ResponseFactory(); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(new RequestInfo(), HttpStatus.CONTINUE); - assertNull(actualResponseInfo.getApiId()); - assertNull(actualResponseInfo.getVer()); - assertNull(actualResponseInfo.getTs()); - assertEquals("100 CONTINUE", actualResponseInfo.getStatus()); - assertNull(actualResponseInfo.getMsgId()); - } - - - @Test - void testGetResponseInfo2() { - - - (new ResponseFactory()).getResponseInfo(null, HttpStatus.CONTINUE); - } - - - @Test - void testGetResponseInfo3() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.CONTINUE); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("100 CONTINUE", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - - @Test - void testGetResponseInfo5() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.SWITCHING_PROTOCOLS); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("101 SWITCHING_PROTOCOLS", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo6() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.PROCESSING); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("102 PROCESSING", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo7() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.CHECKPOINT); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("103 CHECKPOINT", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo8() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.OK); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("200 OK", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo9() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.CREATED); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("201 CREATED", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - @Test - void testGetResponseInfo10() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.ACCEPTED); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("202 ACCEPTED", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo11() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, - HttpStatus.NON_AUTHORITATIVE_INFORMATION); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("203 NON_AUTHORITATIVE_INFORMATION", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - @Test - void testGetResponseInfo12() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.NO_CONTENT); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("204 NO_CONTENT", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - @Test - void testGetResponseInfo13() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.RESET_CONTENT); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("205 RESET_CONTENT", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo14() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.PARTIAL_CONTENT); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("206 PARTIAL_CONTENT", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo15() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.MULTI_STATUS); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("207 MULTI_STATUS", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo16() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.ALREADY_REPORTED); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("208 ALREADY_REPORTED", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo17() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.IM_USED); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("226 IM_USED", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo18() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.MULTIPLE_CHOICES); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("300 MULTIPLE_CHOICES", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo19() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.MOVED_PERMANENTLY); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("301 MOVED_PERMANENTLY", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetResponseInfo20() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.FOUND); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("302 FOUND", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - @Test - void testGetResponseInfo21() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.MOVED_TEMPORARILY); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("302 MOVED_TEMPORARILY", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - @Test - void testGetResponseInfo22() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ResponseInfo actualResponseInfo = responseFactory.getResponseInfo(requestInfo, HttpStatus.SEE_OTHER); - assertEquals("42", actualResponseInfo.getApiId()); - assertEquals("Ver", actualResponseInfo.getVer()); - assertEquals(1L, actualResponseInfo.getTs().longValue()); - assertEquals("303 SEE_OTHER", actualResponseInfo.getStatus()); - assertEquals("42", actualResponseInfo.getMsgId()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } - - - @Test - void testGetErrorResponse() { - ResponseFactory responseFactory = new ResponseFactory(); - ErrorResponse actualErrorResponse = responseFactory.getErrorResponse(new RequestInfo()); - Error error = actualErrorResponse.getError(); - assertEquals("EG_BS_API_ERROR", error.getMessage()); - ResponseInfo responseInfo = actualErrorResponse.getResponseInfo(); - assertNull(responseInfo.getVer()); - assertNull(responseInfo.getTs()); - assertEquals("400 BAD_REQUEST", responseInfo.getStatus()); - assertNull(responseInfo.getMsgId()); - assertNull(responseInfo.getApiId()); - assertEquals("The API you are trying to access has been depricated, Access the V2 API's", error.getDescription()); - assertEquals(400, error.getCode()); - } - - - @Test - void testGetErrorResponse2() { - Error error = (new ResponseFactory()).getErrorResponse(null).getError(); - assertEquals("EG_BS_API_ERROR", error.getMessage()); - assertEquals("The API you are trying to access has been depricated, Access the V2 API's", error.getDescription()); - assertEquals(400, error.getCode()); - } - - @Test - void testGetErrorResponse3() { - ResponseFactory responseFactory = new ResponseFactory(); - RequestInfo requestInfo = mock(RequestInfo.class); - when(requestInfo.getTs()).thenReturn(1L); - when(requestInfo.getApiId()).thenReturn("42"); - when(requestInfo.getMsgId()).thenReturn("42"); - when(requestInfo.getVer()).thenReturn("Ver"); - ErrorResponse actualErrorResponse = responseFactory.getErrorResponse(requestInfo); - Error error = actualErrorResponse.getError(); - assertEquals("EG_BS_API_ERROR", error.getMessage()); - ResponseInfo responseInfo = actualErrorResponse.getResponseInfo(); - assertEquals("Ver", responseInfo.getVer()); - assertEquals(1L, responseInfo.getTs().longValue()); - assertEquals("400 BAD_REQUEST", responseInfo.getStatus()); - assertEquals("42", responseInfo.getMsgId()); - assertEquals("42", responseInfo.getApiId()); - assertEquals("The API you are trying to access has been depricated, Access the V2 API's", error.getDescription()); - assertEquals(400, error.getCode()); - verify(requestInfo).getTs(); - verify(requestInfo).getApiId(); - verify(requestInfo).getMsgId(); - verify(requestInfo).getVer(); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/AmendmentControllerTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/controller/AmendmentControllerTest.java deleted file mode 100644 index 6162cf9643b..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/AmendmentControllerTest.java +++ /dev/null @@ -1,370 +0,0 @@ -package org.egov.demand.web.controller; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.MissingNode; - -import java.util.ArrayList; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.amendment.model.Amendment; -import org.egov.demand.amendment.model.AmendmentRequest; -import org.egov.demand.amendment.model.AmendmentUpdate; -import org.egov.demand.amendment.model.AmendmentUpdateRequest; -import org.egov.demand.amendment.model.Document; -import org.egov.demand.amendment.model.ProcessInstance; -import org.egov.demand.amendment.model.enums.AmendmentReason; -import org.egov.demand.amendment.model.enums.AmendmentStatus; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.service.AmendmentService; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -@SpringBootTest -@AutoConfigureMockMvc -@ExtendWith(SpringExtension.class) -class AmendmentControllerTest { - @Autowired - private AmendmentController amendmentController; - - @MockBean - private AmendmentService amendmentService; - - - @Autowired - private MockMvc mockMvc; - - - @Test - public void AmendmentPostSuccess() throws Exception { - AmendmentRequest amendmentRequest = new AmendmentRequest(); - ProcessInstance workflow = new ProcessInstance(); - ArrayList demandDetails = new ArrayList<>(); - ArrayList documents = new ArrayList<>(); - AuditDetails auditDetails = new AuditDetails(); - amendmentRequest.setAmendment(new Amendment("42", "42", "42", "?", "42", "?", AmendmentReason.COURT_CASE_SETTLEMENT, - "Just cause", AmendmentStatus.ACTIVE, workflow, demandDetails, documents, 1L, 1L, auditDetails, - MissingNode.getInstance())); - ObjectMapper objectMapper = new ObjectMapper(); - String Json = objectMapper.writeValueAsString(amendmentRequest); - - mockMvc.perform(post("/amendment/_create") - .accept(MediaType.APPLICATION_JSON).content(Json) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().is(400)); - } - - @Test - public void AmendmentPostFailure() throws Exception { - mockMvc.perform(post("/amendment/_create").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - - - @Test - public void AmendmentSearchSuccess() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - ObjectMapper objectMapper = new ObjectMapper(); - String Json = objectMapper.writeValueAsString(requestInfoWrapper); - mockMvc.perform(post("/amendment/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(Json)); - } - @Test - public void amendmentSearchFailure() throws Exception { - mockMvc.perform(post("/amendment/_search").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - - @Test - public void AmendmentUpdateSuccess() throws Exception { - AmendmentUpdateRequest amendmentUpdateRequest = new AmendmentUpdateRequest(); - AuditDetails auditDetails = new AuditDetails(); - MissingNode additionalDetails = MissingNode.getInstance(); - ProcessInstance workflow = new ProcessInstance(); - amendmentUpdateRequest.setAmendmentUpdate(new AmendmentUpdate("42", "42", "42", auditDetails, additionalDetails, - workflow, AmendmentStatus.ACTIVE, new ArrayList<>())); - amendmentUpdateRequest.setRequestInfo(new RequestInfo()); - ObjectMapper objectMapper = new ObjectMapper(); - String Json = objectMapper.writeValueAsString(amendmentUpdateRequest); - - mockMvc.perform(post("/amendment/_update") - .contentType(MediaType.APPLICATION_JSON) - .content(Json)); - } - - @Test - public void amendmentUpdateFailure() throws Exception { - mockMvc.perform(post("/amendment/_update").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - - - @Test - void testCreateWith400Code() throws Exception { - AmendmentRequest amendmentRequest = new AmendmentRequest(); - amendmentRequest.setAmendment(new Amendment()); - amendmentRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(amendmentRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/amendment/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.amendmentController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - - - @Test - void testCreateWithSucess() throws Exception { - when(this.amendmentService.create((AmendmentRequest) any())).thenReturn(new Amendment()); - - AmendmentRequest amendmentRequest = new AmendmentRequest(); - ProcessInstance workflow = new ProcessInstance(); - ArrayList demandDetails = new ArrayList<>(); - ArrayList documents = new ArrayList<>(); - AuditDetails auditDetails = new AuditDetails(); - amendmentRequest.setAmendment(new Amendment("42", "42", "42", "?", "42", "?", AmendmentReason.COURT_CASE_SETTLEMENT, - "Just cause", AmendmentStatus.ACTIVE, workflow, demandDetails, documents, 1L, 1L, auditDetails, - MissingNode.getInstance())); - amendmentRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(amendmentRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/amendment/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.amendmentController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().isCreated()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"ResponseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"201" - + " CREATED\"},\"Amendments\":[{\"id\":null,\"amendedDemandId\":null,\"tenantId\":null,\"consumerCode\":null," - + "\"amendmentId\":null,\"businessService\":null,\"amendmentReason\":null,\"reasonDocumentNumber\":null,\"status" - + "\":null,\"workflow\":null,\"demandDetails\":null,\"documents\":null,\"effectiveFrom\":null,\"effectiveTill\":null" - + ",\"auditDetails\":null,\"additionalDetails\":null}]}")); - } - - @Test - void testCreateSuccessWithRequestInfo() throws Exception { - ProcessInstance workflow = new ProcessInstance(); - ArrayList demandDetails = new ArrayList<>(); - ArrayList documents = new ArrayList<>(); - AuditDetails auditDetails = new AuditDetails(); - when(this.amendmentService.create((AmendmentRequest) any())).thenReturn(new Amendment("42", "42", "42", "?", "42", - "?", AmendmentReason.COURT_CASE_SETTLEMENT, "Just cause", AmendmentStatus.ACTIVE, workflow, demandDetails, - documents, 6L, 6L, auditDetails, MissingNode.getInstance())); - - AmendmentRequest amendmentRequest = new AmendmentRequest(); - ProcessInstance workflow1 = new ProcessInstance(); - ArrayList demandDetails1 = new ArrayList<>(); - ArrayList documents1 = new ArrayList<>(); - AuditDetails auditDetails1 = new AuditDetails(); - amendmentRequest.setAmendment(new Amendment("42", "42", "42", "?", "42", "?", AmendmentReason.COURT_CASE_SETTLEMENT, - "Just cause", AmendmentStatus.ACTIVE, workflow1, demandDetails1, documents1, 1L, 1L, auditDetails1, - MissingNode.getInstance())); - amendmentRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(amendmentRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/amendment/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.amendmentController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().isCreated()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"ResponseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"201" - + " CREATED\"},\"Amendments\":[{\"id\":\"42\",\"amendedDemandId\":\"42\",\"tenantId\":\"42\",\"consumerCode\":\"?\",\"amendmentId" - + "\":\"42\",\"businessService\":\"?\",\"amendmentReason\":\"COURT_CASE_SETTLEMENT\",\"reasonDocumentNumber\":\"Just" - + " cause\",\"status\":\"ACTIVE\",\"workflow\":{\"id\":null,\"tenantId\":null,\"businessService\":null,\"businessId\"" - + ":null,\"action\":null,\"moduleName\":null,\"state\":null,\"comment\":null,\"documents\":null,\"assigner\":null," - + "\"assignes\":null,\"nextActions\":null,\"stateSla\":null,\"businesssServiceSla\":null,\"previousStatus\":null," - + "\"entity\":null,\"auditDetails\":null},\"demandDetails\":[],\"documents\":[],\"effectiveFrom\":6,\"effectiveTill" - + "\":6,\"auditDetails\":{\"createdBy\":null,\"lastModifiedBy\":null,\"createdTime\":null,\"lastModifiedTime\":null" - + "},\"additionalDetails\":null}]}")); - } - - - @Test - void testSearchWith400Code() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/amendment/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.amendmentController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - @Test - void testUpdateWith400Code() throws Exception { - AmendmentUpdateRequest amendmentUpdateRequest = new AmendmentUpdateRequest(); - amendmentUpdateRequest.setAmendmentUpdate(new AmendmentUpdate()); - amendmentUpdateRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(amendmentUpdateRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/amendment/_update") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.amendmentController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - @Test - void testUpdateSucess() throws Exception { - when(this.amendmentService.updateAmendment((AmendmentUpdateRequest) any())).thenReturn(new Amendment()); - - AmendmentUpdateRequest amendmentUpdateRequest = new AmendmentUpdateRequest(); - AuditDetails auditDetails = new AuditDetails(); - MissingNode additionalDetails = MissingNode.getInstance(); - ProcessInstance workflow = new ProcessInstance(); - amendmentUpdateRequest.setAmendmentUpdate(new AmendmentUpdate("42", "42", "42", auditDetails, additionalDetails, - workflow, AmendmentStatus.ACTIVE, new ArrayList<>())); - amendmentUpdateRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(amendmentUpdateRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/amendment/_update") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - MockMvcBuilders.standaloneSetup(this.amendmentController) - .build() - .perform(requestBuilder) - .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"ResponseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"200" - + " OK\"},\"Amendments\":[{\"id\":null,\"amendedDemandId\":null,\"tenantId\":null,\"consumerCode\":null,\"amendmentId" - + "\":null,\"businessService\":null,\"amendmentReason\":null,\"reasonDocumentNumber\":null,\"status\":null,\"workflow" - + "\":null,\"demandDetails\":null,\"documents\":null,\"effectiveFrom\":null,\"effectiveTill\":null,\"auditDetails" - + "\":null,\"additionalDetails\":null}]}")); - } - - - @Test - void testUpdateSucesswithExpectdString() throws Exception { - ProcessInstance workflow = new ProcessInstance(); - ArrayList demandDetails = new ArrayList<>(); - ArrayList documents = new ArrayList<>(); - AuditDetails auditDetails = new AuditDetails(); - when(this.amendmentService.updateAmendment((AmendmentUpdateRequest) any())).thenReturn(new Amendment("42", "42", - "42", "?", "42", "?", AmendmentReason.COURT_CASE_SETTLEMENT, "Just cause", AmendmentStatus.ACTIVE, workflow, - demandDetails, documents, 4L, 4L, auditDetails, MissingNode.getInstance())); - - AmendmentUpdateRequest amendmentUpdateRequest = new AmendmentUpdateRequest(); - AuditDetails auditDetails1 = new AuditDetails(); - MissingNode additionalDetails = MissingNode.getInstance(); - ProcessInstance workflow1 = new ProcessInstance(); - amendmentUpdateRequest.setAmendmentUpdate(new AmendmentUpdate("42", "42", "42", auditDetails1, additionalDetails, - workflow1, AmendmentStatus.ACTIVE, new ArrayList<>())); - amendmentUpdateRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(amendmentUpdateRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/amendment/_update") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - MockMvcBuilders.standaloneSetup(this.amendmentController) - .build() - .perform(requestBuilder) - .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"ResponseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"200" - + " OK\"},\"Amendments\":[{\"id\":\"42\",\"amendedDemandId\":\"42\",\"tenantId\":\"42\",\"consumerCode\":\"?\",\"amendmentId" - + "\":\"42\",\"businessService\":\"?\",\"amendmentReason\":\"COURT_CASE_SETTLEMENT\",\"reasonDocumentNumber\":\"Just" - + " cause\",\"status\":\"ACTIVE\",\"workflow\":{\"id\":null,\"tenantId\":null,\"businessService\":null,\"businessId\"" - + ":null,\"action\":null,\"moduleName\":null,\"state\":null,\"comment\":null,\"documents\":null,\"assigner\":null," - + "\"assignes\":null,\"nextActions\":null,\"stateSla\":null,\"businesssServiceSla\":null,\"previousStatus\":null," - + "\"entity\":null,\"auditDetails\":null},\"demandDetails\":[],\"documents\":[],\"effectiveFrom\":4,\"effectiveTill" - + "\":4,\"auditDetails\":{\"createdBy\":null,\"lastModifiedBy\":null,\"createdTime\":null,\"lastModifiedTime\":null" - + "},\"additionalDetails\":null}]}")); - } - - - @Test - void testUpdateSucessWithRequestInfo() throws Exception { - when(this.amendmentService.updateAmendment((AmendmentUpdateRequest) any())).thenReturn(new Amendment()); - - AmendmentUpdateRequest amendmentUpdateRequest = new AmendmentUpdateRequest(); - AuditDetails auditDetails = new AuditDetails(); - MissingNode additionalDetails = MissingNode.getInstance(); - ProcessInstance workflow = new ProcessInstance(); - amendmentUpdateRequest.setAmendmentUpdate(new AmendmentUpdate("42", "42", "42", auditDetails, additionalDetails, - workflow, AmendmentStatus.INACTIVE, new ArrayList<>())); - amendmentUpdateRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(amendmentUpdateRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/amendment/_update") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - MockMvcBuilders.standaloneSetup(this.amendmentController) - .build() - .perform(requestBuilder) - .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"ResponseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"200" - + " OK\"},\"Amendments\":[{\"id\":null,\"amendedDemandId\":null,\"tenantId\":null,\"consumerCode\":null,\"amendmentId" - + "\":null,\"businessService\":null,\"amendmentReason\":null,\"reasonDocumentNumber\":null,\"status\":null,\"workflow" - + "\":null,\"demandDetails\":null,\"documents\":null,\"effectiveFrom\":null,\"effectiveTill\":null,\"auditDetails" - + "\":null,\"additionalDetails\":null}]}")); - } - - - @Test - void testUpdateError() throws Exception { - when(this.amendmentService.updateAmendment((AmendmentUpdateRequest) any())).thenReturn(new Amendment()); - - ArrayList documentList = new ArrayList<>(); - documentList.add(new Document()); - AuditDetails auditDetails = new AuditDetails(); - MissingNode additionalDetails = MissingNode.getInstance(); - AmendmentUpdate amendmentUpdate = new AmendmentUpdate("42", "42", "42", auditDetails, additionalDetails, - new ProcessInstance(), AmendmentStatus.ACTIVE, documentList); - - AmendmentUpdateRequest amendmentUpdateRequest = new AmendmentUpdateRequest(); - amendmentUpdateRequest.setAmendmentUpdate(amendmentUpdate); - amendmentUpdateRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(amendmentUpdateRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/amendment/_update") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.amendmentController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/BillControllerTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/controller/BillControllerTest.java deleted file mode 100644 index 9d6b03e9cf1..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/BillControllerTest.java +++ /dev/null @@ -1,339 +0,0 @@ -package org.egov.demand.web.controller; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.util.ArrayList; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.web.contract.BillRequest; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.MediaType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@SpringBootTest -@AutoConfigureMockMvc -@ExtendWith(SpringExtension.class) -class BillControllerTest { - @Autowired - private BillController billController; - - @Autowired - private MockMvc mockMvc; - - - - - @Test - public void BillPostFailure() throws Exception { - mockMvc.perform(post("/bill/_create").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - @Test - public void FetchBillPostFailure() throws Exception { - mockMvc.perform(post("/bill/_fetchbill").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - @Test - public void GenerateBillPostFailure() throws Exception { - mockMvc.perform(post("/amendment/_create").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - @Test - public void SearchBillPostFailure() throws Exception { - mockMvc.perform(post("/bill/_search").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - - @Test - void testCreate() throws Exception { - BillRequest billRequest = new BillRequest(); - billRequest.setBills(new ArrayList<>()); - billRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(billRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"400" - + " BAD_REQUEST\"},\"error\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying" - + " to access has been depricated, Access the V2 API's\",\"fields\":null}}")); - } - - - @Test - void testCreateWithError400() throws Exception { - BillRequest billRequest = new BillRequest(); - billRequest.setBills(new ArrayList<>()); - billRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(billRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_create", "Uri Vars") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"400" - + " BAD_REQUEST\"},\"error\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying" - + " to access has been depricated, Access the V2 API's\",\"fields\":null}}")); - } - - - @Test - void testCreateWithNull() throws Exception { - BillRequest billRequest = new BillRequest(); - billRequest.setBills(new ArrayList<>()); - billRequest.setRequestInfo(null); - String content = (new ObjectMapper()).writeValueAsString(billRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":null},\"error" - + "\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying to access has been" - + " depricated, Access the V2 API's\",\"fields\":null}}")); - } - - - @Test - void testCreate4() throws Exception { - BillRequest billRequest = new BillRequest(); - billRequest.setBills(new ArrayList<>()); - billRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(billRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"400" - + " BAD_REQUEST\"},\"error\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying" - + " to access has been depricated, Access the V2 API's\",\"fields\":null}}")); - } - - - @Test - void testCreate5() throws Exception { - BillRequest billRequest = new BillRequest(); - billRequest.setBills(new ArrayList<>()); - billRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(billRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_create", "Uri Vars") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"400" - + " BAD_REQUEST\"},\"error\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying" - + " to access has been depricated, Access the V2 API's\",\"fields\":null}}")); - } - - - @Test - void testCreate6() throws Exception { - BillRequest billRequest = new BillRequest(); - billRequest.setBills(new ArrayList<>()); - billRequest.setRequestInfo(null); - String content = (new ObjectMapper()).writeValueAsString(billRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":null},\"error" - + "\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying to access has been" - + " depricated, Access the V2 API's\",\"fields\":null}}")); - } - - - @Test - void testFetchBill() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_fetchbill") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - - @Test - void testFetchBill2() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_fetchbill") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - - @Test - void testGenrateBill() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_generate") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - - @Test - void testGenrateBill2() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_generate") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - @Test - void testSearch() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"400" - + " BAD_REQUEST\"},\"error\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying" - + " to access has been depricated, Access the V2 API's\",\"fields\":null}}")); - } - - @Test - void testSearch2() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(null); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":null},\"error" - + "\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying to access has been" - + " depricated, Access the V2 API's\",\"fields\":null}}")); - } - - @Test - void testSearch3() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"400" - + " BAD_REQUEST\"},\"error\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying" - + " to access has been depricated, Access the V2 API's\",\"fields\":null}}")); - } - - @Test - void testSearch4() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(null); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"responseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":null},\"error" - + "\":{\"code\":400,\"message\":\"EG_BS_API_ERROR\",\"description\":\"The API you are trying to access has been" - + " depricated, Access the V2 API's\",\"fields\":null}}")); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/BillControllerv2Test.java b/business-services/billing-service/src/test/java/org/egov/demand/web/controller/BillControllerv2Test.java deleted file mode 100644 index 93776beb582..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/BillControllerv2Test.java +++ /dev/null @@ -1,247 +0,0 @@ -package org.egov.demand.web.controller; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.MissingNode; - -import java.util.ArrayList; - -import java.util.HashSet; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.helper.BillHelperV2; -import org.egov.demand.model.BillV2; -import org.egov.demand.model.UpdateBillCriteria; -import org.egov.demand.model.UpdateBillRequest; -import org.egov.demand.service.BillServicev2; -import org.egov.demand.web.contract.BillRequestV2; -import org.egov.demand.web.contract.BillResponseV2; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.egov.demand.web.validator.BillValidator; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -@ContextConfiguration(classes = {BillControllerv2.class, ResponseFactory.class}) -@ExtendWith(SpringExtension.class) -class BillControllerv2Test { - @Autowired - private BillControllerv2 billControllerv2; - - @MockBean - private BillHelperV2 billHelperV2; - - @MockBean - private BillServicev2 billServicev2; - - @MockBean - private BillValidator billValidator; - - @Test - void testCancelBillFail() throws Exception { - UpdateBillRequest updateBillRequest = new UpdateBillRequest(); - updateBillRequest.setRequestInfo(new RequestInfo()); - updateBillRequest.setUpdateBillCriteria(new UpdateBillCriteria()); - String content = (new ObjectMapper()).writeValueAsString(updateBillRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_cancelbill") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - @Test - void testCancelBillSucessfullyCancleActiveBill() throws Exception { - when(this.billServicev2.cancelBill((UpdateBillRequest) any())).thenReturn(1); - - UpdateBillRequest updateBillRequest = new UpdateBillRequest(); - updateBillRequest.setRequestInfo(new RequestInfo()); - HashSet consumerCodes = new HashSet<>(); - MissingNode additionalDetails = MissingNode.getInstance(); - updateBillRequest.setUpdateBillCriteria( - new UpdateBillCriteria("42", consumerCodes, "?", additionalDetails, new HashSet<>(), BillV2.BillStatus.ACTIVE)); - String content = (new ObjectMapper()).writeValueAsString(updateBillRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_cancelbill") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder) - .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"ResponseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"200" - + " OK\"},\"Message\":\"Successfully cancelled 1 Active bills for given consumer codes\"}")); - } - - - @Test - void testCancelBillwithNoActiveBillFound() throws Exception { - when(this.billServicev2.cancelBill((UpdateBillRequest) any())).thenReturn(0); - - UpdateBillRequest updateBillRequest = new UpdateBillRequest(); - updateBillRequest.setRequestInfo(new RequestInfo()); - HashSet consumerCodes = new HashSet<>(); - MissingNode additionalDetails = MissingNode.getInstance(); - updateBillRequest.setUpdateBillCriteria( - new UpdateBillCriteria("42", consumerCodes, "?", additionalDetails, new HashSet<>(), BillV2.BillStatus.ACTIVE)); - String content = (new ObjectMapper()).writeValueAsString(updateBillRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_cancelbill") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"ResponseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"400" - + " BAD_REQUEST\"},\"Message\":\"No Active bills found for cancellation for the given criteria\"}")); - } - - @Test - void testCancelBillWithNotCancelduringWorkflow() throws Exception { - when(this.billServicev2.cancelBill((UpdateBillRequest) any())).thenReturn(-1); - - UpdateBillRequest updateBillRequest = new UpdateBillRequest(); - updateBillRequest.setRequestInfo(new RequestInfo()); - HashSet consumerCodes = new HashSet<>(); - MissingNode additionalDetails = MissingNode.getInstance(); - updateBillRequest.setUpdateBillCriteria( - new UpdateBillCriteria("42", consumerCodes, "?", additionalDetails, new HashSet<>(), BillV2.BillStatus.ACTIVE)); - String content = (new ObjectMapper()).writeValueAsString(updateBillRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_cancelbill") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content() - .string( - "{\"ResponseInfo\":{\"apiId\":null,\"ver\":null,\"ts\":null,\"resMsgId\":null,\"msgId\":null,\"status\":\"400" - + " BAD_REQUEST\"},\"Message\":\"You cannot cancel the bill in the workflow\"}")); - } - - - @Test - void testCancelBillNotFound() throws Exception { - UpdateBillRequest updateBillRequest = new UpdateBillRequest(); - updateBillRequest.setRequestInfo(new RequestInfo()); - updateBillRequest.setUpdateBillCriteria(new UpdateBillCriteria()); - String content = (new ObjectMapper()).writeValueAsString(updateBillRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_cancelbill", "Uri Vars") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - - @Test - void testCreateWithNull() throws Exception { - when(this.billServicev2.sendBillToKafka((BillRequestV2) any())).thenReturn(new BillResponseV2()); - doNothing().when(this.billHelperV2).getBillRequestWithIds((BillRequestV2) any()); - - BillRequestV2 billRequestV2 = new BillRequestV2(); - billRequestV2.setBills(new ArrayList<>()); - billRequestV2.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(billRequestV2); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().isCreated()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content().string("{\"ResposneInfo\":null,\"Bill\":[]}")); - } - - @Test - void testpostSucess() throws Exception { - when(this.billServicev2.sendBillToKafka((BillRequestV2) any())).thenReturn(new BillResponseV2()); - doNothing().when(this.billHelperV2).getBillRequestWithIds((BillRequestV2) any()); - - ArrayList billV2List = new ArrayList<>(); - billV2List.add(new BillV2()); - BillRequestV2 billRequestV2 = new BillRequestV2(); - billRequestV2.setBills(billV2List); - billRequestV2.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(billRequestV2); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().isCreated()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content().string("{\"ResposneInfo\":null,\"Bill\":[]}")); - } - - - @Test - void testFetchBillWithError() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_fetchbill") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - @Test - void testGenrateWithError() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_generate") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - - @Test - void testSearch() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/bill/v2/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.billControllerv2) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/BusinessServiceDetailControllerTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/controller/BusinessServiceDetailControllerTest.java deleted file mode 100644 index 5f526644cd4..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/BusinessServiceDetailControllerTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.egov.demand.web.controller; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.service.BusinessServDetailService; -import org.egov.demand.web.contract.BusinessServiceDetailResponse; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -@ContextConfiguration(classes = {BusinessServiceDetailController.class}) -@ExtendWith(SpringExtension.class) -class BusinessServiceDetailControllerTest { - @MockBean - private BusinessServDetailService businessServDetailService; - - @Autowired - private BusinessServiceDetailController businessServiceDetailController; - - - @Test - void testSearch() throws Exception { - when(this.businessServDetailService.searchBusinessServiceDetails( - (org.egov.demand.web.contract.BusinessServiceDetailCriteria) any(), (RequestInfo) any())) - .thenReturn(new BusinessServiceDetailResponse()); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/businessservices/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - MockMvcBuilders.standaloneSetup(this.businessServiceDetailController) - .build() - .perform(requestBuilder) - .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content().string("{\"ResponseInfo\":null,\"BusinessServiceDetails\":[]}")); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/DemandControllerTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/controller/DemandControllerTest.java deleted file mode 100644 index bff84045f21..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/DemandControllerTest.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.egov.demand.web.controller; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.util.ArrayList; -import java.util.HashMap; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.service.DemandService; -import org.egov.demand.util.migration.DemandMigration; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.contract.DemandResponse; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.factory.ResponseFactory; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -@ContextConfiguration(classes = {DemandController.class, ResponseFactory.class}) -@ExtendWith(SpringExtension.class) -class DemandControllerTest { - @Autowired - private DemandController demandController; - - @MockBean - private DemandMigration demandMigration; - - @MockBean - private DemandService demandService; - - - @Test - void testCreate() throws Exception { - when(this.demandService.create((DemandRequest) any())).thenReturn(new DemandResponse()); - - DemandRequest demandRequest = new DemandRequest(); - demandRequest.setDemands(new ArrayList<>()); - demandRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(demandRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/demand/_create") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.demandController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().isCreated()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect( - MockMvcResultMatchers.content().string("{\"ResponseInfo\":null,\"Demands\":[],\"CollectedReceipt\":null}")); - } - - - @Test - void testMigrate() throws Exception { - when(this.demandMigration.migrateToV1((Integer) any(), (Integer) any())).thenReturn(new HashMap<>()); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder postResult = MockMvcRequestBuilders.post("/demand/_migratetov1"); - MockHttpServletRequestBuilder requestBuilder = postResult.param("batchSizeInput", String.valueOf(1)) - .contentType(MediaType.APPLICATION_JSON) - .content(content); - MockMvcBuilders.standaloneSetup(this.demandController) - .build() - .perform(requestBuilder) - .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content().string("{}")); - } - - - @Test - void testSearch() throws Exception { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/demand/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.demandController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().is(400)); - } - - - @Test - void testUpdate() throws Exception { - when(this.demandService.updateAsync((DemandRequest) any(), (org.egov.demand.model.PaymentBackUpdateAudit) any())) - .thenReturn(new DemandResponse()); - - DemandRequest demandRequest = new DemandRequest(); - demandRequest.setDemands(new ArrayList<>()); - demandRequest.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(demandRequest); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/demand/_update") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.demandController) - .build() - .perform(requestBuilder); - actualPerformResult.andExpect(MockMvcResultMatchers.status().isCreated()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect( - MockMvcResultMatchers.content().string("{\"ResponseInfo\":null,\"Demands\":[],\"CollectedReceipt\":null}")); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/TaxHeadMasterControllerTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/controller/TaxHeadMasterControllerTest.java deleted file mode 100644 index 996f89b5c36..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/TaxHeadMasterControllerTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.egov.demand.web.controller; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.service.TaxHeadMasterService; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.TaxHeadMasterResponse; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -@ContextConfiguration(classes = {TaxHeadMasterController.class}) -@ExtendWith(SpringExtension.class) -class TaxHeadMasterControllerTest { - @Autowired - private TaxHeadMasterController taxHeadMasterController; - - @MockBean - private TaxHeadMasterService taxHeadMasterService; - - - @Test - void testSearch() throws Exception { - when( - this.taxHeadMasterService.getTaxHeads((org.egov.demand.model.TaxHeadMasterCriteria) any(), (RequestInfo) any())) - .thenReturn(new TaxHeadMasterResponse()); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/taxheads/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - MockMvcBuilders.standaloneSetup(this.taxHeadMasterController) - .build() - .perform(requestBuilder) - .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content().string("{\"ResponseInfo\":null,\"TaxHeadMasters\":[]}")); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/TaxPeriodControllerTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/controller/TaxPeriodControllerTest.java deleted file mode 100644 index 8a819ef9161..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/controller/TaxPeriodControllerTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.demand.web.controller; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.service.TaxPeriodService; -import org.egov.demand.web.contract.RequestInfoWrapper; -import org.egov.demand.web.contract.TaxPeriodResponse; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -@ContextConfiguration(classes = {TaxPeriodController.class}) -@ExtendWith(SpringExtension.class) -class TaxPeriodControllerTest { - @Autowired - private TaxPeriodController taxPeriodController; - - @MockBean - private TaxPeriodService taxPeriodService; - - - @Test - void testSearch() throws Exception { - when(this.taxPeriodService.searchTaxPeriods((org.egov.demand.web.contract.TaxPeriodCriteria) any(), - (RequestInfo) any())).thenReturn(new TaxPeriodResponse()); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(new RequestInfo()); - String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/taxperiods/_search") - .contentType(MediaType.APPLICATION_JSON) - .content(content); - MockMvcBuilders.standaloneSetup(this.taxPeriodController) - .build() - .perform(requestBuilder) - .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.content().contentType("application/json")) - .andExpect(MockMvcResultMatchers.content().string("{\"ResponseInfo\":null,\"TaxPeriods\":[]}")); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/validator/AmendmentValidatorTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/validator/AmendmentValidatorTest.java deleted file mode 100644 index 940afa01534..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/validator/AmendmentValidatorTest.java +++ /dev/null @@ -1,157 +0,0 @@ -package org.egov.demand.web.validator; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.amendment.model.Amendment; -import org.egov.demand.amendment.model.AmendmentCriteria; -import org.egov.demand.amendment.model.AmendmentRequest; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.repository.AmendmentRepository; -import org.egov.demand.repository.IdGenRepo; -import org.egov.demand.service.DemandService; -import org.egov.demand.util.Util; -import org.egov.tracer.model.CustomException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.util.ReflectionTestUtils; - -import java.util.HashSet; - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; - - - -public class AmendmentValidatorTest { - - @Mock - private Util util; - - @Mock - private ObjectMapper mapper; - - @Mock - private IdGenRepo idGenRepo; - - @Mock - private DemandService demandService; - - @Mock - private ApplicationProperties props; - - @Mock - private AmendmentRepository amendmentRepository; - - @Mock - private AmendmentValidator amendmentValidator; - - @BeforeEach - public void setUp() { - MockitoAnnotations.initMocks(this); - ReflectionTestUtils.setField(amendmentValidator, "mapper", mapper); - ReflectionTestUtils.setField(amendmentValidator, "idGenRepo", idGenRepo); - ReflectionTestUtils.setField(amendmentValidator, "demandService", demandService); - ReflectionTestUtils.setField(amendmentValidator, "props", props); - ReflectionTestUtils.setField(amendmentValidator, "amendmentRepository", amendmentRepository); - } - - @Test - @DisplayName("Should set the id of amendment to a random UUID") - public void testEnrichAmendmentForCreateShouldSetIdOfAmendmentToRandomUUID() { - - AmendmentRequest amendmentRequest = AmendmentRequest.builder().build(); - Amendment amendment = Amendment.builder().build(); - amendmentRequest.setAmendment(amendment); - RequestInfo requestInfo = RequestInfo.builder().build(); - amendmentRequest.setRequestInfo(requestInfo); - - amendmentValidator.enrichAmendmentForCreate(amendmentRequest); - - assertNotNull("1",amendment.getId()); - } - - @Test - @DisplayName("Should set the id of demandDetails to a random UUID") - public void testEnrichAmendmentForCreateShouldSetIdOfDemandDetailsToRandomUUID() { - AmendmentValidator amendmentValidator1 =new AmendmentValidator(); - AmendmentRequest amendmentRequest = AmendmentRequest.builder().build(); - Amendment amendment = Amendment.builder().build(); - amendmentRequest.setAmendment(amendment); - RequestInfo requestInfo = RequestInfo.builder().build(); - amendmentRequest.setRequestInfo(requestInfo); - when(props.getIsAmendmentworkflowEnabed()).thenReturn(true); - when(props.getAmendmentWfModuleName()).thenReturn("amendment"); - when(props.getAmendmentWfName()).thenReturn("amendment"); - when(props.getAmendmentWfOpenAction()).thenReturn("OPEN"); - - amendmentValidator.enrichAmendmentForCreate(amendmentRequest); - - - } - - @Test - void testValidateAmendmentCriteriaForSearch() { - AmendmentValidator amendmentValidator = new AmendmentValidator(); - AmendmentCriteria amendmentCriteria = new AmendmentCriteria(); - amendmentValidator.validateAmendmentCriteriaForSearch(amendmentCriteria); - assertTrue(amendmentCriteria.getConsumerCode().isEmpty()); - } - - @Test - void testValidateAmendmentCriteriaForSearch3() { - AmendmentValidator amendmentValidator = new AmendmentValidator(); - AmendmentCriteria amendmentCriteria = mock(AmendmentCriteria.class); - when(amendmentCriteria.getConsumerCode()).thenReturn(new HashSet<>()); - amendmentValidator.validateAmendmentCriteriaForSearch(amendmentCriteria); - verify(amendmentCriteria).getConsumerCode(); - } - - @Test - void testValidateAmendmentCriteriaForSearch4() { - AmendmentValidator amendmentValidator = new AmendmentValidator(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - AmendmentCriteria amendmentCriteria = mock(AmendmentCriteria.class); - when(amendmentCriteria.getBusinessService()).thenReturn("Business Service"); - when(amendmentCriteria.getConsumerCode()).thenReturn(stringSet); - amendmentValidator.validateAmendmentCriteriaForSearch(amendmentCriteria); - verify(amendmentCriteria).getBusinessService(); - verify(amendmentCriteria).getConsumerCode(); - } - - @Test - void testValidateAmendmentCriteriaForSearch5() { - AmendmentValidator amendmentValidator = new AmendmentValidator(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - AmendmentCriteria amendmentCriteria = mock(AmendmentCriteria.class); - when(amendmentCriteria.getBusinessService()).thenReturn(""); - when(amendmentCriteria.getConsumerCode()).thenReturn(stringSet); - assertThrows(CustomException.class, () -> amendmentValidator.validateAmendmentCriteriaForSearch(amendmentCriteria)); - verify(amendmentCriteria).getBusinessService(); - verify(amendmentCriteria).getConsumerCode(); - } - - @Test - void testValidateAmendmentCriteriaForSearch6() { - AmendmentValidator amendmentValidator = new AmendmentValidator(); - - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - AmendmentCriteria amendmentCriteria = mock(AmendmentCriteria.class); - when(amendmentCriteria.getBusinessService()) - .thenThrow(new CustomException("EG_BS_AMENDMENT_CRITERIA_ERROR", "An error occurred")); - when(amendmentCriteria.getConsumerCode()).thenReturn(stringSet); - assertThrows(CustomException.class, () -> amendmentValidator.validateAmendmentCriteriaForSearch(amendmentCriteria)); - verify(amendmentCriteria).getBusinessService(); - verify(amendmentCriteria).getConsumerCode(); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/validator/BillValidatorTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/validator/BillValidatorTest.java deleted file mode 100644 index dbb1d417359..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/validator/BillValidatorTest.java +++ /dev/null @@ -1,180 +0,0 @@ -package org.egov.demand.web.validator; - -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.node.MissingNode; - -import java.util.HashSet; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.model.BillSearchCriteria; -import org.egov.demand.model.BillV2; -import org.egov.demand.model.GenerateBillCriteria; -import org.egov.demand.model.UpdateBillCriteria; -import org.egov.demand.util.Util; -import org.egov.tracer.model.CustomException; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {BillValidator.class}) -@ExtendWith(SpringExtension.class) -class BillValidatorTest { - @Autowired - private BillValidator billValidator; - - @MockBean - private Util util; - - @Test - void testValidateBillGenRequest() { - doNothing().when(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - GenerateBillCriteria generateBillCriteria = new GenerateBillCriteria(); - assertThrows(CustomException.class, - () -> this.billValidator.validateBillGenRequest(generateBillCriteria, new RequestInfo())); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - - - @Test - void testValidateBillGenRequest3() { - doNothing().when(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - GenerateBillCriteria generateBillCriteria = new GenerateBillCriteria("42", "42", new HashSet<>(), - "BILL_GEN_MANDATORY_FIELDS_MISSING", "jane.doe@example.org", "42"); - - this.billValidator.validateBillGenRequest(generateBillCriteria, new RequestInfo()); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - - @Test - void testValidateBillGenRequest4() { - doNothing().when(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - - GenerateBillCriteria generateBillCriteria = new GenerateBillCriteria(); - generateBillCriteria.setEmail("jane.doe@example.org"); - this.billValidator.validateBillGenRequest(generateBillCriteria, new RequestInfo()); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - - @Test - void testValidateBillGenRequest5() { - doThrow(new CustomException("BILL_GEN_MANDATORY_FIELDS_MISSING", "An error occurred")).when(this.util) - .validateTenantIdForUserType((String) any(), (RequestInfo) any()); - GenerateBillCriteria generateBillCriteria = new GenerateBillCriteria(); - assertThrows(CustomException.class, - () -> this.billValidator.validateBillGenRequest(generateBillCriteria, new RequestInfo())); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - - @Test - void testValidateBillGenRequest6() { - doNothing().when(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - - HashSet stringSet = new HashSet<>(); - stringSet.add("foo"); - GenerateBillCriteria generateBillCriteria = new GenerateBillCriteria("42", "42", stringSet, - "BILL_GEN_MANDATORY_FIELDS_MISSING", "jane.doe@example.org", "42"); - - this.billValidator.validateBillGenRequest(generateBillCriteria, new RequestInfo()); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - - @Test - void testValidateBillSearchCriteria() { - doNothing().when(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - BillSearchCriteria billCriteria = new BillSearchCriteria(); - assertThrows(CustomException.class, - () -> this.billValidator.validateBillSearchCriteria(billCriteria, new RequestInfo())); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - - @Test - void testValidateBillSearchCriteria3() { - doNothing().when(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - HashSet billId = new HashSet<>(); - BillSearchCriteria billCriteria = new BillSearchCriteria("42", billId, 2L, 2L, true, true, true, new HashSet<>(), - "42", "EGBS_MANDATORY_FIELDS_ERROR", true, 3L, 2L, "jane.doe@example.org", BillV2.BillStatus.ACTIVE, "42"); - - this.billValidator.validateBillSearchCriteria(billCriteria, new RequestInfo()); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - @Test - void testValidateBillSearchCriteria4() { - doNothing().when(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - - BillSearchCriteria billSearchCriteria = new BillSearchCriteria(); - billSearchCriteria.setBillId(new HashSet<>()); - this.billValidator.validateBillSearchCriteria(billSearchCriteria, new RequestInfo()); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - - @Test - void testValidateBillSearchCriteria5() { - doNothing().when(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - - BillSearchCriteria billSearchCriteria = new BillSearchCriteria(); - billSearchCriteria.setEmail("jane.doe@example.org"); - this.billValidator.validateBillSearchCriteria(billSearchCriteria, new RequestInfo()); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - - @Test - void testValidateBillSearchCriteria6() { - doNothing().when(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - - BillSearchCriteria billSearchCriteria = new BillSearchCriteria(); - billSearchCriteria.setMobileNumber("42"); - this.billValidator.validateBillSearchCriteria(billSearchCriteria, new RequestInfo()); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - @Test - void testValidateBillSearchCriteria7() { - doThrow(new CustomException("EGBS_MANDATORY_FIELDS_ERROR", "An error occurred")).when(this.util) - .validateTenantIdForUserType((String) any(), (RequestInfo) any()); - BillSearchCriteria billCriteria = new BillSearchCriteria(); - assertThrows(CustomException.class, - () -> this.billValidator.validateBillSearchCriteria(billCriteria, new RequestInfo())); - verify(this.util).validateTenantIdForUserType((String) any(), (RequestInfo) any()); - } - - - @Test - void testValidateBillSearchRequest2() { - HashSet consumerCodes = new HashSet<>(); - MissingNode additionalDetails = MissingNode.getInstance(); - assertThrows(CustomException.class, () -> this.billValidator.validateBillSearchRequest(new UpdateBillCriteria("42", - consumerCodes, "reasonMessage", additionalDetails, new HashSet<>(), BillV2.BillStatus.ACTIVE))); - } - - - @Test - void testValidateBillSearchRequest4() { - UpdateBillCriteria updateBillCriteria = mock(UpdateBillCriteria.class); - when(updateBillCriteria.getAdditionalDetails()).thenReturn(MissingNode.getInstance()); - doNothing().when(updateBillCriteria).setStatusToBeUpdated((BillV2.BillStatus) any()); - assertThrows(CustomException.class, () -> this.billValidator.validateBillSearchRequest(updateBillCriteria)); - verify(updateBillCriteria).getAdditionalDetails(); - verify(updateBillCriteria).setStatusToBeUpdated((BillV2.BillStatus) any()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/validator/DemandValidatorTest.java b/business-services/billing-service/src/test/java/org/egov/demand/web/validator/DemandValidatorTest.java deleted file mode 100644 index 31a29f3c081..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/validator/DemandValidatorTest.java +++ /dev/null @@ -1,236 +0,0 @@ -package org.egov.demand.web.validator; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashSet; - -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.enums.Type; -import org.egov.demand.web.contract.DemandRequest; -import org.junit.jupiter.api.Disabled; - -import org.junit.jupiter.api.Test; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindException; -import org.springframework.validation.BindingResult; - -class DemandValidatorTest { - - @Test - void testSupports() { - DemandValidator demandValidator = new DemandValidator(); - assertFalse(demandValidator.supports(Object.class)); - } - - - @Test - void testValidate() { - DemandValidator demandValidator = new DemandValidator(); - ArrayList objectList = new ArrayList<>(); - assertThrows(RuntimeException.class, - () -> demandValidator.validate(objectList, new BindException(objectList, "java.util.Collection"))); - } - - - @Test - void testValidateForUpdate() { - DemandValidator demandValidator = new DemandValidator(); - assertThrows(RuntimeException.class, () -> demandValidator.validateForUpdate("Target", - new BindException(new BindException(new BindException(new BindException(mock(BindingResult.class))))))); - } - - - - @Test - void testValidateForUpdate3() { - DemandValidator demandValidator = new DemandValidator(); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).addAllErrors((org.springframework.validation.Errors) any()); - - BindException bindException = new BindException(bindingResult); - bindException.addAllErrors( - new BindException(new BindException(new BindException(new BindException(mock(BindingResult.class)))))); - assertThrows(RuntimeException.class, () -> demandValidator.validateForUpdate("Target", - new BindException(new BindException(new BindException(bindException))))); - verify(bindingResult).addAllErrors((org.springframework.validation.Errors) any()); - } - - - @Test - void testValidateDemandCriteria() { - DemandValidator demandValidator = new DemandValidator(); - DemandCriteria demandCriteria = new DemandCriteria(); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - verify(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - } - - - @Test - void testValidateDemandCriteria3() { - DemandValidator demandValidator = new DemandValidator(); - HashSet demandId = new HashSet<>(); - HashSet payer = new HashSet<>(); - HashSet consumerCode = new HashSet<>(); - BigDecimal valueOfResult = BigDecimal.valueOf(42L); - DemandCriteria demandCriteria = new DemandCriteria("42", demandId, payer, consumerCode, "businessService", - valueOfResult, BigDecimal.valueOf(42L), 1L, 1L, Type.ARREARS, "42", "jane.doe@example.org", "businessService", - true, true); - - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - assertEquals("businessService", demandCriteria.getBusinessService()); - assertEquals(Type.ARREARS, demandCriteria.getType()); - assertEquals("42", demandCriteria.getTenantId()); - assertEquals("businessService", demandCriteria.getStatus()); - assertTrue(demandCriteria.getReceiptRequired()); - assertEquals(1L, demandCriteria.getPeriodTo().longValue()); - assertEquals(1L, demandCriteria.getPeriodFrom().longValue()); - assertTrue(demandCriteria.getPayer().isEmpty()); - assertEquals("42", demandCriteria.getMobileNumber()); - assertTrue(demandCriteria.getIsPaymentCompleted()); - assertEquals("jane.doe@example.org", demandCriteria.getEmail()); - BigDecimal demandTo = demandCriteria.getDemandTo(); - assertEquals(valueOfResult, demandTo); - assertTrue(demandCriteria.getDemandId().isEmpty()); - assertTrue(demandCriteria.getConsumerCode().isEmpty()); - assertEquals(demandTo, demandCriteria.getDemandFrom()); - } - - - - @Test - void testValidateDemandCriteria5() { - DemandValidator demandValidator = new DemandValidator(); - - DemandCriteria demandCriteria = new DemandCriteria(); - demandCriteria.setDemandId(new HashSet<>()); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - assertFalse(demandCriteria.getReceiptRequired()); - assertTrue(demandCriteria.getDemandId().isEmpty()); - } - - @Test - void testValidateDemandCriteria6() { - DemandValidator demandValidator = new DemandValidator(); - - DemandCriteria demandCriteria = new DemandCriteria(); - demandCriteria.setConsumerCode(new HashSet<>()); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - assertFalse(demandCriteria.getReceiptRequired()); - assertTrue(demandCriteria.getConsumerCode().isEmpty()); - } - - - @Test - void testValidateDemandCriteria7() { - DemandValidator demandValidator = new DemandValidator(); - - DemandCriteria demandCriteria = new DemandCriteria(); - demandCriteria.setBusinessService("businessService"); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - assertEquals("businessService", demandCriteria.getBusinessService()); - assertFalse(demandCriteria.getReceiptRequired()); - } - - - @Test - void testValidateDemandCriteria8() { - DemandValidator demandValidator = new DemandValidator(); - - DemandCriteria demandCriteria = new DemandCriteria(); - BigDecimal valueOfResult = BigDecimal.valueOf(42L); - demandCriteria.setDemandFrom(valueOfResult); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - assertFalse(demandCriteria.getReceiptRequired()); - assertSame(valueOfResult, demandCriteria.getDemandFrom()); - } - - - @Test - void testValidateDemandCriteria9() { - DemandValidator demandValidator = new DemandValidator(); - - DemandCriteria demandCriteria = new DemandCriteria(); - BigDecimal valueOfResult = BigDecimal.valueOf(42L); - demandCriteria.setDemandTo(valueOfResult); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - assertFalse(demandCriteria.getReceiptRequired()); - assertSame(valueOfResult, demandCriteria.getDemandTo()); - } - - - @Test - void testValidateDemandCriteria10() { - DemandValidator demandValidator = new DemandValidator(); - - DemandCriteria demandCriteria = new DemandCriteria(); - demandCriteria.setType(Type.ARREARS); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - assertEquals(Type.ARREARS, demandCriteria.getType()); - assertFalse(demandCriteria.getReceiptRequired()); - } - - - @Test - void testValidateDemandCriteria11() { - DemandValidator demandValidator = new DemandValidator(); - - DemandCriteria demandCriteria = new DemandCriteria(); - demandCriteria.setMobileNumber("42"); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - assertFalse(demandCriteria.getReceiptRequired()); - assertEquals("42", demandCriteria.getMobileNumber()); - } - - - @Test - void testValidateDemandCriteria12() { - DemandValidator demandValidator = new DemandValidator(); - - DemandCriteria demandCriteria = new DemandCriteria(); - demandCriteria.setEmail("jane.doe@example.org"); - BindingResult bindingResult = mock(BindingResult.class); - doNothing().when(bindingResult).rejectValue((String) any(), (String) any(), (String) any()); - demandValidator.validateDemandCriteria(demandCriteria, - new BindException(new BindException(new BindException(new BindException(bindingResult))))); - assertFalse(demandCriteria.getReceiptRequired()); - assertEquals("jane.doe@example.org", demandCriteria.getEmail()); - } -} - diff --git a/business-services/billing-service/src/test/java/org/egov/demand/web/validator/DemandValidatorV1Test.java b/business-services/billing-service/src/test/java/org/egov/demand/web/validator/DemandValidatorV1Test.java deleted file mode 100644 index 15909c43a08..00000000000 --- a/business-services/billing-service/src/test/java/org/egov/demand/web/validator/DemandValidatorV1Test.java +++ /dev/null @@ -1,210 +0,0 @@ -package org.egov.demand.web.validator; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.DocumentContext; - -import java.math.BigDecimal; - -import java.util.ArrayList; -import java.util.HashMap; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.demand.config.ApplicationProperties; -import org.egov.demand.model.AuditDetails; -import org.egov.demand.model.Demand; -import org.egov.demand.model.DemandCriteria; -import org.egov.demand.model.DemandDetail; -import org.egov.demand.repository.DemandRepository; -import org.egov.demand.repository.ServiceRequestRepository; -import org.egov.demand.service.UserService; -import org.egov.demand.util.Util; -import org.egov.demand.web.contract.DemandRequest; -import org.egov.demand.web.contract.User; -import org.egov.tracer.model.CustomException; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - - -class DemandValidatorV1Test { - @MockBean - private Boolean aBoolean; - - @MockBean - private DemandRepository demandRepository; - - @Autowired - private DemandValidatorV1 demandValidatorV1; - - @MockBean - private ObjectMapper objectMapper; - - @MockBean - private ServiceRequestRepository serviceRequestRepository; - - @MockBean - private UserService userService; - - @MockBean - private Util util; - - - @Test - void testValidateDemandDetailsForAmount() { - - DemandValidatorV1 demandValidatorV1 = new DemandValidatorV1(); - ArrayList demandDetails = new ArrayList<>(); - demandValidatorV1.validateDemandDetailsForAmount(demandDetails, new HashMap<>()); - assertNull(demandValidatorV1.userService); - } - - - @Test - void testValidateDemandDetailsForAmount3() { - - DemandValidatorV1 demandValidatorV1 = new DemandValidatorV1(); - - ArrayList demandDetailList = new ArrayList<>(); - BigDecimal taxAmount = BigDecimal.valueOf(42L); - BigDecimal collectionAmount = BigDecimal.valueOf(42L); - demandDetailList.add(new DemandDetail("42", "42", "Tax Head Master Code", taxAmount, collectionAmount, - "Additional Details", new AuditDetails(), "42")); - demandValidatorV1.validateDemandDetailsForAmount(demandDetailList, new HashMap<>()); - assertNull(demandValidatorV1.userService); - } - - - @Test - void testValidateDemandDetailsForAmount5() { - - - DemandValidatorV1 demandValidatorV1 = new DemandValidatorV1(); - DemandDetail demandDetail = mock(DemandDetail.class); - when(demandDetail.getCollectionAmount()).thenReturn(BigDecimal.valueOf(42L)); - when(demandDetail.getTaxAmount()).thenReturn(BigDecimal.valueOf(42L)); - - ArrayList demandDetailList = new ArrayList<>(); - demandDetailList.add(demandDetail); - demandValidatorV1.validateDemandDetailsForAmount(demandDetailList, new HashMap<>()); - verify(demandDetail).getCollectionAmount(); - verify(demandDetail).getTaxAmount(); - } - - - @Test - void testValidateDemandDetailsForAmount6() { - - - DemandValidatorV1 demandValidatorV1 = new DemandValidatorV1(); - DemandDetail demandDetail = mock(DemandDetail.class); - when(demandDetail.getCollectionAmount()).thenReturn(BigDecimal.valueOf(-1L)); - when(demandDetail.getTaxAmount()).thenReturn(BigDecimal.valueOf(42L)); - - ArrayList demandDetailList = new ArrayList<>(); - demandDetailList.add(demandDetail); - HashMap stringStringMap = new HashMap<>(); - demandValidatorV1.validateDemandDetailsForAmount(demandDetailList, stringStringMap); - verify(demandDetail).getCollectionAmount(); - verify(demandDetail).getTaxAmount(); - assertEquals(1, stringStringMap.size()); - } - - - @Test - void testValidateDemandDetailsForAmount7() { - - DemandValidatorV1 demandValidatorV1 = new DemandValidatorV1(); - DemandDetail demandDetail = mock(DemandDetail.class); - when(demandDetail.getCollectionAmount()).thenReturn(BigDecimal.valueOf(Long.MAX_VALUE)); - when(demandDetail.getTaxAmount()).thenReturn(BigDecimal.valueOf(42L)); - - ArrayList demandDetailList = new ArrayList<>(); - demandDetailList.add(demandDetail); - HashMap stringStringMap = new HashMap<>(); - demandValidatorV1.validateDemandDetailsForAmount(demandDetailList, stringStringMap); - verify(demandDetail).getCollectionAmount(); - verify(demandDetail).getTaxAmount(); - assertEquals(1, stringStringMap.size()); - } - - - @Test - void testValidateDemandDetailsForAmount9() { - - - DemandValidatorV1 demandValidatorV1 = new DemandValidatorV1(); - DemandDetail demandDetail = mock(DemandDetail.class); - when(demandDetail.getCollectionAmount()).thenReturn(BigDecimal.valueOf(42L)); - when(demandDetail.getTaxAmount()).thenReturn(BigDecimal.valueOf(-1L)); - - ArrayList demandDetailList = new ArrayList<>(); - demandDetailList.add(demandDetail); - HashMap stringStringMap = new HashMap<>(); - demandValidatorV1.validateDemandDetailsForAmount(demandDetailList, stringStringMap); - verify(demandDetail).getCollectionAmount(); - verify(demandDetail).getTaxAmount(); - assertEquals(1, stringStringMap.size()); - } - - - @Test - void testValidateDemandDetailsForAmount10() { - - DemandValidatorV1 demandValidatorV1 = new DemandValidatorV1(); - DemandDetail demandDetail = mock(DemandDetail.class); - when(demandDetail.getCollectionAmount()).thenReturn(BigDecimal.valueOf(-1L)); - when(demandDetail.getTaxAmount()).thenReturn(BigDecimal.valueOf(-1L)); - - ArrayList demandDetailList = new ArrayList<>(); - demandDetailList.add(demandDetail); - demandValidatorV1.validateDemandDetailsForAmount(demandDetailList, new HashMap<>()); - verify(demandDetail).getCollectionAmount(); - verify(demandDetail).getTaxAmount(); - } - - - @Test - void testValidateDemandDetailsForAmount11() { - - DemandValidatorV1 demandValidatorV1 = new DemandValidatorV1(); - DemandDetail demandDetail = mock(DemandDetail.class); - when(demandDetail.getCollectionAmount()).thenReturn(BigDecimal.valueOf(0L)); - when(demandDetail.getTaxAmount()).thenReturn(BigDecimal.valueOf(-1L)); - - ArrayList demandDetailList = new ArrayList<>(); - demandDetailList.add(demandDetail); - demandValidatorV1.validateDemandDetailsForAmount(demandDetailList, new HashMap<>()); - verify(demandDetail).getCollectionAmount(); - verify(demandDetail).getTaxAmount(); - } - - - - @Test - void testValidateForUpdate4() { - - DemandValidatorV1 demandValidatorV1 = new DemandValidatorV1(); - - ArrayList demandList = new ArrayList<>(); - demandList.add(new Demand()); - DemandRequest demandRequest = mock(DemandRequest.class); - when(demandRequest.getDemands()).thenReturn(demandList); - assertThrows(CustomException.class, () -> demandValidatorV1.validateForUpdate(demandRequest, null)); - verify(demandRequest, atLeast(1)).getDemands(); - } - - -} - diff --git a/business-services/billing-service/src/test/resources/UpdatemisResponse.json b/business-services/billing-service/src/test/resources/UpdatemisResponse.json deleted file mode 100644 index dc3a5ef7789..00000000000 --- a/business-services/billing-service/src/test/resources/UpdatemisResponse.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ResponseInfo": { - "apiId": "apiId", - "ver": "ver", - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/billCreateRequest.json b/business-services/billing-service/src/test/resources/billCreateRequest.json deleted file mode 100644 index 7c387a8bff9..00000000000 --- a/business-services/billing-service/src/test/resources/billCreateRequest.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "RequestInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "Bill": [ - { - "id": "12", - "tenantId": "ap.kurnool", - "isActive": true, - "isCancelled": true, - "payeeAddress": "bangalore", - "payeeEmail": "abc@xyz.com", - "payeeName": "abcd", - "billDetails":null, - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/billCreateResponse.json b/business-services/billing-service/src/test/resources/billCreateResponse.json deleted file mode 100644 index 14d4c06701c..00000000000 --- a/business-services/billing-service/src/test/resources/billCreateResponse.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "ResposneInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "Bill": [ - { - "id": "12", - "tenantId": "ap.kurnool", - "isActive": true, - "isCancelled": true, - "payeeAddress": "bangalore", - "payeeEmail": "abc@xyz.com", - "payeeName": "abcd", - "billDetails":null, - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/billSearchResponse.json b/business-services/billing-service/src/test/resources/billSearchResponse.json deleted file mode 100644 index 14d4c06701c..00000000000 --- a/business-services/billing-service/src/test/resources/billSearchResponse.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "ResposneInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "Bill": [ - { - "id": "12", - "tenantId": "ap.kurnool", - "isActive": true, - "isCancelled": true, - "payeeAddress": "bangalore", - "payeeEmail": "abc@xyz.com", - "payeeName": "abcd", - "billDetails":null, - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/businessservdetailcreaterequest.json b/business-services/billing-service/src/test/resources/businessservdetailcreaterequest.json deleted file mode 100644 index 3b89729cea5..00000000000 --- a/business-services/billing-service/src/test/resources/businessservdetailcreaterequest.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "RequestInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "BusinessServiceDetails":[{ - "id":"1", - "businessService":"Test Business Service", - "collectionModesNotAllowed":[], - "tenantId":"ap.kurnool", - "auditDetails": null - }] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/businessservdetailcreateresponse.json b/business-services/billing-service/src/test/resources/businessservdetailcreateresponse.json deleted file mode 100644 index 89ba865f6cf..00000000000 --- a/business-services/billing-service/src/test/resources/businessservdetailcreateresponse.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "BusinessServiceDetails":[{ - "id":"1", - "businessService":"Test Business Service", - "collectionModesNotAllowed":[], - "tenantId":"ap.kurnool", - "auditDetails": null - }] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/businessservdetailsearchresponse.json b/business-services/billing-service/src/test/resources/businessservdetailsearchresponse.json deleted file mode 100644 index 8d657d53893..00000000000 --- a/business-services/billing-service/src/test/resources/businessservdetailsearchresponse.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null - }, - "BusinessServiceDetails": [ - { - "id": "1", - "tenantId": "ap.kurnool", - "businessService": "Test Business Service", - "collectionModesNotAllowed": [], - "partPaymentAllowed": false, - "callBackForApportioning": false, - "callBackApportionURL": null, - "auditDetails": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/demandDetailsResponse.json b/business-services/billing-service/src/test/resources/demandDetailsResponse.json deleted file mode 100644 index 0cf17763ce2..00000000000 --- a/business-services/billing-service/src/test/resources/demandDetailsResponse.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "ResponseInfo": { - "apiId": "apiId", - "ver": "ver" - }, - "DemandDetails": [ - { - "id": null, - "demandId": null, - "taxHeadMasterCode" : "0002", - "taxAmount": 100, - "collectionAmount": 0 - }, - { - "id": null, - "demandId": null, - "taxHeadMasterCode" : "0003", - "taxAmount": 200, - "collectionAmount": 0 - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/demandDueResponse.json b/business-services/billing-service/src/test/resources/demandDueResponse.json deleted file mode 100644 index 7e3f3db78bf..00000000000 --- a/business-services/billing-service/src/test/resources/demandDueResponse.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "ResponseInfo": { - "apiId": "apiId", - "ver": "ver", - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "DemandDue": { - "consolidatedTax": { - "arrearsDemand": 0, - "arrearsCollection": 0, - "arrearsBalance": 0, - "currentDemand": 255, - "currentCollection": 205, - "currentBalance": 50 - }, - "demands": [ - { - "id": null, - "tenantId": "ap.kurnool", - "consumerCode": "consumercode", - "consumerType": "consumertype", - "businessService": "businessservice", - "minimumAmountPayable": 200, - "owner": { - "id": 1, - "userName": null, - "name": null, - "mobileNumber": null, - "emailId": null - }, - "taxPeriodFrom": 12345, - "taxPeriodTo": 1234567890, - - "demandDetails": [ - { - "id": null, - "demandId": null, - "taxHeadMasterCode" : "0002", - "taxAmount": 100, - "collectionAmount": 0 - }, - { - "id": null, - "demandId": null, - "taxHeadMasterCode" : "0003", - "taxAmount": 200, - "collectionAmount": 0 - } - ] - } - ] - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/demandrequest.json b/business-services/billing-service/src/test/resources/demandrequest.json deleted file mode 100644 index 987bfab2378..00000000000 --- a/business-services/billing-service/src/test/resources/demandrequest.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "RequestInfo": { - "apiId": "apiId", - "ver": "ver", - "did":"did" - }, - "Demands": [ - { - "id": null, - "tenantId": "ap.kurnool", - "consumerCode": "consumercode", - "consumerType": "consumertype", - "businessService": "businessservice", - "minimumAmountPayable": 200, - "owner": { - "id": 1, - "userName": null, - "name": null, - "mobileNumber": null, - "emailId": null - }, - "taxPeriodFrom": 12345, - "taxPeriodTo": 1234567890, - - "demandDetails": [ - { - "id": null, - "demandId": null, - "taxHeadMasterCode" : "0002", - "taxAmount": 100, - "collectionAmount": 0 - }, - { - "id": null, - "demandId": null, - "taxHeadMasterCode" : "0003", - "taxAmount": 200, - "collectionAmount": 0 - } - ] - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/demandresponse.json b/business-services/billing-service/src/test/resources/demandresponse.json deleted file mode 100644 index 638c497ae3c..00000000000 --- a/business-services/billing-service/src/test/resources/demandresponse.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "ResponseInfo": { - "apiId": "apiId", - "ver": "ver" - }, - "Demands": [ - { - "id": null, - "tenantId": "ap.kurnool", - "consumerCode": "consumercode", - "consumerType": "consumertype", - "businessService": "businessservice", - "minimumAmountPayable": 200, - "owner": { - "id": 1, - "userName": null, - "name": null, - "mobileNumber": null, - "emailId": null - }, - "taxPeriodFrom": 12345, - "taxPeriodTo": 1234567890, - - "demandDetails": [ - { - "id": null, - "demandId": null, - "taxHeadMasterCode" : "0002", - "taxAmount": 100, - "collectionAmount": 0 - }, - { - "id": null, - "demandId": null, - "taxHeadMasterCode" : "0003", - "taxAmount": 200, - "collectionAmount": 0 - } - ] - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/glCodeMasterCreateRequest.json b/business-services/billing-service/src/test/resources/glCodeMasterCreateRequest.json deleted file mode 100644 index d645d51efc9..00000000000 --- a/business-services/billing-service/src/test/resources/glCodeMasterCreateRequest.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "RequestInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "GlCodeMasters": [ - { - "id":"12", - "tenantId":"ap.kurnool", - "service":"string", - "taxHead":"string", - "glCode":"string", - "fromDate":0, - "toDate":0, - "auditDetails": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/glCodeMasterCreateResponse.json b/business-services/billing-service/src/test/resources/glCodeMasterCreateResponse.json deleted file mode 100644 index 6448523930a..00000000000 --- a/business-services/billing-service/src/test/resources/glCodeMasterCreateResponse.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "GlCodeMasters": [ - { - "id":"12", - "tenantId":"ap.kurnool", - "service":"string", - "taxHead":"string", - "glCode":"string", - "fromDate":0, - "toDate":0, - "auditDetails": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/glCodeMasterSearchResponse.json b/business-services/billing-service/src/test/resources/glCodeMasterSearchResponse.json deleted file mode 100644 index 6448523930a..00000000000 --- a/business-services/billing-service/src/test/resources/glCodeMasterSearchResponse.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "GlCodeMasters": [ - { - "id":"12", - "tenantId":"ap.kurnool", - "service":"string", - "taxHead":"string", - "glCode":"string", - "fromDate":0, - "toDate":0, - "auditDetails": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/glCodeMasterUpdateRequest.json b/business-services/billing-service/src/test/resources/glCodeMasterUpdateRequest.json deleted file mode 100644 index d645d51efc9..00000000000 --- a/business-services/billing-service/src/test/resources/glCodeMasterUpdateRequest.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "RequestInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "GlCodeMasters": [ - { - "id":"12", - "tenantId":"ap.kurnool", - "service":"string", - "taxHead":"string", - "glCode":"string", - "fromDate":0, - "toDate":0, - "auditDetails": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/glCodeMasterUpdateResponse.json b/business-services/billing-service/src/test/resources/glCodeMasterUpdateResponse.json deleted file mode 100644 index 6448523930a..00000000000 --- a/business-services/billing-service/src/test/resources/glCodeMasterUpdateResponse.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "GlCodeMasters": [ - { - "id":"12", - "tenantId":"ap.kurnool", - "service":"string", - "taxHead":"string", - "glCode":"string", - "fromDate":0, - "toDate":0, - "auditDetails": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/requestinfowrapper.json b/business-services/billing-service/src/test/resources/requestinfowrapper.json deleted file mode 100644 index f508ce91508..00000000000 --- a/business-services/billing-service/src/test/resources/requestinfowrapper.json +++ /dev/null @@ -1,14 +0,0 @@ -{ -"RequestInfo" : { - "apiId" : null, - "ver" : null, - "ts" : null, - "action" : null, - "did" : null, - "key" : null, - "msgId" : null, - "requesterId" : null, - "authToken" : null, - "corelationId" : null - } -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxHeadsCreateRequest.json b/business-services/billing-service/src/test/resources/taxHeadsCreateRequest.json deleted file mode 100644 index 086cdb879f1..00000000000 --- a/business-services/billing-service/src/test/resources/taxHeadsCreateRequest.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "RequestInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "TaxHeadMasters": [ - { - "id": "23", - "tenantId": "ap.kurnool", - "category": "TAX", - "service": "string", - "name": "string", - "code": "string", - "isDebit": true, - "isActualDemand": true, - "validFrom":324, - "validTill":23, - "order":12, - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxHeadsCreateRequest2.json b/business-services/billing-service/src/test/resources/taxHeadsCreateRequest2.json deleted file mode 100644 index 15593817674..00000000000 --- a/business-services/billing-service/src/test/resources/taxHeadsCreateRequest2.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "RequestInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "TaxHeadMasters": [ - { - "id": "23", - "tenantId": null, - "category": "TAX", - "service": "string", - "name": "string", - "code": "string", - "isDebit": true, - "isActualDemand": true, - "validFrom":324, - "validTill":23, - "order":12, - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxHeadsCreateResponse.json b/business-services/billing-service/src/test/resources/taxHeadsCreateResponse.json deleted file mode 100644 index 688826c301b..00000000000 --- a/business-services/billing-service/src/test/resources/taxHeadsCreateResponse.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "TaxHeadMasters": [ - { - "id": "23", - "tenantId": "ap.kurnool", - "category": "TAX", - "service": "string", - "name": "string", - "code": "string", - "isDebit": true, - "isActualDemand": true, - "validFrom":324, - "validTill":23, - "order":12, - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxHeadsSearchResponse.json b/business-services/billing-service/src/test/resources/taxHeadsSearchResponse.json deleted file mode 100644 index 688826c301b..00000000000 --- a/business-services/billing-service/src/test/resources/taxHeadsSearchResponse.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "TaxHeadMasters": [ - { - "id": "23", - "tenantId": "ap.kurnool", - "category": "TAX", - "service": "string", - "name": "string", - "code": "string", - "isDebit": true, - "isActualDemand": true, - "validFrom":324, - "validTill":23, - "order":12, - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxHeadsUpdateRequest.json b/business-services/billing-service/src/test/resources/taxHeadsUpdateRequest.json deleted file mode 100644 index df6276c42dc..00000000000 --- a/business-services/billing-service/src/test/resources/taxHeadsUpdateRequest.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "RequestInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "TaxHeadMasters": [ - { - "id": "23", - "tenantId": "ap.kurnool", - "category": "TAX", - "service": "string", - "name": "string", - "code": "string", - "isDebit": true, - "isActualDemand": true, - "validFrom":324, - "validTill":23, - "order":12, - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxHeadsUpdateResponse.json b/business-services/billing-service/src/test/resources/taxHeadsUpdateResponse.json deleted file mode 100644 index 698377393e2..00000000000 --- a/business-services/billing-service/src/test/resources/taxHeadsUpdateResponse.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "TaxHeadMasters": [ - { - "id": "23", - "tenantId": "ap.kurnool", - "category": "TAX", - "service": "string", - "name": "string", - "code": "string", - "isDebit": true, - "isActualDemand": true, - "validFrom":324, - "validTill":23, - "order":12, - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxperiodcreaterequest.json b/business-services/billing-service/src/test/resources/taxperiodcreaterequest.json deleted file mode 100644 index e5661fcba79..00000000000 --- a/business-services/billing-service/src/test/resources/taxperiodcreaterequest.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "RequestInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "TaxPeriods": [ - { - "id": "1", - "tenantId": "ap.kurnool", - "fromDate": 1478930, - "toDate": 4783525, - "service": "Test Service", - "code": "2017-2018-I", - "financialYear": "2017-18", - "periodCycle": "QUARTER", - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxperiodcreateresponse.json b/business-services/billing-service/src/test/resources/taxperiodcreateresponse.json deleted file mode 100644 index 65944a8ac0c..00000000000 --- a/business-services/billing-service/src/test/resources/taxperiodcreateresponse.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null - }, - "TaxPeriods": [ - { - "id": "1", - "tenantId": "ap.kurnool", - "fromDate": 1478930, - "toDate": 4783525, - "service": "Test Service", - "code": "2017-2018-I", - "financialYear": "2017-18", - "periodCycle": "QUARTER", - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxperiodsearchresponse.json b/business-services/billing-service/src/test/resources/taxperiodsearchresponse.json deleted file mode 100644 index 149db4961a2..00000000000 --- a/business-services/billing-service/src/test/resources/taxperiodsearchresponse.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null - }, - "TaxPeriods": [ - { - "id": "1", - "tenantId": "ap.kurnool", - "fromDate": 1478930, - "toDate": 4783525, - "service": "Test Service", - "code": "2017-2018-I", - "financialYear": "2017-18", - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxperiodupdaterequest.json b/business-services/billing-service/src/test/resources/taxperiodupdaterequest.json deleted file mode 100644 index e5661fcba79..00000000000 --- a/business-services/billing-service/src/test/resources/taxperiodupdaterequest.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "RequestInfo": { - "apiId": null, - "ver": null, - "ts": null, - "resMsgId": null, - "msgId": null, - "status": null - }, - "TaxPeriods": [ - { - "id": "1", - "tenantId": "ap.kurnool", - "fromDate": 1478930, - "toDate": 4783525, - "service": "Test Service", - "code": "2017-2018-I", - "financialYear": "2017-18", - "periodCycle": "QUARTER", - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/billing-service/src/test/resources/taxperiodupdateresponse.json b/business-services/billing-service/src/test/resources/taxperiodupdateresponse.json deleted file mode 100644 index 65944a8ac0c..00000000000 --- a/business-services/billing-service/src/test/resources/taxperiodupdateresponse.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "ResponseInfo": { - "apiId": null, - "ver": null - }, - "TaxPeriods": [ - { - "id": "1", - "tenantId": "ap.kurnool", - "fromDate": 1478930, - "toDate": 4783525, - "service": "Test Service", - "code": "2017-2018-I", - "financialYear": "2017-18", - "periodCycle": "QUARTER", - "auditDetail": null - } - ] -} \ No newline at end of file diff --git a/business-services/build/build-config.yml b/business-services/build/build-config.yml deleted file mode 100644 index 3e7071d16ed..00000000000 --- a/business-services/build/build-config.yml +++ /dev/null @@ -1,86 +0,0 @@ -# -# config: -# - name: < Name of the job, foo/bar would create job named bar inside folder foo > -# build: -# - work-dir: < Working directory of the app to be built > -# dockerfile: < Path to the dockerfile, optional, assumes dockerfile in working directory if not provided > -# image-name: < Docker image name > -# - -# - -# -# config: -# - name: < Name of the job, foo/bar would create job named bar inside folder foo > -# build: -# - work-dir: < Working directory of the app to be built > -# dockerfile: < Path to the dockerfile, optional, assumes dockerfile in working directory if not provided > -# image-name: < Docker image name > -# - -# - -config: - - name: "builds/business-services/billing-service" - build: - - work-dir: "billing-service" - image-name: "billing-service" - dockerfile: "build/maven/Dockerfile" - - work-dir: "billing-service/src/main/resources/db" - image-name: "billing-service-db" - - - name: "builds/business-services/collection-services" - build: - - work-dir: "collection-services" - image-name: "collection-services" - dockerfile: "build/maven/Dockerfile" - - work-dir: "collection-services/src/main/resources/db" - image-name: "collection-services-db" - - - name: "builds/business-services/egf-instrument" - build: - - work-dir: "egf-instrument" - image-name: "egf-instrument" - dockerfile: "build/maven/Dockerfile" - - work-dir: "egf-instrument/src/main/resources/db" - image-name: "egf-instrument-db" - - - name: "builds/business-services/egf-master" - build: - - work-dir: "egf-master" - image-name: "egf-master" - dockerfile: "build/maven/Dockerfile" - - work-dir: "egf-master/src/main/resources/db" - image-name: "egf-master-db" - - - name: "builds/business-services/egov-apportion-service" - build: - - work-dir: "egov-apportion-service" - image-name: "egov-apportion-service" - dockerfile: "build/maven/Dockerfile" - - work-dir: "egov-apportion-service/src/main/resources/db" - image-name: "egov-apportion-service-db" - - - name: "builds/business-services/egov-hrms" - build: - - work-dir: "egov-hrms" - image-name: "egov-hrms" - dockerfile: "build/maven/Dockerfile" - - work-dir: "egov-hrms/src/main/resources/db" - image-name: "egov-hrms-db" - - - name: "builds/business-services/finance-collections-voucher-consumer" - build: - - work-dir: "finance-collections-voucher-consumer" - image-name: "finance-collections-voucher-consumer" - dockerfile: "build/maven/Dockerfile" - - work-dir: "finance-collections-voucher-consumer/src/main/resources/db" - image-name: "finance-collections-voucher-consumer-db" - - - name: "builds/business-services/dashboard-analytics" - build: - - work-dir: "dashboard-analytics" - image-name: "dashboard-analytics" - dockerfile: "build/maven/Dockerfile" - - - name: "builds/business-services/dashboard-ingest" - build: - - work-dir: "dashboard-ingest" - image-name: "dashboard-ingest" - dockerfile: "build/maven/Dockerfile" diff --git a/business-services/build/maven/Dockerfile b/business-services/build/maven/Dockerfile deleted file mode 100644 index b97b9cdc49b..00000000000 --- a/business-services/build/maven/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ - -FROM egovio/alpine-maven-builder-jdk-8:1-master-NA-6036091e AS build -ARG WORK_DIR -WORKDIR /app - -# copy the project files -COPY ${WORK_DIR}/pom.xml ./pom.xml -COPY build/maven/start.sh ./start.sh - -# not useful for stateless builds -# RUN mvn -B dependency:go-offline - -COPY ${WORK_DIR}/src ./src -RUN mvn -B -f /app/pom.xml package - - -# Create runtime image -FROM egovio/8-openjdk-alpine - - -WORKDIR /opt/egov - -COPY --from=build /app/target/*.jar /app/start.sh /opt/egov/ - -RUN chmod +x /opt/egov/start.sh - -CMD ["/opt/egov/start.sh"] diff --git a/business-services/collection-services/CHANGELOG.md b/business-services/collection-services/CHANGELOG.md deleted file mode 100644 index da97a8858e9..00000000000 --- a/business-services/collection-services/CHANGELOG.md +++ /dev/null @@ -1,64 +0,0 @@ - - -# Changelog -All notable changes to this module will be documented in this file. -## 1.1.6 - 2022-01-13 -- Updated to log4j2 version 2.17.1 - -## 1.1.5 - 2021-07-26 -- Support for statelevel search - -## 1.1.4 - 2021-05-11 -- RAIN-2515 Added regex pattern for paid by, payer name, email and mobilenumber -- VUL-WEB-L008: added @SafeHtml annotaion on string fields -- VUL-WEB-L008: updated POM to add safeHtml validator libraries -- Query optimized made in sync with prod -- RAIN-2420 Added url shortend link for payment message - -- -## 1.1.3 - 2021-02-26 -- Updated domain name in application.properties - -## 1.1.2 - 2021-01-12 -- Query Optimized -- Payment search/workflow path param based URL config added - -## 1.1.1 - 2020-08-04 -- Migration fix for status mapping issues - -## 1.1.1 - -## 1.1.0 - 2020-06-25 - -- Added Paytment API -- Added typescript definition generation plugin -- Upgraded to `tracer:2.0.0-SNAPSHOT` -- Upgraded to spring boot `2.2.6-RELEASE` -- Removed `start.sh` and `Dockerfile` - -## 1.1.0 - -## [1.0.0] - 2018-12-06 -### Added -- Receipt update API to allow for update of editable fields. -- Receipt Workflow API - - Cancellation of receipts in open state. - - Remittance of instruments such as Cash, Cheque, DD . - - Dishonoring of instruments such as Cheque, DD. - -### Changed -- Receipt Search API - - Search response to include fields such as receiptNumber, consumerCode -at Receipt root for easier access. - - Search by multiple receipt status and instrument types. - - -### Deprecated -- Receipt status & voucher update via update API in favour of workflow API. - - -All notable changes to this module will be documented in this file. - -- Base version - - diff --git a/business-services/collection-services/LOCALSETUP.md b/business-services/collection-services/LOCALSETUP.md deleted file mode 100644 index 9259b7e348d..00000000000 --- a/business-services/collection-services/LOCALSETUP.md +++ /dev/null @@ -1,49 +0,0 @@ -# Local Setup - -To setup the billing-service in your local system, clone the git repo(https://github.com/egovernments/business-services). - -## Dependencies - - -### Infra Dependency - -- [X] Postgres DB -- [ ] Redis -- [ ] Elasticsearch -- [X] Kafka - - [X] Consumer - - [X] Producer - -## Running Locally - -To run the service locally, you need to port forward below services. - -```bash -function kgpt(){kubectl get pods -n egov --selector=app=$1 --no-headers=true | head -n1 | awk '{print $1}'} - -kubectl port-forward -n egov $(kgpt egov-user) 8081:8080 & -kubectl port-forward -n egov $(kgpt egf-master) 8083:8080 & -kubectl port-forward -n egov $(kgpt egov-common-masters) 8084:8080 & -kubectl port-forward -n egov $(kgpt egf-instrument) 8085:8080 & -kubectl port-forward -n egov $(kgpt billing-service) 8086:8080 & -kubectl port-forward -n egov $(kgpt egov-idgen) 8087:8080 & -kubectl port-forward -n egov $(kgpt egov-mdms-service) 8088:8080 & -kubectl port-forward -n egov $(kgpt egov-apportion-service) 8089:8080 & -``` - -Update below listed properties in `application.properties` before running the project: - -```ini - -user.service.hostname=http://127.0.0.1:8081 -egov.egfmasters.hostname=http://127.0.0.1:8083 -egov.egfcommonmasters.hostname =http://127.0.0.1:8084 -egov.instrument.hostname = http://127.0.0.1:8085 -egov.services.billing_service.hostname=http://127.0.0.1:8086 -egov.idgen.hostname = http://127.0.0.1:8087 -egov.mdms.host=http://127.0.0.1:8088 -egov.apportion.host=http://127.0.0.1:8089 - -# this is the main server host for sending notification -coll.notification.ui.host= -``` diff --git a/business-services/collection-services/README.md b/business-services/collection-services/README.md deleted file mode 100644 index 0cf8fe347dc..00000000000 --- a/business-services/collection-services/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Collection-Service service - - generates Payment for bills generated by billing service. - -### DB UML Diagram - -NA - -### Service Dependencies - - - User-service - - egf-master - - common-master - - instrument-service - - billing-service - - IdGen - - Mdms - - Apportion-service - -### Swagger API Contract - - https://raw.githubusercontent.com/egovernments/business-services/finance_master_readme/Docs/collection-services/V-2-0.yml - -## Service Details - -collects payment for bills from CITIZEN and EMPLOYEE for the bills generated by revenue services using different modes of services of online and offline(employee counter). - -### API Details - - - payment/_create - the payment set of API's collects payments based on bill Id. it validates whether the bill for which payment is being made is either a valid bill or not. incase of invaid or expired bills error will be thrown. - - payment/_workflow - The update API for payment where payment can be remitted/deposited or cancelled in case of invalid payments. - -### Kafka Consumers - --kafka.topics.payment.create.name= --kafka.topics.payment.cancel.name= --kafka.topics.payment.update.name= - -Kafka consumer listen to payment topic to update demand whenever payment is made against the bills. - -### Kafka Producers - --kafka.topics.payment.create.name= --kafka.topics.payment.cancel.name= --kafka.topics.payment.update.name= - diff --git a/business-services/collection-services/mvnw b/business-services/collection-services/mvnw deleted file mode 100644 index 5bf251c0774..00000000000 --- a/business-services/collection-services/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/business-services/collection-services/mvnw.cmd b/business-services/collection-services/mvnw.cmd deleted file mode 100644 index 019bd74d766..00000000000 --- a/business-services/collection-services/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/business-services/collection-services/pom.xml b/business-services/collection-services/pom.xml deleted file mode 100644 index 175cc22b02d..00000000000 --- a/business-services/collection-services/pom.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - - collection-services - collection-services - 1.1.6-SNAPSHOT - collection-services - Spring Boot Project for Collection Services - - 2.17.1 - UTF-8 - 1.8 - 2.9.6 - UTF-8 - 1.18.8 - 2.6 - - - - org.egov.services - tracer - 2.1.2-SNAPSHOT - - - org.egov.services - services-common - 1.1.1-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - org.apache.logging.log4j - log4j-to-slf4j - 2.8.2 - - - org.postgresql - postgresql - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.flywaydb - flyway-core - - - org.springframework.kafka - spring-kafka - - - org.apache.commons - commons-lang3 - 3.0 - - - joda-time - joda-time - - - com.jayway.jsonpath - json-path - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - org.projectlombok - lombok - true - - - org.egov - mdms-client - 0.0.4-SNAPSHOT - - - commons-io - commons-io - 2.5 - - - org.springframework.boot - spring-boot-starter-test - test - - - org.hibernate - hibernate-validator - 6.0.16.Final - - - org.jsoup - jsoup - 1.10.2 - - - - - repo.digit.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - repo.egovernments.org.snapshots - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.collection.web.contract.PaymentRequest - org.egov.collection.web.contract.PaymentResponse - org.egov.collection.model.PaymentSearchCriteria - - - org.egov.common.contract.request.User:User - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - true - module - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - cz.habarta.typescript-generator - - - typescript-generator-maven-plugin - - - [2.22.595,) - - - generate - - - - - - - - - - - - - - diff --git a/business-services/collection-services/postman/Collections.postman_collection.json b/business-services/collection-services/postman/Collections.postman_collection.json deleted file mode 100644 index dafbd4e3fc8..00000000000 --- a/business-services/collection-services/postman/Collections.postman_collection.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "variables": [], - "info": { - "name": "Collections", - "_postman_id": "74908e9c-5511-6a47-f657-564f1c036e2f", - "description": "Create receipt", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "http://egov-micro-dev.egovernments.org/collection-services/receipt/_create", - "request": { - "url": "http://egov-micro-dev.egovernments.org/collection-services/receipts/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"Receipt\": [\n {\n \"Bill\": [\n {\n \"id\": \"2\",\n \"payeeName\": \"R Krishna Reddy\",\n \"payeeAddress\": null,\n \"payeeEmail\": null,\n \"isActive\": true,\n \"isCancelled\": false,\n \"mobileNumber\" : \"9742913171\",\n \"billDetails\": [\n {\n \"id\": \"17\",\n \"tenantId\": \"default\",\n \"bill\": \"17\",\n \"businessService\": \"WC\",\n \"billNumber\": \"17\",\n \"billDate\": 1502365191113,\n \"consumerCode\": \"1016000001\",\n \"consumerType\": \"PRIVATE\",\n \"billDescription\": \"Property Tax Consumer Code: 1016000001\",\n \"displayMessage\": \"Property Tax Consumer Code: 1016000001\",\n \"minimumAmount\": 1,\n \"totalAmount\": 1948,\n \"receiptDate\" : \"1503089751000\",\n \"manualReceiptNumber\" : \"test123\",\n \"collectionModesNotAllowed\": [\n \"Cash\"\n ],\n \"callBackForApportioning\": true,\n \"partPaymentAllowed\": true,\n \"billAccountDetails\": [\n {\n \"id\": \"48\",\n \"tenantId\": \"default\",\n \"billDetail\": \"17\",\n \"glcode\": \"4501001\",\n \"order\": 1,\n \"accountDescription\": \"EDU_CESS-1490985000000-1506796199000\",\n \"crAmountToBePaid\": 418,\n \"creditAmount\": null,\n \"debitAmount\": null,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n },\n {\n \"id\": \"49\",\n \"tenantId\": \"default\",\n \"billDetail\": \"17\",\n \"glcode\": \"4501001\",\n \"order\": 0,\n \"accountDescription\": \"PT_TAX-1490985000000-1506796199000\",\n \"crAmountToBePaid\": 1500,\n \"creditAmount\": null,\n \"debitAmount\": null,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n },\n {\n \"id\": \"50\",\n \"tenantId\": \"default\",\n \"billDetail\": \"17\",\n \"glcode\": \"4501001\",\n \"order\": 1,\n \"accountDescription\": \"LIB_CESS-1490985000000-1506796199000\",\n \"crAmountToBePaid\": 30,\n \"creditAmount\": null,\n \"debitAmount\": null,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n }\n ],\n \"amountPaid\": \"1000\"\n }\n ],\n \"tenantId\": \"default\",\n \"auditDetail\": null,\n \"paidBy\": \"murali\"\n }\n ],\n \"tenantId\": \"default\",\n \"instrument\": {\n \"transactionNumber\": \"657837232\",\n \"transactionDateInput\":\"1505327400000\", \n \"amount\": 100,\n \"instrumentType\": {\n \"name\": \"DD\",\n \"tenantId\": \"default\"\n },\n \"branchName\":\"Bangalore\",\n \"bank\": {\n \"id\": \"1770\",\n \"tenantId\": \"default\"\n }\n }\n }\n ],\n \"RequestInfo\": {\n \"apiId\": \"org.egov.pt\",\n \"ver\": \"1.0\",\n \"ts\": 1502365223899,\n \"action\": \"asd\",\n \"did\": \"4354648646\",\n \"key\": \"xyz\",\n \"msgId\": \"654654\",\n \"requesterId\": \"61\",\n \"authToken\": \"77b984a5-1e75-4fd7-afa2-8b6c66ffa9f7\",\n \"userInfo\":{\n \t\"id\":73,\n \t\"roles\": []\n }\n }\n}" - }, - "description": "" - }, - "response": [] - }, - { - "name": "http://egov-micro-dev.egovernments.org/collection-services/receipts/_search?tenantId=default", - "request": { - "url": { - "raw": "http://egov-micro-dev.egovernments.org/collection-services/receipts/_search?tenantId=default", - "protocol": "http", - "host": [ - "egov-micro-dev", - "egovernments", - "org" - ], - "path": [ - "collection-services", - "receipts", - "_search" - ], - "query": [ - { - "key": "tenantId", - "value": "default", - "equals": true, - "description": "" - } - ], - "variable": [] - }, - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\"RequestInfo\" : {\n \"apiId\":\"org.egov.collection\",\n \"ver\":\"1.0\",\n \"action\":\"POST\",\n \"did\":\"4354648646\",\n \"key\":\"xyz\",\n \"msgId\":\"654654\",\n \"requesterId\": \"rajesh\",\n \"correlationId\" : \"\",\n \"ts\" : \"10-03-2017 00:00:00\",\n \"authToken\":\"cbaebf2f-e8a2-4312-9041-01f987d40377\",\n \"userInfo\":\n {\n \t\"id\":1\n }\n }\n}" - }, - "description": "" - }, - "response": [] - }, - { - "name": "http://egov-micro-dev.egovernments.org/collection-services/receipt/_update", - "request": { - "url": "http://egov-micro-dev.egovernments.org/collection-services/receipts/_update", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"Receipt\": [\n {\n \"Bill\": [\n {\n \"id\": \"17\",\n \"payeeName\": \"R Krishna Reddy\",\n \"payeeAddress\": null,\n \"payeeEmail\": null,\n \"isActive\": true,\n \"isCancelled\": false,\n \"billDetails\": [\n {\n \"id\": \"17\",\n \"tenantId\": \"default\",\n \"bill\": \"17\",\n \"businessService\": \"TL\",\n \"billNumber\": \"17\",\n \"billDate\": 1502365191113,\n \"consumerCode\": \"1016000001\",\n \"consumerType\": \"PRIVATE\",\n \"billDescription\": \"Property Tax Consumer Code: 1016000001\",\n \"displayMessage\": \"Property Tax Consumer Code: 1016000001\",\n \"minimumAmount\": 1,\n \"totalAmount\": 1948,\n \"receiptDate\" : \"1503089751000\",\n \"manualReceiptNumber\" : \"test123\",\n \"collectionModesNotAllowed\": [\n \"Cash\"\n ],\n \"callBackForApportioning\": true,\n \"partPaymentAllowed\": true,\n \"billAccountDetails\": [\n {\n \"id\": \"48\",\n \"tenantId\": \"default\",\n \"billDetail\": \"17\",\n \"glcode\": \"4501001\",\n \"order\": 1,\n \"accountDescription\": \"EDU_CESS-1490985000000-1506796199000\",\n \"crAmountToBePaid\": 418,\n \"creditAmount\": null,\n \"debitAmount\": null,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n },\n {\n \"id\": \"49\",\n \"tenantId\": \"default\",\n \"billDetail\": \"17\",\n \"glcode\": \"4501001\",\n \"order\": 0,\n \"accountDescription\": \"PT_TAX-1490985000000-1506796199000\",\n \"crAmountToBePaid\": 1500,\n \"creditAmount\": null,\n \"debitAmount\": null,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n },\n {\n \"id\": \"50\",\n \"tenantId\": \"default\",\n \"billDetail\": \"17\",\n \"glcode\": \"4501001\",\n \"order\": 1,\n \"accountDescription\": \"LIB_CESS-1490985000000-1506796199000\",\n \"crAmountToBePaid\": 30,\n \"creditAmount\": null,\n \"debitAmount\": null,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n }\n ],\n \"amountPaid\": \"1000\"\n }\n ],\n \"tenantId\": \"default\",\n \"auditDetail\": null,\n \"paidBy\": \"murali\"\n }\n ],\n \"tenantId\": \"default\",\n \"instrument\": {\n \"transactionNumber\": \"1232356543\",\n \"transactionDateInput\":\"1503089751000\",\n \"amount\": 100,\n \"instrumentType\": {\n \"name\": \"Cash\",\n \"tenantId\": \"default\"\n },\n \"branchName\":\"Bangalore\",\n \"bank\": {\n \"id\": \"1\",\n \"tenantId\": \"default\"\n }\n }\n }\n ],\n \"RequestInfo\": {\n \"apiId\": \"org.egov.pt\",\n \"ver\": \"1.0\",\n \"ts\": 1502365223899,\n \"action\": \"asd\",\n \"did\": \"4354648646\",\n \"key\": \"xyz\",\n \"msgId\": \"654654\",\n \"requesterId\": \"61\",\n \"authToken\": \"a40c39dc-4158-47c2-8fc0-6d17c5a1584f\",\n \"userInfo\":{\n \t\"id\":73,\n \t\"roles\": []\n }\n }\n}" - }, - "description": "Receipt Update" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/CollectionServicesApplication.java b/business-services/collection-services/src/main/java/org/egov/collection/CollectionServicesApplication.java deleted file mode 100644 index 370db27605e..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/CollectionServicesApplication.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection; - -import java.text.SimpleDateFormat; -import java.util.Locale; -import java.util.TimeZone; - -import javax.annotation.PostConstruct; - -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.config.TracerConfiguration; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -@SpringBootApplication -@Component -@Import({TracerConfiguration.class , MultiStateInstanceUtil.class}) -public class CollectionServicesApplication { - - - private static final String DATE_FORMAT = "dd-MM-yyyy HH:mm:ss"; - - @Value("${app.timezone}") - private String timeZone; - - @PostConstruct - public void initialize() { - TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); - } - - public static void main(String[] args) { - SpringApplication.run(CollectionServicesApplication.class); - } - - @Bean - public ObjectMapper getObjectMapper() { - final ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - objectMapper.setTimeZone(TimeZone.getTimeZone(timeZone)); - return objectMapper; - } - - @Bean - public MappingJackson2HttpMessageConverter jacksonConverter() { - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - ObjectMapper mapper = new ObjectMapper(); - mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); - mapper.setDateFormat(new SimpleDateFormat(DATE_FORMAT, Locale.ENGLISH)); - mapper.setTimeZone(TimeZone.getTimeZone(timeZone)); - converter.setObjectMapper(mapper); - return converter; - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/config/ApplicationProperties.java b/business-services/collection-services/src/main/java/org/egov/collection/config/ApplicationProperties.java deleted file mode 100644 index 52507672326..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/config/ApplicationProperties.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.config; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.annotation.Order; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -@Configuration -@PropertySource(value = { "classpath:config/application-config.properties" }, ignoreResourceNotFound = true) -@Order(0) -public class ApplicationProperties { - - @Value("${kafka.topics.receipt.create.name}") - private String createReceiptTopicName; - - @Value("${kafka.topics.receipt.create.key}") - private String createReceiptTopicKey; - - @Value("${kafka.topics.receipt.cancel.name}") - private String cancelReceiptTopicName; - - @Value("${kafka.topics.receipt.cancel.key}") - private String cancelReceiptTopicKey; - - @Value("${kafka.topics.receipt.update.name}") - private String updateReceiptTopicName; - - @Value("${kafka.topics.receipt.update.key}") - private String updateReceiptTopicKey; - - @Value("${egov.services.hostname}") - private String egovServiceHost; - - @Value("${egov.pdf.service.create}") - private String egovPdfCreate; - - @Value("${egov.egfcommonmasters.hostname}") - private String egfcommonmastersHost; - - @Value("${buisnessdetails.search.uri}") - private String businessDetailsSearch; - - @Value("${egov.egfmasters.hostname}") - private String egfmastersHost; - - @Value("${coa.search.uri}") - private String chartOfAccountsSearch; - - @Value("${egov.idgen.hostname}") - private String idGenServiceHost; - - @Value("${rcptno.gen.uri}") - private String idGeneration; - - @Value("${egov.instrument.hostname}") - private String instrumentServiceHost; - - @Value("${create.instrument.uri}") - private String createInstrument; - - @Value("${search.instrument.uri}") - private String searchInstrument; - - @Value("${search.instrumentbypaymentmode.uri}") - private String searchInstrumentByPaymentMode; - - @Value("${egov.services.billing_service.hostname}") - private String billingServiceHostName; - - @Value("${egov.services.billing_service.apportion}") - private String billingServiceApportion; - - @Value("${search.accountcodes.uri}") - private String searchAccountCodes; - - @Value("${egov.services.billing_service.search}") - private String searchBill; - - @Value("${kafka.topics.update.receipt.workflowdetails}") - private String kafkaUpdateWorkFlowDetailsTopic; - - @Value("${kafka.topics.bankaccountservicemapping.create.name}") - private String createBankAccountServiceMappingTopicName; - - @Value("${kafka.topics.filestore}") - private String fileStore; - - @Value("${receiptnumber.idname}") - private String receiptNumberIdName; - - @Value("${receiptnumber.servicebased}") - private boolean receiptNumberByService; - - @Value("${receiptnumber.state.level.format}") - private String receiptNumberStateLevelFormat; - - @Value("${collection.receipts.search.paginate}") - private boolean receiptsSearchPaginationEnabled; - - @Value("${collection.receipts.search.default.size}") - private Integer receiptsSearchDefaultLimit; - - @Value("${collection.receipts.search.max.size}") - private Integer receiptsSearchMaxLimit; - - @Value("${egov.apportion.service.host}") - private String apportionHost; - - @Value("${egov.apportion.apportion.endpoint}") - private String apportionURI; - - @Value("${collection.is.user.create.enabled}") - private Boolean isUserCreateEnabled; - - @Value("${user.service.host}") - private String userHost; - - @Value("${egov.services.user_by_id}") - private String userSearchEnpoint; - - @Value("${egov.user.create.user}") - private String userCreateEnpoint; - - @Value("${kafka.topics.payment.receiptlink.name}") - private String paymentReceiptLinkTopic; - - @Value("${kafka.topics.payment.receiptlink.key}") - private String paymentReceiptLinkTopicKey; - - @Value("${coll.notification.ui.host}") - private String uiHost; - - @Value("${coll.notification.ui.redirect.url}") - private String uiRedirectUrl; - - @Value("${coll.notification.fallback.locale}") - private String fallBackLocale; - - - // Payment properties - - @Value("${kafka.topics.payment.create.name}") - private String createPaymentTopicName; - - @Value("${kafka.topics.payment.create.key}") - private String createPaymentTopicKey; - - @Value("${collection.payments.search.paginate}") - private boolean paymentsSearchPaginationEnabled; - - @Value("${kafka.topics.payment.cancel.name}") - private String cancelPaymentTopicName; - - @Value("#{'${search.ignore.status}'.split(',')}") - private List searchIgnoreStatus; - - @Value("${is.payment.search.uri.modulename.mandatory}") - private Boolean isModuleNameMandatoryInSearchUriForEmployee; - - - @Value("${kafka.topics.payment.cancel.key}") - private String cancelPaymentTopicKey; - - @Value("${kafka.topics.payment.update.name}") - private String updatePaymentTopicName; - - @Value("${kafka.topics.payment.update.key}") - private String updatePaymentTopicKey; - - @Value("${kafka.topics.notification.sms}") - private String smsTopic; - - @Value("${kafka.topics.notification.sms.key}") - private String smsTopickey; - - - - //MDMS - - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsSearchEndpoint; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsUrl; - - @Value("${kafka.topics.collection.migrate.name}") - private String collectionMigrationTopicName; - - @Value("${kafka.topics.collection.migrate.key}") - private String collectionMigrationTopicKey; - - //Localization - - @Value("${egov.localization.host}") - private String localizationHost; - - @Value("${egov.localization.search.endpoint}") - private String localizationEndpoint; - - @Value("${collection.search.max.limit}") - private Integer defaultLimit; - - @Value("${collection.search.default.limit}") - private Integer maxSearchLimit; - - @Value("${egov.url.shortner.host}") - private String urlShortnerHost; - - @Value("${egov.url.shortner.endpoint}") - private String urlShortnerEndpoint; - - @Value("${egov.razorpay.url}") - private String razorPayUrl; - - // central-instance configs - - @Value("${state.level.tenantid.length}") - private Integer stateLevelTenantIdLength; - - @Value("${is.environment.central.instance}") - private Boolean isEnvironmentCentralInstance; - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/config/CollectionServiceConstants.java b/business-services/collection-services/src/main/java/org/egov/collection/config/CollectionServiceConstants.java deleted file mode 100644 index cfd37d362c0..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/config/CollectionServiceConstants.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.config; - -import org.springframework.context.annotation.Configuration; - -@Configuration -public class CollectionServiceConstants { - - public static final String INVALID_RECEIPT_REQUEST = "Receipt create request is invalid"; - public static final String INVALID_LEGACY_RECEIPT_REQUEST = "Legacy Receipt Create request is invalid"; - public static final String BUSINESS_KEY = "ReceiptHeader"; - public static final String SEARCH_RECEIPT_REQUEST = "Search Receipt request is invalid"; - - public static final String TENANT_ID_REQUIRED_CODE = "egcl_001"; - public static final String TENANT_ID_REQUIRED_FIELD = "tenantId"; - public static final String TENANT_ID_REQUIRED_MESSAGE = "Tenant Id is Required"; - - public static final String PAYEE_NAME_MISSING_CODE = "egcl_002"; - public static final String PAYEE_NAME_MISSING_FIELD = "payeeName"; - public static final String PAYEE_NAME_MISSING_MESSAGE = "Payee Name is missing"; - - public static final String PAID_BY_MISSING_CODE = "egcl_003"; - public static final String PAID_BY_MISSING_FIELD = "paidBy"; - public static final String PAID_BY_MISSING_MESSAGE = "Paid by is missing"; - - public static final String RECEIPT_TYPE_MISSING_CODE = "egcl_004"; - public static final String RECEIPT_TYPE_MISSING_FIELD = "receiptType"; - public static final String RECEIPT_TYPE_MISSING_MESSAGE = "Receipt Type can only be: Miscellaneous, BillBased, Challan"; - - public static final String RECEIPT_DATE_MISSING_CODE = "egcl_005"; - public static final String RECEIPT_DATE_MISSING_FIELD = "receiptDate"; - public static final String RECEIPT_DATE_MISSING_MESSAGE = "Receipt Date is missing"; - - public static final String BD_CODE_MISSING_CODE = "egcl_006"; - public static final String BD_CODE_MISSING_FIELD = "businessService"; - public static final String BD_CODE_MISSING_MESSAGE = "Business Details Code is missing"; - - public static final String COA_MISSING_CODE = "egcl_007"; - public static final String COA_MISSING_FIELD = "glcode"; - public static final String COA_MISSING_MESSAGE = "Chart of Account Code/ GL Code is missing"; - - public static final String PURPOSE_MISSING_CODE = "egcl_008"; - public static final String PURPOSE_MISSING_FIELD = "purpose"; - public static final String PURPOSE_MISSING_MESSAGE = "Purpose can only be: ARREAR_AMOUNT, CURRENT_AMOUNT, ADVANCE_AMOUNT" - + "ARREAR_LATEPAYMENT_CHARGES, CURRENT_LATEPAYMENT_CHARGES, CHEQUE_BOUNCE_PENALTY, REBATE, OTHERS"; - - public static final String COLLECTIONTYPE_MISSING_CODE = "egcl_009"; - public static final String COLLECTIONTYPE_MISSING_FIELD = "collectionType"; - public static final String COLLECTIONTYPE_MISSING_MESSAGE = "Collection type can only be: Counter, Field, Online"; - - public static final String COLL_REMITTENACE_ID_NAME = "collection.remittanceno"; - public static final String COLL_REMITTENACE_ID_FORMAT = "REM/[[SEQ_COLL_REMITTENCE]/[cy:MM]/[fy:yyyy-yy]"; - - public static final String COLL_TRANSACTION_ID_NAME = "collection.transactionno"; - public static final String COLL_TRANSACTION_FORMAT = "{tenant}[d{10}]"; - - public static final String STATUS_MISSING_CODE = "egcl_011"; - public static final String STATUS_MISSING_MESSAGE = "status"; - public static final String STATUS_MISSING_FIELD = "Status is missing"; - - public static final String COLL_DETAILS_DESCRIPTION_CODE = "egcl_012"; - public static final String COLL_DETAILS_DESCRIPTION_FIELD = "billDescription"; - public static final String COLL_DETAILS_DESCRIPTION_MESSAGE = "Bill details description is required"; - - public static final String AMT_PAID_NOT_NULL_CODE = "egcl_013"; - public static final String AMT_PAID_NOT_NULL_FIELD = "amountPaid"; - public static final String AMT_PAID_NOT_NULL_MESSAGE = "Amount Paid cannot be null"; - - public static final String RCPT_TYPE_MISSING_CODE = "egcl_014"; - public static final String RCPT_TYPE_MISSING_FIELD = "receiptType"; - public static final String RCPT_TYPE_MISSING_MESSAGE = "Receipt Type is missing"; - - public static final String COLL_TYPE_MISSING_CODE = "egcl_015"; - public static final String COLL_TYPE_MISSING_FIELD = "collectionType"; - public static final String COLL_TYPE_MISSING_MESSAGE = "Collection Type is missing"; - - public static final String INSTRUMENT_EXCEPTION_MSG = "Instrument couldn't be fetched"; - public static final String INSTRUMENT_EXCEPTION_DESC = "ISE while trying to fetch instrument id, creation of instrument failed!"; - - public static final String RCPTNO_EXCEPTION_MSG = "Receipt Number couldn't be generated"; - public static final String RCPTNO_EXCEPTION_DESC = "ISE while trying to generate receipt no, id gen service failed to return receipt no"; - - public static final String TRANSACTIONNO_EXCEPTION_MSG = "Transaction Number couldn't be generated"; - public static final String TRANSACTIONNO_EXCEPTION_DESC = "ISE while trying to generate transaction no, id gen service failed to return receipt no"; - - public static final String REMITTANCENO_EXCEPTION_MSG = "Remittance Number couldn't be generated"; - public static final String REMITTANCENO_EXCEPTION_DESC = "ISE while trying to generate remittance no, id gen service failed to return receipt no"; - - public static final String BUSINESSDETAILS_EXCEPTION_MSG = "Businessdetails couldn't be fetched"; - public static final String BUSINESSDETAILS_EXCEPTION_DESC = "ISE while trying to fetch buisness details, common masters failed to return fund, function, department and fundsource"; - - public static final String KAFKA_PUSH_EXCEPTION_MSG = "Data couldn't be pushed on the kafka queue"; - public static final String KAFKA_PUSH_EXCEPTION_DESC = "ISE while pushing to the queue, check if the kafka server is running"; - - public static final String POSITION_EXCEPTION_MSG = "Positions couldn't be fetched"; - public static final String POSITION_EXCEPTION_DESC = "ISE while fetching positions for asignee and initator, hr-employees failed to return values"; - - public static final String ACCOUNT_CODE_EXCEPTION_MSG = "glcode couldn't be fetched"; - public static final String ACCOUNT_CODE_EXCEPTION_DESC = "ISE while fetching glcode for instrument type, instrument service failed to return values"; - - public static final String DUPLICATE_RCPT_EXCEPTION_MSG = "Duplicate Receipt"; - public static final String DUPLICATE_RCPT_EXCEPTION_DESC = "Receipt number already exists, Receipt cannot be created"; - - public static final String INVALID_BILL_EXCEPTION_MSG = "Invalid Bill"; - public static final String INVALID_BILL_EXCEPTION_DESC = "Bill is invalid, Receipt cannot be created."; - public static final String INVALID_BILL_EXCEPTION_MESSAGE_DESC = " is invalid, Receipt cannot be created,"; - - public static final String CUTT_OFF_DATE_CODE = "egcl_0016"; - public static final String CUTT_OFF_DATE_FIELD = "manualReceiptDate"; - public static final String CUTT_OFF_DATE_MESSAGE = "Manual receipt date is greater than the cut-off date "; - public static final String CUTT_OFF_DATE_MESSAGE_DESC = " for legacy data entry.Please enter proper date"; - - public static final String FROM_DATE_GREATER_CODE = "egcl_0017"; - public static final String FROM_DATE_GREATER_FIELD = "FromDate ot ToDate"; - public static final String FROM_DATE_GREATER_MESSAGE = "From Date is greater than To Date "; - - public static final String BUSINESS_CODE_REQUIRED_CODE = "egcl_0019"; - public static final String BUSINESS_CODE_REQUIRED_FIELD = "businessCode"; - public static final String BUSINESS_CODE_REQUIRED_MESSAGE = "Business code is Required"; - - public static final String RCPTNO_MISSING_CODE = "egcl_0017"; - public static final String RCPTNO_FIELD_NAME = "receiptNo"; - public static final String RCPTNO_MISSING_MESSAGE = "Receipt Number is Required"; - - public static final String RCPTDATE_MISSING_CODE = "egcl_0018"; - public static final String RCPTDATE_FIELD_NAME = "receiptDate"; - public static final String RCPTDATE_MISSING_MESSAGE = "Receipt Date is Required"; - - public static final String RECEIPT_WORKFLOW_ASSIGNEE_MISSING_CODE = "egcl_0019"; - public static final String RECEIPT_WORKFLOW_ASSIGNEE_MISSING_FIELD = "initiatorPosition"; - public static final String RECEIPT_WORKFLOW_ASSIGNEE_MISSING_MESSAGE = "Assignment details not found for workflow"; - - public static final String RECEIPT_CHEQUE_OR_DD_DATE = "INVALID_CHEQUE_DD_DATE"; - public static final String RECEIPT_CHEQUE_OR_DD_DATE_FIELD = "Cheque/DD Date"; - public static final String RECEIPT_CHEQUE_OR_DD_DATE_MESSAGE = "Cheque/DD date should not be greater than Manual Receipt Date "; - - public static final String RECEIPT_NEFT_OR_RTGS_DATE = "INVALID_NEFT_RTGS_DATE"; - public static final String RECEIPT_NEFT_OR_RTGS_DATE_MESSAGE = "NEFT/RTGS date should not be greater than Manual Receipt Date "; - - public static final String CHEQUE_DD_DATE_WITH_MANUAL_RECEIPT_DATE_CODE = "egcl_0021"; - public static final String CHEQUE_DD_DATE_WITH_MANUAL_RECEIPT_DATE_FIELD = "Cheque/DD Date"; - public static final String CHEQUE_DD_DATE_WITH_MANUAL_RECEIPT_DATE_MESSAGE = "Cheque/DD date should be less than and within 90 days of Manual Receipt Date "; - - public static final String CHEQUE_DD_DATE_WITH_RECEIPT_DATE_CODE = "egcl_0021"; - public static final String CHEQUE_DD_DATE_WITH_RECEIPT_DATE_FIELD = "Cheque/DD Date"; - public static final String CHEQUE_DD_DATE_WITH_RECEIPT_DATE_MESSAGE = "Cheque/DD date should be less than and within 90 days of Current Date"; - - public static final String CHEQUE_DD_DATE_WITH_FUTURE_DATE_CODE = "egcl_0022"; - public static final String CHEQUE_DD_DATE_WITH_FUTURE_DATE_FIELD = "Cheque/DD Date"; - public static final String CHEQUE_DD_DATE_WITH_FUTURE_DATE_MESSAGE = "Cheque/DD date can not be future Date"; - - public static final String ONLINE_PAYMENT_CODE = "egcl_0023"; - public static final String ONLINE_PAYMENT_FIELD = "Instrument type"; - public static final String ONLINE_PAYMENT_MESSAGE = "Only citizen portal user is eligible for online payments"; - - public static final String AMOUNT_PAID_CODE = "egcl_0022"; - public static final String AMOUNT_PAID_FIELD = "Amount Paid"; - public static final String AMOUNT_PAID_MESSAGE = "Invalid amount entered in amountPaid field. Amount should be " + - "greater than 0 and without fractions"; - - public static final String INSTRUMENT_TYPE_CASH = "Cash"; - public static final String INSTRUMENT_TYPE_ONLINE = "ONLINE"; - public static final String INSTRUMENT_TYPE_CHEQUE = "Cheque"; - public static final String INSTRUMENT_TYPE_DD = "DD"; - public static final String INSTRUMENT_TYPE_CARD = "Card"; - - public static final String MANUAL_RECEIPT_DETAILS_REQUIRED_CONFIG_KEY = "MANUAL_RECEIPT_DETAILS_REQUIRED_OR_NOT"; - - public static final String MANUAL_RECEIPT_DETAILS_CUTOFF_DATE_CONFIG_KEY = "CUTOFF_DATE_FOR_MANUAL_RECEIPT_DETAILS"; - - public static final String COLLECTION_LEGACY_RECEIPT_CREATOR_ROLE = "Legacy Receipt Creator"; - public static final String COLLECTION_ONLINE_RECEIPT_ROLE = "CITIZEN"; - - public static final String STATEID_NOT_UPDATED_FOR_RECEIPT = "State Id is not updated for receipt"; - - public static final String RECEIPT_PREAPPROVED_OR_APPROVED_CONFIG_KEY = "RECEIPT_PREAPPROVED_OR_APPROVED"; - public static final String PREAPPROVED_CONFIG_VALUE = "PREAPPROVED"; - - public static final String INSTRUMENT_DATE_DAYS = "90"; - - public static final String ONLINE_PAYMENT_AUTHORISATION_SUCCESS_CODE = "0300"; - - public static final String ONLINE_PAYMENT_REMARKS = "Online Payment is done successfully"; - - public static final String BANKACCOUNT_SERVICE_MAPPING_BUSINESSDETAILS_CODE = "egcl_002"; - public static final String BANKACCOUNT_SERVICE_MAPPING_BUSINESSDETAILS_FIELD = "businessdetails"; - public static final String BANKACCOUNT_SERVICE_MAPPING_BUSINESSDETAILS_MESSAGE = "Please select business details"; - - public static final String BANKACCOUNT_SERVICE_MAPPING_BANKACCOUNT_CODE = "egcl_003"; - public static final String BANKACCOUNT_SERVICE_MAPPING_BANKACCOUNT_FIELD = "businessdetails"; - public static final String BANKACCOUNT_SERVICE_MAPPING_BANKACCOUNT_MESSAGE = "Please select bank account"; - - public static final String BANKACCOUNT_SERVICE_MAPPING_EXISTS_CODE = "egcl_004"; - public static final String BANKACCOUNT_SERVICE_MAPPING_EXISTS_FIELD = "Bank Account service mappping"; - public static final String BANKACCOUNT_SERVICE_MAPPING_EXISTS_MESSAGE1 = "The service "; - public static final String BANKACCOUNT_SERVICE_MAPPING_EXISTS_MESSAGE2 = " is already mapped to the bank account number "; - public static final String BANKACCOUNT_SERVICE_MAPPING_EXISTS_MESSAGE3 = ". Please select the correct bank account"; - - public static final String SEARCH_BANKACCOUNT_SERVICE_MAPPING_REQUEST = "Bank account service request is invalid"; - - public static final String VOUCHER_HEADER_KEY = "voucherHeader"; - - public static final String BILLING_MASTER_CODE = "BusinessService"; - - public static final String BILLING_MODULE_NAME = "BillingService"; - - public static final String MDMS_BUSINESSSERVICE_PATH = "$.MdmsRes.BillingService.BusinessService"; - - public static final String MASTER_BUSINESSSERVICE_KEY = "code"; - - public static final String MASTER_ISADVANCEALLOWED_KEY = "isAdvanceAllowed"; - - public static final String MASTER_PARTPAYMENTALLOWED_KEY = "partPaymentAllowed"; - - public static final String MASTER_COLLECTIONMODESNOTALLOWED_KEY = "collectionModesNotAllowed"; - - public static final String KEY_ID = "id"; - - public static final String KEY_FILESTOREID = "filestoreid"; - - public static final String KEY_PDF_JOBS = "jobs"; - - public static final String KEY_PDF_ENTITY_ID = "entityid"; - - public static final String KEY_PDF_FILESTOREID = "filestoreids"; - - public static final String COLLECTION_LOCALIZATION_MODULE = "collection-services"; - - public static final String BUSINESSSERVICE_LOCALIZATION_MODULE = "rainmaker-uc"; - - public static final String LOCALIZATION_CODES_JSONPATH = "$.messages.*.code"; - - public static final String LOCALIZATION_MSGS_JSONPATH = "$.messages.*.message"; - - public static final String BUSINESSSERVICE_CODES_JSONPATH = "$.MdmsRes.BillingService.BusinessService"; - - public static final String BUSINESSSERVICE_MDMS_MASTER = "BusinessService"; - - public static final String BUSINESSSERVICE_CODES_FILTER = "$.[?(@.type=='Adhoc')].code"; - - public static final String BUSINESSSERVICE_MDMS_MODULE = "BillingService"; - - public static final String BUSINESSSERVICELOCALIZATION_CODE_PREFIX = "BILLINGSERVICE_BUSINESSSERVICE_"; - - public static final String WF_MT_STATUS_OPEN_CODE = "UC_NOTIF_WF_MT_NEW"; - - public static final String WF_MT_STATUS_DEPOSITED_CODE = "UC_NOTIF_WF_MT_DEPOSITED"; - - public static final String WF_MT_STATUS_CANCELLED_CODE = "UC_NOTIF_WF_MT_CANCELLED"; - - public static final String WF_MT_STATUS_DISHONOURED_CODE = "UC_NOTIF_WF_MT_DISHONOURED"; - - public static final String CITIZEN_ROLE = "CITIZEN"; - - public static final String EMPLOYEE_TYPE = "EMPLOYEE"; - - public static final String SCHEMA_PLACEHOLDER = "{schema}"; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/consumer/CollectionConsumer.java b/business-services/collection-services/src/main/java/org/egov/collection/consumer/CollectionConsumer.java deleted file mode 100644 index 0376aff0162..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/consumer/CollectionConsumer.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.consumer; - -import java.util.HashMap; -import java.util.List; - -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.BankAccountServiceMapping; -import org.egov.collection.service.BankAccountMappingService; -import org.egov.collection.web.contract.BankAccountServiceMappingReq; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class CollectionConsumer { - - public static final Logger logger = LoggerFactory.getLogger(CollectionConsumer.class); - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private BankAccountMappingService bankAccountMappingService; - - @KafkaListener(topics = { "${kafka.topics.bankaccountservicemapping.create.name}" }) - public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - logger.info("Record: " + record.toString()); - try { - if (topic.equals(applicationProperties.getCreateBankAccountServiceMappingTopicName())) { - logger.info("Consuming cancel Receipt request"); - BankAccountServiceMappingReq bankAccountServiceMappingReq = objectMapper.convertValue(record, - BankAccountServiceMappingReq.class); - List modelBankAccountServiceMappings = new BankAccountServiceMapping() - .toDomainModelList(bankAccountServiceMappingReq.getBankAccountServiceMapping(), - bankAccountServiceMappingReq.getRequestInfo()); - bankAccountMappingService.createBankAccountToServiceMapping(modelBankAccountServiceMappings); - } - - } catch (final Exception e) { - logger.error("Error while listening to value: " + record + " on topic: " + topic + ": ", e.getMessage()); - } - } - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/consumer/CollectionNotificationConsumer.java b/business-services/collection-services/src/main/java/org/egov/collection/consumer/CollectionNotificationConsumer.java deleted file mode 100644 index 0725060cf95..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/consumer/CollectionNotificationConsumer.java +++ /dev/null @@ -1,198 +0,0 @@ -package org.egov.collection.consumer; - -import static org.egov.collection.config.CollectionServiceConstants.BUSINESSSERVICELOCALIZATION_CODE_PREFIX; -import static org.egov.collection.config.CollectionServiceConstants.BUSINESSSERVICE_LOCALIZATION_MODULE; -import static org.egov.collection.config.CollectionServiceConstants.COLLECTION_LOCALIZATION_MODULE; -import static org.egov.collection.config.CollectionServiceConstants.LOCALIZATION_CODES_JSONPATH; -import static org.egov.collection.config.CollectionServiceConstants.LOCALIZATION_MSGS_JSONPATH; -import static org.egov.collection.config.CollectionServiceConstants.WF_MT_STATUS_CANCELLED_CODE; -import static org.egov.collection.config.CollectionServiceConstants.WF_MT_STATUS_DEPOSITED_CODE; -import static org.egov.collection.config.CollectionServiceConstants.WF_MT_STATUS_DISHONOURED_CODE; -import static org.egov.collection.config.CollectionServiceConstants.WF_MT_STATUS_OPEN_CODE; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.producer.CollectionProducer; -import org.egov.collection.web.contract.Bill; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; -import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils; - -@Slf4j -@Component -public class CollectionNotificationConsumer{ - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - private CollectionProducer producer; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private MultiStateInstanceUtil multiStateInstanceUtil; - - @KafkaListener(topics = { "${kafka.topics.payment.create.name}", "${kafka.topics.payment.receiptlink.name}" }) - public void listen(HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic){ - try{ - PaymentRequest req = objectMapper.convertValue(record, PaymentRequest.class); - sendNotification(req); - }catch(Exception e){ - log.error("Exception while reading from the queue: ", e); - } - } - - private void sendNotification(PaymentRequest paymentRequest){ - Payment payment = paymentRequest.getPayment(); - for (PaymentDetail paymentDetail : payment.getPaymentDetails()) { - String mobNo = payment.getMobileNumber(); - String paymentStatus = (payment.getPaymentStatus().toString() == null ? "NEW" : payment.getPaymentStatus().toString()); - Bill bill = paymentDetail.getBill(); - String message = buildSmsBody(bill, paymentDetail, paymentRequest.getRequestInfo(), paymentStatus); - if (!StringUtils.isEmpty(message)) { - HashMap request = new HashMap<>(); - request.put("mobileNumber", mobNo); - request.put("message", message); - producer.push(payment.getTenantId(), applicationProperties.getSmsTopic(), request); - } else { - log.error("Message not configured! No notification will be sent."); - } - } - - } - - private String buildSmsBody(Bill bill, PaymentDetail paymentDetail, RequestInfo requestInfo, String paymentStatus){ - String message = null; - String content = null; - switch(paymentStatus.toUpperCase()){ - case "NEW": - content = fetchContentFromLocalization(requestInfo, paymentDetail.getTenantId(), COLLECTION_LOCALIZATION_MODULE, WF_MT_STATUS_OPEN_CODE); - break; - case "DEPOSITED": - content = fetchContentFromLocalization(requestInfo, paymentDetail.getTenantId(), COLLECTION_LOCALIZATION_MODULE, WF_MT_STATUS_DEPOSITED_CODE); - break; - case "CANCELLED": - content = fetchContentFromLocalization(requestInfo, paymentDetail.getTenantId(), COLLECTION_LOCALIZATION_MODULE, WF_MT_STATUS_CANCELLED_CODE); - break; - case "DISHONOURED": - content = fetchContentFromLocalization(requestInfo, paymentDetail.getTenantId(), COLLECTION_LOCALIZATION_MODULE, WF_MT_STATUS_DISHONOURED_CODE); - break; - default: - break; - } - if(!StringUtils.isEmpty(content)){ - StringBuilder link = new StringBuilder(); - link.append(applicationProperties.getUiHost() + "/citizen").append("/otpLogin?mobileNo=").append(bill.getMobileNumber()).append("&redirectTo=") - .append(applicationProperties.getUiRedirectUrl()).append("¶ms=").append(paymentDetail.getTenantId() + "," + paymentDetail.getReceiptNumber()); - - String receiptLink = getShortenedUrl(link.toString()); - - content = content.replaceAll("{rcpt_link}", receiptLink); - - String moduleName = fetchContentFromLocalization(requestInfo, paymentDetail.getTenantId(), - BUSINESSSERVICE_LOCALIZATION_MODULE, formatCodes(paymentDetail.getBusinessService())); - - if(StringUtils.isEmpty(moduleName)) - moduleName = "Adhoc Tax"; - - content = content.replaceAll("{owner_name}", bill.getPayerName()); - - if(content.contains("{amount_paid}")) - content = content.replaceAll("{amount_paid}", paymentDetail.getTotalAmountPaid().toString()); - - content = content.replaceAll("{rcpt_no}", paymentDetail.getReceiptNumber()); - content = content.replaceAll("{mod_name}", moduleName); - content = content.replaceAll("{unique_id}", bill.getConsumerCode()); - message = content; - } - return message; - } - - private String fetchContentFromLocalization(RequestInfo requestInfo, String tenantId, String module, String code){ - String message = null; - List codes = new ArrayList<>(); - List messages = new ArrayList<>(); - Object result = null; - String locale = ""; - if(requestInfo.getMsgId().contains("|")) - locale = requestInfo.getMsgId().split("[\\|]")[1]; - if(StringUtils.isEmpty(locale)) - locale = applicationProperties.getFallBackLocale(); - StringBuilder uri = new StringBuilder(); - uri.append(applicationProperties.getLocalizationHost()).append(applicationProperties.getLocalizationEndpoint()); - uri.append("?tenantId=").append(multiStateInstanceUtil.getStateLevelTenant(tenantId)) - .append("&locale=").append(locale).append("&module=").append(module); - - Map request = new HashMap<>(); - request.put("RequestInfo", requestInfo); - try { - result = restTemplate.postForObject(uri.toString(), request, Map.class); - codes = JsonPath.read(result, LOCALIZATION_CODES_JSONPATH); - messages = JsonPath.read(result, LOCALIZATION_MSGS_JSONPATH); - } catch (Exception e) { - log.error("Exception while fetching from localization: " + e); - } - if(CollectionUtils.isEmpty(messages)){ - throw new CustomException("LOCALIZATION_NOT_FOUND", "Localization not found for the code: " + code); - } - for(int index = 0; index < codes.size(); index++){ - if(codes.get(index).equals(code)){ - message = messages.get(index); - } - } - return message; - } - - private String formatCodes(String code){ - String regexForSpecialCharacters = "[-+$&,:;=?@#|'<>.^*()%!]"; - code = code.replaceAll(regexForSpecialCharacters, ""); - code = code.replaceAll(" ", "_"); - - return BUSINESSSERVICELOCALIZATION_CODE_PREFIX + code.toUpperCase(); - } - - /** - * Method to shortent the url - * returns the same url if shortening fails - * @param url - */ - public String getShortenedUrl(String url){ - - HashMap body = new HashMap<>(); - body.put("url",url); - StringBuilder builder = new StringBuilder(applicationProperties.getUrlShortnerHost()); - builder.append(applicationProperties.getUrlShortnerEndpoint()); - String res = restTemplate.postForObject(builder.toString(), body, String.class); - - if(StringUtils.isEmpty(res)){ - log.error("URL_SHORTENING_ERROR","Unable to shorten url: "+url); ; - return url; - } - else return res; - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/consumer/FileStoreConsumer.java b/business-services/collection-services/src/main/java/org/egov/collection/consumer/FileStoreConsumer.java deleted file mode 100644 index 207c06fea84..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/consumer/FileStoreConsumer.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.collection.consumer; - - -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.apache.kafka.common.protocol.types.Field; -import org.egov.collection.repository.PaymentRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Component; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import static org.egov.collection.config.CollectionServiceConstants.*; - -@Component -@Slf4j -public class FileStoreConsumer { - - - @Autowired - private PaymentRepository paymentRepository; - - @KafkaListener(topics = { "${kafka.topics.filestore}" }) - public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - - List> jobMaps = (List>)record.get(KEY_PDF_JOBS); - - List> idTofileStoreIdMaps = new LinkedList<>(); - - jobMaps.forEach(job -> { - Map idToFileStore = new HashMap<>(); - idToFileStore.put(KEY_ID,(String) job.get(KEY_PDF_ENTITY_ID)); - idToFileStore.put(KEY_FILESTOREID, StringUtils.join((List)job.get(KEY_PDF_FILESTOREID),',')); - idTofileStoreIdMaps.add(idToFileStore); - log.info("Updating filestorid for: "+idToFileStore.get(KEY_ID)); - }); - - - paymentRepository.updateFileStoreId(idTofileStoreIdMaps); - - - } - - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/consumer/HashMapDeserializer.java b/business-services/collection-services/src/main/java/org/egov/collection/consumer/HashMapDeserializer.java deleted file mode 100644 index 678f1800619..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/consumer/HashMapDeserializer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.consumer; - -import org.springframework.kafka.support.serializer.JsonDeserializer; - -import java.util.HashMap; - -public class HashMapDeserializer extends JsonDeserializer { - - public HashMapDeserializer() { - super(HashMap.class); - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/AuditDetails.java b/business-services/collection-services/src/main/java/org/egov/collection/model/AuditDetails.java deleted file mode 100644 index f206df3c796..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/AuditDetails.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -import javax.validation.constraints.Size; - -@Builder -@Setter -@Getter -@ToString -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class AuditDetails { - - @Size(max=64) - @JsonProperty("createdBy") - private String createdBy = null; - - @JsonProperty("createdTime") - private Long createdTime = null; - - @Size(max=64) - @JsonProperty("lastModifiedBy") - private String lastModifiedBy = null; - - @JsonProperty("lastModifiedTime") - private Long lastModifiedTime = null; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/BankAccountServiceMapping.java b/business-services/collection-services/src/main/java/org/egov/collection/model/BankAccountServiceMapping.java deleted file mode 100644 index fbb77a97ab5..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/BankAccountServiceMapping.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model; - -import java.util.List; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class BankAccountServiceMapping { - - private String businessDetails; - - private String bankAccount; - - private String bank; - - private String bankBranch; - - private Long createdBy; - - private Long lastModifiedBy; - - private String tenantId; - - public BankAccountServiceMapping(org.egov.collection.web.contract.BankAccountServiceMapping bankAccountServiceMapping, - RequestInfo requestInfo) { - this.bankAccount = bankAccountServiceMapping.getBankAccount(); - this.bank = bankAccountServiceMapping.getBank(); - this.bankBranch = bankAccountServiceMapping.getBankBranch(); - this.businessDetails = bankAccountServiceMapping.getBusinessDetails(); - this.createdBy = requestInfo.getUserInfo().getId(); - this.lastModifiedBy = requestInfo.getUserInfo().getId(); - this.tenantId = bankAccountServiceMapping.getTenantId(); - - } - - public List toDomainModelList( - final List bankAccountServiceList, - final RequestInfo requestInfo) { - return bankAccountServiceList.stream() - .map(bankAccountServiceMapping -> new BankAccountServiceMapping(bankAccountServiceMapping, requestInfo)) - .collect(Collectors.toList()); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/BankAccountServiceMappingSearchCriteria.java b/business-services/collection-services/src/main/java/org/egov/collection/model/BankAccountServiceMappingSearchCriteria.java deleted file mode 100644 index fbb5c518002..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/BankAccountServiceMappingSearchCriteria.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.egov.collection.model; - -import lombok.*; - -import java.util.List; - -@Getter -@Setter -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class BankAccountServiceMappingSearchCriteria { - - private String tenantId; - - private List businessDetails; - - private String bankAccount; - - private String bank; - - private String bankBranch; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/BillingServiceRequestInfo.java b/business-services/collection-services/src/main/java/org/egov/collection/model/BillingServiceRequestInfo.java deleted file mode 100644 index c9589e769d0..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/BillingServiceRequestInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.egov.collection.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.contract.request.User; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * RequestInfo should be used to carry meta information about the requests to - * the server as described in the fields below. All eGov APIs will use - * requestinfo as a part of the request body to carry this meta information. - * Some of this information will be returned back from the server as part of the - * ResponseInfo in the response body to ensure correlation. Author : Narendra - */ - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class BillingServiceRequestInfo { - @JsonProperty("apiId") - @NotNull - @Size(max = 128) - private String apiId = null; - - @JsonProperty("ver") - @NotNull - @Size(max = 32) - private String ver = null; - - @JsonProperty("ts") - @NotNull - private Long ts = null; - - @JsonProperty("action") - @NotNull - @Size(max = 32) - private String action = null; - - @JsonProperty("did") - @Size(max = 1024) - private String did = null; - - @JsonProperty("key") - @Size(max = 256) - private String key = null; - - @JsonProperty("msgId") - @NotNull - @Size(max = 256) - private String msgId = null; - - @JsonProperty("requesterId") - @Size(max = 256) - private String requesterId = null; - - @JsonProperty("authToken") - private String authToken = null; - - @JsonProperty("userInfo") - private User userInfo = null; - - @JsonProperty("correlationId") - private String correlationId = null; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/BillingServiceRequestWrapper.java b/business-services/collection-services/src/main/java/org/egov/collection/model/BillingServiceRequestWrapper.java deleted file mode 100644 index 9b9c811e1ab..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/BillingServiceRequestWrapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.collection.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -public class BillingServiceRequestWrapper { - - @JsonProperty("RequestInfo") - private BillingServiceRequestInfo billingServiceRequestInfo; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/CommonDataModel.java b/business-services/collection-services/src/main/java/org/egov/collection/model/CommonDataModel.java deleted file mode 100644 index c84a0599a20..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/CommonDataModel.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model; - - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; - -@Getter -@Builder -@AllArgsConstructor -@EqualsAndHashCode -public class CommonDataModel { - - private Long id; - - private String name; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/Department.java b/business-services/collection-services/src/main/java/org/egov/collection/model/Department.java deleted file mode 100644 index 5fd020fd88d..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/Department.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -public class Department { - - @NotNull - private Long id; - - @NotNull - @Size(min=8, max=64) - private String name; - - @NotNull - @Size(min=1, max=10) - private String code; - - @NotNull - private Boolean active; - - @NotNull - private String tenantId; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/DepartmentSearchCriteria.java b/business-services/collection-services/src/main/java/org/egov/collection/model/DepartmentSearchCriteria.java deleted file mode 100644 index 34bd5f623df..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/DepartmentSearchCriteria.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; - -@Getter -@Builder -@AllArgsConstructor -@EqualsAndHashCode -public class DepartmentSearchCriteria { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - public String tenantId; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/DesignationSearchCriteria.java b/business-services/collection-services/src/main/java/org/egov/collection/model/DesignationSearchCriteria.java deleted file mode 100644 index 49d398a5c9f..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/DesignationSearchCriteria.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; - -@Getter -@Builder -@AllArgsConstructor -@EqualsAndHashCode -public class DesignationSearchCriteria { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - private String buisnessKey; - - private String tenantId; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/EmployeeInfo.java b/business-services/collection-services/src/main/java/org/egov/collection/model/EmployeeInfo.java deleted file mode 100644 index 642895ad23b..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/EmployeeInfo.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - -import lombok.*; - -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@Builder -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -public class EmployeeInfo { - - private Long id; - - @Size(min=1, max=256) - private String code; - - @Size(max=5) - private String salutation; - - @Size(min=3, max=100) - private String name; - - @Size(min=1, max=64) - private String userName; - - - @Size(max=10) - private String mobileNumber; - - @Size(min=5, max=128) - private String emailId; - - @Size(max=10) - private String pan; - - @Size(max=12) - private String aadhaarNumber; - - private Boolean active; - - private Long employeeStatus; - - private Long employeeType; - - private List jurisdictions = new ArrayList(); - - private Long bank; - - private Long bankBranch; - - @Size(max=20) - private String bankAccount; - - private List documents = new ArrayList(); - - private String tenantId; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/EnumData.java b/business-services/collection-services/src/main/java/org/egov/collection/model/EnumData.java deleted file mode 100644 index 2a46af767c6..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/EnumData.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - -import lombok.*; - -@AllArgsConstructor -@Getter -@Builder -@NoArgsConstructor -@Setter -public class EnumData { - private String key; - private Object object; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/FinancialStatusContract.java b/business-services/collection-services/src/main/java/org/egov/collection/model/FinancialStatusContract.java deleted file mode 100644 index 33eb7378169..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/FinancialStatusContract.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.egov.collection.model; - -public class FinancialStatusContract { - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/IdGenerationRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/model/IdGenerationRequest.java deleted file mode 100644 index 32c2aa3a073..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/IdGenerationRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.collection.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.ToString; - -import org.egov.common.contract.request.RequestInfo; - -import java.util.List; - -@Getter -@AllArgsConstructor -@ToString -public class IdGenerationRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - private List idRequests; - -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/IdGenerationResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/model/IdGenerationResponse.java deleted file mode 100644 index 9fbdb52aba6..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/IdGenerationResponse.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.collection.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.ToString; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Getter -@ToString -@AllArgsConstructor -@NoArgsConstructor -public class IdGenerationResponse { - - private ResponseInfo responseInfo; - - private List idResponses; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/IdRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/model/IdRequest.java deleted file mode 100644 index 705a95ba768..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/IdRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.egov.collection.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.ToString; - -import javax.validation.constraints.NotNull; - -@Getter -@AllArgsConstructor -@NoArgsConstructor -@ToString -public class IdRequest { - - @JsonProperty("idName") - @NotNull - private String idName; - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("format") - private String format; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/IdResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/model/IdResponse.java deleted file mode 100644 index 96c8980c724..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/IdResponse.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.collection.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.ToString; - -@AllArgsConstructor -@NoArgsConstructor -@Getter -@ToString -public class IdResponse { - - private String id; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/Instrument.java b/business-services/collection-services/src/main/java/org/egov/collection/model/Instrument.java deleted file mode 100644 index b2ba9f73cb8..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/Instrument.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.v1.AuditDetails_v1; -import org.egov.collection.web.contract.BankAccountContract; -import org.egov.collection.web.contract.BankContract; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@ToString -public class Instrument{ - - /* - * id is the unique reference to Instrument Header entered in the system. - */ - private String id; - - /* - * transactionNumber unique number of the instrument. For cheque type this - * is cheque date. For DD type it is DD number - * - */ - private String transactionNumber; - - /* - * transactionDate is the date of instrument . For cheque type it is cheque - * date. for DD it is DD date - */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy") - private Date transactionDate; - - /** - * Transaction date as long comes from UI in case of cheque and DD - */ - private Long transactionDateInput; - - /* - * amount is the instrument amount. For cheque type it is cheque amount. - */ - @NotNull - @Min(value = 0) - @Max(value = 999999999) - private BigDecimal amount; - - /* - * instrumentType specifies the type of the instrument - The folowing are - * the different types Cash,Cheque,DD,POC - * - */ - @NotNull - private InstrumentType instrumentType; - - private Long instrumentDate; - - private String instrumentNumber; - - /* - * bank references to the bank from which the payment/Receipt is made. - */ - private BankContract bank; - - /* - * branchName is the branch name entered in the collection Receipt. - */ - - @Size(max = 50) - private String branchName; - - /* - * bankAccount is the reference of the Bank account from which the payment - * instrument is assigned - */ - private BankAccountContract bankAccount; - - /** - * IFSC Code of the bank branch - */ - private String ifscCode; - - - /* - * transactionType are of two kinds -Debit and Credit. When its a receipt - * instrument it is Debit and in case of payment instrument its credit. - */ - private TransactionType transactionType; - - /** - * Status of the instrument, newly added - */ - private InstrumentStatusEnum instrumentStatus; - - /* - * payee is the entity who is making the payment via instrument - */ - @Size(max = 50) - private String payee; - - /* - * drawer is the entity to which the payment is made. - */ - @Size(max = 100) - private String drawer; - - /* - * surrenderReason is the reason from the defined list seleted while - * surrendering a payment cheque. Depending on the reason, the cheque can be - * re-used or not is decided. - */ - private SurrenderReason surrenderReason; - - /* - * serialNo is the series of the cheque numbers from which the instrument is - * assigned from. The cheque numbers in an account is defined based on Year, - * Bank account and tagged to a department. - */ - //@NotBlank - @Size(max = 50, min = 2) - private String serialNo; - - /* - * instrumentVouchers is the reference to the payment vouchers for which the - * instrument is attached. - */ - // @DrillDownTable - private Set instrumentVouchers = new HashSet(0); - - private AuditDetails_v1 auditDetails; - - private JsonNode additionalDetails; - - @NotNull - private String tenantId; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentRequest.java deleted file mode 100644 index 112f190e21d..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.egov.collection.model; - -import lombok.Data; -import org.egov.common.contract.request.RequestInfo; - -import java.util.ArrayList; -import java.util.List; - -@Data -public class InstrumentRequest { - private RequestInfo requestInfo = new RequestInfo(); - private List instruments = new ArrayList<>(); - private String ids; -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentStatus.java b/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentStatus.java deleted file mode 100644 index 1982a2ed2d0..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentStatus.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@ToString -@Builder -public class InstrumentStatus { - - /** - * Unique Identifier of the status - */ - @NotNull - private String id; - - @NotNull - @Size(min = 3, max = 50) - private String moduleType; - - /** - * name is the status name - */ - @NotNull - @Size(min = 3, max = 20) - private String name; - - /** - * description is the detailed description of the status - */ - @NotNull - @Size(min = 3, max = 250) - private String description; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentType.java b/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentType.java deleted file mode 100644 index 61fd67cf416..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentType.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.NotBlank; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class InstrumentType{ - - /* - * id is the unique reference to instrument type entered in the system. - */ - private String id; - - /* - * type specifies the mode/type of transaction that can be made - i.e - * Cheque,DD,RTGS. For receipt - Cheque,DD,RTGS - */ - @NotNull - @NotBlank - @Size(max = 50, min = 2) - private String name; - - /* - * description specifies details of the instrument type . For example type - * DD description may be Demand Draft - */ - - @Size(max = 100) - private String description; - - /* - * active specifies whether the type is active for transacting. - */ - @NotNull - private Boolean active; - - @Valid - @NotNull - @Size(max = 2, min = 2, message = "") - private List instrumentTypeProperties; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentTypeProperty.java b/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentTypeProperty.java deleted file mode 100644 index 61194233a50..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentTypeProperty.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.egov.collection.model; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class InstrumentTypeProperty{ - - @NotNull - private TransactionType transactionType; - @NotNull - private Boolean reconciledOncreate; - @NotNull - private InstrumentStatus statusOnCreate; - @NotNull - private InstrumentStatus statusOnUpdate; - @NotNull - private InstrumentStatus statusOnReconcile; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentVoucher.java b/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentVoucher.java deleted file mode 100644 index b8ca3e6a376..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/InstrumentVoucher.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model; - - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class InstrumentVoucher { - - /* - * instrumentHeaderId is the reference of the instrument attached to a - * voucher - */ - private Instrument instrument; - - /* - * voucherHeaderId is the reference of the voucher attached to a instrument. - */ - private String voucherHeaderId; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/LegacyReceiptDetails.java b/business-services/collection-services/src/main/java/org/egov/collection/model/LegacyReceiptDetails.java deleted file mode 100644 index 8835cbba6a9..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/LegacyReceiptDetails.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.egov.collection.model; - -import java.math.BigDecimal; - -import javax.validation.constraints.NotNull; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class LegacyReceiptDetails { - public static final Object SEQ_LEGACY_RECEIPT_DETAILS = "seq_legacy_receipt_details"; - - @NotNull - private Long id; - - private String billNo; - - private Long billId; - - private Long billYear; - - private Long taxId; - @NotNull - private Long billDate; - - private String description; - - private BigDecimal currDemand; - - private BigDecimal arrDemand; - - private BigDecimal currCollection; - - private BigDecimal arrCollection; - - private BigDecimal currBalance; - - private BigDecimal arrBalance; - - @NotNull - private Long receiptHeaderId; - @NotNull - private String tenantid; -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/LegacyReceiptGetReq.java b/business-services/collection-services/src/main/java/org/egov/collection/model/LegacyReceiptGetReq.java deleted file mode 100644 index 660cd755f0a..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/LegacyReceiptGetReq.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.egov.collection.model; - -import java.util.List; - -import javax.validation.constraints.NotNull; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -public class LegacyReceiptGetReq { - private List receiptNumbers; - - private Long fromDate; - - private String consumerNo; - - private String limit; - - private Long toDate; - - private String serviceName; - - @NotNull - private String tenantId; - - private String sortBy; - - private String sortOrder; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/LegacyReceiptHeader.java b/business-services/collection-services/src/main/java/org/egov/collection/model/LegacyReceiptHeader.java deleted file mode 100644 index aae4a601444..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/LegacyReceiptHeader.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.egov.collection.model; - -import java.math.BigDecimal; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class LegacyReceiptHeader { - - public static final String SEQ_LEGACY_RECEIPT_HEADER = "SEQ_LEGACY_RECEIPT_HEADER"; - - - @NotNull - private Long id; - - private Long legacyReceiptId; - - @NotNull - private String receiptNo; - - @NotNull - private Long receiptDate; - - private String department; - - private String serviceCode; - - private String serviceName; - - private String consumerNo; - - private String consumerName; - - private BigDecimal totalAmount; - - private BigDecimal advanceAmount; - - private List legacyReceiptDetails; - - private BigDecimal adjustmentAmount; - - private String consumerAddress; - - private String payeeName; - - private String instrumentType; - - private Long instrumentDate; - - private String instrumentNo; - - private String bankName; - - private String manualreceiptnumber; - - private Long manualreceiptDate; - @NotNull - private String tenantId; - - private String remarks; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/OnlinePayment.java b/business-services/collection-services/src/main/java/org/egov/collection/model/OnlinePayment.java deleted file mode 100644 index 1b63fbf42d5..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/OnlinePayment.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.collection.model; - -import lombok.*; - -import java.math.BigDecimal; - -@Getter -@Setter -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class OnlinePayment { - - private Long id; - - private String receiptHeader; - - private String paymentGatewayName; - - private Long transactionDate; - - private BigDecimal transactionAmount; - - private String transactionNumber; - - private String authorisationStatusCode; - - private String status; - - private String remarks; - - private String callBackUrl; - - private String tenantId; - - private AuditDetails auditDetails; - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/Pagination.java b/business-services/collection-services/src/main/java/org/egov/collection/model/Pagination.java deleted file mode 100644 index 0f4afdedd74..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/Pagination.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonProperty.Access; -import lombok.Data; - -import javax.validation.constraints.Max; -import java.util.List; - -@Data -public class Pagination { - - public static int DEFAULT_PAGE_SIZE = 10; - public static int DEFAULT_PAGE_OFFSET = 0; - - private Integer totalResults; - - private Integer totalPages; - - @Max(500l) - private Integer pageSize = DEFAULT_PAGE_SIZE; - - private Integer currentPage; - - private Integer offset = DEFAULT_PAGE_OFFSET; - - @JsonProperty(access = Access.WRITE_ONLY) - List pagedData; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/Payment.java b/business-services/collection-services/src/main/java/org/egov/collection/model/Payment.java deleted file mode 100644 index db7b8a5d2eb..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/Payment.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.egov.collection.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.enums.PaymentModeEnum; -import org.egov.collection.model.enums.PaymentStatusEnum; -import org.hibernate.validator.constraints.SafeHtml; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@EqualsAndHashCode -public class Payment { - - @Size(max=64) - @JsonProperty("id") - private String id; - - @NotNull - @Size(max=64) - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("totalDue") - private BigDecimal totalDue; - - @NotNull - @JsonProperty("totalAmountPaid") - private BigDecimal totalAmountPaid; - - @SafeHtml - @Size(max=128) - @JsonProperty("transactionNumber") - private String transactionNumber; - - @JsonProperty("transactionDate") - private Long transactionDate; - - @NotNull - @JsonProperty("paymentMode") - private PaymentModeEnum paymentMode; - - - @JsonProperty("instrumentDate") - private Long instrumentDate; - - @SafeHtml - @Size(max=128) - @JsonProperty("instrumentNumber") - private String instrumentNumber; - - @JsonProperty("instrumentStatus") - private InstrumentStatusEnum instrumentStatus; - - @SafeHtml - @Size(max=64) - @JsonProperty("ifscCode") - private String ifscCode; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("paymentDetails") - @Valid - private List paymentDetails; - - @SafeHtml - @Size(max=128) - @NotNull - @Pattern(regexp = "^[a-zA-Z]+(([_\\-'`\\. ][a-zA-Z ])?[a-zA-Z]*)*$", message = "Invalid name. Only alphabets and special characters -, ',`, ., _") - @JsonProperty("paidBy") - private String paidBy = null; - - @SafeHtml - @Size(max=64) - @Pattern(regexp = "^[6-9][0-9]{9}$", message = "Invalid mobile number") - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @SafeHtml - @Size(max=128) - @Pattern(regexp = "^[a-zA-Z]+(([_\\-'`\\. ][a-zA-Z ])?[a-zA-Z]*)*$", message = "Invalid name. Only alphabets and special characters -, ',`, ., _") - @JsonProperty("payerName") - private String payerName = null; - - @SafeHtml - @Size(max=1024) - @JsonProperty("payerAddress") - private String payerAddress = null; - - @SafeHtml - @Size(max=64) - @Pattern(regexp = "^$|^(?=^.{1,64}$)((([^<>()\\[\\]\\\\.,;:\\s$*@'\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@'\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,})))$", message = "Invalid emailId") - @JsonProperty("payerEmail") - private String payerEmail = null; - - @SafeHtml - @Size(max=64) - @JsonProperty("payerId") - private String payerId = null; - - @JsonProperty("paymentStatus") - private PaymentStatusEnum paymentStatus; - - @SafeHtml - @JsonProperty("fileStoreId") - private String fileStoreId; - - - public Payment addpaymentDetailsItem(PaymentDetail paymentDetail) { - if (this.paymentDetails == null) { - this.paymentDetails = new ArrayList<>(); - } - this.paymentDetails.add(paymentDetail); - return this; - } - - - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentDetail.java b/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentDetail.java deleted file mode 100644 index b5d12091891..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentDetail.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.egov.collection.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.egov.collection.web.contract.Bill; -import org.hibernate.validator.constraints.SafeHtml; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@EqualsAndHashCode -public class PaymentDetail { - - @Size(max=64) - @JsonProperty("id") - private String id; - - @Size(max=64) - private String paymentId; - - @SafeHtml - @Size(max=64) - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("totalDue") - private BigDecimal totalDue; - - @NotNull - @JsonProperty("totalAmountPaid") - private BigDecimal totalAmountPaid; - - @Size(max=64) - @JsonProperty("receiptNumber") - private String receiptNumber; - - @SafeHtml - @Size(max=64) - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate; - - @JsonProperty("receiptDate") - private Long receiptDate = null; - - @SafeHtml - @JsonProperty("receiptType") - private String receiptType = null; - - @SafeHtml - @JsonProperty("businessService") - private String businessService; - - @NotNull - @Size(max=64) - @JsonProperty("billId") - private String billId; - - @JsonProperty("bill") - private Bill bill; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentRequest.java deleted file mode 100644 index b54c18ed5f8..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentRequest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.collection.model; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class PaymentRequest { - - @NotNull - @Valid - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @Valid - @JsonProperty("Payment") - private Payment payment; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentResponse.java deleted file mode 100644 index cbf4a8a5182..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentResponse.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.egov.collection.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Builder -@Data -@AllArgsConstructor -@NoArgsConstructor -public class PaymentResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Payments") - private List payments; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentSearchCriteria.java b/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentSearchCriteria.java deleted file mode 100644 index 647d5fd1331..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/PaymentSearchCriteria.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.egov.collection.model; - -import java.util.List; -import java.util.Set; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class PaymentSearchCriteria { - - - private Set ids; - - private Set billIds; - - private String tenantId; - - private Set tenantIds; - - private Set receiptNumbers; - - private Set status; - - private Set instrumentStatus; - - private Set paymentModes; - - private List payerIds; - - private Set consumerCodes; - - private Set businessServices; - - private String transactionNumber; - - private String mobileNumber; - - private Long fromDate; - - private Long toDate; - - private Integer offset; - - private Integer limit; - - @Default - private Boolean isCountRequest = false; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/PositionSearchCriteria.java b/business-services/collection-services/src/main/java/org/egov/collection/model/PositionSearchCriteria.java deleted file mode 100644 index 3cf7ee1d763..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/PositionSearchCriteria.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@Builder -@AllArgsConstructor -@NoArgsConstructor -@EqualsAndHashCode -@ToString -public class PositionSearchCriteria { - - private String tenantId; - - private Long employeeId; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/PositionSearchCriteriaWrapper.java b/business-services/collection-services/src/main/java/org/egov/collection/model/PositionSearchCriteriaWrapper.java deleted file mode 100644 index 3c0b7536b00..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/PositionSearchCriteriaWrapper.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@Builder -@AllArgsConstructor -@NoArgsConstructor -@EqualsAndHashCode -@ToString -public class PositionSearchCriteriaWrapper { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("PositionSearchCriteria") - private PositionSearchCriteria positionSearchCriteria; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/ReceiptCommonModel.java b/business-services/collection-services/src/main/java/org/egov/collection/model/ReceiptCommonModel.java deleted file mode 100644 index 0000f76b7ef..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/ReceiptCommonModel.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - -package org.egov.collection.model; - -import lombok.*; -import org.egov.collection.model.enums.CollectionType; -import org.egov.collection.model.enums.Purpose; -import org.egov.collection.model.enums.ReceiptType; -import org.egov.collection.web.contract.*; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@Builder -@EqualsAndHashCode -@NoArgsConstructor -public class ReceiptCommonModel { - - private List receiptHeaders; - - public List toDomainContract() { - List receipts = new ArrayList<>(); - - for (ReceiptHeader receiptHeader : receiptHeaders) { - - List billAccountDetails = new ArrayList<>(); - for (ReceiptDetail rctDetail : receiptHeader.getReceiptDetails()) { - if(null != rctDetail.getDramount() ){ - billAccountDetails.add(BillAccountDetail.builder().isActualDemand(rctDetail.getIsActualDemand()) - .id(rctDetail.getId().toString()).tenantId(rctDetail.getTenantId()) - .billDetail(rctDetail.getReceiptHeader().getId().toString()) - .purpose(Purpose.valueOf(rctDetail.getPurpose())).build()); - - }else{ - billAccountDetails.add(BillAccountDetail.builder().isActualDemand(rctDetail.getIsActualDemand()) - .id(rctDetail.getId().toString()).tenantId(rctDetail.getTenantId()) - .billDetail(rctDetail.getReceiptHeader().getId().toString()) - .glcode(rctDetail.getChartOfAccount()) - .purpose(Purpose.valueOf(rctDetail.getPurpose())).build()); - } - } - CollectionType collectnType = null; - for(CollectionType coll: CollectionType.values()){ - if(coll.getValue().equals(receiptHeader.getCollectionType())){ - collectnType = coll; - break; - } - } - BillDetail billDetail = BillDetail.builder().id(receiptHeader.getId().toString()).billNumber(receiptHeader.getReferenceNumber()) - .consumerCode(receiptHeader.getConsumerCode()).consumerType(receiptHeader.getConsumerType()) - .collectionModesNotAllowed(Collections.singletonList(receiptHeader.getCollModesNotAllwd())) - .tenantId(receiptHeader.getTenantId()) - .billAccountDetails(billAccountDetails).businessService(receiptHeader.getBusinessDetails()) - .receiptNumber(receiptHeader.getReceiptNumber()).receiptType(receiptHeader.getReceiptType()) - .channel(receiptHeader.getChannel()).voucherHeader(receiptHeader.getVoucherheader()) - .collectionType(collectnType).boundary(receiptHeader.getBoundary()) - .reasonForCancellation(receiptHeader.getReasonForCancellation()) - .billAccountDetails(billAccountDetails).receiptDate(receiptHeader.getReceiptDateWithTimeStamp()) //read comment on receiptDateWithTimeStamp variable - .amountPaid(receiptHeader.getTotalAmount() != null ? BigDecimal.valueOf(receiptHeader.getTotalAmount()) : BigDecimal.ZERO).build(); - if(null != receiptHeader.getMinimumAmount()){ - billDetail.setMinimumAmount(BigDecimal.valueOf(receiptHeader.getMinimumAmount())); - } - if(null != receiptHeader.getTotalAmount()){ - billDetail.setTotalAmount(BigDecimal.valueOf(receiptHeader.getTotalAmount())); - } - - Bill billInfo = Bill.builder().payerName(receiptHeader.getPayeename()) - .payerAddress(receiptHeader.getPayeeAddress()).payerEmail(receiptHeader.getPayeeEmail()) - .paidBy(receiptHeader.getPaidBy()).tenantId(receiptHeader.getTenantId()) - .billDetails(Collections.singletonList(billDetail)).build(); - Receipt receipt = Receipt.builder().tenantId(receiptHeader.getTenantId()).bill(Collections.singletonList(billInfo)). - transactionId(receiptHeader.getTransactionId()).instrument(receiptHeader.getReceiptInstrument()).build(); - receipts.add(receipt); - } - - return receipts; - } - -}*/ \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/RequestInfoWrapper.java b/business-services/collection-services/src/main/java/org/egov/collection/model/RequestInfoWrapper.java deleted file mode 100644 index f8a31a41243..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/RequestInfoWrapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.collection.model; - -import lombok.Builder; -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -@Builder -public class RequestInfoWrapper { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/SurrenderReason.java b/business-services/collection-services/src/main/java/org/egov/collection/model/SurrenderReason.java deleted file mode 100644 index 6ebb227ecb9..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/SurrenderReason.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.egov.collection.model; - -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.NotBlank; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@ToString -public class SurrenderReason{ - /** - * id is the unique Identifier of the reason - */ - private String id; - /** - * name is the reason of instrument surrender. Example "Damaged cheque","Cheque to be scrapped" etc - */ - @NotBlank - @Size(max=50,min=5) - private String name; - /** - * description is detailed description of the surrender of a instrument - */ - @NotBlank - @Size(max=250) - private String description; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/Task.java b/business-services/collection-services/src/main/java/org/egov/collection/model/Task.java deleted file mode 100644 index 4e4bbe76e00..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/Task.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model; - -import java.util.Date; - -import org.egov.collection.web.contract.Position; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class Task { - - private String id; - private String businessKey; - private String type; - private Position assignee; - private String comments; - @JsonFormat(pattern = "dd/MM/yyyy") - private Date createdDate; - @JsonFormat(pattern = "dd/MM/yyyy") - private Date lastupdatedSince; - private Position owner; - private String state; - private String status; - private String url; - private String action; - private String senderName; - private String details; - private String natureOfTask; - private String entity; - private String tenantId; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/TaskRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/model/TaskRequest.java deleted file mode 100644 index 817dccaf72f..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/TaskRequest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class TaskRequest { - - @JsonProperty("requestInfo") - private RequestInfo requestInfo = null; - - @JsonProperty("tasks") - private List tasks = new ArrayList<>(); - - @JsonProperty("task") - private Task task = null; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/TaskResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/model/TaskResponse.java deleted file mode 100644 index 0f1ec68fbc3..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/TaskResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class TaskResponse { - @JsonProperty("responseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("tasks") - private List tasks = new ArrayList<>(); - - @JsonProperty("task") - private Task task = null; -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/TransactionType.java b/business-services/collection-services/src/main/java/org/egov/collection/model/TransactionType.java deleted file mode 100644 index b537a6a6ada..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/TransactionType.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.egov.collection.model; - -public enum TransactionType { - Debit,Credit - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/UserSearchCriteria.java b/business-services/collection-services/src/main/java/org/egov/collection/model/UserSearchCriteria.java deleted file mode 100644 index 9e4ba91ea9f..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/UserSearchCriteria.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - -import lombok.*; - -@Getter -@Builder -@AllArgsConstructor -@NoArgsConstructor -@EqualsAndHashCode -@ToString -public class UserSearchCriteria { - - - private long designationId; - - private long departmentId; - - private String tenantId; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/UserSearchCriteriaWrapper.java b/business-services/collection-services/src/main/java/org/egov/collection/model/UserSearchCriteriaWrapper.java deleted file mode 100644 index 927b76c0af5..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/UserSearchCriteriaWrapper.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.model; - - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.ToString; - -@Getter -@Builder -@AllArgsConstructor -@EqualsAndHashCode -@ToString -public class UserSearchCriteriaWrapper { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("UserSearchCriteria") - private UserSearchCriteria userSearchCriteria; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/BankAccountType.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/BankAccountType.java deleted file mode 100644 index 47c6150b912..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/BankAccountType.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model.enums; - -public enum BankAccountType { - RECEIPTS, PAYMENTS, RECEIPTS_PAYMENTS -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/CollectionType.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/CollectionType.java deleted file mode 100644 index 06374515c4d..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/CollectionType.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.egov.collection.model.enums; - - - - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum CollectionType { - COUNTER("COUNTER"), - FIELD("FIELD"), - ONLINE("ONLINE"); - - - private String value; - - CollectionType(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - public String getValue() { - return value; - } - - @JsonCreator - public static CollectionType fromValue(String text) { - if(text!=null){ - for (CollectionType b : CollectionType.values()) { - if (0 ==b.value.compareTo(text)) { - return b; - } - } - } - return null; - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/InstrumentStatusEnum.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/InstrumentStatusEnum.java deleted file mode 100644 index 0b755e9a9ed..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/InstrumentStatusEnum.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.egov.collection.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -import java.util.HashSet; -import java.util.Set; - -public enum InstrumentStatusEnum { - - APPROVED("APPROVED", InstrumentStatusEnum.Category.OPEN), - APPROVAL_PENDING("APPROVAL_PENDING", InstrumentStatusEnum.Category.OPEN), - TO_BE_SUBMITTED("TO_BE_SUBMITTED", InstrumentStatusEnum.Category.OPEN), - REMITTED("REMITTED", InstrumentStatusEnum.Category.OPEN), - REJECTED("REJECTED", InstrumentStatusEnum.Category.CLOSED), - CANCELLED("CANCELLED", InstrumentStatusEnum.Category.CLOSED), - DISHONOURED("DISHONOURED", InstrumentStatusEnum.Category.CLOSED); - - - private String value; - - private InstrumentStatusEnum.Category category; - - InstrumentStatusEnum(String value, InstrumentStatusEnum.Category category) { - this.value = value; - this.category = category; - } - - public boolean isCategory(InstrumentStatusEnum.Category category) { - return this.category == category; - } - - public static Set statusesByCategory(InstrumentStatusEnum.Category category) { - Set statuses = new HashSet<>(); - for (InstrumentStatusEnum b : InstrumentStatusEnum.values()) { - if (b.category == category) { - statuses.add(b.value); - } - } - - return statuses; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static InstrumentStatusEnum fromValue(String text) { - for (InstrumentStatusEnum b : InstrumentStatusEnum.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } - - public enum Category { - OPEN, - CLOSED; - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/InstrumentTypesEnum.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/InstrumentTypesEnum.java deleted file mode 100644 index 1ef7d2ed7b3..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/InstrumentTypesEnum.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.collection.model.enums; - -public enum InstrumentTypesEnum { - CASH, CHEQUE, DD, ONLINE, CARD, - OFFLINE_NEFT, - OFFLINE_RTGS, - ONLINE_NEFT, - ONLINE_RTGS, - POSTAL_ORDER; - - public static boolean contains(String test) { - for (InstrumentTypesEnum val : InstrumentTypesEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/OnlineStatusCode.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/OnlineStatusCode.java deleted file mode 100644 index 29744b58300..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/OnlineStatusCode.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.egov.collection.model.enums; - - -public enum OnlineStatusCode { - SUCCESS, FAILURE, PENDING; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/PaymentModeEnum.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/PaymentModeEnum.java deleted file mode 100644 index a91abf8c890..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/PaymentModeEnum.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.collection.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum PaymentModeEnum { - CASH("CASH"), - CHEQUE("CHEQUE"), - DD("DD"), - ONLINE("ONLINE"), - OFFLINE_NEFT("OFFLINE_NEFT"), - OFFLINE_RTGS("OFFLINE_RTGS"), - ONLINE_NEFT("ONLINE_NEFT"), - ONLINE_RTGS("ONLINE_RTGS"), - POSTAL_ORDER("POSTAL_ORDER"), - CARD("CARD"); - - - private String value; - - PaymentModeEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - public static boolean contains(String test) { - for (PaymentModeEnum val : PaymentModeEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } - - @JsonCreator - public static PaymentModeEnum fromValue(String text) { - for (PaymentModeEnum b : PaymentModeEnum.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/PaymentStatusEnum.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/PaymentStatusEnum.java deleted file mode 100644 index ba3d0c4c75e..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/PaymentStatusEnum.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.egov.collection.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum PaymentStatusEnum { - NEW("NEW"), - DEPOSITED("DEPOSITED"), - CANCELLED("CANCELLED"), - DISHONOURED("DISHONOURED"), - RECONCILED("RECONCILED"); - - - private String value; - - PaymentStatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - - @JsonCreator - public static PaymentStatusEnum fromValue(String text) { - for (PaymentStatusEnum b : PaymentStatusEnum.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } - - public static boolean contains(String test) { - for (PaymentStatusEnum val : PaymentStatusEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } - } diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/Purpose.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/Purpose.java deleted file mode 100644 index a357fbc7859..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/Purpose.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.collection.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum Purpose { - - ARREAR("ARREAR"), - - CURRENT("CURRENT"), - - ADVANCE("ADVANCE"), - - EXEMPTION("EXEMPTION"), - - ARREAR_LATEPAYMENT_CHARGES("ARREAR_LATEPAYMENT_CHARGES"), - - CURRENT_LATEPAYMENT_CHARGES("CURRENT_LATEPAYMENT_CHARGES"), - - CHEQUE_BOUNCE_PENALTY("CHEQUE_BOUNCE_PENALTY"), - - REBATE("REBATE"), - - OTHERS("OTHERS"); - - private String value; - - Purpose(String value) { - this.value = value; - } - - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Purpose fromValue(String text) { - for (Purpose b : Purpose.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/ReasonForCancellation.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/ReasonForCancellation.java deleted file mode 100644 index 88f7ed4e867..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/ReasonForCancellation.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model.enums; - - - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum ReasonForCancellation { - DATAENTRYMISTAKE("Data entry mistake"),OTHERS("Others"); - - - private String name; - - ReasonForCancellation(final String name) { - this.name = name; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(name); - } - - public String getName() { - return name; - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/ReceiptStatus.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/ReceiptStatus.java deleted file mode 100644 index 256672d9efb..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/ReceiptStatus.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model.enums; - - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -import java.util.HashSet; -import java.util.Set; - -public enum ReceiptStatus { - APPROVED("Approved", Category.OPEN), - APPROVALPENDING("Approval Pending",Category.OPEN), - TOBESUBMITTED("To be Submitted", Category.OPEN), - REMITTED("Remitted", Category.OPEN), - REJECTED("Rejected", Category.CLOSED), - CANCELLED("Cancelled",Category.CLOSED), - DISHONOURED("Dishonoured", Category.CLOSED); - - - private String value; - - private Category category; - - ReceiptStatus(String value, Category category) { - this.value = value; - this.category = category; - } - - public boolean isCategory(Category category) { - return this.category == category; - } - - public static Set statusesByCategory(Category category) { - Set statuses = new HashSet<>(); - for (ReceiptStatus b : ReceiptStatus.values()) { - if (b.category == category) { - statuses.add(b.value); - } - } - - return statuses; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static ReceiptStatus fromValue(String text) { - for (ReceiptStatus b : ReceiptStatus.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - - public enum Category { - OPEN, - CLOSED; - } -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/ReceiptType.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/ReceiptType.java deleted file mode 100644 index 85a65b40927..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/ReceiptType.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.collection.model.enums; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum ReceiptType { - ADHOC("Adhoc"), - BILLBASED("BillBased"), - CHALLAN("Challan"); - - - private String name; - - ReceiptType(final String name) { - this.name = name; - } - - @Override - @JsonValue - public String toString() { - return StringUtils.capitalize(name()); - } - - public String getName() { - return name; - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/RemittanceStatus.java b/business-services/collection-services/src/main/java/org/egov/collection/model/enums/RemittanceStatus.java deleted file mode 100644 index 29f66f7ed8f..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/enums/RemittanceStatus.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum RemittanceStatus { - APPROVED("Approved"), NEW("New"); - - private String value; - - RemittanceStatus(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static RemittanceStatus fromValue(String text) { - for (RemittanceStatus b : RemittanceStatus.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/AuditDetails_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/model/v1/AuditDetails_v1.java deleted file mode 100644 index 6ca1b3e0610..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/AuditDetails_v1.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.egov.collection.model.v1; - - - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Builder -@Setter -@Getter -@ToString -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class AuditDetails_v1 { - - @JsonProperty("createdBy") - private String createdBy = null; - - @JsonProperty("createdDate") - private Long createdDate = null; - - @JsonProperty("lastModifiedBy") - private String lastModifiedBy = null; - - @JsonProperty("lastModifiedDate") - private Long lastModifiedDate = null; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/BillAccountDetail_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/model/v1/BillAccountDetail_v1.java deleted file mode 100644 index ac6e6236ca9..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/BillAccountDetail_v1.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.egov.collection.model.v1; - -import java.math.BigDecimal; - -import org.egov.collection.model.enums.Purpose; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class BillAccountDetail_v1 { - - @JsonProperty("id") - private String id = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("billDetail") - private String billDetail = null; - - @JsonProperty("demandDetailId") - private String demandDetailId = null; - - @JsonProperty("order") - private Integer order = null; - - @JsonProperty("amount") - private BigDecimal amount = null; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount = null; - - @JsonProperty("isActualDemand") - private Boolean isActualDemand = null; - - @JsonProperty("glcode") - private String glcode = null; - - @JsonProperty("taxHeadCode") - private String taxHeadCode = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("purpose") - private Purpose purpose = null; -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/BillDetail_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/model/v1/BillDetail_v1.java deleted file mode 100644 index bcb0257bad7..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/BillDetail_v1.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.model.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.egov.collection.model.enums.CollectionType; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.egov.collection.model.enums.CollectionType; -import org.egov.collection.model.enums.ReceiptType; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class BillDetail_v1 { - - @JsonProperty("id") - private String id = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("demandId") - private String demandId = null; - - @JsonProperty("bill") - private String bill = null; - - @JsonProperty("businessService") - private String businessService = null; - - @JsonProperty("billNumber") - private String billNumber = null; - - @JsonProperty("billDate") - private Long billDate = null; - - @JsonProperty("consumerCode") - private String consumerCode = null; - - @JsonProperty("consumerType") - private String consumerType = null; - - @JsonProperty("minimumAmount") - private BigDecimal minimumAmount = null; - - @JsonProperty("totalAmount") - @NotNull - private BigDecimal totalAmount = null; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid = null; - - @JsonProperty("fromPeriod") - private Long fromPeriod = null; - - @JsonProperty("toPeriod") - private Long toPeriod = null; - - @JsonProperty("collectedAmount") - private BigDecimal collectedAmount = null; - - @JsonProperty("collectionModesNotAllowed") - private List collectionModesNotAllowed = null; - - @JsonProperty("partPaymentAllowed") - private Boolean partPaymentAllowed = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("receiptNumber") - private String receiptNumber = null; - - @JsonProperty("receiptDate") - private Long receiptDate = null; - - @JsonProperty("receiptType") - private String receiptType = null; - - @JsonProperty("channel") - private String channel = null; - - @JsonProperty("voucherHeader") - private String voucherHeader = null; - - @JsonProperty("boundary") - private String boundary = null; - - @JsonProperty("reasonForCancellation") - private String reasonForCancellation = null; - - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber = null; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate = null; - - @JsonProperty("stateId") - private String stateId = null; - - @JsonProperty("fund") - private String fund = null; - - @JsonProperty("function") - private String function = null; - - @JsonProperty("department") - private String department = null; - - @JsonProperty("billAccountDetails") - private List billAccountDetails = null; - - @JsonProperty("status") - private String status = null; - - @NotNull - @JsonProperty("collectionType") - private CollectionType collectionType = null; - - @JsonProperty("isAdvanceAllowed") - private Boolean isAdvanceAllowed; - - private String billDescription; - - private Long expiryDate; - - private String displayMessage; - - private Boolean callBackForApportioning; - - private String cancellationRemarks; - - public Boolean addBillAccountDetail(BillAccountDetail_v1 billAccountDetail) { - - if (CollectionUtils.isEmpty(billAccountDetails)) { - - billAccountDetails = new ArrayList<>(); - return billAccountDetails.add(billAccountDetail); - } else { - - if (!billAccountDetails.contains(billAccountDetail)) - return billAccountDetails.add(billAccountDetail); - else - return false; - } - } - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/BillResponse_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/model/v1/BillResponse_v1.java deleted file mode 100644 index 74b4e174aee..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/BillResponse_v1.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.collection.model.v1; - -import java.util.ArrayList; -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * BillResponse - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillResponse_v1 { - - @JsonProperty("ResposneInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("Bill") - private List bill = new ArrayList<>(); - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/Bill_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/model/v1/Bill_v1.java deleted file mode 100644 index 22dbba0819a..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/Bill_v1.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.egov.collection.model.v1; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.collection.model.AuditDetails; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import org.egov.collection.web.contract.TaxAndPayment; - -@Getter -@Setter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class Bill_v1 { - // TODO some of the fields are mandatory in yml, lets discuss billdetail and billaccountdetail also for more clarity - - @JsonProperty("id") - private String id = null; - - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @JsonProperty("paidBy") - private String paidBy = null; - - @JsonProperty("payerName") - private String payerName = null; - - @JsonProperty("payerAddress") - private String payerAddress = null; - - @JsonProperty("payerEmail") - private String payerEmail = null; - - @JsonProperty("payerId") - private String payerId = null; - - @JsonProperty("isActive") - private Boolean isActive = null; - - @JsonProperty("isCancelled") - private Boolean isCancelled = null; - - @JsonProperty("additionalDetails") - private Object additionalDetails = null; - - @JsonProperty("taxAndPayments") - @Valid - @NotNull - private List taxAndPayments = null; - - @JsonProperty("billDetails") - @Valid - private List billDetails = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/ReceiptRequest_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/model/v1/ReceiptRequest_v1.java deleted file mode 100644 index 2eda59cf600..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/ReceiptRequest_v1.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.egov.collection.model.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.List; - -@Setter -@Getter -@ToString -@Builder -@EqualsAndHashCode -@AllArgsConstructor -@NoArgsConstructor -public class ReceiptRequest_v1 { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @JsonProperty("Receipt") - @Valid - private List receipt = null; - - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/ReceiptResponse_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/model/v1/ReceiptResponse_v1.java deleted file mode 100644 index 25ff65e0422..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/ReceiptResponse_v1.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.egov.collection.model.v1; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Setter -@Getter -@ToString -@AllArgsConstructor -public class ReceiptResponse_v1 { - - public ReceiptResponse_v1() { - } - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Receipt") - private List receipts; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/ReceiptSearchCriteria_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/model/v1/ReceiptSearchCriteria_v1.java deleted file mode 100644 index 3d6370f9107..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/ReceiptSearchCriteria_v1.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.egov.collection.model.v1; - -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - - -import lombok.*; - -import java.util.List; -import java.util.Set; - -@Setter -@Getter -@Builder -@AllArgsConstructor -@ToString -@EqualsAndHashCode -@NoArgsConstructor -public class ReceiptSearchCriteria_v1 { - private List ids; - - private Set receiptNumbers; - - private Set consumerCode; - - private Long fromDate; - - private Long toDate; - - private String collectedBy; - - private Set status; - - private Set instrumentType; - - private String fund; - - private String department; - - private String paymentType; - - private String classification; - - private String businessCode; - - private List businessCodes; - - private String tenantId; - - private String sortBy; - - private String sortOrder; - - private String transactionId; - - private List payerIds; - - private List manualReceiptNumbers; - - private List billIds; - - private boolean receiptDetailsRequired; - - private String mobileNo; - - private Integer offset; - - private Integer limit; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/Receipt_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/model/v1/Receipt_v1.java deleted file mode 100644 index 7cafd91c621..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/model/v1/Receipt_v1.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.collection.model.v1; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.collection.model.AuditDetails; -import org.egov.collection.model.Instrument; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -@EqualsAndHashCode(of = {"receiptNumber"}) -public class Receipt_v1 { - - @NotNull - private String tenantId; - - private String transactionId; - - // Read only, populated during search - private String receiptNumber; - - // Read only, populated during search - private String consumerCode; - - // Read only, populated during search - private Long receiptDate; - - @NotNull - @Size(min = 1, max = 1) - @Valid - @JsonProperty("Bill") - private List bill = new ArrayList<>(); - - private AuditDetails_v1 auditDetails; - - @Valid - private Instrument instrument; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/notification/consumer/NotificationConsumer.java b/business-services/collection-services/src/main/java/org/egov/collection/notification/consumer/NotificationConsumer.java deleted file mode 100644 index e45ec70f529..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/notification/consumer/NotificationConsumer.java +++ /dev/null @@ -1,305 +0,0 @@ -package org.egov.collection.notification.consumer; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.producer.CollectionProducer; -import org.egov.collection.web.contract.Bill; -//import org.egov.collection.web.contract.Receipt; -//import org.egov.collection.web.contract.ReceiptReq; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.ModuleDetail; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import net.logstash.logback.encoder.org.apache.commons.lang.StringUtils; - -@Service -@Slf4j -@Data -/** - * Methods with different responsibilites are written in the same class because we're not sure on where this consumer has to go. - * Ideally, we will have one consumer that handles notifications on every payment belonging to all the modules. - * The reason for having all methods in the same class is to make it easy for migration when the common-consumer design is finalized. - * - * - * @author vishal - * - */ -public class NotificationConsumer { - - @Autowired - private MultiStateInstanceUtil multiStateInstanceUtil; - - @Value("${coll.notification.ui.host}") - private String uiHost; - - @Value("${coll.notification.ui.redirect.url}") - private String uiRedirectUrl; - - - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsUrl; - - @Value("${egov.localization.host}") - private String localizationHost; - - @Value("${egov.localization.search.endpoint}") - private String localizationEndpoint; - - @Value("${coll.notification.fallback.locale}") - private String fallBackLocale; - - @Value("${kafka.topics.notification.sms}") - private String smsTopic; - - @Value("${kafka.topics.notification.sms.key}") - private String smsTopickey; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private CollectionProducer producer; - - @Autowired - private RestTemplate restTemplate; - - private static final String COLLECTION_LOCALIZATION_MODULE = "collection-services"; - public static final String PAYMENT_MSG_LOCALIZATION_CODE = "coll.notif.payment.receipt.link"; - private static final String BUSINESSSERVICE_LOCALIZATION_MODULE = "rainmaker-uc"; - public static final String BUSINESSSERVICELOCALIZATION_CODE_PREFIX = "BILLINGSERVICE_BUSINESSSERVICE_"; - public static final String LOCALIZATION_CODES_JSONPATH = "$.messages.*.code"; - public static final String LOCALIZATION_MSGS_JSONPATH = "$.messages.*.message"; - - private static final String BUSINESSSERVICE_MDMS_MODULE = "BillingService"; - public static final String BUSINESSSERVICE_MDMS_MASTER = "BusinessService"; - public static final String BUSINESSSERVICE_CODES_FILTER = "$.[?(@.type=='Adhoc')].code"; - public static final String BUSINESSSERVICE_CODES_JSONPATH = "$.MdmsRes.BillingService.BusinessService"; - - - - /* - * Kafka consumer - * - * @param record - * @param topic - */ - //@KafkaListener(topics = { "${kafka.topics.payment.receiptlink.name}" }) - public void listen(HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - try { - PaymentRequest req = objectMapper.convertValue(record, PaymentRequest.class); - sendNotification(req); - }catch(Exception e) { - log.error("Exception while reading from the queue: ", e); - } - } - - /* - * Method to send notifications. - * - * @param receiptReq - * @throws Exception - */ - private void sendNotification(PaymentRequest receiptReq){ - Payment receipt = receiptReq.getPayment(); - List businessServiceAllowed = fetchBusinessServiceFromMDMS(receiptReq.getRequestInfo(), receiptReq.getPayment().getTenantId()); - if(!CollectionUtils.isEmpty(businessServiceAllowed)) { - for(PaymentDetail detail: receipt.getPaymentDetails()) { - Bill bill = detail.getBill(); - if (businessServiceAllowed.contains(detail.getBusinessService())) { - String phNo = bill.getMobileNumber(); - String message = buildSmsBody(bill, detail, receiptReq.getRequestInfo()); - if (!StringUtils.isEmpty(message)) { - Map request = new HashMap<>(); - request.put("mobileNumber", phNo); - request.put("message", message); - - producer.push(receipt.getTenantId(), smsTopic, request); - } else { - log.error("No message configured! Notification will not be sent."); - } - } else { - log.info("Notification not configured for this business service!"); - } - } - - }else { - log.info("Business services to which notifs are to be sent, couldn't be retrieved! Notification will not be sent."); - } - } - - - /* - * Prepares sms body based on the configuration - * - * @param instrument - * @param bill - * @param billDetail - * @param requestInfo - * @return - */ - private String buildSmsBody(Bill bill, PaymentDetail paymentdetail, RequestInfo requestInfo) { - String content = fetchContentFromLocalization(requestInfo, paymentdetail.getTenantId(), COLLECTION_LOCALIZATION_MODULE, PAYMENT_MSG_LOCALIZATION_CODE); - String message = null; - if(!StringUtils.isEmpty(content)) { - StringBuilder link = new StringBuilder(); - link.append(uiHost + "/citizen").append("/otpLogin?mobileNo=").append(bill.getMobileNumber()).append("&redirectTo=") - .append(uiRedirectUrl).append("¶ms=").append(paymentdetail.getTenantId() + "," + paymentdetail.getReceiptNumber()); - - content = content.replaceAll("{rcpt_link}", link.toString()); - String taxName = fetchContentFromLocalization(requestInfo, paymentdetail.getTenantId(), - BUSINESSSERVICE_LOCALIZATION_MODULE, formatCodes(paymentdetail.getBusinessService())); - if(StringUtils.isEmpty(taxName)) - taxName = "Adhoc Tax"; - content = content.replaceAll("{tax_name}", taxName); - content = content.replaceAll("{fin_year}", fetchFinYear(bill.getBillDetails().get(0).getFromPeriod(), bill.getBillDetails().get(0).getToPeriod())); - content = content.replaceAll("{rcpt_no}", paymentdetail.getReceiptNumber()); - content = content.replaceAll("{amount_paid}", bill.getAmountPaid().toString()); - - message = content; - } - return message; - } - - /* - * Generic method to fetch data from localization. - * - * @param requestInfo - * @param tenantId - * @param module - * @param code - * @return - */ - private String fetchContentFromLocalization(RequestInfo requestInfo, String tenantId, String module, String code) { - String message = null; - List codes = new ArrayList<>(); - List messages = new ArrayList<>(); - Object result = null; - String locale = requestInfo.getMsgId().split("[|]")[1]; // Conventionally locale is sent in the first index of msgid split by | - if(StringUtils.isEmpty(locale)) - locale = fallBackLocale; - StringBuilder uri = new StringBuilder(); - uri.append(localizationHost).append(localizationEndpoint); - uri.append("?tenantId=").append(multiStateInstanceUtil.getStateLevelTenant(tenantId)) - .append("&locale=").append(locale).append("&module=").append(module); - - Map request = new HashMap<>(); - request.put("RequestInfo", requestInfo); - try { - result = restTemplate.postForObject(uri.toString(), request, Map.class); - codes = JsonPath.read(result, LOCALIZATION_CODES_JSONPATH); - messages = JsonPath.read(result, LOCALIZATION_MSGS_JSONPATH); - } catch (Exception e) { - log.error("Exception while fetching from localization: " + e); - } - if (null != result) { - for (int i = 0; i < codes.size(); i++) { - if(codes.get(i).equals(code)) message = messages.get(i); - } - } - return message; - } - - - /* - * Method to fetch business service from MDMS - * - * @param requestInfo - * @return - */ - private List fetchBusinessServiceFromMDMS(RequestInfo requestInfo, String tenantId){ - List masterData = new ArrayList<>(); - StringBuilder uri = new StringBuilder(); - uri.append(mdmsHost).append(mdmsUrl); - if(StringUtils.isEmpty(tenantId)) - return masterData; - MdmsCriteriaReq request = getRequestForEvents(requestInfo, multiStateInstanceUtil.getStateLevelTenant(tenantId)); - try { - Object response = restTemplate.postForObject(uri.toString(), request, Map.class); - masterData = JsonPath.read(response, BUSINESSSERVICE_CODES_JSONPATH); - }catch(Exception e) { - log.error("Exception while fetching business service codes: ",e); - } - return masterData; - } - - /** - * Util method to build MDMS request to search businessservices - * - * @param requestInfo - * @param tenantId - * @return - */ - private MdmsCriteriaReq getRequestForEvents(RequestInfo requestInfo, String tenantId) { - MasterDetail masterDetail = org.egov.mdms.model.MasterDetail.builder() - .name(BUSINESSSERVICE_MDMS_MASTER).filter(BUSINESSSERVICE_CODES_FILTER).build(); - List masterDetails = new ArrayList<>(); - masterDetails.add(masterDetail); - ModuleDetail moduleDetail = ModuleDetail.builder().moduleName(BUSINESSSERVICE_MDMS_MODULE) - .masterDetails(masterDetails).build(); - List moduleDetails = new ArrayList<>(); - moduleDetails.add(moduleDetail); - MdmsCriteria mdmsCriteria = MdmsCriteria.builder().tenantId(tenantId).moduleDetails(moduleDetails).build(); - return MdmsCriteriaReq.builder().requestInfo(requestInfo).mdmsCriteria(mdmsCriteria).build(); - } - - - /** - * Method to fetch year format from from and to period of the bill - * - * @param fromPeriod - * @param toPeriod - * @return - */ - private String fetchFinYear(Long fromPeriod, Long toPeriod) { - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(fromPeriod); - int fromYear = calendar.get(Calendar.YEAR); - calendar.setTimeInMillis(toPeriod); - int toYear = calendar.get(Calendar.YEAR); - if((toYear - fromYear) == 0) - return toYear + ""; - return fromYear + "-" + (toYear % 1000); - - } - - /** - * Method to format the code as per localization keys - * - * @param code - * @return - */ - private String formatCodes(String code) { - String regexForSpecialCharacters = "[$&+,:;=?@#|'<>.-^*()%!]"; - code = code.replaceAll(regexForSpecialCharacters, "_"); - code = code.replaceAll(" ", "_"); - - return BUSINESSSERVICELOCALIZATION_CODE_PREFIX + code.toUpperCase(); - } - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/producer/CollectionProducer.java b/business-services/collection-services/src/main/java/org/egov/collection/producer/CollectionProducer.java deleted file mode 100644 index 4bb4204a6ad..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/producer/CollectionProducer.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.collection.producer; - - -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.kafka.CustomKafkaTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class CollectionProducer { - - @Autowired - private CustomKafkaTemplate kafkaTemplate; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - public void push(String tenantId, String topic, Object value) { - - String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); - log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); - kafkaTemplate.send(updatedTopic, value); - } - - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/BankAccountMappingRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/BankAccountMappingRepository.java deleted file mode 100644 index 09c3ce4eb08..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/BankAccountMappingRepository.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.collection.model.BankAccountServiceMapping; -import org.egov.collection.model.BankAccountServiceMappingSearchCriteria; -import org.egov.collection.repository.querybuilder.BankAccountServiceQueryBuilder; -import org.egov.common.exception.InvalidTenantIdException; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Repository; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class BankAccountMappingRepository { - - @Autowired - private MultiStateInstanceUtil centralUtil; - - @Autowired - private BankAccountServiceQueryBuilder bankAccountServiceQueryBuilder; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private JdbcTemplate jdbcTemplate; - - public void persistBankAccountServiceMapping(List bankAccountServiceMappings) { - log.info("Create BankAccount Service Mapping Repository::" + bankAccountServiceMappings); - final String bankAccountServiceInsertQuery = bankAccountServiceQueryBuilder.insertBankAccountServiceDetailsQuery(); - - List> bankAccountServiceBatchValues = new ArrayList<>(bankAccountServiceMappings.size()); - for (BankAccountServiceMapping bankAccountServiceMapping : bankAccountServiceMappings) { - bankAccountServiceBatchValues - .add(new MapSqlParameterSource("businessdetails", bankAccountServiceMapping.getBusinessDetails()) - .addValue("bankaccount", bankAccountServiceMapping.getBankAccount()) - .addValue("bank", bankAccountServiceMapping.getBank()) - .addValue("bankbranch", bankAccountServiceMapping.getBankBranch()) - .addValue("active", true) - .addValue("createdby", bankAccountServiceMapping.getCreatedBy()) - .addValue("lastmodifiedby", bankAccountServiceMapping.getLastModifiedBy()) - .addValue("createddate", new Date().getTime()) - .addValue("lastmodifieddate", new Date().getTime()) - .addValue("tenantid", bankAccountServiceMapping.getTenantId()).getValues()); - } - try { - namedParameterJdbcTemplate.batchUpdate(bankAccountServiceInsertQuery, - bankAccountServiceBatchValues.toArray(new Map[bankAccountServiceMappings.size()])); - } catch (Exception e) { - log.error("Error in inserting bank Account service mapping data", e); - } - } - - public List searchBankAccountServicemapping( - final BankAccountServiceMappingSearchCriteria searchCriteria) { - - Map paramValues = new HashMap<>(); - String searchQuery = bankAccountServiceQueryBuilder.BankAccountServiceMappingSearchQuery(searchCriteria, paramValues); - try { - searchQuery = centralUtil.replaceSchemaPlaceholder(searchQuery, searchCriteria.getTenantId()); - } catch (InvalidTenantIdException e) { - - throw new CustomException("EG_CL_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - List bankAccountServiceMappings = new ArrayList(); - BeanPropertyRowMapper rowMapper = new BeanPropertyRowMapper(BankAccountServiceMapping.class); - - try { - bankAccountServiceMappings = namedParameterJdbcTemplate.query(searchQuery, paramValues, rowMapper); - } catch (Exception e) { - log.error("Error while searching bank account service mapping :", e); - } - return bankAccountServiceMappings; - } - - public List searchBankAccountBranches(final String tenantId) { - String searchQuery = bankAccountServiceQueryBuilder.getAllBankAccountsForServiceQuery(); - return jdbcTemplate.queryForList( - searchQuery, Long.class, new Object[] { tenantId }); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/BillingServiceRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/BillingServiceRepository.java deleted file mode 100644 index c4972ef10bd..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/BillingServiceRepository.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.egov.collection.repository; - -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.BillRequest; -import org.egov.collection.web.contract.BillResponse; -import org.egov.collection.web.contract.factory.RequestInfoWrapper; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.util.UriComponentsBuilder; - -import java.util.List; - -import static java.util.Objects.isNull; - -@Service -@Slf4j -public class BillingServiceRepository { - @Autowired - private RestTemplate restTemplate; - @Autowired - private ApplicationProperties applicationProperties; - - public BillResponse getApportionListFromBillingService(RequestInfo requestInfo, Bill apportionBill) { - log.info("Apportion Paid Amount in Billing Service"); - StringBuilder uriForApportion = new StringBuilder(); - uriForApportion - .append(applicationProperties.getBillingServiceHostName()) - .append(applicationProperties.getBillingServiceApportion()); - //.append("&tenantId=").append(apportionBill.getTenantId()); - log.info("URI For Apportioning Paid Amount in Billing Service: " - + uriForApportion.toString()); - BillRequest billRequest = new BillRequest(); - billRequest.setRequestInfo(requestInfo); - billRequest.getBills().add(apportionBill); - try { - BillResponse response = restTemplate.postForObject(uriForApportion.toString(), - billRequest, BillResponse.class); - - if (!isNull(response.getBill()) && !isNull(response.getBill().get(0).getBillDetails()) && !response - .getBill().get(0).getBillDetails().isEmpty()) - return response; - else - throw new CustomException("APPORTION_FAILED", "Apportioning from billing service failed"); - - } catch (RestClientException e) { - log.error("Error while apportioning paid amount from billing service. ", e); - throw new CustomException("APPORTION_FAILED", "Apportioning from billing service failed"); - } - } - - - public List fetchBill(RequestInfo requestInfo, String tenantId, List billIds) { - MultiValueMap queryParams = new LinkedMultiValueMap<>(); - queryParams.add("tenantId", tenantId); - queryParams.add("billId", StringUtils.join(billIds,",")); - - String uri = UriComponentsBuilder - .fromHttpUrl(applicationProperties.getBillingServiceHostName()) - .path(applicationProperties.getSearchBill()) - .queryParams(queryParams) - .build() - .toUriString(); - - RequestInfoWrapper wrapper = new RequestInfoWrapper(requestInfo); - - try { - BillResponse response = restTemplate.postForObject(uri, wrapper, BillResponse.class); - return response.getBill(); - } catch (HttpClientErrorException e) { - log.error("Unable to fetch bill for Bill ID: {} in tenant {}", billIds, tenantId, e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - log.error("Unable to fetch bill for Bill ID: {} in tenant {}", billIds, tenantId, e); - throw new CustomException("BILLING_SERVICE_ERROR", "Failed to fetch bill, unknown error occurred"); - } - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/ChartOfAccountsRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/ChartOfAccountsRepository.java deleted file mode 100644 index 3167a381af9..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/ChartOfAccountsRepository.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.egov.collection.repository; - -import org.egov.collection.web.contract.ChartOfAccount; -import org.egov.collection.web.contract.ChartOfAccountsResponse; -import org.egov.collection.web.contract.factory.RequestInfoWrapper; -import org.egov.common.contract.request.RequestInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.List; - -@Service -public class ChartOfAccountsRepository { - - public static final Logger LOGGER = LoggerFactory.getLogger(ChartOfAccountsRepository.class); - - - @Autowired - private RestTemplate restTemplate; - - private String url; - - public ChartOfAccountsRepository(final RestTemplate restTemplate,@Value("${egov.egfmasters.hostname}") final String egfServiceHost, - @Value("${coa.search.uri}") final String url) { - this.restTemplate = restTemplate; - this.url = egfServiceHost + url; - - } - - public List getChartOfAccounts(final List accountCodes,final String tenantId,final RequestInfo requestInfo) { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - String chartOfAccountCodes = String.join(",", accountCodes); - LOGGER.info("URI: "+url); - LOGGER.info("tenantid: "+tenantId); - return restTemplate.postForObject(url, requestInfoWrapper, - ChartOfAccountsResponse.class,tenantId,chartOfAccountCodes).getChartOfAccounts(); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/CollectionRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/CollectionRepository.java deleted file mode 100644 index b6d31359afb..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/CollectionRepository.java +++ /dev/null @@ -1,154 +0,0 @@ -/*package org.egov.collection.repository; - -import lombok.extern.slf4j.Slf4j; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.model.ReceiptSearchCriteria; -import org.egov.collection.repository.querybuilder.CollectionsQueryBuilder; -import org.egov.collection.repository.rowmapper.CollectionResultSetExtractor; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.BillAccountDetail; -import org.egov.collection.web.contract.BillDetail; -import org.egov.collection.web.contract.Receipt; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; - -import static org.egov.collection.repository.querybuilder.CollectionsQueryBuilder.*; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.*; - -@Repository -@Slf4j -public class CollectionRepository { - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private CollectionResultSetExtractor collectionResultSetExtractor; - - - @Transactional - public void saveReceipt(Receipt receipt){ - Bill bill = receipt.getBill().get(0); - try { - namedParameterJdbcTemplate.update(INSERT_INSTRUMENT_HEADER_SQL, getParametersForInstrumentHeader(receipt - .getInstrument(), receipt.getAuditDetails())); - - List receiptHeaderSource = new ArrayList<>(); - List receiptDetailSource = new ArrayList<>(); - List instrumentSource = new ArrayList<>(); - - for (BillDetail billDetail : bill.getBillDetails()) { - receiptHeaderSource.add(getParametersForReceiptHeader(receipt, billDetail)); - instrumentSource.add(getParametersForInstrument(receipt.getInstrument(), billDetail - .getId())); - - - for (BillAccountDetail billAccountDetail : billDetail.getBillAccountDetails()) { - receiptDetailSource.add(getParametersForReceiptDetails(billAccountDetail, billDetail.getId())); - } - - } - - namedParameterJdbcTemplate.batchUpdate(INSERT_RECEIPT_HEADER_SQL, receiptHeaderSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(INSERT_RECEIPT_DETAILS_SQL, receiptDetailSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(INSERT_INSTRUMENT_SQL, instrumentSource.toArray(new MapSqlParameterSource[0])); - - }catch (Exception e){ - log.error("Failed to persist receipt to database", e); - throw new CustomException("RECEIPT_CREATION_FAILED", e.getMessage()); - } - } - - - public void updateReceipt(List receipts){ - List receiptHeaderSource = new ArrayList<>(); - List receiptDetailSource = new ArrayList<>(); - List instrumentHeaderSource = new ArrayList<>(); - try { - - - for (Receipt receipt : receipts) { - BillDetail billDetail = receipt.getBill().get(0).getBillDetails().get(0); - receiptHeaderSource.add(getParametersForReceiptHeaderUpdate(receipt, billDetail)); - for (BillAccountDetail billAccountDetail : billDetail.getBillAccountDetails()) { - receiptDetailSource.add(getParametersForReceiptDetails(billAccountDetail, billDetail.getId())); - } - instrumentHeaderSource.add(getParametersForInstrumentHeaderUpdate(receipt.getInstrument(), - receipt.getAuditDetails())); - } - namedParameterJdbcTemplate.batchUpdate(COPY_RCPT_HEADER_SQL, receiptHeaderSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(COPY_RCPT_DETALS_SQL, receiptDetailSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(COPY_INSTRUMENT_HEADER_SQL, instrumentHeaderSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(UPDATE_RECEIPT_HEADER_SQL, receiptHeaderSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(UPDATE_INSTRUMENT_HEADER_SQL, instrumentHeaderSource.toArray(new MapSqlParameterSource[0])); - - }catch (Exception e){ - log.error("Failed to update receipt to database", e); - throw new CustomException("RECEIPT_UPDATION_FAILED", "Unable to update receipt"); - } - } - - public void updateStatus(List receipts){ - List receiptHeaderSource = new ArrayList<>(); - List receiptDetailSource = new ArrayList<>(); - List instrumentHeaderSource = new ArrayList<>(); - try { - - for(Receipt receipt : receipts){ - BillDetail billDetail = receipt.getBill().get(0).getBillDetails().get(0); - receiptHeaderSource.add(getParametersForReceiptStatusUpdate(billDetail, receipt.getAuditDetails())); - for (BillAccountDetail billAccountDetail : billDetail.getBillAccountDetails()) { - receiptDetailSource.add(getParametersForReceiptDetails(billAccountDetail, billDetail.getId())); - } - instrumentHeaderSource.add(getParametersForInstrumentStatusUpdate(receipt.getInstrument(), receipt.getAuditDetails - ())); - } - - namedParameterJdbcTemplate.batchUpdate(COPY_RCPT_HEADER_SQL, receiptHeaderSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(COPY_RCPT_DETALS_SQL, receiptDetailSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(COPY_INSTRUMENT_HEADER_SQL, instrumentHeaderSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(UPDATE_RECEIPT_STATUS_SQL, receiptHeaderSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(UPDATE_INSTRUMENT_STATUS_SQL, instrumentHeaderSource.toArray(new MapSqlParameterSource[0])); - } - catch(Exception e){ - log.error("Failed to persist cancel Receipt to database", e); - throw new CustomException("CANCEL_RECEIPT_FAILED", "Unable to cancel Receipt"); - } - } - - public void saveInstrument(Receipt receipt){ - Bill bill = receipt.getBill().get(0); - try { - - List instrumentSource = new ArrayList<>(); - - for (BillDetail billDetail : bill.getBillDetails()) { - instrumentSource.add(getParametersForInstrument(receipt.getInstrument(), billDetail - .getId())); - } - - namedParameterJdbcTemplate.batchUpdate(INSERT_INSTRUMENT_SQL, instrumentSource.toArray(new MapSqlParameterSource[0])); - }catch (Exception e){ - log.error("Failed to persist instrument to database", e); - throw new CustomException("INSTRUMENT_CREATION_FAILED", "Unable to create instrument"); - } - } - - public List fetchReceipts(ReceiptSearchCriteria receiptSearchCriteria){ - Map preparedStatementValues = new HashMap<>(); - String query = CollectionsQueryBuilder.getReceiptSearchQuery(receiptSearchCriteria, preparedStatementValues); - log.debug(query); - List receipts = namedParameterJdbcTemplate.query(query, preparedStatementValues, - collectionResultSetExtractor); - return receipts; - } - -} -*/ \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/EmployeeRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/EmployeeRepository.java deleted file mode 100644 index 1c710037970..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/EmployeeRepository.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.repository; - -import org.egov.collection.web.contract.Employee; -import org.egov.collection.web.contract.EmployeeResponse; -import org.egov.collection.web.contract.factory.RequestInfoWrapper; -import org.egov.common.contract.request.RequestInfo; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.List; - -@Service -public class EmployeeRepository { - - private RestTemplate restTemplate; - - //NPE , inject - private String hrEmployeePositonsUrl; - - public EmployeeRepository(final RestTemplate restTemplate) { - this.restTemplate = restTemplate; - } - - public List getPositionsForEmployee(final RequestInfo requestInfo,final Long employeeId,final String tenantId) { - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - return restTemplate.postForObject(hrEmployeePositonsUrl,requestInfoWrapper, EmployeeResponse.class,tenantId,employeeId).getEmployees(); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/IdGenRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/IdGenRepository.java deleted file mode 100644 index 1d8ad8c2f7f..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/IdGenRepository.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.egov.collection.repository; - -import static org.egov.collection.config.CollectionServiceConstants.COLL_TRANSACTION_FORMAT; -import static org.egov.collection.config.CollectionServiceConstants.COLL_TRANSACTION_ID_NAME; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.IdGenerationRequest; -import org.egov.collection.model.IdGenerationResponse; -import org.egov.collection.model.IdRequest; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.util.UriComponentsBuilder; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class IdGenRepository { - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ApplicationProperties applicationProperties; - - /** - * Generates a receipt number - * - If isReceiptNumberByService flag is set to true, - * generates receipt number by business service and tenant id - * - Else generates by tenant id only - * - * @param requestInfo - * @param businessService - * @param tenantId - * @return - */ - public String generateReceiptNumber(RequestInfo requestInfo, String businessService ,String tenantId) { - String idName = ""; - String format = null; - log.debug("Attempting to generate Receipt Number from ID Gen"); - - if(applicationProperties.isReceiptNumberByService()){ - idName = idName + businessService.toLowerCase() + "." + applicationProperties.getReceiptNumberIdName(); - } else{ - idName = applicationProperties.getReceiptNumberIdName(); - format = applicationProperties.getReceiptNumberStateLevelFormat(); - } - - return getId(requestInfo, tenantId, idName, format, 1); - } - - public String generateTransactionNumber(RequestInfo requestInfo, String tenantId) { - log.debug("Attempting to generate Transaction Number from ID Gen"); - - String[] tenantArray = tenantId.split("\\."); - String splitTenant = tenantId.contains(".") ? tenantArray[tenantArray.length-1] : tenantId; - String tenantFormat = COLL_TRANSACTION_FORMAT.replace("{tenant}", splitTenant); - - return getId(requestInfo, tenantId, COLL_TRANSACTION_ID_NAME, tenantFormat, 1); - - } - - private String getId(RequestInfo requestInfo, String tenantId, String name, String format, int count) { - - List reqList = new ArrayList<>(); - for (int i = 0; i < count; i++) { - reqList.add(new IdRequest(name, tenantId, format)); - } - IdGenerationRequest req = new IdGenerationRequest(requestInfo, reqList); - String uri = UriComponentsBuilder - .fromHttpUrl(applicationProperties.getIdGenServiceHost()) - .path(applicationProperties.getIdGeneration()) - .build() - .toUriString(); - try { - IdGenerationResponse idGenerationResponse = restTemplate.postForObject(uri, req, - IdGenerationResponse.class); - return idGenerationResponse.getIdResponses().get(0).getId(); - } catch (HttpClientErrorException e) { - log.error("ID Gen Service failure ", e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - log.error("ID Gen Service failure", e); - throw new org.egov.tracer.model.CustomException("IDGEN_SERVICE_ERROR", "Failed to generate ID, unknown error occurred"); - } - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/InstrumentRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/InstrumentRepository.java deleted file mode 100644 index 717159d995b..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/InstrumentRepository.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.egov.collection.repository; - -import com.jayway.jsonpath.JsonPath; -import lombok.extern.slf4j.Slf4j; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.Instrument; -import org.egov.collection.model.InstrumentRequest; -import org.egov.collection.web.contract.InstrumentResponse; -import org.egov.collection.web.contract.factory.RequestInfoWrapper; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import java.util.Collections; -import java.util.List; - -import static java.util.Objects.isNull; - -@Repository -@Slf4j -public class InstrumentRepository { - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ApplicationProperties applicationProperties; - - public Instrument createInstrument(RequestInfo requestinfo, Instrument instrument) { - - if (!isNull(instrument.getBank())) - instrument.getBank().setTenantId(instrument.getTenantId()); - - StringBuilder builder = new StringBuilder(); - String hostname = applicationProperties.getInstrumentServiceHost(); - String baseUri = applicationProperties.getCreateInstrument(); - builder.append(hostname).append(baseUri); - InstrumentRequest instrumentRequest = new InstrumentRequest(); - instrumentRequest.setRequestInfo(requestinfo); - instrumentRequest.setInstruments(Collections.singletonList(instrument)); - - try { - List instruments = restTemplate.postForObject(builder.toString(), instrumentRequest, - InstrumentResponse.class).getInstruments(); - - if (instruments.isEmpty()) - throw new CustomException("INSTRUMENT_SERVICE_ERROR", "Unable to create instrument"); - else - return instruments.get(0); - - } catch (HttpClientErrorException e) { - log.error("Unable to create instrument, " + instrument, e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - log.error("Unable to create instrument, " + instrument, e); - throw new CustomException("INSTRUMENT_CREATE_SERVICE_ERROR", "Unable to create instrument, unknown error " + - "occurred"); - } - } - - Instrument searchInstruments(final String instrumentHeader, final String tenantId, final RequestInfo requestInfo) { - StringBuilder builder = new StringBuilder(); - String hostname = applicationProperties.getInstrumentServiceHost(); - String baseUri = applicationProperties.getSearchInstrument(); - builder.append(hostname).append(baseUri); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(requestInfo); - - try { - List instruments = restTemplate.postForObject(builder.toString(), - requestInfoWrapper, InstrumentResponse.class, instrumentHeader).getInstruments(); - - if (instruments.isEmpty()) - return null; - else - return instruments.get(0); - - } catch (HttpClientErrorException e) { - log.error("Unable to fetch instrument, {} in tenant {}", instrumentHeader, tenantId, e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - log.error("Unable to fetch instrument, {} in tenant {}", instrumentHeader, tenantId, e); - throw new CustomException("INSTRUMENT_SERVICE_SEARCH_ERROR", "Unable to fetch instrument, unknown error " + - "occurred"); - } - - } - - public List searchInstruments(final String instrumentHeader, final RequestInfo - requestInfo) { - StringBuilder builder = new StringBuilder(); - String hostname = applicationProperties.getInstrumentServiceHost(); - String baseUri = applicationProperties.getSearchInstrument(); - builder.append(hostname).append(baseUri); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(requestInfo); - - try { - InstrumentResponse instrumentResponse= restTemplate.postForObject(builder.toString(), - requestInfoWrapper, InstrumentResponse.class, instrumentHeader); - - return isNull(instrumentResponse.getInstruments()) ? Collections.emptyList() : instrumentResponse.getInstruments(); - - } catch (HttpClientErrorException e) { - log.error("Unable to fetch instrument, {} ", instrumentHeader, e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - log.error("Unable to fetch instrument, {} ", instrumentHeader, e); - throw new CustomException("INSTRUMENT_SERVICE_SEARCH_ERROR", "Unable to fetch instrument, unknown error " + - "occurred"); - } - - } - - public List searchInstrumentsByPaymentMode(final String paymentMode,final String tenantId,final RequestInfo requestInfo) { - StringBuilder builder = new StringBuilder(); - String hostname = applicationProperties.getInstrumentServiceHost(); - String baseUri = applicationProperties.getSearchInstrumentByPaymentMode(); - builder.append(hostname).append(baseUri); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(requestInfo); - - log.info("Request to instrument search: " - + baseUri); - log.info("URI Instrument search: " + builder.toString()); - List instrumentList = restTemplate.postForObject(builder.toString(), - requestInfoWrapper, InstrumentResponse.class, paymentMode, tenantId).getInstruments(); - log.info("Response from instrument service: " + instrumentList); - return instrumentList; - - } - - public String getAccountCodeId(RequestInfo requestinfo, Instrument instrument, String tenantId) { - StringBuilder builder = new StringBuilder(); - String hostname = applicationProperties.getInstrumentServiceHost(); - String baseUri = applicationProperties.getSearchAccountCodes(); - String searchCriteria = "?tenantId="+tenantId+"&name="+instrument.getInstrumentType().getName(); - builder.append(hostname).append(baseUri).append(searchCriteria); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(requestinfo); - - log.info("URI account code id search: " + builder.toString()); - log.info("Request account code id search: " + requestinfo); - - Object response = restTemplate.postForObject(builder.toString(), - requestInfoWrapper, Object.class); - - String glCode = JsonPath.read(response, "$.instrumentAccountCodes[0].accountCode.glcode"); - log.info("Response from instrument service: " + response.toString()); - - return glCode; - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/PaymentRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/PaymentRepository.java deleted file mode 100644 index 58cec26f585..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/PaymentRepository.java +++ /dev/null @@ -1,414 +0,0 @@ -package org.egov.collection.repository; - -import static java.util.Collections.reverseOrder; -import static org.egov.collection.config.CollectionServiceConstants.KEY_FILESTOREID; -import static org.egov.collection.config.CollectionServiceConstants.KEY_ID; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.COPY_BILLDETAIL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.COPY_BILL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.COPY_PAYMENTDETAIL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.COPY_PAYMENT_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.FILESTOREID_UPDATE_PAYMENT_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.INSERT_BILLACCOUNTDETAIL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.INSERT_BILLDETAIL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.INSERT_BILL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.INSERT_PAYMENTDETAIL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.INSERT_PAYMENT_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.STATUS_UPDATE_BILL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.STATUS_UPDATE_PAYMENTDETAIL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.STATUS_UPDATE_PAYMENT_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.UPDATE_BILLDETAIL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.UPDATE_BILL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.UPDATE_PAYMENTDETAIL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.UPDATE_PAYMENT_BANKDETAIL_ARRAYADDTL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.UPDATE_PAYMENT_BANKDETAIL_EMPTYADDTL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.UPDATE_PAYMENT_BANKDETAIL_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.UPDATE_PAYMENT_SQL; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParametersEmptyDtlBankDetailUpdate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParametersForBankDetailUpdate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParametersForBillAccountDetailCreate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParametersForPaymentCreate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParametersForPaymentDetailCreate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParametersForPaymentDetailStatusUpdate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParametersForPaymentDetailUpdate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParametersForPaymentStatusUpdate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParametersForPaymentUpdate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParamtersForBillCreate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParamtersForBillDetailCreate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParamtersForBillDetailUpdate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParamtersForBillStatusUpdate; -import static org.egov.collection.repository.querybuilder.PaymentQueryBuilder.getParamtersForBillUpdate; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.model.PaymentSearchCriteria; -import org.egov.collection.repository.querybuilder.PaymentQueryBuilder; -import org.egov.collection.repository.rowmapper.BillRowMapper; -import org.egov.collection.repository.rowmapper.PaymentRowMapper; -import org.egov.collection.web.contract.Bill; -import org.egov.common.exception.InvalidTenantIdException; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.SingleColumnRowMapper; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Repository -public class PaymentRepository { - - - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - private PaymentQueryBuilder paymentQueryBuilder; - - private PaymentRowMapper paymentRowMapper; - - private BillRowMapper billRowMapper; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - public PaymentRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, PaymentQueryBuilder paymentQueryBuilder, - PaymentRowMapper paymentRowMapper, BillRowMapper billRowMapper) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - this.paymentQueryBuilder = paymentQueryBuilder; - this.paymentRowMapper = paymentRowMapper; - this.billRowMapper = billRowMapper; - } - - - - - @Transactional - public void savePayment(Payment payment){ - try { - - List paymentDetailSource = new ArrayList<>(); - List billSource = new ArrayList<>(); - List billDetailSource = new ArrayList<>(); - List billAccountDetailSource = new ArrayList<>(); - - for (PaymentDetail paymentDetail : payment.getPaymentDetails()) { - paymentDetailSource.add(getParametersForPaymentDetailCreate(payment.getId(), paymentDetail)); - billSource.add(getParamtersForBillCreate(paymentDetail.getBill())); - paymentDetail.getBill().getBillDetails().forEach(billDetail -> { - billDetailSource.add(getParamtersForBillDetailCreate(billDetail)); - billDetail.getBillAccountDetails().forEach(billAccountDetail -> { - billAccountDetailSource.add(getParametersForBillAccountDetailCreate(billAccountDetail)); - }); - }); - - } - String sqlPayment = centralInstanceUtil.replaceSchemaPlaceholder(INSERT_PAYMENT_SQL, payment.getTenantId()); - namedParameterJdbcTemplate.update(sqlPayment, getParametersForPaymentCreate(payment)); - String sqlPaymentDetail = centralInstanceUtil.replaceSchemaPlaceholder(INSERT_PAYMENTDETAIL_SQL, payment.getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlPaymentDetail, paymentDetailSource.toArray(new MapSqlParameterSource[0])); - String sqlBill = centralInstanceUtil.replaceSchemaPlaceholder(INSERT_BILL_SQL,payment.getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlBill, billSource.toArray(new MapSqlParameterSource[0])); - String sqlBillDetail = centralInstanceUtil.replaceSchemaPlaceholder(INSERT_BILLDETAIL_SQL,payment.getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlBillDetail, billDetailSource.toArray(new MapSqlParameterSource[0])); - String sqlBillAccount = centralInstanceUtil.replaceSchemaPlaceholder(INSERT_BILLACCOUNTDETAIL_SQL,payment.getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlBillAccount, billAccountDetailSource.toArray(new MapSqlParameterSource[0])); - - }catch (InvalidTenantIdException e) { - - throw new CustomException("EG_CL_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - }catch (Exception e){ - log.error("Failed to persist payment to database", e); - throw new CustomException("PAYMENT_CREATION_FAILED", e.getMessage()); - } - } - - - public List fetchPayments(PaymentSearchCriteria paymentSearchCriteria) { - Map preparedStatementValues = new HashMap<>(); - - List ids = fetchPaymentIdsByCriteria(paymentSearchCriteria); - - if(CollectionUtils.isEmpty(ids)) - return new LinkedList<>(); - - String query = paymentQueryBuilder.getPaymentSearchQuery(ids, preparedStatementValues); - try { - query = centralInstanceUtil.replaceSchemaPlaceholder(query, paymentSearchCriteria.getTenantId()); - } catch (InvalidTenantIdException e) { - - throw new CustomException("EG_CL_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - log.info("Query: " + query); - log.info("preparedStatementValues: " + preparedStatementValues); - List payments = namedParameterJdbcTemplate.query(query, preparedStatementValues, paymentRowMapper); - if (!CollectionUtils.isEmpty(payments)) { - Set billIds = new HashSet<>(); - for (Payment payment : payments) { - billIds.addAll(payment.getPaymentDetails().stream().map(detail -> detail.getBillId()).collect(Collectors.toSet())); - } - Map billMap = getBills(billIds, paymentSearchCriteria.getTenantId()); - for (Payment payment : payments) { - payment.getPaymentDetails().forEach(detail -> { - detail.setBill(billMap.get(detail.getBillId())); - }); - } - payments.sort(reverseOrder(Comparator.comparingLong(Payment::getTransactionDate))); - } - - return payments; - } - - public Long getPaymentsCount (String tenantId, String businessService) { - - Map preparedStatementValues = new HashMap<>(); - String query = paymentQueryBuilder.getPaymentCountQuery(tenantId, businessService, preparedStatementValues); - return namedParameterJdbcTemplate.queryForObject(query, preparedStatementValues, Long.class); - } - - public List fetchPaymentsForPlainSearch(PaymentSearchCriteria paymentSearchCriteria) { - Map preparedStatementValues = new HashMap<>(); - String query = paymentQueryBuilder.getPaymentSearchQueryForPlainSearch(paymentSearchCriteria, preparedStatementValues); - try { - query = centralInstanceUtil.replaceSchemaPlaceholder(query, paymentSearchCriteria.getTenantId()); - } catch (InvalidTenantIdException e) { - - throw new CustomException("EG_CL_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - log.info("Query: " + query); - log.info("preparedStatementValues: " + preparedStatementValues); - List payments = namedParameterJdbcTemplate.query(query, preparedStatementValues, paymentRowMapper); - if (!CollectionUtils.isEmpty(payments)) { - Set billIds = new HashSet<>(); - for (Payment payment : payments) { - billIds.addAll(payment.getPaymentDetails().stream().map(detail -> detail.getBillId()).collect(Collectors.toSet())); - } - Map billMap = getBills(billIds, paymentSearchCriteria.getTenantId()); - for (Payment payment : payments) { - payment.getPaymentDetails().forEach(detail -> { - detail.setBill(billMap.get(detail.getBillId())); - }); - } - payments.sort(reverseOrder(Comparator.comparingLong(Payment::getTransactionDate))); - } - - return payments; - } - - - - private Map getBills(Set ids, String tenantId){ - Map mapOfIdAndBills = new HashMap<>(); - Map preparedStatementValues = new HashMap<>(); - preparedStatementValues.put("id", ids); - String query = PaymentQueryBuilder.getBillQuery(); - try { - query = centralInstanceUtil.replaceSchemaPlaceholder(query, tenantId); - } catch (InvalidTenantIdException e) { - - throw new CustomException("EG_CL_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - List bills = namedParameterJdbcTemplate.query(query, preparedStatementValues, billRowMapper); - bills.forEach(bill -> { - mapOfIdAndBills.put(bill.getId(), bill); - }); - - return mapOfIdAndBills; - - } - - - - public void updateStatus(List payments){ - List paymentSource = new ArrayList<>(); - List paymentDetailSource = new ArrayList<>(); - List billSource = new ArrayList<>(); - try { - - for(Payment payment : payments){ - paymentSource.add(getParametersForPaymentStatusUpdate(payment)); - for (PaymentDetail paymentDetail : payment.getPaymentDetails()) { - paymentDetailSource.add(getParametersForPaymentDetailStatusUpdate(paymentDetail)); - billSource.add(getParamtersForBillStatusUpdate(paymentDetail.getBill())); - } - } - String tenantId = payments.get(0).getTenantId(); - namedParameterJdbcTemplate.batchUpdate(centralInstanceUtil.replaceSchemaPlaceholder(COPY_PAYMENT_SQL,tenantId), paymentSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(centralInstanceUtil.replaceSchemaPlaceholder(COPY_PAYMENTDETAIL_SQL,tenantId), paymentDetailSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(centralInstanceUtil.replaceSchemaPlaceholder(COPY_BILL_SQL,tenantId), billSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(centralInstanceUtil.replaceSchemaPlaceholder(STATUS_UPDATE_PAYMENT_SQL,tenantId), paymentSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(centralInstanceUtil.replaceSchemaPlaceholder(STATUS_UPDATE_PAYMENTDETAIL_SQL,tenantId), paymentDetailSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(centralInstanceUtil.replaceSchemaPlaceholder(STATUS_UPDATE_BILL_SQL,tenantId), billSource.toArray(new MapSqlParameterSource[0])); - }catch (InvalidTenantIdException e) { - - throw new CustomException("EG_CL_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - catch(Exception e){ - log.error("Failed to persist cancel Receipt to database", e); - throw new CustomException("CANCEL_RECEIPT_FAILED", "Unable to cancel Receipt"); - } - } - - - public void updatePayment(List payments){ - List paymentSource = new ArrayList<>(); - List paymentDetailSource = new ArrayList<>(); - List billSource = new ArrayList<>(); - List billDetailSource = new ArrayList<>(); - - try { - - for (Payment payment : payments) { - paymentSource.add(getParametersForPaymentUpdate(payment)); - payment.getPaymentDetails().forEach(paymentDetail -> { - paymentDetailSource.add(getParametersForPaymentDetailUpdate(paymentDetail)); - billSource.add(getParamtersForBillUpdate(paymentDetail.getBill())); - - paymentDetail.getBill().getBillDetails().forEach(billDetail -> { - billDetailSource.add(getParamtersForBillDetailUpdate(billDetail)); - }); - - }); - } - String sqlPayment = centralInstanceUtil.replaceSchemaPlaceholder(UPDATE_PAYMENT_SQL, payments.get(0).getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlPayment, paymentSource.toArray(new MapSqlParameterSource[0])); - String sqlPaymentDetail = centralInstanceUtil.replaceSchemaPlaceholder(UPDATE_PAYMENTDETAIL_SQL,payments.get(0).getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlPaymentDetail, paymentDetailSource.toArray(new MapSqlParameterSource[0])); - String sqlBill = centralInstanceUtil.replaceSchemaPlaceholder(UPDATE_BILL_SQL,payments.get(0).getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlBill, billSource.toArray(new MapSqlParameterSource[0])); - String sqlBillDetail = centralInstanceUtil.replaceSchemaPlaceholder(UPDATE_BILLDETAIL_SQL, payments.get(0).getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlBillDetail, billDetailSource.toArray(new MapSqlParameterSource[0])); - String sqlCopyPayment = centralInstanceUtil.replaceSchemaPlaceholder(COPY_PAYMENT_SQL, payments.get(0).getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlCopyPayment, paymentSource.toArray(new MapSqlParameterSource[0])); - String sqlCopyPaymentDetail = centralInstanceUtil.replaceSchemaPlaceholder(COPY_PAYMENTDETAIL_SQL,payments.get(0).getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlCopyPaymentDetail, paymentDetailSource.toArray(new MapSqlParameterSource[0])); - String sqlCopyBill = centralInstanceUtil.replaceSchemaPlaceholder(COPY_BILL_SQL, payments.get(0).getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlCopyBill, billSource.toArray(new MapSqlParameterSource[0])); - String sqlCopyBillDetail = centralInstanceUtil.replaceSchemaPlaceholder(COPY_BILLDETAIL_SQL, payments.get(0).getTenantId()); - namedParameterJdbcTemplate.batchUpdate(sqlCopyBillDetail, billDetailSource.toArray(new MapSqlParameterSource[0])); - - }catch (InvalidTenantIdException e) { - - throw new CustomException("EG_CL_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - }catch (Exception e){ - log.error("Failed to update receipt to database", e); - throw new CustomException("RECEIPT_UPDATION_FAILED", "Unable to update receipt"); - } - } - - - public void updateFileStoreId(List> idToFileStoreIdMaps){ - - List fileStoreIdSource = new ArrayList<>(); - - idToFileStoreIdMaps.forEach(map -> { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - sqlParameterSource.addValue("id",map.get(KEY_ID)); - sqlParameterSource.addValue("filestoreid",map.get(KEY_FILESTOREID)); - fileStoreIdSource.add(sqlParameterSource); - }); - - namedParameterJdbcTemplate.batchUpdate(FILESTOREID_UPDATE_PAYMENT_SQL,fileStoreIdSource.toArray(new MapSqlParameterSource[0])); - - } - - public List fetchPaymentIds(PaymentSearchCriteria paymentSearchCriteria) { - - Map preparedStatementValues = new HashMap<>(); - preparedStatementValues.put("offset", paymentSearchCriteria.getOffset()); - preparedStatementValues.put("limit", paymentSearchCriteria.getLimit()); - - return namedParameterJdbcTemplate.query("SELECT id from egcl_payment ORDER BY createdtime offset " + ":offset " + "limit :limit", preparedStatementValues, new SingleColumnRowMapper<>(String.class)); - - } - - public List fetchPaymentIdsByCriteria(PaymentSearchCriteria paymentSearchCriteria) { - Map preparedStatementValues = new HashMap<>(); - String query = paymentQueryBuilder.getIdQuery(paymentSearchCriteria, preparedStatementValues); - try { - query = centralInstanceUtil.replaceSchemaPlaceholder(query, paymentSearchCriteria.getTenantId()); - } catch (InvalidTenantIdException e) { - - throw new CustomException("EG_CL_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - return namedParameterJdbcTemplate.query(query, preparedStatementValues, - new SingleColumnRowMapper<>(String.class)); - } - - /** - * API is to get the distinct ifsccode from payment - * - * @return ifsccode list - */ - public List fetchIfsccode() { - - return namedParameterJdbcTemplate.query("SELECT distinct ifsccode from egcl_payment where ifsccode is not null ", - new SingleColumnRowMapper<>(String.class)); - - } - - /** - * API, All payments with @param ifsccode, additional details updated - * with @param additionaldetails - * - * @param additionaldetails - * @param ifsccode - */ - - @Transactional - public void updatePaymentBankDetail(JsonNode additionaldetails, String ifsccode) { - List parameterSource = new ArrayList<>(); - parameterSource.add(getParametersForBankDetailUpdate(additionaldetails, ifsccode)); - - /** - * UPDATE_PAYMENT_BANKDETAIL_SQL query adds the bankdetails data to - * existing object type additionaldetails ex: object type - * additionaldetails data {"isWhatsapp": false } - */ - namedParameterJdbcTemplate.batchUpdate(UPDATE_PAYMENT_BANKDETAIL_SQL, - parameterSource.toArray(new MapSqlParameterSource[0])); - - List emptyAddtlParameterSource = new ArrayList<>(); - emptyAddtlParameterSource.add(getParametersEmptyDtlBankDetailUpdate(additionaldetails, ifsccode)); - /** - * UPDATE_PAYMENT_BANKDETAIL_EMPTYADDTL_SQL query update the bankdetails - * to empty/null additionaldetails. ex: empty or 'null' - * additionaldetails data. - */ - namedParameterJdbcTemplate.batchUpdate(UPDATE_PAYMENT_BANKDETAIL_EMPTYADDTL_SQL, - emptyAddtlParameterSource.toArray(new MapSqlParameterSource[0])); - - /** - * UPDATE_PAYMENT_BANKDETAIL_ARRAYADDTL_SQL query adds bankdetails data - * to existing array type additionaldetails. ex: array additional data - * :[{"bankName": "State Bank of India", "branchName": "Chandigarh Main - * Branch"}] - * - */ - namedParameterJdbcTemplate.batchUpdate(UPDATE_PAYMENT_BANKDETAIL_ARRAYADDTL_SQL, - emptyAddtlParameterSource.toArray(new MapSqlParameterSource[0])); - - } -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/RemittanceRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/RemittanceRepository.java deleted file mode 100644 index 4e8c8ea03bd..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/RemittanceRepository.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.egov.collection.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.collection.repository.querybuilder.RemittanceQueryBuilder; -import org.egov.collection.repository.rowmapper.RemittanceResultSetExtractor; -import org.egov.collection.web.contract.Remittance; -import org.egov.collection.web.contract.RemittanceDetail; -import org.egov.collection.web.contract.RemittanceInstrument; -import org.egov.collection.web.contract.RemittanceReceipt; -import org.egov.collection.web.contract.RemittanceSearchRequest; -import org.egov.common.exception.InvalidTenantIdException; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Repository; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class RemittanceRepository { - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private RemittanceResultSetExtractor remittanceResultSetExtractor; - - @Autowired - private MultiStateInstanceUtil centralUtil; - - public void saveRemittance(Remittance remittance) { - try { - - namedParameterJdbcTemplate.update(RemittanceQueryBuilder.INSERT_REMITTANCE_SQL, - RemittanceQueryBuilder.getParametersForRemittance(remittance)); - - List remittanceDetailSource = new ArrayList<>(); - List remittanceInstrumentSource = new ArrayList<>(); - List remittanceReceiptSource = new ArrayList<>(); - - for (RemittanceDetail detail : remittance.getRemittanceDetails()) { - remittanceDetailSource.add(RemittanceQueryBuilder.getParametersForRemittanceDetails(detail)); - } - - for (RemittanceInstrument instrument : remittance.getRemittanceInstruments()) { - remittanceInstrumentSource.add(RemittanceQueryBuilder.getParametersForRemittanceInstrument(instrument)); - } - - for (RemittanceReceipt receipt : remittance.getRemittanceReceipts()) { - remittanceReceiptSource.add(RemittanceQueryBuilder.getParametersForRemittanceReceipt(receipt)); - } - - namedParameterJdbcTemplate.batchUpdate(RemittanceQueryBuilder.INSERT_REMITTANCE_DETAILS_SQL, - remittanceDetailSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(RemittanceQueryBuilder.INSERT_REMITTANCE_INSTRUMENT_SQL, - remittanceInstrumentSource.toArray(new MapSqlParameterSource[0])); - namedParameterJdbcTemplate.batchUpdate(RemittanceQueryBuilder.INSERT_REMITTANCE_RECEIPT_SQL, - remittanceReceiptSource.toArray(new MapSqlParameterSource[0])); - - } catch (Exception e) { - log.error("Failed to persist remittance to database", e); - throw new CustomException("REMITTANCE_CREATION_FAILED", "Unable to create remittance"); - } - } - - public void updateRemittance(Remittance remittance) { - } - - public List fetchRemittances(RemittanceSearchRequest remittanceSearchRequest) { - Map preparedStatementValues = new HashMap<>(); - String query = RemittanceQueryBuilder.getRemittanceSearchQuery(remittanceSearchRequest, preparedStatementValues); - try { - query = centralUtil.replaceSchemaPlaceholder(query, remittanceSearchRequest.getTenantId()); - }catch (InvalidTenantIdException e) { - - throw new CustomException("EG_CL_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - log.debug(query); - List remittances = namedParameterJdbcTemplate.query(query, preparedStatementValues, - remittanceResultSetExtractor); - return remittances; - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/ServiceRequestRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/ServiceRequestRepository.java deleted file mode 100644 index bb3d3d6528e..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/ServiceRequestRepository.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.egov.collection.repository; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import lombok.extern.slf4j.Slf4j; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpMethod; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import java.util.Map; - - -@Slf4j -@Repository -public class ServiceRequestRepository { - - - - @Autowired - private RestTemplate restTemplate; - - - /** - * Makes a RestTemplate Call on the input uri with the given get request - * @param uri The uri to be called - * @param request The request body - * @return The reponse of the call - */ - public Object fetchResult(StringBuilder uri, Object request) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - Object response = null; - try { - response = restTemplate.postForObject(uri.toString(), request, Map.class); - }catch(HttpClientErrorException e) { - log.error("External Service threw an Exception: ",e); - throw new ServiceCallException(e.getResponseBodyAsString()); - }catch(Exception e) { - log.error("Exception while fetching from searcher: ",e); - } - - return response; - - } - - /** - * Makes a RestTemplate Call on the input uri with thegiven request - * @param uri The uri to be called - * @param request The request body - * @return The reponse of the call - */ - public String fetchGetResult(String uri) { - - String response; - try { - response = restTemplate.exchange(uri, HttpMethod.GET, null, String.class).getBody(); - }catch(HttpClientErrorException e) { - log.error("External Service threw an Exception: ",e); - throw new ServiceCallException(e.getResponseBodyAsString()); - }catch(Exception e) { - log.error("Exception while fetching from searcher: ",e); - throw new ServiceCallException(e.getMessage()); - } - - return response; - - } - - - -} - - - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/UserRepository.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/UserRepository.java deleted file mode 100644 index 5eef4ce9212..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/UserRepository.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.collection.repository; - -import org.egov.collection.web.contract.GetUserByIdRequest; -import org.egov.collection.web.contract.UserResponse; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.List; - -@Service -public class UserRepository { - - public static final Logger LOGGER = LoggerFactory.getLogger(UserRepository.class); - - - @Autowired - private RestTemplate restTemplate; - - private String url; - - public UserRepository(RestTemplate restTemplate, @Value("${user.service.host}") String userServiceHost, @Value("${egov.services.user_by_id}") String url) { - this.restTemplate = restTemplate; - this.url = userServiceHost + url; - } - - List getUsersById(List userIds, final RequestInfo requestInfo, final String tenantId) { - GetUserByIdRequest userRequest = GetUserByIdRequest.builder().requestInfo(requestInfo) - .id(userIds).tenantId(tenantId).build(); - LOGGER.info("URI: "+url); - LOGGER.info("tenantid: "+tenantId); - LOGGER.info("Request: "+userRequest.toString()); - return restTemplate.postForObject(url, userRequest, UserResponse.class).getReceiptCreators(); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/BankAccountServiceQueryBuilder.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/BankAccountServiceQueryBuilder.java deleted file mode 100644 index c504bb94511..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/BankAccountServiceQueryBuilder.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.repository.querybuilder; - -import java.util.List; -import java.util.Map; - -import org.egov.collection.model.BankAccountServiceMappingSearchCriteria; -import org.springframework.stereotype.Component; - -@Component -public class BankAccountServiceQueryBuilder { - - public String insertBankAccountServiceDetailsQuery() { - return "INSERT INTO {schema}.egcl_bankaccountservicemapping (id, businessdetails, bankaccount, bank, bankbranch, active, createdby, lastmodifiedby, createddate, lastmodifieddate, tenantid) values" - + "(nextval('seq_egcl_bankaccountservicemapping'), :businessdetails, :bankaccount, :bank, :bankbranch, :active, :createdby, :lastmodifiedby, :createddate, :lastmodifieddate, :tenantid)"; - } - - public String BankAccountServiceMappingSearchQuery(final BankAccountServiceMappingSearchCriteria searchCriteria, - final Map paramValues) { - StringBuilder searchQuery = new StringBuilder(); - searchQuery.append("select * from {schema}.egcl_bankaccountservicemapping where tenantid =:tenantId"); - paramValues.put("tenantId", searchCriteria.getTenantId()); - - if (searchCriteria.getBusinessDetails() != null && !searchCriteria.getBusinessDetails().isEmpty()) { - searchQuery.append(" and businessdetails ilike any " - + getStringAppendQuery(searchCriteria.getBusinessDetails())); - } - - if (searchCriteria.getBankAccount() != null) { - searchQuery.append(" and bankaccount =:bankaccount"); - paramValues.put("bankaccount", searchCriteria.getBankAccount()); - } - - if (searchCriteria.getBank() != null) { - searchQuery.append(" and bank =:bank"); - paramValues.put("bank", searchCriteria.getBank()); - } - - if (searchCriteria.getBankBranch() != null) { - searchQuery.append(" and bankBranch =:bankBranch"); - paramValues.put("bankBranch", searchCriteria.getBankBranch()); - } - - searchQuery.append(" order by businessdetails"); - return searchQuery.toString(); - } - - private static String getStringAppendQuery(List receiptNumbersList) { - StringBuilder query = new StringBuilder("(array ["); - - if (receiptNumbersList.size() >= 1) { - query.append("'%").append(receiptNumbersList.get(0).toString()).append("%'"); - for (int i = 1; i < receiptNumbersList.size(); i++) { - query.append(", '%" + receiptNumbersList.get(i) + "%'"); - } - } - return query.append("])").toString(); - } - - public String getAllBankAccountsForServiceQuery() { - return "select distinct(bankaccount) bankAccount from {schema}.egcl_bankaccountservicemapping where tenantId=:tenantId"; - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/CollectionConfigQueryBuilder.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/CollectionConfigQueryBuilder.java deleted file mode 100644 index 06f5296d8fd..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/CollectionConfigQueryBuilder.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.egov.collection.repository.querybuilder; - -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - - -import java.util.List; - -import org.egov.collection.web.contract.CollectionConfigGetRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -@Component -public class CollectionConfigQueryBuilder { - - private static final Logger logger = LoggerFactory.getLogger(CollectionConfigQueryBuilder.class); - - - private static final String BASE_QUERY = "SELECT c.keyname as key, cv.value as value " - + "FROM {schema}.egcl_configuration c JOIN egcl_configurationvalues cv ON c.id = cv.keyid"; - - @SuppressWarnings("rawtypes") - public String getQuery(CollectionConfigGetRequest collectionConfigGetRequest, List preparedStatementValues) { - StringBuilder selectQuery = new StringBuilder(BASE_QUERY); - - addWhereClause(selectQuery, preparedStatementValues, collectionConfigGetRequest); - addOrderByClause(selectQuery, collectionConfigGetRequest); - addPagingClause(selectQuery, preparedStatementValues, collectionConfigGetRequest); - - logger.info("Query : " + selectQuery); - return selectQuery.toString(); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private void addWhereClause(StringBuilder selectQuery, List preparedStatementValues, - CollectionConfigGetRequest collectionConfigGetRequest) { - - if (collectionConfigGetRequest.getId() == null && collectionConfigGetRequest.getEffectiveFrom() == null - && collectionConfigGetRequest.getName() == null && collectionConfigGetRequest.getTenantId() == null) - return; - - selectQuery.append(" WHERE"); - boolean isAppendAndClause = false; - - if (collectionConfigGetRequest.getTenantId() != null) { - isAppendAndClause = true; - selectQuery.append(" cv.tenantId = ?"); - preparedStatementValues.add(collectionConfigGetRequest.getTenantId()); - } - - if (collectionConfigGetRequest.getId() != null) { - isAppendAndClause = addAndClauseIfRequired(isAppendAndClause, selectQuery); - selectQuery.append(" c.id IN " + getIdQuery(collectionConfigGetRequest.getId())); - } - - if (collectionConfigGetRequest.getName() != null) { - isAppendAndClause = addAndClauseIfRequired(isAppendAndClause, selectQuery); - selectQuery.append(" c.keyname = ?"); - preparedStatementValues.add(collectionConfigGetRequest.getName()); - } - - if (collectionConfigGetRequest.getEffectiveFrom() != null) { - isAppendAndClause = addAndClauseIfRequired(isAppendAndClause, selectQuery); - selectQuery.append(" cv.effectiveFrom = ?"); - preparedStatementValues.add(collectionConfigGetRequest.getEffectiveFrom()); - } - } - - private void addOrderByClause(StringBuilder selectQuery, CollectionConfigGetRequest collectionConfigGetRequest) { - String sortBy = (collectionConfigGetRequest.getSortBy() == null ? "keyname" - : collectionConfigGetRequest.getSortBy()); - String sortOrder = (collectionConfigGetRequest.getSortOrder() == null ? "ASC" - : collectionConfigGetRequest.getSortOrder()); - selectQuery.append(" ORDER BY " + sortBy + " " + sortOrder); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private void addPagingClause(StringBuilder selectQuery, List preparedStatementValues, - CollectionConfigGetRequest collectionConfigGetRequest) { - // handle limit(also called pageSize) here - selectQuery.append(" LIMIT ?"); - long pageSize = 500l; - //FIXME GET PAGESIZE FROM APPLICATION PROPERTIEs - //Integer.parseInt(applicationProperties.collectionSearchPageSizeDefault()); - if (collectionConfigGetRequest.getPageSize() != null) - pageSize = collectionConfigGetRequest.getPageSize(); - preparedStatementValues.add(pageSize); // Set limit to pageSize - - // handle offset here - selectQuery.append(" OFFSET ?"); - int pageNumber = 0; // Default pageNo is zero meaning first page - if (collectionConfigGetRequest.getPageNumber() != null) - pageNumber = collectionConfigGetRequest.getPageNumber() - 1; - preparedStatementValues.add(pageNumber * pageSize); // Set offset to pageNo * pageSize - } - - /** - * This method is always called at the beginning of the method so that and - * is prepended before the field's predicate is handled. - * - * @param appendAndClauseFlag - * @param queryString - * @return boolean indicates if the next predicate should append an "AND" - */ - private boolean addAndClauseIfRequired(boolean appendAndClauseFlag, StringBuilder queryString) { - if (appendAndClauseFlag) - queryString.append(" AND"); - - return true; - } - - private static String getIdQuery(List idList) { - StringBuilder query = new StringBuilder("("); - if (!idList.isEmpty()) { - query.append(idList.get(0).toString()); - for (int i = 1; i < idList.size(); i++) { - query.append(", " + idList.get(i)); - } - } - return query.append(")").toString(); - } -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/PaymentQueryBuilder.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/PaymentQueryBuilder.java deleted file mode 100644 index b7b19d717ca..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/PaymentQueryBuilder.java +++ /dev/null @@ -1,846 +0,0 @@ -package org.egov.collection.repository.querybuilder; - -import static java.util.stream.Collectors.toSet; - -import java.sql.SQLException; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.model.PaymentSearchCriteria; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.BillAccountDetail; -import org.egov.collection.web.contract.BillDetail; -import org.egov.tracer.model.CustomException; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; - -@Service -public class PaymentQueryBuilder { - - @Autowired - private ApplicationProperties configs; - - public static final String SELECT_PAYMENT_SQL = "SELECT py.*,pyd.*," + - "py.id as py_id,py.tenantId as py_tenantId,py.totalAmountPaid as py_totalAmountPaid,py.createdBy as py_createdBy,py.createdtime as py_createdtime," + - "py.lastModifiedBy as py_lastModifiedBy,py.lastmodifiedtime as py_lastmodifiedtime,py.additionalDetails as py_additionalDetails," + - "pyd.id as pyd_id, pyd.tenantId as pyd_tenantId, pyd.manualreceiptnumber as manualreceiptnumber,pyd.manualreceiptdate as manualreceiptdate, pyd.createdBy as pyd_createdBy,pyd.createdtime as pyd_createdtime,pyd.lastModifiedBy as pyd_lastModifiedBy," + - "pyd.lastmodifiedtime as pyd_lastmodifiedtime,pyd.additionalDetails as pyd_additionalDetails" + - " FROM {schema}.egcl_payment py " + - " INNER JOIN {schema}.egcl_paymentdetail pyd ON pyd.paymentid = py.id "; - - public static final String SELECT_COUNT_PAYMENT_SQL = "SELECT count(distinct(py.id)) FROM {schema}.egcl_payment py " - + "INNER JOIN {schema}.egcl_paymentdetail pyd ON pyd.paymentid = py.id where pyd.businessservice= :businessservice and pyd.tenantid= :tenantid "; - - /*public static final String ID_QUERY = "SELECT DISTINCT py.id as id,py.transactiondate as date " + - " FROM egcl_payment py " + - " INNER JOIN egcl_paymentdetail pyd ON pyd.paymentid = py.id " + - " INNER JOIN egcl_bill bill ON bill.id = pyd.billid " + - " INNER JOIN egcl_billdetial bd ON bd.billid = bill.id " ;*/ - - public static final String ID_QUERY = "WITH py_filtered as (" + - "select id from {schema}.egcl_payment as py_inner {{WHERE_CLAUSE}} ) " + - " SELECT py.id as id FROM py_filtered as py " + - " INNER JOIN {schema}.egcl_paymentdetail as pyd ON pyd.paymentid = py.id and pyd.tenantid {{operator}} :tenantId " + - " INNER JOIN {schema}.egcl_bill bill ON bill.id = pyd.billid " + - " INNER JOIN {schema}.egcl_billdetial bd ON bd.billid = bill.id and bd.tenantid {{operator}} :tenantId; "; - - private static final String PAGINATION_WRAPPER = "SELECT * FROM " + - "(SELECT *, DENSE_RANK() OVER (ORDER BY py_id) offset_ FROM " + - "({baseQuery})" + - " result) result_offset " + - "WHERE offset_ > :offset AND offset_ <= :limit"; - - - public static final String INSERT_PAYMENT_SQL = "INSERT INTO {schema}.egcl_payment(" + - " id, tenantid, totaldue, totalamountpaid, transactionnumber, transactiondate, " + - " paymentmode, instrumentdate, instrumentnumber,instrumentStatus, ifsccode, additionaldetails, " + - " paidby, mobilenumber, payername, payeraddress, payeremail, payerid, " + - " paymentstatus, createdby, createdtime, lastmodifiedby, lastmodifiedtime)" + - " VALUES (:id, :tenantid, :totaldue, :totalamountpaid, :transactionnumber, :transactiondate, " + - " :paymentmode, :instrumentdate, :instrumentnumber, :instrumentStatus, :ifsccode, :additionaldetails," + - " :paidby, :mobilenumber, :payername, :payeraddress, :payeremail, :payerid, " + - " :paymentstatus, :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime);"; - - - public static final String INSERT_PAYMENTDETAIL_SQL = "INSERT INTO {schema}.egcl_paymentdetail(" + - " id, tenantid, paymentid, due, amountpaid, receiptnumber, businessservice, " + - " billid, additionaldetails,receiptdate, receipttype, manualreceiptnumber, manualreceiptdate, createdby, createdtime, " + - " lastmodifiedby, lastmodifiedtime)" + - " VALUES (:id, :tenantid, :paymentid, :due, :amountpaid, :receiptnumber, :businessservice, " + - " :billid, :additionaldetails,:receiptdate, :receipttype, :manualreceiptnumber, :manualreceiptdate, :createdby, :createdtime," + - " :lastmodifiedby, :lastmodifiedtime);"; - - - public static final String INSERT_BILL_SQL = "INSERT INTO {schema}.egcl_bill(" + - " id, status, iscancelled, additionaldetails, tenantid, collectionmodesnotallowed," + - " partpaymentallowed, isadvanceallowed, minimumamounttobepaid, " + - " businessservice, totalamount, consumercode, billnumber, billdate," + - " createdby, createdtime, lastmodifiedby, lastmodifiedtime) " + - " VALUES (:id, :status, :iscancelled, :additionaldetails, :tenantid, :collectionmodesnotallowed," + - " :partpaymentallowed, :isadvanceallowed, :minimumamounttobepaid," + - " :businessservice, :totalamount, :consumercode, :billnumber, :billdate," + - " :createdby, :createdtime, :lastmodifiedby, :lastmodifiedtime);"; - - - public static final String INSERT_BILLDETAIL_SQL = "INSERT INTO {schema}.egcl_billdetial(" + - " id, tenantid, demandid, billid, amount, amountpaid, fromperiod," + - " toperiod, additionaldetails," + - " channel, voucherheader, boundary," + - " collectiontype," + - " billdescription, expirydate, displaymessage, callbackforapportioning," + - " cancellationremarks)" + - " VALUES (:id, :tenantid, :demandid, :billid, :amount, :amountpaid, :fromperiod," + - " :toperiod, :additionaldetails," + - " :channel, :voucherheader, :boundary," + - " :collectiontype," + - " :billdescription, :expirydate, :displaymessage, :callbackforapportioning," + - " :cancellationremarks);"; - - - public static final String INSERT_BILLACCOUNTDETAIL_SQL = "INSERT INTO {schema}.egcl_billaccountdetail(" + - " id, tenantid, billdetailid, demanddetailid, " + - " \"order\", amount, adjustedamount, isactualdemand, taxheadcode, additionaldetails)" + - " VALUES (:id, :tenantid, :billdetailid, :demanddetailid, " + - " :order, :amount, :adjustedamount, :isactualdemand, :taxheadcode, :additionaldetails);"; - - - // Payment Status update queries - - public static final String STATUS_UPDATE_PAYMENT_SQL = "UPDATE {schema}.egcl_payment SET instrumentstatus=:instrumentstatus,additionaldetails=:additionaldetails," + - " paymentstatus=:paymentstatus, lastmodifiedby=:lastmodifiedby,lastmodifiedtime=:lastmodifiedtime" + - " WHERE id=:id;"; - - public static final String STATUS_UPDATE_PAYMENTDETAIL_SQL = "UPDATE {schema}.egcl_paymentdetail SET additionaldetails=:additionaldetails, lastmodifiedby=:lastmodifiedby, lastmodifiedtime=:lastmodifiedtime " + - " WHERE id=:id;"; - - public static final String STATUS_UPDATE_BILL_SQL = "UPDATE {schema}.egcl_bill " + - " SET status= :status, iscancelled= :iscancelled, additionaldetails= :additionaldetails, lastmodifiedby= :lastmodifiedby, lastmodifiedtime=:lastmodifiedtime" + - " WHERE id=:id;"; - - public static final String COPY_PAYMENT_SQL = "INSERT INTO {schema}.egcl_payment_audit SELECT * FROM {schema}.egcl_payment WHERE id = :id;"; - - public static final String COPY_PAYMENTDETAIL_SQL = "INSERT INTO {schema}.egcl_paymentdetail_audit SELECT id, tenantid, paymentid, due, amountpaid, receiptnumber, " - + "businessservice, billid, additionaldetails, createdby, createdtime, lastmodifiedby, lastmodifiedtime, manualreceiptnumber, " - + "manualreceiptdate, receiptdate, receipttype FROM {schema}.egcl_paymentdetail WHERE id = :id ;"; - - public static final String COPY_BILL_SQL = "INSERT INTO {schema}.egcl_bill_audit SELECT * FROM egcl_bill WHERE id = :id;"; - - public static final String COPY_BILLDETAIL_SQL = "INSERT INTO {schema}.egcl_billdetial_audit SELECT * FROM egcl_billdetial WHERE id = :id;"; - - public static final String FILESTOREID_UPDATE_PAYMENT_SQL = "UPDATE {schema}.egcl_payment SET filestoreid=:filestoreid WHERE id=:id;"; - - - - // Payment update queries - - public static final String UPDATE_PAYMENT_SQL = "UPDATE {schema}.egcl_payment SET additionaldetails=:additionaldetails, paidby=:paidby, payername=:payername," + - " payeraddress=:payeraddress, payeremail=:payeremail, payerid=:payerid,paymentstatus=:paymentstatus, createdby=:createdby, createdtime=:createdtime," + - " lastmodifiedby=:lastmodifiedby, lastmodifiedtime=:lastmodifiedtime WHERE id=:id "; - - public static final String UPDATE_PAYMENTDETAIL_SQL ="UPDATE {schema}.egcl_paymentdetail SET additionaldetails=:additionaldetails, createdby=:createdby," + - "createdtime=:createdtime, lastmodifiedby=:lastmodifiedby, lastmodifiedtime=:lastmodifiedtime" + - "WHERE id=:id;"; - - public static final String UPDATE_BILL_SQL = "UPDATE {schema}.egcl_bill SET additionaldetails=:additionaldetails,createdby=:createdby,createdtime=:createdtime, lastmodifiedby=:lastmodifiedby,\n" + - "lastmodifiedtime=:lastmodifiedtime WHERE id=:id;"; - - public static final String UPDATE_BILLDETAIL_SQL = "UPDATE {schema}.egcl_billdetial SET additionaldetails=:additionaldetails, voucherheader=:voucherheader," + - " manualreceiptnumber=:manualreceiptnumber, manualreceiptdate=:manualreceiptdate, billdescription=:billdescription,displaymessage=:displaymessage," + - "createdby=:createdby, createdtime=:createdtime, lastmodifiedby=:lastmodifiedby,lastmodifiedtime=:lastmodifiedtime WHERE id=:id "; - - - public static final String BILL_BASE_QUERY = "SELECT b.id AS b_id, b.tenantid AS b_tenantid, b.iscancelled AS b_iscancelled, b.businessservice AS b_businessservice, " - + "b.billnumber AS b_billnumber, b.billdate AS b_billdate, b.consumercode AS b_consumercode, b.createdby AS b_createdby, b.status as b_status, b.minimumamounttobepaid AS b_minimumamounttobepaid, " - + "b.totalamount AS b_totalamount, b.partpaymentallowed AS b_partpaymentallowed, b.isadvanceallowed as b_isadvanceallowed, " - + "b.collectionmodesnotallowed AS b_collectionmodesnotallowed, b.createdtime AS b_createdtime, b.lastmodifiedby AS b_lastmodifiedby, " - + "b.lastmodifiedtime AS b_lastmodifiedtime, bd.id AS bd_id, bd.billid AS bd_billid, bd.tenantid AS bd_tenantid, bd.demandid, " - + "bd.fromperiod, bd.toperiod, bd.billdescription AS bd_billdescription, bd.displaymessage AS bd_displaymessage, bd.amount AS bd_amount, bd.amountpaid AS bd_amountpaid, " - + "bd.callbackforapportioning AS bd_callbackforapportioning, bd.expirydate AS bd_expirydate, ad.id AS ad_id, ad.tenantid AS ad_tenantid, " - + "ad.billdetailid AS ad_billdetailid, ad.order AS ad_order, ad.amount AS ad_amount, ad.adjustedamount AS ad_adjustedamount, " - + "ad.taxheadcode AS ad_taxheadcode, ad.demanddetailid as ad_demanddetailid, ad.isactualdemand AS ad_isactualdemand, b.additionaldetails as b_additionaldetails, " - + "bd.additionaldetails as bd_additionaldetails, ad.additionaldetails as ad_additionaldetails " - + "FROM {schema}.egcl_bill b LEFT OUTER JOIN {schema}.egcl_billdetial bd ON b.id = bd.billid AND b.tenantid = bd.tenantid " - + "LEFT OUTER JOIN {schema}.egcl_billaccountdetail ad ON bd.id = ad.billdetailid AND bd.tenantid = ad.tenantid " - + "WHERE b.id IN (:id);"; - - - public static final String UPDATE_PAYMENT_BANKDETAIL_SQL = "UPDATE {schema}.egcl_payment SET additionaldetails = jsonb_set(additionaldetails, '{bankDetails}', :additionaldetails, true) WHERE length(additionaldetails :: text) is not null and length(additionaldetails :: text) > 4 and jsonb_typeof( additionaldetails ::jsonb ) ='object' and ifsccode=:ifsccode "; - public static final String UPDATE_PAYMENT_BANKDETAIL_EMPTYADDTL_SQL = "UPDATE {schema}.egcl_payment SET additionaldetails = :additionaldetails ::jsonb WHERE (length(additionaldetails :: text) is null or length(additionaldetails :: text) = 4) and ifsccode=:ifsccode "; - public static final String UPDATE_PAYMENT_BANKDETAIL_ARRAYADDTL_SQL = "UPDATE {schema}.egcl_payment SET additionaldetails = additionaldetails || :additionaldetails ::jsonb WHERE length(additionaldetails :: text) is not null and length(additionaldetails :: text) > 4 and jsonb_typeof(additionaldetails ::jsonb) ='array' and ifsccode=:ifsccode "; - - public static String getBillQuery() { - return BILL_BASE_QUERY; - } - - - public static MapSqlParameterSource getParametersForPaymentCreate(Payment payment) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", payment.getId()); - sqlParameterSource.addValue("tenantid", payment.getTenantId()); - sqlParameterSource.addValue("totaldue", payment.getTotalDue()); - sqlParameterSource.addValue("totalamountpaid", payment.getTotalAmountPaid()); - sqlParameterSource.addValue("transactionnumber", payment.getTransactionNumber()); - sqlParameterSource.addValue("transactiondate", payment.getTransactionDate()); - sqlParameterSource.addValue("paymentmode", payment.getPaymentMode().toString()); - sqlParameterSource.addValue("instrumentdate", payment.getInstrumentDate()); - sqlParameterSource.addValue("instrumentnumber", payment.getInstrumentNumber()); - sqlParameterSource.addValue("instrumentStatus", payment.getInstrumentStatus().toString()); - sqlParameterSource.addValue("ifsccode", payment.getIfscCode()); - sqlParameterSource.addValue("additionaldetails", getJsonb(payment.getAdditionalDetails())); - sqlParameterSource.addValue("paidby", payment.getPaidBy()); - sqlParameterSource.addValue("mobilenumber", payment.getMobileNumber()); - sqlParameterSource.addValue("payername", payment.getPayerName()); - sqlParameterSource.addValue("payeraddress", payment.getPayerAddress()); - sqlParameterSource.addValue("payeremail", payment.getPayerEmail()); - sqlParameterSource.addValue("payerid", payment.getPayerId()); - sqlParameterSource.addValue("paymentstatus", payment.getPaymentStatus().toString()); - sqlParameterSource.addValue("createdby", payment.getAuditDetails().getCreatedBy()); - sqlParameterSource.addValue("createdtime", payment.getAuditDetails().getCreatedTime()); - sqlParameterSource.addValue("lastmodifiedby", payment.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", payment.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - - } - - - public static MapSqlParameterSource getParametersForPaymentDetailCreate(String paymentId,PaymentDetail paymentDetail) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", paymentDetail.getId()); - sqlParameterSource.addValue("tenantid", paymentDetail.getTenantId()); - sqlParameterSource.addValue("paymentid", paymentId); - sqlParameterSource.addValue("due", paymentDetail.getTotalDue()); - sqlParameterSource.addValue("amountpaid", paymentDetail.getTotalAmountPaid()); - sqlParameterSource.addValue("receiptnumber", paymentDetail.getReceiptNumber()); - sqlParameterSource.addValue("businessservice", paymentDetail.getBusinessService()); - sqlParameterSource.addValue("billid", paymentDetail.getBillId()); - sqlParameterSource.addValue("additionaldetails", getJsonb(paymentDetail.getAdditionalDetails())); - sqlParameterSource.addValue("receiptdate", paymentDetail.getReceiptDate()); - sqlParameterSource.addValue("receipttype", paymentDetail.getReceiptType()); - sqlParameterSource.addValue("manualreceiptnumber", paymentDetail.getManualReceiptNumber()); - sqlParameterSource.addValue("manualreceiptdate", paymentDetail.getManualReceiptDate()); - sqlParameterSource.addValue("createdby", paymentDetail.getAuditDetails().getCreatedBy()); - sqlParameterSource.addValue("createdtime", paymentDetail.getAuditDetails().getCreatedTime()); - sqlParameterSource.addValue("lastmodifiedby", paymentDetail.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", paymentDetail.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - - } - - - - public static MapSqlParameterSource getParamtersForBillCreate(Bill bill){ - - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", bill.getId()); - sqlParameterSource.addValue("status", bill.getStatus().toString()); - sqlParameterSource.addValue("iscancelled", bill.getIsCancelled()); - sqlParameterSource.addValue("additionaldetails",getJsonb(bill.getAdditionalDetails())); - sqlParameterSource.addValue("tenantid", bill.getTenantId()); - sqlParameterSource.addValue("collectionmodesnotallowed", StringUtils.join(bill.getCollectionModesNotAllowed(),",")); - sqlParameterSource.addValue("partpaymentallowed", bill.getPartPaymentAllowed()); - sqlParameterSource.addValue("isadvanceallowed", bill.getIsAdvanceAllowed()); - sqlParameterSource.addValue("minimumamounttobepaid", bill.getMinimumAmountToBePaid()); - sqlParameterSource.addValue("businessservice", bill.getBusinessService()); - sqlParameterSource.addValue("totalamount", bill.getTotalAmount()); - sqlParameterSource.addValue("consumercode", bill.getConsumerCode()); - sqlParameterSource.addValue("billnumber", bill.getBillNumber()); - sqlParameterSource.addValue("billdate", bill.getBillDate()); - sqlParameterSource.addValue("reasonforcancellation", bill.getReasonForCancellation()); - sqlParameterSource.addValue("createdby", bill.getAuditDetails().getCreatedBy()); - sqlParameterSource.addValue("createdtime", bill.getAuditDetails().getCreatedTime()); - sqlParameterSource.addValue("lastmodifiedby", bill.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", bill.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - } - - - - public static MapSqlParameterSource getParamtersForBillDetailCreate(BillDetail billDetail) { - - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - sqlParameterSource.addValue("id", billDetail.getId()); - sqlParameterSource.addValue("tenantid", billDetail.getTenantId()); - sqlParameterSource.addValue("demandid", billDetail.getDemandId()); - sqlParameterSource.addValue("billid", billDetail.getBillId()); - sqlParameterSource.addValue("amount", billDetail.getAmount()); - sqlParameterSource.addValue("amountpaid", billDetail.getAmountPaid()); - sqlParameterSource.addValue("fromperiod", billDetail.getFromPeriod()); - sqlParameterSource.addValue("toperiod", billDetail.getToPeriod()); - sqlParameterSource.addValue("additionaldetails", getJsonb(billDetail.getAdditionalDetails())); - sqlParameterSource.addValue("channel", billDetail.getChannel()); - sqlParameterSource.addValue("voucherheader", billDetail.getVoucherHeader()); - sqlParameterSource.addValue("boundary", billDetail.getBoundary()); - sqlParameterSource.addValue("manualreceiptnumber", billDetail.getManualReceiptNumber()); - sqlParameterSource.addValue("manualreceiptdate", billDetail.getManualReceiptDate()); - sqlParameterSource.addValue("collectiontype", billDetail.getCollectionType()); - sqlParameterSource.addValue("billdescription", billDetail.getBillDescription()); - sqlParameterSource.addValue("expirydate", billDetail.getExpiryDate()); - sqlParameterSource.addValue("displaymessage", billDetail.getDisplayMessage()); - sqlParameterSource.addValue("callbackforapportioning", billDetail.getCallBackForApportioning()); - sqlParameterSource.addValue("cancellationremarks", billDetail.getCancellationRemarks()); - - return sqlParameterSource; - } - - - public static MapSqlParameterSource getParametersForBillAccountDetailCreate(BillAccountDetail billAccountDetail) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", billAccountDetail.getId()); - sqlParameterSource.addValue("tenantid", billAccountDetail.getTenantId()); - sqlParameterSource.addValue("billdetailid", billAccountDetail.getBillDetailId()); - sqlParameterSource.addValue("demanddetailid", billAccountDetail.getDemandDetailId()); - sqlParameterSource.addValue("order", billAccountDetail.getOrder()); - sqlParameterSource.addValue("amount", billAccountDetail.getAmount()); - sqlParameterSource.addValue("adjustedamount", billAccountDetail.getAdjustedAmount()); - sqlParameterSource.addValue("isactualdemand", billAccountDetail.getIsActualDemand()); - sqlParameterSource.addValue("taxheadcode", billAccountDetail.getTaxHeadCode()); - sqlParameterSource.addValue("additionaldetails", getJsonb(billAccountDetail.getAdditionalDetails())); - - return sqlParameterSource; - } - - public String getPaymentCountQuery (String tenantId, String businessService, Map preparedStatementValues) { - - StringBuilder selectQuery = new StringBuilder(SELECT_COUNT_PAYMENT_SQL); - preparedStatementValues.put("businessservice", businessService); - preparedStatementValues.put("tenantid", tenantId); - - return selectQuery.toString(); - } - - - public String getPaymentSearchQuery(List ids, - Map preparedStatementValues) { - StringBuilder selectQuery = new StringBuilder(SELECT_PAYMENT_SQL); - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py.id IN (:id) "); - preparedStatementValues.put("id", ids); - return addOrderByClause(selectQuery); - } - - - public String getPaymentSearchQueryForPlainSearch(PaymentSearchCriteria searchCriteria, - Map preparedStatementValues) { - StringBuilder selectQuery = new StringBuilder(SELECT_PAYMENT_SQL); - - addWhereClauseForPlainSearch(selectQuery, preparedStatementValues, searchCriteria); - - - return addOrderByClause(selectQuery); - - } - - - - public String getIdQuery(PaymentSearchCriteria searchCriteria, Map preparedStatementValues){ - StringBuilder whereClause = new StringBuilder(); - addWhereClause(whereClause, preparedStatementValues, searchCriteria); - whereClause.append(" ORDER BY py_inner.transactiondate DESC ").toString(); - addPagination(whereClause,preparedStatementValues,searchCriteria); - String query = ID_QUERY.replace("{{WHERE_CLAUSE}}",whereClause.toString()); - if(searchCriteria.getTenantId().split("\\.").length > 1){ - query = query.replace("{{operator}}", "="); - } - else - query = query.replace("{{operator}}", "LIKE"); - - return query; - } - - private StringBuilder addWrapperQuery(StringBuilder builder){ - String wrapper = "select id from ( {{PLACEHOLDER}} ) t ORDER BY date DESC"; - wrapper = wrapper.replace("{{PLACEHOLDER}}", builder.toString()); - - return new StringBuilder(wrapper); - - } - - - private void addWhereClause(StringBuilder selectQuery, Map preparedStatementValues, - PaymentSearchCriteria searchCriteria) { - - if (StringUtils.isNotBlank(searchCriteria.getTenantId())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - if(searchCriteria.getTenantId().split("\\.").length > configs.getStateLevelTenantIdLength()) { - selectQuery.append(" py_inner.tenantId =:tenantId"); - preparedStatementValues.put("tenantId", searchCriteria.getTenantId()); - } - else { - selectQuery.append(" py_inner.tenantId LIKE :tenantId"); - preparedStatementValues.put("tenantId", searchCriteria.getTenantId() + "%"); - } - - } - - if(!CollectionUtils.isEmpty(searchCriteria.getIds())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py_inner.id IN (:id) "); - preparedStatementValues.put("id", searchCriteria.getIds()); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getStatus())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" UPPER(py_inner.paymentstatus) in (:status)"); - preparedStatementValues.put("status", - searchCriteria.getStatus() - .stream() - .map(String::toUpperCase) - .collect(toSet()) - ); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getInstrumentStatus())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" UPPER(py_inner.instrumentStatus) in (:instrumentStatus)"); - preparedStatementValues.put("instrumentStatus", - searchCriteria.getInstrumentStatus() - .stream() - .map(String::toUpperCase) - .collect(toSet()) - ); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getPaymentModes())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" UPPER(py_inner.paymentMode) in (:paymentMode)"); - preparedStatementValues.put("paymentMode", - searchCriteria.getPaymentModes() - .stream() - .map(String::toUpperCase) - .collect(toSet()) - ); - } - - if (StringUtils.isNotBlank(searchCriteria.getMobileNumber())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py_inner.mobileNumber = :mobileNumber"); - preparedStatementValues.put("mobileNumber", searchCriteria.getMobileNumber()); - } - - if (StringUtils.isNotBlank(searchCriteria.getTransactionNumber())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py_inner.transactionNumber = :transactionNumber"); - preparedStatementValues.put("transactionNumber", searchCriteria.getTransactionNumber()); - } - - if (searchCriteria.getFromDate() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py_inner.transactionDate >= :fromDate"); - preparedStatementValues.put("fromDate", searchCriteria.getFromDate()); - } - - if (searchCriteria.getToDate() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py_inner.transactionDate <= :toDate"); - Calendar c = Calendar.getInstance(); - c.setTime(new Date(searchCriteria.getToDate())); - c.add(Calendar.DATE, 1); - searchCriteria.setToDate(c.getTime().getTime()); - - preparedStatementValues.put("toDate", searchCriteria.getToDate()); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getPayerIds())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py_inner.payerid IN (:payerid) "); - preparedStatementValues.put("payerid", searchCriteria.getPayerIds()); - } - - addPaymentDetailWhereClause(selectQuery, preparedStatementValues, searchCriteria); - addBillWhereCluase(selectQuery, preparedStatementValues, searchCriteria); - - -/* if (searchCriteria.getReceiptNumbers() != null && !searchCriteria.getReceiptNumbers().isEmpty()) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" pyd.receiptNumber IN (:receiptnumber) "); - preparedStatementValues.put("receiptnumber", searchCriteria.getReceiptNumbers()); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getBusinessServices())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" pyd.businessService IN (:businessService) "); - preparedStatementValues.put("businessService", searchCriteria.getBusinessServices()); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getBillIds())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" pyd.billid in (:billid)"); - preparedStatementValues.put("billid", searchCriteria.getBillIds()); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getConsumerCodes())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" bill.consumerCode in (:consumerCodes)"); - preparedStatementValues.put("consumerCodes", searchCriteria.getConsumerCodes()); - }*/ - - - } - - - private static void addPaymentDetailWhereClause(StringBuilder selectQuery, Map preparedStatementValues, - PaymentSearchCriteria searchCriteria){ - - StringBuilder paymentDetailQuery = new StringBuilder(" id in (select pyd.paymentid from {schema}.egcl_paymentdetail as pyd "); - Map paymentDetailPreparedStatementValues = new HashMap<>(); - - if (!CollectionUtils.isEmpty(searchCriteria.getBusinessServices())) { - addClauseIfRequired(paymentDetailPreparedStatementValues, paymentDetailQuery); - paymentDetailQuery.append(" pyd.businessService IN (:businessService) "); - preparedStatementValues.put("businessService", searchCriteria.getBusinessServices()); - paymentDetailPreparedStatementValues.put("businessService", searchCriteria.getBusinessServices()); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getBillIds())) { - addClauseIfRequired(paymentDetailPreparedStatementValues, paymentDetailQuery); - paymentDetailQuery.append(" pyd.billid in (:billid)"); - preparedStatementValues.put("billid", searchCriteria.getBillIds()); - paymentDetailPreparedStatementValues.put("billid", searchCriteria.getBillIds()); - } - - if (searchCriteria.getReceiptNumbers() != null && !searchCriteria.getReceiptNumbers().isEmpty()) { - addClauseIfRequired(paymentDetailPreparedStatementValues, paymentDetailQuery); - paymentDetailQuery.append(" pyd.receiptNumber IN (:receiptnumber) "); - preparedStatementValues.put("receiptnumber", searchCriteria.getReceiptNumbers()); - paymentDetailPreparedStatementValues.put("receiptnumber", searchCriteria.getReceiptNumbers()); - } - - if (!paymentDetailPreparedStatementValues.isEmpty()){ - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(paymentDetailQuery).append(") "); - } - - } - - - - private static void addBillWhereCluase(StringBuilder selectQuery, Map preparedStatementValues, - PaymentSearchCriteria searchCriteria){ - if (!CollectionUtils.isEmpty(searchCriteria.getConsumerCodes())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" id in (select paymentid from {schema}.egcl_paymentdetail as pyd where pyd.billid in ( select id from {schema}.egcl_bill as bill where bill.consumercode in (:consumerCodes)) )" ); - preparedStatementValues.put("consumerCodes", searchCriteria.getConsumerCodes()); - } - } - - /* - * Wraps pagination around the base query - * @param query The query for which pagination has to be done - * @param preparedStmtList The object list to send the params - * @param criteria The object containg the search params - * @return Query with pagination - */ - private void addPagination(StringBuilder query,Map preparedStatementValues,PaymentSearchCriteria criteria){ - int limit = configs.getDefaultLimit(); - int offset = 0; - query.append(" OFFSET :offset "); - query.append(" LIMIT :limit "); - - if(criteria.getLimit()!=null && criteria.getLimit()<= configs.getMaxSearchLimit()) - limit = criteria.getLimit(); - - if(criteria.getLimit()!=null && criteria.getLimit()> configs.getMaxSearchLimit()) - limit = configs.getMaxSearchLimit(); - - if(criteria.getOffset()!=null) - offset = criteria.getOffset(); - - preparedStatementValues.put("offset", offset); - preparedStatementValues.put("limit", limit); - - } - - private static String addOrderByClause(StringBuilder selectQuery) { - return selectQuery.append(" ORDER BY py.transactiondate DESC ").toString(); - - } - - - private static void addClauseIfRequired(Map values, StringBuilder queryString) { - if (values.isEmpty()) - queryString.append(" WHERE "); - else { - queryString.append(" AND"); - } - } - - - public static MapSqlParameterSource getParamtersForBillStatusUpdate(Bill bill){ - - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", bill.getId()); - sqlParameterSource.addValue("status", bill.getStatus()); - sqlParameterSource.addValue("iscancelled", bill.getIsCancelled()); - sqlParameterSource.addValue("additionaldetails", getJsonb(bill.getAdditionalDetails())); - sqlParameterSource.addValue("status", bill.getStatus().toString()); - sqlParameterSource.addValue("reasonforcancellation", bill.getReasonForCancellation()); - sqlParameterSource.addValue("lastmodifiedby", bill.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", bill.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - } - - - public static MapSqlParameterSource getParametersForPaymentDetailStatusUpdate(PaymentDetail paymentDetail) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", paymentDetail.getId()); - sqlParameterSource.addValue("additionaldetails",getJsonb(paymentDetail.getAdditionalDetails())); - sqlParameterSource.addValue("lastmodifiedby", paymentDetail.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", paymentDetail.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - - } - - - public static MapSqlParameterSource getParametersForPaymentStatusUpdate(Payment payment) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", payment.getId()); - sqlParameterSource.addValue("instrumentstatus", payment.getInstrumentStatus().toString()); - sqlParameterSource.addValue("paymentstatus", payment.getPaymentStatus().toString()); - sqlParameterSource.addValue("additionaldetails", getJsonb(payment.getAdditionalDetails())); - sqlParameterSource.addValue("lastmodifiedby", payment.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", payment.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - - } - - - - // Payment update - - public static MapSqlParameterSource getParametersForPaymentUpdate(Payment payment) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", payment.getId()); - sqlParameterSource.addValue("paidby", payment.getPaidBy()); - sqlParameterSource.addValue("payeraddress", payment.getPayerAddress()); - sqlParameterSource.addValue("payeremail", payment.getPayerEmail()); - sqlParameterSource.addValue("payername", payment.getPayerName()); - sqlParameterSource.addValue("additionalDetails", getJsonb(payment.getAdditionalDetails())); - sqlParameterSource.addValue("lastmodifiedby", payment.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", payment.getAuditDetails().getLastModifiedTime()); - - - return sqlParameterSource; - - } - - - public static MapSqlParameterSource getParametersForPaymentDetailUpdate(PaymentDetail paymentDetail) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", paymentDetail.getId()); - sqlParameterSource.addValue("additionalDetails", getJsonb(paymentDetail.getAdditionalDetails())); - sqlParameterSource.addValue("lastmodifiedby", paymentDetail.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", paymentDetail.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - - } - - - public static MapSqlParameterSource getParamtersForBillUpdate(Bill bill){ - - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", bill.getId()); - sqlParameterSource.addValue("additionaldetails", getJsonb(bill.getAdditionalDetails()) ); - sqlParameterSource.addValue("createdby", bill.getAuditDetails().getCreatedBy()); - sqlParameterSource.addValue("createdtime", bill.getAuditDetails().getCreatedTime()); - sqlParameterSource.addValue("lastmodifiedby", bill.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", bill.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - } - - - public static MapSqlParameterSource getParamtersForBillDetailUpdate(BillDetail billDetail) { - - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - sqlParameterSource.addValue("id", billDetail.getId()); - sqlParameterSource.addValue("additionaldetails", getJsonb(billDetail.getAdditionalDetails())); - sqlParameterSource.addValue("voucherheader", billDetail.getVoucherHeader()); - sqlParameterSource.addValue("manualreceiptnumber", billDetail.getManualReceiptNumber()); - sqlParameterSource.addValue("manualreceiptdate", billDetail.getManualReceiptDate()); - sqlParameterSource.addValue("billdescription", billDetail.getBillDescription()); - sqlParameterSource.addValue("displaymessage", billDetail.getDisplayMessage()); - sqlParameterSource.addValue("createdby", billDetail.getAuditDetails().getCreatedBy()); - sqlParameterSource.addValue("createdtime", billDetail.getAuditDetails().getCreatedTime()); - sqlParameterSource.addValue("lastmodifiedby", billDetail.getAuditDetails().getLastModifiedBy()); - sqlParameterSource.addValue("lastmodifiedtime", billDetail.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - } - - - - - - private static PGobject getJsonb(JsonNode node) { - if (Objects.isNull(node)) - return null; - - PGobject pgObject = new PGobject(); - pgObject.setType("jsonb"); - try { - pgObject.setValue(node.toString()); - return pgObject; - } catch (SQLException e) { - throw new CustomException("UNABLE_TO_CREATE_RECEIPT", "Invalid JSONB value provided"); - } - - } - - private void addWhereClauseForPlainSearch(StringBuilder selectQuery, Map preparedStatementValues, - PaymentSearchCriteria searchCriteria) { - - if (StringUtils.isNotBlank(searchCriteria.getTenantId())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - if(searchCriteria.getTenantId().split("\\.").length > configs.getStateLevelTenantIdLength()) { - selectQuery.append(" py.tenantId =:tenantId"); - preparedStatementValues.put("tenantId", searchCriteria.getTenantId()); - } - else { - selectQuery.append(" py.tenantId LIKE :tenantId"); - preparedStatementValues.put("tenantId", searchCriteria.getTenantId() + "%"); - } - - } - - if(!CollectionUtils.isEmpty(searchCriteria.getIds())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py.id IN (:id) "); - preparedStatementValues.put("id", searchCriteria.getIds()); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getStatus())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" UPPER(py.paymentstatus) in (:status)"); - preparedStatementValues.put("status", - searchCriteria.getStatus() - .stream() - .map(String::toUpperCase) - .collect(toSet()) - ); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getInstrumentStatus())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" UPPER(py.instrumentStatus) in (:instrumentStatus)"); - preparedStatementValues.put("instrumentStatus", - searchCriteria.getInstrumentStatus() - .stream() - .map(String::toUpperCase) - .collect(toSet()) - ); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getPaymentModes())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" UPPER(py.paymentMode) in (:paymentMode)"); - preparedStatementValues.put("paymentMode", - searchCriteria.getPaymentModes() - .stream() - .map(String::toUpperCase) - .collect(toSet()) - ); - } - - if (StringUtils.isNotBlank(searchCriteria.getMobileNumber())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py.mobileNumber = :mobileNumber"); - preparedStatementValues.put("mobileNumber", searchCriteria.getMobileNumber()); - } - - if (StringUtils.isNotBlank(searchCriteria.getTransactionNumber())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py.transactionNumber = :transactionNumber"); - preparedStatementValues.put("transactionNumber", searchCriteria.getTransactionNumber()); - } - - if (searchCriteria.getFromDate() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py.transactionDate >= :fromDate"); - preparedStatementValues.put("fromDate", searchCriteria.getFromDate()); - } - - if (searchCriteria.getToDate() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py.transactionDate <= :toDate"); - Calendar c = Calendar.getInstance(); - c.setTime(new Date(searchCriteria.getToDate())); - c.add(Calendar.DATE, 1); - searchCriteria.setToDate(c.getTime().getTime()); - - preparedStatementValues.put("toDate", searchCriteria.getToDate()); - } - - if (!CollectionUtils.isEmpty(searchCriteria.getPayerIds())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" py.payerid IN (:payerid) "); - preparedStatementValues.put("payerid", searchCriteria.getPayerIds()); - } - - addPaymentDetailWhereClause(selectQuery, preparedStatementValues, searchCriteria); - addBillWhereCluase(selectQuery, preparedStatementValues, searchCriteria); - - } - - - public static MapSqlParameterSource getParametersForBankDetailUpdate(JsonNode additionalDetails, String ifsccode) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - sqlParameterSource.addValue("additionaldetails", getJsonb(additionalDetails)); - sqlParameterSource.addValue("ifsccode", ifsccode); - return sqlParameterSource; - - } - - public static MapSqlParameterSource getParametersEmptyDtlBankDetailUpdate(JsonNode additionalDetails, - String ifsccode) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - ObjectMapper mapper = new ObjectMapper(); - ObjectNode objectNode = mapper.createObjectNode(); - objectNode.set("bankDetails", additionalDetails); - sqlParameterSource.addValue("additionaldetails", getJsonb(objectNode)); - sqlParameterSource.addValue("ifsccode", ifsccode); - return sqlParameterSource; - - } - - - - - - - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/RemittanceQueryBuilder.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/RemittanceQueryBuilder.java deleted file mode 100644 index 30d502e43e8..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/RemittanceQueryBuilder.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.egov.collection.repository.querybuilder; - -import java.util.Calendar; -import java.util.Date; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.web.contract.Remittance; -import org.egov.collection.web.contract.RemittanceDetail; -import org.egov.collection.web.contract.RemittanceInstrument; -import org.egov.collection.web.contract.RemittanceReceipt; -import org.egov.collection.web.contract.RemittanceSearchRequest; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; - -public class RemittanceQueryBuilder { - - public static final String INSERT_REMITTANCE_SQL = "INSERT INTO {schema}.egcl_remittance(id, referencenumber, referencedate, voucherheader, fund, function, remarks, reasonfordelay, status, createdby, createddate, lastmodifiedby, lastmodifieddate, bankaccount, tenantid) " - + "VALUES (:id, :referencenumber, :referencedate, :voucherheader, :fund, :function, :remarks, :reasonfordelay, :status, :createdby, :createddate, :lastmodifiedby, :lastmodifieddate, :bankaccount, :tenantid)"; - - public static final String INSERT_REMITTANCE_DETAILS_SQL = "INSERT INTO {schema}.egcl_remittancedetails(id, remittance, chartofaccount, creditamount, debitamount, tenantid) " - + "VALUES (:id, :remittance, :chartofaccount, :creditamount, :debitamount, :tenantid)"; - - public static final String INSERT_REMITTANCE_INSTRUMENT_SQL = "INSERT INTO {schema}.egcl_remittanceinstrument(id, remittance, instrument, reconciled, tenantid) " - + "VALUES (:id, :remittance, :instrument, :reconciled, :tenantid)"; - - public static final String INSERT_REMITTANCE_RECEIPT_SQL = "INSERT INTO {schema}.egcl_remittancereceipt(id, remittance, receipt, tenantid) " - + "VALUES (:id, :remittance, :receipt, :tenantid)"; - - private static final String SELECT_REMITTANCES_SQL = "Select rem.bankaccount as rem_bankaccount,rem.function as rem_function," - + "rem.fund as rem_fund, rem.id as rem_id, rem.reasonForDelay as rem_reasonForDelay, rem.referenceDate as rem_referenceDate," - + "rem.referenceNumber as rem_referenceNumber, rem.remarks as rem_remarks, rem.status as rem_status,rem.voucherHeader as rem_voucherHeader," - + "rem.createdBy as rem_createdBy, rem.createdDate as rem_createdDate," - + "rem.lastModifiedBy as rem_lastModifiedBy, rem.lastModifiedDate as rem_lastModifiedDate," - + "rem.tenantId as rem_tenantId," - - + "remDet.remittance as remDet_remittance, remDet.chartOfAccount as remDet_chartOfAccount," - + "remDet.creditAmount as remDet_creditAmount, remDet.debitAmount as remDet_debitAmount," - + "remDet.tenantId as remDet_tenantId, remDet.id as remDet_id," - - + "remIsm.remittance as remIsm_remittance, remIsm.instrument as remIsm_instrument, remIsm.reconciled as remIsm_reconciled," - + "remIsm.tenantId as remIsm_tenantId, remIsm.id as remIsm_id," - - + "remRec.remittance as remRec_remittance, remRec.receipt as remRec_receipt," - + "remRec.tenantId as remRec_tenantId, remRec.id as remRec_id" - - + " from {schema}.egcl_remittance rem LEFT OUTER JOIN {schema}.egcl_remittancedetails remDet ON rem.id=remDet.remittance " + - "LEFT OUTER JOIN {schema}.egcl_remittanceinstrument remIsm ON rem.id=remIsm.remittance " + - "LEFT OUTER JOIN {schema}.egcl_remittancereceipt remRec ON rem.id=remRec.remittance "; - - private static final String PAGINATION_WRAPPER = "SELECT * FROM " + - "(SELECT *, DENSE_RANK() OVER (ORDER BY rem_id) offset_ FROM " + - "({baseQuery})" + - " result) result_offset " + - "WHERE offset_ > :offset AND offset_ <= :limit"; - - public static MapSqlParameterSource getParametersForRemittance(Remittance remittance) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", remittance.getId()); - sqlParameterSource.addValue("referencenumber", remittance.getReferenceNumber()); - sqlParameterSource.addValue("referencedate", remittance.getReferenceDate()); - sqlParameterSource.addValue("voucherheader", remittance.getVoucherHeader()); - sqlParameterSource.addValue("fund", remittance.getFund()); - sqlParameterSource.addValue("function", remittance.getFunction()); - sqlParameterSource.addValue("remarks", remittance.getRemarks()); - sqlParameterSource.addValue("reasonfordelay", remittance.getReasonForDelay()); - sqlParameterSource.addValue("status", remittance.getStatus()); - sqlParameterSource.addValue("bankaccount", remittance.getBankaccount()); - sqlParameterSource.addValue("tenantid", remittance.getTenantId()); - sqlParameterSource.addValue("createdby", Long.parseLong(remittance.getAuditDetails().getCreatedBy())); - sqlParameterSource.addValue("createddate", remittance.getAuditDetails().getCreatedTime()); - sqlParameterSource.addValue("lastmodifiedby", Long.parseLong(remittance.getAuditDetails().getLastModifiedBy())); - sqlParameterSource.addValue("lastmodifieddate", remittance.getAuditDetails().getLastModifiedTime()); - - return sqlParameterSource; - - } - - public static MapSqlParameterSource getParametersForRemittanceDetails(RemittanceDetail remittanceDetails) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", remittanceDetails.getId()); - sqlParameterSource.addValue("remittance", remittanceDetails.getRemittance()); - sqlParameterSource.addValue("chartofaccount", remittanceDetails.getChartOfAccount()); - sqlParameterSource.addValue("creditamount", remittanceDetails.getCreditAmount()); - sqlParameterSource.addValue("debitamount", remittanceDetails.getDebitAmount()); - sqlParameterSource.addValue("tenantid", remittanceDetails.getTenantId()); - - return sqlParameterSource; - - } - - public static MapSqlParameterSource getParametersForRemittanceInstrument(RemittanceInstrument remittanceInstrument) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", remittanceInstrument.getId()); - sqlParameterSource.addValue("remittance", remittanceInstrument.getRemittance()); - sqlParameterSource.addValue("instrument", remittanceInstrument.getInstrument()); - sqlParameterSource.addValue("reconciled", remittanceInstrument.getReconciled()); - sqlParameterSource.addValue("tenantid", remittanceInstrument.getTenantId()); - - return sqlParameterSource; - - } - - public static MapSqlParameterSource getParametersForRemittanceReceipt(RemittanceReceipt remittanceReceipt) { - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - - sqlParameterSource.addValue("id", remittanceReceipt.getId()); - sqlParameterSource.addValue("remittance", remittanceReceipt.getRemittance()); - sqlParameterSource.addValue("receipt", remittanceReceipt.getReceipt()); - sqlParameterSource.addValue("tenantid", remittanceReceipt.getTenantId()); - - return sqlParameterSource; - - } - - @SuppressWarnings("rawtypes") - public static String getRemittanceSearchQuery(RemittanceSearchRequest searchCriteria, - Map preparedStatementValues) { - StringBuilder selectQuery = new StringBuilder(SELECT_REMITTANCES_SQL); - - addWhereClause(selectQuery, preparedStatementValues, searchCriteria); - addOrderByClause(selectQuery, searchCriteria); - - return addPaginationClause(selectQuery, preparedStatementValues, searchCriteria); - } - - @SuppressWarnings({ "unchecked", "rawtypes", "deprecation" }) - private static void addWhereClause(StringBuilder selectQuery, Map preparedStatementValues, - RemittanceSearchRequest searchCriteria) { - - if (StringUtils.isNotBlank(searchCriteria.getTenantId())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.tenantId =:tenantId"); - preparedStatementValues.put("tenantId", searchCriteria.getTenantId()); - - } - - if (searchCriteria.getReferenceNumbers() != null && !searchCriteria.getReferenceNumbers().isEmpty()) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.referenceNumber IN (:referenceNumbers) "); - preparedStatementValues.put("referenceNumbers", searchCriteria.getReferenceNumbers()); - } - - if (StringUtils.isNotBlank(searchCriteria.getBankaccount())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.bankaccount in (:bankaccount)"); - preparedStatementValues.put("bankaccount", searchCriteria.getBankaccount()); - } - - if (StringUtils.isNotBlank(searchCriteria.getStatus())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.status = :status"); - preparedStatementValues.put("status", searchCriteria.getStatus()); - } - - if (StringUtils.isNotBlank(searchCriteria.getFund())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.fund = :fund"); - preparedStatementValues.put("fund", searchCriteria.getFund()); - } - - if (StringUtils.isNotBlank(searchCriteria.getFunction())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.function = :function"); - preparedStatementValues.put("function", searchCriteria.getFunction()); - } - - if (StringUtils.isNotBlank(searchCriteria.getReasonForDelay())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.reasonForDelay = :reasonForDelay"); - preparedStatementValues.put("reasonForDelay", searchCriteria.getReasonForDelay()); - } - - if (StringUtils.isNotBlank(searchCriteria.getRemarks())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.remarks = :remarks"); - preparedStatementValues.put("remarks", searchCriteria.getRemarks()); - } - - if (searchCriteria.getFromDate() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.referenceDate >= :fromDate"); - preparedStatementValues.put("fromDate", searchCriteria.getFromDate()); - } - - if (searchCriteria.getToDate() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.referenceDate <= :toDate"); - Calendar c = Calendar.getInstance(); - c.setTime(new Date(searchCriteria.getToDate())); - c.add(Calendar.DATE, 1); - searchCriteria.setToDate(c.getTime().getTime()); - - preparedStatementValues.put("toDate", searchCriteria.getToDate()); - } - - if (StringUtils.isNotBlank(searchCriteria.getVoucherHeader())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.voucherHeader = :voucherHeader"); - preparedStatementValues.put("voucherHeader", searchCriteria.getVoucherHeader()); - } - - if (searchCriteria.getIds() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rem.id IN (:ids)"); - preparedStatementValues.put("ids", searchCriteria.getIds()); - } - - } - - private static void addClauseIfRequired(Map values, StringBuilder queryString) { - if (values.isEmpty()) - queryString.append(" WHERE "); - else { - queryString.append(" AND"); - } - } - - private static void addOrderByClause(StringBuilder selectQuery, - RemittanceSearchRequest criteria) { - String sortBy = (criteria.getSortBy() == null ? "rem.referenceDate" : "rem." + criteria.getSortBy()); - String sortOrder = (criteria.getSortOrder() == null ? "DESC" : criteria - .getSortOrder()); - selectQuery.append(" ORDER BY ").append(sortBy).append(" ").append(sortOrder); - } - - private static String addPaginationClause(StringBuilder selectQuery, Map preparedStatementValues, - RemittanceSearchRequest criteria) { - - if (criteria.getLimit() != 0) { - String finalQuery = PAGINATION_WRAPPER.replace("{baseQuery}", selectQuery); - preparedStatementValues.put("offset", criteria.getOffset()); - preparedStatementValues.put("limit", criteria.getOffset() + criteria.getLimit()); - - return finalQuery; - } else - return selectQuery.toString(); - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/v1/CollectionQueryBuilder_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/v1/CollectionQueryBuilder_v1.java deleted file mode 100644 index c66192a3de3..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/v1/CollectionQueryBuilder_v1.java +++ /dev/null @@ -1,243 +0,0 @@ -package org.egov.collection.repository.querybuilder.v1; - -import static java.util.Objects.isNull; -import static java.util.stream.Collectors.toSet; - -import java.util.Calendar; -import java.util.Date; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.v1.ReceiptSearchCriteria_v1; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class CollectionQueryBuilder_v1 { - - @Autowired - private ApplicationProperties configs; - - private static final String SELECT_RECEIPTS_SQL = "Select rh.id as rh_id,rh.payername as rh_payername,rh" + - ".payerAddress as rh_payerAddress, rh.payerEmail as rh_payerEmail, rh.payermobile as rh_payermobile, rh" + - ".paidBy as rh_paidBy, rh.referenceNumber as rh_referenceNumber, rh.referenceDate as rh_referenceDate,rh.receiptType as " - + - "rh_receiptType, rh.receiptNumber as rh_receiptNumber, rh.receiptDate as rh_receiptDate, rh.referenceDesc" + - " as rh_referenceDesc, rh.manualReceiptNumber as rh_manualReceiptNumber, rh.fund as rh_fund, rh.function as rh_function, rh.department as rh_department, rh.manualreceiptdate as " - + - "rh_manualreceiptdate, rh.businessDetails as rh_businessDetails, rh.collectionType as rh_collectionType,rh.stateId as rh_stateId,rh.location as " - + - "rh_location, rh.isReconciled as rh_isReconciled,rh.status as rh_status,rh.reasonForCancellation as " + - "rh_reasonForCancellation , rh.minimumAmount as rh_minimumAmount,rh.totalAmount as rh_totalAmount, rh" + - ".collectedamount as rh_collectedamount, rh.collModesNotAllwd as rh_collModesNotAllwd,rh.consumerCode as " + - "rh_consumerCode,rh.function as rh_function, rh.version as rh_version,rh.channel as rh_channel,rh.reference_ch_id as " - + - "rh_reference_ch_id, rh.consumerType as rh_consumerType,rh.fund as rh_fund,rh.fundSource as " + - "rh_fundSource, rh.boundary as rh_boundary, rh.department as rh_department,rh.depositedBranch as " + - "rh_depositedBranch, rh.tenantId as rh_tenantId, rh.displayMsg as rh_displayMsg,rh.voucherheader as " + - "rh_voucherheader, rh.cancellationRemarks as rh_cancellationRemarks, rh.additionalDetails as " + - "rh_additionalDetails, rh.createdBy as rh_createdBy, rh.createdDate as rh_createdDate,rh.lastModifiedBy " + - "as rh_lastModifiedBy, rh.lastModifiedDate as " + - "rh_lastModifiedDate, rh.demandid as rh_demandid, rh.demandFromDate as rh_demandfromdate, " + - "rh.demandToDate as rh_demandtodate, rh.transactionid as rh_transactionid, rd.id as rd_id, rd.amount as rd_amount, " + - "rd.adjustedamount as rd_adjustedamount, rd.ordernumber as " + - "rd_ordernumber, rd.description as rd_description,rd" + - ".isActualDemand as rd_isActualDemand, rd.financialYear as rd_financialYear,rd.purpose as rd_purpose, " + - "rd.additionalDetails as rd_additionalDetails, rd.tenantId as rd_tenantId, rd.taxheadcode as rd_taxheadcode, "+ - "rd.demanddetailid as rd_demanddetailid, ins.id as ins_instrumentheader, " + - "ins.amount as ins_amount, ins.transactionDate as ins_transactiondate, ins.transactionNumber as " + - "ins_transactionNumber, ins.instrumenttype as ins_instrumenttype, ins .instrumentstatus" + - " as ins_instrumentstatus, ins.bankid as ins_bankid , ins.branchname as ins_branchname , ins" + - ".bankaccountid as ins_bankaccountid, ins.ifsccode as ins_ifsccode , ins.financialstatus as " + - "ins_financialstatus , ins.transactiontype as ins_transactiontype , ins.payee as ins_payee , ins.drawer " + - "as ins_drawer , ins.surrenderreason as ins_surrenderreason , ins.serialno as ins_serialno , ins" + - ".additionalDetails as ins_additionalDetails, ins.createdby as ins_createdby , ins.createddate as ins_createddate , ins.lastmodifiedby as " - + - "ins_lastmodifiedby , ins.lastmodifieddate as ins_lastmodifieddate , ins.tenantid as ins_tenantid , " + - " ins.instrumentDate as ins_instrumentDate, ins.instrumentNumber as ins_instrumentNumber " + - "from egcl_receiptheader_v1 rh LEFT OUTER JOIN egcl_receiptdetails_v1 rd ON rh.id=rd.receiptheader " + - "LEFT OUTER JOIN egcl_receiptinstrument_v1 recins ON rh.id=recins.receiptheader " + - "LEFT JOIN egcl_instrumentheader_v1 ins ON recins.instrumentheader=ins.id "; - - private static final String PAGINATION_WRAPPER = "SELECT * FROM " + - "(SELECT *, DENSE_RANK() OVER (ORDER BY rh_id) offset_ FROM " + - "({baseQuery})" + - " result) result_offset " + - "WHERE offset_ > :offset AND offset_ <= :limit"; - - public String getReceiptSearchQuery(ReceiptSearchCriteria_v1 searchCriteria, - Map preparedStatementValues) { - StringBuilder selectQuery = new StringBuilder(SELECT_RECEIPTS_SQL); - - addWhereClause(selectQuery, preparedStatementValues, searchCriteria); - - addPaginationClause(selectQuery, preparedStatementValues, searchCriteria); - - return selectQuery.toString(); - } - - private static void addClauseIfRequired(Map values, StringBuilder queryString) { - if (values.isEmpty()) - queryString.append(" WHERE "); - else { - queryString.append(" AND"); - } - } - - - @SuppressWarnings({ "unchecked", "rawtypes", "deprecation" }) - private void addWhereClause(StringBuilder selectQuery, Map preparedStatementValues, - ReceiptSearchCriteria_v1 searchCriteria) { - - if (StringUtils.isNotBlank(searchCriteria.getTenantId())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - if(searchCriteria.getTenantId().split("\\.").length > configs.getStateLevelTenantIdLength()) { - selectQuery.append(" rh.tenantId =:tenantId"); - preparedStatementValues.put("tenantId", searchCriteria.getTenantId()); - } - else { - selectQuery.append(" rh.tenantId LIKE :tenantId"); - preparedStatementValues.put("tenantId", searchCriteria.getTenantId() + "%"); - } - - } - - if (searchCriteria.getReceiptNumbers() != null && !searchCriteria.getReceiptNumbers().isEmpty()) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.receiptNumber IN (:receiptNumbers) "); - preparedStatementValues.put("receiptNumbers", searchCriteria.getReceiptNumbers()); - } - - if (!isNull(searchCriteria.getConsumerCode()) && !searchCriteria.getConsumerCode().isEmpty()) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.consumerCode in (:consumerCodes)"); - preparedStatementValues.put("consumerCodes", searchCriteria.getConsumerCode()); - } - - if (!isNull(searchCriteria.getStatus()) && !searchCriteria.getStatus().isEmpty()) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" UPPER(rh.status) in (:status)"); - preparedStatementValues.put("status", - searchCriteria.getStatus() - .stream() - .map(String::toUpperCase) - .collect(toSet()) - ); - } - - if (!isNull(searchCriteria.getInstrumentType()) && !searchCriteria.getInstrumentType().isEmpty()) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" UPPER(ins.instrumenttype) in (:instrumenttype)"); - preparedStatementValues.put("instrumenttype", - searchCriteria.getInstrumentType() - .stream() - .map(String::toUpperCase) - .collect(toSet()) - ); - } - - if (StringUtils.isNotBlank(searchCriteria.getFund())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.fund = :fund"); - preparedStatementValues.put("fund", searchCriteria.getFund()); - } - - if (StringUtils.isNotBlank(searchCriteria.getDepartment())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.department = :department"); - preparedStatementValues.put("department", searchCriteria.getDepartment()); - } - - if (StringUtils.isNotBlank(searchCriteria.getCollectedBy())) { - - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.createdBy = :collectedBy"); - preparedStatementValues.put("collectedBy", new Long(searchCriteria - .getCollectedBy())); - } - - if (searchCriteria.getFromDate() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.receiptDate >= :fromDate"); - preparedStatementValues.put("fromDate", searchCriteria.getFromDate()); - } - - if (searchCriteria.getToDate() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.receiptDate <= :toDate"); - Calendar c = Calendar.getInstance(); - c.setTime(new Date(searchCriteria.getToDate())); - c.add(Calendar.DATE, 1); - searchCriteria.setToDate(c.getTime().getTime()); - - preparedStatementValues.put("toDate", searchCriteria.getToDate()); - } - - if (StringUtils.isNotBlank(searchCriteria.getBusinessCode())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.businessDetails = :businessCode"); - preparedStatementValues.put("businessCode", searchCriteria.getBusinessCode()); - } - - if (searchCriteria.getBusinessCodes() != null && !searchCriteria.getBusinessCodes().isEmpty()) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.businessDetails IN (:businessCodes) "); - preparedStatementValues.put("businessCodes", searchCriteria.getBusinessCodes()); - } - - if (searchCriteria.getIds() != null) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.id IN (:ids)"); - preparedStatementValues.put("ids", searchCriteria.getIds()); - } - - if (StringUtils.isNotBlank(searchCriteria.getTransactionId())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.transactionid = :transactionId "); - preparedStatementValues.put("transactionId", searchCriteria.getTransactionId()); - } - - if (searchCriteria.getManualReceiptNumbers() != null && !searchCriteria.getManualReceiptNumbers().isEmpty()) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.manualreceiptnumber IN (:manualReceiptNumbers) "); - preparedStatementValues.put("manualReceiptNumbers", searchCriteria.getManualReceiptNumbers()); - } - - if (searchCriteria.getBillIds() != null && !searchCriteria.getBillIds().isEmpty()) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.referencenumber IN (:billIds) "); - preparedStatementValues.put("billIds", searchCriteria.getBillIds()); - } - - if (searchCriteria.getPayerIds() != null && !searchCriteria.getPayerIds().isEmpty()) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.payerid IN (:payerid) "); - preparedStatementValues.put("payerid", searchCriteria.getPayerIds()); - } - - if (StringUtils.isNotBlank(searchCriteria.getMobileNo())) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append(" rh.payermobile = :payermobile"); - preparedStatementValues.put("payermobile", searchCriteria.getMobileNo()); - } - } - - private static void addPaginationClause(StringBuilder selectQuery, Map preparedStatementValues, - ReceiptSearchCriteria_v1 criteria) { - - if (criteria.getLimit() != null && criteria.getLimit() != 0) { - addClauseIfRequired(preparedStatementValues, selectQuery); - selectQuery.append( - " rh.id in (select id from egcl_receiptheader_v1 where tenantid = :tenantId order by createddate offset :offset limit :limit)"); - preparedStatementValues.put("offset", criteria.getOffset()); - preparedStatementValues.put("limit", criteria.getLimit()); - } - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/v1/CollectionResultSetExtractor_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/v1/CollectionResultSetExtractor_v1.java deleted file mode 100644 index 13e318adf6f..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/querybuilder/v1/CollectionResultSetExtractor_v1.java +++ /dev/null @@ -1,207 +0,0 @@ -package org.egov.collection.repository.querybuilder.v1; - - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.model.*; -import org.egov.collection.model.enums.CollectionType; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.enums.Purpose; -import org.egov.collection.model.enums.ReceiptType; -import org.egov.collection.model.v1.*; -import org.egov.collection.web.contract.*; -import org.egov.tracer.model.CustomException; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Service; - -import java.io.IOException; -import java.math.BigDecimal; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.*; - -@Service -public class CollectionResultSetExtractor_v1 implements ResultSetExtractor> { - - private ObjectMapper objectMapper; - - @Autowired - CollectionResultSetExtractor_v1(ObjectMapper objectMapper){ - this.objectMapper = objectMapper; - } - - @Override - public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { - - Map receipts = new LinkedHashMap<>(); - - while(resultSet.next()){ - String receiptHeader = resultSet.getString("rh_id"); - Receipt_v1 receipt; - - if(!receipts.containsKey(receiptHeader)){ - BillDetail_v1 billDetail = BillDetail_v1.builder() - .id(receiptHeader) - .billNumber(resultSet.getString("rh_referenceNumber")) - .billDate(resultSet.getLong("rh_referencedate")) - .consumerCode(resultSet.getString("rh_consumerCode")) - .consumerType(resultSet.getString("rh_consumerType")) - .collectionModesNotAllowed(resultSet.getString("rh_collModesNotAllwd") != null - ? Arrays.asList(resultSet.getString("rh_collModesNotAllwd").split("\\s*,\\s*")) - : Collections.emptyList()) - .tenantId(resultSet.getString("rh_tenantId")) - .businessService(resultSet.getString("rh_businessDetails")) - .receiptNumber(resultSet.getString("rh_receiptNumber")) - .receiptType(resultSet.getString("rh_receiptType")) - .channel(resultSet.getString("rh_channel")) - .voucherHeader(resultSet.getString("rh_voucherheader")) - .collectionType(!StringUtils.isEmpty(resultSet.getString("rh_collectionType")) - ? CollectionType.valueOf(resultSet.getString("rh_collectionType")) : null) - .boundary(resultSet.getString("rh_boundary")) - .reasonForCancellation(resultSet.getString("rh_reasonForCancellation")) - .status(resultSet.getString("rh_status")) - .receiptDate(resultSet.getLong("rh_receiptDate")) - .manualReceiptNumber(resultSet.getString("rh_manualReceiptNumber")) - .manualReceiptDate(resultSet.getLong("rh_manualreceiptdate")) - .fund(resultSet.getString("rh_fund")) - .function(resultSet.getString("rh_function")) - .department(resultSet.getString("rh_department")) - .demandId(resultSet.getString("rh_demandid")) - .fromPeriod(resultSet.getLong("rh_demandfromdate")) - .toPeriod(resultSet.getLong("rh_demandtodate")) - .amountPaid(BigDecimal.ZERO) - .totalAmount(getBigDecimalValue(resultSet.getBigDecimal("rh_totalAmount"))) - .collectedAmount(getBigDecimalValue(resultSet.getBigDecimal("rh_collectedamount"))) - .minimumAmount(getBigDecimalValue(resultSet.getBigDecimal("rh_minimumAmount"))) - .additionalDetails(getJsonValue((PGobject) resultSet.getObject("rh_additionalDetails"))) - .billAccountDetails(new ArrayList<>()) - .build(); - - Bill_v1 billInfo = Bill_v1.builder() - .id(resultSet.getString("rh_id")) - .payerName(resultSet.getString("rh_payername")) - .payerAddress(resultSet.getString("rh_payerAddress")) - .payerEmail(resultSet.getString("rh_payerEmail")) - .mobileNumber(resultSet.getString("rh_payermobile")) - .paidBy(resultSet.getString("rh_paidBy")) - .tenantId(resultSet.getString("rh_tenantId")) - .billDetails(Collections.singletonList(billDetail)) - .build(); - - AuditDetails_v1 auditDetailsIns = AuditDetails_v1.builder() - .createdBy(resultSet.getString("rh_createdBy")) - .createdDate(resultSet.getLong("rh_createdDate")) - .lastModifiedBy(resultSet.getString("rh_lastModifiedBy")) - .lastModifiedDate(resultSet.getLong("rh_lastModifiedDate")) - .build(); - - - - Instrument instrument = Instrument.builder() - .id(resultSet.getString("ins_instrumentheader")) - .amount(resultSet.getBigDecimal("ins_amount")) - .transactionDateInput(resultSet.getLong("ins_transactiondate")) - .transactionNumber(resultSet.getString("ins_transactionNumber")) - .instrumentType(InstrumentType.builder().name(resultSet.getString("ins_instrumenttype")) - .build()) - .ifscCode(resultSet.getString("ins_ifsccode")) - .bank(BankContract.builder().name(resultSet.getString("ins_bankid")).build()) - .transactionType(TransactionType.valueOf(resultSet.getString("ins_transactiontype"))) - .payee(resultSet.getString("ins_payee")) - .drawer(resultSet.getString("ins_drawer")) - .surrenderReason(SurrenderReason.builder().name(resultSet.getString("ins_surrenderreason")).build()) - .serialNo(resultSet.getString("ins_serialno")) - .additionalDetails(getJsonValue((PGobject) resultSet.getObject("ins_additionalDetails"))) - .auditDetails(auditDetailsIns) - .instrumentDate(resultSet.getLong("ins_instrumentDate")) - .instrumentNumber(resultSet.getString("ins_instrumentNumber")) - .tenantId(resultSet.getString("ins_tenantid")) - .build(); - - if(resultSet.getString("ins_instrumentstatus").equals("NEW")) { - instrument.setInstrumentStatus(InstrumentStatusEnum.TO_BE_SUBMITTED); - }else if((resultSet.getString("ins_instrumentstatus").equals("CANCELLED"))){ - instrument.setInstrumentStatus(InstrumentStatusEnum.CANCELLED); - }else if((resultSet.getString("ins_instrumentstatus").equals("DEPOSITED"))){ - instrument.setInstrumentStatus(InstrumentStatusEnum.REMITTED); - } - - AuditDetails_v1 auditDetails = AuditDetails_v1.builder() - .createdBy(resultSet.getString("rh_createdBy")) - .createdDate(resultSet.getLong("rh_createdDate")) - .lastModifiedBy(resultSet.getString("rh_lastModifiedBy")) - .lastModifiedDate(resultSet.getLong("rh_lastModifiedDate")) - .build(); - - receipt = Receipt_v1.builder() - .tenantId(resultSet.getString("rh_tenantId")) - .bill(Collections.singletonList(billInfo)) - .receiptNumber(billDetail.getReceiptNumber()) - .consumerCode(billDetail.getConsumerCode()) - .receiptDate(billDetail.getReceiptDate()) - .transactionId(resultSet.getString("rh_transactionid")) - .instrument(instrument) - .auditDetails(auditDetails) - .build(); - - receipts.put(receiptHeader, receipt); - - } else { - receipt = receipts.get(receiptHeader); - } - - BillDetail_v1 billDetail = receipt.getBill().get(0).getBillDetails().get(0); - BillAccountDetail_v1 billAccountDetail = populateAccountDetail(resultSet, billDetail); - - /* - * adding paid amount only when data is not duplicate - */ - if (billDetail.addBillAccountDetail(billAccountDetail)) - billDetail.setAmountPaid(billDetail.getAmountPaid().add(billAccountDetail.getAdjustedAmount())); - } - - return new ArrayList<>(receipts.values()); - } - - private BillAccountDetail_v1 populateAccountDetail(ResultSet resultSet, BillDetail_v1 billDetail) throws SQLException, - DataAccessException{ - - - return BillAccountDetail_v1.builder() - .id(resultSet.getString("rd_id")) - .isActualDemand((Boolean) resultSet.getObject("rd_isActualDemand")) - .tenantId(resultSet.getString("rd_tenantId")) - .billDetail(resultSet.getString("rh_id")) - .order(resultSet.getInt("rd_ordernumber")) - .purpose(!StringUtils.isEmpty(resultSet.getString("rd_purpose")) ? - Purpose.valueOf(resultSet.getString("rd_purpose")) : null) - .additionalDetails(getJsonValue((PGobject) resultSet.getObject("rd_additionalDetails"))) - .amount(getBigDecimalValue(resultSet.getBigDecimal("rd_amount"))) - .adjustedAmount(getBigDecimalValue(resultSet.getBigDecimal("rd_adjustedamount"))) - .taxHeadCode(resultSet.getString("rd_taxheadcode")) - .demandDetailId(resultSet.getString("rd_demanddetailid")) - .build(); - } - - private BigDecimal getBigDecimalValue(BigDecimal amount){ - return Objects.isNull(amount) ? BigDecimal.ZERO : amount; - } - - private JsonNode getJsonValue(PGobject pGobject){ - try { - if(Objects.isNull(pGobject) || Objects.isNull(pGobject.getValue())) - return null; - else - return objectMapper.readTree( pGobject.getValue()); - } catch (IOException e) { - throw new CustomException("SERVER_ERROR","Exception occurred while parsing the draft json : "+ e - .getMessage()); - } - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/BillRowMapper.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/BillRowMapper.java deleted file mode 100644 index b1dd9b4f07a..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/BillRowMapper.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.egov.collection.repository.rowmapper; - -import java.io.IOException; -import java.math.BigDecimal; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -import org.egov.collection.model.AuditDetails; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.Bill.StatusEnum; -import org.egov.collection.web.contract.BillAccountDetail; -import org.egov.tracer.model.CustomException; -import org.postgresql.util.PGobject; -import org.egov.collection.web.contract.BillDetail; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Component -public class BillRowMapper implements ResultSetExtractor> { - - @Autowired - private ObjectMapper mapper; - - @Override - public List extractData(ResultSet rs) throws SQLException { - - Map billMap = new LinkedHashMap<>(); - Map billDetailMap = new HashMap<>(); - - while (rs.next()) { - - String billId = rs.getString("b_id"); - Bill bill = billMap.get(billId); - - if (bill == null) { - - AuditDetails auditDetails = new AuditDetails(); - auditDetails.setCreatedBy(rs.getString("b_createdby")); - auditDetails.setCreatedTime((Long) rs.getObject("b_createdtime")); - auditDetails.setLastModifiedBy(rs.getString("b_lastmodifiedby")); - auditDetails.setLastModifiedTime((Long) rs.getObject("b_lastmodifiedtime")); - - bill = Bill.builder().id(billId).totalAmount(BigDecimal.ZERO).tenantId(rs.getString("b_tenantid")) - .status(StatusEnum.fromValue(rs.getString("b_status"))) - .businessService(rs.getString("b_businessService")) - .billNumber(rs.getString("b_billnumber")) - .billDate(rs.getLong("b_billdate")) - .consumerCode(rs.getString("b_consumerCode")) - .partPaymentAllowed(rs.getBoolean("b_partpaymentallowed")) - .isAdvanceAllowed(rs.getBoolean("b_isadvanceallowed")) - .auditDetails(auditDetails).build(); - - if(null != rs.getString("b_collectionmodesnotallowed")) { - bill.setCollectionModesNotAllowed( - Arrays.asList(rs.getString("b_collectionmodesnotallowed").split(","))); - } - - PGobject obj = (PGobject) rs.getObject("b_additionalDetails"); - bill.setAdditionalDetails(getJsonValue(obj)); - - billMap.put(bill.getId(), bill); - billDetailMap.clear(); - } - - String detailId = rs.getString("bd_id"); - BillDetail billDetail = billDetailMap.get(detailId); - - if (billDetail == null) { - - billDetail = BillDetail.builder().id(detailId).tenantId(rs.getString("bd_tenantid")) - .billId(rs.getString("bd_billid")).demandId(rs.getString("demandid")) - .fromPeriod(rs.getLong("fromperiod")).toPeriod(rs.getLong("toperiod")) - .amount(rs.getBigDecimal("bd_amount")).amountPaid(rs.getBigDecimal("bd_amountpaid")) - .expiryDate(rs.getLong("bd_expirydate")).build(); - - PGobject obj = (PGobject) rs.getObject("bd_additionalDetails"); - billDetail.setAdditionalDetails(getJsonValue(obj)); - - billDetailMap.put(billDetail.getId(), billDetail); - - if (bill.getId().equals(billDetail.getBillId())) { - bill.addBillDetail(billDetail); - bill.setTotalAmount(bill.getTotalAmount().add(billDetail.getAmount())); - } - } - - BillAccountDetail billAccDetail = BillAccountDetail.builder().id(rs.getString("ad_id")) - .tenantId(rs.getString("ad_tenantid")).billDetailId(rs.getString("ad_billdetailid")) - .order(rs.getInt("ad_order")).amount(rs.getBigDecimal("ad_amount")) - .adjustedAmount(rs.getBigDecimal("ad_adjustedamount")).taxHeadCode(rs.getString("ad_taxheadcode")) - .demandDetailId(rs.getString("ad_demanddetailid")).build(); - - PGobject obj = (PGobject) rs.getObject("ad_additionalDetails"); - billAccDetail.setAdditionalDetails(getJsonValue(obj)); - - if (billDetail.getId().equals(billAccDetail.getBillDetailId())) - billDetail.addBillAccountDetail(billAccDetail); - - } - - return new ArrayList<>(billMap.values()); - } - - private JsonNode getJsonValue(PGobject pGobject) { - try { - if (Objects.isNull(pGobject) || Objects.isNull(pGobject.getValue())) - return null; - else - return mapper.readTree(pGobject.getValue()); - } catch (IOException e) { - throw new CustomException("SERVER_ERROR", - "Exception occurred while parsing the additionalDetail json : " + e.getMessage()); - } - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/CollectionConfigRowMapper.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/CollectionConfigRowMapper.java deleted file mode 100644 index 0787dd2eedf..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/CollectionConfigRowMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.egov.collection.repository.rowmapper; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; - -@Component -public class CollectionConfigRowMapper implements ResultSetExtractor>> { - - @Override - public Map> extractData(ResultSet rs) throws SQLException, DataAccessException { - Map> collectionConfigKeyValMap = new HashMap<>(); - - while (rs.next()) { - String collectionConfigKey = rs.getString("key"); - - if(!collectionConfigKeyValMap.containsKey(collectionConfigKey)) { - collectionConfigKeyValMap.put(collectionConfigKey, new ArrayList<>()); - } - - List lamsConfKeyVal = collectionConfigKeyValMap.get(collectionConfigKey); - lamsConfKeyVal.add(rs.getString("value")); - } - - return collectionConfigKeyValMap; - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/CollectionResultSetExtractor.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/CollectionResultSetExtractor.java deleted file mode 100644 index ddecaed8c60..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/CollectionResultSetExtractor.java +++ /dev/null @@ -1,198 +0,0 @@ -/*package org.egov.collection.repository.rowmapper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.model.*; -import org.egov.collection.model.enums.CollectionType; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.enums.Purpose; -import org.egov.collection.model.enums.ReceiptType; -import org.egov.collection.web.contract.*; -import org.egov.tracer.model.CustomException; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Service; - -import java.io.IOException; -import java.math.BigDecimal; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.*; - -@Service -public class CollectionResultSetExtractor implements ResultSetExtractor> { - - private ObjectMapper objectMapper; - - @Autowired - CollectionResultSetExtractor(ObjectMapper objectMapper){ - this.objectMapper = objectMapper; - } - - @Override - public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { - - Map receipts = new LinkedHashMap<>(); - - while(resultSet.next()){ - String receiptHeader = resultSet.getString("rh_id"); - Receipt receipt; - - if(!receipts.containsKey(receiptHeader)){ - BillDetail billDetail = BillDetail.builder() - .id(receiptHeader) - .billNumber(resultSet.getString("rh_referenceNumber")) - .billDate(resultSet.getLong("rh_referencedate")) - .consumerCode(resultSet.getString("rh_consumerCode")) - .consumerType(resultSet.getString("rh_consumerType")) - .collectionModesNotAllowed(resultSet.getString("rh_collModesNotAllwd") != null - ? Arrays.asList(resultSet.getString("rh_collModesNotAllwd").split("\\s*,\\s*")) - : Collections.emptyList()) - .tenantId(resultSet.getString("rh_tenantId")) - .businessService(resultSet.getString("rh_businessDetails")) - .receiptNumber(resultSet.getString("rh_receiptNumber")) - .receiptType(resultSet.getString("rh_receiptType")) - .channel(resultSet.getString("rh_channel")) - .voucherHeader(resultSet.getString("rh_voucherheader")) - .collectionType(!StringUtils.isEmpty(resultSet.getString("rh_collectionType")) - ? CollectionType.valueOf(resultSet.getString("rh_collectionType")) : null) - .boundary(resultSet.getString("rh_boundary")) - .reasonForCancellation(resultSet.getString("rh_reasonForCancellation")) - .status(resultSet.getString("rh_status")) - .receiptDate(resultSet.getLong("rh_receiptDate")) - .manualReceiptNumber(resultSet.getString("rh_manualReceiptNumber")) - .manualReceiptDate(resultSet.getLong("rh_manualreceiptdate")) - .fund(resultSet.getString("rh_fund")) - .function(resultSet.getString("rh_function")) - .department(resultSet.getString("rh_department")) - .demandId(resultSet.getString("rh_demandid")) - .fromPeriod(resultSet.getLong("rh_demandfromdate")) - .toPeriod(resultSet.getLong("rh_demandtodate")) - .amountPaid(BigDecimal.ZERO) - .totalAmount(getBigDecimalValue(resultSet.getBigDecimal("rh_totalAmount"))) - .collectedAmount(getBigDecimalValue(resultSet.getBigDecimal("rh_collectedamount"))) - .minimumAmount(getBigDecimalValue(resultSet.getBigDecimal("rh_minimumAmount"))) - .additionalDetails(getJsonValue((PGobject) resultSet.getObject("rh_additionalDetails"))) - .billAccountDetails(new ArrayList<>()) - .build(); - - Bill billInfo = Bill.builder() - .payerName(resultSet.getString("rh_payername")) - .payerAddress(resultSet.getString("rh_payerAddress")) - .payerEmail(resultSet.getString("rh_payerEmail")) - .mobileNumber(resultSet.getString("rh_payermobile")) - .paidBy(resultSet.getString("rh_paidBy")) - .tenantId(resultSet.getString("rh_tenantId")) - .billDetails(Collections.singletonList(billDetail)) - .build(); - - AuditDetails auditDetailsIns = AuditDetails.builder() - .createdBy(resultSet.getString("rh_createdBy")) - .createdDate(resultSet.getLong("rh_createdDate")) - .lastModifiedBy(resultSet.getString("rh_lastModifiedBy")) - .lastModifiedDate(resultSet.getLong("rh_lastModifiedDate")) - .build(); - - - - Instrument instrument = Instrument.builder() - .id(resultSet.getString("ins_instrumentheader")) - .amount(resultSet.getBigDecimal("ins_amount")) - .transactionDateInput(resultSet.getLong("ins_transactiondate")) - .transactionNumber(resultSet.getString("ins_transactionNumber")) - .instrumentType(InstrumentType.builder().name(resultSet.getString("ins_instrumenttype")) - .build()) - .instrumentStatus(InstrumentStatusEnum.valueOf(resultSet.getString("ins_instrumentstatus"))) - .ifscCode(resultSet.getString("ins_ifsccode")) - .bank(BankContract.builder().name(resultSet.getString("ins_bankid")).build()) - .transactionType(TransactionType.valueOf(resultSet.getString("ins_transactiontype"))) - .payee(resultSet.getString("ins_payee")) - .drawer(resultSet.getString("ins_drawer")) - .surrenderReason(SurrenderReason.builder().name(resultSet.getString("ins_surrenderreason")).build()) - .serialNo(resultSet.getString("ins_serialno")) - .additionalDetails(getJsonValue((PGobject) resultSet.getObject("ins_additionalDetails"))) - .auditDetails(auditDetailsIns) - .instrumentDate(resultSet.getLong("ins_instrumentDate")) - .instrumentNumber(resultSet.getString("ins_instrumentNumber")) - .tenantId(resultSet.getString("ins_tenantid")) - .build(); - - AuditDetails auditDetails = AuditDetails.builder() - .createdBy(resultSet.getString("rh_createdBy")) - .createdDate(resultSet.getLong("rh_createdDate")) - .lastModifiedBy(resultSet.getString("rh_lastModifiedBy")) - .lastModifiedDate(resultSet.getLong("rh_lastModifiedDate")) - .build(); - - receipt = Receipt.builder() - .tenantId(resultSet.getString("rh_tenantId")) - .bill(Collections.singletonList(billInfo)) - .receiptNumber(billDetail.getReceiptNumber()) - .consumerCode(billDetail.getConsumerCode()) - .receiptDate(billDetail.getReceiptDate()) - .transactionId(resultSet.getString("rh_transactionid")) - .instrument(instrument) - .auditDetails(auditDetails) - .build(); - - receipts.put(receiptHeader, receipt); - - } else { - receipt = receipts.get(receiptHeader); - } - - BillDetail billDetail = receipt.getBill().get(0).getBillDetails().get(0); - BillAccountDetail billAccountDetail = populateAccountDetail(resultSet, billDetail); - - - * adding paid amount only when data is not duplicate - - if (billDetail.addBillAccountDetail(billAccountDetail)) - billDetail.setAmountPaid(billDetail.getAmountPaid().add(billAccountDetail.getAdjustedAmount())); - } - - return new ArrayList<>(receipts.values()); - } - - private BillAccountDetail populateAccountDetail(ResultSet resultSet, BillDetail billDetail) throws SQLException, - DataAccessException{ - - - return BillAccountDetail.builder() - .id(resultSet.getString("rd_id")) - .isActualDemand((Boolean) resultSet.getObject("rd_isActualDemand")) - .tenantId(resultSet.getString("rd_tenantId")) - .billDetail(resultSet.getString("rh_id")) - .order(resultSet.getInt("rd_ordernumber")) - .purpose(!StringUtils.isEmpty(resultSet.getString("rd_purpose")) ? - Purpose.valueOf(resultSet.getString("rd_purpose")) : null) - .additionalDetails(getJsonValue((PGobject) resultSet.getObject("rd_additionalDetails"))) - .amount(getBigDecimalValue(resultSet.getBigDecimal("rd_amount"))) - .adjustedAmount(getBigDecimalValue(resultSet.getBigDecimal("rd_adjustedamount"))) - .taxHeadCode(resultSet.getString("rd_taxheadcode")) - .demandDetailId(resultSet.getString("rd_demanddetailid")) - .build(); - } - - private BigDecimal getBigDecimalValue(BigDecimal amount){ - return Objects.isNull(amount) ? BigDecimal.ZERO : amount; - } - - private JsonNode getJsonValue(PGobject pGobject){ - try { - if(Objects.isNull(pGobject) || Objects.isNull(pGobject.getValue())) - return null; - else - return objectMapper.readTree( pGobject.getValue()); - } catch (IOException e) { - throw new CustomException("SERVER_ERROR","Exception occurred while parsing the draft json : "+ e - .getMessage()); - } - } - -} -*/ \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/PaymentRowMapper.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/PaymentRowMapper.java deleted file mode 100644 index cc13b453930..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/PaymentRowMapper.java +++ /dev/null @@ -1,274 +0,0 @@ -package org.egov.collection.repository.rowmapper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.collection.model.AuditDetails; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.model.enums.CollectionType; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.enums.PaymentModeEnum; -import org.egov.collection.model.enums.PaymentStatusEnum; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.BillAccountDetail; -import org.egov.collection.web.contract.BillDetail; -import org.egov.tracer.model.CustomException; -import org.postgresql.util.PGobject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.io.IOException; -import java.math.BigDecimal; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.*; - -@Service -public class PaymentRowMapper implements ResultSetExtractor> { - - - @Autowired - private ObjectMapper mapper; - - @Override - public List extractData(ResultSet rs) throws SQLException, DataAccessException { - - - Map idToPaymentMap = new HashMap<>(); - - Payment currentPayment; - - while (rs.next()){ - - String id = rs.getString("py_id"); - - if(idToPaymentMap.get(id) != null) - currentPayment = idToPaymentMap.get(id); - else{ - - String tenantId = rs.getString("py_tenantId"); - BigDecimal totalDue = rs.getBigDecimal("totalDue"); - BigDecimal totalAmountPaid = rs.getBigDecimal("py_totalAmountPaid"); - String transactionNumber = rs.getString("transactionNumber"); - Long transactionDate = rs.getLong("transactionDate"); - String paymentMode = rs.getString("paymentMode"); - - Long instrumentDate = rs.getLong("instrumentDate"); - if(rs.wasNull()){instrumentDate = null;} - - String instrumentNumber = rs.getString("instrumentNumber"); - String instrumentStatus = rs.getString("instrumentStatus"); - String ifscCode = rs.getString("ifscCode"); - String paidBy = rs.getString("paidBy"); - String mobileNumber = rs.getString("mobileNumber"); - String payerName = rs.getString("payerName"); - String payerAddress = rs.getString("payerAddress"); - String payerEmail = rs.getString("payerEmail"); - String payerId = rs.getString("payerId"); - String paymentStatus = rs.getString("paymentStatus"); - String filesoreId = rs.getString("filestoreid"); - String createdBy = rs.getString("py_createdBy"); - - Long createdDate = rs.getLong("py_createdTime"); - if(rs.wasNull()){createdDate = null;} - - String lastModifiedBy = rs.getString("py_lastModifiedBy"); - - Long lastModifiedTime = rs.getLong("py_lastModifiedTime"); - if(rs.wasNull()){lastModifiedTime = null;} - - - AuditDetails auditDetails = AuditDetails.builder().createdBy(createdBy).createdTime(createdDate) - .lastModifiedBy(lastModifiedBy).lastModifiedTime(lastModifiedTime).build(); - - currentPayment = Payment.builder() - .id(id) - .tenantId(tenantId) - .totalDue(totalDue) - .totalAmountPaid(totalAmountPaid) - .transactionNumber(transactionNumber) - .transactionDate(transactionDate) - .paymentMode(PaymentModeEnum.fromValue(paymentMode)) - .instrumentDate(instrumentDate) - .instrumentNumber(instrumentNumber) - .instrumentStatus(InstrumentStatusEnum.fromValue(instrumentStatus)) - .ifscCode(ifscCode) - .paidBy(paidBy) - .mobileNumber(mobileNumber) - .payerName(payerName) - .payerAddress(payerAddress) - .payerEmail(payerEmail) - .payerId(payerId) - .paymentStatus(PaymentStatusEnum.fromValue(paymentStatus)) - .fileStoreId(filesoreId) - .auditDetails(auditDetails) - .build(); - - - PGobject obj = (PGobject) rs.getObject("py_additionalDetails"); - currentPayment.setAdditionalDetails(getJsonValue(obj)); - idToPaymentMap.put(currentPayment.getId(),currentPayment); - } - - addChildrenToPayment(rs,currentPayment); - - } - - return new ArrayList<>(idToPaymentMap.values()); - } - - - - - private void addChildrenToPayment(ResultSet rs, Payment payment) throws SQLException{ - - PaymentDetail paymentDetail = null; - - String paymentDetailId = rs.getString("pyd_id"); - - if(!CollectionUtils.isEmpty(payment.getPaymentDetails())){ - for(PaymentDetail detail : payment.getPaymentDetails()){ - if(detail.getId().equalsIgnoreCase(paymentDetailId)){ - paymentDetail = detail; - break; - } - } - } - - if(paymentDetail == null){ - - String id = rs.getString("pyd_id"); - String tenantId = rs.getString("pyd_tenantId"); - BigDecimal due = rs.getBigDecimal("due"); - BigDecimal amountPaid = rs.getBigDecimal("amountPaid"); - String receiptNumber = rs.getString("receiptNumber"); - Long receiptDate = rs.getLong("receiptdate"); - String receiptType = rs.getString("receipttype"); - String businessService = rs.getString("businessService"); - String manualReceiptNo = rs.getString("manualreceiptnumber"); - Long manualReceiptDate = rs.getLong("manualreceiptdate"); - String billId = rs.getString("billId"); - PGobject obj = (PGobject) rs.getObject("pyd_additionalDetails"); - String createdBy = rs.getString("pyd_createdBy"); - Long createdTime = rs.getLong("pyd_createdTime"); - String lastModifiedBy = rs.getString("pyd_lastModifiedBy"); - Long lastModifiedTime = rs.getLong("pyd_lastModifiedTime"); - - AuditDetails auditDetails = AuditDetails.builder().createdBy(createdBy).createdTime(createdTime) - .lastModifiedBy(lastModifiedBy).lastModifiedTime(lastModifiedTime).build(); - - paymentDetail = PaymentDetail.builder() - .id(id) - .tenantId(tenantId) - .totalDue(due) - .totalAmountPaid(amountPaid) - .receiptNumber(receiptNumber) - .businessService(businessService) - .billId(billId) - .receiptDate(receiptDate) - .manualReceiptDate(manualReceiptDate) - .manualReceiptNumber(manualReceiptNo) - .receiptType(receiptType) - .additionalDetails(getJsonValue(obj)) - - .auditDetails(auditDetails) - .build(); - - /*Long billDate = rs.getLong("billdate"); - if(rs.wasNull()){billDate = null;} - - AuditDetails billAuditDetails = AuditDetails.builder().createdBy(rs.getString("bill_createdby")) - .createdTime(rs.getLong("bill_createdTime")) - .lastModifiedBy("bill_lastmodifiedby") - .lastModifiedTime(rs.getLong("bill_lastModifiedTime")) - .build();*/ - - /*List collectionModesAllowedList = new LinkedList<>(); - if(null != rs.getString("collectionmodesnotallowed")) { - String[] collectionModesAllowed = rs.getString("collectionmodesnotallowed").split(","); - if(collectionModesAllowed.length!=0) - collectionModesAllowedList = Arrays.asList(collectionModesAllowed); - }*/ - - // PGobject billAdditionalObj = (PGobject) rs.getObject("bill_additionalDetails"); - - - - - payment.addpaymentDetailsItem(paymentDetail); - } - - /*PGobject billAccountDetailAdditionalObj = (PGobject) rs.getObject("bacdt_additionalDetails"); - - Integer order = rs.getInt("order"); - if(rs.wasNull()){order = null;} - - BillAccountDetail billAccountDetail = BillAccountDetail.builder() - .id(rs.getString("bacdt_id")) - .tenantId(rs.getString("bacdt_tenantid")) - .billDetailId(rs.getString("billdetailid")) - .demandDetailId(rs.getString("demanddetailid")) - .order(order) - .isActualDemand(rs.getBoolean("isactualdemand")) - .taxHeadCode(rs.getString("taxheadcode")) - .amount(rs.getBigDecimal("bacdt_amount")) - .adjustedAmount(rs.getBigDecimal("bacdt_adjustedamount")) - .additionalDetails(getJsonValue(billAccountDetailAdditionalObj)) - .build(); - - - PGobject billDetailAdditionalObj = (PGobject) rs.getObject("bd_additionalDetails"); - - BillDetail billDetail = BillDetail.builder() - .id(rs.getString("bd_id")) - .tenantId(rs.getString("bd_tenantid")) - .demandId(rs.getString("demandid")) - .billId(rs.getString("billid")) - .amount(rs.getBigDecimal("amount")) - .amountPaid(rs.getBigDecimal("amountpaid")) - .fromPeriod(rs.getLong("fromperiod")) - .toPeriod(rs.getLong("toperiod")) - .additionalDetails(getJsonValue(billDetailAdditionalObj)) - .channel(rs.getString("channel")) - .voucherHeader(rs.getString("voucherheader")) - .boundary(rs.getString("boundary")) - .manualReceiptNumber(rs.getString("manualreceiptnumber")) - .manualReceiptDate(rs.getLong("manualreceiptdate")) - .collectionType(CollectionType.fromValue(rs.getString("collectiontype"))) - .billDescription(rs.getString("billdescription")) - .expiryDate(rs.getLong("expirydate")) - .displayMessage(rs.getString("displaymessage")) - .callBackForApportioning(rs.getBoolean("callbackforapportioning")) - .cancellationRemarks(rs.getString("cancellationremarks")) - .build(); - - // Adding to Bill - billDetail.addBillAccountDetail(billAccountDetail); - paymentDetail.getBill().addBillDetail(billDetail);*/ - - - } - - - private JsonNode getJsonValue(PGobject pGobject){ - try { - if(Objects.isNull(pGobject) || Objects.isNull(pGobject.getValue())) - return null; - else - return mapper.readTree( pGobject.getValue()); - } catch (IOException e) { - throw new CustomException("SERVER_ERROR","Exception occurred while parsing the additionalDetail json : "+ e - .getMessage()); - } - } - - - - - - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/RemittanceResultSetExtractor.java b/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/RemittanceResultSetExtractor.java deleted file mode 100644 index 89e47e61b25..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/repository/rowmapper/RemittanceResultSetExtractor.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.egov.collection.repository.rowmapper; - -import java.math.BigDecimal; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -import org.egov.collection.model.AuditDetails; -import org.egov.collection.web.contract.Remittance; -import org.egov.collection.web.contract.RemittanceDetail; -import org.egov.collection.web.contract.RemittanceInstrument; -import org.egov.collection.web.contract.RemittanceReceipt; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Service; - -@Service -public class RemittanceResultSetExtractor implements ResultSetExtractor> { - - @Override - public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { - - Map remittances = new LinkedHashMap<>(); - - while (resultSet.next()) { - String id = resultSet.getString("rem_id"); - Remittance remittance; - Set remittanceDetails; - Set remittanceInstruments; - Set remittanceReceipts; - if (!remittances.containsKey(id)) { - - AuditDetails auditDetails = AuditDetails.builder() - .createdBy(resultSet.getString("rem_createdBy")) - .createdTime(resultSet.getLong("rem_createdDate")) - .lastModifiedBy(resultSet.getString("rem_lastModifiedBy")) - .lastModifiedTime(resultSet.getLong("rem_lastModifiedDate")) - .build(); - - BigDecimal creditAmount = getBigDecimalValue(resultSet.getBigDecimal("remDet_creditAmount")); - BigDecimal debitAmount = getBigDecimalValue(resultSet.getBigDecimal("remDet_debitAmount")); - - RemittanceDetail details = RemittanceDetail.builder().chartOfAccount(resultSet.getString("remDet_chartOfAccount")) - .remittance(resultSet.getString("remDet_remittance")) - .creditAmount(creditAmount).debitAmount(debitAmount).id(resultSet.getString("remDet_id")) - .tenantId(resultSet.getString("remDet_tenantId")).build(); - - RemittanceInstrument instrument = RemittanceInstrument.builder() - .instrument(resultSet.getString("remIsm_instrument")) - .remittance(resultSet.getString("remIsm_remittance")) - .id(resultSet.getString("remIsm_id")) - .reconciled(resultSet.getBoolean("remIsm_reconciled")) - .tenantId(resultSet.getString("remIsm_tenantId")).build(); - - RemittanceReceipt receipt = RemittanceReceipt.builder() - .receipt(resultSet.getString("remRec_receipt")) - .remittance(resultSet.getString("remRec_remittance")) - .id(resultSet.getString("remRec_id")) - .tenantId(resultSet.getString("remRec_tenantId")).build(); - - remittance = Remittance.builder().bankaccount(resultSet.getString("rem_bankaccount")) - .function(resultSet.getString("rem_function")).fund(resultSet.getString("rem_fund")) - .id(resultSet.getString("rem_id")).reasonForDelay(resultSet.getString("rem_reasonForDelay")) - .referenceDate(resultSet.getLong("rem_referenceDate")) - .referenceNumber(resultSet.getString("rem_referenceNumber")).remarks(resultSet.getString("rem_remarks")) - .status(resultSet.getString("rem_status")).tenantId(resultSet.getString("rem_tenantId")) - .voucherHeader(resultSet.getString("rem_voucherHeader")).auditDetails(auditDetails) - .remittanceDetails(Collections.singleton(details)) - .remittanceInstruments(Collections.singleton(instrument)) - .remittanceReceipts(Collections.singleton(receipt)).build(); - - remittances.put(id, remittance); - - } else { - remittance = remittances.get(id); - - BigDecimal creditAmount = getBigDecimalValue(resultSet.getBigDecimal("remDet_creditAmount")); - BigDecimal debitAmount = getBigDecimalValue(resultSet.getBigDecimal("remDet_debitAmount")); - RemittanceDetail details = RemittanceDetail.builder().chartOfAccount(resultSet.getString("remDet_chartOfAccount")) - .remittance(resultSet.getString("remDet_remittance")) - .creditAmount(creditAmount).debitAmount(debitAmount).id(resultSet.getString("remDet_id")) - .tenantId(resultSet.getString("remDet_tenantId")).build(); - remittanceDetails = new HashSet<>(remittance.getRemittanceDetails()); - remittanceDetails.add(details); - remittance.setRemittanceDetails(remittanceDetails); - - RemittanceInstrument instrument = RemittanceInstrument.builder() - .instrument(resultSet.getString("remIsm_instrument")) - .remittance(resultSet.getString("remIsm_remittance")) - .id(resultSet.getString("remIsm_id")) - .reconciled(resultSet.getBoolean("remIsm_reconciled")) - .tenantId(resultSet.getString("remIsm_tenantId")).build(); - - remittanceInstruments = new HashSet<>(remittance.getRemittanceInstruments()); - remittanceInstruments.add(instrument); - remittance.setRemittanceInstruments(remittanceInstruments); - - RemittanceReceipt receipt = RemittanceReceipt.builder() - .receipt(resultSet.getString("remRec_receipt")) - .remittance(resultSet.getString("remRec_remittance")) - .id(resultSet.getString("remRec_id")) - .tenantId(resultSet.getString("remRec_tenantId")).build(); - - remittanceReceipts = new HashSet<>(remittance.getRemittanceReceipts()); - remittanceReceipts.add(receipt); - remittance.setRemittanceReceipts(remittanceReceipts); - } - - } - - return new ArrayList<>(remittances.values()); - } - - private BigDecimal getBigDecimalValue(BigDecimal amount) { - return Objects.isNull(amount) ? BigDecimal.ZERO : amount; - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/ApportionerService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/ApportionerService.java deleted file mode 100644 index 2744d2b173b..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/ApportionerService.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.egov.collection.service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.web.contract.ApportionRequest; -import org.egov.collection.web.contract.ApportionResponse; -import org.egov.collection.web.contract.Bill; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.web.client.RestTemplate; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class ApportionerService { - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - private RestTemplate restTemplate; - - /** - * Makes a call to apportion service and gets all the bills apportioned. - * - * @param paymentRequest - * @return - */ - public Map apportionBill(PaymentRequest paymentRequest) { - - RequestInfo requestInfo = paymentRequest.getRequestInfo(); - Payment payment = paymentRequest.getPayment(); - List bills = payment.getPaymentDetails().stream().map(PaymentDetail::getBill).collect(Collectors.toList()); - StringBuilder uri = new StringBuilder(); - uri.append(applicationProperties.getApportionHost()).append(applicationProperties.getApportionURI()); - ApportionRequest apportionRequest = ApportionRequest.builder().bills(bills).tenantId(payment.getTenantId()) - .requestInfo(requestInfo).build(); - ApportionResponse apportionResponse; - try { - apportionResponse = restTemplate.postForObject(uri.toString(), apportionRequest,ApportionResponse.class); - if (null != apportionResponse) { - if(CollectionUtils.isEmpty(apportionResponse.getBills())) - throw new CustomException("APPORTIONING_FAILED_CODE", "Apportioning of the bill Failed"); - }else - throw new CustomException("APPORTIONING_FAILED_CODE", "Apportioning of the bill Failed"); - } catch (Exception e) { - log.error("Error while apportioning the bill: ", e); - throw new CustomException("APPORTIONING_FAILED_CODE", "Apportioning of the bill Failed"); - } - - Map billIdToBillMap = apportionResponse.getBills().stream().collect(Collectors.toMap(Bill::getId, Function.identity())); - - return billIdToBillMap; - } - - - /** - * Method to segregate bills based on the tenantid, as apportioning service takes bills of one tenant at a time. - * - * @param bills - * @return - */ - public Map> seggregateBillOnTenantId(List bills) { - Map> seggregatedBills = new HashMap<>(); - bills.forEach(bill -> { - List billsBelongingtoATenant = new ArrayList<>(); - if (null != seggregatedBills.get(bill.getTenantId())) - billsBelongingtoATenant = seggregatedBills.get(bill.getTenantId()); - billsBelongingtoATenant.add(bill); - seggregatedBills.put(bill.getTenantId(), billsBelongingtoATenant); - }); - - return seggregatedBills; - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/BankAccountMappingService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/BankAccountMappingService.java deleted file mode 100644 index 35a8776b782..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/BankAccountMappingService.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.service; - -import java.util.List; - -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.BankAccountServiceMapping; -import org.egov.collection.model.BankAccountServiceMappingSearchCriteria; -import org.egov.collection.repository.BankAccountMappingRepository; -import org.egov.collection.web.contract.BankAccountServiceMappingReq; -import org.egov.tracer.kafka.LogAwareKafkaTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class BankAccountMappingService { - - private BankAccountMappingRepository bankAccountMappingRepository; - - private LogAwareKafkaTemplate kafkaTemplate; - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - public BankAccountMappingService(BankAccountMappingRepository bankAccountMappingRepository, - LogAwareKafkaTemplate kafkaTemplate) { - - this.bankAccountMappingRepository = bankAccountMappingRepository; - this.kafkaTemplate = kafkaTemplate; - - } - - public List createBankAccountToServiceMapping( - List bankServiceMappings) { - bankAccountMappingRepository.persistBankAccountServiceMapping(bankServiceMappings); - return bankServiceMappings; - } - - public BankAccountServiceMappingReq createBankAccountServiceMappingAsync( - final BankAccountServiceMappingReq bankAccountServiceMappingReq) { - kafkaTemplate.send(applicationProperties.getCreateBankAccountServiceMappingTopicName(), bankAccountServiceMappingReq); - return bankAccountServiceMappingReq; - } - - public List searchBankAccountService( - final BankAccountServiceMappingSearchCriteria searchcriteria) { - return bankAccountMappingRepository.searchBankAccountServicemapping(searchcriteria); - - } - - public List searchBankAccountsMappedToServices(final String tenantId) { - return bankAccountMappingRepository.searchBankAccountBranches(tenantId); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/CollectionService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/CollectionService.java deleted file mode 100644 index 715047dc78b..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/CollectionService.java +++ /dev/null @@ -1,248 +0,0 @@ -/* -package org.egov.collection.service; - -import static java.util.Objects.isNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.model.ReceiptSearchCriteria; -import org.egov.collection.producer.CollectionProducer; -import org.egov.collection.repository.BillingServiceRepository; -import org.egov.collection.repository.CollectionRepository; -import org.egov.collection.repository.InstrumentRepository; -import org.egov.collection.util.ReceiptEnricher; -import org.egov.collection.util.ReceiptValidator; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.Receipt; -import org.egov.collection.web.contract.ReceiptReq; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class CollectionService { - - private CollectionRepository collectionRepository; - private InstrumentRepository instrumentRepository; - private BillingServiceRepository billingServiceRepository; - private ReceiptEnricher receiptEnricher; - private ReceiptValidator receiptValidator; - private CollectionProducer collectionProducer; - private ApplicationProperties applicationProperties; - - @Autowired - private ApportionerService apportionerService; - - @Autowired - private UserService userService; - - @Autowired - public CollectionService(CollectionRepository collectionRepository, InstrumentRepository instrumentRepository, - BillingServiceRepository billingServiceRepository, ReceiptEnricher receiptEnricher, - ReceiptValidator receiptValidator, CollectionProducer collectionProducer, - ApplicationProperties applicationProperties) { - this.collectionRepository = collectionRepository; - this.instrumentRepository = instrumentRepository; - this.billingServiceRepository = billingServiceRepository; - this.receiptEnricher = receiptEnricher; - this.receiptValidator = receiptValidator; - this.collectionProducer = collectionProducer; - this.applicationProperties = applicationProperties; - } - - */ -/** - * Fetch all receipts matching the given criteria, enrich receipts with instruments - * - * @param requestInfo Request info of the search - * @param receiptSearchCriteria Criteria against which search has to be performed - * @return List of matching receipts - *//* - - public List getReceipts(RequestInfo requestInfo, ReceiptSearchCriteria receiptSearchCriteria) { - ReceiptReq receiptReq = ReceiptReq.builder().requestInfo(requestInfo).build(); - Map errorMap = new HashMap<>(); - receiptValidator.validateUserInfo(receiptReq, errorMap); - if (!errorMap.isEmpty()) - throw new CustomException(errorMap); - - if (applicationProperties.isReceiptsSearchPaginationEnabled()) { - receiptSearchCriteria.setOffset(isNull(receiptSearchCriteria.getOffset()) ? 0 : receiptSearchCriteria.getOffset()); - receiptSearchCriteria.setLimit(isNull(receiptSearchCriteria.getLimit()) ? applicationProperties.getReceiptsSearchDefaultLimit() : - receiptSearchCriteria.getLimit()); - } else { - receiptSearchCriteria.setOffset(0); - receiptSearchCriteria.setLimit(applicationProperties.getReceiptsSearchDefaultLimit()); - } - if(requestInfo.getUserInfo().getType().equals("CITIZEN")) { - List payerIds = new ArrayList<>(); - payerIds.add(requestInfo.getUserInfo().getUuid()); - receiptSearchCriteria.setPayerIds(payerIds); - } - List receipts = collectionRepository.fetchReceipts(receiptSearchCriteria); - - return receipts; - } - - */ -/** - * Handles creation of a receipt, including multi-service, involves the following steps, - Enrich receipt from billing service - * using bill id - Validate the receipt object - Enrich receipt with receipt numbers, coll type etc - Apportion paid amount - - * Persist the receipt object - Create instrument - * - * @param receiptReq Receipt request for which receipt has to be created - * @return Created receipt - *//* - - @Transactional - public Receipt createReceipt(ReceiptReq receiptReq) { - receiptEnricher.enrichReceiptPreValidate(receiptReq); - receiptValidator.validateReceiptForCreate(receiptReq); - receiptEnricher.enrichReceiptPostValidate(receiptReq); - - Receipt receipt = receiptReq.getReceipt().get(0); // Why get(0)? - Bill bill = receipt.getBill().get(0); // Why get(0)? - List bills = new ArrayList<>(); - bills.add(bill); - Map> apportionedBills = apportionerService.apportionBill(receiptReq.getRequestInfo(), bills); - receiptEnricher.enrichAdvanceTaxHead(apportionedBills); - bill = apportionedBills.get(bill.getTenantId()).get(0); //Will be changed if get(0) is removed from the top 2 lines - String payerId = createUser(receiptReq); - if(!StringUtils.isEmpty(payerId)) - bill.setPayerId(payerId); - receipt.getBill().set(0, bill); - collectionRepository.saveReceipt(receipt); - - collectionProducer.producer(applicationProperties.getCreateReceiptTopicName(), applicationProperties - .getCreateReceiptTopicKey(), receiptReq); - - //Pushing for notification to the user on payment - collectionProducer.producer(applicationProperties.getPaymentReceiptLinkTopic(), applicationProperties - .getPaymentReceiptLinkTopicKey(), receiptReq); - - return receipt; - } - - */ -/** - * Handles creation of a receipt, including multi-service, involves the following steps, - Enrich receipt from billing service - * using bill id - Validate the receipt object - Enrich receipt with receipt numbers, coll type etc - Apportion paid amount - - * Persist the receipt object - Create instrument - * - * @param receiptReq Receipt request for which receipt has to be created - * @return Created receipt - *//* - - @Transactional - public Receipt createPayment(PaymentRequest paymentRequest) { - receiptEnricher.enrichPaymentPreValidate(paymentRequest); - receiptValidator.validateReceiptForCreate(receiptReq); - receiptEnricher.enrichReceiptPostValidate(receiptReq); - - Receipt receipt = receiptReq.getReceipt().get(0); // Why get(0)? - Bill bill = receipt.getBill().get(0); // Why get(0)? - List bills = new ArrayList<>(); - bills.add(bill); - Map> apportionedBills = apportionerService.apportionBill(receiptReq.getRequestInfo(), bills); - receiptEnricher.enrichAdvanceTaxHead(apportionedBills); - bill = apportionedBills.get(bill.getTenantId()).get(0); //Will be changed if get(0) is removed from the top 2 lines - String payerId = createUser(receiptReq); - if(!StringUtils.isEmpty(payerId)) - bill.setPayerId(payerId); - receipt.getBill().set(0, bill); - collectionRepository.saveReceipt(receipt); - - collectionProducer.producer(applicationProperties.getCreateReceiptTopicName(), applicationProperties - .getCreateReceiptTopicKey(), receiptReq); - - //Pushing for notification to the user on payment - collectionProducer.producer(applicationProperties.getPaymentReceiptLinkTopic(), applicationProperties - .getPaymentReceiptLinkTopicKey(), receiptReq); - - return receipt; - } - - - */ -/** - * If the receipt is being generated by - - * employee: the user to whom the bill belongs to will be created in the sytem. and id is attached to the receipt. - * citizen: id of the citizen is attached to the receipt. - * - * @param receiptReq - * @return - *//* - - public String createUser(ReceiptReq receiptReq) { - String id = null; - if(receiptReq.getRequestInfo().getUserInfo().getType().equals("CITIZEN")) { - id = receiptReq.getRequestInfo().getUserInfo().getUuid(); - }else { - if(applicationProperties.getIsUserCreateEnabled()) { - Receipt receipt = receiptReq.getReceipt().get(0); - Bill bill = receipt.getBill().get(0); - Map res = userService.getUser(receiptReq.getRequestInfo(), bill.getMobileNumber(), bill.getTenantId()); - if(CollectionUtils.isEmpty(res.keySet())) { - id = userService.createUser(receiptReq.getRequestInfo(), bill); - }else { - id = res.get("id"); - } - } - } - return id; - } - - */ -/** - * Performs update of eligible receipts - * Allows update of payee details, manual receipt number & date, additionalDetails - *

- * - If validated, update receipts as per the request - * else, throws exception and exit - * - * @param receiptReq receipts to be updated - * @return updated receipts - *//* - - @Transactional - public List updateReceipt(ReceiptReq receiptReq) { - - List validatedReceipts = receiptValidator.validateAndEnrichReceiptsForUpdate(receiptReq.getReceipt(), - receiptReq.getRequestInfo()); - - collectionRepository.updateReceipt(validatedReceipts); - collectionProducer.producer(applicationProperties.getUpdateReceiptTopicName(), applicationProperties - .getUpdateReceiptTopicKey(), new ReceiptReq(receiptReq.getRequestInfo(), validatedReceipts)); - - return validatedReceipts; - } - - */ -/** - * Validates a provisional receipt, - Enriches receipt from billing service using bill id - Validates the receipt object - * - * @param receiptReq Receipt request for which receipt has to be validated - * @return Validated receipt - *//* - - public List validateReceipt(ReceiptReq receiptReq) { - receiptEnricher.enrichReceiptPreValidate(receiptReq); - receiptValidator.validateReceiptForCreate(receiptReq); - - return receiptReq.getReceipt(); - } - -} -*/ diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/MDMSService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/MDMSService.java deleted file mode 100644 index fdde4eaceb8..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/MDMSService.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.egov.collection.service; - -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.repository.ServiceRequestRepository; -import org.egov.common.contract.request.RequestInfo; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.ModuleDetail; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.egov.collection.config.CollectionServiceConstants.BILLING_MASTER_CODE; -import static org.egov.collection.config.CollectionServiceConstants.BILLING_MODULE_NAME; - -@Service -public class MDMSService { - - - private ApplicationProperties applicationProperties; - - private ServiceRequestRepository serviceRequestRepository; - - - @Autowired - public MDMSService(ApplicationProperties applicationProperties, ServiceRequestRepository serviceRequestRepository) { - this.applicationProperties = applicationProperties; - this.serviceRequestRepository = serviceRequestRepository; - } - - public Object mDMSCall(RequestInfo requestInfo, String tenantId){ - MdmsCriteriaReq mdmsCriteriaReq = getMDMSRequest(requestInfo,tenantId); - StringBuilder url = getMdmsSearchUrl(); - Object result = serviceRequestRepository.fetchResult(url,mdmsCriteriaReq); - return result; - } - - - /** - * Creates MDMS request - * @param requestInfo The RequestInfo of the Payment - * @param tenantId The tenantId of the Payment - * @return MDMSCriteria Request - */ - private MdmsCriteriaReq getMDMSRequest(RequestInfo requestInfo, String tenantId) { - - // master details for Collection module - List billingMasterDetails = new ArrayList<>(); - - billingMasterDetails.add(MasterDetail.builder().name(BILLING_MASTER_CODE).build()); - - ModuleDetail billingModuleDtls = ModuleDetail.builder().masterDetails(billingMasterDetails) - .moduleName(BILLING_MODULE_NAME).build(); - - List moduleDetails = new ArrayList<>(); - moduleDetails.add(billingModuleDtls); - - MdmsCriteria mdmsCriteria = MdmsCriteria.builder().moduleDetails(moduleDetails).tenantId(tenantId) - .build(); - - return MdmsCriteriaReq.builder().requestInfo(requestInfo).mdmsCriteria(mdmsCriteria).build(); - } - - - /** - * Creates and returns the url for mdms search endpoint - * - * @return MDMS Search URL - */ - private StringBuilder getMdmsSearchUrl() { - return new StringBuilder().append(applicationProperties.getMdmsHost()).append(applicationProperties.getMdmsSearchEndpoint()); - } - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/PaymentService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/PaymentService.java deleted file mode 100644 index 0953c330262..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/PaymentService.java +++ /dev/null @@ -1,220 +0,0 @@ -package org.egov.collection.service; - -import static java.util.Objects.isNull; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.model.PaymentSearchCriteria; -import org.egov.collection.producer.CollectionProducer; -import org.egov.collection.repository.PaymentRepository; -import org.egov.collection.util.PaymentEnricher; -import org.egov.collection.util.PaymentValidator; -import org.egov.collection.web.contract.Bill; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; - - -@Service -public class PaymentService { - - private ApportionerService apportionerService; - - private PaymentEnricher paymentEnricher; - - private ApplicationProperties applicationProperties; - - private UserService userService; - - private PaymentValidator paymentValidator; - - private PaymentRepository paymentRepository; - - private CollectionProducer producer; - - - @Autowired - public PaymentService(ApportionerService apportionerService, PaymentEnricher paymentEnricher, ApplicationProperties applicationProperties, - UserService userService, PaymentValidator paymentValidator, PaymentRepository paymentRepository, CollectionProducer producer) { - this.apportionerService = apportionerService; - this.paymentEnricher = paymentEnricher; - this.applicationProperties = applicationProperties; - this.userService = userService; - this.paymentValidator = paymentValidator; - this.paymentRepository = paymentRepository; - this.producer = producer; - } - - - - /** - * Fetch all receipts matching the given criteria, enrich receipts with instruments - * - * @param requestInfo Request info of the search - * @param paymentSearchCriteria Criteria against which search has to be performed - * @return List of matching receipts - */ - public List getPayments(RequestInfo requestInfo, PaymentSearchCriteria paymentSearchCriteria, String moduleName) { - - paymentValidator.validateAndUpdateSearchRequestFromConfig(paymentSearchCriteria, requestInfo, moduleName); - if (applicationProperties.isPaymentsSearchPaginationEnabled()) { - paymentSearchCriteria.setOffset(isNull(paymentSearchCriteria.getOffset()) ? 0 : paymentSearchCriteria.getOffset()); - paymentSearchCriteria.setLimit(isNull(paymentSearchCriteria.getLimit()) ? applicationProperties.getReceiptsSearchDefaultLimit() : - paymentSearchCriteria.getLimit()); - } else { - paymentSearchCriteria.setOffset(0); - paymentSearchCriteria.setLimit(applicationProperties.getReceiptsSearchDefaultLimit()); - } - /*if(requestInfo.getUserInfo().getType().equals("CITIZEN")) { - List payerIds = new ArrayList<>(); - payerIds.add(requestInfo.getUserInfo().getUuid()); - paymentSearchCriteria.setPayerIds(payerIds); - }*/ - List payments = paymentRepository.fetchPayments(paymentSearchCriteria); - - return payments; - } - - public Long getpaymentcountForBusiness (String tenantId, String businessService) { - - return paymentRepository.getPaymentsCount(tenantId, businessService); - } - - - - - /** - * Handles creation of a receipt, including multi-service, involves the following steps, - Enrich receipt from billing service - * using bill id - Validate the receipt object - Enrich receipt with receipt numbers, coll type etc - Apportion paid amount - - * Persist the receipt object - Create instrument - * - * @param paymentRequest payment request for which receipt has to be created - * @return Created receipt - */ - @Transactional - public Payment createPayment(PaymentRequest paymentRequest) { - - paymentEnricher.enrichPaymentPreValidate(paymentRequest); - paymentValidator.validatePaymentForCreate(paymentRequest); - paymentEnricher.enrichPaymentPostValidate(paymentRequest); - - Payment payment = paymentRequest.getPayment(); - Map billIdToApportionedBill = apportionerService.apportionBill(paymentRequest); - paymentEnricher.enrichAdvanceTaxHead(new LinkedList<>(billIdToApportionedBill.values())); - setApportionedBillsToPayment(billIdToApportionedBill,payment); - - String payerId = createUser(paymentRequest); - if(!StringUtils.isEmpty(payerId)) - payment.setPayerId(payerId); - paymentRepository.savePayment(payment); - - producer.push(paymentRequest.getPayment().getTenantId(),applicationProperties.getCreatePaymentTopicName(), paymentRequest); - - - return payment; - } - - - /** - * If Citizen is paying, the id of the logged in user becomes payer id. - * If Employee is paying, - * 1. the id of the owner of the bill will be attached as payer id. - * 2. In case the bill is for a misc payment, payer id is empty. - * - * @param paymentRequest - * @return - */ - public String createUser(PaymentRequest paymentRequest) { - - String id = null; - if(paymentRequest.getRequestInfo().getUserInfo().getType().equals("CITIZEN")) { - id = paymentRequest.getRequestInfo().getUserInfo().getUuid(); - }else { - if(applicationProperties.getIsUserCreateEnabled()) { - Payment payment = paymentRequest.getPayment(); - Map res = userService.getUser(paymentRequest.getRequestInfo(), payment.getMobileNumber(), payment.getTenantId()); - if(CollectionUtils.isEmpty(res.keySet())) { - id = userService.createUser(paymentRequest); - }else { - id = res.get("id"); - } - } - } - return id; - } - - - private void setApportionedBillsToPayment(Map billIdToApportionedBill,Payment payment){ - Map errorMap = new HashMap<>(); - payment.getPaymentDetails().forEach(paymentDetail -> { - if(billIdToApportionedBill.get(paymentDetail.getBillId())!=null) - paymentDetail.setBill(billIdToApportionedBill.get(paymentDetail.getBillId())); - else errorMap.put("APPORTIONING_ERROR","The bill id: "+paymentDetail.getBillId()+" not present in apportion response"); - }); - if(!errorMap.isEmpty()) - throw new CustomException(errorMap); - } - - - @Transactional - public List updatePayment(PaymentRequest paymentRequest) { - - List validatedPayments = paymentValidator.validateAndEnrichPaymentsForUpdate(Collections.singletonList(paymentRequest.getPayment()), - paymentRequest.getRequestInfo()); - - paymentRepository.updatePayment(validatedPayments); - producer.push(paymentRequest.getPayment().getTenantId(), applicationProperties.getUpdatePaymentTopicName(), - new PaymentRequest(paymentRequest.getRequestInfo(), paymentRequest.getPayment())); - - return validatedPayments; - } - - - - /** - * Used by payment gateway to validate provisional receipts of the payment - * - * @param paymentRequest - * @return - */ - @Transactional - public Payment vaidateProvisonalPayment(PaymentRequest paymentRequest) { - paymentEnricher.enrichPaymentPreValidate(paymentRequest); - paymentValidator.validatePaymentForCreate(paymentRequest); - - return paymentRequest.getPayment(); - } - - public List plainSearch(PaymentSearchCriteria paymentSearchCriteria) { - PaymentSearchCriteria searchCriteria = new PaymentSearchCriteria(); - - if (applicationProperties.isPaymentsSearchPaginationEnabled()) { - searchCriteria.setOffset(isNull(paymentSearchCriteria.getOffset()) ? 0 : paymentSearchCriteria.getOffset()); - searchCriteria.setLimit(isNull(paymentSearchCriteria.getLimit()) ? applicationProperties.getReceiptsSearchDefaultLimit() : paymentSearchCriteria.getLimit()); - } else { - searchCriteria.setOffset(0); - searchCriteria.setLimit(applicationProperties.getReceiptsSearchDefaultLimit()); - } - - List ids = paymentRepository.fetchPaymentIds(searchCriteria); - if (ids.isEmpty()) - return Collections.emptyList(); - - PaymentSearchCriteria criteria = PaymentSearchCriteria.builder().ids(new HashSet(ids)).build(); - return paymentRepository.fetchPaymentsForPlainSearch(criteria); - } - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/PaymentWorkflowService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/PaymentWorkflowService.java deleted file mode 100644 index 668539fbc34..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/PaymentWorkflowService.java +++ /dev/null @@ -1,332 +0,0 @@ -package org.egov.collection.service; - - -import static java.util.Collections.reverseOrder; -import static java.util.Collections.singleton; -import static org.egov.collection.config.CollectionServiceConstants.KEY_FILESTOREID; -import static org.egov.collection.config.CollectionServiceConstants.KEY_ID; -import static org.egov.collection.util.Utils.jsonMerge; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.model.PaymentSearchCriteria; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.enums.PaymentModeEnum; -import org.egov.collection.model.enums.PaymentStatusEnum; -import org.egov.collection.producer.CollectionProducer; -import org.egov.collection.repository.PaymentRepository; -import org.egov.collection.util.PaymentWorkflowValidator; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.PaymentWorkflow; -import org.egov.collection.web.contract.PaymentWorkflowRequest; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.databind.JsonNode; -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class PaymentWorkflowService { - - - - private PaymentRepository paymentRepository; - private PaymentWorkflowValidator paymentWorkflowValidator; - private CollectionProducer collectionProducer; - private ApplicationProperties applicationProperties; - - @Autowired - RestTemplate restTemplate; - - @Autowired - public PaymentWorkflowService(PaymentRepository paymentRepository, PaymentWorkflowValidator - paymentWorkflowValidator, CollectionProducer collectionProducer, ApplicationProperties applicationProperties) { - this.paymentRepository = paymentRepository; - this.paymentWorkflowValidator = paymentWorkflowValidator; - this.collectionProducer = collectionProducer; - this.applicationProperties = applicationProperties; - - } - - /** - * Processes all workflow related requests - * - Verify that all workflow actions in the request are same - * - Handover processing of actions to sub methods - * - Persist the updated receipts - * - * @param paymentWorkflowRequest multiple actions - * @return updated receipts - */ - @Transactional - public List performWorkflow(PaymentWorkflowRequest paymentWorkflowRequest){ - - // Basic validations - - PaymentWorkflow.PaymentAction action = paymentWorkflowRequest.getPaymentWorkflows().get(0).getAction(); - String tenantId = paymentWorkflowRequest.getPaymentWorkflows().get(0).getTenantId(); - - Set paymentIds = new HashSet<>(); - Map workflowRequestByPaymentId = new HashMap<>(); - - for(PaymentWorkflow workflow : paymentWorkflowRequest.getPaymentWorkflows()){ - if(!workflow.getAction().equals(action)) - throw new CustomException("PAYMENT_WORKFLOW_SINGLE_ACTION_ALLOWED", "All workflow requests should be " + - "of the same action"); - if(!workflow.getTenantId().equalsIgnoreCase(tenantId)) - throw new CustomException("CROSS_TENANT_OP_NOT_ALLOWED", "All requests should act on a single tenant "); - paymentIds.add(workflow.getPaymentId()); - workflowRequestByPaymentId.put(workflow.getPaymentId(), workflow); - } - - // Fetch consumer codes of receipts - - List payments = paymentRepository.fetchPayments(PaymentSearchCriteria.builder() - .ids(paymentIds) - .tenantId(tenantId) - .offset(0).limit(applicationProperties.getReceiptsSearchDefaultLimit()) - .build()); - - Set consumerCodes = new HashSet<>(); - - payments.forEach(payment -> { - payment.getPaymentDetails().forEach(paymentDetail -> { - consumerCodes.add(paymentDetail.getBill().getConsumerCode()); - }); - }); - - List processedPayments = new ArrayList<>(); - - switch (action){ - case CANCEL: - processedPayments = cancel(workflowRequestByPaymentId, consumerCodes, - paymentWorkflowRequest.getRequestInfo(), tenantId); - break; - case DISHONOUR: - processedPayments = dishonour(workflowRequestByPaymentId, consumerCodes, - paymentWorkflowRequest.getRequestInfo(), tenantId); - break; - case REMIT: - processedPayments = remit(workflowRequestByPaymentId, consumerCodes, - paymentWorkflowRequest.getRequestInfo(), tenantId); - break; - } - - return processedPayments; - } - - - private List cancel(Map workflowRequestByPaymentId, Set consumerCodes, - RequestInfo requestInfo, String tenantId){ - PaymentSearchCriteria paymentSearchCriteria = PaymentSearchCriteria - .builder() - .consumerCodes(consumerCodes) - .instrumentStatus(singleton(InstrumentStatusEnum.APPROVED.toString())) - .offset(0).limit(applicationProperties.getReceiptsSearchDefaultLimit()) - .tenantId(tenantId) - .build(); - - List payments = paymentRepository.fetchPayments(paymentSearchCriteria); - payments.sort(reverseOrder(Comparator.comparingLong(Payment::getTransactionDate))); - - List validatedPayments = paymentWorkflowValidator.validateForCancel(new ArrayList<> - (workflowRequestByPaymentId.values()), payments); - - for(Payment payment : validatedPayments) { - payment.setInstrumentStatus(InstrumentStatusEnum.CANCELLED); - payment.setPaymentStatus(PaymentStatusEnum.CANCELLED); - payment.getPaymentDetails().forEach(paymentDetail -> { - Bill bill = paymentDetail.getBill(); - bill.setStatus(Bill.StatusEnum.CANCELLED); - bill.setIsCancelled(true); - bill.setReasonForCancellation(workflowRequestByPaymentId.get(payment.getId()).getReason()); - bill.setAdditionalDetails(jsonMerge(bill.getAdditionalDetails(), - workflowRequestByPaymentId.get(payment.getId()).getAdditionalDetails())); - }); - updateAuditDetails(payment, requestInfo); - } - - List> idTofileStoreIdMaps; - idTofileStoreIdMaps = generateNewReceiptUponStatusChange(validatedPayments, requestInfo); - paymentRepository.updateFileStoreId(idTofileStoreIdMaps); - paymentRepository.updateStatus(validatedPayments); - - validatedPayments.forEach(payment -> { - collectionProducer.push(tenantId, applicationProperties.getCancelPaymentTopicName(), new PaymentRequest(requestInfo, payment)); - }); - - - return validatedPayments; - } - - - - private List dishonour(Map workflowRequestByPaymentId, Set consumerCodes, - RequestInfo requestInfo, String tenantId){ - Set status = new HashSet<>(); - status.add(InstrumentStatusEnum.APPROVED.toString()); - status.add(InstrumentStatusEnum.REMITTED.toString()); - - Set paymentModes = new HashSet<>(); - paymentModes.add(PaymentModeEnum.CHEQUE.toString()); - paymentModes.add(PaymentModeEnum.DD.toString()); - - PaymentSearchCriteria paymentSearchCriteria = PaymentSearchCriteria - .builder() - .consumerCodes(consumerCodes) - .paymentModes(paymentModes) - .instrumentStatus(status) - .tenantId(tenantId) - .offset(0).limit(applicationProperties.getReceiptsSearchDefaultLimit()) - .build(); - - List payments = paymentRepository.fetchPayments(paymentSearchCriteria); - payments.sort(reverseOrder(Comparator.comparingLong(Payment::getTransactionDate))); - - List validatedPayments = paymentWorkflowValidator.validateForCancel(new ArrayList<>(workflowRequestByPaymentId.values()), payments); - - for(Payment payment : validatedPayments) { - payment.setPaymentStatus(PaymentStatusEnum.DISHONOURED); - payment.setInstrumentStatus(InstrumentStatusEnum.DISHONOURED); - - payment.getPaymentDetails().forEach(paymentDetail -> { - Bill bill = paymentDetail.getBill(); - bill.setStatus(Bill.StatusEnum.CANCELLED); - bill.setReasonForCancellation(workflowRequestByPaymentId.get(payment.getId()).getReason()); - bill.setAdditionalDetails(jsonMerge(bill.getAdditionalDetails(), - workflowRequestByPaymentId.get(payment.getId()).getAdditionalDetails())); - }); - - updateAuditDetails(payment, requestInfo); - } - - List> idTofileStoreIdMaps; - idTofileStoreIdMaps = generateNewReceiptUponStatusChange(validatedPayments, requestInfo); - paymentRepository.updateFileStoreId(idTofileStoreIdMaps); - paymentRepository.updateStatus(validatedPayments); - - validatedPayments.forEach(payment -> { - collectionProducer.push(tenantId, applicationProperties.getCancelPaymentTopicName(), new PaymentRequest(requestInfo, payment)); - }); - - return validatedPayments; - } - - private List remit(Map workflowRequestByPaymentId, Set consumerCodes, - RequestInfo requestInfo, String tenantId){ - - Set paymentModes = new HashSet<>(); - paymentModes.add(PaymentModeEnum.CASH.toString()); - paymentModes.add(PaymentModeEnum.CHEQUE.toString()); - paymentModes.add(PaymentModeEnum.DD.toString()); - - PaymentSearchCriteria paymentSearchCriteria = PaymentSearchCriteria - .builder() - .consumerCodes(consumerCodes) - .instrumentStatus(singleton(InstrumentStatusEnum.APPROVED.toString())) - .paymentModes(paymentModes) - .offset(0).limit(applicationProperties.getReceiptsSearchDefaultLimit()) - .tenantId(tenantId) - .build(); - - List payments = paymentRepository.fetchPayments(paymentSearchCriteria); - - List validatedPayments = paymentWorkflowValidator.validateForRemit(new ArrayList<>(workflowRequestByPaymentId.values()), payments); - - for(Payment payment : validatedPayments) { - payment.setPaymentStatus(PaymentStatusEnum.DEPOSITED); - payment.setInstrumentStatus(InstrumentStatusEnum.REMITTED); - - JsonNode additionalDetails = workflowRequestByPaymentId.get(payment.getId()) - .getAdditionalDetails(); - - payment.getPaymentDetails().forEach(paymentDetail -> { - paymentDetail.getBill().setAdditionalDetails( - jsonMerge(paymentDetail.getBill().getAdditionalDetails(), additionalDetails)); - }); - - - updateAuditDetails(payment, requestInfo); - } - - List> idTofileStoreIdMaps; - idTofileStoreIdMaps = generateNewReceiptUponStatusChange(validatedPayments, requestInfo); - paymentRepository.updateFileStoreId(idTofileStoreIdMaps); - paymentRepository.updateStatus(validatedPayments); - - validatedPayments.forEach(payment -> { - collectionProducer.push(tenantId, applicationProperties.getCancelPaymentTopicName(), new PaymentRequest(requestInfo, payment)); - }); - return validatedPayments; - } - - // This method generates a new receipt when payment status is changed and updates fileStoreId of payment receipt - List> generateNewReceiptUponStatusChange(List validatedPayments, RequestInfo request){ - List fileStoreIds; - StringBuilder uri = new StringBuilder(); - uri.append(applicationProperties.getEgovServiceHost()) - .append(applicationProperties.getEgovPdfCreate()).append("?key=") - .append("consolidatedreceipt") - .append("&tenantId=") - .append(validatedPayments.get(0).getTenantId().split("\\.")[0]); - - log.info("GENERATED LINK TO PDF-SERVICE " + uri); - Object result = null; - Map pdfRequest = new HashMap<>(); - pdfRequest.put("RequestInfo", request); - pdfRequest.put("Payments", validatedPayments); - List> idTofileStoreIdMaps = new LinkedList<>(); - try{ - Map idToFileStore = new HashMap<>(); - result = restTemplate.postForObject(uri.toString(), pdfRequest, Map.class); - String id = validatedPayments.get(0).getId(); - fileStoreIds = JsonPath.read(result, "$.filestoreIds"); - idToFileStore.put(KEY_ID, id); - idToFileStore.put(KEY_FILESTOREID, StringUtils.join(fileStoreIds,',')); - idTofileStoreIdMaps.add(idToFileStore); - - }catch(Exception e){ - log.error("Error while fetching filestoreid corresponding to new receipt" + e); - } - return idTofileStoreIdMaps; - } - - - /** - * Update audit details as per request - * - * @param payment which is being modified - * @param requestInfo info about the request - */ - public static void updateAuditDetails(Payment payment, RequestInfo requestInfo){ - Long currentTime = System.currentTimeMillis(); - payment.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getId().toString()); - payment.getAuditDetails().setLastModifiedTime(currentTime); - - payment.getPaymentDetails().forEach(paymentDetail -> { - paymentDetail.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getId().toString()); - paymentDetail.getAuditDetails().setLastModifiedTime(currentTime); - paymentDetail.getBill().getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getId().toString()); - paymentDetail.getBill().getAuditDetails().setLastModifiedTime(currentTime); - }); - - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/PreExistPaymentService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/PreExistPaymentService.java deleted file mode 100644 index 2e4d51d58af..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/PreExistPaymentService.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.egov.collection.service; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.repository.PaymentRepository; -import org.egov.tracer.model.CustomException; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpMethod; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class PreExistPaymentService { - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - private PaymentRepository paymentRepository; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private RestTemplate restTemplate; - - /** - * Fetch the Bank details from bank ifsccode - * - * @param ifscCode - * @return - */ - private JsonNode populateBankBranch(String ifscCode) { - JsonNode razorpayIfsccodeResponse = null; - if (StringUtils.isNotEmpty(ifscCode)) { - String response = null; - try { - response = restTemplate - .exchange(applicationProperties.getRazorPayUrl() + ifscCode, HttpMethod.GET, null, String.class) - .getBody(); - } catch (HttpClientErrorException e) { - log.error("Razor pay throw Exception for IFSCCODE: " + ifscCode, e); - } catch (Exception e) { - log.error("Exception while fetching from searcher: ", e); - throw new ServiceCallException(e.getMessage()); - } - - try { - if (StringUtils.isNotEmpty(response)) - razorpayIfsccodeResponse = mapper.readTree(response); - } catch (JsonProcessingException e) { - log.error("Error in processing JSON", e); - throw new CustomException("INVALID_PROCESS_EXCEPTION", e.getMessage()); - } - } - return razorpayIfsccodeResponse; - } - - /** - * From the payment ifsccode get bank details from RazorPay api. Persists - * the bankdetails in payment additional details. - * - * @param ifsccode - */ - @Transactional - public void updatePaymentBankDetails(String ifsccode) { - JsonNode bankdetails = populateBankBranch(ifsccode); - if (null != bankdetails) - paymentRepository.updatePaymentBankDetail(bankdetails, ifsccode); - } - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/RemittanceService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/RemittanceService.java deleted file mode 100644 index 0888a93c674..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/RemittanceService.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.egov.collection.service; - -import java.util.List; - -import org.egov.collection.repository.RemittanceRepository; -import org.egov.collection.util.RemittanceEnricher; -import org.egov.collection.web.contract.Remittance; -import org.egov.collection.web.contract.RemittanceRequest; -import org.egov.collection.web.contract.RemittanceSearchRequest; -import org.egov.common.contract.request.RequestInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class RemittanceService { - - private RemittanceRepository remittanceRepository; - private RemittanceEnricher remittanceEnricher; - - @Autowired - public RemittanceService(RemittanceRepository remittanceRepository, RemittanceEnricher remittanceEnricher) { - this.remittanceRepository = remittanceRepository; - this.remittanceEnricher = remittanceEnricher; - } - - public List getRemittances(RequestInfo requestInfo, RemittanceSearchRequest remittanceSearchRequest) { - remittanceSearchRequest.setOffset(0); - remittanceSearchRequest.setLimit(25); - - List remittances = remittanceRepository.fetchRemittances(remittanceSearchRequest); - return remittances; - } - - @Transactional - public Remittance createRemittance(RemittanceRequest request) { - Remittance remittance = request.getRemittances().get(0); - - remittanceEnricher.enrichRemittancePreValidate(request); - remittanceRepository.saveRemittance(remittance); - - return remittance; - } - - @Transactional - public Remittance updateRemittance(RemittanceRequest request) { - - Remittance remittance = request.getRemittances().get(0); - - remittanceRepository.updateRemittance(remittance); - - return remittance; - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/UserService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/UserService.java deleted file mode 100644 index e27ce687456..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/UserService.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.egov.collection.service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.UserResponse; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.web.client.RestTemplate; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class UserService { - - @Autowired - private MultiStateInstanceUtil centralUtil; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private ApplicationProperties properties; - - /** - * Fetched user based on phone number. - * Note: Currently all CITIZEN are state-level and hence the phone no (which is set as username) is unique across state. - * - * @param requestInfo - * @param phoneNo - * @return - */ - public Map getUser(RequestInfo requestInfo, String phoneNo, String tenantId){ - Map request = new HashMap<>(); - UserResponse userResponse = null; - Map response = new HashMap<>(); - request.put("RequestInfo", requestInfo); - request.put("userName", phoneNo); - request.put("type", "CITIZEN"); - request.put("tenantid", centralUtil.getStateLevelTenant(tenantId)); - StringBuilder url = new StringBuilder(); - url.append(properties.getUserHost()).append(properties.getUserSearchEnpoint()); - try { - userResponse = restTemplate.postForObject(url.toString(), request, UserResponse.class); - if(null != userResponse) { - if(!CollectionUtils.isEmpty(userResponse.getReceiptCreators())) - response.put("id", userResponse.getReceiptCreators().get(0).getUuid()); - } - }catch(Exception e) { - log.error("Exception while fetching user: ", e); - } - - return response; - } - - /** - * Creates user using the details given in Bill. We're not using the entire user object because: - * 1. User contract is old - * 2. Lot of unnecessary fields. - * - * @param requestInfo - * @param bill - * @return - */ - public String createUser(RequestInfo requestInfo, Bill bill){ - Map request = new HashMap<>(); - Map user = new HashMap<>(); - Map role = new HashMap<>(); - List roles = new ArrayList<>(); - role.put("code", "CITIZEN"); - role.put("name", "Citizen"); - role.put("tenantId", bill.getTenantId().split("\\.")[0]); - roles.add(role); - - user.put("name", bill.getPaidBy()); - user.put("mobileNumber", bill.getMobileNumber()); - user.put("userName", bill.getMobileNumber()); - user.put("active", true); - user.put("type", "CITIZEN"); - user.put("tenantId", bill.getTenantId().split("\\.")[0]); - user.put("permanentAddress", bill.getPayerAddress()); - user.put("roles", roles); - - request.put("RequestInfo", requestInfo); - request.put("user", user); - - UserResponse response = null; - StringBuilder url = new StringBuilder(); - url.append(properties.getUserHost()).append(properties.getUserCreateEnpoint()); - try { - response = restTemplate.postForObject(url.toString(), request, UserResponse.class); - }catch(Exception e) { - log.error("Exception while creating user: ", e); - return null; - } - - return response.getReceiptCreators().get(0).getUuid(); - } - - public String createUser(PaymentRequest paymentRequest){ - RequestInfo requestInfo = paymentRequest.getRequestInfo(); - Payment payment = paymentRequest.getPayment(); - Map request = new HashMap<>(); - Map user = new HashMap<>(); - Map role = new HashMap<>(); - List roles = new ArrayList<>(); - role.put("code", "CITIZEN"); - role.put("name", "Citizen"); - role.put("tenantId", payment.getTenantId().split("\\.")[0]); - roles.add(role); - - user.put("name", payment.getPaidBy()); - user.put("mobileNumber", payment.getMobileNumber()); - user.put("userName", payment.getMobileNumber()); - user.put("active", true); - user.put("type", "CITIZEN"); - user.put("tenantId", payment.getTenantId().split("\\.")[0]); - user.put("permanentAddress", payment.getPayerAddress()); - user.put("roles", roles); - - request.put("RequestInfo", requestInfo); - request.put("user", user); - - UserResponse response = null; - StringBuilder url = new StringBuilder(); - url.append(properties.getUserHost()).append(properties.getUserCreateEnpoint()); - try { - response = restTemplate.postForObject(url.toString(), request, UserResponse.class); - }catch(Exception e) { - log.error("Exception while creating user: ", e); - return null; - } - - return response.getReceiptCreators().get(0).getUuid(); - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/WorkflowService.java b/business-services/collection-services/src/main/java/org/egov/collection/service/WorkflowService.java deleted file mode 100644 index 0a41e071a86..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/WorkflowService.java +++ /dev/null @@ -1,298 +0,0 @@ -/*package org.egov.collection.service; - -import com.fasterxml.jackson.databind.JsonNode; -import lombok.extern.slf4j.Slf4j; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.ReceiptSearchCriteria; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.enums.ReceiptStatus; -import org.egov.collection.producer.CollectionProducer; -import org.egov.collection.repository.CollectionRepository; -import org.egov.collection.util.WorkflowValidator; -import org.egov.collection.web.contract.*; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import java.util.stream.Collectors; - -import static java.util.Collections.reverseOrder; -import static java.util.Collections.singleton; -import static java.util.Objects.isNull; -import static org.egov.collection.config.CollectionServiceConstants.VOUCHER_HEADER_KEY; -import static org.egov.collection.model.enums.InstrumentStatusEnum.DEPOSITED; -import static org.egov.collection.model.enums.InstrumentTypesEnum.*; -import static org.egov.collection.util.Utils.jsonMerge; - -@Service -@Slf4j -public class WorkflowService { - private CollectionRepository collectionRepository; - private WorkflowValidator workflowValidator; - private CollectionProducer collectionProducer; - private ApplicationProperties applicationProperties; - - @Autowired - public WorkflowService(CollectionRepository collectionRepository, WorkflowValidator - workflowValidator, CollectionProducer collectionProducer, ApplicationProperties applicationProperties) { - this.collectionRepository = collectionRepository; - this.workflowValidator = workflowValidator; - this.collectionProducer = collectionProducer; - this.applicationProperties = applicationProperties; - - } - - *//** - * Processes all workflow related requests - * - Verify that all workflow actions in the request are same - * - Handover processing of actions to sub methods - * - Persist the updated receipts - * - * @param receiptWorkflowRequest multiple actions - * @return updated receipts - *//* - @Transactional - public List performWorkflow(ReceiptWorkflowRequest receiptWorkflowRequest){ - - // Basic validations - - ReceiptWorkflow.ReceiptAction action = receiptWorkflowRequest.getReceiptWorkflow().get(0).getAction(); - String tenantId = receiptWorkflowRequest.getReceiptWorkflow().get(0).getTenantId(); - - Set receiptNumbers = new HashSet<>(); - Map workflowRequestByReceiptNumber = new HashMap<>(); - - for(ReceiptWorkflow workflow : receiptWorkflowRequest.getReceiptWorkflow()){ - if(!workflow.getAction().equals(action)) - throw new CustomException("RECEIPT_WORKFLOW_SINGLE_ACTION_ALLOWED", "All workflow requests should be " + - "of the same action"); - - if(!workflow.getTenantId().equalsIgnoreCase(tenantId)) - throw new CustomException("CROSS_TENANT_OP_NOT_ALLOWED", "All requests should act on a single tenant "); - - receiptNumbers.add(workflow.getReceiptNumber()); - workflowRequestByReceiptNumber.put(workflow.getReceiptNumber(), workflow); - } - - // Fetch consumer codes of receipts - - List receipts = collectionRepository.fetchReceipts(ReceiptSearchCriteria.builder() - .receiptNumbers(receiptNumbers) - .tenantId(tenantId) - .build()); - - Set consumerCodes = receipts.stream() - .map(Receipt::getConsumerCode) - .collect(Collectors.toSet()); - - - List processedReceipts = new ArrayList<>(); - - switch (action){ - case CANCEL: - processedReceipts = cancel(workflowRequestByReceiptNumber, consumerCodes, - receiptWorkflowRequest.getRequestInfo(), tenantId); - break; - case DISHONOUR: - processedReceipts = dishonour(workflowRequestByReceiptNumber, consumerCodes, - receiptWorkflowRequest.getRequestInfo(), tenantId); - break; - case REMIT: - processedReceipts = remit(workflowRequestByReceiptNumber, consumerCodes, - receiptWorkflowRequest.getRequestInfo(), tenantId); - break; - } - - return processedReceipts; - - - } - - *//** - * Performs cancellation of eligible receipts - * Eligibility is defined by current status of the receipt - * Latest receipt of a consumer code with status of APPROVED [or initial state] can be cancelled - * - * - Fetch receipts eligible for cancellation by consumer codes & order by receipt date desc - * - Validate workflow requests for cancellation - * - If validated, update receipts as per the request - * else, throws exception and exit - * - * @param workflowRequestByReceiptNumber map workflow request to receipt number - * @param consumerCodes Consumer codes of all the requests - * @param requestInfo request info of the incoming request - * @param tenantId - * @return updated receipts - *//* - private List cancel(Map workflowRequestByReceiptNumber, Set consumerCodes, - RequestInfo requestInfo, String tenantId){ - ReceiptSearchCriteria receiptSearchCriteria = ReceiptSearchCriteria - .builder() - .consumerCode(consumerCodes) - .status(singleton(ReceiptStatus.APPROVED.toString())) - .tenantId(tenantId) - .build(); - - List receipts = collectionRepository.fetchReceipts(receiptSearchCriteria); - receipts.sort(reverseOrder(Comparator.comparingLong(Receipt::getReceiptDate))); - - List validatedReceipts = workflowValidator.validateForCancel(new ArrayList<> - (workflowRequestByReceiptNumber.values()), receipts); - - - for(Receipt receipt : validatedReceipts) { - BillDetail billDetail = receipt.getBill().get(0).getBillDetails().get(0); - billDetail.setStatus(ReceiptStatus.CANCELLED.toString()); - billDetail.setReasonForCancellation(workflowRequestByReceiptNumber.get(receipt.getReceiptNumber()).getReason()); - billDetail.setAdditionalDetails(jsonMerge(billDetail.getAdditionalDetails(), - workflowRequestByReceiptNumber.get(receipt.getReceiptNumber()).getAdditionalDetails())); - receipt.getInstrument().setInstrumentStatus(InstrumentStatusEnum.CANCELLED); - - updateAuditDetails(receipt, requestInfo); - } - - collectionRepository.updateStatus(validatedReceipts); - - collectionProducer.producer(applicationProperties.getCancelReceiptTopicName(), applicationProperties - .getCancelReceiptTopicKey(), new ReceiptReq(requestInfo, validatedReceipts)); - - return validatedReceipts; - } - - *//** - * Performs dishonoring of eligible receipts - * Eligibility is defined by current status of the receipt & mode of payment - * Latest receipt of a consumer code with status of APPROVED [or initial state], REMITTED & payment mode CHEQUE, DD can be dishonored - * - * - Fetch receipts eligible for dishonoring by consumer codes & order by receipt date desc - * - Validate requests for dishonoring - * - If validated, update receipts as per the request - * else, throws exception and exit - * - * @param workflowRequestByReceiptNumber map workflow request to receipt number - * @param consumerCodes Consumer codes of all the requests - * @param requestInfo request info of the incoming request - * @param tenantId - * @return updated receipts - *//* - private List dishonour(Map workflowRequestByReceiptNumber, Set consumerCodes, - RequestInfo requestInfo, String tenantId){ - Set status = new HashSet<>(); - status.add(ReceiptStatus.APPROVED.toString()); - status.add(ReceiptStatus.REMITTED.toString()); - - Set instrumentTypes = new HashSet<>(); - instrumentTypes.add(CHEQUE.toString()); - instrumentTypes.add(DD.toString()); - - ReceiptSearchCriteria receiptSearchCriteria = ReceiptSearchCriteria - .builder() - .consumerCode(consumerCodes) - .instrumentType(instrumentTypes) - .status(status) - .tenantId(tenantId) - .build(); - - List receipts = collectionRepository.fetchReceipts(receiptSearchCriteria); - receipts.sort(reverseOrder(Comparator.comparingLong(Receipt::getReceiptDate))); - - List validatedReceipts = workflowValidator.validateForCancel(new ArrayList<>(workflowRequestByReceiptNumber.values()), receipts); - - for(Receipt receipt : validatedReceipts) { - BillDetail billDetail = receipt.getBill().get(0).getBillDetails().get(0); - billDetail.setStatus(ReceiptStatus.REJECTED.toString()); - billDetail.setReasonForCancellation(workflowRequestByReceiptNumber.get(receipt.getReceiptNumber()).getReason()); - billDetail.setAdditionalDetails(jsonMerge(billDetail.getAdditionalDetails(), - workflowRequestByReceiptNumber.get(receipt.getReceiptNumber()).getAdditionalDetails())); - receipt.getInstrument().setInstrumentStatus(InstrumentStatusEnum.DISHONOURED); - - updateAuditDetails(receipt, requestInfo); - } - - collectionRepository.updateStatus(validatedReceipts); - - collectionProducer.producer(applicationProperties.getCancelReceiptTopicName(), applicationProperties - .getCancelReceiptTopicKey(), new ReceiptReq(requestInfo, validatedReceipts)); - return validatedReceipts; - } - - - *//** - * Performs remittance of eligible receipts - * Eligibility is defined by current status of the receipt & mode of payment - * Receipts with status of APPROVED [or initial state] & payment mode CHEQUE, DD, CASH can be remitted - * - * - * - Fetch receipts eligible for remittance by consumer codes - * - Validate requests for remittance - * - If validated, update receipts as per the request - * else, throws exception and exit - * - * @param workflowRequestByReceiptNumber map workflow request to receipt number - * @param consumerCodes Consumer codes of all the requests - * @param requestInfo request info of the incoming request - * @param tenantId - * @return updated receipts - *//* - private List remit(Map workflowRequestByReceiptNumber, Set consumerCodes, - RequestInfo requestInfo, String tenantId){ - - Set instrumentTypes = new HashSet<>(); - instrumentTypes.add(CASH.toString()); - instrumentTypes.add(CHEQUE.toString()); - instrumentTypes.add(DD.toString()); - - ReceiptSearchCriteria receiptSearchCriteria = ReceiptSearchCriteria - .builder() - .consumerCode(consumerCodes) - .status(singleton(ReceiptStatus.APPROVED.toString())) - .instrumentType(instrumentTypes) - .tenantId(tenantId) - .build(); - - List receipts = collectionRepository.fetchReceipts(receiptSearchCriteria); - - List validatedReceipts = workflowValidator.validateForRemit(new ArrayList<>(workflowRequestByReceiptNumber.values()), receipts); - - for(Receipt receipt : validatedReceipts) { - JsonNode additionalDetails = workflowRequestByReceiptNumber.get(receipt.getReceiptNumber()) - .getAdditionalDetails(); - BillDetail billDetail = receipt.getBill().get(0).getBillDetails().get(0); - billDetail.setStatus(ReceiptStatus.REMITTED.toString()); - billDetail.setAdditionalDetails(jsonMerge(billDetail.getAdditionalDetails(), - additionalDetails)); - - if( ! isNull(additionalDetails) && ! additionalDetails.isNull() && additionalDetails.has(VOUCHER_HEADER_KEY)) - billDetail.setVoucherHeader(additionalDetails.get(VOUCHER_HEADER_KEY).asText()); - - receipt.getInstrument().setInstrumentStatus(DEPOSITED); - - updateAuditDetails(receipt, requestInfo); - } - - collectionRepository.updateStatus(validatedReceipts); - - collectionProducer.producer(applicationProperties.getUpdateReceiptTopicName(), applicationProperties - .getUpdateReceiptTopicKey(), new ReceiptReq(requestInfo, validatedReceipts)); - return validatedReceipts; - } - - *//** - * Update audit details as per request - * - * @param receipt which is being modified - * @param requestInfo info about the request - *//* - public static void updateAuditDetails(Receipt receipt, RequestInfo requestInfo){ - receipt.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getId().toString()); - receipt.getAuditDetails().setLastModifiedDate(System.currentTimeMillis()); - - receipt.getInstrument().getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getId().toString()); - receipt.getInstrument().getAuditDetails().setLastModifiedDate(System.currentTimeMillis()); - } - -} -*/ \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/service/v1/CollectionService_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/service/v1/CollectionService_v1.java deleted file mode 100644 index 461f262c90c..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/service/v1/CollectionService_v1.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.egov.collection.service.v1; - -import static java.util.Objects.isNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.model.v1.ReceiptRequest_v1; -import org.egov.collection.model.v1.ReceiptSearchCriteria_v1; -import org.egov.collection.model.v1.Receipt_v1; -import org.egov.collection.repository.querybuilder.v1.CollectionQueryBuilder_v1; -import org.egov.collection.repository.querybuilder.v1.CollectionResultSetExtractor_v1; -import org.egov.collection.util.v1.ReceiptValidator_v1; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class CollectionService_v1 { - - private ReceiptValidator_v1 receiptValidator; - private ApplicationProperties applicationProperties; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private CollectionQueryBuilder_v1 collectionQueryBuilder_v1; - - @Autowired - private CollectionResultSetExtractor_v1 collectionResultSetExtractor; - /** - * Fetch all receipts matching the given criteria, enrich receipts with instruments - * - * @param requestInfo Request info of the search - * @param receiptSearchCriteria Criteria against which search has to be performed - * @return List of matching receipts - */ - public List getReceipts(RequestInfo requestInfo, ReceiptSearchCriteria_v1 receiptSearchCriteria) { - ReceiptRequest_v1 receiptReq = ReceiptRequest_v1.builder().requestInfo(requestInfo).build(); - Map errorMap = new HashMap<>(); - receiptValidator.validateUserInfo(receiptReq, errorMap); - if (!errorMap.isEmpty()) - throw new CustomException(errorMap); - - if (applicationProperties.isReceiptsSearchPaginationEnabled()) { - receiptSearchCriteria.setOffset(isNull(receiptSearchCriteria.getOffset()) ? 0 : receiptSearchCriteria.getOffset()); - receiptSearchCriteria.setLimit(isNull(receiptSearchCriteria.getLimit()) ? applicationProperties.getReceiptsSearchDefaultLimit() : - receiptSearchCriteria.getLimit()); - } else { - receiptSearchCriteria.setOffset(0); - receiptSearchCriteria.setLimit(applicationProperties.getReceiptsSearchDefaultLimit()); - } - if(requestInfo.getUserInfo().getType().equals("CITIZEN")) { - List payerIds = new ArrayList<>(); - payerIds.add(requestInfo.getUserInfo().getUuid()); - receiptSearchCriteria.setPayerIds(payerIds); - } - List receipts = fetchReceipts(receiptSearchCriteria); - - return receipts; - } - - public List fetchReceipts(ReceiptSearchCriteria_v1 receiptSearchCriteria){ - Map preparedStatementValues = new HashMap<>(); - String query = collectionQueryBuilder_v1.getReceiptSearchQuery(receiptSearchCriteria, preparedStatementValues); - log.debug(query); - List receipts = namedParameterJdbcTemplate.query(query, preparedStatementValues, - collectionResultSetExtractor); - return receipts; - } - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/util/CollectionMastersRequestValidator.java b/business-services/collection-services/src/main/java/org/egov/collection/util/CollectionMastersRequestValidator.java deleted file mode 100644 index 932ffda7717..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/util/CollectionMastersRequestValidator.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.util; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.config.CollectionServiceConstants; -import org.egov.collection.model.BankAccountServiceMappingSearchCriteria; -import org.egov.collection.service.BankAccountMappingService; -import org.egov.collection.web.contract.BankAccountServiceMapping; -import org.egov.collection.web.contract.BankAccountServiceMappingReq; -import org.egov.common.contract.response.Error; -import org.egov.common.contract.response.ErrorField; -import org.egov.common.contract.response.ErrorResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class CollectionMastersRequestValidator { - - @Autowired - private BankAccountMappingService bankAccountMappingService; - - public ErrorResponse validateBankAccountSearchRequest(final BankAccountServiceMappingSearchCriteria searchCriteria) { - ErrorResponse errorResponse = null; - List errorFields = new ArrayList<>(); - Error error = null; - if (StringUtils.isBlank(searchCriteria.getTenantId())) { - ErrorField errorField = ErrorField - .builder() - .code(CollectionServiceConstants.TENANT_ID_REQUIRED_CODE) - .message( - CollectionServiceConstants.TENANT_ID_REQUIRED_MESSAGE) - .field(CollectionServiceConstants.TENANT_ID_REQUIRED_FIELD) - .build(); - errorFields.add(errorField); - - } - - if (errorFields != null && !errorFields.isEmpty()) { - error = Error.builder().code(HttpStatus.BAD_REQUEST.value()) - .message(CollectionServiceConstants.SEARCH_BANKACCOUNT_SERVICE_MAPPING_REQUEST) - .fields(errorFields).build(); - error.setFields(errorFields); - errorResponse = new ErrorResponse(); - errorResponse.setError(error); - } - return errorResponse; - } - - public ErrorResponse validateBankAccountServiceRequest(final BankAccountServiceMappingReq bankAccountServiceMappingReq) { - ErrorResponse errorResponse = null; - List errorFields = new ArrayList<>(); - Error error = null; - for (BankAccountServiceMapping bankAccountServiceMapping : bankAccountServiceMappingReq.getBankAccountServiceMapping()) { - if (StringUtils.isEmpty(bankAccountServiceMapping.getTenantId())) { - ErrorField errorField = ErrorField - .builder() - .code(CollectionServiceConstants.TENANT_ID_REQUIRED_CODE) - .message( - CollectionServiceConstants.TENANT_ID_REQUIRED_MESSAGE) - .field(CollectionServiceConstants.TENANT_ID_REQUIRED_FIELD) - .build(); - errorFields.add(errorField); - } - if (StringUtils.isEmpty(bankAccountServiceMapping.getBusinessDetails())) { - ErrorField errorField = ErrorField - .builder() - .code(CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_BUSINESSDETAILS_CODE) - .message( - CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_BUSINESSDETAILS_MESSAGE) - .field(CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_BUSINESSDETAILS_FIELD) - .build(); - errorFields.add(errorField); - } - if (StringUtils.isEmpty(bankAccountServiceMapping.getBankAccount())) { - ErrorField errorField = ErrorField - .builder() - .code(CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_BANKACCOUNT_CODE) - .message( - CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_BANKACCOUNT_MESSAGE) - .field(CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_BANKACCOUNT_FIELD) - .build(); - errorFields.add(errorField); - } - - if (StringUtils.isNotBlank(bankAccountServiceMapping.getTenantId()) - && StringUtils.isNotBlank(bankAccountServiceMapping.getBusinessDetails()) - && StringUtils.isNotBlank(bankAccountServiceMapping.getBankAccount())) { - BankAccountServiceMappingSearchCriteria searchCriteria = new BankAccountServiceMappingSearchCriteria(); - searchCriteria.setTenantId(bankAccountServiceMapping.getTenantId()); - searchCriteria.setBusinessDetails(Collections.singletonList(bankAccountServiceMapping.getBusinessDetails())); - searchCriteria.setBankAccount(bankAccountServiceMapping.getBankAccount()); - List bankAccountServiceMappings = bankAccountMappingService - .searchBankAccountService(searchCriteria); - if (!bankAccountServiceMappings.isEmpty()) { - ErrorField errorField = ErrorField - .builder() - .code(CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_EXISTS_CODE) - .message( - CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_EXISTS_MESSAGE1 - + bankAccountServiceMapping.getBusinessDetails() + - CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_EXISTS_MESSAGE2 - + bankAccountServiceMapping.getBankAccount() + - CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_EXISTS_MESSAGE3) - .field(CollectionServiceConstants.BANKACCOUNT_SERVICE_MAPPING_EXISTS_FIELD) - .build(); - errorFields.add(errorField); - } - - } - - } - if (errorFields != null && !errorFields.isEmpty()) { - error = Error.builder().code(HttpStatus.BAD_REQUEST.value()) - .message(CollectionServiceConstants.SEARCH_BANKACCOUNT_SERVICE_MAPPING_REQUEST) - .fields(errorFields).build(); - error.setFields(errorFields); - errorResponse = new ErrorResponse(); - errorResponse.setError(error); - } - return errorResponse; - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/util/PaymentEnricher.java b/business-services/collection-services/src/main/java/org/egov/collection/util/PaymentEnricher.java deleted file mode 100644 index 142659f2a1a..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/util/PaymentEnricher.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.egov.collection.util; - -import static java.util.Objects.isNull; -import static org.egov.collection.config.CollectionServiceConstants.MASTER_BUSINESSSERVICE_KEY; -import static org.egov.collection.config.CollectionServiceConstants.MASTER_COLLECTIONMODESNOTALLOWED_KEY; -import static org.egov.collection.config.CollectionServiceConstants.MASTER_ISADVANCEALLOWED_KEY; -import static org.egov.collection.config.CollectionServiceConstants.MASTER_PARTPAYMENTALLOWED_KEY; -import static org.egov.collection.config.CollectionServiceConstants.MDMS_BUSINESSSERVICE_PATH; -import static org.egov.collection.model.enums.InstrumentTypesEnum.CARD; -import static org.egov.collection.model.enums.InstrumentTypesEnum.CASH; -import static org.egov.collection.model.enums.InstrumentTypesEnum.ONLINE; -import static org.egov.collection.model.enums.PaymentModeEnum.ONLINE_NEFT; -import static org.egov.collection.model.enums.PaymentModeEnum.ONLINE_RTGS; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.egov.collection.model.AuditDetails; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.enums.PaymentStatusEnum; -import org.egov.collection.model.enums.Purpose; -import org.egov.collection.model.enums.ReceiptType; -import org.egov.collection.repository.BillingServiceRepository; -import org.egov.collection.repository.IdGenRepository; -import org.egov.collection.service.MDMSService; -import org.egov.collection.web.contract.Bill; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Component -@Slf4j -public class PaymentEnricher { - - @Autowired - private BillingServiceRepository billingRepository; - - @Autowired - private IdGenRepository idGenRepository; - - @Autowired - private MDMSService mdmsService; - - public void enrichPaymentPreValidate(PaymentRequest paymentRequest) { - - Payment payment = paymentRequest.getPayment(); - String tenantId = payment.getTenantId(); - List billIds = payment.getPaymentDetails().stream().map(PaymentDetail::getBillId).collect(Collectors.toList()); - Set billIdSet = payment.getPaymentDetails().stream().map(PaymentDetail::getBillId) - .collect(Collectors.toSet()); - - if (isNull(paymentRequest.getRequestInfo().getUserInfo()) || isNull(paymentRequest.getRequestInfo().getUserInfo().getUuid())) { - throw new CustomException("USER_INFO_INVALID", "Invalid user info in request info, user id is mandatory"); - } - - if (billIdSet.size() < payment.getPaymentDetails().size()) - throw new CustomException("DUPLICATE_BILLID", "The Bill ids have been repeated for multiple payment details"); - - Object mdmsData = mdmsService.mDMSCall(paymentRequest.getRequestInfo(),tenantId); - - List businessServices = JsonPath.read(mdmsData,MDMS_BUSINESSSERVICE_PATH); - - Map codeToBusinessService = new HashMap<>(); - - businessServices.forEach(businessService -> { - codeToBusinessService.put(businessService.get(MASTER_BUSINESSSERVICE_KEY).toString(),businessService); - }); - - List validatedBills = billingRepository.fetchBill(paymentRequest.getRequestInfo(), payment.getTenantId(), - billIds); - Map billIdToBillMap = new HashMap<>(); - Map errorMap = new HashMap<>(); - - // If the bills is non-empty list payer info is added to the bil - if (CollectionUtils.isEmpty(validatedBills)) - throw new CustomException("INVALID_BILL_ID", "Bill IDs provided does not exist or is in an invalid state"); - else - validatedBills.forEach(bill -> { - Map billingServiceMaster = codeToBusinessService.get(bill.getBusinessService()); - if (CollectionUtils.isEmpty(bill.getBillDetails())) { - log.error("Bill ID provided does not exist or is in an invalid state " + bill.getId()); - errorMap.put("INVALID_BILL_ID", "Bill ID provided does not exist or is in an invalid state: " + bill.getId()); - } - else if(billingServiceMaster==null){ - log.error("BusinessService not found for bill with business service: " + bill.getBusinessService()); - errorMap.put("INVALID_BILL_BUSINESSSERVICE", "Business service provided does not exist for bill: " + bill.getId()); - } - else { - bill.setPaidBy(payment.getPaidBy()); - //payment.setPayerName(bill.getPayerName()); - //payment.setPayerAddress(bill.getPayerAddress()); - //payment.setMobileNumber(bill.getMobileNumber()); - try{ - List collectionsModeNotAllowed = (List)billingServiceMaster.get(MASTER_COLLECTIONMODESNOTALLOWED_KEY); - bill.setIsAdvanceAllowed(((Boolean)billingServiceMaster.get(MASTER_ISADVANCEALLOWED_KEY))); - bill.setPartPaymentAllowed((Boolean)billingServiceMaster.get(MASTER_PARTPAYMENTALLOWED_KEY)); - bill.setCollectionModesNotAllowed(collectionsModeNotAllowed); - } - catch (Exception e){ - errorMap.put("INVALID_BILL_BUSINESSSERVICE","Failed to parse the master data"); - } - } - billIdToBillMap.put(bill.getId(), bill); - }); - - AuditDetails auditDetails = AuditDetails.builder() - .createdBy(paymentRequest.getRequestInfo().getUserInfo().getId().toString()) - .createdTime(System.currentTimeMillis()) - .lastModifiedBy(paymentRequest.getRequestInfo().getUserInfo().getId().toString()) - .lastModifiedTime(System.currentTimeMillis()).build(); - - // Assigns bill object to each paymentDetail if no bill object is found the - // billId from paymentDetail is added in error map - payment.getPaymentDetails().forEach(paymentDetail -> { - paymentDetail.setBusinessService(billIdToBillMap.get(paymentDetail.getBillId()).getBusinessService()); - paymentDetail.setBill(billIdToBillMap.get(paymentDetail.getBillId())); - paymentDetail.setId(UUID.randomUUID().toString()); - paymentDetail.setTenantId(payment.getTenantId()); - paymentDetail.setAuditDetails(auditDetails); - paymentDetail.setReceiptType(ReceiptType.BILLBASED.toString()); - paymentDetail.setReceiptDate(System.currentTimeMillis()); - paymentDetail.setTotalDue(billIdToBillMap.get(paymentDetail.getBillId()).getTotalAmount()); - }); - if (!errorMap.isEmpty()) - throw new CustomException(errorMap); - BigDecimal result = payment.getPaymentDetails().stream().map(PaymentDetail :: getTotalDue).collect(Collectors.toList()) - .stream().reduce(BigDecimal.ZERO, BigDecimal::add); - payment.setTotalDue(result); - payment.setId(UUID.randomUUID().toString()); - payment.setAuditDetails(auditDetails); - - } - - /** - * Enrich instrument for financials For each bill detail, - Set status to - * approved by default for now, no workflow - Set collection type to online or - * counter - Set receipt date - Generate and set receipt number - * - * @param paymentRequest - * paymentRequest to be enriched - */ - public void enrichPaymentPostValidate(PaymentRequest paymentRequest) { - Payment payment = paymentRequest.getPayment(); - List paymentDetails = payment.getPaymentDetails(); - String paymentMode = payment.getPaymentMode().toString(); - - if (paymentMode.equalsIgnoreCase(ONLINE.name()) || paymentMode.equalsIgnoreCase(CARD.name()) || - paymentMode.equalsIgnoreCase(ONLINE_NEFT.name()) || paymentMode.equalsIgnoreCase(ONLINE_RTGS.name())) - payment.setPaymentStatus(PaymentStatusEnum.DEPOSITED); - else - payment.setPaymentStatus(PaymentStatusEnum.NEW); - - for (PaymentDetail paymentDetail : paymentDetails) { - paymentDetail.setId(UUID.randomUUID().toString()); - String receiptNumber = idGenRepository.generateReceiptNumber(paymentRequest.getRequestInfo(), - paymentDetail.getBusinessService(), paymentDetail.getTenantId()); - paymentDetail.setReceiptNumber(receiptNumber); - paymentDetail.getBill().setAmountPaid(paymentDetail.getTotalAmountPaid()); - - } - enrichInstrument(paymentRequest); - } - - private void enrichInstrument(PaymentRequest paymentRequest) { - Payment payment = paymentRequest.getPayment(); - String paymentMode = payment.getPaymentMode().toString(); - - if (paymentMode.equalsIgnoreCase(CASH.name())) { - String transactionId = idGenRepository.generateTransactionNumber(paymentRequest.getRequestInfo(), - payment.getTenantId()); - payment.setTransactionNumber(transactionId); - } - if (paymentMode.equalsIgnoreCase(ONLINE.name()) || paymentMode.equalsIgnoreCase(CARD.name()) || - paymentMode.equalsIgnoreCase(ONLINE_NEFT.name()) || paymentMode.equalsIgnoreCase(ONLINE_RTGS.name())) - payment.setInstrumentStatus(InstrumentStatusEnum.REMITTED); - else - payment.setInstrumentStatus(InstrumentStatusEnum.APPROVED); - - payment.setTransactionDate(new Date().getTime()); - if(paymentMode.equalsIgnoreCase(CASH.name()) || paymentMode.equalsIgnoreCase(CARD.name()) || paymentMode.equalsIgnoreCase(ONLINE.name()) - || paymentMode.equalsIgnoreCase(ONLINE_NEFT.name()) || paymentMode.equalsIgnoreCase(ONLINE_RTGS.name())) { - payment.setInstrumentDate(payment.getTransactionDate()); - } - - } - - /** - * Apportion adds another billAccDetail for Advance tax head when advance amt is - * paid, this method enriches that object - * - * @param bills - */ - public void enrichAdvanceTaxHead(List bills) { - bills.forEach(bill -> { - bill.getBillDetails().forEach(billDetail -> { - billDetail.getBillAccountDetails().forEach(billAccountDetail -> { - if (StringUtils.isEmpty(billAccountDetail.getId()) - && billAccountDetail.getPurpose().equals(Purpose.ADVANCE)) { - billAccountDetail.setId(UUID.randomUUID().toString()); - billAccountDetail.setTenantId(bill.getTenantId()); - billAccountDetail.setBillDetailId(billDetail.getId()); - billAccountDetail.setDemandDetailId("advance_tax"); - billAccountDetail.setAdjustedAmount(BigDecimal.ZERO); - billAccountDetail.setOrder(-1); - } - }); - }); - }); - } - - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/util/PaymentValidator.java b/business-services/collection-services/src/main/java/org/egov/collection/util/PaymentValidator.java deleted file mode 100644 index 2ede55aae96..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/util/PaymentValidator.java +++ /dev/null @@ -1,520 +0,0 @@ -package org.egov.collection.util; - - -import static java.util.Objects.isNull; -import static org.egov.collection.config.CollectionServiceConstants.CHEQUE_DD_DATE_WITH_FUTURE_DATE_MESSAGE; -import static org.egov.collection.config.CollectionServiceConstants.CHEQUE_DD_DATE_WITH_MANUAL_RECEIPT_DATE_MESSAGE; -import static org.egov.collection.config.CollectionServiceConstants.CHEQUE_DD_DATE_WITH_RECEIPT_DATE_MESSAGE; -import static org.egov.collection.config.CollectionServiceConstants.INSTRUMENT_DATE_DAYS; -import static org.egov.collection.config.CollectionServiceConstants.RECEIPT_CHEQUE_OR_DD_DATE; -import static org.egov.collection.config.CollectionServiceConstants.RECEIPT_CHEQUE_OR_DD_DATE_MESSAGE; -import static org.egov.collection.config.CollectionServiceConstants.RECEIPT_NEFT_OR_RTGS_DATE; -import static org.egov.collection.config.CollectionServiceConstants.RECEIPT_NEFT_OR_RTGS_DATE_MESSAGE; -import static org.egov.collection.model.enums.InstrumentStatusEnum.APPROVAL_PENDING; -import static org.egov.collection.model.enums.InstrumentStatusEnum.APPROVED; -import static org.egov.collection.model.enums.InstrumentStatusEnum.REMITTED; -import static org.egov.collection.model.enums.PaymentModeEnum.ONLINE_NEFT; -import static org.egov.collection.model.enums.PaymentModeEnum.ONLINE_RTGS; -import static org.egov.collection.util.Utils.jsonMerge; -import static org.springframework.util.ObjectUtils.isEmpty; - -import java.math.BigDecimal; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.config.ApplicationProperties; -import org.egov.collection.config.CollectionServiceConstants; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.model.PaymentSearchCriteria; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.enums.InstrumentTypesEnum; -import org.egov.collection.model.enums.PaymentModeEnum; -import org.egov.collection.model.enums.PaymentStatusEnum; -import org.egov.collection.repository.PaymentRepository; -import org.egov.collection.repository.ServiceRequestRepository; -import org.egov.collection.service.PaymentWorkflowService; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.BillDetail; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.joda.time.DateTime; -import org.joda.time.Days; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Component -public class PaymentValidator { - - - private PaymentRepository paymentRepository; - - private PaymentWorkflowService paymentWorkflowService; - - private ApplicationProperties applicationProperties; - - private ServiceRequestRepository serviceRequestRepository; - - - @Autowired - public PaymentValidator(PaymentRepository paymentRepository, PaymentWorkflowService paymentWorkflowService, - ApplicationProperties applicationProperties,ServiceRequestRepository serviceRequestRepository) { - this.paymentRepository = paymentRepository; - this.paymentWorkflowService = paymentWorkflowService; - this.applicationProperties = applicationProperties; - this.serviceRequestRepository=serviceRequestRepository; - } - - - public Payment validatePaymentForCreate(PaymentRequest paymentRequest) { - Map errorMap = new HashMap<>(); - Payment payment = paymentRequest.getPayment(); - List paymentDetails = paymentRequest.getPayment().getPaymentDetails(); - validateUserInfo(paymentRequest.getRequestInfo(), errorMap); - validateInstrument(paymentRequest.getPayment(),errorMap); - Set billIds = payment.getPaymentDetails().stream().map(PaymentDetail :: getBillId).collect(Collectors.toSet()); - - PaymentSearchCriteria criteria = PaymentSearchCriteria.builder().tenantId(payment.getTenantId()) - .offset(0).limit(applicationProperties.getReceiptsSearchDefaultLimit()).billIds(billIds).build(); - - List payments = paymentRepository.fetchPayments(criteria); - if (!payments.isEmpty()) { - validateIPaymentForBillPresent(payments,errorMap); - } - - validateIFSCCode(paymentRequest); - // Loop through all bill details [one for each service], and perform various - // validations - for (PaymentDetail paymentDetail : paymentDetails) { - - if (StringUtils.isEmpty(paymentDetail.getBusinessService())) { - errorMap.put("INVALID_BUSINESS_DETAILS", "Business details code cannot be empty"); - } - - validatePaymentDetailAgainstBill(payment.getPaymentMode().toString(),paymentDetail,errorMap); - } - - if (!errorMap.isEmpty()) - throw new CustomException(errorMap); - - return paymentRequest.getPayment(); - } - - - public void validateUserInfo(RequestInfo requestInfo, Map errorMap) { - - if (null == requestInfo) { - errorMap.put("INVALID_REQUEST_INFO", "RequestInfo cannot be null"); - } else { - if (null == requestInfo.getUserInfo()) { - errorMap.put("INVALID_USER_INFO", "UserInfo within RequestInfo cannot be null"); - } else { - if (StringUtils.isEmpty(requestInfo.getUserInfo().getUuid())) { - errorMap.put("INVALID_USER_ID", "UUID of the user within RequestInfo cannot be null"); - } - } - } - } - - - /** - * Validations if no transaction exists for this bill No existing receipt should - * be in approved or pending status - *

- * If not, proceed with validateIfReceiptForBillAbsent validations * - * - * @param payments List of payment Details - * @param errorMap Map of errors occurred during validations - */ - private void validateIPaymentForBillPresent(List payments, Map errorMap) { - log.info("receipt present"); - for (Payment payment : payments) { - String paymentStatus = payment.getInstrumentStatus().toString(); - if (paymentStatus.equalsIgnoreCase(APPROVED.toString()) - || paymentStatus.equalsIgnoreCase(APPROVAL_PENDING.toString()) - || paymentStatus.equalsIgnoreCase(REMITTED.toString())) { - errorMap.put("BILL_ALREADY_PAID", "Bill has already been paid or is in pending state"); - return; - } - } - // validateIfReceiptForBillAbsent(errorMap, billDetail); - } - - - private void validateInstrument(Payment payment, Map errorMap) { - - String paymentMode = payment.getPaymentMode().toString(); - if (!PaymentModeEnum.contains(paymentMode)) { - throw new CustomException("INVALID_PAYMENTMODE", "Invalid payment mode provided"); - } - - if (paymentMode.equalsIgnoreCase(InstrumentTypesEnum.CHEQUE.name()) - || paymentMode.equalsIgnoreCase(InstrumentTypesEnum.DD.name()) - || paymentMode.equalsIgnoreCase(InstrumentTypesEnum.OFFLINE_NEFT.name()) - || paymentMode.equalsIgnoreCase(InstrumentTypesEnum.OFFLINE_RTGS.name()) - || paymentMode.equalsIgnoreCase(InstrumentTypesEnum.POSTAL_ORDER.name())) { - - if (isNull(payment.getInstrumentDate())) - errorMap.put("INVALID_INST_DATE", "Instrument Date Input is mandatory for cheque and DD"); - - if (StringUtils.isEmpty(payment.getInstrumentNumber())) - errorMap.put("INVALID_INST_NUMBER", "Instrument Number is mandatory for Cheque, DD, Card"); - - if (paymentMode.equalsIgnoreCase(InstrumentTypesEnum.CHEQUE.name()) - || paymentMode.equalsIgnoreCase(InstrumentTypesEnum.DD.name())) - validateChequeDD(payment, errorMap); - - if (paymentMode.equalsIgnoreCase(InstrumentTypesEnum.OFFLINE_NEFT.name()) - || paymentMode.equalsIgnoreCase(InstrumentTypesEnum.OFFLINE_RTGS.name()) - || paymentMode.equalsIgnoreCase(InstrumentTypesEnum.POSTAL_ORDER.name())) - validateNEFTAndRTGS(payment, errorMap); - - } - - if (paymentMode.equalsIgnoreCase(InstrumentTypesEnum.CARD.name()) || paymentMode.equalsIgnoreCase(InstrumentTypesEnum.ONLINE.name()) - || paymentMode.equalsIgnoreCase(ONLINE_NEFT.name()) || paymentMode.equalsIgnoreCase(ONLINE_RTGS.name())) { - if (org.apache.commons.lang3.StringUtils.isEmpty(payment.getTransactionNumber())) - errorMap.put("INVALID_TXN_NUMBER", "Transaction Number is mandatory for Card and online payment"); - - if (org.apache.commons.lang3.StringUtils.isEmpty(payment.getInstrumentNumber())) - errorMap.put("INVALID_INSTRUMENT_NUMBER", "Instrument Number is mandatory for Card"); - - } - - } - - - private void validateNEFTAndRTGS(Payment payment, Map errorMap){ - - DateTime instrumentDate = new DateTime(payment.getInstrumentDate()); - if (instrumentDate.isAfter(System.currentTimeMillis())) { - errorMap.put(RECEIPT_NEFT_OR_RTGS_DATE, RECEIPT_NEFT_OR_RTGS_DATE_MESSAGE); - } - } - - - private void validateChequeDD(Payment payment, Map errorMap) { - - DateTime instrumentDate = new DateTime(payment.getInstrumentDate()); - - if (payment.getTransactionDate()!=null) { - if (instrumentDate.isAfter(payment.getTransactionDate())) { - errorMap.put(RECEIPT_CHEQUE_OR_DD_DATE, RECEIPT_CHEQUE_OR_DD_DATE_MESSAGE); - } - - Days daysDiff = Days.daysBetween(instrumentDate, new DateTime(payment.getTransactionDate())); - if (daysDiff.getDays() > Integer.valueOf(INSTRUMENT_DATE_DAYS)) { - errorMap.put("CHEQUE_DD_DATE_WITH_MANUAL_RECEIPT_DATE", - CHEQUE_DD_DATE_WITH_MANUAL_RECEIPT_DATE_MESSAGE); - } - - } else { - Days daysDiff = Days.daysBetween(instrumentDate, new DateTime()); - if (daysDiff.getDays() > Integer.valueOf(INSTRUMENT_DATE_DAYS)) { - errorMap.put("CHEQUE_DD_DATE_WITH_RECEIPT_DATE", CHEQUE_DD_DATE_WITH_RECEIPT_DATE_MESSAGE); - } - if (instrumentDate.isAfter(new DateTime().getMillis())) { - errorMap.put("CHEQUE_DD_DATE_WITH_FUTURE_DATE", CHEQUE_DD_DATE_WITH_FUTURE_DATE_MESSAGE); - } - } - - } - - public List validateAndEnrichPaymentsForUpdate(List payments, RequestInfo requestInfo) { - - Map errorMap = new HashMap<>(); - - - Set paymentIds = payments.stream().map(Payment::getId).collect(Collectors.toSet()); - - List paymentsFromDb = paymentRepository.fetchPayments(PaymentSearchCriteria - .builder() - .ids(paymentIds) - .offset(0).limit(applicationProperties.getReceiptsSearchDefaultLimit()) - .instrumentStatus(InstrumentStatusEnum.statusesByCategory(InstrumentStatusEnum.Category.OPEN)) - .build()); - - Map paymentsById = paymentsFromDb.stream() - .collect(Collectors.toMap(Payment::getId, Function.identity())); - - for (Payment payment : payments) { - if (paymentsById.containsKey(payment.getId())) { - - Payment paymentFromDb = paymentsById.get(payment.getId()); - - Map billIdToPaymentDetailDB = paymentFromDb.getPaymentDetails().stream().collect(Collectors.toMap(PaymentDetail::getBillId,Function.identity())); - - paymentFromDb.setAdditionalDetails(jsonMerge(paymentFromDb.getAdditionalDetails(), - payment.getAdditionalDetails())); - - if (paymentFromDb.getPaymentMode().toString().equalsIgnoreCase(InstrumentTypesEnum.CHEQUE.toString()) - || paymentFromDb.getPaymentMode().toString().equalsIgnoreCase(InstrumentTypesEnum.DD.toString())){ - validateChequeDD(payment, errorMap); - } - - for(PaymentDetail paymentDetail : payment.getPaymentDetails()) { - - Bill bill = paymentDetail.getBill(); - - Bill billFromDB = billIdToPaymentDetailDB.get(bill.getId()).getBill(); - - Map idToBillDetailDBMap = billFromDB.getBillDetails().stream().collect(Collectors.toMap(BillDetail::getId,Function.identity())); - - if (!isEmpty(bill.getPaidBy())) - billFromDB.setPaidBy(bill.getPaidBy()); - - if (!isEmpty(bill.getPayerAddress())) - billFromDB.setPayerAddress(bill.getPayerAddress()); - - if (!isEmpty(bill.getPayerEmail())) - billFromDB.setPayerEmail(bill.getPayerEmail()); - - if (!isEmpty(bill.getPayerName())) { - billFromDB.setPayerName(bill.getPayerName()); - } - - Map idToBillDetailMap = billFromDB.getBillDetails().stream().collect(Collectors.toMap(BillDetail::getId,Function.identity())); - - - for(BillDetail billDetail : bill.getBillDetails()){ - - BillDetail billDetailFromDb = idToBillDetailDBMap.get(billDetail.getId()); - - if (!StringUtils.isEmpty(billDetail.getVoucherHeader())) - billDetailFromDb.setVoucherHeader(billDetail.getVoucherHeader()); - - billDetailFromDb.setAdditionalDetails( - jsonMerge(billDetailFromDb.getAdditionalDetails(), billDetail.getAdditionalDetails())); - - - - // If change to manual receipt date or manual receipt number, and instrument is - // Cheque / DD revalidate - - if (!isEmpty(billDetail.getManualReceiptNumber())) - billDetailFromDb.setManualReceiptNumber(billDetail.getManualReceiptNumber()); - - if (!isNull(billDetail.getManualReceiptDate()) && billDetail.getManualReceiptDate() != 0L) - billDetailFromDb.setManualReceiptDate(billDetail.getManualReceiptDate()); - - // Temporary code block below, to enable backward compatibility with previous - // API - - if (!isEmpty(payment.getInstrumentStatus()) - && payment.getInstrumentStatus().toString().equalsIgnoreCase(REMITTED.toString())) { - InstrumentStatusEnum instrumentStatusInDB = paymentFromDb.getInstrumentStatus(); - if (!isNull(instrumentStatusInDB) && !instrumentStatusInDB.equals(REMITTED)) { - if (instrumentStatusInDB.isCategory(InstrumentStatusEnum.Category.OPEN)) { - paymentFromDb.setInstrumentStatus(REMITTED); - billDetailFromDb.setVoucherHeader(billDetail.getVoucherHeader()); - paymentFromDb.setPaymentStatus(PaymentStatusEnum.DEPOSITED); - } else { - errorMap.put("PAYMENT_WORKFLOW_INVALID_PAYMENT", - "Payment not found in the system or not in editable state, " - + payment.getId()); - } - } - } - } - } - paymentWorkflowService.updateAuditDetails(paymentFromDb, requestInfo); - - } else { - log.error("Receipt not found with receipt number {} or not in editable status ", - payment.getId()); - errorMap.put("RECEIPT_UPDATE_NOT_FOUND", - "Receipt not found in the system or not in editable state, " + payment.getId()); - } - } - - if (!errorMap.isEmpty()) - throw new CustomException(errorMap); - else - return paymentsFromDb; - - } - - - /** - * Validates the paymentDetail with the bill - * - * @param paymentMode - * The payment mode - * @param paymentDetail - * The payment detail for the bill - * @param errorMap - * Error map to catch errors - */ - private void validatePaymentDetailAgainstBill(String paymentMode, PaymentDetail paymentDetail, - Map errorMap) { - - Bill bill = paymentDetail.getBill(); - - // If IsAdvanceAllowed is null it is interpretated as not allowed - Boolean isAdvanceAllowed = !(bill.getIsAdvanceAllowed() == null || !bill.getIsAdvanceAllowed()); - - // Total amount to be paid should be same in bill and paymentDetail - if (paymentDetail.getTotalDue().compareTo(bill.getTotalAmount()) != 0) - errorMap.put("INVALID_PAYMENTDETAIL", - "The amount to be paid is mismatching with bill for paymentDetial with bill id: " + bill.getId()); - - - // If advance is not allowed bill total amount should be positive integer - if(!isAdvanceAllowed && !Utils.isPositiveInteger(paymentDetail.getBill().getTotalAmount())) - errorMap.put("INVALID_BILL_AMOUNT","The bill amount of bill: "+paymentDetail.getBill().getId()+" is fractional or less than zero"); - - // Amount to be paid should be greater than minimum collection amount - if (bill.getMinimumAmountToBePaid() != null - && paymentDetail.getTotalAmountPaid().compareTo(bill.getMinimumAmountToBePaid()) == -1) - errorMap.put("INVALID_PAYMENTDETAIL", - "The amount to be paid cannot be less than minimum amount to be paid"); - - // In case of partial payment checks if it is allowed in bill - if ((bill.getPartPaymentAllowed() == null || !bill.getPartPaymentAllowed()) - && paymentDetail.getTotalAmountPaid().compareTo(bill.getTotalAmount()) == -1) - errorMap.put("INVALID_PAYMENTDETAIL", "The amount to be paid is less than amount due"); - - // In case of advance payment checks if it is allowed in bill - if ((bill.getIsAdvanceAllowed() == null || !bill.getIsAdvanceAllowed()) - && paymentDetail.getTotalAmountPaid().compareTo(bill.getTotalAmount()) == 1) - errorMap.put("INVALID_PAYMENTDETAIL", "The amount to be paid is more than amount due"); - - // Checks if the payment mode is allowed by the bill - if (!CollectionUtils.isEmpty(bill.getCollectionModesNotAllowed()) - && bill.getCollectionModesNotAllowed().contains(paymentMode)) - errorMap.put("INVALID_PAYMENTDETAIL", - "The paymentMode: " + paymentMode + " is not allowed for the bill: " + bill.getId()); - - // Checks if the amount paid is positive integer - if (!Utils.isPositiveInteger(paymentDetail.getTotalAmountPaid())) - errorMap.put("INVALID_PAYMENTDETAIL", - "The amount paid for the paymentDetail with bill number: " + paymentDetail.getBillId()); - - // Zero amount payment is allowed only if bill amount is not positive - if (paymentDetail.getTotalAmountPaid().compareTo(BigDecimal.ZERO) == 0 - && bill.getTotalAmount().compareTo(BigDecimal.ZERO) > 0) - errorMap.put("INVALID_PAYMENTDETAIL", - "The amount paid for the paymentDetail with bill number: " + paymentDetail.getBillId()); - - // Checks if the amount to be paid is fractional - if ((bill.getTotalAmount().remainder(BigDecimal.ONE)).doubleValue() != 0) - errorMap.put("INVALID_BILL", "The due amount cannot be fractional"); - - // Checks if the amount paid is fractional - if ((paymentDetail.getTotalAmountPaid().remainder(BigDecimal.ONE)).doubleValue() != 0) - errorMap.put("INVALID_PAYMENTDETAIL", "The amount paid cannot be fractional"); - - // Checks if the bill is expired - bill.getBillDetails().forEach(billDetail -> { - if (isNull(billDetail.getExpiryDate()) || System.currentTimeMillis() >= billDetail.getExpiryDate()) { - errorMap.put("BILL_EXPIRED", "Bill expired or invalid, regenerate bill!"); - } - }); - - } - - /** - * method to validate and update search request information based on APP configs - * checks for requestInfo - * verifies if requester is citizen and validates the module-name path for employee - * adds default status and module-name to criteria if applicable - * - * @param paymentSearchCriteria - * @param requestInfo - * @param moduleName - */ - public void validateAndUpdateSearchRequestFromConfig(PaymentSearchCriteria paymentSearchCriteria, RequestInfo requestInfo, String moduleName) { - - Map errorMap = new HashMap<>(); - validateUserInfo(requestInfo, errorMap); - if (!errorMap.isEmpty()) - throw new CustomException(errorMap); - - Boolean isRequesterEmployee = requestInfo.getUserInfo().getType() - .equalsIgnoreCase(CollectionServiceConstants.EMPLOYEE_TYPE); - if (isRequesterEmployee && applicationProperties.getIsModuleNameMandatoryInSearchUriForEmployee() - && null == moduleName) - throw new CustomException("EGCL_URI_EXCEPTION", "Path variable module name is mandatory for employees"); - - /* - * Only Applicable if there is no receipt number search - * Only Applicable when search ignore status has been defined in application properties - * Only Applicable when status has not been already provided for the search - */ - if ((CollectionUtils.isEmpty(paymentSearchCriteria.getReceiptNumbers())) - && !applicationProperties.getSearchIgnoreStatus().isEmpty() - && (CollectionUtils.isEmpty(paymentSearchCriteria.getStatus()))) { - - // Do not return ignored status for receipts by default - Set defaultStatus = new HashSet<>(); - for (PaymentStatusEnum paymentStatus : PaymentStatusEnum.values()) { - - if (!applicationProperties.getSearchIgnoreStatus().contains(paymentStatus.toString())) { - defaultStatus.add(paymentStatus.toString()); - } - } - paymentSearchCriteria.setStatus(defaultStatus); - } - - if (null != moduleName) { - - if (CollectionUtils.isEmpty(paymentSearchCriteria.getBusinessServices())) { - paymentSearchCriteria.setBusinessServices(Stream.of(moduleName).collect(Collectors.toSet())); - } else { - paymentSearchCriteria.getBusinessServices().add(moduleName); - } - } - } - - /*** - * This method will validate the ifsc code and fetch the bank details and add - * those details in payment additionaldetails - * - * @param payments - * @param errorMap - */ - - private void validateIFSCCode(PaymentRequest paymentRequest) { - // TODO Auto-generated method stub - JsonNode razorPayIfscSearchResponse = null; - if (paymentRequest.getPayment().getIfscCode() != null) { - - String response = serviceRequestRepository - .fetchGetResult(applicationProperties.getRazorPayUrl() + paymentRequest.getPayment().getIfscCode()); - ObjectNode objectNode = (ObjectNode) paymentRequest.getPayment().getAdditionalDetails(); - if (objectNode == null) { - ObjectMapper mapper = new ObjectMapper(); - objectNode = mapper.createObjectNode(); - - try { - razorPayIfscSearchResponse = mapper.readTree(response); - } catch (JsonProcessingException e) { - throw new CustomException("INVALID_PROCESS_EXCEPTION", e.getMessage()); - - } - objectNode.set("bankDetails", razorPayIfscSearchResponse); - paymentRequest.getPayment().setAdditionalDetails(objectNode); - } - - } - - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/util/PaymentWorkflowValidator.java b/business-services/collection-services/src/main/java/org/egov/collection/util/PaymentWorkflowValidator.java deleted file mode 100644 index 2deb828aad2..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/util/PaymentWorkflowValidator.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.egov.collection.util; - -import lombok.extern.slf4j.Slf4j; -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentDetail; -import org.egov.collection.web.contract.PaymentWorkflow; -import org.egov.tracer.model.CustomException; -import org.springframework.stereotype.Component; - -import java.util.*; - -import static java.util.Collections.reverseOrder; - -@Component -@Slf4j -public class PaymentWorkflowValidator { - - - - - public List validateForRemit(List paymentWorkflows, List payments){ - - Map paymentsById = new HashMap<>(); - - for (Payment payment : payments){ - paymentsById.put(payment.getId(), payment); - } - - return doPaymentsExist(paymentWorkflows, paymentsById); - - } - - - public List validateForCancel(List paymentWorkflows, List payments){ - payments.sort(reverseOrder(Comparator.comparingLong(Payment::getTransactionDate))); - - Map errorMap = new HashMap<>(); - Map paymentById = new HashMap<>(); - Map> paymentsByConsumerCode = new HashMap<>(); - - for (Payment payment : payments){ - - paymentById.put(payment.getId(), payment); - - payment.getPaymentDetails().forEach(paymentDetail -> { - if (paymentsByConsumerCode.containsKey(paymentDetail.getBill().getConsumerCode())){ - paymentsByConsumerCode.get(paymentDetail.getBill().getConsumerCode()).add(payment); - } - else{ - LinkedList temp = new LinkedList<>(); - temp.add(payment); - paymentsByConsumerCode.put(paymentDetail.getBill().getConsumerCode(), temp); - } - }); - - } - List paymentsToProcess = doPaymentsExist(paymentWorkflows, paymentById); - - paymentsToProcess.sort(Collections.reverseOrder(Comparator.comparingLong(Payment::getTransactionDate))); - - for (Payment payment: paymentsToProcess){ - for(PaymentDetail paymentDetail : payment.getPaymentDetails()) - if(paymentsByConsumerCode.containsKey(paymentDetail.getBill().getConsumerCode()) && - paymentsByConsumerCode.get(paymentDetail.getBill().getConsumerCode()).getFirst().getId() - .equalsIgnoreCase(payment.getId())){ - paymentsByConsumerCode.get(paymentDetail.getBill().getConsumerCode()).removeFirst(); - } - else { - log.error("Payment not the latest payment for the consumer code {} , perform operation for {} first ", - paymentDetail.getBill().getConsumerCode(), paymentsByConsumerCode.get(paymentDetail.getBill().getConsumerCode()).getFirst() - .getId()); - errorMap.put("RECEIPT_WORKFLOW_ACTION_NOT_APPLICABLE", "Can only cancel / dishonour latest receipt " + - "for a consumer code. Dishonour of receipt possible only after deposited! "); - } - - } - - if(!errorMap.isEmpty()) - throw new CustomException(errorMap); - - return paymentsToProcess; - } - - private List doPaymentsExist(List paymentWorkflows, Map paymentById){ - Map errorMap = new HashMap<>(); - List paymentsToProcess = new ArrayList<>(); - - for(PaymentWorkflow current : paymentWorkflows){ - if(!paymentById.containsKey(current.getPaymentId())){ - log.error("Payment not found with paymentId {} or not in editable status ", current.getPaymentId()); - errorMap.put("RECEIPT_WORKFLOW_INVALID_RECEIPT", - "Payment not found in the system or not in editable state, "+current.getPaymentId()); - } else { - paymentsToProcess.add(paymentById.get(current.getPaymentId())); - } - } - - if(!errorMap.isEmpty()) - throw new CustomException(errorMap); - else - return paymentsToProcess; - } - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/util/ReceiptEnricher.java b/business-services/collection-services/src/main/java/org/egov/collection/util/ReceiptEnricher.java deleted file mode 100644 index 4fd54d10a2e..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/util/ReceiptEnricher.java +++ /dev/null @@ -1,479 +0,0 @@ -/* -package org.egov.collection.util; - -import static java.util.Objects.isNull; -import static org.egov.collection.model.enums.InstrumentTypesEnum.CARD; -import static org.egov.collection.model.enums.InstrumentTypesEnum.CASH; -import static org.egov.collection.model.enums.InstrumentTypesEnum.ONLINE; -import static org.egov.collection.model.enums.ReceiptStatus.APPROVED; -import static org.egov.collection.model.enums.ReceiptStatus.REMITTED; - -import java.math.BigDecimal; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.collection.model.*; -import org.egov.collection.model.enums.CollectionType; -import org.egov.collection.model.enums.InstrumentStatusEnum; -import org.egov.collection.model.enums.Purpose; -import org.egov.collection.model.enums.ReceiptType; -import org.egov.collection.repository.BillingServiceRepository; -import org.egov.collection.repository.BusinessDetailsRepository; -import org.egov.collection.repository.IdGenRepository; -import org.egov.collection.repository.InstrumentRepository; -import org.egov.collection.web.contract.Bill; -import org.egov.collection.web.contract.BillAccountDetail; -import org.egov.collection.web.contract.BillDetail; -import org.egov.collection.web.contract.BusinessDetailsResponse; -import org.egov.collection.web.contract.TaxAndPayment; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class ReceiptEnricher { - private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy"); - private BillingServiceRepository billingRepository; - private InstrumentRepository instrumentRepository; - private IdGenRepository idGenRepository; - private BusinessDetailsRepository businessDetailsRepository; - - @Autowired - public ReceiptEnricher(BillingServiceRepository billingRepository, InstrumentRepository instrumentRepository, - IdGenRepository idGenRepository, BusinessDetailsRepository businessDetailsRepository) { - this.billingRepository = billingRepository; - this.instrumentRepository = instrumentRepository; - this.idGenRepository = idGenRepository; - this.businessDetailsRepository = businessDetailsRepository; - } - - */ -/** - * Fetch instruments from financials for the given receipts - * - * @param requestInfo Request Info for the request - * @param receipts Receipts to be enriched - *//* - - public void enrichReceiptsWithInstruments(RequestInfo requestInfo, List receipts) { - Set instruments = receipts.stream().map(receipt -> receipt.getInstrument().getId()).collect(Collectors - .toSet()); - List fetchedInstruments = instrumentRepository.searchInstruments(String.join(",", instruments), - requestInfo); - - Map map = fetchedInstruments.stream().collect(Collectors.toMap(Instrument::getId, - instrument -> instrument)); - - receipts.forEach(receipt -> receipt.setInstrument(map.get(receipt.getInstrument().getId()))); - } - - */ -/** - * Fetch bill from billing service for the provided bill id - * Ensure bill exists and amount paid details exist for all bill details - * Set paid by and amount paid for each bill detail in the new validated bill - * - * @param receiptReq Receipt to be enriched - *//* - - */ -/* public void enrichReceiptPreValidate(ReceiptReq receiptReq) { - - Receipt receipt = receiptReq.getReceipt().get(0); - Bill billFromRequest = receipt.getBill().get(0); - - if (isNull(receiptReq.getRequestInfo().getUserInfo()) || isNull(receiptReq.getRequestInfo().getUserInfo() - .getId())) { - throw new CustomException("USER_INFO_INVALID", "Invalid user info in request info, user id is mandatory"); - } - - List validatedBills = billingRepository.fetchBill(receiptReq.getRequestInfo(), receipt.getTenantId(), billFromRequest.getId - ()); - - if (validatedBills.isEmpty() || Objects.isNull(validatedBills.get(0).getBillDetails()) || validatedBills.get(0) - .getBillDetails().isEmpty()) { - log.error("Bill ID provided does not exist or is in an invalid state " + billFromRequest.getId()); - throw new CustomException("INVALID_BILL_ID", "Bill ID provided does not exist or is in an invalid state"); - } - - if (validatedBills.get(0).getBillDetails().size() != billFromRequest.getBillDetails().size()) { - log.error("Mismatch in bill details records provided in request and actual bill. Expected {} billdetails " + - "found {} in request", billFromRequest.getBillDetails().size(), validatedBills.get(0) - .getBillDetails().size()); - throw new CustomException("INVALID_BILL_DETAILS", "Mismatch in bill detail records provided in request " + - "and actual bill"); - - } - - Long expiryDate = validatedBills.get(0).getBillDetails().get(0).getExpiryDate(); - if (isNull(expiryDate) || System.currentTimeMillis() >= expiryDate) { - throw new CustomException("BILL_EXPIRED", "Bill expired or invalid, regenerate bill!"); - } - - Bill validatedBill = validatedBills.get(0); - validatedBill.setPaidBy(billFromRequest.getPaidBy()); - validatedBill.setPayerName(billFromRequest.getPayerName()); - validatedBill.setMobileNumber(billFromRequest.getMobileNumber()); - validatedBill.setPayerAddress(billFromRequest.getPayerAddress()); - - validatedBill.getBillDetails().sort(Comparator.comparing(BillDetail::getId)); - billFromRequest.getBillDetails().sort(Comparator.comparing(BillDetail::getId)); - - validateTaxAndPayment(billFromRequest, validatedBill); - - for (int i = 0; i < validatedBill.getBillDetails().size(); i++) { - validatedBill.getBillDetails().get(i).setAmountPaid(billFromRequest.getBillDetails().get(i).getAmountPaid()); - - validatedBill.getBillDetails().get(i).setManualReceiptNumber(billFromRequest.getBillDetails().get(i) - .getManualReceiptNumber()); - - validatedBill.getBillDetails().get(i).setManualReceiptDate(billFromRequest.getBillDetails().get(i).getManualReceiptDate()); - - if (receipt.getInstrument().getInstrumentType().getName().equalsIgnoreCase(ONLINE.name())) - validatedBill.getBillDetails().get(i).setCollectionType(CollectionType.ONLINE); - else - validatedBill.getBillDetails().get(i).setCollectionType(CollectionType.COUNTER); - - if (Objects.isNull(validatedBill.getBillDetails().get(i).getReceiptDate())) - validatedBill.getBillDetails().get(i).setReceiptDate(new Date().getTime()); - - validatedBill.getBillDetails().get(i).setReceiptType(ReceiptType.BILLBASED.toString()); - - validatedBill.getBillDetails().get(i).setAdditionalDetails(billFromRequest.getBillDetails().get(i).getAdditionalDetails()); - - enrichBillAccountDetails(validatedBill.getBillDetails().get(i), billFromRequest.getBillDetails().get(i)); - - } - - AuditDetails auditDetails = AuditDetails.builder().createdBy(receiptReq.getRequestInfo().getUserInfo().getId - ().toString()).createdDate(System.currentTimeMillis()).lastModifiedBy(receiptReq.getRequestInfo().getUserInfo().getId - ().toString()).lastModifiedDate(System.currentTimeMillis()).build(); - receipt.setBill(validatedBills); - receipt.setAuditDetails(auditDetails); - List receipts = new ArrayList<>(); - receipts.add(receipt); - receiptReq.setReceipt(receipts); - }*//* - - - - - public void enrichPaymentPreValidate(PaymentRequest paymentRequest) { - - Payment payment = paymentRequest.getPayment(); - List billIds = payment.getPaymentDetails().stream().map(PaymentDetail::getBillId).collect(Collectors.toList()); - - AuditDetails auditDetails = AuditDetails.builder().createdBy(paymentRequest.getRequestInfo().getUserInfo().getId - ().toString()).createdDate(System.currentTimeMillis()).lastModifiedBy(paymentRequest.getRequestInfo().getUserInfo().getId - ().toString()).lastModifiedDate(System.currentTimeMillis()).build(); - - if (isNull(paymentRequest.getRequestInfo().getUserInfo()) || isNull(paymentRequest.getRequestInfo().getUserInfo() - .getId())) { - throw new CustomException("USER_INFO_INVALID", "Invalid user info in request info, user id is mandatory"); - } - - List validatedBills = billingRepository.fetchBill(paymentRequest.getRequestInfo(), payment.getTenantId(), billIds); - - Map billIdToBillMap = new HashMap<>(); - - Map errorMap = new HashMap<>(); - - // If the bills is non-empty list payer info is added to the bil - if(CollectionUtils.isEmpty(validatedBills)) - errorMap.put("INVALID_BILL_ID", "Bill ID provided does not exist or is in an invalid state"); - else - validatedBills.forEach(bill -> { - billIdToBillMap.put(bill.getId(), bill); - if (CollectionUtils.isEmpty(bill.getBillDetails())) { - log.error("Bill ID provided does not exist or is in an invalid state " + bill.getId()); - errorMap.put("INVALID_BILL_ID", "Bill ID provided does not exist or is in an invalid state"); - } - else { - bill.setPaidBy(payment.getPaidBy()); - bill.setPayerName(payment.getPayerName()); - bill.setMobileNumber(payment.getMobileNumber()); - bill.setPayerAddress(payment.getPayerAddress()); - } - }); - - // Assigns bill object to each paymentDetail if no bill object is found the billId from paymentDetail is added in error map - payment.getPaymentDetails().forEach(paymentDetail -> { - if(billIdToBillMap.get(paymentDetail.getBillId())==null) - errorMap.put("INVALID PAYMENTDETAIL","No bill found for the bill id: "+paymentDetail.getBillId()); - else { - validatePaymentDetailAgainstBill(payment.getPaymentMode(),billIdToBillMap.get(paymentDetail.getBillId()),paymentDetail,errorMap); - paymentDetail.setBill(billIdToBillMap.get(paymentDetail.getBillId())); - paymentDetail.setId(UUID.randomUUID().toString()); - } - }); - - if(!errorMap.isEmpty()) - throw new CustomException(errorMap); - - - - payment.setAuditDetails(auditDetails); - - } - - - - - - - */ -/** - * Fetches bill based on businessservice - * - * @param validatedBill - * @param businessService - * @return - *//* - - public List getBillForBusinessService(List validatedBill, String businessService) { - List bills = new LinkedList<>(); - validatedBill.forEach(bill -> { - if(bill.getBusinessService().equalsIgnoreCase(businessService)) - bills.add(bill); - }); - return bills; - } - - - */ -/** - * Fetches business details for given bill detail business service - * - * @param requestInfo Request Info of the request - * @param billDetail Bill Detail for which business service to be fetched - *//* - - private void enrichBusinessService(RequestInfo requestInfo, BillDetail billDetail) { - BusinessDetailsResponse businessDetailsResponse = businessDetailsRepository.getBusinessDetails(Collections.singletonList(billDetail.getBusinessService()), - billDetail.getTenantId(), requestInfo); - - if (isNull(businessDetailsResponse.getBusinessDetails()) || businessDetailsResponse - .getBusinessDetails().isEmpty()) { - log.error("Business detail not found for {} and tenant {}", billDetail.getBusinessService(), billDetail - .getTenantId()); - throw new CustomException("BUSINESS_DETAILS_INVALID", "fetch buisness details, common masters failed to return fund, function, department and fundsource"); - } else { - // billDetail.setReceiptType(businessDetailsResponse.getBusinessDetails().get(0).getBusinessType()); - billDetail.setFund(businessDetailsResponse.getBusinessDetails().get(0).getFund()); - billDetail.setFunction(businessDetailsResponse.getBusinessDetails().get(0).getFunction()); - billDetail.setDepartment(businessDetailsResponse.getBusinessDetails().get(0).getDepartment()); - } - } - - - */ -/** - * Enrich instrument for financials - * For each bill detail, - * - Set status to approved by default for now, no workflow - * - Set collection type to online or counter - * - Set receipt date - * - Generate and set receipt number - * - * @param receiptReq Receipt request to be enriched - *//* - - public void enrichReceiptPostValidate(ReceiptReq receiptReq) { - Receipt receipt = receiptReq.getReceipt().get(0); - Bill bill = receipt.getBill().get(0); - String instrumentType = receipt.getInstrument().getInstrumentType().getName(); - - for (BillDetail billDetail : bill.getBillDetails()) { - billDetail.setId(UUID.randomUUID().toString()); - - if (instrumentType.equalsIgnoreCase(ONLINE.name()) || instrumentType.equalsIgnoreCase(CARD.name())) - billDetail.setStatus(REMITTED.toString()); - else - billDetail.setStatus(APPROVED.toString()); - - String receiptNumber = idGenRepository.generateReceiptNumber(receiptReq.getRequestInfo(), billDetail.getBusinessService(), - billDetail.getTenantId()); - billDetail.setReceiptNumber(receiptNumber); - - for (BillAccountDetail billAccountDetail : billDetail.getBillAccountDetails()) { - billAccountDetail.setId(UUID.randomUUID().toString()); - } - } - enrichInstrument(receiptReq); - - List receipts = new ArrayList<>(); - receipts.add(receipt); - receiptReq.setReceipt(receipts); - - } - - */ -/** - * Enrich the instrument object, - * - In case of cash / card [append card digits], generate transaction number - * - In case of online, dd, cheque use given txn number, and date - * - * @param receiptReq Receipt request to be enriched - *//* - - private void enrichInstrument(ReceiptReq receiptReq) { - Receipt receipt = receiptReq.getReceipt().get(0); - String instrumentType = receipt.getInstrument().getInstrumentType().getName(); - - Instrument instrument = receipt.getInstrument(); - instrument.setId(UUID.randomUUID().toString()); - instrument.setTransactionType(TransactionType.Debit); - instrument.setTenantId(receipt.getTenantId()); - instrument.setPayee(receipt.getBill().get(0).getPayerName()); - - instrument.setInstrumentDate(instrument.getTransactionDateInput()); - - - if (instrumentType.equalsIgnoreCase(CASH.name())) { - String transactionId = idGenRepository.generateTransactionNumber(receiptReq.getRequestInfo(), - receipt.getTenantId()); - instrument.setTransactionNumber(transactionId); - } - - if (instrumentType.equalsIgnoreCase(CASH.name()) || instrumentType.equalsIgnoreCase(CARD.name())) { - - instrument.setTransactionDateInput(new Date().getTime()); - instrument.setTransactionDate(new Date()); - - } else { - instrument.setTransactionDate(new Date(instrument.getTransactionDateInput())); - } - - if (instrumentType.equalsIgnoreCase(ONLINE.name()) || instrumentType.equalsIgnoreCase(CARD.name())) - instrument.setInstrumentStatus(InstrumentStatusEnum.DEPOSITED); - else - instrument.setInstrumentStatus(InstrumentStatusEnum.NEW); - - receipt.setTransactionId(instrument.getTransactionNumber()); - - List receipts = new ArrayList<>(); - receipts.add(receipt); - receiptReq.setReceipt(receipts); - } - - */ -/** - * Enrich the bill account details object - * - Copy over additional details received part of request to validated bill - * - * @param validatedBillDetail Validated bill detail from billing service - * @param billDetailFromRequest Bill detail from request - *//* - - private void enrichBillAccountDetails(BillDetail validatedBillDetail, BillDetail billDetailFromRequest) { - if (!Objects.isNull(billDetailFromRequest.getBillAccountDetails()) && billDetailFromRequest - .getBillAccountDetails().size() == validatedBillDetail.getBillAccountDetails().size()) { - - billDetailFromRequest.getBillAccountDetails().sort(Comparator.comparing(BillAccountDetail::getId)); - validatedBillDetail.getBillAccountDetails().sort(Comparator.comparing(BillAccountDetail::getId)); - - for (int i = 0; i < validatedBillDetail.getBillAccountDetails().size(); i++) { - validatedBillDetail.getBillAccountDetails().get(i).setAdditionalDetails(billDetailFromRequest - .getBillAccountDetails().get(i).getAdditionalDetails()); - } - } - } - - */ -/** - * Apportion adds another billAccDetail for Advance tax head when advance amt is paid, this method enriches that object - * - * @param bills - *//* - - public void enrichAdvanceTaxHead(Map> bills) { - for (String tenantId : bills.keySet()) { - bills.get(tenantId).forEach(bill -> { - bill.getBillDetails().forEach(billDetail -> { - billDetail.getBillAccountDetails().forEach(billAccountDetail -> { - if (StringUtils.isEmpty(billAccountDetail.getId()) && billAccountDetail.getPurpose().equals(Purpose.ADVANCE)) { - billAccountDetail.setId(UUID.randomUUID().toString()); - billAccountDetail.setTenantId(tenantId); - billAccountDetail.setBillDetail(billDetail.getId()); - } - }); - }); - }); - } - } - - - */ -/** - * Validates the paymentDetail with the bill - * @param paymentMode The payment mode - * @param bill Bill against which payment is made - * @param paymentDetail The payment detail for the bill - * @param errorMap Error map to catch errors - *//* - - private void validatePaymentDetailAgainstBill(String paymentMode,Bill bill,PaymentDetail paymentDetail,Map errorMap){ - - // Total amount to be paid should be same in bill and paymentDetail - if(paymentDetail.getTotalDue().compareTo(bill.getTotalAmount())!=0) - errorMap.put("INVALID_PAYMENTDETAIL","The amount to be paid is mismatching with bill for paymentDetial with bill id: "+bill.getId()); - - // Amount to be paid should be grater than minimum collection amount - if(bill.getMinimumAmountToBePaid() != null && paymentDetail.getTotalAmountPaid().compareTo(bill.getMinimumAmountToBePaid())==-1) - errorMap.put("INVALID_PAYMENTDETAIL","The amount to be paid cannot be less than minimum amount to be paid"); - - // In case of partial payment checks if it is allowed in bill - if((bill.getPartPaymentAllowed()==null || !bill.getPartPaymentAllowed()) - && paymentDetail.getTotalAmountPaid().compareTo(bill.getTotalAmount())==-1) - errorMap.put("INVALID_PAYMENTDETAIL","The amount to be paid is less than amount due"); - - // In case of advance payment checks if it is allowed in bill - if((bill.getIsAdvanceAllowed()==null || !bill.getIsAdvanceAllowed()) - && paymentDetail.getTotalAmountPaid().compareTo(bill.getTotalAmount())==1) - errorMap.put("INVALID_PAYMENTDETAIL","The amount to be paid is more than amount due"); - - // Checks if the payment mode is allowed by the bill - if(!CollectionUtils.isEmpty(bill.getCollectionModesNotAllowed()) && bill.getCollectionModesNotAllowed().contains(paymentMode)) - errorMap.put("INVALID_PAYMENTDETAIL","The paymentMode: "+paymentMode+" is not allowed for the bill: "+bill.getId()); - - // Checks if the amount paid is not negative - if(paymentDetail.getTotalAmountPaid().compareTo(BigDecimal.ZERO)<0) - errorMap.put("INVALID_PAYMENTDETAIL","The amount paid for the paymentDetail with bill number: "+paymentDetail.getBillId()); - - // Zero amount payment is allowed only if bill amount is zero - if(paymentDetail.getTotalAmountPaid().compareTo(BigDecimal.ZERO)==0 && bill.getTotalAmount().compareTo(BigDecimal.ZERO) > 0) - errorMap.put("INVALID_PAYMENTDETAIL","The amount paid for the paymentDetail with bill number: "+paymentDetail.getBillId()); - - // Checks if the amount to be paid is fractional - if((bill.getTotalAmount().divide(BigDecimal.ONE)).doubleValue()!=0) - errorMap.put("INVALID_BILL","The due amount cannot be fractional"); - - // Checks if the amount paid is fractional - if((paymentDetail.getTotalAmountPaid().divide(BigDecimal.ONE)).doubleValue()!=0) - errorMap.put("INVALID_PAYMENTDETAIL","The amount paid cannot be fractional"); - - // Checks if the bill is expired - bill.getBillDetails().forEach(billDetail -> { - if (isNull(billDetail.getExpiryDate()) || System.currentTimeMillis() >= billDetail.getExpiryDate()) { - errorMap.put("BILL_EXPIRED", "Bill expired or invalid, regenerate bill!"); - } - }); - - } - - - - private void enrichPaymentDetail(PaymentDetail paymentDetail){} - - - -} -*/ diff --git a/business-services/collection-services/src/main/java/org/egov/collection/util/RemittanceEnricher.java b/business-services/collection-services/src/main/java/org/egov/collection/util/RemittanceEnricher.java deleted file mode 100644 index f737f8682f8..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/util/RemittanceEnricher.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.egov.collection.util; - -import java.util.UUID; - -import org.egov.collection.model.AuditDetails; -import org.egov.collection.model.enums.RemittanceStatus; -import org.egov.collection.web.contract.Remittance; -import org.egov.collection.web.contract.RemittanceDetail; -import org.egov.collection.web.contract.RemittanceInstrument; -import org.egov.collection.web.contract.RemittanceReceipt; -import org.egov.collection.web.contract.RemittanceRequest; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class RemittanceEnricher { - - public void enrichRemittancePreValidate(RemittanceRequest remittanceRequest) { - Remittance remittance = remittanceRequest.getRemittances().get(0); - - remittance.setId(UUID.randomUUID().toString().replace("-", "")); - remittance.setStatus(RemittanceStatus.APPROVED.name()); - AuditDetails auditDetails = AuditDetails.builder().createdBy(remittanceRequest.getRequestInfo().getUserInfo() != null - ? remittanceRequest.getRequestInfo().getUserInfo().getId().toString() : null) - .createdTime(System.currentTimeMillis()).lastModifiedBy(remittanceRequest.getRequestInfo().getUserInfo() != null - ? remittanceRequest.getRequestInfo().getUserInfo().getId().toString() : null) - .lastModifiedTime(System.currentTimeMillis()).build(); - remittance.setAuditDetails(auditDetails); - - for (RemittanceDetail rd : remittance.getRemittanceDetails()) { - rd.setId(UUID.randomUUID().toString().replace("-", "")); - rd.setRemittance(remittance.getId()); - rd.setTenantId(remittance.getTenantId()); - } - - for (RemittanceInstrument ri : remittance.getRemittanceInstruments()) { - ri.setId(UUID.randomUUID().toString().replace("-", "")); - ri.setRemittance(remittance.getId()); - ri.setTenantId(remittance.getTenantId()); - } - - for (RemittanceReceipt rr : remittance.getRemittanceReceipts()) { - rr.setId(UUID.randomUUID().toString().replace("-", "")); - rr.setRemittance(remittance.getId()); - rr.setTenantId(remittance.getTenantId()); - } - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/util/Utils.java b/business-services/collection-services/src/main/java/org/egov/collection/util/Utils.java deleted file mode 100644 index 2851cf1e517..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/util/Utils.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.collection.util; - -import static java.util.Objects.isNull; - -import java.math.BigDecimal; -import java.util.Iterator; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; - -public class Utils { - - private Utils(){} - - public static JsonNode jsonMerge(JsonNode mainNode, JsonNode updateNode) { - - if(isNull(mainNode) || mainNode.isNull()) - return updateNode; - if (isNull(updateNode) || updateNode.isNull()) - return mainNode; - - Iterator fieldNames = updateNode.fieldNames(); - while (fieldNames.hasNext()) { - - String fieldName = fieldNames.next(); - JsonNode jsonNode = mainNode.get(fieldName); - // if field exists and is an embedded object - if (jsonNode != null && jsonNode.isObject()) { - jsonMerge(jsonNode, updateNode.get(fieldName)); - } - else { - if (mainNode instanceof ObjectNode) { - // Overwrite field - JsonNode value = updateNode.get(fieldName); - ((ObjectNode) mainNode).put(fieldName, value); - } - } - - } - - return mainNode; - } - - public static boolean isPositiveInteger(BigDecimal bd) { - return bd.compareTo(BigDecimal.ZERO) >= 0 - && (bd.signum() == 0 || bd.scale() <= 0 || bd.stripTrailingZeros().scale() <= 0); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/util/v1/ReceiptValidator_v1.java b/business-services/collection-services/src/main/java/org/egov/collection/util/v1/ReceiptValidator_v1.java deleted file mode 100644 index 4e1b45d48f2..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/util/v1/ReceiptValidator_v1.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.egov.collection.util.v1; - -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.egov.collection.model.v1.ReceiptRequest_v1; -import org.springframework.stereotype.Component; - -import java.util.Map; - -@Slf4j -@Component -public class ReceiptValidator_v1 { - - public void validateUserInfo(ReceiptRequest_v1 receiptReq, Map errorMap) { - if (null == receiptReq.getRequestInfo()) { - errorMap.put("INVALID_REQUEST_INFO", "RequestInfo cannot be null"); - } else { - if (null == receiptReq.getRequestInfo().getUserInfo()) { - errorMap.put("INVALID_USER_INFO", "UserInfo within RequestInfo cannot be null"); - } else { - if (StringUtils.isEmpty(receiptReq.getRequestInfo().getUserInfo().getUuid())) { - errorMap.put("INVALID_USER_ID", "UUID of the user within RequestInfo cannot be null"); - } - } - } - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AccountCodePurpose.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AccountCodePurpose.java deleted file mode 100644 index d5bbf3af11f..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AccountCodePurpose.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.collection.web.contract; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class AccountCodePurpose { - private Long id = null; - - private String name = null; -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AccountCodePurposeContract.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AccountCodePurposeContract.java deleted file mode 100644 index 82a8ed4196b..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AccountCodePurposeContract.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name" }) -public class AccountCodePurposeContract extends AuditableContract { - - private Long id; - - @NotNull - @Length(max = 256, min = 3) - private String name; - - public AccountCodePurposeContract(final String id) { - super(); - this.id = Long.valueOf(id); - } - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AccountDetailTypeContract.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AccountDetailTypeContract.java deleted file mode 100644 index f723d4ed01a..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AccountDetailTypeContract.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonProperty.Access; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "description", "tableName", "columnName", "attributeName", "active", - "fullyQualifiedName" }) -public class AccountDetailTypeContract extends AuditableContract implements java.io.Serializable { - - private Long id; - - @JsonProperty(access = Access.WRITE_ONLY) - private List ids = new ArrayList(); - - @NotNull - @Length(max = 50, min = 1) - private String name; - - @NotNull - @Length(max = 50, min = 1) - private String description; - - @Length(max = 25) - private String tableName; - - @NotNull - private Boolean active; - - @Length(max = 250, min = 1) - private String fullyQualifiedName; - - public Long getId() { - return this.id; - } - - public AccountDetailTypeContract(final String id) { - super(); - this.id = Long.valueOf(id); - } - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ApportionRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ApportionRequest.java deleted file mode 100644 index 40b052f6662..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ApportionRequest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -public class ApportionRequest { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - private String tenantId; - - private List bills; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ApportionResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ApportionResponse.java deleted file mode 100644 index d2b1d2bd7f0..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ApportionResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -public class ApportionResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("Bills") - private List bills; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Assignment.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Assignment.java deleted file mode 100644 index ef68c8f49b6..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Assignment.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import lombok.Getter; -import lombok.Setter; - -import javax.validation.constraints.NotNull; - -@Setter -@Getter -public class Assignment { - - private Long id; - - @NotNull - private Long position; - - private Long fund; - - private Long functionary; - - private Long function; - - @NotNull - private Long department; - - @NotNull - private Long designation; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Attribute.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Attribute.java deleted file mode 100644 index 0aabc31a016..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Attribute.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@AllArgsConstructor -@Getter -@Builder -@NoArgsConstructor -@Setter -public class Attribute { - - private Boolean variable; - - private String code; - - private String datatype; - - private Boolean required; - - private String datatypeDescription; - - private List values; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AuditableContract.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AuditableContract.java deleted file mode 100644 index dcb26d64d21..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/AuditableContract.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.Date; - -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.Data; - -@Data -@JsonPropertyOrder({ "createdBy", "createdDate", "lastModifiedBy", "lastModifiedDate", "tenantId" }) -public class AuditableContract { - - private Long createdBy; - - private Date createdDate; - - private Long lastModifiedBy; - - private Date lastModifiedDate; - - @NotNull - private String tenantId; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Bank.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Bank.java deleted file mode 100644 index 1ad6d165cee..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Bank.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.egov.collection.web.contract; - -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - - - -@Setter -@Getter -@ToString -@EqualsAndHashCode -public class Bank { - - private Long id; - - private String code; - - private String name; - - private String description; - - private Boolean active; - - private String type; - - private String tenantId; -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccount.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccount.java deleted file mode 100644 index c098553df49..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccount.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - - - -@Setter -@Getter -@ToString -@EqualsAndHashCode -@Builder -public class BankAccount { - private Long id; - - @JsonProperty("BankBranch") - private BankBranch bankBranch; - - @JsonProperty("ChartOfAccount") - private ChartOfAccount chartOfAccount; - - @JsonProperty("Fund") - private Fund fund; - - private String accountNumber; - - private String accountType; - - private String description; - - private Boolean active; - - private String payTo; - -/* public enum TypeEnum { - RECEIPTS("RECEIPTS"), - - PAYMENTS("PAYMENTS"), - - RECEIPTS_PAYMENTS("RECEIPTS_PAYMENTS"); - - private String value; - - TypeEnum(String value) { - this.value = value; - } - } */ -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountContract.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountContract.java deleted file mode 100644 index 608160abaf7..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountContract.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - - -import javax.validation.constraints.NotNull; - -import org.egov.collection.model.enums.BankAccountType; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonProperty.Access; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "bankBranch", "chartOfAccount", "fund", "accountNumber", "accountType", "description", - "active", "payTo", "type" }) -public class BankAccountContract extends AuditableContract implements java.io.Serializable { - - private Long id; - - private BankBranchContract bankBranch; - - @JsonProperty(access = Access.WRITE_ONLY) - private ChartOfAccount chartOfAccount; - - @JsonProperty(access = Access.WRITE_ONLY) - private FundContract fund; - - @NotNull - @Length(max = 25) - private String accountNumber; - - // is this required ? - private String accountType; - @Length(max = 256) - private String description; - - @NotNull - private Boolean active; - - @Length(max = 100) - private String payTo; - - @NotNull - private BankAccountType type; - - public Long getId() { - return this.id; - } - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMapping.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMapping.java deleted file mode 100644 index 8d5af55ee9a..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMapping.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.List; -import java.util.stream.Collectors; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.Length; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -public class BankAccountServiceMapping { - - @NotNull - private String businessDetails; - - @NotNull - @Length(min = 8, max = 18) - private String bankAccount; - - private String bank; - - private String bankBranch; - - @NotNull - private String tenantId; - - public BankAccountServiceMapping(org.egov.collection.model.BankAccountServiceMapping bankAccountServiceMapping) { - this.businessDetails = bankAccountServiceMapping.getBusinessDetails(); - this.bankAccount = bankAccountServiceMapping.getBankAccount(); - this.tenantId = bankAccountServiceMapping.getTenantId(); - this.bank = bankAccountServiceMapping.getBank(); - this.bankBranch = bankAccountServiceMapping.getBankBranch(); - - } - - public List toContractList( - List bankAccountServiceList) { - return bankAccountServiceList.stream() - .map(bankAccountServiceMapping -> new BankAccountServiceMapping(bankAccountServiceMapping)) - .collect(Collectors.toList()); - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMappingReq.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMappingReq.java deleted file mode 100644 index 7396589452d..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMappingReq.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; - -@Setter -@Getter -public class BankAccountServiceMappingReq { - - @Valid - @NotNull - @JsonProperty("BankAccountServiceMapping") - private List bankAccountServiceMapping; - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMappingResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMappingResponse.java deleted file mode 100644 index 00f0266c5da..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMappingResponse.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; - -@Setter -@Getter -public class BankAccountServiceMappingResponse { - - @JsonProperty("BankAccountServiceMapping") - private List bankAccountServiceMapping; - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMappingSearchReq.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMappingSearchReq.java deleted file mode 100644 index d85e93dae27..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankAccountServiceMappingSearchReq.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.List; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class BankAccountServiceMappingSearchReq { - - private List businessDetails; - - private String bankAccount; - - private String tenantId; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankBranch.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankBranch.java deleted file mode 100644 index 847cb943a74..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankBranch.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Builder; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -@Builder -public class BankBranch { - private Long id; - - @JsonProperty("Bank") - private Bank bank; - - private String code; - - private String name; - - private String address; - - private String address2; - - private String city; - - private String state; - - private String pincode; - - private String phone; - - private String fax; - - private String contactPerson; - - private Boolean active; - - private String description; - - private String micr; - -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankBranchContract.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankBranchContract.java deleted file mode 100644 index ea8bc3f9a73..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankBranchContract.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "code", "name", "bank", "address", "address2", "city", "state", "pincode", "phone", "fax", - "contactPerson", "active", "description", "micr", "bankAccounts" }) -public class BankBranchContract extends AuditableContract { - - private Long id; - - @NotNull - private BankContract bank; - - @NotNull - @Length(max = 50, min = 1) - private String code; - - @NotNull - @Length(max = 50, min = 1) - @Pattern(regexp = "^[a-zA-Z0-9_]*$") - private String name; - - @NotNull - @Length(max = 50, min = 1) - private String address; - - @Length(max = 50) - private String address2; - - @Length(max = 50) - private String city; - - @Length(max = 50) - private String state; - - @Length(max = 50) - private String pincode; - - @Length(max = 15) - private String phone; - - @Length(max = 15) - private String fax; - - @Length(max = 50) - private String contactPerson; - - @NotNull - private Boolean active; - - @Length(max = 256) - private String description; - - @Length(max = 50) - private String micr; - - public Long getId() { - return this.id; - } - - public BankBranchContract(final String id) { - super(); - this.id = Long.valueOf(id); - } - - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankContract.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankContract.java deleted file mode 100644 index faf3e995301..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BankContract.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonProperty.Access; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class BankContract { - - private Long id; - - @JsonProperty(access = Access.WRITE_ONLY) - private List ids = new ArrayList(); - - @NotNull - @Length(max = 50, min = 1) - private String code; - - @NotNull - @Length(max = 100, min = 2) - private String name; - - @Length(max = 250) - private String description; - - @NotNull - private Boolean active; - // is this required? - - @Length(max = 50) - private String type; - - private String tenantId; - - public Long getId() { - return id; - } - - public BankContract(final String id) { - super(); - this.id = Long.valueOf(id); - } - - public BankContract(Bank bean) { - this.setTenantId(bean.getTenantId()); - this.setId(bean.getId()); - this.setCode(bean.getCode()); - this.setName(bean.getName()); - this.setType(bean.getType()); - this.setActive(bean.getActive()); - this.setDescription(bean.getDescription()); - } - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Bill.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Bill.java deleted file mode 100644 index 3f58a40745c..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Bill.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.egov.collection.model.AuditDetails; -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.util.CollectionUtils; - -import javax.validation.Valid; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class Bill { - // TODO some of the fields are mandatory in yml, lets discuss billdetail and billaccountdetail also for more clarity - - @JsonProperty("id") - private String id = null; - - @SafeHtml - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @SafeHtml - @JsonProperty("paidBy") - private String paidBy = null; - - @SafeHtml - @JsonProperty("payerName") - private String payerName = null; - - @SafeHtml - - @JsonProperty("payerAddress") - private String payerAddress = null; - - @SafeHtml - @JsonProperty("payerEmail") - private String payerEmail = null; - - @SafeHtml - @JsonProperty("payerId") - private String payerId = null; - - @JsonProperty("status") - private StatusEnum status = null; - - @SafeHtml - @JsonProperty("reasonForCancellation") - private String reasonForCancellation = null; - - @JsonProperty("isCancelled") - private Boolean isCancelled = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("billDetails") - @Valid - private List billDetails = null; - - @SafeHtml - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - - @JsonProperty("collectionModesNotAllowed") - private List collectionModesNotAllowed = null; - - @JsonProperty("partPaymentAllowed") - private Boolean partPaymentAllowed = null; - - @JsonProperty("isAdvanceAllowed") - private Boolean isAdvanceAllowed; - - @JsonProperty("minimumAmountToBePaid") - private BigDecimal minimumAmountToBePaid = null; - - @SafeHtml - @JsonProperty("businessService") - private String businessService = null; - - @JsonProperty("totalAmount") - private BigDecimal totalAmount = null; - - @SafeHtml - @JsonProperty("consumerCode") - private String consumerCode = null; - - @SafeHtml - @JsonProperty("billNumber") - private String billNumber = null; - - @JsonProperty("billDate") - private Long billDate = null; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid; - - public Boolean addBillDetail(BillDetail billDetail) { - - if (CollectionUtils.isEmpty(billDetails)) { - - billDetails = new ArrayList<>(); - return billDetails.add(billDetail); - } else { - - if (!billDetails.contains(billDetail)) - return billDetails.add(billDetail); - else - return false; - } - } - - public enum StatusEnum { - ACTIVE("ACTIVE"), - - CANCELLED("CANCELLED"), - - PAID("PAID"), - - EXPIRED("EXPIRED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - public static boolean contains(String test) { - for (StatusEnum val : StatusEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - } - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillAccountDetail.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillAccountDetail.java deleted file mode 100644 index e9a500e79fe..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillAccountDetail.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.egov.collection.web.contract; - -import java.math.BigDecimal; - -import org.egov.collection.model.AuditDetails; -import org.egov.collection.model.enums.Purpose; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import org.hibernate.validator.constraints.SafeHtml; - -import javax.validation.constraints.Size; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class BillAccountDetail { - - @SafeHtml - @Size(max=64) - @JsonProperty("id") - private String id = null; - - @SafeHtml - @Size(max=64) - @JsonProperty("tenantId") - private String tenantId = null; - - @SafeHtml - @Size(max=64) - @JsonProperty("billDetailId") - private String billDetailId = null; - - @SafeHtml - @Size(max=64) - @JsonProperty("demandDetailId") - private String demandDetailId = null; - - @JsonProperty("order") - private Integer order = null; - - @JsonProperty("amount") - private BigDecimal amount = null; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount = null; - - @JsonProperty("isActualDemand") - private Boolean isActualDemand = null; - - @SafeHtml - @Size(max=64) - @JsonProperty("taxHeadCode") - private String taxHeadCode = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("purpose") - private Purpose purpose = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillDetail.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillDetail.java deleted file mode 100644 index 609c228edf6..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillDetail.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.egov.collection.model.AuditDetails; -import org.egov.collection.model.enums.CollectionType; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.egov.collection.model.enums.CollectionType; -import org.egov.collection.model.enums.ReceiptType; -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(of = {"id"}) -public class BillDetail { - - @SafeHtml - @JsonProperty("id") - private String id = null; - - @SafeHtml - @JsonProperty("tenantId") - private String tenantId = null; - - @SafeHtml - @JsonProperty("demandId") - private String demandId = null; - - @SafeHtml - @JsonProperty("billId") - private String billId = null; - - @JsonProperty("amount") - @NotNull - private BigDecimal amount = null; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid = null; - - @NotNull - @JsonProperty("fromPeriod") - private Long fromPeriod = null; - - @NotNull - @JsonProperty("toPeriod") - private Long toPeriod = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @SafeHtml - @JsonProperty("channel") - private String channel = null; - - @SafeHtml - @JsonProperty("voucherHeader") - private String voucherHeader = null; - - @SafeHtml - @JsonProperty("boundary") - private String boundary = null; - - @SafeHtml - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber = null; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate = null; - - - @JsonProperty("billAccountDetails") - private List billAccountDetails = null; - - @NotNull - @JsonProperty("collectionType") - private CollectionType collectionType = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - - @SafeHtml - private String billDescription; - - @NotNull - @JsonProperty("expiryDate") - private Long expiryDate; - - @SafeHtml - private String displayMessage; - - private Boolean callBackForApportioning; - - @SafeHtml - private String cancellationRemarks; - - public Boolean addBillAccountDetail(BillAccountDetail billAccountDetail) { - - if (CollectionUtils.isEmpty(billAccountDetails)) { - - billAccountDetails = new ArrayList<>(); - return billAccountDetails.add(billAccountDetail); - } else { - - if (!billAccountDetails.contains(billAccountDetail)) - return billAccountDetails.add(billAccountDetail); - else - return false; - } - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillRequest.java deleted file mode 100644 index 1f9cecc1d5e..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillRequest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; -/** - * BillRequest - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("Bills") - private List bills = new ArrayList<>(); -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillResponse.java deleted file mode 100644 index 32dd9491149..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BillResponse.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * BillResponse - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("Bill") - private List bill = new ArrayList<>(); - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessAccountDetails.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessAccountDetails.java deleted file mode 100644 index 9ae4ed0fa51..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessAccountDetails.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.collection.web.contract; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@AllArgsConstructor -@Getter -@Builder -@NoArgsConstructor -@EqualsAndHashCode -public class BusinessAccountDetails { - private Long id; - - private Long businessDetails; - - private Long chartOfAccounts; - - private Double amount; -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessAccountSubLedger.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessAccountSubLedger.java deleted file mode 100644 index 3a3bc7249b8..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessAccountSubLedger.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.egov.collection.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; - -@Builder -@Getter -@AllArgsConstructor -@EqualsAndHashCode -public class BusinessAccountSubLedger { - - private Long id; - - private Long detailType; - - private Long detailKey; - - private Double amount; - - private Long businessAccountDetails; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetails.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetails.java deleted file mode 100644 index 01d2d5ad688..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetails.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.ToString; - -@AllArgsConstructor -@Builder -@Getter -@EqualsAndHashCode -@ToString - -public class BusinessDetails { - private Long id; - - private String code; - - private String name; - - private Boolean active; - - private Long businessCategory; - - private String businessType; - - private String businessUrl; - - private Boolean voucherCreation; - - private Boolean isVoucherApproved; - - private Boolean callBackForApportioning; - - @JsonFormat(pattern = "dd-MM-yyyy HH:mm:ss", timezone = "UTC") - private Date voucherCutoffDate; - - private Integer ordernumber; - - private String fund; - - private String function; - - private String tenantId; - - private String department; - - private String fundSource; - - private String functionary; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetailsRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetailsRequest.java deleted file mode 100644 index d3dc5850dec..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetailsRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Builder; -import lombok.Getter; -import lombok.Setter; -import org.egov.common.contract.request.RequestInfo; - -import java.util.List; - -@Setter -@Getter -@Builder -public class BusinessDetailsRequest { - - private String tenantId; - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("businessDetailsCodes") - private List businessCodes; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetailsRequestInfo.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetailsRequestInfo.java deleted file mode 100644 index 3b4ecd95168..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetailsRequestInfo.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.Date; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@EqualsAndHashCode -@ToString - -public class BusinessDetailsRequestInfo { - - private Long id; - - private String code; - - private String name; - - private Boolean active; - - private Long businessCategory; - - private String businessType; - - private String businessUrl; - - private String department; - - private String fundSource; - - private String functionary; - - private Boolean voucherCreation; - - private Boolean isVoucherApproved; - - private Boolean callBackForApportioning; - - @JsonFormat(pattern = "dd-MM-yyyy HH:mm:ss", timezone = "UTC") - private Date voucherCutoffDate; - - private Integer ordernumber; - - private String fund; - - private String function; - - private String tenantId; - - private List accountDetails; - - private List subledgerDetails; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetailsResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetailsResponse.java deleted file mode 100644 index 72ff232de62..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/BusinessDetailsResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Setter -@Getter -@ToString -public class BusinessDetailsResponse { - - @JsonProperty("ResponseInfo") - @JsonIgnore - private ResponseInfo responseInfo; - - @JsonProperty("BusinessDetails") - private List businessDetails; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ChartOfAccount.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ChartOfAccount.java deleted file mode 100644 index 7a52f320af4..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ChartOfAccount.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - - -@Setter -@Getter -@ToString -public class ChartOfAccount { - private Long id; - - private String glcode; - - private String name; - - @JsonProperty("AccountCodePurpose") - private AccountCodePurpose accountCodePurpose; - - private String desciption; - - private Boolean isActiveForPosting; - -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ChartOfAccountDetailContract.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ChartOfAccountDetailContract.java deleted file mode 100644 index 1691e95b8d3..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ChartOfAccountDetailContract.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract; - -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "chartOfAccount", "accountDetailType" }) -public class ChartOfAccountDetailContract extends AuditableContract { - - private Long id; - - @NotNull - private ChartOfAccount chartOfAccount; - - @NotNull - private AccountDetailTypeContract accountDetailType; - - public Long getId() { - return this.id; - } - - public ChartOfAccountDetailContract(final String id) { - super(); - this.id = Long.valueOf(id); - } - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ChartOfAccountsResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ChartOfAccountsResponse.java deleted file mode 100644 index 068757b2ea9..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ChartOfAccountsResponse.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.collection.web.contract; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Getter -@Setter -@ToString -public class ChartOfAccountsResponse { - - public ResponseInfo responseInfo; - - public List chartOfAccounts; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/CollectionConfigGetRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/CollectionConfigGetRequest.java deleted file mode 100644 index 3ccf976c594..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/CollectionConfigGetRequest.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.Date; -import java.util.List; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -@EqualsAndHashCode -public class CollectionConfigGetRequest { - private List id; - - @Size(min=3, max=50) - private String name; - - @JsonFormat(pattern = "dd/MM/yyyy") - private Date effectiveFrom; - - private String sortBy; - - private String sortOrder; - - @NotNull - private String tenantId; - - @Min(1) - @Max(500) - private Short pageSize; - - private Short pageNumber; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/CollectionConfigResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/CollectionConfigResponse.java deleted file mode 100644 index db774a41de8..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/CollectionConfigResponse.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -@EqualsAndHashCode -public class CollectionConfigResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("CollectionConfiguration") - private Map> collectionConfiguration = new HashMap<>(); -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/DepartmentDesignation.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/DepartmentDesignation.java deleted file mode 100644 index 262b3f619ab..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/DepartmentDesignation.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract; - -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class DepartmentDesignation { - - private Long id; - private Long departmentId; - private Designation designation; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/DepartmentResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/DepartmentResponse.java deleted file mode 100644 index 248c0ad7e98..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/DepartmentResponse.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.collection.model.Department; -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -public class DepartmentResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Department") - private List department = new ArrayList(); - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Designation.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Designation.java deleted file mode 100644 index 583a99c7b49..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Designation.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract; - -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class Designation { - - private Long id; - private String name; - private String code; - private String description; - private String chartOfAccounts; - private Boolean active; - private String tenantId; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/DesignationResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/DesignationResponse.java deleted file mode 100644 index b31af78ba05..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/DesignationResponse.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -public class DesignationResponse { - - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Designations") - List designations = new ArrayList<>(); - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Employee.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Employee.java deleted file mode 100644 index 08d83f69bd2..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Employee.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import lombok.Getter; -import lombok.Setter; - -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -public class Employee { - - private Long id; - - private String code; - - private String name; - - private String userName; - - private List assignments = new ArrayList<>(); -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/EmployeeResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/EmployeeResponse.java deleted file mode 100644 index 1f6339634e6..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/EmployeeResponse.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Getter; -import lombok.Setter; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Setter -@Getter -public class EmployeeResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Employee") - private List employees; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Function.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Function.java deleted file mode 100644 index 732234796a6..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Function.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.egov.collection.web.contract; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class Function { - - private Long id; - - private String name; - - private String code; - - private Integer level; - - private Boolean active; - - private Boolean isParent; - - private Long parentId; - -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Fund.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Fund.java deleted file mode 100644 index 2bf7f1b911e..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Fund.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.egov.collection.web.contract; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class Fund { - private Long id; - - private String name; - - private String code; - - private String identifier; - - private Long level; - - private Long parentId; - - private Boolean isParent; - - private Boolean active; - -} - diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/FundContract.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/FundContract.java deleted file mode 100644 index 689b821fbec..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/FundContract.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonProperty.Access; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "code", "identifier", "level", "parentId", "isParent", "active" }) -public class FundContract extends AuditableContract { - - private Long id; - - @Length(max = 50, min = 2) - @NotNull - private String name; - - @Length(max = 50, min = 2) - @NotNull - private String code; - @NotNull - private Character identifier; - - @NotNull - private Long level; - - @JsonProperty(access = Access.WRITE_ONLY) - private FundContract parentId; - - private Boolean isParent; - @NotNull - private Boolean active; - - public Long getId() { - return this.id; - } - - public FundContract(final String id) { - super(); - this.id = Long.valueOf(id); - } - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/GetUserByIdRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/GetUserByIdRequest.java deleted file mode 100644 index 71c97f6678e..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/GetUserByIdRequest.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Builder; -import lombok.Getter; -import lombok.Setter; -import org.egov.common.contract.request.RequestInfo; - -import java.util.List; - -@Setter -@Getter -@Builder -public class GetUserByIdRequest { - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - private List id; - - private String tenantId; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/InstrumentResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/InstrumentResponse.java deleted file mode 100644 index 15ae4cca5f0..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/InstrumentResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.collection.web.contract; - -import lombok.Getter; -import lombok.Setter; -import org.egov.collection.model.Instrument; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Getter -@Setter -public class InstrumentResponse { - private ResponseInfo responseInfo; - private List instruments; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/LegacyReceiptReq.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/LegacyReceiptReq.java deleted file mode 100644 index 5438bdcef43..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/LegacyReceiptReq.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.List; - -import org.egov.collection.model.LegacyReceiptHeader; -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Getter -@Setter -@Builder -@ToString -@AllArgsConstructor -@NoArgsConstructor -public class LegacyReceiptReq { - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("LegacyReceipts") - private List legacyReceipts; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/LegacyReceiptRes.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/LegacyReceiptRes.java deleted file mode 100644 index 63f13e89325..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/LegacyReceiptRes.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.List; - -import org.egov.collection.model.LegacyReceiptHeader; -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class LegacyReceiptRes { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("") - private List legacyReceipts; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/PaginationContract.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/PaginationContract.java deleted file mode 100644 index 1c0803ed294..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/PaginationContract.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.collection.model.Pagination; - -import javax.validation.constraints.Max; - -@AllArgsConstructor -@NoArgsConstructor -@Data -public class PaginationContract { - - public static int DEFAULT_PAGE_SIZE = 500; - public static int DEFAULT_PAGE_OFFSET = 0; - - private Integer totalResults; - - private Integer totalPages; - - @Max(500l) - private Integer pageSize; - - private Integer currentPage; - - private Integer offset; - - public PaginationContract(Pagination page) { - this.pageSize = page.getPageSize(); - this.currentPage = page.getCurrentPage(); - this.offset = page.getOffset(); - this.totalPages = page.getTotalPages(); - this.totalResults = page.getTotalResults(); - - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/PaymentWorkflow.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/PaymentWorkflow.java deleted file mode 100644 index cf02cdc565b..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/PaymentWorkflow.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.Data; -import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.SafeHtml; - -import javax.validation.constraints.NotNull; - -@Data -public class PaymentWorkflow { - - @SafeHtml - @NotNull - @Length(min = 1) - private String paymentId; - - @NotNull - private PaymentAction action; - - @SafeHtml - @NotNull - @Length(min = 1) - private String tenantId; - - @SafeHtml - private String reason; - - private JsonNode additionalDetails; - - /** - * Current status of the transaction - */ - public enum PaymentAction { - CANCEL("CANCEL"), - DISHONOUR("DISHONOUR"), - REMIT("REMIT"); - - private String value; - - PaymentAction(String value) { - this.value = value; - } - - @JsonCreator - public static PaymentAction fromValue(String text) { - for (PaymentAction b : PaymentAction.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - } - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/PaymentWorkflowRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/PaymentWorkflowRequest.java deleted file mode 100644 index d9cbdd5d086..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/PaymentWorkflowRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Data; -import org.egov.common.contract.request.RequestInfo; - -import javax.validation.Valid; -import javax.validation.constraints.Size; -import java.util.List; - -@Data -public class PaymentWorkflowRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("PaymentWorkflows") - @Size(min = 1) - @Valid - private List paymentWorkflows; - - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Position.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Position.java deleted file mode 100644 index 28418c4e826..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Position.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract; - -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class Position { - - private Long id; - private String name; - private DepartmentDesignation deptdesig; - private Boolean isPostOutsourced; - private Boolean active; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ProcessInstance.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ProcessInstance.java deleted file mode 100644 index 44f03bb63b1..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ProcessInstance.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -public class ProcessInstance { - - private String id; - private String businessKey; - private String type; - private Position assignee; - private String comments; - @JsonFormat(pattern = "dd/MM/yyyy") - private Date createdDate; - @JsonFormat(pattern = "dd/MM/yyyy") - private Date lastupdatedSince; - private Position owner; - private String state; - private String status; - private String senderName; - private String details; - List tasks = new ArrayList<>(); - private String tenantId; - private Long initiatorPosition; - private Map attributes = new HashMap<>(); -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ProcessInstanceRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ProcessInstanceRequest.java deleted file mode 100644 index cd7f2d0ca15..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ProcessInstanceRequest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -public class ProcessInstanceRequest { - - @JsonProperty("requestInfo") - private RequestInfo requestInfo; - - @JsonProperty("processInstances") - private List processInstances = new ArrayList<>(); - - @JsonProperty("processInstance") - private ProcessInstance processInstance; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ProcessInstanceResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ProcessInstanceResponse.java deleted file mode 100644 index 377753cc910..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/ProcessInstanceResponse.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -public class ProcessInstanceResponse { - - @JsonProperty("responseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("processInstances") - private List processInstances = new ArrayList<>(); - - @JsonProperty("processInstance") - private ProcessInstance processInstance = null; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Remittance.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Remittance.java deleted file mode 100644 index 45ef60a9eab..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Remittance.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.HashSet; -import java.util.Set; - -import javax.validation.constraints.NotNull; - -import org.egov.collection.model.AuditDetails; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -@EqualsAndHashCode -public class Remittance { - - @NotNull - private String tenantId; - - private String id; - - @NotNull - private String referenceNumber; - - @NotNull - private Long referenceDate; - - private String voucherHeader; - - private String function; - - private String fund; - - private String remarks; - - private String reasonForDelay; - - private String status; - - private String bankaccount; - - private AuditDetails auditDetails; - - private Set remittanceReceipts = new HashSet<>(); - - private Set remittanceDetails = new HashSet<>(); - - private Set remittanceInstruments = new HashSet<>(); - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceDetail.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceDetail.java deleted file mode 100644 index f2059eede6a..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceDetail.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.collection.web.contract; - -import java.math.BigDecimal; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -@EqualsAndHashCode -public class RemittanceDetail { - - private String tenantId; - - private String id; - - private String remittance; - - @NotNull - private String chartOfAccount; - - private BigDecimal creditAmount; - - private BigDecimal debitAmount; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceInstrument.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceInstrument.java deleted file mode 100644 index 2f967e139c3..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceInstrument.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.collection.web.contract; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -@EqualsAndHashCode -public class RemittanceInstrument { - - private String tenantId; - - private String id; - - private String remittance; - - @NotNull - private String instrument; - - private Boolean reconciled; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceReceipt.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceReceipt.java deleted file mode 100644 index 0447ad48ca2..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceReceipt.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.collection.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -@EqualsAndHashCode -public class RemittanceReceipt { - - private String tenantId; - - private String id; - - private String remittance; - - private String receipt; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceRequest.java deleted file mode 100644 index a49b995362f..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceRequest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -@Builder -@EqualsAndHashCode -@AllArgsConstructor -@NoArgsConstructor -public class RemittanceRequest { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @JsonProperty("Remittance") - @Valid - private List remittances = null; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceResponse.java deleted file mode 100644 index 42f1020975d..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceResponse.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Setter -@Getter -@ToString -@AllArgsConstructor -public class RemittanceResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Remittance") - private List remittances; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceSearchRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceSearchRequest.java deleted file mode 100644 index 46ebee9ce30..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RemittanceSearchRequest.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.egov.collection.web.contract; - -import java.util.List; - -import javax.validation.constraints.NotNull; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class RemittanceSearchRequest { - - private List ids; - - private List referenceNumbers; - - private Long fromDate; - - private Long toDate; - - private String voucherHeader; - - private String function; - - private String fund; - - private String remarks; - - private String reasonForDelay; - - private String status; - - private String bankaccount; - - @NotNull - private String tenantId; - - private String sortBy; - - private String sortOrder; - - private Integer pageSize; - - private Integer limit; - - private Integer offset; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RequestInfoBody.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RequestInfoBody.java deleted file mode 100644 index 5eb797d8327..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/RequestInfoBody.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.collection.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import org.egov.common.contract.request.RequestInfo; - -@Getter -@Setter -@AllArgsConstructor -public class RequestInfoBody { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/StatusResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/StatusResponse.java deleted file mode 100644 index 09808336698..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/StatusResponse.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Setter; -import org.egov.collection.model.EnumData; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Setter -public class StatusResponse { - - private String tenantId; - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("status") - private List status; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Task.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Task.java deleted file mode 100644 index 85349188a6e..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Task.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import java.util.Date; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class Task { - - private String id; - private String businessKey; - private String type; - private Position assignee; - private String comments; - @JsonFormat(pattern = "dd/MM/yyyy") - private Date createdDate; - @JsonFormat(pattern = "dd/MM/yyyy") - private Date lastupdatedSince; - private Position owner; - private String state; - private String status; - private String url; - private String action; - private String senderName; - private String details; - private String natureOfTask; - private String entity; - private String tenantId; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/TaxAndPayment.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/TaxAndPayment.java deleted file mode 100644 index cea9bef7503..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/TaxAndPayment.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.collection.web.contract; - -import java.math.BigDecimal; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class TaxAndPayment { - - @NotNull - private String businessService; - - private BigDecimal taxAmount; - - @NotNull - private BigDecimal amountPaid; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/UserResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/UserResponse.java deleted file mode 100644 index f3bd6ef237e..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/UserResponse.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.collection.model.EmployeeInfo; -import org.egov.common.contract.request.User; -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -public class UserResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Users") - private List users = new ArrayList(); - - @JsonProperty("user") - private List receiptCreators = new ArrayList(); -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Value.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Value.java deleted file mode 100644 index 5cae089db81..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/Value.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class Value { - - private String key; - - private String name; -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/WorkFlowDetailsResponse.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/WorkFlowDetailsResponse.java deleted file mode 100644 index 6b7249f00ee..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/WorkFlowDetailsResponse.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.collection.web.contract; - -import javax.validation.constraints.NotNull; -import org.egov.common.contract.response.ResponseInfo; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -@Getter -@Setter -public class WorkFlowDetailsResponse { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @NotNull - private String tenantId; - - private String receiptNumber; - - @NotNull - private long receiptHeaderId; - - private long department; - - private long designation; - - private String businessKey; - - @NotNull - private long user; - - private String comments; - - private Long initiatorPosition; - - private Long assignee; - - @NotNull - private String action; - - - private String status; - - @NotNull - private String state; - - private long stateId; -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/WorkflowDetailsRequest.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/WorkflowDetailsRequest.java deleted file mode 100644 index b9dd9ed992d..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/WorkflowDetailsRequest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -@Builder -public class WorkflowDetailsRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - private String tenantId; - - private String receiptNumber; - - @NotNull - private long receiptHeaderId; - - private long department; - - private long designation; - - private String businessKey; - - @NotNull - private long user; - - private String comments; - - private Long initiatorPosition; - - private Long assignee; - - @NotNull - private String action; - - - private String status; - - @NotNull - private String state; - - private long stateId; - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/factory/RequestInfoWrapper.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/factory/RequestInfoWrapper.java deleted file mode 100644 index 5be1d8627f4..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/factory/RequestInfoWrapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.collection.web.contract.factory; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RequestInfoWrapper { - - @JsonProperty(value="RequestInfo") - private RequestInfo requestInfo; - -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/factory/ResponseInfoFactory.java b/business-services/collection-services/src/main/java/org/egov/collection/web/contract/factory/ResponseInfoFactory.java deleted file mode 100644 index 8afa8b70319..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/contract/factory/ResponseInfoFactory.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.contract.factory; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.stereotype.Component; - -@Component -public class ResponseInfoFactory { - - public static ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { - - final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; - final String ver = requestInfo != null ? requestInfo.getVer() : ""; - Long ts = null; - if (requestInfo != null) - ts = requestInfo.getTs(); - final String resMsgId = "uief87324"; // FIXME : Hard-coded - final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; - - - return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) - .build(); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/BankAccountServiceMappingController.java b/business-services/collection-services/src/main/java/org/egov/collection/web/controller/BankAccountServiceMappingController.java deleted file mode 100644 index c98c05f5c56..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/BankAccountServiceMappingController.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.collection.web.controller; - -import java.util.List; - -import javax.validation.Valid; - -import org.egov.collection.model.BankAccountServiceMappingSearchCriteria; -import org.egov.collection.service.BankAccountMappingService; -import org.egov.collection.util.CollectionMastersRequestValidator; -import org.egov.collection.web.contract.BankAccountServiceMapping; -import org.egov.collection.web.contract.BankAccountServiceMappingReq; -import org.egov.collection.web.contract.BankAccountServiceMappingResponse; -import org.egov.collection.web.contract.BankAccountServiceMappingSearchReq; -import org.egov.collection.web.contract.factory.RequestInfoWrapper; -import org.egov.collection.web.contract.factory.ResponseInfoFactory; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ErrorResponse; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseStatus; - -import lombok.extern.slf4j.Slf4j; - -@Controller -@RequestMapping("/bankAccountServiceMapping") -@Slf4j -public class BankAccountServiceMappingController { - - @Autowired - private BankAccountMappingService bankAccountMappingService; - - @Autowired - private CollectionMastersRequestValidator collectionMastersRequestValidator; - - @PostMapping(value = "/_create") - @ResponseStatus(HttpStatus.OK) - public ResponseEntity create(@RequestBody @Valid BankAccountServiceMappingReq bankAccountServiceMappingReq) { - - log.info("BankAccountServiceMapping Request::" + bankAccountServiceMappingReq); - final ErrorResponse errorResponse = collectionMastersRequestValidator - .validateBankAccountServiceRequest(bankAccountServiceMappingReq); - if (errorResponse != null) - return new ResponseEntity(errorResponse, HttpStatus.BAD_REQUEST); - BankAccountServiceMappingReq bankAccountServiceReq = bankAccountMappingService - .createBankAccountServiceMappingAsync(bankAccountServiceMappingReq); - - return getSuccessResponse(bankAccountServiceReq.getRequestInfo(), bankAccountServiceReq.getBankAccountServiceMapping()); - } - - @PostMapping(value = "/_search") - @ResponseStatus(HttpStatus.OK) - public ResponseEntity search(@ModelAttribute BankAccountServiceMappingSearchReq bankAccountServiceMappingSearchReq, - final BindingResult modelAttributeBindingResult, - @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper) { - - log.info("Search request for BankAccount service mapping :: " + bankAccountServiceMappingSearchReq); - - BankAccountServiceMappingSearchCriteria searchCriteria = BankAccountServiceMappingSearchCriteria.builder() - .bankAccount(bankAccountServiceMappingSearchReq.getBankAccount()) - .businessDetails(bankAccountServiceMappingSearchReq.getBusinessDetails()) - .tenantId(bankAccountServiceMappingSearchReq.getTenantId()).build(); - - final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); - final ErrorResponse errorResponse = collectionMastersRequestValidator.validateBankAccountSearchRequest(searchCriteria); - - if (errorResponse != null) - return new ResponseEntity<>(errorResponse, HttpStatus.BAD_REQUEST); - - List bankAccountServiceMappings = bankAccountMappingService - .searchBankAccountService(searchCriteria); - - List contractBankServiceMappings = new BankAccountServiceMapping() - .toContractList(bankAccountServiceMappings); - - return getSuccessResponse(requestInfo, contractBankServiceMappings); - } - - private ResponseEntity getSuccessResponse(RequestInfo requestInfo, - List bankAccountServiceMappingList) { - BankAccountServiceMappingResponse response = new BankAccountServiceMappingResponse(); - response.setBankAccountServiceMapping(bankAccountServiceMappingList); - ResponseInfo responseInfo = ResponseInfoFactory.createResponseInfoFromRequestInfo(requestInfo, true); - responseInfo.setStatus(HttpStatus.OK.toString()); - response.setResponseInfo(responseInfo); - return new ResponseEntity(response, HttpStatus.OK); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/PaymentController.java b/business-services/collection-services/src/main/java/org/egov/collection/web/controller/PaymentController.java deleted file mode 100644 index 7bbbb3aa11d..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/PaymentController.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.controller; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.validation.Valid; - -import org.egov.collection.model.Payment; -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.model.PaymentResponse; -import org.egov.collection.model.PaymentSearchCriteria; -import org.egov.collection.service.PaymentService; -import org.egov.collection.service.PaymentWorkflowService; -import org.egov.collection.web.contract.PaymentWorkflowRequest; -import org.egov.collection.web.contract.factory.RequestInfoWrapper; -import org.egov.collection.web.contract.factory.ResponseInfoFactory; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.lang.Nullable; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/payments") -public class PaymentController { - - @Autowired - private PaymentService paymentService; - - @Autowired - private PaymentWorkflowService workflowService; - - @RequestMapping(path = {"/_search","/{moduleName}/_search"}, method = RequestMethod.POST) - @ResponseBody - public ResponseEntity search(@ModelAttribute PaymentSearchCriteria paymentSearchCriteria, - @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper, - @PathVariable @Nullable String moduleName) { - - final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); - if (paymentSearchCriteria.getIsCountRequest()) { - - if (CollectionUtils.isEmpty(paymentSearchCriteria.getBusinessServices()) - || StringUtils.isEmpty(paymentSearchCriteria.getTenantId())) { - throw new CustomException("EGCL_PAYMENT_COUNT_ERROR", - "both of tenantid and businessServices is mandatory for count search"); - } - - Long count = paymentService.getpaymentcountForBusiness(paymentSearchCriteria.getTenantId(), - paymentSearchCriteria.getBusinessServices().iterator().next()); - ResponseInfo responseInfo = ResponseInfoFactory.createResponseInfoFromRequestInfo(requestInfo, true); - responseInfo.setStatus(HttpStatus.OK.toString()); - - Map responseMap = new HashMap<>(); - responseMap.put("Count", count); - responseMap.put("ResponseInfo", responseInfo); - - return new ResponseEntity<>(responseMap, HttpStatus.OK); - } else { - List payments = paymentService.getPayments(requestInfo, paymentSearchCriteria, moduleName); - return getSuccessResponse(payments, requestInfo); - } - } - - @RequestMapping(value = "/_create", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity create(@RequestBody @Valid PaymentRequest paymentRequest) { - - Payment payment = paymentService.createPayment(paymentRequest); - return getSuccessResponse(Collections.singletonList(payment), paymentRequest.getRequestInfo()); - - } - - - @RequestMapping(value = "/{moduleName}/_workflow", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity workflow(@RequestBody @Valid PaymentWorkflowRequest receiptWorkflowRequest, @PathVariable String moduleName) { - - List payments = workflowService.performWorkflow(receiptWorkflowRequest); - return getSuccessResponse(payments, receiptWorkflowRequest.getRequestInfo()); - } - -// @RequestMapping(value = "/_update", method = RequestMethod.POST) -// @ResponseBody -// public ResponseEntity update(@RequestBody @Valid PaymentRequest paymentRequest) { -// List payments = paymentService.updatePayment(paymentRequest); -// return getSuccessResponse(payments, paymentRequest.getRequestInfo()); -// } - - @RequestMapping(value = "/_validate", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity validate(@RequestBody @Valid PaymentRequest paymentRequest) { - - Payment payment = paymentService.vaidateProvisonalPayment(paymentRequest);; - return getSuccessResponse(Collections.singletonList(payment), paymentRequest.getRequestInfo()); - - } - - - private ResponseEntity getSuccessResponse(List payments, RequestInfo requestInfo) { - final ResponseInfo responseInfo = ResponseInfoFactory.createResponseInfoFromRequestInfo(requestInfo, true); - responseInfo.setStatus(HttpStatus.OK.toString()); - - PaymentResponse paymentResponse = new PaymentResponse(responseInfo, payments); - return new ResponseEntity<>(paymentResponse, HttpStatus.OK); - } - - @RequestMapping(value = "/_plainsearch", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity plainSearch(@ModelAttribute PaymentSearchCriteria paymentSearchCriteria, - @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper) { - - final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); - - List payments = paymentService.plainSearch(paymentSearchCriteria); - - return getSuccessResponse(payments, requestInfo); - } - -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/PreExistPaymentController.java b/business-services/collection-services/src/main/java/org/egov/collection/web/controller/PreExistPaymentController.java deleted file mode 100644 index 8d6f3abdc5d..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/PreExistPaymentController.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.collection.web.controller; - -import java.util.List; - -import org.egov.collection.repository.PaymentRepository; -import org.egov.collection.service.PreExistPaymentService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/preexistpayments") -public class PreExistPaymentController { - - @Autowired - private PaymentRepository paymentRepository; - - @Autowired - private PreExistPaymentService preExistPaymentService; - - @PostMapping(value = "/_update") - @ResponseBody - public void update() { - List ifsccodeList = paymentRepository.fetchIfsccode(); - ifsccodeList.forEach(ifsccode -> preExistPaymentService.updatePaymentBankDetails(ifsccode)); - } -} diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/ReceiptControllerV2.java b/business-services/collection-services/src/main/java/org/egov/collection/web/controller/ReceiptControllerV2.java deleted file mode 100644 index c3678a03ee1..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/ReceiptControllerV2.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - *//* - - -package org.egov.collection.web.controller; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.validation.Valid; - -import org.egov.collection.model.PaymentRequest; -import org.egov.collection.model.ReceiptSearchCriteria; -import org.egov.collection.model.enums.ReceiptStatus; -import org.egov.collection.service.CollectionService; -import org.egov.collection.service.WorkflowService; -import org.egov.collection.util.migration.ReceiptMigration; -import org.egov.collection.web.contract.Receipt; -import org.egov.collection.web.contract.ReceiptReq; -import org.egov.collection.web.contract.ReceiptRes; -import org.egov.collection.web.contract.ReceiptWorkflowRequest; -import org.egov.collection.web.contract.factory.RequestInfoWrapper; -import org.egov.collection.web.contract.factory.ResponseInfoFactory; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -import lombok.extern.slf4j.Slf4j; - -@RestController -@RequestMapping("/v2/receipts") -@Slf4j -public class ReceiptControllerV2 { - - @Autowired - private CollectionService collectionService; - - @Autowired - private ReceiptMigration migrationService; - - @Autowired - private WorkflowService workflowService; - - @Value("#{'${search.ignore.status}'.split(',')}") - private List searchIgnoreStatus; - - @RequestMapping(value = "/_search", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity search(@ModelAttribute ReceiptSearchCriteria receiptSearchCriteria, - @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper) { - - final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); - - // Only do this if there is no receipt number search - // Only do this when search ignore status has been defined in - // application.properties - // Only do this when status has not been already provided for the search - if ((receiptSearchCriteria.getReceiptNumbers() == null || receiptSearchCriteria.getReceiptNumbers().isEmpty()) - && !searchIgnoreStatus.isEmpty() - && (receiptSearchCriteria.getStatus() == null || receiptSearchCriteria.getStatus().isEmpty())) { - // Do not return ignored status for receipts by default - Set defaultStatus = new HashSet<>(); - for (ReceiptStatus receiptStatus : ReceiptStatus.values()) { - if (!searchIgnoreStatus.contains(receiptStatus.toString())) { - defaultStatus.add(receiptStatus.toString()); - } - } - - receiptSearchCriteria.setStatus(defaultStatus); - } - - List receipts = collectionService.getReceipts(requestInfo, receiptSearchCriteria); - - return getSuccessResponse(receipts, requestInfo); - } - - @RequestMapping(value = "/_create", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity create(@RequestBody @Valid PaymentRequest paymentRequest) { - - Receipt receiptInfo = collectionService.createPayment(paymentRequest); - return getSuccessResponse(Collections.singletonList(receiptInfo), receiptRequest.getRequestInfo()); - - } - - @RequestMapping(value = "/_workflow", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity workflow(@RequestBody @Valid ReceiptWorkflowRequest receiptWorkflowRequest) { - - List receipts = workflowService.performWorkflow(receiptWorkflowRequest); - return getSuccessResponse(receipts, receiptWorkflowRequest.getRequestInfo()); - } - - @RequestMapping(value = "/_update", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity update(@RequestBody @Valid ReceiptReq receiptRequest) { - - List receiptInfo = collectionService.updateReceipt(receiptRequest); - - return getSuccessResponse(receiptInfo, receiptRequest.getRequestInfo()); - } - - @RequestMapping(value = "/_validate", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity validate(@RequestBody @Valid ReceiptReq receiptReq) { - - List receipt = collectionService.validateReceipt(receiptReq); - return getSuccessResponse(receipt, receiptReq.getRequestInfo()); - - } - - @PostMapping(value = "/_migratetov1") - @ResponseBody - public ResponseEntity migrate(@RequestBody @Valid RequestInfoWrapper wrapper, - @RequestParam(required = false) Integer startBatch, @RequestParam(required=true) Integer batchSizeInput) { - - Map resultMap = migrationService.migrateToV1(startBatch, batchSizeInput); - return new ResponseEntity<>(resultMap, HttpStatus.OK); - } - - private ResponseEntity getSuccessResponse(List receipts, RequestInfo requestInfo) { - final ResponseInfo responseInfo = ResponseInfoFactory.createResponseInfoFromRequestInfo(requestInfo, true); - responseInfo.setStatus(HttpStatus.OK.toString()); - - ReceiptRes receiptResponse = new ReceiptRes(responseInfo, receipts); - return new ResponseEntity<>(receiptResponse, HttpStatus.OK); - } -}*/ diff --git a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/RemittanceController.java b/business-services/collection-services/src/main/java/org/egov/collection/web/controller/RemittanceController.java deleted file mode 100644 index 3e8e857d5eb..00000000000 --- a/business-services/collection-services/src/main/java/org/egov/collection/web/controller/RemittanceController.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.collection.web.controller; - -import java.util.Collections; -import java.util.List; - -import javax.validation.Valid; - -import org.egov.collection.service.RemittanceService; -import org.egov.collection.web.contract.Remittance; -import org.egov.collection.web.contract.RemittanceRequest; -import org.egov.collection.web.contract.RemittanceResponse; -import org.egov.collection.web.contract.RemittanceSearchRequest; -import org.egov.collection.web.contract.factory.RequestInfoWrapper; -import org.egov.collection.web.contract.factory.ResponseInfoFactory; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -import lombok.extern.slf4j.Slf4j; - -@RestController -@RequestMapping("/remittances") -@Slf4j -public class RemittanceController { - - @Autowired - private RemittanceService remittanceService; - - @RequestMapping(value = "/_create", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity create(@RequestBody @Valid RemittanceRequest remittanceRequest) { - - Remittance remittanceInfo = remittanceService.createRemittance(remittanceRequest); - return getSuccessResponse(Collections.singletonList(remittanceInfo), remittanceRequest.getRequestInfo()); - - } - - @RequestMapping(value = "/_search", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity search(@ModelAttribute RemittanceSearchRequest remittanceSearchRequest, - @RequestBody @Valid final RequestInfoWrapper requestInfoWrapper) { - - final RequestInfo requestInfo = requestInfoWrapper.getRequestInfo(); - List remittances = remittanceService.getRemittances(requestInfo, remittanceSearchRequest); - return getSuccessResponse(remittances, requestInfo); - } - - @RequestMapping(value = "/_update", method = RequestMethod.POST) - @ResponseBody - public ResponseEntity update(@RequestBody @Valid RemittanceRequest remittanceRequest) { - - Remittance remittanceInfo = remittanceService.updateRemittance(remittanceRequest); - - return getSuccessResponse(Collections.singletonList(remittanceInfo), remittanceRequest.getRequestInfo()); - } - - private ResponseEntity getSuccessResponse(List remittances, - RequestInfo requestInfo) { - final ResponseInfo responseInfo = ResponseInfoFactory - .createResponseInfoFromRequestInfo(requestInfo, true); - responseInfo.setStatus(HttpStatus.OK.toString()); - - RemittanceResponse remittanceResponse = new RemittanceResponse(responseInfo, remittances); - return new ResponseEntity<>(remittanceResponse, HttpStatus.OK); - } -} \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/application.properties b/business-services/collection-services/src/main/resources/application.properties deleted file mode 100644 index bb1c0882abf..00000000000 --- a/business-services/collection-services/src/main/resources/application.properties +++ /dev/null @@ -1,179 +0,0 @@ -server.workDir-path=/collection-services - -#rest config -server.port=8280 -server.context-path=/collection-services -server.servlet.context-path=/collection-services -logging.level.org.egov=DEBUG - -collection.receipts.search.paginate=true -collection.receipts.search.default.size=30 -collection.receipts.search.max.size=200 -collection.is.user.create.enabled=true - -#db config -spring.datasource.url=jdbc:postgresql://localhost:5432/collections -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.username=postgres -spring.datasource.password=postgres -spring.jackson.serialization.write-dates-as-timestamps=false - -#flyway config -spring.flyway.user=postgres -spring.flyway.password=postgres -spring.flyway.outOfOrder=true -spring.flyway.table=collection_services_schema_version -spring.flyway.baseline-on-migrate=true -spring.flyway.url=jdbc:postgresql://localhost:5432/collections -spring.flyway.locations=classpath:db/migration/main -spring.flyway.enabled=true -spring.flyway.validateOnMigrate=false - -spring.jpa.show-sql=true - - -#kafka server config -spring.kafka.bootstrap.servers=localhost:9092 - -logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} - - - -#kafka topic config -kafka.topics.receipt.create.name=egov.collection.receipt-create-v2 -kafka.topics.receipt.create.key=receipt-create - -kafka.topics.collection.migrate.name=egov-collection-migration-batch -kafka.topics.collection.migrate.key=collection-migration - -kafka.topics.receipt.cancel.name=egov.collection.receipt-cancel-v2 -kafka.topics.receipt.cancel.key=receipt-cancel - -kafka.topics.receipt.update.name=egov.collection.receipt-update -kafka.topics.receipt.update.key=receipt-update - -kafka.topics.update.receipt.workflowdetails=egov.collection.update.workflowdetails -kafka.topics.update.receipt.workflowdetails.key=workflow-update - -kafka.topics.bankaccountservicemapping.create.name=egov.collectionmasters.bankaccountservicemapping-create -kafka.topics.bankaccountservicemapping.create.key=bankaccountservicemapping-create - -#URIs of other services collection depends on -egov.services.hostname = http://pdf-service.egov:8080 -egov.pdf.service.create = /pdf-service/v1/_create - -# ID GEN CONFIGS -egov.idgen.hostname = https://dev.digit.org -rcptno.gen.uri = /egov-idgen/id/_generate -receiptnumber.idname=receipt.id -receiptnumber.servicebased=false -#If servicebased is set to false, use default state level format -receiptnumber.state.level.format=[cy:MM]/[fy:yyyy-yy]/[SEQ_COLL_RCPT_NUM] - -egov.egfcommonmasters.hostname = https://dev.digit.org -buisnessdetails.search.uri = /egov-common-masters/businessDetails/_search - -egov.egfmasters.hostname = https://dev.digit.org -coa.search.uri = /egf-master/chartofaccounts/_search?tenantId={tenantId}&glcodes={chartOfAccountCodes} - -egov.instrument.hostname = https://dev.digit.org -create.instrument.uri = /egf-instrument/instruments/_create -search.ignore.status= -search.instrument.uri = /egf-instrument/instruments/_search?ids={instrumentheader} -search.instrumentbypaymentmode.uri = /egf-instrument/instruments/_search?instrumentTypes={instrumentType}&tenantId={tenantId} -search.accountcodes.uri = /egf-instrument/instrumentaccountcodes/_search - - -egov.apportion.service.host= http://localhost:8085 -egov.apportion.apportion.endpoint=/apportion-service/v2/bill/_apportion - -egov.egfmaster.service.host=https://dev.digit.org - -#Billing Service path config -egov.services.billing_service.hostname=http://localhost:8096 -egov.services.billing_service.apportion=/billing-service/bill/_apportion -egov.services.billing_service.search=/billing-service/bill/v2/_search - - - - -#Notification Consumer -coll.notification.ui.host=https://dev.digit.org -coll.notification.ui.redirect.url=uc-citizen/smsViewReceipt -coll.notification.fallback.locale=en_IN -#egov.localization.host=https://dev.digit.org -egov.localization.host=http://egov-localization:8080 -egov.localization.search.endpoint=/localization/messages/v1/_search - -kafka.topics.notification.sms=egov.core.notification.sms -kafka.topics.notification.sms.key=notification.sms.parition.0 - -kafka.topics.payment.receiptlink.name=coll.payment.receiptlink.topic.name -kafka.topics.payment.receiptlink.key=coll.payment.receiptlink.topic.key - - -#egov.mdms.host=https://dev.digit.org -egov.mdms.host=http://egov-mdms-service:8080 -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search - - - - - -# KAFKA CONSUMER CONFIGURATIONS -spring.kafka.consumer.enable-auto-commit=true -spring.kafka.consumer.auto-commit-interval=100 -spring.kafka.consumer.auto-offset-reset=earliest -spring.kafka.consumer.value-deserializer=org.egov.collection.consumer.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=collection-persist -spring.kafka.listener.missing-topics-fatal=false -spring.kafka.consumer.properties.spring.json.use.type.headers=false - - - -# KAFKA PRODUCER CONFIGURATIONS -spring.kafka.producer.retries=0 -spring.kafka.producer.batch-size=16384 -spring.kafka.producer.buffer-memory=33554432 -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer - - -user.service.host=https://dev.digit.org/ -egov.services.user_by_id=user/_search -egov.user.create.user=user/users/_createnovalidate -egov.services.user.get_user_details=user/_details?access_token= -egov.services.user.get_user_by_username=user/_search - -app.timezone=UTC - - -collection.payments.search.paginate=true - -kafka.topics.payment.create.name=egov.collection.payment-create -kafka.topics.payment.create.key=payment-create -kafka.topics.payment.cancel.name=egov.collection.payment-cancel -kafka.topics.payment.cancel.key=payment-cancel -kafka.topics.payment.update.name=egov.collection.payment-update -kafka.topics.payment.update.key=payment-update - -is.payment.search.uri.modulename.mandatory=true - -kafka.topics.filestore=PDF_GEN_CREATE - -collection.search.max.limit=300 -collection.search.default.limit=100 - -#url shortner -egov.url.shortner.host=http://egov-url-shortening.egov:8080 -egov.url.shortner.endpoint=/egov-url-shortening/shortener - -#razoarpay url for fetching bank details -egov.razorpay.url=https://ifsc.razorpay.com/ - -# central-instance configs -state.level.tenantid.length=2 -is.environment.central.instance=true -egov.state.list=statea,stateb - diff --git a/business-services/collection-services/src/main/resources/db/Dockerfile b/business-services/collection-services/src/main/resources/db/Dockerfile deleted file mode 100644 index 13adcba4469..00000000000 --- a/business-services/collection-services/src/main/resources/db/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM egovio/flyway:4.1.2 - -COPY ./migration/main /flyway/sql - -COPY ./migration/dev /flyway/qa - -COPY migrate.sh /usr/bin/migrate.sh - -RUN chmod +x /usr/bin/migrate.sh - -CMD ["/usr/bin/migrate.sh"] diff --git a/business-services/collection-services/src/main/resources/db/migrate.sh b/business-services/collection-services/src/main/resources/db/migrate.sh deleted file mode 100644 index f79b7016299..00000000000 --- a/business-services/collection-services/src/main/resources/db/migrate.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -baseurl=$DB_URL -echo "the baseurl : $DB_URL" -schemasetter="?currentSchema=" -schemas=$SCHEMA_NAME -echo "the schemas : $schemas" -for schemaname in ${schemas//,/ } -do - echo "the schema name : ${baseurl}${schemasetter}${schemaname}" - flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate -done \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/dev/V20181016090609__collection_bankaccount_service_mapping_seed.sql b/business-services/collection-services/src/main/resources/db/migration/dev/V20181016090609__collection_bankaccount_service_mapping_seed.sql deleted file mode 100644 index c92e2e18fd1..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/dev/V20181016090609__collection_bankaccount_service_mapping_seed.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egcl_bankaccountservicemapping(id,businessdetails,bankaccount,bank,bankbranch,active,createdby,lastmodifiedby,tenantid,version) -values(nextval('seq_egcl_bankaccountservicemapping'),'ATH','000000000001','SBI','BC001',true,1,1,'pb.jalandhar',0); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/dev/V20181029154219__collection_bankaccount_service_mapping.sql b/business-services/collection-services/src/main/resources/db/migration/dev/V20181029154219__collection_bankaccount_service_mapping.sql deleted file mode 100644 index dd46afbb934..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/dev/V20181029154219__collection_bankaccount_service_mapping.sql +++ /dev/null @@ -1,4 +0,0 @@ -insert into egcl_bankaccountservicemapping(id,businessdetails,bankaccount,bank,bankbranch,active,createdby,lastmodifiedby,tenantid,version) -values(nextval('seq_egcl_bankaccountservicemapping'),'ETYPK','0000000003','XYZ1','007',true,1,1,'pb.jalandhar',0); -insert into egcl_bankaccountservicemapping(id,businessdetails,bankaccount,bank,bankbranch,active,createdby,lastmodifiedby,tenantid,version) -values(nextval('seq_egcl_bankaccountservicemapping'),'ETYG','0000000003','XYZ1','007',true,1,1,'pb.jalandhar',0); diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20180820232855__create_collections_tables.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20180820232855__create_collections_tables.sql deleted file mode 100644 index da3a817e8c1..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20180820232855__create_collections_tables.sql +++ /dev/null @@ -1,130 +0,0 @@ -DROP TABLE IF EXISTS "egcl_receiptheader" CASCADE; -DROP INDEX IF EXISTS idx_rcpthd_consumercode; -DROP INDEX IF EXISTS idx_rcpthd_createdby; -DROP INDEX IF EXISTS idx_rcpthd_createddate; -DROP INDEX IF EXISTS idx_rcpthd_mreceiptnumber; -DROP INDEX IF EXISTS idx_rcpthd_refno; -DROP INDEX IF EXISTS idx_rcpthd_business; -DROP INDEX IF EXISTS idx_rcpthd_status; -DROP TABLE IF EXISTS "egcl_receiptdetails"; -DROP TABLE IF EXISTS "egcl_receiptinstrument"; -DROP TABLE IF EXISTS "egcl_instrumentheader"; -DROP INDEX IF EXISTS idx_ins_transactionnumber; - - -CREATE TABLE "egcl_receiptheader" ( - "id" VARCHAR(36) NOT NULL, - "payeename" VARCHAR(256) NULL DEFAULT NULL, - "payeeaddress" VARCHAR(1024) NULL DEFAULT NULL, - "payeeemail" VARCHAR(254) NULL DEFAULT NULL, - "paidby" VARCHAR(1024) NULL DEFAULT NULL, - "referencenumber" VARCHAR(50) NULL DEFAULT NULL, - "receipttype" VARCHAR(32) NOT NULL, - "receiptnumber" VARCHAR(50) NULL DEFAULT NULL, - "referencedesc" VARCHAR(250) NULL DEFAULT NULL, - "manualreceiptnumber" VARCHAR(50) NULL DEFAULT NULL, - "businessdetails" VARCHAR(32) NOT NULL, - "collectiontype" VARCHAR(50) NOT NULL, - "displaymsg" VARCHAR(256) NULL DEFAULT NULL, - "reference_ch_id" BIGINT NULL DEFAULT NULL, - "stateid" BIGINT NULL DEFAULT NULL, - "location" BIGINT NULL DEFAULT NULL, - "isreconciled" BOOLEAN NULL DEFAULT NULL, - "status" VARCHAR(50) NOT NULL, - "reasonforcancellation" VARCHAR(250) NULL DEFAULT NULL, - "minimumamount" NUMERIC(12,2) NULL DEFAULT NULL, - "totalamount" NUMERIC(12,2) NULL DEFAULT NULL, - "collmodesnotallwd" VARCHAR(256) NULL DEFAULT NULL, - "consumercode" VARCHAR(256) NULL DEFAULT NULL, - "channel" VARCHAR(20) NULL DEFAULT NULL, - "consumertype" VARCHAR(100) NULL DEFAULT NULL, - "fund" VARCHAR NULL DEFAULT NULL, - "fundsource" VARCHAR NULL DEFAULT NULL, - "function" VARCHAR NULL DEFAULT NULL, - "boundary" VARCHAR NULL DEFAULT NULL, - "department" VARCHAR NULL DEFAULT NULL, - "voucherheader" VARCHAR NULL DEFAULT NULL, - "depositedbranch" VARCHAR NULL DEFAULT NULL, - "version" BIGINT NOT NULL DEFAULT E'1', - "createdby" BIGINT NOT NULL, - "lastmodifiedby" BIGINT NOT NULL, - "tenantid" VARCHAR NOT NULL, - "cancellationremarks" VARCHAR(256) NULL DEFAULT NULL, - "receiptdate" BIGINT NOT NULL, - "createddate" BIGINT NOT NULL, - "lastmodifieddate" BIGINT NOT NULL, - "referencedate" BIGINT NOT NULL DEFAULT E'100', - "transactionid" VARCHAR(32) NULL DEFAULT NULL, - CONSTRAINT pk_egcl_receiptheader PRIMARY KEY (id) -); - - -CREATE INDEX idx_rcpthd_consumercode ON egcl_receiptheader(consumercode); -CREATE INDEX idx_rcpthd_transactionid ON egcl_receiptheader(transactionid); -CREATE INDEX idx_rcpthd_mreceiptnumber ON egcl_receiptheader(manualreceiptnumber); -CREATE INDEX idx_rcpthd_refno ON egcl_receiptheader(referencenumber); -CREATE INDEX idx_rcpthd_business ON egcl_receiptheader(businessdetails); -CREATE INDEX idx_rcpthd_status ON egcl_receiptheader(status); - - -CREATE TABLE "egcl_receiptdetails" ( - "id" VARCHAR(36) NOT NULL, - "chartofaccount" VARCHAR NOT NULL, - "dramount" NUMERIC(12,2) NULL DEFAULT NULL, - "cramount" NUMERIC(12,2) NULL DEFAULT NULL, - "ordernumber" BIGINT NULL DEFAULT NULL, - "receiptheader" VARCHAR(36) NOT NULL, - "actualcramounttobepaid" NUMERIC(12,2) NULL DEFAULT NULL, - "description" VARCHAR(500) NULL DEFAULT NULL, - "financialyear" VARCHAR NULL DEFAULT NULL, - "isactualdemand" BOOLEAN NULL DEFAULT NULL, - "purpose" VARCHAR(50) NOT NULL, - "tenantid" VARCHAR NOT NULL, - CONSTRAINT pk_egcl_receiptdetails PRIMARY KEY (id), - CONSTRAINT fk_rcptdtls_rcpthead FOREIGN KEY (receiptheader) - REFERENCES egcl_receiptheader (id) MATCH SIMPLE - ON UPDATE CASCADE - ON DELETE CASCADE -); - - -CREATE TABLE "egcl_instrumentheader" ( - id VARCHAR(36) NOT NULL, - transactionNumber varchar(50) NOT NULL, - transactionDate BIGINT NOT NULL, - amount numeric (12,2) NOT NULL, - instrumentType varchar(50) NOT NULL, - instrumentStatus varchar(50) NOT NULL, - bankId varchar(50), - branchName varchar(50), - bankAccountId varchar(50), - ifscCode varchar(20), - financialStatus varchar(50), - transactionType varchar(6), - payee varchar(50), - drawer varchar(100), - surrenderReason varchar(50), - serialNo varchar(50), - createdby varchar(50), - createddate BIGINT NOT NULL, - lastmodifiedby varchar(50), - lastmodifieddate BIGINT NOT NULL, - tenantId varchar(250), - CONSTRAINT pk_egcl_instrumenthead PRIMARY KEY (id) -); - -CREATE INDEX idx_ins_transactionnumber ON egcl_instrumentheader(transactionNumber); - - -CREATE TABLE EGCL_RECEIPTINSTRUMENT ( - RECEIPTHEADER VARCHAR(36) NOT NULL, - INSTRUMENTHEADER VARCHAR(36) NOT NULL, - CONSTRAINT FK_RCPTINST_RCPTHEAD FOREIGN KEY (RECEIPTHEADER) - REFERENCES EGCL_RECEIPTHEADER (ID) - ON UPDATE CASCADE - ON DELETE CASCADE, - CONSTRAINT FK_RCPTINST_INSTHEAD FOREIGN KEY (INSTRUMENTHEADER) - REFERENCES EGCL_INSTRUMENTHEADER (ID) - ON UPDATE CASCADE - ON DELETE CASCADE -); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20180904130655__alter_receipt_header.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20180904130655__alter_receipt_header.sql deleted file mode 100644 index d462afaed76..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20180904130655__alter_receipt_header.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE "egcl_receiptheader" -ADD COLUMN "collectedamount" NUMERIC(12,2) DEFAULT NULL, -ADD COLUMN "manualreceiptdate" BIGINT; diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20181001121955__alter_receipt_additional_details.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20181001121955__alter_receipt_additional_details.sql deleted file mode 100644 index 7bdf79489d2..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20181001121955__alter_receipt_additional_details.sql +++ /dev/null @@ -1,10 +0,0 @@ -ALTER TABLE egcl_receiptheader ADD COLUMN additionalDetails JSONB; -ALTER TABLE egcl_receiptdetails ADD COLUMN additionalDetails JSONB; -ALTER TABLE egcl_instrumentheader ADD COLUMN additionalDetails JSONB; - -ALTER TABLE egcl_receiptheader ADD COLUMN payeemobile varchar(50); - -ALTER TABLE egcl_receiptheader ALTER COLUMN transactionid TYPE varchar(50); - -ALTER TABLE egcl_instrumentheader ADD COLUMN instrumentDate BIGINT; -ALTER TABLE egcl_instrumentheader ADD COLUMN instrumentNumber varchar(50); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20181016084259__collection_bankaccount_service_mapping_corr.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20181016084259__collection_bankaccount_service_mapping_corr.sql deleted file mode 100644 index 3a66be71998..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20181016084259__collection_bankaccount_service_mapping_corr.sql +++ /dev/null @@ -1,22 +0,0 @@ -DROP TABLE IF EXISTS egcl_bankaccountservicemapping; - -DROP SEQUENCE IF EXISTS seq_egcl_bankaccountservicemapping; - -CREATE TABLE egcl_bankaccountservicemapping -( - id bigint NOT NULL, - businessdetails character varying(12) NOT NULL, - bankaccount character varying(12) NOT NULL, - bank character varying(12) , - bankbranch character varying(12), - active boolean, - version bigint NOT NULL DEFAULT 1, - createdby bigint NOT NULL, - lastmodifiedby bigint NOT NULL, - createddate bigint, - lastmodifieddate bigint, - tenantid character varying(252) NOT NULL, - CONSTRAINT pk_egcl_bankaccountservicemapping PRIMARY KEY (id) - ); - -CREATE SEQUENCE seq_egcl_bankaccountservicemapping; \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20181022115827__collection_remittance_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20181022115827__collection_remittance_ddl.sql deleted file mode 100644 index af33de817ef..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20181022115827__collection_remittance_ddl.sql +++ /dev/null @@ -1,40 +0,0 @@ -CREATE TABLE egcl_remittance -( - id character varying(250) NOT NULL, - referencenumber character varying(50) NOT NULL, - referencedate bigint NOT NULL, - voucherheader character varying(250), - fund character varying(250), - function character varying(250), - remarks character varying(250), - reasonfordelay character varying(250), - status character varying(250) NOT NULL, - createdby bigint NOT NULL, - createddate bigint, - lastmodifiedby bigint NOT NULL, - lastmodifieddate bigint, - bankaccount character varying(250), - tenantid character varying(252) NOT NULL, - CONSTRAINT pk_egcl_remittance PRIMARY KEY (id) - ); - - CREATE TABLE egcl_remittancedetails -( - id character varying(250) NOT NULL, - remittance character varying(250) NOT NULL, - chartofaccount character varying(250) NOT NULL, - creditamount double precision, - debitamount double precision, - tenantid character varying(252) NOT NULL, - CONSTRAINT pk_egcl_remittancedetails PRIMARY KEY (id) - ); - - CREATE TABLE egcl_remittanceinstrument -( - id character varying(250) NOT NULL, - remittance character varying(250) NOT NULL, - instrument character varying(250) NOT NULL, - reconciled boolean DEFAULT false, - tenantid character varying(252) NOT NULL, - CONSTRAINT pk_egcl_remittanceinstrument PRIMARY KEY (id) - ); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20181023173723__collection_remittance_receipt_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20181023173723__collection_remittance_receipt_ddl.sql deleted file mode 100644 index 8b6d1b0d653..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20181023173723__collection_remittance_receipt_ddl.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE egcl_remittancereceipt -( - id character varying(250) NOT NULL, - remittance character varying(250) NOT NULL, - receipt character varying(250) NOT NULL, - tenantid character varying(252) NOT NULL, - CONSTRAINT pk_egcl_remittancereceipt PRIMARY KEY (id) - ); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20181026102700__collection_remittance_alter_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20181026102700__collection_remittance_alter_ddl.sql deleted file mode 100644 index 4a117dc6703..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20181026102700__collection_remittance_alter_ddl.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE egcl_remittance ALTER COLUMN createdby DROP NOT NULL; - -ALTER TABLE egcl_remittance ALTER COLUMN lastmodifiedby DROP NOT NULL; \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20181029152415__collection_bankaccount_sm_alter_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20181029152415__collection_bankaccount_sm_alter_ddl.sql deleted file mode 100644 index 308bbc950fd..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20181029152415__collection_bankaccount_sm_alter_ddl.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE egcl_bankaccountservicemapping ALTER COLUMN bankaccount TYPE varchar(20); - -ALTER TABLE egcl_bankaccountservicemapping ALTER COLUMN bankbranch TYPE varchar(80); - -ALTER TABLE egcl_bankaccountservicemapping ALTER COLUMN bank TYPE varchar(256); - -ALTER TABLE egcl_bankaccountservicemapping ALTER COLUMN businessdetails TYPE varchar(256); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20190325111630__receipt_v1_create_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20190325111630__receipt_v1_create_ddl.sql deleted file mode 100644 index 80e9a251014..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20190325111630__receipt_v1_create_ddl.sql +++ /dev/null @@ -1,229 +0,0 @@ -CREATE TABLE egcl_receiptheader_v1 -( - id character varying(36) NOT NULL, - payername character varying(256) , - payeraddress character varying(1024) , - payeremail character varying(254) , - paidby character varying(1024) , - referencenumber character varying(50) , - receipttype character varying(32) NOT NULL, - receiptnumber character varying(50) , - referencedesc character varying(250) , - manualreceiptnumber character varying(50) , - businessdetails character varying(32) NOT NULL, - collectiontype character varying(50) NOT NULL, - displaymsg character varying(256) , - reference_ch_id bigint, - stateid bigint, - location bigint, - isreconciled boolean, - status character varying(50) NOT NULL, - reasonforcancellation character varying(250) , - minimumamount numeric(12,2), - totalamount numeric(12,2), - collmodesnotallwd character varying(256) , - consumercode character varying(256) , - channel character varying(20) , - consumertype character varying(100) , - fund character varying , - fundsource character varying , - function character varying , - boundary character varying , - department character varying , - voucherheader character varying , - depositedbranch character varying , - version bigint NOT NULL DEFAULT 1, - createdby character varying(256) NOT NULL, - lastmodifiedby character varying(256) NOT NULL, - tenantid character varying NOT NULL, - cancellationremarks character varying(256) , - receiptdate bigint NOT NULL, - createddate bigint NOT NULL, - lastmodifieddate bigint NOT NULL, - referencedate bigint NOT NULL , - transactionid character varying(50) , - collectedamount numeric(12,2), - manualreceiptdate bigint, - additionaldetails jsonb, - payermobile character varying(50) , - demandid character varying(256) , - demandfromdate bigint, - demandtodate bigint, - CONSTRAINT pk_egcl_receiptheader_v1 PRIMARY KEY (id) -); - - -CREATE TABLE egcl_receiptdetails_v1 -( - id character varying(36) NOT NULL, - chartofaccount character varying , - dramount numeric(12,2) , - cramount numeric(12,2) , - ordernumber bigint, - receiptheader character varying(36) NOT NULL, - actualcramounttobepaid numeric(12,2) , - description character varying(500) , - financialyear character varying , - isactualdemand boolean, - purpose character varying(50) , - tenantid character varying NOT NULL, - additionaldetails jsonb, - amount numeric(12,2) , - adjustedamount numeric(12,2) , - demanddetailid character varying(256) , - taxheadcode character varying(256) , - CONSTRAINT pk_egcl_receiptdetails_v1 PRIMARY KEY (id), - CONSTRAINT fk_rcptdtls_rcpthead_v1 FOREIGN KEY (receiptheader) - REFERENCES egcl_receiptheader_v1 (id) MATCH SIMPLE - ON UPDATE CASCADE - ON DELETE CASCADE -); - -CREATE TABLE egcl_receiptheader_v1_history -( - id character varying(36) , - payername character varying(256) , - payeraddress character varying(1024) , - payeremail character varying(254) , - paidby character varying(1024) , - referencenumber character varying(50) , - receipttype character varying(32) , - receiptnumber character varying(50) , - referencedesc character varying(250) , - manualreceiptnumber character varying(50) , - businessdetails character varying(32) , - collectiontype character varying(50) , - displaymsg character varying(256) , - reference_ch_id bigint, - stateid bigint, - location bigint, - isreconciled boolean, - status character varying(50) , - reasonforcancellation character varying(250) , - minimumamount numeric(12,2), - totalamount numeric(12,2), - collmodesnotallwd character varying(256) , - consumercode character varying(256) , - channel character varying(20) , - consumertype character varying(100) , - fund character varying , - fundsource character varying , - function character varying , - boundary character varying , - department character varying , - voucherheader character varying , - depositedbranch character varying , - version bigint, - createdby character varying(256) , - lastmodifiedby character varying(256) , - tenantid character varying(256) , - cancellationremarks character varying(256) , - receiptdate bigint, - createddate bigint, - lastmodifieddate bigint, - referencedate bigint, - transactionid character varying(50) , - collectedamount numeric(12,2), - manualreceiptdate bigint, - additionaldetails jsonb, - payermobile character varying(50) , - uuid character varying(256) NOT NULL, - demandid character varying(256) , - demandfromdate bigint, - demandtodate bigint -); - -CREATE TABLE egcl_receiptdetails_v1_history -( - id character varying(36) , - chartofaccount character varying , - dramount numeric(12,2), - cramount numeric(12,2), - ordernumber bigint, - receiptheader character varying(36) , - actualcramounttobepaid numeric(12,2), - description character varying(500) , - financialyear character varying , - isactualdemand boolean, - purpose character varying(50) , - tenantid character varying (256), - additionaldetails jsonb, - amount numeric(12,2), - adjustedamount numeric(12,2), - uuid character varying(256) NOT NULL, - demanddetailid character varying(256) , - taxheadcode character varying(256) -); - -CREATE TABLE egcl_instrumentheader_v1 -( - id character varying(36) NOT NULL, - transactionnumber character varying(50) NOT NULL, - transactiondate bigint NOT NULL, - amount numeric(12,2) NOT NULL, - instrumenttype character varying(50) NOT NULL, - instrumentstatus character varying(50) NOT NULL, - bankid character varying(50) , - branchname character varying(50) , - bankaccountid character varying(50) , - ifsccode character varying(20) , - financialstatus character varying(50) , - transactiontype character varying(6) , - payee character varying(50) , - drawer character varying(100) , - surrenderreason character varying(50) , - serialno character varying(50) , - createdby character varying(50) , - createddate bigint NOT NULL, - lastmodifiedby character varying(50) , - lastmodifieddate bigint NOT NULL, - tenantid character varying(250) , - additionaldetails jsonb, - instrumentdate bigint, - instrumentnumber character varying(50) , - CONSTRAINT pk_egcl_instrumenthead_v1 PRIMARY KEY (id) -); - -CREATE TABLE egcl_instrumentheader_v1_history -( - id character varying(36) , - transactionnumber character varying(50) , - transactiondate bigint, - amount numeric(12,2), - instrumenttype character varying(50) , - instrumentstatus character varying(50) , - bankid character varying(50) , - branchname character varying(50) , - bankaccountid character varying(50) , - ifsccode character varying(20) , - financialstatus character varying(50) , - transactiontype character varying(6) , - payee character varying(50) , - drawer character varying(100) , - surrenderreason character varying(50) , - serialno character varying(50) , - createdby character varying(50) , - createddate bigint, - lastmodifiedby character varying(50) , - lastmodifieddate bigint, - tenantid character varying(250) , - additionaldetails jsonb, - instrumentdate bigint, - instrumentnumber character varying(50) , - uuid character varying(256) NOT NULL -); - -CREATE TABLE egcl_receiptinstrument_v1 -( - receiptheader character varying(36) NOT NULL, - instrumentheader character varying(36) NOT NULL, - CONSTRAINT fk_rcptinst_insthead FOREIGN KEY (instrumentheader) - REFERENCES egcl_instrumentheader_v1 (id) MATCH SIMPLE - ON UPDATE CASCADE - ON DELETE CASCADE, - CONSTRAINT fk_rcptinst_rcpthead FOREIGN KEY (receiptheader) - REFERENCES egcl_receiptheader_v1 (id) MATCH SIMPLE - ON UPDATE CASCADE - ON DELETE CASCADE -); - diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20190426132730__alter_rcptheader_add_payerid_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20190426132730__alter_rcptheader_add_payerid_ddl.sql deleted file mode 100644 index f14f4dde701..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20190426132730__alter_rcptheader_add_payerid_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egcl_receiptheader_v1 ADD COLUMN payerid varchar(256); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20190506162422__alter_rcptheader_history_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20190506162422__alter_rcptheader_history_ddl.sql deleted file mode 100644 index 15c4b833b4b..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20190506162422__alter_rcptheader_history_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egcl_receiptheader_v1_history ADD COLUMN payerid varchar(256); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20190529194925__alter_payee_length_instrumentheaderv1.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20190529194925__alter_payee_length_instrumentheaderv1.sql deleted file mode 100644 index 1df46373be9..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20190529194925__alter_payee_length_instrumentheaderv1.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egcl_instrumentheader_v1 alter column payee TYPE character varying(256) \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20190712111830__alter_egcl_receiptheader_and_history.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20190712111830__alter_egcl_receiptheader_and_history.sql deleted file mode 100644 index 0f02fd927bd..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20190712111830__alter_egcl_receiptheader_and_history.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE egcl_receiptheader_v1 ALTER COLUMN receipttype TYPE character varying(256), ALTER COLUMN businessdetails TYPE character varying(256); - -ALTER TABLE egcl_receiptheader_v1_history ALTER COLUMN receipttype TYPE character varying(256), ALTER COLUMN businessdetails TYPE character varying(256); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20190903171638__alter_column_length_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20190903171638__alter_column_length_ddl.sql deleted file mode 100644 index ed11b379053..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20190903171638__alter_column_length_ddl.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE egcl_receiptheader_v1 alter column businessdetails TYPE character varying(500); -ALTER TABLE egcl_receiptheader_v1 alter column receipttype TYPE character varying(500); - -ALTER TABLE egcl_receiptheader_v1_history alter column businessdetails TYPE character varying(500); -ALTER TABLE egcl_receiptheader_v1_history alter column receipttype TYPE character varying(500); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20190911170321__egcl_all_indices_update_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20190911170321__egcl_all_indices_update_ddl.sql deleted file mode 100644 index a450f6d3b6f..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20190911170321__egcl_all_indices_update_ddl.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE UNIQUE INDEX IF NOT EXISTS pk_egcl_bankaccountservicemapping ON public.egcl_bankaccountservicemapping USING btree (id); -CREATE INDEX IF NOT EXISTS idx_ins_transactionnumber_v1 ON public.egcl_instrumentheader_v1 USING btree (transactionnumber); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egcl_instrumenthead_v1 ON public.egcl_instrumentheader_v1 USING btree (id); -CREATE INDEX IF NOT EXISTS idx_receiptdetails_v1_receiptheader ON public.egcl_receiptdetails_v1 USING btree (receiptheader); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egcl_receiptdetails_v1 ON public.egcl_receiptdetails_v1 USING btree (id); -CREATE INDEX IF NOT EXISTS idx_rcpthd_v1_business ON public.egcl_receiptheader_v1 USING btree (businessdetails); -CREATE INDEX IF NOT EXISTS idx_rcpthd_v1_consumercode ON public.egcl_receiptheader_v1 USING btree (consumercode); -CREATE INDEX IF NOT EXISTS idx_rcpthd_v1_mreceiptnumber ON public.egcl_receiptheader_v1 USING btree (manualreceiptnumber); -CREATE INDEX IF NOT EXISTS idx_rcpthd_v1_refno ON public.egcl_receiptheader_v1 USING btree (referencenumber); -CREATE INDEX IF NOT EXISTS idx_rcpthd_v1_status ON public.egcl_receiptheader_v1 USING btree (status); -CREATE INDEX IF NOT EXISTS idx_rcpthd_v1_transactionid ON public.egcl_receiptheader_v1 USING btree (transactionid); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egcl_receiptheader_v1 ON public.egcl_receiptheader_v1 USING btree (id); -CREATE INDEX IF NOT EXISTS idx_receiptinstrument_v1_instrumentheader ON public.egcl_receiptinstrument_v1 USING btree (instrumentheader); -CREATE INDEX IF NOT EXISTS idx_receiptinstrument_v1_receiptheader ON public.egcl_receiptinstrument_v1 USING btree (receiptheader); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egcl_remittance ON public.egcl_remittance USING btree (id); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egcl_remittancedetails ON public.egcl_remittancedetails USING btree (id); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egcl_remittanceinstrument ON public.egcl_remittanceinstrument USING btree (id); -CREATE UNIQUE INDEX IF NOT EXISTS pk_egcl_remittancereceipt ON public.egcl_remittancereceipt USING btree (id); diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20191003121332__egl_payment_create_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20191003121332__egl_payment_create_ddl.sql deleted file mode 100644 index e097ef34f40..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20191003121332__egl_payment_create_ddl.sql +++ /dev/null @@ -1,234 +0,0 @@ -CREATE TABLE egcl_payment ( - id VARCHAR(256) NOT NULL, - tenantId VARCHAR(256) NOT NULL, - totalDue numeric(12,2) NOT NULL, - totalAmountPaid numeric(12,2) NOT NULL, - transactionNumber VARCHAR(256) NOT NULL, - transactionDate BIGINT NOT NULL, - paymentMode VARCHAR(64) NOT NULL, - instrumentDate BIGINT, - instrumentNumber VARCHAR(256), - instrumentStatus VARCHAR(256) NOT NULL, - ifscCode VARCHAR(64), - additionalDetails JSONB, - paidBy VARCHAR(256) , - mobileNumber VARCHAR(64) NOT NULL, - payerName VARCHAR(256) , - payerAddress VARCHAR(1024), - payerEmail VARCHAR(256), - payerId VARCHAR(256) , - paymentStatus VARCHAR(256) NOT NULL, - createdBy VARCHAR(256) NOT NULL, - createdtime BIGINT NOT NULL, - lastModifiedBy VARCHAR(256) NOT NULL, - lastModifiedTime BIGINT NOT NULL, - - CONSTRAINT pk_egcl_payment PRIMARY KEY (id) - -); - -CREATE INDEX IF NOT EXISTS idx_egcl_payment_transactionNumber ON egcl_payment(transactionNumber); -CREATE INDEX IF NOT EXISTS idx_egcl_payment_payerId ON egcl_payment(payerId); -CREATE INDEX IF NOT EXISTS idx_egcl_payment_mobileNumber ON egcl_payment(mobileNumber); - - - -CREATE TABLE egcl_paymentDetail ( - id VARCHAR(256) NOT NULL, - tenantId VARCHAR(256) NOT NULL, - paymentid VARCHAR(256) NOT NULL, - due numeric(12,2) NOT NULL, - amountPaid numeric(12,2) NOT NULL, - receiptNumber VARCHAR(256) NOT NULL, - receiptDate BIGINT NOT NULL, - receiptType VARCHAR(256) NOT NULL, - businessService VARCHAR(256) NOT NULL, - billId VARCHAR(256) NOT NULL, - additionalDetails JSONB, - createdBy VARCHAR(256) NOT NULL, - createdTime BIGINT NOT NULL, - lastModifiedBy VARCHAR(256) NOT NULL, - lastModifiedTime BIGINT NOT NULL, - - CONSTRAINT pk_egcl_paymentDetail PRIMARY KEY (id), - CONSTRAINT uk_egcl_paymentDetail UNIQUE (billId), - CONSTRAINT fk_egcl_paymentDetail FOREIGN KEY (paymentid) REFERENCES egcl_payment(id) - - ON UPDATE CASCADE - ON DELETE CASCADE -); - -CREATE INDEX IF NOT EXISTS idx_egcl_paymentDetail_receiptNumber ON egcl_paymentDetail(receiptNumber); -CREATE INDEX IF NOT EXISTS idx_egcl_paymentDetail_billId ON egcl_paymentDetail(billId); - - - -CREATE TABLE egcl_bill( - id VARCHAR(256) NOT NULL, - status VARCHAR(256) NOT NULL, - isCancelled boolean, - additionalDetails JSONB, - tenantId VARCHAR(256) NOT NULL, - collectionModesNotAllowed VARCHAR(256), - partPaymentAllowed boolean, - isAdvanceAllowed boolean, - minimumAmountToBePaid numeric(12,2), - businessService VARCHAR(256) NOT NULL, - totalAmount numeric(12,2) NOT NULL, - consumerCode VARCHAR(256) NOT NULL, - billNumber VARCHAR(256) NOT NULL, - billDate BIGINT NOT NULL, - reasonForCancellation VARCHAR(2048), - createdBy VARCHAR(256) NOT NULL, - createdTime BIGINT NOT NULL, - lastModifiedBy VARCHAR(256) NOT NULL, - lastModifiedTime BIGINT NOT NULL, - - CONSTRAINT pk_egcl_bill PRIMARY KEY (id), - CONSTRAINT fk_egcl_bill FOREIGN KEY (id) REFERENCES egcl_paymentdetail(billid) -); - -CREATE INDEX IF NOT EXISTS idx_egcl_bill_consumerCode ON egcl_bill(consumerCode); - - -CREATE TABLE egcl_billdetial( - id VARCHAR(256) NOT NULL, - tenantId VARCHAR(256) NOT NULL, - demandId VARCHAR(256) NOT NULL, - billId VARCHAR(256) NOT NULL, - amount numeric(12,2) NOT NULL, - amountPaid numeric(12,2) NOT NULL, - fromPeriod BIGINT NOT NULL, - toPeriod BIGINT NOT NULL, - additionalDetails JSONB, - channel VARCHAR(256), - voucherHeader VARCHAR(256), - boundary VARCHAR(256), - manualReceiptNumber VARCHAR(256), - manualReceiptDate BIGINT, - collectionType VARCHAR(256), - billDescription VARCHAR(256), - expiryDate VARCHAR(256) NOT NULL, - displayMessage VARCHAR(2048), - callBackForApportioning VARCHAR(256), - cancellationRemarks VARCHAR(2048), - - - CONSTRAINT pk_egcl_billdetail PRIMARY KEY (id), - CONSTRAINT fk_egcl_billdetail FOREIGN KEY (billId) REFERENCES egcl_bill(id) -); - - - -CREATE TABLE egcl_billAccountDetail ( - id VARCHAR(256) NOT NULL, - tenantId VARCHAR(256) NOT NULL, - billDetailid VARCHAR(256) NOT NULL, - demandDetailId VARCHAR(256) NOT NULL, - "order" Integer NOT NULL, - amount numeric(12,2) NOT NULL, - isActualDemand Boolean, - taxHeadCode VARCHAR(256) NOT NULL, - additionalDetails JSONB, - - CONSTRAINT pk_egcl_payment_taxhead PRIMARY KEY (id), - CONSTRAINT fk_egcl_payment_taxhead FOREIGN KEY (billDetailid) REFERENCES egcl_billdetial(id) - - ON UPDATE CASCADE - ON DELETE CASCADE -); - - -CREATE TABLE egcl_payment_audit ( - id VARCHAR(256) NOT NULL, - tenantId VARCHAR(256) NOT NULL, - totalDue numeric(12,2) NOT NULL, - totalAmountPaid numeric(12,2) NOT NULL, - transactionNumber VARCHAR(256) NOT NULL, - transactionDate BIGINT NOT NULL, - paymentMode VARCHAR(64) NOT NULL, - instrumentDate BIGINT, - instrumentNumber VARCHAR(256), - instrumentStatus VARCHAR(256) NOT NULL, - ifscCode VARCHAR(64), - additionalDetails JSONB, - paidBy VARCHAR(256) , - mobileNumber VARCHAR(64) NOT NULL, - payerName VARCHAR(256) , - payerAddress VARCHAR(1024), - payerEmail VARCHAR(256), - payerId VARCHAR(256) , - paymentStatus VARCHAR(256) NOT NULL, - createdBy VARCHAR(256) NOT NULL, - createdTime BIGINT NOT NULL, - lastModifiedBy VARCHAR(256) NOT NULL, - lastModifiedTime BIGINT NOT NULL - -); - - -CREATE TABLE egcl_paymentDetail_audit ( - id VARCHAR(256) NOT NULL, - tenantId VARCHAR(256) NOT NULL, - paymentid VARCHAR(256) NOT NULL, - due numeric(12,2) NOT NULL, - amountPaid numeric(12,2) NOT NULL, - receiptNumber VARCHAR(256) NOT NULL, - businessService VARCHAR(256) NOT NULL, - billId VARCHAR(256) NOT NULL, - additionalDetails JSONB, - createdBy VARCHAR(256) NOT NULL, - createdTime BIGINT NOT NULL, - lastModifiedBy VARCHAR(256) NOT NULL, - lastModifiedTime BIGINT NOT NULL -); - - -CREATE TABLE egcl_bill_audit( - id VARCHAR(256) NOT NULL, - status VARCHAR(256) NOT NULL, - isCancelled boolean, - additionalDetails JSONB, - tenantId VARCHAR(256) NOT NULL, - collectionModesNotAllowed VARCHAR(256), - partPaymentAllowed boolean, - isAdvanceAllowed boolean, - minimumAmountToBePaid numeric(12,2), - businessService VARCHAR(256) NOT NULL, - totalAmount numeric(12,2) NOT NULL, - consumerCode VARCHAR(256) NOT NULL, - billNumber VARCHAR(256) NOT NULL, - billDate BIGINT NOT NULL, - reasonForCancellation VARCHAR(2048), - createdBy VARCHAR(256) NOT NULL, - createdTime BIGINT NOT NULL, - lastModifiedBy VARCHAR(256) NOT NULL, - lastModifiedTime BIGINT NOT NULL -); - - -CREATE TABLE egcl_billdetial_audit( - id VARCHAR(256) NOT NULL, - tenantId VARCHAR(256) NOT NULL, - demandId VARCHAR(256) NOT NULL, - billId VARCHAR(256) NOT NULL, - amount numeric(12,2) NOT NULL, - amountPaid numeric(12,2) NOT NULL, - fromPeriod BIGINT NOT NULL, - toPeriod BIGINT NOT NULL, - additionalDetails JSONB, - receiptDate BIGINT NOT NULL, - receiptType VARCHAR(256) NOT NULL, - channel VARCHAR(256), - voucherHeader VARCHAR(256), - boundary VARCHAR(256), - manualReceiptNumber VARCHAR(256), - manualReceiptDate BIGINT, - collectionType VARCHAR(256), - billDescription VARCHAR(256), - expiryDate VARCHAR(256) NOT NULL, - displayMessage VARCHAR(2048), - callBackForApportioning VARCHAR(256), - cancellationRemarks VARCHAR(2048) -); - diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20191111124203__add_manual_rcptno_pymntdtl_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20191111124203__add_manual_rcptno_pymntdtl_ddl.sql deleted file mode 100644 index a408a285096..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20191111124203__add_manual_rcptno_pymntdtl_ddl.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE egcl_paymentDetail ADD COLUMN manualreceiptnumber varchar(256); -ALTER TABLE egcl_paymentDetail_audit ADD COLUMN manualreceiptnumber varchar(256); - -ALTER TABLE egcl_billdetial DROP COLUMN manualReceiptNumber; -ALTER TABLE egcl_billdetial_audit DROP COLUMN manualReceiptNumber; \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20191111132320__add_manual_rcptdt_pmntdtl_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20191111132320__add_manual_rcptdt_pmntdtl_ddl.sql deleted file mode 100644 index a3d21f21f0e..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20191111132320__add_manual_rcptdt_pmntdtl_ddl.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE egcl_paymentDetail ADD COLUMN manualreceiptdate BIGINT; -ALTER TABLE egcl_paymentDetail_audit ADD COLUMN manualreceiptdate BIGINT; - -ALTER TABLE egcl_billdetial DROP COLUMN manualReceiptDate; -ALTER TABLE egcl_billdetial_audit DROP COLUMN manualReceiptDate; \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20191112134348__add_adjustedamt_billdtl_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20191112134348__add_adjustedamt_billdtl_ddl.sql deleted file mode 100644 index ae6d6ba2528..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20191112134348__add_adjustedamt_billdtl_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egcl_billAccountDetail ADD COLUMN adjustedamount numeric(12,2); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20191205171923__alter_audits_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20191205171923__alter_audits_ddl.sql deleted file mode 100644 index 658fb86a005..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20191205171923__alter_audits_ddl.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE egcl_paymentDetail_audit ADD COLUMN receiptdate BIGINT; -ALTER TABLE egcl_paymentDetail_audit ADD COLUMN receipttype character varying(256); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20191210153821__alter_payment_mobno_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20191210153821__alter_payment_mobno_ddl.sql deleted file mode 100644 index 1a2e38f496e..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20191210153821__alter_payment_mobno_ddl.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE egcl_payment ALTER COLUMN mobileNumber DROP NOT NULL; -ALTER TABLE egcl_payment_audit ALTER COLUMN mobileNumber DROP NOT NULL; \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20200319102633__egcl_payment_add_filestoreid_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20200319102633__egcl_payment_add_filestoreid_ddl.sql deleted file mode 100644 index 68f1205bc2b..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20200319102633__egcl_payment_add_filestoreid_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egcl_payment ADD COLUMN filestoreid VARCHAR(1024); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20200810133238__egcl_payment_audit_filestore_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20200810133238__egcl_payment_audit_filestore_ddl.sql deleted file mode 100644 index a762c6a7bff..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20200810133238__egcl_payment_audit_filestore_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egcl_payment_audit ADD COLUMN filestoreid VARCHAR(1024); diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20201005230836__egcl_payment_bill_index_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20201005230836__egcl_payment_bill_index_ddl.sql deleted file mode 100644 index 6fc5ffc4c15..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20201005230836__egcl_payment_bill_index_ddl.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE index if not exists idx_egcl_billaccountdetail_billdetailid ON egcl_billaccountdetail USING btree (billdetailid); -CREATE index if not exists idx_egcl_billdetial_billdetail_billid ON egcl_billdetial USING btree (billid); -CREATE index if not exists idx_egcl_paymentdetail_paymentid ON egcl_paymentdetail USING btree (paymentid); diff --git a/business-services/collection-services/src/main/resources/db/migration/main/V20201127163033__add_idx_ddl.sql b/business-services/collection-services/src/main/resources/db/migration/main/V20201127163033__add_idx_ddl.sql deleted file mode 100644 index 1552c18a3a7..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/main/V20201127163033__add_idx_ddl.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE INDEX IF NOT EXISTS idx_egcl_payment_paymentstatus ON public.egcl_payment USING btree (paymentstatus); -CREATE INDEX IF NOT EXISTS idx_egcl_payment_tenant_id_paymentstatus ON public.egcl_payment USING btree (tenantid, id, paymentstatus); \ No newline at end of file diff --git a/business-services/collection-services/src/main/resources/db/migration/migration_file_name_gen.sh b/business-services/collection-services/src/main/resources/db/migration/migration_file_name_gen.sh deleted file mode 100644 index 912f2eb030a..00000000000 --- a/business-services/collection-services/src/main/resources/db/migration/migration_file_name_gen.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - - -echo "Please enter your script file name : " -read given_name -file_name=$given_name - -current_time=$(date "+%Y%m%d%H%M%S") - -echo "Current Time : $current_time" - -new_fileName="V""$current_time"__"$file_name" - -echo "New FileName: " "$new_fileName" - -mv $file_name $new_fileName - -echo "$new_fileName created under ${PWD}, copy this file to add your migrations folder" - -exit diff --git a/business-services/collection-services/src/main/resources/jmeterScripts/collectionServiceJmeterScript.jmx b/business-services/collection-services/src/main/resources/jmeterScripts/collectionServiceJmeterScript.jmx deleted file mode 100644 index bea604b4fa7..00000000000 --- a/business-services/collection-services/src/main/resources/jmeterScripts/collectionServiceJmeterScript.jmx +++ /dev/null @@ -1,443 +0,0 @@ - - - - - false - - false - - - - - - - - - false - 1 - - 1 - 1 - false - 0 - 0 - continue - true - - - - - false - false - - - - true - - - - false - { - "RequestInfo": { - "apiId": "string", - "ver": "string", - "ts": 0, - "action": "string", - "did": "string", - "key": "string", - "msgId": "string", - "authToken": "37dcdbcc-db50-4ac7-a8c3-1889ec8622c2" - }, - "Payment":{ - "tenantId":"pb.amritsar", - "instrumentNumber":"dsd", - "instrumentDate":"112232323", - "totalAmountPaid":100, - "paymentMode":"CASH", - "paidBy":"xyz", - "mobileNumber":"7878787878", - "paymentDetails":[{ - "businessService":"SW", // add respective businessService - "billId":"6a141863-11a1-4885-840d-ba8f25418603", //add bill id - "totalAmountPaid": 100 - } - ] - - } -} - = - - - - qa.digit.org - - https - - /collection-services/payments/_create - POST - true - false - true - false - - - - - - - - - Content-Type - application/json - - - - - - - true - - - - false - { - "RequestInfo": { - "apiId": "string", - "ver": "string", - "ts": 0, - "action": "string", - "did": "string", - "key": "string", - "msgId": "string", - "authToken": "4c203698-f4f0-443c-b058-d393a604a971", - "userInfo": {"id":12022,"uuid":"4b3c9a8b-a6e6-4e84-99dd-19c883a876aa","userName":"QAMCS","name":"Misc Collector","mobileNumber":"9666554533","emailId":"gubbi678@gmail.com","locale":null,"type":"EMPLOYEE","roles":[{"name":"CSC Collection Operator","code":"CSC_COLL_OPERATOR","tenantId":"pb.amritsar"},{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"},{"name":"Collections Receipt Creator","code":"COLL_RECEIPT_CREATOR","tenantId":"pb.amritsar"},{"name":null,"code":"ULB Operator","tenantId":"pb.amritsar"},{"name":"Customer Support Representative","code":"CSR","tenantId":"pb.amritsar"},{"name":"Collections Remitter","code":"COLL_REMIT_TO_BANK","tenantId":"pb.amritsar"},{"name":"Collection Report Viewer","code":"COLL_REP_VIEW","tenantId":"pb.amritsar"},{"name":"Universal Collection Employee","code":"UC_EMP","tenantId":"pb.amritsar"},{"name":"Abstract Estimate Creator","code":"AE_CREATOR","tenantId":"pb.amritsar"},{"name":"Counter Employee","code":"CEMP","tenantId":"pb.amritsar"},{"name":"Admin of a ULB","code":"CITY_ADMIN","tenantId":"pb.amritsar"},{"name":"State Administrator","code":"STADMIN","tenantId":"pb.amritsar"},{"name":"Grievance Officer","code":"GO","tenantId":"pb.amritsar"},{"name":"Super User","code":"SUPERUSER","tenantId":"pb.amritsar"},{"name":"FSM Payment Collector","code":"FSM_COLLECTOR","tenantId":"pb.amritsar"},{"name":"Bank Collection Operator","code":"BANK_COLL_OPERATOR","tenantId":"pb.amritsar"},{"name":"Collection Operator","code":"COLL_OPERATOR","tenantId":"pb.amritsar"}],"active":true,"tenantId":"pb.amritsar","permanentCity":"Amritsar"} - } -} - = - - - - qa.digit.org - - https - - /collection-services/payments/SW/_search?tenantId=pb.amritsar&consumerCodes=SW/107/2022-23/438239 - POST - true - false - true - false - - - - - - - - - Content-Type - application/json - - - - - - - true - - - - false - { - "RequestInfo": { - "apiId": "string", - "ver": "string", - "ts": 0, - "action": "string", - "did": "string", - "key": "string", - "msgId": "string", - "authToken": "${authToken_amritsar}", - "userInfo": { - "id": 12022, - "uuid": "4b3c9a8b-a6e6-4e84-99dd-19c883a876aa", - "userName": "QAMCS", - "name": "Misc Collector", - "mobileNumber": "9666554533", - "emailId": "gubbi678@gmail.com", - "locale": null, - "type": "EMPLOYEE", - "roles": [ - { - "name": "CSC Collection Operator", - "code": "CSC_COLL_OPERATOR", - "tenantId": "pb.amritsar" - }, - { - "name": "Employee", - "code": "EMPLOYEE", - "tenantId": "pb.amritsar" - }, - { - "name": "Collections Receipt Creator", - "code": "COLL_RECEIPT_CREATOR", - "tenantId": "pb.amritsar" - }, - { - "name": null, - "code": "ULB Operator", - "tenantId": "pb.amritsar" - }, - { - "name": "Customer Support Representative", - "code": "CSR", - "tenantId": "pb.amritsar" - }, - { - "name": "Collections Remitter", - "code": "COLL_REMIT_TO_BANK", - "tenantId": "pb.amritsar" - }, - { - "name": "Collection Report Viewer", - "code": "COLL_REP_VIEW", - "tenantId": "pb.amritsar" - }, - { - "name": "Universal Collection Employee", - "code": "UC_EMP", - "tenantId": "pb.amritsar" - }, - { - "name": "Abstract Estimate Creator", - "code": "AE_CREATOR", - "tenantId": "pb.amritsar" - }, - { - "name": "Counter Employee", - "code": "CEMP", - "tenantId": "pb.amritsar" - }, - { - "name": "Admin of a ULB", - "code": "CITY_ADMIN", - "tenantId": "pb.amritsar" - }, - { - "name": "State Administrator", - "code": "STADMIN", - "tenantId": "pb.amritsar" - }, - { - "name": "Grievance Officer", - "code": "GO", - "tenantId": "pb.amritsar" - }, - { - "name": "Super User", - "code": "SUPERUSER", - "tenantId": "pb.amritsar" - }, - { - "name": "FSM Payment Collector", - "code": "FSM_COLLECTOR", - "tenantId": "pb.amritsar" - }, - { - "name": "Bank Collection Operator", - "code": "BANK_COLL_OPERATOR", - "tenantId": "pb.amritsar" - }, - { - "name": "Collection Operator", - "code": "COLL_OPERATOR", - "tenantId": "pb.amritsar" - } - ], - "active": true, - "tenantId": "pb.amritsar", - "permanentCity": "Amritsar" - } - }, - "paymentWorkflows": [ - { - "paymentId": "a5aa8f22-dfd1-4065-ad56-6531a320d530", - "action": "CANCEL", - "tenantId": "pb.amritsar", - "reason": "official order", - "additionalDetails": null - } - ] -} - = - - - - qa.digit.org - - https - - /collection-services/payments/SW/_workflow - POST - true - false - true - false - - - - - - - - - - - - true - - - - false - { - "RequestInfo": { - "apiId": "string", - "ver": "string", - "ts": 0, - "action": "string", - "did": "string", - "key": "string", - "msgId": "string", - "authToken": "4c203698-f4f0-443c-b058-d393a604a971", - "userInfo": {"id":12022,"uuid":"4b3c9a8b-a6e6-4e84-99dd-19c883a876aa","userName":"QAMCS","name":"Misc Collector","mobileNumber":"9666554533","emailId":"gubbi678@gmail.com","locale":null,"type":"EMPLOYEE","roles":[{"name":"CSC Collection Operator","code":"CSC_COLL_OPERATOR","tenantId":"pb.amritsar"},{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"},{"name":"Collections Receipt Creator","code":"COLL_RECEIPT_CREATOR","tenantId":"pb.amritsar"},{"name":null,"code":"ULB Operator","tenantId":"pb.amritsar"},{"name":"Customer Support Representative","code":"CSR","tenantId":"pb.amritsar"},{"name":"Collections Remitter","code":"COLL_REMIT_TO_BANK","tenantId":"pb.amritsar"},{"name":"Collection Report Viewer","code":"COLL_REP_VIEW","tenantId":"pb.amritsar"},{"name":"Universal Collection Employee","code":"UC_EMP","tenantId":"pb.amritsar"},{"name":"Abstract Estimate Creator","code":"AE_CREATOR","tenantId":"pb.amritsar"},{"name":"Counter Employee","code":"CEMP","tenantId":"pb.amritsar"},{"name":"Admin of a ULB","code":"CITY_ADMIN","tenantId":"pb.amritsar"},{"name":"State Administrator","code":"STADMIN","tenantId":"pb.amritsar"},{"name":"Grievance Officer","code":"GO","tenantId":"pb.amritsar"},{"name":"Super User","code":"SUPERUSER","tenantId":"pb.amritsar"},{"name":"FSM Payment Collector","code":"FSM_COLLECTOR","tenantId":"pb.amritsar"},{"name":"Bank Collection Operator","code":"BANK_COLL_OPERATOR","tenantId":"pb.amritsar"},{"name":"Collection Operator","code":"COLL_OPERATOR","tenantId":"pb.amritsar"}],"active":true,"tenantId":"pb.amritsar","permanentCity":"Amritsar"} - } -} - = - - - - qa.digit.org - - https - - /collection-services/payments/SW/_search?tenantId=pb.amritsar&receiptNumbers=SW/2022-23/1356064 - POST - true - false - true - false - - - - - - - - - Content-Type - application/json - - - - - - - true - - - - false - { - "RequestInfo": { - "apiId": "string", - "ver": "string", - "ts": 0, - "action": "string", - "did": "string", - "key": "string", - "msgId": "string", - "authToken": "4c203698-f4f0-443c-b058-d393a604a971", - "userInfo": {"id":12022,"uuid":"4b3c9a8b-a6e6-4e84-99dd-19c883a876aa","userName":"QAMCS","name":"Misc Collector","mobileNumber":"9666554533","emailId":"gubbi678@gmail.com","locale":null,"type":"EMPLOYEE","roles":[{"name":"CSC Collection Operator","code":"CSC_COLL_OPERATOR","tenantId":"pb.amritsar"},{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"},{"name":"Collections Receipt Creator","code":"COLL_RECEIPT_CREATOR","tenantId":"pb.amritsar"},{"name":null,"code":"ULB Operator","tenantId":"pb.amritsar"},{"name":"Customer Support Representative","code":"CSR","tenantId":"pb.amritsar"},{"name":"Collections Remitter","code":"COLL_REMIT_TO_BANK","tenantId":"pb.amritsar"},{"name":"Collection Report Viewer","code":"COLL_REP_VIEW","tenantId":"pb.amritsar"},{"name":"Universal Collection Employee","code":"UC_EMP","tenantId":"pb.amritsar"},{"name":"Abstract Estimate Creator","code":"AE_CREATOR","tenantId":"pb.amritsar"},{"name":"Counter Employee","code":"CEMP","tenantId":"pb.amritsar"},{"name":"Admin of a ULB","code":"CITY_ADMIN","tenantId":"pb.amritsar"},{"name":"State Administrator","code":"STADMIN","tenantId":"pb.amritsar"},{"name":"Grievance Officer","code":"GO","tenantId":"pb.amritsar"},{"name":"Super User","code":"SUPERUSER","tenantId":"pb.amritsar"},{"name":"FSM Payment Collector","code":"FSM_COLLECTOR","tenantId":"pb.amritsar"},{"name":"Bank Collection Operator","code":"BANK_COLL_OPERATOR","tenantId":"pb.amritsar"},{"name":"Collection Operator","code":"COLL_OPERATOR","tenantId":"pb.amritsar"}],"active":true,"tenantId":"pb.amritsar","permanentCity":"Amritsar"} - } -} - = - - - - qa.digit.org - - https - - /collection-services/payments/SW/_search?tenantId=pb.amritsar&transactionNumber=amritsar2101641377 - POST - true - false - true - false - - - - - - - - - Content-Type - application/json - - - - - - - true - - - - false - { - "RequestInfo": { - "apiId": "string", - "ver": "string", - "ts": 0, - "action": "string", - "did": "string", - "key": "string", - "msgId": "string", - "authToken": "4c203698-f4f0-443c-b058-d393a604a971", - "userInfo": {"id":12022,"uuid":"4b3c9a8b-a6e6-4e84-99dd-19c883a876aa","userName":"QAMCS","name":"Misc Collector","mobileNumber":"9666554533","emailId":"gubbi678@gmail.com","locale":null,"type":"EMPLOYEE","roles":[{"name":"CSC Collection Operator","code":"CSC_COLL_OPERATOR","tenantId":"pb.amritsar"},{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"},{"name":"Collections Receipt Creator","code":"COLL_RECEIPT_CREATOR","tenantId":"pb.amritsar"},{"name":null,"code":"ULB Operator","tenantId":"pb.amritsar"},{"name":"Customer Support Representative","code":"CSR","tenantId":"pb.amritsar"},{"name":"Collections Remitter","code":"COLL_REMIT_TO_BANK","tenantId":"pb.amritsar"},{"name":"Collection Report Viewer","code":"COLL_REP_VIEW","tenantId":"pb.amritsar"},{"name":"Universal Collection Employee","code":"UC_EMP","tenantId":"pb.amritsar"},{"name":"Abstract Estimate Creator","code":"AE_CREATOR","tenantId":"pb.amritsar"},{"name":"Counter Employee","code":"CEMP","tenantId":"pb.amritsar"},{"name":"Admin of a ULB","code":"CITY_ADMIN","tenantId":"pb.amritsar"},{"name":"State Administrator","code":"STADMIN","tenantId":"pb.amritsar"},{"name":"Grievance Officer","code":"GO","tenantId":"pb.amritsar"},{"name":"Super User","code":"SUPERUSER","tenantId":"pb.amritsar"},{"name":"FSM Payment Collector","code":"FSM_COLLECTOR","tenantId":"pb.amritsar"},{"name":"Bank Collection Operator","code":"BANK_COLL_OPERATOR","tenantId":"pb.amritsar"},{"name":"Collection Operator","code":"COLL_OPERATOR","tenantId":"pb.amritsar"}],"active":true,"tenantId":"pb.amritsar","permanentCity":"Amritsar"} - } -} - = - - - - qa.digit.org - - https - - /collection-services/payments/SW/_search?tenantId=pb.amritsar&mobileNumber=7878787878 - POST - true - false - true - false - - - - - - - - - Content-Type - application/json - - - - - - - - - diff --git a/business-services/collection-services/verify.sh b/business-services/collection-services/verify.sh deleted file mode 100644 index d9db414fe82..00000000000 --- a/business-services/collection-services/verify.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -./mvnw clean test verify diff --git a/business-services/dashboard-analytics/CHANGELOG.md b/business-services/dashboard-analytics/CHANGELOG.md deleted file mode 100644 index 60a96b84ea7..00000000000 --- a/business-services/dashboard-analytics/CHANGELOG.md +++ /dev/null @@ -1,60 +0,0 @@ -#Changelog - -All notable changes to this module will be documented in this file. - -## 1.1.9 - 2023-08-11 -- Central Instance Library Integration - -## 1.1.8 - 2023-02-02 - -- Transition from 1.1.8-beta version to 1.1.8 version - -## 1.1.8-beta - 2022-11-04 - -- caching added to search API for performance improvement - -## 1.1.7 - 2022-03-02 -- LineChart ResponseHandler modified to consider the empty value for particular interval -- TodaysCollection property added to the Metric chart, when this property is true query response is expected to have todaysDate and lastUdatedTime aggreagations which would be returned as the plots -- Performance Chart response handler changes to consider only the value of the aggregations which does not have buckets -- AdvanceTable Response handler changes to consider valueType of the chart when pathTypeDataMapping is not configured -- preActionTheory property added to metric chart type, which help to run the computeHelper on the aggregation path before applying action of the chart - Ex: preActionTheory:{"ActualCollection":"repsonseToDifferenceOfDates"} - - - - -## 1.1.6 - 2022-01-13 -- Updated to log4j2 version 2.17.1 - - -## 1.1.5 - 2021-07-23 -- Code changes related to new properties. -- Here are the properties which are added - - isRoundOff from configuration will round off the specific number value. - - chartSpecificProperty, XtableColumnOrder to give the xtable column order as we mention in this configuration - -## 1.1.4 - 2021-05-11 -- security fixes - -## 1.1.3 - 2021-02-26 -- Updated egov mdms host name in application.properties - -## 1.1.2 - 2020-11-18 -- Removed default DDR hard coding - - -## 1.1.1 - 2020-09-01 - -- Added LOCALSETUP.md and README.md -- updated Plot object to support String dataType - -## 1.1.0 - 2020-06-24 - -- Added typescript definition generation plugin -- Upgraded to `tracer:2.0.0-SNAPSHOT` -- Upgraded to spring boot `2.2.6-RELEASE` - -## 1.0.0 - -- Base version diff --git a/business-services/dashboard-analytics/LOCALSETUP.md b/business-services/dashboard-analytics/LOCALSETUP.md deleted file mode 100644 index 909e2334630..00000000000 --- a/business-services/dashboard-analytics/LOCALSETUP.md +++ /dev/null @@ -1,35 +0,0 @@ -# Local Setup - -To setup the dss-analytics service in your local system, clone the [Business Service repository](https://github.com/egovernments/business-services). - -## Dependencies - -### Infra Dependency - -- [ ] Postgres DB -- [ ] Redis -- [x] Elasticsearch -- [ ] Kafka - - [ ] Consumer - - [ ] Producer - -## Running Locally - -To run the dss-analytics in local system, you need to port forward below services. - -```bash - kubectl port-forward -n egov {egov-mdms} 8088:8080 -``` - - -Update below listed properties in `application.properties` before running the project: - -```ini - -- services.esindexer.host=http://localhost:9200/ (elastic search host) -- services.esindexer.host.port=9200 (elastic search port) -- services.esindexer.username=changeme (elastic search db username) -- services.esindexer.password=changeme (elastic search db password) - -``` - diff --git a/business-services/dashboard-analytics/README.md b/business-services/dashboard-analytics/README.md deleted file mode 100644 index abb7b14ea94..00000000000 --- a/business-services/dashboard-analytics/README.md +++ /dev/null @@ -1,52 +0,0 @@ - - -# dashboard-analytics - - -DSS Analytics Module is used to return aggregated data from elastic search indexes which is displayed on UI to gain meaningful insights from the data - -### DSS Analytics -The analytics service creates/wraps queries based on the configuration provided and executes it on the elastic search to fetch the aggregated data. -This aggregated data is then transformed to AggregateDTO by Response Handlers. AggregateDTO contains list of object called Plots. This plot object are created based on the chart type defined in the configuration. The module also provides functionality to compare the data with previous time period,which can be configured -by defining insight in the chartAPI configuration for the required chart. - - - - -### Project Structure -*Packages* - - constant - Contains all the constant values - - controller - Controllers for the app. - - dao - DAO layer - - dto - contains POJO's which are used to manage data returned from queries - - enums - Enum definitions - - exception - POJO for the module. - - handler - Reponse Handlers which converts the aggregated data to AggregationDTO object based on chart type defined - - helper - Helper classes to do computations on data - - model - POJO's related to chart config - - org.service - Consists of all services containing the business logic. - - query.model - POJO's related to building query - - repository - Fetches data from elastic search - - service - Implementations of services which help with fetching data - - utils - Contains utility functions. - - -### Resources -- Granular details about the API's can be found in the [swagger api definition](https://raw.githubusercontent.com/egovernments/business-services/master/Docs/dss-dashboard/DSS%20Analytics%20Dashboard%20YAML%20Spec%201.0.0.yaml) -- Postman collection for all the API's can be found in the [postman collection](https://www.getpostman.com/collections/0894f347322bed5bea1a) - - -## Build & Run - - - mvn clean install - java -jar target/analytics-1.1.0-SNAPSHOT.jar - - -## Dependencies - - -- Elastic search database to fetch data from index. - - - diff --git a/business-services/dashboard-analytics/pom.xml b/business-services/dashboard-analytics/pom.xml deleted file mode 100644 index 7d4cb334c0e..00000000000 --- a/business-services/dashboard-analytics/pom.xml +++ /dev/null @@ -1,211 +0,0 @@ - - 4.0.0 - com.tarento - analytics - 1.1.9-SNAPSHOT - - Analytic Service - Project for handling the data for analytics visualization - http://maven.apache.org - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - - - 2.17.1 - UTF-8 - UTF-8 - 1.8 - 3.4.2 - - - - - junit - junit - 3.8.1 - test - - - org.egov.services - tracer - 2.1.2-SNAPSHOT - - - org.egov.services - services-common - 1.1.1-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - - org.springframework.boot - spring-boot-starter-jdbc - 2.0.0.RELEASE - - - org.cache2k - cache2k-spring - 1.2.0.Final - compile - - - - com.google.code.gson - gson - 2.8.0 - - - - org.springframework.boot - spring-boot-starter-jersey - 1.2.0.RELEASE - - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - - - org.projectlombok - lombok - - - org.apache.poi - poi-ooxml - 3.10-FINAL - - - - javax.ws.rs - jsr311-api - 1.1.1 - - - org.apache.cxf - cxf-rt-frontend-jaxws - ${cxf.version} - - - org.apache.cxf - cxf-rt-transports-http - ${cxf.version} - - - org.apache.cxf - cxf-rt-frontend-jaxrs - ${cxf.version} - - - org.apache.cxf - cxf-tools-java2ws - ${cxf.version} - - - org.apache.commons - commons-lang3 - 3.4 - - - - - org.elasticsearch.client - elasticsearch-rest-high-level-client - 6.2.4 - - - org.elasticsearch - elasticsearch - 6.2.4 - - - com.github.fge - json-schema-validator - 2.2.6 - - - - commons-io - commons-io - 2.6 - - - - org.json - json - 20180813 - - - com.googlecode.json-simple - json-simple - 1.1 - - - com.amazonaws - aws-java-sdk - 1.11.550 - - - - - - repo.digit.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - com.tarento.analytics.model.dashboardConfig.Chart - com.tarento.analytics.model.dashboardConfig.Dashboard - com.tarento.analytics.model.dashboardConfig.Header - com.tarento.analytics.model.dashboardConfig.Visualization - - - com.tarento.analytics.enums.ChartType$ChartType:ChartType - com.tarento.analytics.enums.ResponseCode$ResponseCode:ResponseCode - com.tarento.analytics.constant.Constants$ClienServiceType:ClienServiceType - com.tarento.analytics.constant.Constants$Interval:Interval - - Digit - true - module - - - - - diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/AnalyticApp.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/AnalyticApp.java deleted file mode 100644 index a968bb02ec1..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/AnalyticApp.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.tarento.analytics; - -import org.cache2k.extra.spring.SpringCache2kCacheManager; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cache.CacheManager; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Profile; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -import com.tarento.analytics.constant.Constants; - -import java.util.concurrent.TimeUnit; - - -@SpringBootApplication -@EnableCaching -public class AnalyticApp { - public static void main( String[] args ) { - SpringApplication.run(AnalyticApp.class, args); - } - - @Value("${cache.expiry.time.in.minutes}") - private int cacheExpiry; - - @Value("${cache.capacity}") - private int cacheCapacity; - - @Bean - public RestTemplate restTemplate() { - return new RestTemplate(); - } - - @Bean - public WebMvcConfigurer corsConfigurer() { - return new WebMvcConfigurerAdapter() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**").allowedMethods(Constants.GET, Constants.POST,Constants.PUT, Constants.DELETE, Constants.OPTIONS).allowedOrigins("*") - .allowedHeaders("*"); - } - }; - } - - @Bean - @Profile("!test") - public CacheManager cacheManager(){ - return new SpringCache2kCacheManager().addCaches(b->b.name("versions").expireAfterWrite(cacheExpiry, TimeUnit.MINUTES) - .entryCapacity(cacheCapacity)); - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/ConfigurationLoader.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/ConfigurationLoader.java deleted file mode 100644 index cd2bb9de3af..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/ConfigurationLoader.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.tarento.analytics; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import org.apache.commons.io.IOUtils; -import org.egov.tracer.config.TracerConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Import; -import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; -import org.springframework.core.io.support.ResourcePatternUtils; -import org.springframework.stereotype.Component; -import org.springframework.util.ObjectUtils; - -import javax.annotation.PostConstruct; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; - -@Import({TracerConfiguration.class}) -@Component("configurationLoader") -public class ConfigurationLoader { - - private static Logger logger = LoggerFactory.getLogger(ConfigurationLoader.class); - private Map nameContentMap = new HashMap<>(); - @Autowired - private ResourceLoader resourceLoader; - @Autowired - private ObjectMapper objectMapper; - - @Value("${config.schema.paths}") - private String RESOURCE_LOCATION; - - // private static final String RESOURCE_LOCATION = "file://home/darshan/Tarento/DataPlatform/analytics2/analytics/src/main/resources/schema/*.json"; - public static final String ROLE_DASHBOARD_CONFIG = "RoleDashboardMappingsConf.json"; - public static final String MASTER_DASHBOARD_CONFIG = "MasterDashboardConfig.json"; - - - /** - * Loads config resources - * @throws Exception - */ - @PostConstruct - public void loadResources() throws Exception { - Resource[] resources = getResources(RESOURCE_LOCATION); - - for (Resource resource : resources) { - String jsonContent = getContent(resource); - ObjectNode jsonNode = (ObjectNode) objectMapper.readTree(jsonContent); - nameContentMap.put(resource.getFilename(), jsonNode); - } - logger.info("Number of resources loaded " + nameContentMap.size()); - - } - - /** - * Obtains a ObjectNode w.r.t given resource/file name in classpath*:schema - * @param name - * @return - */ - public ObjectNode get(String name) { - return nameContentMap.get(name); - } - - /** - * Loads all the resources/files with a given pattern *.json - * @param pattern path with *json - * @return - * @throws IOException - */ - private Resource[] getResources(String pattern) throws IOException { - Resource[] resources = ResourcePatternUtils.getResourcePatternResolver(resourceLoader).getResources(pattern); - return resources; - } - - /** - * Returns a content of resource - * - * @param resource - * @return - */ - private String getContent(Resource resource) { - String content = null; - InputStream is = null; - try { - is = resource.getInputStream(); - byte[] encoded = IOUtils.toByteArray(is); - content = new String(encoded, Charset.forName("UTF-8")); - - } catch (IOException e) { - logger.error("Cannot load resource " + resource.getFilename()); - - } finally{ - try { - if(!ObjectUtils.isEmpty(is)) - is.close(); - }catch(IOException e){ - logger.error("Error while closing input stream."); - } - } - return content; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/constant/Constants.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/constant/Constants.java deleted file mode 100644 index 5f49b6a5215..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/constant/Constants.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.tarento.analytics.constant; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class Constants { - /** - * Allowed Origins for CORS Bean - */ - public static final String GET = "GET"; - public static final String POST = "POST"; - public static final String PUT = "PUT"; - public static final String DELETE = "DELETE"; - public static final String OPTIONS = "OPTIONS"; - - - public static int UNAUTHORIZED_ID = 401; - public static int SUCCESS_ID = 200; - public static int FAILURE_ID = 320; - public static String UNAUTHORIZED = "Invalid credentials. Please try again."; - public static String PROCESS_FAIL = "Process failed, Please try again."; - public static String SUCCESS= "success"; - - - //chart format - - public static final String D3 = "d3"; - public static final String CHARTJS = "chartjs"; - - //chart type - public static final String BAR = "bar"; - public static final String PIE ="pie"; - public static final String STACKEDBAR ="stackedbar"; - public static final String LINE ="line"; - public static final String HORIZONTAL_BAR="horizontalBar"; - public static final String DOUGHNUT="doughnut"; - public static final String Heat = "heat"; - public static final String RADAR ="radar"; - - public static final Long FEEDBACK_MESSAGE_TIMEOUT = 2000l; - - public static final String STORE_ID = "storeId"; - - public static final String PLACEMENTS_DASHBOARD = "DASHBOARD"; - public static final String PLACEMENTS_HOME = "HOME"; - - public static final List RATING_LIST = new ArrayList<>(Arrays.asList(1l,2l,3l,4l,5l)); - public static final List RATING_LIST_STRING = new ArrayList<>(Arrays.asList("1","2","3","4","5")); - public static final List RATING_LIST_STRING_STAR = new ArrayList<>(Arrays.asList("1 Star","2 Star","3 Star","4 Star","5 Star")); - - public interface Modules { - final static String HOME_REVENUE = "HOME_REVENUE"; - final static String HOME_SERVICES = "HOME_SERVICES"; - final static String COMMON = "COMMON"; - final static String PT = "PT"; - final static String TL = "TL"; - } - - public interface KafkaTopics { - final static String NEW_CONTENT_MESSAGE = "SaveContent"; - final static String SIMULATOR_TRANSACTION = "SaveTransaction"; - } - - public interface ConfigurationFiles { - final static String CHART_API_CONFIG = "ChartApiConfig.json"; - } - - public interface JsonPaths { - final static String CHART_TYPE = "chartType"; - final static String QUERIES = "queries"; - final static String AGGREGATION_QUERY= "aggrQuery"; - final static String INDEX_NAME = "indexName"; - final static String REQUEST_QUERY_MAP = "requestQueryMap"; - final static String DATE_REF_FIELD = "dateRefField"; - final static String AGGS = "aggs"; - final static String AGGREGATIONS = "aggregations" ; - final static String MODULE = "module"; - final static String INTERVAL_VAL = "intervalvalue"; - final static String INTERVAL = "interval"; - final static String IS_MDMS_ENABALED = "isMdmsEnabled"; - final static String INSIGHT = "insight"; - final static String DAYS = "days"; - final static String TRANSLATE_CODE = "translateTenantCode"; - - } - - public interface Filters { - final static String MODULE = "module"; - final static String FILTER_ALL = "*"; - } - - public interface Catagory { - final static String SEVICE = "service"; - final static String REVENUE = "revenue"; - } - - public interface DashBoardConfig { - final static String ROLES = "roles"; - final static String ROLE_ID = "roleId"; - final static String DASHBOARDS = "dashboards"; - final static String VISUALISATIONS = "visualizations"; - final static String NAME = "name"; - final static String ID = "id"; - final static String TITLE = "title"; - - } - public interface MDMSKeys { - final static String CODE = "code"; - final static String DISTRICT_CODE = "districtCode"; - final static String DDR_NAME = "ddrName"; - final static String TENANTS = "tenants"; - final static String KEY = "key"; - final static String TENANT_ID = "tenantId"; - - static final String TENANTID_MDC_STRING = "TENANTID"; - - } - - public enum Interval { - week, month, year, day - } - public interface PostAggregationTheories { - final static String RESPONSE_DIFF_DATES = "repsonseToDifferenceOfDates"; - } - - public enum ClienServiceType { - DEFAULT_CLIENT , - MDMS_CLIENT - } - - public static final SimpleDateFormat DASHBOARD_DATE_FORMAT = new SimpleDateFormat("MMM dd, yyyy"); - - //data type - public static final String STRING_DATATYPE = "string"; - - public static final String MDMS_REQUESTINFO = "{\"RequestInfo\":{\"authToken\":\"\"},\"MdmsCriteria\":{\"tenantId\":\"{TENANTID_PLACEHOLDER}\",\"moduleDetails\":[{\"moduleName\":\"tenant\",\"masterDetails\":[{\"name\":\"tenants\"}]}]}}"; - - public static final String TENANTID_PLACEHOLDER = "{TENANTID_PLACEHOLDER}"; - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/constant/ElasticSearchConstants.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/constant/ElasticSearchConstants.java deleted file mode 100644 index 09963b4dce8..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/constant/ElasticSearchConstants.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.tarento.analytics.constant; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class ElasticSearchConstants { - public static final String LTE = "<="; - public static final String LT = "<"; - public static final String GTE = ">="; - public static final String GT = ">"; - public static final String ASC_ORDER = "ASC"; - public static final String STARTS_WITH = "startsWith"; - public static final String ENDS_WITH = "endsWith"; - public static final List upsertResults = - new ArrayList<>(Arrays.asList("CREATED", "UPDATED", "NOOP")); - public static final String SOFT_MODE = "soft"; - public static final String RAW_APPEND = ".raw"; - public static final String DAY_OF_WEEK = "dayOfWeek"; - public static final String DAY = "day"; - public static final String HOUR = "hour"; -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/constant/ErrorCode.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/constant/ErrorCode.java deleted file mode 100644 index 56a8e5cc44a..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/constant/ErrorCode.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.tarento.analytics.constant; - -public class ErrorCode { - - public static final String ERR320= "320"; - - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/controllers/DashboardController.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/controllers/DashboardController.java deleted file mode 100644 index a019ad1de43..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/controllers/DashboardController.java +++ /dev/null @@ -1,230 +0,0 @@ -package com.tarento.analytics.controllers; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.tarento.analytics.org.service.ClientServiceFactory; -import com.tarento.analytics.service.AmazonS3ClientService; -import org.apache.commons.lang3.StringUtils; -import org.json.JSONArray; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.context.request.ServletWebRequest; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.tarento.analytics.constant.Constants; -import com.tarento.analytics.constant.ErrorCode; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.AggregateRequestDtoV3; -import com.tarento.analytics.dto.RequestDto; -import com.tarento.analytics.dto.RequestDtoV3; -import com.tarento.analytics.dto.RoleDto; -import com.tarento.analytics.dto.UserDto; -import com.tarento.analytics.exception.AINException; -import com.tarento.analytics.org.service.ClientService; -import com.tarento.analytics.service.MetadataService; -import com.tarento.analytics.utils.PathRoutes; -import com.tarento.analytics.utils.ResponseGenerator; -import org.springframework.web.multipart.MultipartFile; - -@RestController -@RequestMapping(PathRoutes.DashboardApi.DASHBOARD_ROOT_PATH) -public class DashboardController { - - public static final Logger logger = LoggerFactory.getLogger(DashboardController.class); - - @Autowired - private MetadataService metadataService; - @Autowired - private AmazonS3ClientService amazonS3ClientService; - @Autowired - private ObjectMapper objectMapper; - -/* @Autowired - private ClientService clientService;*/ - - @Autowired - private ClientServiceFactory clientServiceFactory; - - @RequestMapping(value = PathRoutes.DashboardApi.FILE_PATH, method = RequestMethod.POST) - public Map uploadFile(@RequestPart(value = "file") MultipartFile file) - { - Map response = new HashMap<>(); - try{ - String imgUrl = this.amazonS3ClientService.uploadFileToS3Bucket(file, true); - response.put("message", "file [" + file.getOriginalFilename() + "] uploading request submitted successfully."); - response.put("url", imgUrl); - }catch (Exception e){ - logger.error("S3 file upload : "+e.getMessage()); - response.put("message", e.getMessage()); - response.put("url", ""); - } - - return response; - } - - @DeleteMapping(value = PathRoutes.DashboardApi.FILE_PATH) - public Map deleteFile(@RequestParam("file_name") String fileName) - { - Map response = new HashMap<>(); - try{ - this.amazonS3ClientService.deleteFileFromS3Bucket(fileName); - response.put("message", "file [" + fileName + "] removing request submitted successfully."); - }catch (Exception e ){ - logger.error("S3 file upload : "+e.getMessage()); - response.put("message", e.getMessage()); - - } - return response; - - } - - @GetMapping(value = PathRoutes.DashboardApi.TEST_PATH, produces = MediaType.APPLICATION_JSON_VALUE) - public String getTest() throws JsonProcessingException { - return ResponseGenerator.successResponse("success"); - - } - - @RequestMapping(value = PathRoutes.DashboardApi.GET_DASHBOARD_CONFIG + "/{dashboardId}", method = RequestMethod.GET) - public String getDashboardConfiguration(@PathVariable String dashboardId, @RequestParam(value="catagory", required = false) String catagory, @RequestHeader(value = "x-user-info", required = false) String xUserInfo) - throws AINException, IOException { - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - UserDto user = new UserDto(); - user.setId(new Long("10007")); - user.setOrgId("1"); - user.setCountryCode(""); - RoleDto role = new RoleDto(); - role.setId(new Long("6")); - role.setName("HR User"); - List roles = new ArrayList<>(); - roles.add(role); - user.setRoles(roles); - //gson.fromJson(xUserInfo, UserDto.class); - - return ResponseGenerator.successResponse(metadataService.getDashboardConfiguration(dashboardId, catagory, user.getRoles())); - } - - @RequestMapping(value = PathRoutes.DashboardApi.GET_CHART_V2, method = RequestMethod.POST) - public String getVisualizationChartV2( @RequestBody RequestDto requestDto, @RequestHeader(value = "x-user-info", required = false) String xUserInfo, ServletWebRequest request) - throws IOException { - - /*logger.info("Request Detail:" + requestDto); - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - UserDto user = gson.fromJson(xUserInfo, UserDto.class);*/ - - UserDto user = new UserDto(); - logger.info("user"+xUserInfo); - - //Getting the request information only from the Full Request - AggregateRequestDto requestInfo = requestDto.getAggregationRequestDto(); - - // For performance enhancement, this creates a key which will cache the response - String requestBodyString = objectMapper.writeValueAsString(requestInfo); - String headersString = objectMapper.writeValueAsString(requestDto.getHeaders()); - StringBuilder finalString = new StringBuilder(requestBodyString).append(headersString); - requestInfo.setHashKey(finalString.toString().hashCode()); - - Map headers = requestDto.getHeaders(); - String response = ""; - try { - if (headers.isEmpty()) { - logger.error("Please provide header details"); - throw new AINException(ErrorCode.ERR320, "header is missing"); - } - if (headers.get("tenantId") == null) { - logger.error("Please provide tenant ID details"); - throw new AINException(ErrorCode.ERR320, "tenant is missing"); - - } - - if(requestDto.getAggregationRequestDto() == null) { - logger.error("Please provide requested Visualization Details"); - throw new AINException(ErrorCode.ERR320, "Visualization Request is missing"); - } - /*if(requestDto.getAggregationRequestDto().getRequestId() == null) { - logger.error("Please provide Request ID"); - throw new AINException(ErrorCode.ERR320, "Request ID is missing. Insights will not work"); - }*/ - - - // To be removed once the development is complete - if(StringUtils.isBlank(requestInfo.getModuleLevel())) { - requestInfo.setModuleLevel(Constants.Modules.HOME_REVENUE); - } - - Object responseData = clientServiceFactory.get(requestInfo.getVisualizationCode()).getAggregatedData(requestInfo, user.getRoles()); - response = ResponseGenerator.successResponse(responseData); - - } catch (AINException e) { - logger.error("error while executing api getVisualizationChart"); - response = ResponseGenerator.failureResponse(e.getErrorCode(), e.getErrorMessage()); - } - return response; - } - -/* - @RequestMapping(value = PathRoutes.DashboardApi.GET_CHART_V3, method = RequestMethod.POST) - public String getVisualizationChartV3(@RequestBody RequestDtoV3 requestDtoV3, @RequestHeader(value = "x-user-info", required = false) String xUserInfo, ServletWebRequest request) - throws IOException { - - */ -/*logger.info("Request Detail:" + requestDto); - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - UserDto user = gson.fromJson(xUserInfo, UserDto.class);*//* - - - UserDto user = new UserDto(); - logger.info("user"+xUserInfo); - - //Getting the request information only from the Full Request - AggregateRequestDtoV3 requestInfoV3 = requestDtoV3.getAggregationRequestDto(); - Map headers = requestDtoV3.getHeaders(); - //requestInfo.getFilters().putAll(headers); - String response = ""; - try { - if (headers.isEmpty()) { - logger.error("Please provide header details"); - throw new AINException(ErrorCode.ERR320, "header is missing"); - } - if (headers.get("tenantId") == null) { - logger.error("Please provide tenant ID details"); - throw new AINException(ErrorCode.ERR320, "tenant is missing"); - } - // To be removed once the development is complete - if(StringUtils.isBlank(requestInfoV3.getModuleLevel())) { - requestInfoV3.setModuleLevel(Constants.Modules.HOME_REVENUE); - } - - List responseDataList = new ArrayList<>(); - if(requestInfoV3 !=null && requestInfoV3.getVisualizations() != null && requestInfoV3.getVisualizations().size() > 0) { - for (int i = 0; i < requestInfoV3.getVisualizations().size(); i++) { - AggregateRequestDto requestInfo = new AggregateRequestDto(requestInfoV3, - requestInfoV3.getVisualizations().get(i).getType(), requestInfoV3.getVisualizations().get(i).getCode()); - Object responseData = clientService.getAggregatedData(requestInfo, user.getRoles()); - responseDataList.add(responseData); - } - - } - response = ResponseGenerator.successResponse(responseDataList); - } catch (AINException e) { - logger.error("error while executing api getVisualizationChart"); - response = ResponseGenerator.failureResponse(e.getErrorCode(), e.getErrorMessage()); - } - return response; - } -*/ - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dao/ElasticSearchDao.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dao/ElasticSearchDao.java deleted file mode 100644 index 1d72b635775..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dao/ElasticSearchDao.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.tarento.analytics.dao; - -import java.util.List; -import java.util.Map; - -import org.elasticsearch.action.search.MultiSearchResponse; -import org.elasticsearch.action.search.SearchRequest; - -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.CummulativeDataRequestDto; -import com.tarento.analytics.dto.SearchDto; -import com.tarento.analytics.model.ElasticSearchDictator; - - -public interface ElasticSearchDao { - - public Map getDataByIdentifier(String index, String type, String identifier); - - public Map searchData(String index, String type, Map searchData); - - public Map complexSearch(SearchDto searchDTO, String index, String... type); - - public boolean healthCheck(); - - /*public ElasticSearchDictator createSearchDictator(AggregateRequestDto dto, String tenant) throws Exception ; - - public ElasticSearchDictator createSearchDictator(AggregateRequestDto dto, String indexName, String documentType, String filterDateField) throws Exception ; - */ - public ElasticSearchDictator createSearchDictatorV2(AggregateRequestDto dto, String indexName, String documentType, String filterDateField) throws Exception ; - - public SearchRequest buildElasticSearchQuery(ElasticSearchDictator dictator); - - public MultiSearchResponse executeMultiSearchRequest(List searchRequestList, String tenant); - - //public ElasticSearchDictator createSearchDictator(String indexName, String documentType, CummulativeDataRequestDto dto, String tenant) throws Exception ; - - MultiSearchResponse executeMultiSearchRequest(List searchRequestList, Boolean primaryOrNot); - -} - diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dao/impl/ElasticSearchDaoImpl.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dao/impl/ElasticSearchDaoImpl.java deleted file mode 100644 index a8f124ed9c0..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dao/impl/ElasticSearchDaoImpl.java +++ /dev/null @@ -1,1307 +0,0 @@ -package com.tarento.analytics.dao.impl; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; -import org.apache.http.HttpHost; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.MultiSearchRequest; -import org.elasticsearch.action.search.MultiSearchResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.client.RestHighLevelClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.ExistsQueryBuilder; -import org.elasticsearch.index.query.MatchQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.query.RangeQueryBuilder; -import org.elasticsearch.index.query.TermQueryBuilder; -import org.elasticsearch.index.query.TermsQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.SearchHits; -import org.elasticsearch.search.aggregations.AggregationBuilder; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.BucketOrder; -import org.elasticsearch.search.aggregations.PipelineAggregationBuilder; -import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregationBuilder; -import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; -import org.elasticsearch.search.aggregations.bucket.histogram.ExtendedBounds; -import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregationBuilder; -import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.avg.AvgAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.sum.SumAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCountAggregationBuilder; -import org.elasticsearch.search.aggregations.pipeline.cumulativesum.CumulativeSumPipelineAggregationBuilder; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.sort.SortBuilder; -import org.elasticsearch.search.sort.SortBuilders; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.tarento.analytics.constant.ElasticSearchConstants; -import com.tarento.analytics.dao.ElasticSearchDao; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.SearchDto; -import com.tarento.analytics.model.ElasticSearchDictator; -import com.tarento.analytics.utils.ElasticProperties; -import com.tarento.analytics.utils.ElasticSearchClient; - -@Component -public class ElasticSearchDaoImpl implements ElasticSearchDao { - - @Autowired - private ElasticSearchClient elasticSearchClient; - - @Autowired - public ObjectMapper mapper; - - private static String elasticHost; - private static int elasticPort; - private static String alternateHost; - private static int alternatePort; - private static final String REST_SCHEME = "http"; - private static final String REST_SCHEME2 = "https"; - private String transactionElasticIndexName; - private static String transactionElasticDocType; - private String ratingElasticIndexName; - private static String ratingElasticDocType; - private static RestHighLevelClient client; - private static RestHighLevelClient alternateClient; - private String indexName; - private String docType; - - public String getIndexName() { - return indexName; - } - - public void setIndexName(String indexName) { - this.indexName = indexName; - } - - public String getDocType() { - return docType; - } - - public void setDocType(String docType) { - this.docType = docType; - } - - public static final Logger logger = LoggerFactory.getLogger(ElasticSearchDaoImpl.class); - - public ElasticSearchDaoImpl(@Value("${services.esindexer.host.name}") String elasticHost, - @Value("${services.esindexer.host.port}") int elasticPort) throws MalformedURLException { - this.elasticHost = elasticHost; - this.elasticPort = elasticPort; - this.client = getClientForElastic(); - - } - - @Override - public Map getDataByIdentifier(String index, String type, String identifier) { - RestHighLevelClient client = elasticSearchClient.getClient(); - long startTime = System.currentTimeMillis(); - logger.info("ElasticSearchUtil getDataByIdentifier method started at ==" + startTime + " for Type " + type); - GetResponse response = null; - - try { - if (StringUtils.isBlank(index) || StringUtils.isBlank(identifier)) { - logger.error("Invalid request is coming."); - return new HashMap<>(); - } else if (StringUtils.isBlank(type)) { - response = client.get(new GetRequest(index).type(type)); - - } else { - response = client.get(new GetRequest(index, type, identifier)); - } - if (response == null || null == response.getSource()) { - return new HashMap<>(); - } - long stopTime = System.currentTimeMillis(); - long elapsedTime = stopTime - startTime; - logger.info("ElasticSearchUtil getDataByIdentifier method end at ==" + stopTime + " for Type " + type - + " ,Total time elapsed = " + elapsedTime); - return response.getSource(); - } catch (IOException ex) { - - } finally { - try { - client.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - logger.error("Error while closing ES client"); - } - } - return null; - } - - @Override - public Map searchData(String index, String type, Map searchData) { - RestHighLevelClient client = elasticSearchClient.getClient(); - - long startTime = System.currentTimeMillis(); - logger.info("ElasticSearchUtil searchData method started at ==" + startTime + " for Type " + type); - SearchSourceBuilder sourceBuilder = new SearchSourceBuilder(); - Iterator> itr = searchData.entrySet().iterator(); - while (itr.hasNext()) { - Entry entry = itr.next(); - sourceBuilder.query(QueryBuilders.commonTermsQuery(entry.getKey(), entry.getValue())); - } - - SearchResponse sr = null; - try { - sr = client.search(new SearchRequest(index).types(type).source(sourceBuilder)); - - } catch (IOException ex) { - logger.error("Error while execution in Elasticsearch", ex); - } - - if (sr.getHits() == null || sr.getHits().getTotalHits() == 0) { - return new HashMap<>(); - } - sr.getHits().getAt(0).getSourceAsMap(); - long stopTime = System.currentTimeMillis(); - long elapsedTime = stopTime - startTime; - - logger.info("ElasticSearchUtil searchData method end at ==" + stopTime + " for Type " + type - + " ,Total time elapsed = " + elapsedTime); - try { - client.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - logger.error("Error while closing the client"); - } - return sr.getAggregations().asList().get(0).getMetaData(); - } - - @SuppressWarnings("rawtypes") - @Override - public Map complexSearch(SearchDto searchDTO, String index, String... type) { - RestHighLevelClient client = elasticSearchClient.getClient(); - - long startTime = System.currentTimeMillis(); - logger.info("ElasticSearchUtil complexSearch method started at ==" + startTime); - - // Map constraintsMap = getConstraints(searchDTO); - SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().size(0); - BoolQueryBuilder query = new BoolQueryBuilder(); - - if (!StringUtils.isBlank(searchDTO.getQuery())) { - query.must(QueryBuilders.simpleQueryStringQuery(searchDTO.getQuery()).field("all_fields")); - } - - // apply sorting - if (searchDTO.getSortBy() != null && searchDTO.getSortBy().size() > 0) { - - for (Map.Entry entry : searchDTO.getSortBy().entrySet()) { - SortBuilder sortB = SortBuilders.fieldSort(entry.getKey()).order(getSortOrder(entry.getValue())); - searchSourceBuilder.sort(sortB); - - } - } - - // apply the fields filter - searchSourceBuilder.fetchSource( - searchDTO.getFields() != null ? searchDTO.getFields().stream().toArray(String[]::new) : null, - searchDTO.getExcludedFields() != null ? searchDTO.getExcludedFields().stream().toArray(String[]::new) - : null); - - // setting the offset - if (searchDTO.getOffset() != null) { - searchSourceBuilder.from(searchDTO.getOffset()); - } - - // setting the limit - if (searchDTO.getLimit() != null) { - searchSourceBuilder.size(searchDTO.getLimit()); - } - - // apply additional properties - if (searchDTO.getAdditionalProperties() != null && searchDTO.getAdditionalProperties().size() > 0) { - for (Map.Entry entry : searchDTO.getAdditionalProperties().entrySet()) { - addAdditionalProperties(query, entry); - } - } - - searchSourceBuilder.query(query); - List finalFacetList = new ArrayList(); - - if (null != searchDTO.getFacets() && !searchDTO.getFacets().isEmpty()) { - // addAggregations(searchSourceBuilder, searchDTO.getFacets()); - } - logger.info("calling search builder======" + searchSourceBuilder.toString()); - SearchResponse response = null; - SearchRequest searchReq = new SearchRequest(index).types(type).source(searchSourceBuilder); - List> esSource = new ArrayList<>(); - - try { - response = client.search(searchReq); - long count = 0; - - if (response != null) { - SearchHits hits = response.getHits(); - count = hits.getTotalHits(); - for (SearchHit hit : hits) { - esSource.add(hit.getSourceAsMap()); - } - } - } catch (IOException e) { - // TODO Auto-generated catch block - logger.info("Error occured while searching"); - } - return null; - - } - - @SuppressWarnings("unchecked") - private void addAggregations(SearchSourceBuilder searchSourceBuilder, Map aggregations) { - long startTime = System.currentTimeMillis(); - logger.info("ElasticSearchUtil addAggregations method started at ==" + startTime); - for (Map.Entry entry : aggregations.entrySet()) { - - String key = entry.getKey(); - Map aggregationInfo = (Map) entry.getValue(); - for (Map.Entry en : aggregations.entrySet()) { - if ("DATE_HISTOGRAM".equalsIgnoreCase(en.getKey())) { - Map aggsVal = (Map) en.getValue(); - DateHistogramInterval dateHistogramInterval = null; - if (aggsVal.get("interval").equals("day")) { - dateHistogramInterval = DateHistogramInterval.DAY; - } else if (aggsVal.get("interval").equals("hour")) { - dateHistogramInterval = DateHistogramInterval.HOUR; - - } else if (aggsVal.get("interval").equals("month")) { - dateHistogramInterval = DateHistogramInterval.MONTH; - - } else if (aggsVal.get("interval").equals("year")) { - dateHistogramInterval = DateHistogramInterval.YEAR; - - } - searchSourceBuilder.aggregation(AggregationBuilders.dateHistogram(key).field(aggsVal.get("field")) - .dateHistogramInterval(dateHistogramInterval)); - - } else if ("TERMS".equalsIgnoreCase(en.getKey())) { - Map aggVal = (Map) en.getValue(); - for (Map.Entry entryS : aggVal.entrySet()) { - - /* - * searchSourceBuilder.aggregation(AggregationBuilders. - * dateHistogram(key).field(aggsVal.get("field")) - * .dateHistogramInterval(Date)); - */ - - } - - } - } - - } - long stopTime = System.currentTimeMillis(); - long elapsedTime = stopTime - startTime; - logger.info("ElasticSearchUtil addAggregations method end at ==" + stopTime + " ,Total time elapsed = " - + elapsedTime); - } - - @SuppressWarnings("unchecked") - private void addAdditionalProperties(BoolQueryBuilder query, Entry entry) { - long startTime = System.currentTimeMillis(); - logger.info("ElasticSearchUtil addAdditionalProperties method started at ==" + startTime); - String key = entry.getKey(); - - if (key.equalsIgnoreCase("FILTERS")) { - - Map filters = (Map) entry.getValue(); - for (Map.Entry en : filters.entrySet()) { - createFilterESOpperation(en, query); - } - } else if (key.equalsIgnoreCase("EXISTS") || key.equalsIgnoreCase("NOT_EXISTS")) { - createESOpperation(entry, query); - } - long stopTime = System.currentTimeMillis(); - long elapsedTime = stopTime - startTime; - logger.info("ElasticSearchUtil addAdditionalProperties method end at ==" + stopTime + " ,Total time elapsed = " - + elapsedTime); - } - - /** Method to create EXISTS and NOT EXIST FILTER QUERY . */ - @SuppressWarnings("unchecked") - private void createESOpperation(Entry entry, BoolQueryBuilder query) { - - String operation = entry.getKey(); - List existsList = (List) entry.getValue(); - - if (operation.equalsIgnoreCase("EXISTS")) { - for (String name : existsList) { - query.must(createExistQuery(name)); - } - } else if (operation.equalsIgnoreCase("NOT_EXISTS")) { - for (String name : existsList) { - query.mustNot(createExistQuery(name)); - } - } - } - - /** Method to create CommonTermQuery , multimatch and Range Query. */ - @SuppressWarnings("unchecked") - private void createFilterESOpperation(Entry entry, BoolQueryBuilder query) { - - String key = entry.getKey(); - Object val = entry.getValue(); - if (val instanceof List) { - if (!((List) val).isEmpty()) { - if (((List) val).get(0) instanceof String) { - ((List) val).replaceAll(String::toLowerCase); - query.must(createTermsQuery(key, (List) val)); - } else { - query.must(createTermsQuery(key, (List) val)); - } - } - } else if (val instanceof Map) { - Map value = (Map) val; - Map rangeOperation = new HashMap<>(); - Map lexicalOperation = new HashMap<>(); - for (Map.Entry it : value.entrySet()) { - String operation = it.getKey(); - if (operation.startsWith(ElasticSearchConstants.LT) - || operation.startsWith(ElasticSearchConstants.GT)) { - rangeOperation.put(operation, it.getValue()); - } else if (operation.startsWith(ElasticSearchConstants.STARTS_WITH) - || operation.startsWith(ElasticSearchConstants.ENDS_WITH)) { - lexicalOperation.put(operation, it.getValue()); - } - } - if (!(rangeOperation.isEmpty())) { - query.must(createRangeQuery(key, rangeOperation)); - } - if (!(lexicalOperation.isEmpty())) { - query.must(createLexicalQuery(key, lexicalOperation)); - } - - } else if (val instanceof String) { - query.must(createTermQuery(key, ((String) val).toLowerCase())); - } else { - query.must(createTermQuery(key, val)); - } - } - - private static TermQueryBuilder createTermQuery(String name, Object text) { - - return QueryBuilders.termQuery(name, text); - - } - - @SuppressWarnings("unchecked") - private static TermsQueryBuilder createTermsQuery(String key, List values) { - - return QueryBuilders.termsQuery(key, (values).stream().toArray(Object[]::new)); - - } - - private static Map getConstraints(SearchDto searchDTO) { - if (null != searchDTO.getSoftConstraints() && !searchDTO.getSoftConstraints().isEmpty()) { - return searchDTO.getSoftConstraints().entrySet().stream() - .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().floatValue())); - } - return Collections.emptyMap(); - } - - @Override - public boolean healthCheck() { - // TODO Auto-generated method stub - return false; - } - - /// New Methods for Elastic Search Query Builders - - private RangeQueryBuilder createRangeQuery(String name, Map rangeOperation) { - - RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery(name); - for (Map.Entry it : rangeOperation.entrySet()) { - if (it.getKey().equalsIgnoreCase(ElasticSearchConstants.LTE)) { - rangeQueryBuilder.lte(it.getValue()); - } else if (it.getKey().equalsIgnoreCase(ElasticSearchConstants.LT)) { - rangeQueryBuilder.lt(it.getValue()); - } else if (it.getKey().equalsIgnoreCase(ElasticSearchConstants.GTE)) { - rangeQueryBuilder.gte(it.getValue()); - } else if (it.getKey().equalsIgnoreCase(ElasticSearchConstants.GT)) { - rangeQueryBuilder.gt(it.getValue()); - } - } - - return rangeQueryBuilder; - } - - private SortOrder getSortOrder(String value) { - return value.equalsIgnoreCase(ElasticSearchConstants.ASC_ORDER) ? SortOrder.ASC : SortOrder.DESC; - } - - private QueryBuilder createLexicalQuery(String key, Map rangeOperation) { - QueryBuilder queryBuilder = null; - for (Map.Entry it : rangeOperation.entrySet()) { - if (it.getKey().equalsIgnoreCase(ElasticSearchConstants.STARTS_WITH)) { - - queryBuilder = QueryBuilders.prefixQuery(key, (String) it.getValue()); - } else if (it.getKey().equalsIgnoreCase(ElasticSearchConstants.ENDS_WITH)) { - String endsWithRegex = "~" + it.getValue(); - queryBuilder = QueryBuilders.regexpQuery(key, endsWithRegex); - } - } - return queryBuilder; - } - - private ExistsQueryBuilder createExistQuery(String name) { - return QueryBuilders.existsQuery(name); - } -/* - - @SuppressWarnings("unchecked") - @Override - public ElasticSearchDictator createSearchDictator(AggregateRequestDto dto, String tenant) throws Exception { - ElasticSearchDictator dictator = new ElasticSearchDictator(); - if (dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE_WRT_TIME) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_DAY_WISE) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE_REASON) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_GENDER) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_AGEGROUP) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE_TIME) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_TOP_PERFORMING) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_LEAST_PERFORMING)) { - dictator.setIndexName(tenant + ratingElasticIndexName); - dictator.setDocumentType(ratingElasticDocType); - } else { - dictator.setIndexName(tenant + transactionElasticIndexName); - dictator.setDocumentType(transactionElasticDocType); - } - if (StringUtils.isNotBlank(dto.getServiceApi())) { - dictator.setVisualisationName(dto.getServiceApi()); - } - Map>> queryMap = new HashMap<>(); - if (dto.getCustomData() != null) { - for (Map.Entry entry : dto.getCustomData().entrySet()) { - if (StringUtils.isNotBlank(entry.getKey()) && entry.getValue() != null) { - List valueList = new ArrayList<>(); - - if (entry.getValue() instanceof ArrayList) { - - List valueArray = (ArrayList) entry.getValue(); - - for (Object value : valueArray) { - valueList.add(value); - } - } else { - valueList.add(entry.getValue()); - } - if (!valueList.isEmpty()) { - String entryKey = entry.getKey(); - if (dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE_WRT_TIME) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_DAY_WISE) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE_REASON) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_GENDER) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_AGEGROUP) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE_TIME) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_TOP_PERFORMING) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_LEAST_PERFORMING)) { - - entryKey = "storeId"; - } - if (queryMap.containsKey(ElasticProperties.Query.MATCH_CONDITION)) { - Map> queryInnerMap = queryMap - .get(ElasticProperties.Query.MATCH_CONDITION); - queryInnerMap.put(entryKey, valueList); - } else { - Map> queryInnerMap = new HashMap<>(); - queryInnerMap.put(entryKey, valueList); - queryMap.put(ElasticProperties.Query.MATCH_CONDITION, queryInnerMap); - } - } - } - } - } - - if (dto.getDates() != null) { - if (StringUtils.isNotBlank(dto.getDates().getStartDate()) - && StringUtils.isNotBlank(dto.getDates().getEndDate())) { - List valueList = new ArrayList<>(); - - valueList.add(dto.getDates().getStartDate()); - valueList.add(dto.getDates().getEndDate()); - Map> queryInnerMap = new HashMap<>(); - if (dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE_WRT_TIME) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE_REASON) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_GENDER) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_AGEGROUP) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_STORE_TIME) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_TOP_PERFORMING) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_LEAST_PERFORMING) - || dto.getServiceApi().equals(ServiceApiConstants.CSAT_DAY_WISE)) { - queryInnerMap.put(ElasticProperties.Query.FEEDBACK_DATE_TIME, valueList); - } else { - queryInnerMap.put(ElasticProperties.Query.TRANSACTION_DATE_FIELD, valueList); - } - - queryMap.put(ElasticProperties.Query.RANGE_CONDITION, queryInnerMap); - } - } - dictator.setQueryMap(queryMap); - - */ -/* - * Map>> aggregationMap = new - * HashMap<>(); Map> innerMap = new - * HashMap<>(); Map deepInnerMap = new HashMap<>(); - *//* - - - return dictator; - - } -*/ - - /** - * Performs request marshalling using elastic search client API - * @param dictator - * @return - */ - - @SuppressWarnings("unchecked") - @Override - public SearchRequest buildElasticSearchQuery(ElasticSearchDictator dictator) { - SearchSourceBuilder searchBuilder = buildSearchSourceBuilder(); - BoolQueryBuilder boolQuery = buildBoolQuery(); - String localDateStartRange = null; - String localDateEndRange = null; - if (dictator.getQueryMap().containsKey(ElasticProperties.Query.RANGE_CONDITION)) { - - String searchParamRange = null; - Map> innerMap = dictator.getQueryMap().get(ElasticProperties.Query.RANGE_CONDITION); - for (Entry> en : innerMap.entrySet()) { - searchParamRange = en.getKey(); - localDateStartRange = (String) en.getValue().get(0); - localDateEndRange = (String) en.getValue().get(1); - } - - addMustOnBoolQuery(boolQuery, buildRangeQuery(searchParamRange, localDateStartRange, localDateEndRange)); - - } - - if (dictator.getQueryMap().containsKey(ElasticProperties.Query.MATCH_CONDITION)) { - String searchTermField = null; - Map> innerMap = dictator.getQueryMap().get(ElasticProperties.Query.MATCH_CONDITION); - for (Entry> en : innerMap.entrySet()) { - searchTermField = en.getKey(); - addFilterTermsOnBoolQuery(boolQuery, buildTermsQuery(searchTermField, en.getValue())); - } - } - - addQueryToSearchBuilder(searchBuilder, boolQuery); - - DateHistogramAggregationBuilder dateAggBuilder = null; - AvgAggregationBuilder avgAggBuilder = null; - SumAggregationBuilder sumAggBuilder = null; - TermsAggregationBuilder termsAggBuilder = null; - NestedAggregationBuilder nestedAggBuilder = null; - ValueCountAggregationBuilder valueCountAggBuilder = null; - if(dictator.getQueryAggregationMap()==null) { - return new SearchRequest(dictator.getIndexName()).types(dictator.getDocumentType()).source(searchBuilder); - } - - for (Map.Entry itr : dictator.getQueryAggregationMap().entrySet()) { - - String aggregationType = itr.getKey(); - Object value = itr.getValue(); - if (ElasticProperties.Query.NESTED.equals(aggregationType.toUpperCase())) { - Map nestedMap = null; - if (value instanceof HashMap) { - nestedMap = (HashMap) value; - } else if (value instanceof LinkedHashMap) { - nestedMap = (LinkedHashMap) value; - } - String aggregationName = aggregationType + "of" - + nestedMap.get(ElasticProperties.Query.PATH.toLowerCase()); - aggregationName = String.valueOf(nestedMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - nestedAggBuilder = buildNestedAggregationBuilder(aggregationName, nestedMap); - - } else if (ElasticProperties.Query.SUM.equals(aggregationType.toUpperCase())) { - Map sumMap = null; - if (value instanceof HashMap) { - sumMap = (HashMap) value; - } else if (value instanceof LinkedHashMap) { - sumMap = (LinkedHashMap) value; - } - String aggregationName = aggregationType + "of" - + sumMap.get(ElasticProperties.Query.FIELD.toLowerCase()); - aggregationName = String.valueOf(sumMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - sumAggBuilder = buildSumAggregation(aggregationName, - String.valueOf(sumMap.get(ElasticProperties.Query.FIELD.toLowerCase()))); - } else if (ElasticProperties.Query.TERM.equals(aggregationType.toUpperCase())) { - Map termMap = null; - if (value instanceof HashMap) { - termMap = (HashMap) value; - } else if (value instanceof LinkedHashMap) { - termMap = (LinkedHashMap) value; - - } - String aggregationName = aggregationType + "of" - + termMap.get(ElasticProperties.Query.FIELD.toLowerCase()); - aggregationName = String.valueOf(termMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - termsAggBuilder = buildTermAggregation(aggregationName, termMap); - - } else if (ElasticProperties.Query.DATE_HISTOGRAM.equals(aggregationType.toUpperCase())) { - Map histogramMap = null; - - if (value instanceof HashMap) { - histogramMap = (HashMap) value; - } else if (value instanceof LinkedHashMap) { - histogramMap = (LinkedHashMap) value; - - } - String aggregationName = aggregationType + "of" - + histogramMap.get(ElasticProperties.Query.FIELD.toLowerCase()); - aggregationName = String.valueOf(histogramMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - dateAggBuilder = buildDateHistogramAggregation(aggregationName, - histogramMap.get(ElasticProperties.Query.FIELD.toLowerCase()).toString(), - histogramMap.get(ElasticProperties.Query.INTERVAL.toLowerCase()).toString().toUpperCase(), - Long.parseLong(localDateStartRange), Long.parseLong(localDateEndRange)); - - } else if (ElasticProperties.Query.COUNT.equals(aggregationType.toUpperCase())) { - Map countAggMap = null; - - if (value instanceof HashMap) { - countAggMap = (HashMap) value; - } else if (value instanceof LinkedHashMap) { - countAggMap = (LinkedHashMap) value; - - } - String countField = countAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()).toString(); - String countAggName = aggregationType + "of" + countField; - countAggName = String.valueOf(countAggMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - valueCountAggBuilder = buildCountsAggregationQuery(countAggName, countField); - } else if (ElasticProperties.Query.AGGREGATION_CONDITION.equals(aggregationType.toUpperCase())) { - - Map firstLevelAggMap = (LinkedHashMap) value; - for (Map.Entry firstLevelItrEntry : firstLevelAggMap.entrySet()) { - - String firstLevelEntryKey = firstLevelItrEntry.getKey(); - Object firstLevelEntryValue = firstLevelItrEntry.getValue(); - if (ElasticProperties.Query.SUM.equals(firstLevelEntryKey.toUpperCase())) { - Map sumAggMap = (LinkedHashMap) firstLevelEntryValue; - String sumField = sumAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()).toString(); - String sumAggName = firstLevelEntryKey + "of" + sumField; - sumAggName = String.valueOf(sumAggMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - if (termsAggBuilder != null) { - termsAggBuilder = buildSubSumAggreationForTerms(termsAggBuilder, sumAggName, sumField); - } else if (dateAggBuilder != null) { - dateAggBuilder = buildSubSumAggreationForDateHistogram(dateAggBuilder, sumAggName, - sumField); - } - } else if (ElasticProperties.Query.AVG.equals(firstLevelEntryKey.toUpperCase())) { - Map avgAggMap = (LinkedHashMap) firstLevelEntryValue; - String avgField = avgAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()).toString(); - String avgAggName = firstLevelEntryKey + "of" + avgField; - avgAggName = String.valueOf(avgAggMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - if (termsAggBuilder != null) { - termsAggBuilder = buildSubAvgAggreationForTerms(termsAggBuilder, avgAggName, avgField); - } else if (dateAggBuilder != null) { - dateAggBuilder = buildSubSumAggreationForDateHistogram(dateAggBuilder, avgAggName, - avgField); - } - } else if (ElasticProperties.Query.COUNT.equals(firstLevelEntryKey.toUpperCase())) { - Map countAggMap = (LinkedHashMap) firstLevelEntryValue; - String countField = countAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()).toString(); - String countAggName = firstLevelEntryKey + "of" + countField; - countAggName = String.valueOf(countAggMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - if (termsAggBuilder != null) { - termsAggBuilder = buildSubCountAggregationForTerms(termsAggBuilder, countAggName, - countField); - } else if (dateAggBuilder != null) { - dateAggBuilder = buildSubCountAggregationForDateHistogram(dateAggBuilder, countAggName, - countField); - } - } else if (ElasticProperties.Query.TERM.equals(firstLevelEntryKey.toUpperCase())) { - Map subTermAggMap = (LinkedHashMap) firstLevelEntryValue; - String subTermAggName = firstLevelEntryKey + "of" - + subTermAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()).toString(); - subTermAggName = String.valueOf(subTermAggMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - if (nestedAggBuilder != null) { - buildSubTermsAggregationForNested(nestedAggBuilder, subTermAggName, - subTermAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()).toString()); - } else if (dateAggBuilder != null) { - buildSubTermsAggregationForHistogram(dateAggBuilder, subTermAggName, - subTermAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()).toString()); - } else if (termsAggBuilder != null) { - buildSubTermsAggregationForTerms(termsAggBuilder, subTermAggName, - subTermAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()).toString()); - } - - } else if (ElasticProperties.Query.AGGREGATION_CONDITION.equals(firstLevelEntryKey.toUpperCase())) { - - Map secondLevelAggMap = (LinkedHashMap) firstLevelEntryValue; - for (Map.Entry secondLevelItrEntry : secondLevelAggMap.entrySet()) { - String secondLevelItrEntryKey = secondLevelItrEntry.getKey(); - Object secondLevelItrEntryValue = secondLevelItrEntry.getValue(); - if (ElasticProperties.Query.SUM.equals(secondLevelItrEntryKey.toUpperCase())) { - Map subSumAggMap = (LinkedHashMap) secondLevelItrEntryValue; - - String subSumField = subSumAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()) - .toString(); - String subSumAggName = secondLevelItrEntryKey + "of" + subSumField; - subSumAggName = String.valueOf(subSumAggMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - - if (nestedAggBuilder != null) { - List aggBuilders = nestedAggBuilder.getSubAggregations(); - for (AggregationBuilder aggregationBuilder : aggBuilders) { - - if (aggregationBuilder instanceof TermsAggregationBuilder) { - TermsAggregationBuilder subTermAggBuilder = (TermsAggregationBuilder) aggregationBuilder; - subTermAggBuilder = buildSubSumAggreationForTerms(subTermAggBuilder, - subSumAggName, subSumField); - - } - } - } - } else if (ElasticProperties.Query.COUNT.equals(secondLevelItrEntryKey.toUpperCase())) { - Map subCountAggMap = (LinkedHashMap) secondLevelItrEntryValue; - - String subCountField = subCountAggMap.get(ElasticProperties.Query.FIELD.toLowerCase()) - .toString(); - String subCountAggName = secondLevelItrEntryKey + "of" + subCountField; - subCountAggName = String.valueOf(subCountAggMap.get(ElasticProperties.Query.LABEL.toLowerCase())); - - if (dateAggBuilder != null) { - List aggBuilders = dateAggBuilder.getSubAggregations(); - for (AggregationBuilder aggregationBuilder : aggBuilders) { - - if (aggregationBuilder instanceof TermsAggregationBuilder) { - TermsAggregationBuilder subTermAggBuilder = (TermsAggregationBuilder) aggregationBuilder; - subTermAggBuilder = buildSubCountAggregationForTerms(subTermAggBuilder, - subCountAggName, subCountField); - } - } - } - } - } - } - } - } - } - - if (dateAggBuilder != null) { - addAggregationToSearchBuilder(searchBuilder, dateAggBuilder); - } - if (sumAggBuilder != null) { - addSumAggregationToSearchBuilder(searchBuilder, sumAggBuilder); - } - if (avgAggBuilder != null) { - addAvgAggregationToSearchBuilder(searchBuilder, avgAggBuilder); - } - if (valueCountAggBuilder != null) { - addValueCountAggregationToSearchBuilder(searchBuilder, valueCountAggBuilder); - } - if (termsAggBuilder != null) { - addTermsAggregationToSearchBuilder(searchBuilder, termsAggBuilder); - } - if (nestedAggBuilder != null) { - addNestedAggregationToSearchBuilder(searchBuilder, nestedAggBuilder); - } - return new SearchRequest(dictator.getIndexName()).types(dictator.getDocumentType()).source(searchBuilder); - } - - private NestedAggregationBuilder buildSubTermsAggregationForNested(NestedAggregationBuilder nestedAggBuilder, - String subAggregationName, String fieldName) { - return nestedAggBuilder.subAggregation(AggregationBuilders.terms(subAggregationName).field(fieldName)); - - } - - private void addNestedAggregationToSearchBuilder(SearchSourceBuilder searchBuilder, - NestedAggregationBuilder nestedAggBuilder) { - searchBuilder.aggregation(nestedAggBuilder); - } - - private RangeQueryBuilder buildRangeQuery(String fieldName, Object startRange, Object endRange) { - return QueryBuilders.rangeQuery(fieldName).gte(startRange).lte(endRange); - } - - private TermQueryBuilder buildTermQuery(String fieldName, Object fieldValue) { - return QueryBuilders.termQuery(fieldName, fieldValue); - } - - private TermsQueryBuilder buildTermsQuery(String fieldName, List fieldValue) { - return QueryBuilders.termsQuery(fieldName, fieldValue); - } - - private MatchQueryBuilder buildMatchQuery(String fieldName, Object fieldValue) { - return QueryBuilders.matchQuery(fieldName, fieldValue); - } - - private ValueCountAggregationBuilder buildCountsAggregationQuery(String aggregationName, String fieldName) { - return AggregationBuilders.count(aggregationName).field(fieldName); - } - - private SumAggregationBuilder buildSumAggregation(String aggregationName, String fieldName) { - return AggregationBuilders.sum(aggregationName).field(fieldName); - } - - @SuppressWarnings("unchecked") - private TermsAggregationBuilder buildTermAggregation(String aggregationName, Map paramMap) { - TermsAggregationBuilder aggBuilder = AggregationBuilders.terms(aggregationName); - for (Map.Entry param : paramMap.entrySet()) { - if (param.getKey().toUpperCase().equals(ElasticProperties.Query.FIELD)) { - aggBuilder = aggBuilder.field((String) param.getValue()); - } else if (param.getKey().toUpperCase().equals(ElasticProperties.Query.SIZE)) { - aggBuilder = aggBuilder.size((Integer) param.getValue()); - } else if (param.getKey().toUpperCase().equals(ElasticProperties.Query.ORDER)) { - Map keyMap = (HashMap) param.getValue(); - BucketOrder order = null; - for (Map.Entry valueMap : keyMap.entrySet()) { - Map orderMap = (HashMap) valueMap.getValue(); - - String key = valueMap.getKey() + "of" + orderMap.get(ElasticProperties.Query.FIELD.toLowerCase()); - - order = BucketOrder.aggregation(key, - orderMap.get("orderBy").toUpperCase().equals(ElasticProperties.Query.ASC) ? true : false); - } - aggBuilder = aggBuilder.order(order); - } - } - return aggBuilder; - - } - - private AvgAggregationBuilder buildAvgAggregation(String aggregationName, String fieldName) { - return AggregationBuilders.avg(aggregationName).field(fieldName); - } - - private NestedAggregationBuilder buildNestedAggregationBuilder(String aggregationName, - Map paramMap) { - String pathName = paramMap.get(ElasticProperties.Query.PATH.toLowerCase()).toString(); - return AggregationBuilders.nested(aggregationName, pathName); - } - - private AggregationBuilder buildSubTermForNestedAggregation(NestedAggregationBuilder nestedBuilder, - String aggregationName, Map paramMap) { - return nestedBuilder.subAggregation(buildTermAggregation(aggregationName, paramMap)); - - } - - private DateHistogramAggregationBuilder buildDateHistogramAggregation(String aggregationName, String fieldName, - String interval, Long boundMin, Long boundMax) { - DateHistogramInterval dateHistogramInterval = null; - if (ElasticProperties.Query.HOUR.equals(interval)) { - dateHistogramInterval = DateHistogramInterval.HOUR; - } else if (ElasticProperties.Query.DAY.equals(interval)) { - dateHistogramInterval = DateHistogramInterval.DAY; - } else if (ElasticProperties.Query.MINUTE.equals(interval)) { - dateHistogramInterval = DateHistogramInterval.MINUTE; - } else if (ElasticProperties.Query.MONTH.equals(interval)) { - dateHistogramInterval = DateHistogramInterval.MONTH; - - } - return AggregationBuilders.dateHistogram(aggregationName).field(fieldName) - .dateHistogramInterval(dateHistogramInterval).format("epoch_millis") - .extendedBounds(new ExtendedBounds(boundMin, boundMax)); - } - - private DateHistogramAggregationBuilder buildSubSumAggreationForDateHistogram( - DateHistogramAggregationBuilder builder, String aggregationName, String fieldName) { - return builder.subAggregation(AggregationBuilders.sum(aggregationName).field(fieldName)); - } - - private DateHistogramAggregationBuilder buildSubCummulativeSumAggreationForDateHistogram( - DateHistogramAggregationBuilder builder, String aggregationName, String fieldName) { - PipelineAggregationBuilder pipeLineAggregation = new CumulativeSumPipelineAggregationBuilder(aggregationName, - fieldName); - return builder.subAggregation(pipeLineAggregation); - } - - private DateHistogramAggregationBuilder buildSubAvgAggreationForDateHistogram( - DateHistogramAggregationBuilder builder, String aggregationName, String fieldName) { - return builder.subAggregation(AggregationBuilders.avg(aggregationName).field(fieldName)); - } - - private DateHistogramAggregationBuilder buildSubCountAggregationForDateHistogram( - DateHistogramAggregationBuilder builder, String aggregationName, String fieldName) { - return builder.subAggregation(AggregationBuilders.count(aggregationName).field(fieldName)); - } - - private TermsAggregationBuilder buildSubCountAggregationForTerms(TermsAggregationBuilder builder, - String aggregationName, String fieldName) { - return builder.subAggregation(AggregationBuilders.count(aggregationName).field(fieldName)); - } - - private TermsAggregationBuilder buildSubTermsAggregationForTerms(TermsAggregationBuilder builder, - String aggregationName, String fieldName) { - return builder.subAggregation(AggregationBuilders.terms(aggregationName).field(fieldName)); - } - - private DateHistogramAggregationBuilder buildSubTermsAggregationForHistogram( - DateHistogramAggregationBuilder builder, String aggregationName, String fieldName) { - return builder.subAggregation(AggregationBuilders.terms(aggregationName).field(fieldName)); - } - - private TermsAggregationBuilder buildSubSumAggreationForTerms(TermsAggregationBuilder builder, - String aggregationName, String fieldName) { - return builder.subAggregation(AggregationBuilders.sum(aggregationName).field(fieldName)); - } - - private TermsAggregationBuilder buildSubAvgAggreationForTerms(TermsAggregationBuilder builder, - String aggregationName, String fieldName) { - return builder.subAggregation(AggregationBuilders.avg(aggregationName).field(fieldName)); - } - - private SumAggregationBuilder buildSubSumAggregation(SumAggregationBuilder builder, String aggregationName, - String fieldName) { - return builder.subAggregation(AggregationBuilders.sum(aggregationName).field(fieldName)); - } - - private AvgAggregationBuilder buildSubAvgAggregation(AvgAggregationBuilder builder, String aggregationName, - String fieldName) { - return builder.subAggregation(AggregationBuilders.avg(aggregationName).field(fieldName)); - } - - private BoolQueryBuilder buildBoolQuery() { - return QueryBuilders.boolQuery(); - } - - private BoolQueryBuilder addMustOnBoolQuery(BoolQueryBuilder builder, RangeQueryBuilder rangeBuilder) { - return builder.must(rangeBuilder); - } - - private BoolQueryBuilder addFilterOnBoolQuery(BoolQueryBuilder builder, TermQueryBuilder termBuilder) { - return builder.filter(termBuilder); - } - - private BoolQueryBuilder addFilterTermsOnBoolQuery(BoolQueryBuilder builder, TermsQueryBuilder termBuilder) { - return builder.filter(termBuilder); - } - - private BoolQueryBuilder addMatchOnBoolQuery(BoolQueryBuilder builder, MatchQueryBuilder matchBuilder) { - return builder.filter(matchBuilder); - } - - private SearchSourceBuilder buildSearchSourceBuilder() { - return new SearchSourceBuilder().size(0); - } - - private SearchSourceBuilder addQueryToSearchBuilder(SearchSourceBuilder builder, BoolQueryBuilder queryBuilder) { - return builder.query(queryBuilder); - } - - private SearchSourceBuilder addAggregationToSearchBuilder(SearchSourceBuilder builder, - DateHistogramAggregationBuilder aggBuilder) { - return builder.aggregation(aggBuilder); - } - - private SearchSourceBuilder addSumAggregationToSearchBuilder(SearchSourceBuilder builder, - SumAggregationBuilder aggBuilder) { - return builder.aggregation(aggBuilder); - } - - private SearchSourceBuilder addAvgAggregationToSearchBuilder(SearchSourceBuilder builder, - AvgAggregationBuilder aggBuilder) { - return builder.aggregation(aggBuilder); - } - - private SearchSourceBuilder addValueCountAggregationToSearchBuilder(SearchSourceBuilder builder, - ValueCountAggregationBuilder aggBuilder) { - return builder.aggregation(aggBuilder); - } - private SearchSourceBuilder addTermsAggregationToSearchBuilder(SearchSourceBuilder builder, - TermsAggregationBuilder aggBuilder) { - return builder.aggregation(aggBuilder); - } - - @Override - public MultiSearchResponse executeMultiSearchRequest(List searchRequestList, String tenant) { - MultiSearchRequest multiRequest = new MultiSearchRequest(); - MultiSearchResponse response = null; - - for (SearchRequest request : searchRequestList) { - logger.info("ES Query is : " + request.source()); - multiRequest.add(request); - } - - try { - response = client.multiSearch(multiRequest); - } catch (IOException e) { - logger.error("Encountered an error while connecting : " + e); - logger.error("Error Message to report : " + e.getMessage()); - } - - return response; - } - - private RestHighLevelClient getClientForElastic() { - return new RestHighLevelClient(RestClient.builder(new HttpHost(elasticHost, elasticPort, REST_SCHEME))); - } - - private RestHighLevelClient getClientForAlternate() throws MalformedURLException { - URL url = new URL ("https://egov-micro-dev.egovernments.org/elasticsearch/"); - return new RestHighLevelClient(RestClient.builder(new HttpHost(url.getHost(), url.getPort(), REST_SCHEME2))); - } - -/* @SuppressWarnings("unchecked") - @Override - public ElasticSearchDictator createSearchDictator(String indexName, String documentType, - CummulativeDataRequestDto dto, String dateField) throws Exception { - ElasticSearchDictator dictator = new ElasticSearchDictator(); - - dictator.setIndexName(indexName); - dictator.setDocumentType(documentType); - - Map>> queryMap = new HashMap<>(); - if (dto.getCustomData() != null) { - for (Map.Entry entry : dto.getCustomData().entrySet()) { - if (StringUtils.isNotBlank(entry.getKey()) && entry.getValue() != null) { - List valueList = new ArrayList<>(); - - if (entry.getValue() instanceof ArrayList) { - - List valueArray = (ArrayList) entry.getValue(); - - for (Object value : valueArray) { - valueList.add(value); - } - } else { - valueList.add(entry.getValue()); - } - if (!valueList.isEmpty()) { - String entryKey = entry.getKey(); - if (queryMap.containsKey(ElasticProperties.Query.MATCH_CONDITION)) { - Map> queryInnerMap = queryMap - .get(ElasticProperties.Query.MATCH_CONDITION); - queryInnerMap.put(entryKey, valueList); - } else { - Map> queryInnerMap = new HashMap<>(); - queryInnerMap.put(entryKey, valueList); - queryMap.put(ElasticProperties.Query.MATCH_CONDITION, queryInnerMap); - } - } - } - } - } - - if (dto.getDates() != null) { - if (StringUtils.isNotBlank(dto.getDates().getStartDate()) - && StringUtils.isNotBlank(dto.getDates().getEndDate())) { - List valueList = new ArrayList<>(); - - valueList.add(dto.getDates().getStartDate()); - valueList.add(dto.getDates().getEndDate()); - Map> queryInnerMap = new HashMap<>(); - queryInnerMap.put(dateField, valueList); - queryMap.put(ElasticProperties.Query.RANGE_CONDITION, queryInnerMap); - } - } - dictator.setQueryMap(queryMap); - - *//* - * Map>> aggregationMap = new - * HashMap<>(); Map> innerMap = new - * HashMap<>(); Map deepInnerMap = new HashMap<>(); - *//* - - return dictator; - } - - @Override - public ElasticSearchDictator createSearchDictator(AggregateRequestDto dto, String indexName, String documentType, - String filterDateField) throws Exception { - ElasticSearchDictator dictator = new ElasticSearchDictator(); - - dictator.setIndexName(indexName); - dictator.setDocumentType(documentType); - if (StringUtils.isNotBlank(dto.getServiceApi())) { - dictator.setVisualisationName(dto.getServiceApi()); - } - - Map>> queryMap = new HashMap<>(); - if (dto.getCustomData() != null) { - for (Map.Entry entry : dto.getCustomData().entrySet()) { - if (StringUtils.isNotBlank(entry.getKey()) && entry.getValue() != null) { - List valueList = new ArrayList<>(); - - if (entry.getValue() instanceof ArrayList) { - - List valueArray = (ArrayList) entry.getValue(); - - for (Object value : valueArray) { - valueList.add(value); - } - } else { - valueList.add(entry.getValue()); - } - if (!valueList.isEmpty()) { - String entryKey = entry.getKey(); - if (queryMap.containsKey(ElasticProperties.Query.MATCH_CONDITION)) { - Map> queryInnerMap = queryMap - .get(ElasticProperties.Query.MATCH_CONDITION); - queryInnerMap.put(entryKey, valueList); - } else { - Map> queryInnerMap = new HashMap<>(); - queryInnerMap.put(entryKey, valueList); - queryMap.put(ElasticProperties.Query.MATCH_CONDITION, queryInnerMap); - } - } - } - } - } - - if (dto.getDates() != null) { - if (StringUtils.isNotBlank(dto.getDates().getStartDate()) - && StringUtils.isNotBlank(dto.getDates().getEndDate())) { - List valueList = new ArrayList<>(); - - valueList.add(dto.getDates().getStartDate()); - valueList.add(dto.getDates().getEndDate()); - Map> queryInnerMap = new HashMap<>(); - - queryInnerMap.put(filterDateField, valueList); - - queryMap.put(ElasticProperties.Query.RANGE_CONDITION, queryInnerMap); - } - } - dictator.setQueryMap(queryMap); - return dictator; - }*/ - - /** - * Creates a ElasticSearchDictator object creates a query map - * eg: if RequestDate is present the below map is added: - * {"RANGE": {"Data.dateOfComplaint" : [1585679400000,1617215399000]}} - * @param dto - * @param indexName - * @param documentType - * @param filterDateField - * @return - * @throws Exception - */ - - @Override - public ElasticSearchDictator createSearchDictatorV2(AggregateRequestDto dto, String indexName, String documentType, - String filterDateField) throws Exception { - ElasticSearchDictator dictator = new ElasticSearchDictator(); - - dictator.setIndexName(indexName); - dictator.setDocumentType(documentType); - - Map>> queryMap = new HashMap<>(); - if (dto.getEsFilters() != null && !dto.getEsFilters().isEmpty()) { - - for (Map.Entry entry : dto.getEsFilters().entrySet()) { - - if (StringUtils.isNotBlank(entry.getKey()) && entry.getValue() != null) { - List valueList = new ArrayList<>(); - - if (entry.getValue() instanceof ArrayList) { - - List valueArray = (ArrayList) entry.getValue(); - - for (Object value : valueArray) { - String valueString = ""; - if(entry.getKey().equals("dataObject.tenantId")) { - valueString = String.valueOf(value); - valueString = valueString.replace("uat: ", ""); - } - if(StringUtils.isBlank(valueString)) valueList.add(value); - else valueList.add(valueString); - } - } else { - String valueString = ""; - if(entry.getKey().equals("dataObject.tenantId")) { - valueString = String.valueOf(entry.getValue()); - valueString = valueString.replace("uat: ", ""); - } - if(StringUtils.isBlank(valueString)) valueList.add(entry.getValue()); - else valueList.add(valueString); - } - if (!valueList.isEmpty()) { - String entryKey = entry.getKey(); - if (queryMap.containsKey(ElasticProperties.Query.MATCH_CONDITION)) { - Map> queryInnerMap = queryMap - .get(ElasticProperties.Query.MATCH_CONDITION); - queryInnerMap.put(entryKey, valueList); - } else { - Map> queryInnerMap = new HashMap<>(); - queryInnerMap.put(entryKey, valueList); - queryMap.put(ElasticProperties.Query.MATCH_CONDITION, queryInnerMap); - } - } - } - } - } - - Map queryAggregationMap = new HashMap<>(); - if (dto.getAggregationFactors() != null && !dto.getAggregationFactors().isEmpty()) { - for (Map.Entry entry : dto.getAggregationFactors().entrySet()) { - if (StringUtils.isNotBlank(entry.getKey()) && entry.getValue() != null) { - Map innerAggregationMap = new HashMap<>(); - innerAggregationMap.put("field", entry.getValue()); - queryAggregationMap.put(entry.getKey(), innerAggregationMap); - } - } - } - dictator.setQueryAggregationMap(queryAggregationMap); - if (dto.getRequestDate() != null) { - if (StringUtils.isNotBlank(dto.getRequestDate().getStartDate()) - && StringUtils.isNotBlank(dto.getRequestDate().getEndDate())) { - List valueList = new ArrayList<>(); - - valueList.add(dto.getRequestDate().getStartDate()); - valueList.add(dto.getRequestDate().getEndDate()); - Map> queryInnerMap = new HashMap<>(); - - if(StringUtils.isNotBlank(filterDateField)) { - queryInnerMap.put(filterDateField, valueList); - queryMap.put(ElasticProperties.Query.RANGE_CONDITION, queryInnerMap); - } - } - } - dictator.setQueryMap(queryMap); - return dictator; - } - - @Override - public MultiSearchResponse executeMultiSearchRequest(List searchRequestList, Boolean primaryOrNot) { - MultiSearchRequest multiRequest = new MultiSearchRequest(); - MultiSearchResponse response = null; - for (SearchRequest request : searchRequestList) { - logger.info("ES Query is : " + request.source()); - multiRequest.add(request); - } - - try { - if(primaryOrNot) { - response = client.multiSearch(multiRequest); - } else { - logger.info("Alternate Client URL : " + alternateClient.toString()); - response = alternateClient.multiSearch(multiRequest); - } - - } catch (IOException e) { - logger.error("Encountered an error while connecting : " + e); - logger.error("Error Message to report : " + e.getMessage()); - } - return response; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/AggregateDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/AggregateDto.java deleted file mode 100644 index 09f225ebccf..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/AggregateDto.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.tarento.analytics.enums.ChartType; - -/** - * @author Darshan Nagesh - * - */ -public class AggregateDto { - - private ChartType chartType; - - private String visualizationCode; - - private String chartFormat; - - private String drillDownChartId; - - public String getVisualizationCode() { - return visualizationCode; - } - - public void setVisualizationCode(String visualizationCode) { - this.visualizationCode = visualizationCode; - } - - public String getDrillDownChartId() { - return drillDownChartId; - } - - public void setDrillDownChartId(String drillDownChartId) { - this.drillDownChartId = drillDownChartId; - } - - private Map customData; - - private RequestDate dates; - - private Object filter; - - private List data = new ArrayList<>(); - - public List getData() { - return data; - } - - public void setData(List data) { - this.data = data; - } - - public ChartType getChartType() { - return chartType; - } - - public void setChartType(ChartType chartType) { - this.chartType = chartType; - } - - public String getChartFormat() { - return chartFormat; - } - - public void setChartFormat(String chartFormat) { - this.chartFormat = chartFormat; - } - - - public Map getCustomData() { - return customData; - } - - public void setCustomData(Map customData) { - this.customData = customData; - } - - public RequestDate getDates() { - return dates; - } - - public void setDates(RequestDate dates) { - this.dates = dates; - } - - public Object getFilter() { - return filter; - } - - public void setFilter(Object filter) { - this.filter = filter; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/AggregateRequestDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/AggregateRequestDto.java deleted file mode 100644 index 859cdd5de15..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/AggregateRequestDto.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.tarento.analytics.dto; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.utils.ResponseRecorder; - -import java.util.Map; - -public class AggregateRequestDto { - - private String requestId; - private String visualizationType; - private String visualizationCode; - private String moduleLevel; - private String queryType; - private Map filters; - private Map esFilters; - private Map aggregationFactors; - private RequestDate requestDate; - private String interval; - private ObjectNode chartNode; - private ResponseRecorder responseRecorder; - - @JsonIgnore - private int hashKey; - - public AggregateRequestDto() {} - public AggregateRequestDto(AggregateRequestDtoV3 requestDtoV3, String visualizationType, String visualizationCode) { - this.visualizationCode = visualizationCode; - this.visualizationType = visualizationType; - this.moduleLevel = requestDtoV3.getModuleLevel(); - this.queryType = requestDtoV3.getQueryType(); - this.filters = requestDtoV3.getFilters(); - this.esFilters = requestDtoV3.getEsFilters(); - this.aggregationFactors = requestDtoV3.getAggregationFactors(); - this.requestDate = requestDtoV3.getRequestDate(); - this.interval = requestDtoV3.getInterval(); - this.chartNode = requestDtoV3.getChartNode(); - this.requestId= requestDtoV3.getRequestId(); - } - - - public String getRequestId() { - return requestId; - } - public void setRequestId(String requestId) { - this.requestId = requestId; - } - public ObjectNode getChartNode() { - return chartNode; - } - - public void setChartNode(ObjectNode chartNode) { - this.chartNode = chartNode; - } - - public String getModuleLevel() { - return moduleLevel; - } - public void setModuleLevel(String moduleLevel) { - this.moduleLevel = moduleLevel; - } - public Map getEsFilters() { - return esFilters; - } - public void setEsFilters(Map esFilters) { - this.esFilters = esFilters; - } - public String getVisualizationCode() { - return visualizationCode; - } - public void setVisualizationCode(String visualizationCode) { - this.visualizationCode = visualizationCode; - } - public String getVisualizationType() { - return visualizationType; - } - public void setVisualizationType(String visualizationType) { - this.visualizationType = visualizationType; - } - public String getQueryType() { - return queryType; - } - public void setQueryType(String queryType) { - this.queryType = queryType; - } - public Map getFilters() { - return filters; - } - public void setFilters(Map filters) { - this.filters = filters; - } - public Map getAggregationFactors() { - return aggregationFactors; - } - public void setAggregationFactors(Map aggregationFactors) { - this.aggregationFactors = aggregationFactors; - } - public RequestDate getRequestDate() { - return requestDate; - } - public void setRequestDate(RequestDate requestDate) { - this.requestDate = requestDate; - } - public String getInterval() { - return interval; - } - public void setInterval(String interval) { - this.interval = interval; - } - public ResponseRecorder getResponseRecorder() { - return responseRecorder; - } - public void setResponseRecorder(ResponseRecorder responseRecorder) { - this.responseRecorder = responseRecorder; - } - public int getHashKey() { return hashKey; } - public void setHashKey(int hashKey) { - this.hashKey = hashKey; - } - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/AggregateRequestDtoV3.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/AggregateRequestDtoV3.java deleted file mode 100644 index 13b3a31f19a..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/AggregateRequestDtoV3.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.databind.node.ObjectNode; - -public class AggregateRequestDtoV3 { - - private String requestId; - private List visualizations; - private String moduleLevel; - private String queryType; - private Map filters; - private Map esFilters; - private Map aggregationFactors; - private RequestDate requestDate; - private String interval; - private ObjectNode chartNode; - - public ObjectNode getChartNode() { - return chartNode; - } - - public void setChartNode(ObjectNode chartNode) { - this.chartNode = chartNode; - } - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - public String getModuleLevel() { - return moduleLevel; - } - public void setModuleLevel(String moduleLevel) { - this.moduleLevel = moduleLevel; - } - public Map getEsFilters() { - return esFilters; - } - public void setEsFilters(Map esFilters) { - this.esFilters = esFilters; - } - public String getQueryType() { - return queryType; - } - public void setQueryType(String queryType) { - this.queryType = queryType; - } - public Map getFilters() { - return filters; - } - public void setFilters(Map filters) { - this.filters = filters; - } - public Map getAggregationFactors() { - return aggregationFactors; - } - public void setAggregationFactors(Map aggregationFactors) { - this.aggregationFactors = aggregationFactors; - } - public RequestDate getRequestDate() { - return requestDate; - } - public void setRequestDate(RequestDate requestDate) { - this.requestDate = requestDate; - } - public String getInterval() { - return interval; - } - public void setInterval(String interval) { - this.interval = interval; - } - - public List getVisualizations() { - return visualizations; - } - - public void setVisualizations(List visualizations) { - this.visualizations = visualizations; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/City.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/City.java deleted file mode 100644 index f436509efb2..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/City.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.HashMap; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "name", "localName", "districtCode", "districtName", "regionName", "ulbGrade", "longitude", - "latitude", "shapeFileLocation", "captcha", "code", "regionCode", "municipalityName" }) -public class City { - - @JsonProperty("name") - private String name; - @JsonProperty("localName") - private String localName; - @JsonProperty("districtCode") - private String districtCode; - @JsonProperty("districtName") - private String districtName; - @JsonProperty("regionName") - private String regionName; - @JsonProperty("ulbGrade") - private String ulbGrade; - @JsonProperty("longitude") - private Double longitude; - @JsonProperty("latitude") - private Double latitude; - @JsonProperty("shapeFileLocation") - private Object shapeFileLocation; - @JsonProperty("captcha") - private Object captcha; - @JsonProperty("code") - private String code; - @JsonProperty("regionCode") - private String regionCode; - @JsonProperty("municipalityName") - private String municipalityName; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("localName") - public String getLocalName() { - return localName; - } - - @JsonProperty("localName") - public void setLocalName(String localName) { - this.localName = localName; - } - - @JsonProperty("districtCode") - public String getDistrictCode() { - return districtCode; - } - - @JsonProperty("districtCode") - public void setDistrictCode(String districtCode) { - this.districtCode = districtCode; - } - - @JsonProperty("districtName") - public String getDistrictName() { - return districtName; - } - - @JsonProperty("districtName") - public void setDistrictName(String districtName) { - this.districtName = districtName; - } - - @JsonProperty("regionName") - public String getRegionName() { - return regionName; - } - - @JsonProperty("regionName") - public void setRegionName(String regionName) { - this.regionName = regionName; - } - - @JsonProperty("ulbGrade") - public String getUlbGrade() { - return ulbGrade; - } - - @JsonProperty("ulbGrade") - public void setUlbGrade(String ulbGrade) { - this.ulbGrade = ulbGrade; - } - - @JsonProperty("longitude") - public Double getLongitude() { - return longitude; - } - - @JsonProperty("longitude") - public void setLongitude(Double longitude) { - this.longitude = longitude; - } - - @JsonProperty("latitude") - public Double getLatitude() { - return latitude; - } - - @JsonProperty("latitude") - public void setLatitude(Double latitude) { - this.latitude = latitude; - } - - @JsonProperty("shapeFileLocation") - public Object getShapeFileLocation() { - return shapeFileLocation; - } - - @JsonProperty("shapeFileLocation") - public void setShapeFileLocation(Object shapeFileLocation) { - this.shapeFileLocation = shapeFileLocation; - } - - @JsonProperty("captcha") - public Object getCaptcha() { - return captcha; - } - - @JsonProperty("captcha") - public void setCaptcha(Object captcha) { - this.captcha = captcha; - } - - @JsonProperty("code") - public String getCode() { - return code; - } - - @JsonProperty("code") - public void setCode(String code) { - this.code = code; - } - - @JsonProperty("regionCode") - public String getRegionCode() { - return regionCode; - } - - @JsonProperty("regionCode") - public void setRegionCode(String regionCode) { - this.regionCode = regionCode; - } - - @JsonProperty("municipalityName") - public String getMunicipalityName() { - return municipalityName; - } - - @JsonProperty("municipalityName") - public void setMunicipalityName(String municipalityName) { - this.municipalityName = municipalityName; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/CummulativeDataRequestDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/CummulativeDataRequestDto.java deleted file mode 100644 index 3ba4bf8e7da..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/CummulativeDataRequestDto.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.List; -import java.util.Map; - -public class CummulativeDataRequestDto { - private Map customData; - private RequestDate dates; - private String dashCode; - - - - public String getDashCode() { - return dashCode; - } - public void setDashCode(String dashCode) { - this.dashCode = dashCode; - } - public Map getCustomData() { - return customData; - } - public void setCustomData(Map customData) { - this.customData = customData; - } - public RequestDate getDates() { - return dates; - } - public void setDates(RequestDate dates) { - this.dates = dates; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/DashboardDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/DashboardDto.java deleted file mode 100644 index 1ff82a8da07..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/DashboardDto.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.tarento.analytics.dto; - -public class DashboardDto { - - private Long id; - private String name; - private String code; - private String description; - private String placement; - - public String getPlacement() { - return placement; - } - public void setPlacement(String placement) { - this.placement = placement; - } - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/DashboardHeaderDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/DashboardHeaderDto.java deleted file mode 100644 index 33db8b1a262..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/DashboardHeaderDto.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.tarento.analytics.dto; - -import com.tarento.analytics.model.LineData; - -public class DashboardHeaderDto { - - private String type; - private Object data; - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - public Object getData() { - return data; - } - public void setData(Object data) { - this.data = data; - } - public LineData getLineData() { - return lineData; - } - public void setLineData(LineData lineData) { - this.lineData = lineData; - } - private LineData lineData; -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Data.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Data.java deleted file mode 100644 index 2673cbf75ef..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Data.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.ArrayList; -import java.util.List; - -public class Data { - - private String headerName; - private Object headerValue; - private String headerSymbol; - private InsightsWidget insight; - - public InsightsWidget getInsight() { - return insight; - } - - public void setInsight(InsightsWidget insight) { - this.insight = insight; - } - - public void setHeaderName(String headerName) { - this.headerName = headerName; - } - - public void setHeaderSymbol(String headerSymbol) { - this.headerSymbol = headerSymbol; - } - - - public Data(String name, Object value, String symbol) { - this.headerName = name; - this.headerValue = value; - this.headerSymbol = symbol; - } - - public Data(String name, Object value, String symbol, List plots) { - this.headerName = name; - this.headerValue = value; - this.headerSymbol = symbol; - this.plots = plots; - } - - private List plots = new ArrayList<>(); - - public List getPlots() { - return plots; - } - - public void setPlots(List plots) { - this.plots = plots; - } - - public void setHeaderValue(Object headerValue) { - this.headerValue = headerValue; - } - - public String getHeaderName() { - return headerName; - } - - public Object getHeaderValue() { - return headerValue; - } - - public String getHeaderSymbol() { - return headerSymbol; - } - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/InsightsWidget.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/InsightsWidget.java deleted file mode 100644 index 0eed70f97fa..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/InsightsWidget.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.tarento.analytics.dto; - -public class InsightsWidget { - - private String name; - private Object value; - private String indicator; - private String colorCode; - - public InsightsWidget() {} - public InsightsWidget(String name, Object value, String indicator, String colorCode) { - this.name = name; - this.value = value; - this.indicator = indicator; - this.colorCode = colorCode; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public Object getValue() { - return value; - } - public void setValue(Object value) { - this.value = value; - } - public String getIndicator() { - return indicator; - } - public void setIndicator(String indicator) { - this.indicator = indicator; - } - public String getColorCode() { - return colorCode; - } - public void setColorCode(String colorCode) { - this.colorCode = colorCode; - } - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/MappingDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/MappingDto.java deleted file mode 100644 index 1bb98d2d1e5..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/MappingDto.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.tarento.analytics.dto; - -public class MappingDto { - - private Object mappings; - - public Object getMappings() { - return mappings; - } - - public void setMappings(Object mappings) { - this.mappings = mappings; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Plot.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Plot.java deleted file mode 100644 index f2d30924ac0..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Plot.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.tarento.analytics.dto; - - -public class Plot { - - private String label; - private String name; - private Double value; - private String strValue; - private String symbol; - - public Plot(String name, Double value, String symbol) { - this.name = name; - this.value = value; - this.symbol = symbol; - } - - public Plot(String name, String strValue, String symbol) { - this.name = name; - this.strValue = strValue; - this.symbol = symbol; - this.value = 0d; - } - - public Plot(String name, String symbol) { - this.name = name; - this.symbol = symbol; - this.value = null; - } - - public String getName() { - return name; - } - - public Double getValue() { - return value; - } - - public String getSymbol() { - return symbol; - } - - public String getLabel() { - return label; - } - - public String getStrValue() { - return strValue; - } - - public void setLabel(String label) { - this.label = label; - } - public void setValue(Double value) { - this.value = value; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RequestDate.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RequestDate.java deleted file mode 100644 index 3e615493aa2..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RequestDate.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.tarento.analytics.dto; - -public class RequestDate { - private String targetDate; - private String startDate; - private String endDate; - private String interval; - public String getInterval() { - return interval; - } - public void setInterval(String interval) { - this.interval = interval; - } - public String getTargetDate() { - return targetDate; - } - public void setTargetDate(String targetDate) { - this.targetDate = targetDate; - } - public String getStartDate() { - return startDate; - } - public void setStartDate(String startDate) { - this.startDate = startDate; - } - public String getEndDate() { - return endDate; - } - public void setEndDate(String endDate) { - this.endDate = endDate; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RequestDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RequestDto.java deleted file mode 100644 index 02e4b86f2a6..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RequestDto.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.Map; - -public class RequestDto { - - private Map headers; - private AggregateRequestDto aggregationRequestDto; - - public Map getHeaders() { - return headers; - } - public void setHeaders(Map headers) { - this.headers = headers; - } - public AggregateRequestDto getAggregationRequestDto() { - return aggregationRequestDto; - } - public void setAggregationRequestDto(AggregateRequestDto aggregationRequestDto) { - this.aggregationRequestDto = aggregationRequestDto; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RequestDtoV3.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RequestDtoV3.java deleted file mode 100644 index f152384027a..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RequestDtoV3.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.Map; - -public class RequestDtoV3 { - - private Map headers; - private AggregateRequestDtoV3 aggregationRequestDto; - - public Map getHeaders() { - return headers; - } - public void setHeaders(Map headers) { - this.headers = headers; - } - public AggregateRequestDtoV3 getAggregationRequestDto() { - return aggregationRequestDto; - } - public void setAggregationRequestDto(AggregateRequestDtoV3 aggregationRequestDto) { - this.aggregationRequestDto = aggregationRequestDto; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/ResponseDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/ResponseDto.java deleted file mode 100644 index 13ac1356976..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/ResponseDto.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.tarento.analytics.dto; - -import org.springframework.http.HttpStatus; - -public class ResponseDto { - - private int statusCode; - private String statusMessage; - private Object response; - - public ResponseDto(int statusCode, String statusMessage, Object response) { - this.statusCode = statusCode; - this.statusMessage = statusMessage; - this.response = response; - } - - public int getStatusCode() { - return statusCode; - } - - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - - public String getStatusMessage() { - return statusMessage; - } - - public void setStatusMessage(String statusMessage) { - this.statusMessage = statusMessage; - } - - public Object getResponse() { - return response; - } - - public void setResponse(Object response) { - this.response = response; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RoleDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RoleDto.java deleted file mode 100644 index 85fee2ee57c..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/RoleDto.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.tarento.analytics.dto; - -public class RoleDto { - - public Long id; - - public String description; - - public String name; - - public String orgId; - - public boolean isSuperAdmin; - - public String getOrgId() { - return orgId; - } - - public void setOrgId(String orgId) { - this.orgId = orgId; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/SearchDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/SearchDto.java deleted file mode 100644 index 14687f398b7..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/SearchDto.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.tarento.analytics.dto; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * This class will take input for elastic search query - * - * @author - */ -public class SearchDto { - - @SuppressWarnings("rawtypes") - private List properties; - - private List> facets = new ArrayList<>(); - private List fields; - private List excludedFields; - private Map sortBy = new HashMap<>(); - private String operation; - private String query; - private Integer limit = 250; - private Integer offset = 0; - private boolean fuzzySearch = false; - // additional properties will hold , filters, exist , not exist - private Map additionalProperties = new HashMap<>(); - private Map softConstraints = new HashMap<>(); - private List> groupQuery = new ArrayList<>(); - private List mode = new ArrayList<>(); - - public List> getGroupQuery() { - return groupQuery; - } - - public void setGroupQuery(List> groupQuery) { - this.groupQuery = groupQuery; - } - - public SearchDto() { - super(); - } - - @SuppressWarnings("rawtypes") - public SearchDto(List properties, String operation, int limit) { - super(); - this.properties = properties; - this.operation = operation; - this.limit = limit; - } - - @SuppressWarnings("rawtypes") - public List getProperties() { - return properties; - } - - @SuppressWarnings("rawtypes") - public void setProperties(List properties) { - this.properties = properties; - } - - public String getOperation() { - return operation; - } - - public void setOperation(String operation) { - this.operation = operation; - } - - public Integer getLimit() { - return limit; - } - - public void setLimit(Integer limit) { - this.limit = limit; - } - - public List> getFacets() { - return facets; - } - - public void setFacets(List> facets) { - this.facets = facets; - } - - public Map getSortBy() { - return sortBy; - } - - public void setSortBy(Map sortBy) { - this.sortBy = sortBy; - } - - public boolean isFuzzySearch() { - return fuzzySearch; - } - - public void setFuzzySearch(boolean fuzzySearch) { - this.fuzzySearch = fuzzySearch; - } - - public Map getAdditionalProperties() { - return additionalProperties; - } - - public void setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - public Object getAdditionalProperty(String key) { - return additionalProperties.get(key); - } - - public void addAdditionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - } - - public List getFields() { - return fields; - } - - public void setFields(List fields) { - this.fields = fields; - } - - public Integer getOffset() { - return offset; - } - - public void setOffset(Integer offset) { - this.offset = offset; - } - - public Map getSoftConstraints() { - return softConstraints; - } - - public void setSoftConstraints(Map softConstraints) { - this.softConstraints = softConstraints; - } - - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - - public List getMode() { - return mode; - } - - public void setMode(List mode) { - this.mode = mode; - } - - public List getExcludedFields() { - return excludedFields; - } - - public void setExcludedFields(List excludedFields) { - this.excludedFields = excludedFields; - } -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Tenant.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Tenant.java deleted file mode 100644 index a76e519ee34..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Tenant.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "code", "name", "description", "logoId", "imageId", "domainUrl", "type", "twitterUrl", - "facebookUrl", "emailId", "OfficeTimings", "city", "address", "contactNumber" }) -public class Tenant { - - @JsonProperty("code") - private String code; - @JsonProperty("name") - private String name; - @JsonProperty("description") - private String description; - @JsonProperty("logoId") - private String logoId; - @JsonProperty("imageId") - private Object imageId; - @JsonProperty("domainUrl") - private String domainUrl; - @JsonProperty("type") - private String type; - @JsonProperty("twitterUrl") - private Object twitterUrl; - @JsonProperty("facebookUrl") - private Object facebookUrl; - @JsonProperty("emailId") - private String emailId; - @JsonProperty("city") - private City city; - @JsonProperty("address") - private String address; - @JsonProperty("contactNumber") - private String contactNumber; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - @JsonProperty("code") - public String getCode() { - return code; - } - - @JsonProperty("code") - public void setCode(String code) { - this.code = code; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("logoId") - public String getLogoId() { - return logoId; - } - - @JsonProperty("logoId") - public void setLogoId(String logoId) { - this.logoId = logoId; - } - - @JsonProperty("imageId") - public Object getImageId() { - return imageId; - } - - @JsonProperty("imageId") - public void setImageId(Object imageId) { - this.imageId = imageId; - } - - @JsonProperty("domainUrl") - public String getDomainUrl() { - return domainUrl; - } - - @JsonProperty("domainUrl") - public void setDomainUrl(String domainUrl) { - this.domainUrl = domainUrl; - } - - @JsonProperty("type") - public String getType() { - return type; - } - - @JsonProperty("type") - public void setType(String type) { - this.type = type; - } - - @JsonProperty("twitterUrl") - public Object getTwitterUrl() { - return twitterUrl; - } - - @JsonProperty("twitterUrl") - public void setTwitterUrl(Object twitterUrl) { - this.twitterUrl = twitterUrl; - } - - @JsonProperty("facebookUrl") - public Object getFacebookUrl() { - return facebookUrl; - } - - @JsonProperty("facebookUrl") - public void setFacebookUrl(Object facebookUrl) { - this.facebookUrl = facebookUrl; - } - - @JsonProperty("emailId") - public String getEmailId() { - return emailId; - } - - @JsonProperty("emailId") - public void setEmailId(String emailId) { - this.emailId = emailId; - } - - @JsonProperty("city") - public City getCity() { - return city; - } - - @JsonProperty("city") - public void setCity(City city) { - this.city = city; - } - - @JsonProperty("address") - public String getAddress() { - return address; - } - - @JsonProperty("address") - public void setAddress(String address) { - this.address = address; - } - - @JsonProperty("contactNumber") - public String getContactNumber() { - return contactNumber; - } - - @JsonProperty("contactNumber") - public void setContactNumber(String contactNumber) { - this.contactNumber = contactNumber; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @Override - public String toString() { - return "Tenant [code=" + code + ", name=" + name + ", description=" + description + ", logoId=" + logoId - + ", imageId=" + imageId + ", domainUrl=" + domainUrl + ", type=" + type + ", twitterUrl=" + twitterUrl - + ", facebookUrl=" + facebookUrl + ", emailId=" + emailId - + ", city=" + city + ", address=" + address + ", contactNumber=" + contactNumber - + ", additionalProperties=" + additionalProperties + ", getCode()=" + getCode() + ", getName()=" - + getName() + ", getDescription()=" + getDescription() + ", getLogoId()=" + getLogoId() - + ", getImageId()=" + getImageId() + ", getDomainUrl()=" + getDomainUrl() + ", getType()=" + getType() - + ", getTwitterUrl()=" + getTwitterUrl() + ", getFacebookUrl()=" + getFacebookUrl() + ", getEmailId()=" - + getEmailId() + ", getCity()=" + getCity() - + ", getAddress()=" + getAddress() + ", getContactNumber()=" + getContactNumber() - + ", getAdditionalProperties()=" + getAdditionalProperties() + ", getClass()=" + getClass() - + ", hashCode()=" + hashCode() + ", toString()=" + super.toString() + "]"; - } - - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Tenants.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Tenants.java deleted file mode 100644 index a41b82e830f..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Tenants.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "tenantId", "moduleName", "tenants" }) -public class Tenants { - - @JsonProperty("tenantId") - private String tenantId; - @JsonProperty("moduleName") - private String moduleName; - @JsonProperty("tenants") - private List tenants = null; - @JsonIgnore - private Map additionalProperties = new HashMap(); - - @JsonProperty("tenantId") - public String getTenantId() { - return tenantId; - } - - @JsonProperty("tenantId") - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - @JsonProperty("moduleName") - public String getModuleName() { - return moduleName; - } - - @JsonProperty("moduleName") - public void setModuleName(String moduleName) { - this.moduleName = moduleName; - } - - @JsonProperty("tenants") - public List getTenants() { - return tenants; - } - - @JsonProperty("tenants") - public void setTenants(List tenants) { - this.tenants = tenants; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/UserDto.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/UserDto.java deleted file mode 100644 index e548e8b4caa..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/UserDto.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.tarento.analytics.dto; - -import java.util.List; - -public class UserDto { - - private long id; - - private String userName; - - private String emailId; - - private List roles; - - private String orgId; - - private String countryCode; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getEmailId() { - return emailId; - } - - public void setEmailId(String emailId) { - this.emailId = emailId; - } - - public List getRoles() { - return roles; - } - - public void setRoles(List roles) { - this.roles = roles; - } - - public String getOrgId() { - return orgId; - } - - public void setOrgId(String orgId) { - this.orgId = orgId; - } - - public String getCountryCode() { - return countryCode; - } - - public void setCountryCode(String countryCode) { - this.countryCode = countryCode; - } - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Visualization.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Visualization.java deleted file mode 100644 index 41a9cd6544a..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/dto/Visualization.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.tarento.analytics.dto; - -public class Visualization { - - private String type; - private String code; - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/enums/ChartType.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/enums/ChartType.java deleted file mode 100644 index 4e1377e630b..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/enums/ChartType.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.tarento.analytics.enums; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum ChartType { - - XTABLE("xtable"), TABLE("table"), PERFORM("perform"), METRIC("metric"), PIE("pie"), LINE("line"); - - private String value; - - ChartType(final String value) { - this.value = value; - } - - - @JsonValue - public String toString() { - return value; - } - - @JsonCreator - public static ChartType fromValue(final String passedValue) { - for (final ChartType obj : ChartType.values()) - if (String.valueOf(obj.value).toLowerCase().equals(passedValue.toLowerCase())) - return obj; - return null; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/exception/AINException.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/exception/AINException.java deleted file mode 100644 index 6e86721c377..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/exception/AINException.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.tarento.analytics.exception; - -public class AINException extends Exception{ - - - //TODO- wrapped up with other exceptions. - private static final long serialVersionUID = 1L; - - String errorCode; - - String errorMessage; - - public AINException(String errorCode, String errorMessage) { - this.errorCode= errorCode; - this.errorMessage = errorMessage; - } - - public String getErrorCode() { - return errorCode; - } - - - public String getErrorMessage() { - return errorMessage; - } - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/AdvanceTableChartResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/AdvanceTableChartResponseHandler.java deleted file mode 100644 index f19f3c4df50..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/AdvanceTableChartResponseHandler.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.tarento.analytics.handler; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; -import com.tarento.analytics.helper.ComputedFieldFactory; -import com.tarento.analytics.helper.IComputedField; -import com.tarento.analytics.model.ComputedFields; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.util.*; -import java.util.stream.Collectors; - -/** - * This handles ES response for single index, multiple index to represent data as pie figure - * Creates plots by merging/computing(by summation) index values for same key - * - */ -@Component -public class AdvanceTableChartResponseHandler implements IResponseHandler { - public static final Logger logger = LoggerFactory.getLogger(AdvanceTableChartResponseHandler.class); - - @Autowired - private ObjectMapper mapper; - - @Autowired - private ComputedFieldFactory computedFieldFactory; - - - @Override - public AggregateDto translate(AggregateRequestDto requestDto, ObjectNode aggregations) throws IOException { - - JsonNode aggregationNode = aggregations.get(AGGREGATIONS); - JsonNode chartNode = requestDto.getChartNode(); - String plotLabel = chartNode.get(PLOT_LABEL).asText(); - JsonNode computedFields = chartNode.get(COMPUTED_FIELDS); - JsonNode excludedFields = chartNode.get(EXCLUDED_COLUMNS); - - boolean executeComputedFields = computedFields !=null && computedFields.isArray(); - List aggrNodes = aggregationNode.findValues(BUCKETS); - boolean isPathSpecified = chartNode.get(IResponseHandler.AGGS_PATH)!=null && chartNode.get(IResponseHandler.AGGS_PATH).isArray(); - ArrayNode aggrsPaths = isPathSpecified ? (ArrayNode) chartNode.get(IResponseHandler.AGGS_PATH) : JsonNodeFactory.instance.arrayNode(); - - - - int[] idx = { 1 }; - List dataList = new ArrayList<>(); - Map> mappings = new HashMap<>(); - - - aggrNodes.stream().forEach(node -> { - - ArrayNode buckets = (ArrayNode) node; - buckets.forEach(bucket -> { - - Map plotMap = new LinkedHashMap<>(); - String key = bucket.get(IResponseHandler.KEY).asText(); - - //If aggrPath is specified. - if(aggrsPaths.size()>0){ - processWithSpecifiedKeys(aggrsPaths, bucket, mappings, key, plotMap,chartNode); - - } else { - processNestedObjects(bucket, mappings, key, plotMap,chartNode); - } - - if (plotMap.size() > 0) { - Map plots = new LinkedHashMap<>(); - Plot sno = new Plot(SERIAL_NUMBER, TABLE_TEXT); - sno.setLabel("" + idx[0]++); - Plot plotkey = new Plot(plotLabel.isEmpty() ? TABLE_KEY : plotLabel, TABLE_TEXT); - plotkey.setLabel(key); - - plots.put(SERIAL_NUMBER, sno); - plots.put(plotLabel.isEmpty() ? TABLE_KEY : plotLabel, plotkey); - plots.putAll(plotMap); - mappings.put(key, plots); - - } - - }); - - }); - mappings.entrySet().stream().forEach(plotMap -> { - List plotList = plotMap.getValue().values().stream().collect(Collectors.toList()); - //filter out data object with all zero data. - List filterPlot = plotList.stream().filter(c -> (!c.getName().equalsIgnoreCase(SERIAL_NUMBER) && !c.getName().equalsIgnoreCase(plotLabel) && c.getValue() != 0.0)).collect(Collectors.toList()); - - if(filterPlot.size()>0){ - Data data = new Data(plotMap.getKey(), Integer.parseInt(String.valueOf(plotMap.getValue().get(SERIAL_NUMBER).getLabel())), null); - data.setPlots(plotList); - // - if(executeComputedFields){ - try { - List computedFieldsList = mapper.readValue(computedFields.toString(), new TypeReference>(){}); - computedFieldsList.forEach(cfs -> { - IComputedField computedFieldObject = computedFieldFactory.getInstance(cfs.getActionName()); - computedFieldObject.set(requestDto, cfs.getPostAggregationTheory()); - computedFieldObject.add(data, cfs.getFields(), cfs.getNewField(), chartNode ); - - }); - // exclude the fields no to be displayed - if(excludedFields!=null){ - List list = mapper.readValue(excludedFields.toString(), new TypeReference>(){}); - List removeplots = data.getPlots().stream().filter(c -> list.contains(c.getName())).collect(Collectors.toList()); - data.getPlots().removeAll(removeplots); - } - - - } catch (Exception e){ - logger.error("execution of computed field :"+e.getMessage()); - } - } - dataList.add(data); - } - - }); - //dataList.sort((o1, o2) -> ((Integer) o1.getHeaderValue()).compareTo((Integer) o2.getHeaderValue())); - - if (chartNode.get(IResponseHandler.CHART_SPECIFIC)!=null) { - JsonNode specificData = chartNode.get(IResponseHandler.CHART_SPECIFIC); - JsonNode orderColumns = specificData.get(IResponseHandler.XTABLE_COLUMN); - if (orderColumns != null) { - dataList.forEach(finaldata -> { - List newDataList = new ArrayList<>(); - orderColumns.forEach(columnName -> { - List plotObj = finaldata.getPlots().stream() - .filter(plot -> plot.getName().equals(columnName.asText())) - .collect(Collectors.toList()); - newDataList.add(plotObj.get(0)); - }); - finaldata.setPlots(newDataList); - }); - } - } - - return getAggregatedDto(chartNode, dataList, requestDto.getVisualizationCode()); - - } - - - /** - * Preparing the plots - * @param bucketNode - * @param mappings - * @param key - * @param headerName - * @param plotMap - */ - private void process(JsonNode bucketNode, Map> mappings, String key, String headerName, Map plotMap,JsonNode chartNode){ - JsonNode valNode = bucketNode.findValue(VALUE) != null ? bucketNode.findValue(VALUE) : bucketNode.findValue(DOC_COUNT); - Double value = valNode.isDouble() ? valNode.asDouble() : valNode.asInt(); - String dataType = getDataType(chartNode, headerName, valNode); - //String headerName = bucketNode.findValue(KEY).asText(); - Plot plot = new Plot(headerName, value, dataType); - - if (mappings.containsKey(key)) { - double newval = mappings.get(key).get(headerName) == null ? value : (mappings.get(key).get(headerName).getValue() + value); - plot.setValue(newval); - mappings.get(key).put(headerName, plot); - } else { - plotMap.put(headerName, plot); - } - } - - /** - * Recursively processing the nodes - * @param node - * @param mappings - * @param key - * @param plotMap - */ - private void processNestedObjects(JsonNode node, Map> mappings, String key, Map plotMap,JsonNode chartNode ){ - - Iterator fieldNames = node.fieldNames(); - while(fieldNames.hasNext()) { - String fieldName = fieldNames.next(); - if(node.get(fieldName).isArray()){ - ArrayNode bucketNodes = (ArrayNode) node.get(fieldName); - bucketNodes.forEach(bucketNode -> { - process(bucketNode, mappings, key, bucketNode.findValue(KEY).asText() , plotMap,chartNode); - }); - - } else if(node.get(fieldName).isObject() && node.get(fieldName).get(VALUE)!=null){ - process(node.get(fieldName), mappings, key, fieldName , plotMap,chartNode); - - } else { - processNestedObjects(node.get(fieldName), mappings, key, plotMap,chartNode ); - } - - } - - - } - - private void processWithSpecifiedKeys(ArrayNode aggrsPaths, JsonNode bucket, Map> mappings, String key, Map plotMap,JsonNode chartNode ){ - - aggrsPaths.forEach(headerPath -> { - JsonNode valueNode = bucket.findValue(headerPath.asText()); - //Double value = (null == valueNode || null == valueNode.get(VALUE)) ? 0.0 : valueNode.get(VALUE).asDouble(); - Double doc_value = 0.0; - if(valueNode!=null) - doc_value = (null == valueNode.findValue(DOC_COUNT)) ? 0.0 : valueNode.findValue(DOC_COUNT).asDouble(); - Double value = (null == valueNode || null == valueNode.findValue(VALUE)) ? doc_value : valueNode.findValue(VALUE).asDouble(); - String dataType = getDataType(chartNode, headerPath.asText(), valueNode); - - if(chartNode.get(IS_ROUND_OFF)!=null && chartNode.get(IS_ROUND_OFF).asBoolean()) { - value = (double) Math.round(value); - } - Plot plot = new Plot(headerPath.asText(), value, dataType); - if (mappings.containsKey(key)) { - double newval = mappings.get(key).get(headerPath.asText()) == null ? value : (mappings.get(key).get(headerPath.asText()).getValue() + value); - plot.setValue(newval); - mappings.get(key).put(headerPath.asText(), plot); - } else { - plotMap.put(headerPath.asText(), plot); - } - }); - } - - - private String getDataType(JsonNode chartNode, String headerName, JsonNode valueNode) { - // TODO Auto-generated method stub - if (chartNode.get("pathDataTypeMapping") != null) { - JsonNode pathDataMapping = chartNode.get("pathDataTypeMapping"); - JsonNode node = pathDataMapping.findValue(headerName); - return node.textValue(); - } else if( chartNode.get(VALUE_TYPE) != null) { - return chartNode.get(VALUE_TYPE).asText(); - }else { - return valueNode.isDouble() ? "amount" : "number"; - } - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IPostResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IPostResponseHandler.java deleted file mode 100644 index 57ceb2bf4cb..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IPostResponseHandler.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.tarento.analytics.handler; - -import com.fasterxml.jackson.databind.node.ObjectNode; - -public interface IPostResponseHandler { - - - /** - * Intecepts the response tree - * @param responseNode - */ - public void postResponse(ObjectNode responseNode); - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IResponseHandler.java deleted file mode 100644 index bcc72b4e486..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/IResponseHandler.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.tarento.analytics.handler; - -import java.io.IOException; -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; - -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; -import com.tarento.analytics.enums.ChartType; -import org.apache.commons.collections.CollectionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Handles Elastic search consolidate responses - */ -public interface IResponseHandler { - - public static final Logger logger = LoggerFactory.getLogger(IResponseHandler.class); - - public static final String API_CONFIG_JSON = "ChartApiConfig.json"; - public static final String AGGS_PATH = "aggregationPaths"; - - public static final String CHART_NAME = "chartName"; - public static final String CHART_TYPE = "chartType"; - public static final String DRILL_CHART = "drillChart"; - public static final String VALUE_TYPE = "valueType"; - public static final String FILTER_KEYS = "filterKeys"; - - // Table Chart Keys - public static final String SERIAL_NUMBER = "S.N."; - public static final String TABLE_TEXT = "text" ; - public static final String TABLE_KEY = "Key"; - - - // TODO remove the specific column names. - public static final String TOTAL_COLLECTION = "Total Collection"; - public static final String TARGET_COLLECTION = "Target Collection"; - public static final String TARGET_ACHIEVED = "Target Achievement"; - - public static final String PT_DDR_BOUNDARY = "demandCollectionIndexDDRRevenue"; - public static final String PT_BOUNDARY = "demandCollectionIndexBoundaryRevenue"; - public static final String PT_BOUNDARY_DRILL = "boundaryDrillDown"; - public static final String TL_DDR_BOUNDARY = "licenseIssuedDDRRevenue"; - public static final String TL_BOUNDARY = "licenseIssuedBoundaryRevenue"; - public static final String TL_BOUNDARY_DRILL = "licenseIssuedBoundaryDrillDown"; - - - - public final String ASC = "asc"; - public final String DESC = "desc"; - public final String RANK = "Rank"; - public final String AGGREGATIONS = "aggregations"; - public final String PLOT_LABEL = "plotLabel"; - public final String COMPUTED_FIELDS = "computedFields"; - public final String EXCLUDED_COLUMNS = "excludedColumns"; - public final String LIMIT = "limit"; - public final String ORDER = "order"; - public final String ACTION = "action"; - public final String TYPE_MAPPING = "pathDataTypeMapping"; - - public static String BUCKETS = "buckets"; - public static String KEY = "key"; - public static String VALUE = "value"; - - public final String PERCENTAGE = "percentage"; - public final String DOC_COUNT = "doc_count"; - - public static final String POST_AGGREGATION_THEORY = "postAggregationTheory"; - - public static final String CHART_SPECIFIC = "chartSpecificProperty"; - - public static final String XTABLE_COLUMN = "XtableColumnOrder"; - - public static final String IS_ROUND_OFF = "isRoundOff"; - - public static Double BOUNDARY_VALUE = 50.0; - - public static final String DIVISION = "division"; - - /** - * Translate the consolidated/aggregated response - * - * @param requestDto - * @param aggregations - * @return - * @throws IOException - */ - public AggregateDto translate(AggregateRequestDto requestDto, ObjectNode aggregations) throws IOException; - - /** - * Prepare aggregated dato for a chart node - * Also sets the drillChart Value - * @param chartNode - * @param dataList - data plots object - * @return - */ - default AggregateDto getAggregatedDto(JsonNode chartNode, List dataList, String visualizationCode) { - AggregateDto aggregateDto = new AggregateDto(); - aggregateDto.setVisualizationCode(visualizationCode); - aggregateDto.setDrillDownChartId(chartNode.get(DRILL_CHART).asText()); - ChartType chartType = ChartType.fromValue(chartNode.get(CHART_TYPE).asText()); - aggregateDto.setChartType(chartType); - aggregateDto.setData(dataList); - if(null!=chartNode.get(FILTER_KEYS)) - aggregateDto.setFilter((ArrayNode) chartNode.get(FILTER_KEYS)); - return aggregateDto; - } - - /** - * Append computed field for a given Data, for its existing fields - * computes as partfield/wholefield * 100 - * - * @param data - * @param newfield - * @param partField - * @param wholeField - */ - default void addComputedField(Data data, String newfield, String partField, String wholeField) { - try { - Map plotMap = data.getPlots().stream().collect(Collectors.toMap(Plot::getName, Function.identity())); - - if (plotMap.get(partField).getValue() == 0.0 || plotMap.get(wholeField).getValue() == 0.0) { - data.getPlots().add(new Plot(newfield, 0.0, "percentage")); - } else { - double fieldValue = plotMap.get(partField).getValue() / plotMap.get(wholeField).getValue() * 100; - data.getPlots().add(new Plot(newfield, fieldValue, "percentage")); - - } - } catch (Exception e) { - data.getPlots().add(new Plot(newfield, 0.0, "percentage")); - } - - } - - /** - * Computes the percentage from 0th and 1st index of list - * Ex: 0th element/1st element * 100 - * @param values - * @return - */ - default Double percentageValue(List values, boolean isRoundOff) { - double val = (values.get(0)/values.get(1) * 100); - if(isRoundOff) { - val = Math.round(val); - } - return (values.size() > 1 && values.get(0) != 0.0 && values.get(1) != 0.0) ? val : 0.0; - } - - - /** - * Computes the percentage from 1st & 2nd element of collection - * Ex: first element/second element * 100 - * @param values - * @return - */ - default Double getPercentage(Map values, String partField, String wholeField, boolean isRoundOff) { - - double val = (values.get(partField)/ values.get(wholeField) * 100); - if(isRoundOff) { - val = Math.round(val); - } - return (values.size() > 1 && values.get(partField) != 0.0 && values.get(wholeField) != 0.0) ? val: 0.0; - } - - /** - * Adding missing plot elements with cumulative data - * @param plotKeys - all required plot key - * @param data - * @param symbol - */ - default void appendMissingPlot(Set plotKeys, Data data, String symbol, boolean isCumulative) { - - //To maintain the sorted plots list order - Map sortedMap = data.getPlots().stream() - .collect(Collectors.toMap( - Plot::getName, - plot -> plot, - (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); }, - LinkedHashMap::new - )); - - logger.info(data.getHeaderName() + " existing keys: "+sortedMap.keySet()+ "& size:"+sortedMap.keySet().size()); - - Collection allKeysMinusDataKeys = CollectionUtils.subtract(plotKeys, sortedMap.keySet()); - logger.info(data.getHeaderName() +" missing keys: "+allKeysMinusDataKeys); - - - for(String plKey:allKeysMinusDataKeys){ - sortedMap.put(plKey, new Plot(plKey, new Double("0"), symbol)); - if(isCumulative){ - List keys = sortedMap.keySet().stream().collect(Collectors.toList()); - int index = keys.indexOf(plKey); - double value = index>0 ? sortedMap.get(keys.get(index-1)).getValue():0.0; - sortedMap.get(plKey).setValue(value); - } - } - logger.info("after appending missing plots : "+ sortedMap); - data.setPlots(sortedMap.values().stream().collect(Collectors.toList())); - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/InsightsHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/InsightsHandler.java deleted file mode 100644 index c97914b2bf2..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/InsightsHandler.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.tarento.analytics.handler; - -import java.util.List; - -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.enums.ChartType; -import com.tarento.analytics.model.InsightsConfiguration; -import com.tarento.analytics.utils.ResponseRecorder; - -public interface InsightsHandler { - - public static final String CHART_NAME = "chartName"; - public static final String CHART_TYPE = "chartType"; - public static final String DRILL_CHART = "drillChart"; - public static final String VALUE_TYPE = "valueType"; - public static final String FILTER_KEYS = "filterKeys"; - public static final String INSIGHT_WIDGET_NAME = "INSIGHTS"; - public static final String INDICATOR_PLACEHOLDER = "$indicator"; - public static final String VALUE_PLACEHOLDER = "$value"; - public static final String INSIGHT_INTERVAL_PLACEHOLDER = "$insightInterval"; - public static final String INSIGHT_INDICATOR_POSITIVE = "upper_green"; - public static final String INSIGHT_INDICATOR_NEGATIVE = "lower_red"; - public static final String POSITIVE = "+"; - public static final String NEGATIVE = "-"; - - public static final String INSIGHT_NUMBER_DIFFERENCE = "differenceOfNumbers" ; - public static final String INSIGHT_PERCENTAGE_DIFFERENCE = "differenceOfPercentage" ; - - AggregateDto getInsights(AggregateDto aggregateDto, String visualizationCode, String moduleLevel, InsightsConfiguration insightsConfig, ResponseRecorder responseRecorder); - - default AggregateDto getAggregatedDto(List dataList, String visualizationCode) { - AggregateDto aggregateDto = new AggregateDto(); - aggregateDto.setVisualizationCode(visualizationCode); - aggregateDto.setDrillDownChartId("none"); - ChartType chartType = ChartType.fromValue("metric"); - aggregateDto.setChartType(chartType); - aggregateDto.setData(dataList); - return aggregateDto; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/InsightsHandlerFactory.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/InsightsHandlerFactory.java deleted file mode 100644 index 7167cfcc7f7..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/InsightsHandlerFactory.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.tarento.analytics.handler; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.tarento.analytics.enums.ChartType; - -@Component -public class InsightsHandlerFactory { - - @Autowired - private MetricsInsightsHandler metricInsightsHandler; - - public InsightsHandler getInstance(ChartType chartType) { - if(chartType == ChartType.METRIC) - return metricInsightsHandler; - return metricInsightsHandler; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/LineChartResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/LineChartResponseHandler.java deleted file mode 100644 index 25a0a4cdcec..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/LineChartResponseHandler.java +++ /dev/null @@ -1,311 +0,0 @@ -package com.tarento.analytics.handler; - -import java.io.IOException; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.tarento.analytics.helper.ComputedFieldFactory; -import com.tarento.analytics.helper.IComputedField; -import com.tarento.analytics.model.ComputedFields; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.constant.Constants; -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; - -import static com.tarento.analytics.constant.Constants.JsonPaths.DAYS; - -/** - * This handles ES response for single index, multiple index to represent data as line chart - * Creates plots by merging/computing(by summation) index values for same key - * AGGS_PATH : this defines the path/key to be used to search the tree - * VALUE_TYPE : defines the data type for the value formed, this could be amount, percentage, number - * - */ -@Component -public class LineChartResponseHandler implements IResponseHandler { - public static final Logger logger = LoggerFactory.getLogger(LineChartResponseHandler.class); - @Autowired - private ObjectMapper mapper; - @Autowired - private ComputedFieldFactory computedFieldFactory; - - @Override - public AggregateDto translate(AggregateRequestDto requestDto, ObjectNode aggregations) throws IOException { - - List dataList = new LinkedList<>(); - - //String json = "{\"ptindex-v1\":{\"Closed Application\":{\"buckets\":[{\"key_as_string\":\"2018-11-12T00:00:00.000Z\",\"key\":1541980800000,\"doc_count\":1,\"Applications Closed\":{\"buckets\":{\"closed\":{\"doc_count\":0,\"Count\":{\"value\":0}}}}}]},\"Total Application\":{\"buckets\":[{\"key_as_string\":\"2018-11-12T00:00:00.000Z\",\"key\":1541980800000,\"doc_count\":1,\"Count\":{\"value\":1}}]}},\"tlindex-v1\":{\"Closed Application\":{\"buckets\":[{\"key_as_string\":\"2019-04-29T00:00:00.000Z\",\"key\":1556496000000,\"doc_count\":6,\"Applications Closed\":{\"buckets\":{\"closed\":{\"doc_count\":0,\"Count\":{\"value\":0}},\"resolved\":{\"doc_count\":0,\"Count\":{\"value\":0}}}}}]},\"Total Application\":{\"buckets\":[{\"key\":1555891200000,\"doc_count\":1,\"Count\":{\"value\":1}},{\"key\":1556496000000,\"doc_count\":0,\"Count\":{\"value\":0}}]}},\"pgrindex-v1\":{\"Closed Application\":{\"buckets\":[{\"key\":1564963200000,\"doc_count\":438,\"Applications Closed\":{\"buckets\":{\"closed\":{\"doc_count\":5,\"Count\":{\"value\":5}}}}}]},\"Total Application\":{\"buckets\":[{\"key\":1564963200000,\"doc_count\":438,\"Count\":{\"value\":438}},{\"key\":1574035200000,\"doc_count\":3,\"Count\":{\"value\":3}}]}}}"; - JsonNode aggregationNode = aggregations.get(AGGREGATIONS); - JsonNode chartNode = requestDto.getChartNode(); - boolean isRequestInterval = null == requestDto.getRequestDate() ? false : requestDto.getRequestDate().getInterval()!=null && !requestDto.getRequestDate().getInterval().isEmpty(); - String interval = isRequestInterval ? requestDto.getRequestDate().getInterval(): chartNode.get(Constants.JsonPaths.INTERVAL).asText(); - if(interval == null || interval.isEmpty()){ - throw new RuntimeException("Interval must have value from config or request"); - } - - String symbol = chartNode.get(IResponseHandler.VALUE_TYPE).asText(); - String symbolFromPathDataTypeMap = symbol; - ArrayNode aggrsPaths = (ArrayNode) chartNode.get(IResponseHandler.AGGS_PATH); - ArrayNode pathDataTypeMap = (ArrayNode) chartNode.get(TYPE_MAPPING); - - Set plotKeys = new LinkedHashSet<>(); - boolean isCumulative = chartNode.get("isCumulative").asBoolean(); - - JsonNode computedFields = chartNode.get(COMPUTED_FIELDS); - boolean executeComputedFields = computedFields !=null && computedFields.isArray(); - - - //aggrsPaths.forEach(headerPath -> { - for(JsonNode headerPath : aggrsPaths){ - List aggrNodes = aggregationNode.findValues(headerPath.asText()); - - - - JsonNode datatype = null; - if(pathDataTypeMap!=null) { - datatype = pathDataTypeMap.findValue(headerPath.asText()); - - } - - if(datatype!=null) { - symbolFromPathDataTypeMap=datatype.asText(); - } - else { - symbolFromPathDataTypeMap=symbol; - } - - Map plotMap = new LinkedHashMap<>(); - Map multiAggrPlotMap = new LinkedHashMap<>(); - List totalValues = new ArrayList<>(); - Set finalBucketKeys = new LinkedHashSet<>(); - - // For multi aggr, find all plot keys first - enrichBucketKeys(aggrNodes, finalBucketKeys, interval); - initializeMultiAggrPlotMap(multiAggrPlotMap, finalBucketKeys); - - for(JsonNode aggrNode : aggrNodes) { - if (aggrNode.findValues(IResponseHandler.BUCKETS).size() > 0) { - ArrayNode buckets = (ArrayNode) aggrNode.findValues(IResponseHandler.BUCKETS).get(0); - for(JsonNode bucket : buckets){ - String bkey = bucket.findValue(IResponseHandler.KEY).asText(); - String key = getIntervalKey(bkey, Constants.Interval.valueOf(interval)); - - plotKeys.add(key); - double previousVal = !isCumulative ? 0.0 : (totalValues.size() > 0 ? totalValues.get(totalValues.size() - 1) : 0.0); - - double value = 0.0; - if (executeComputedFields) { - try { - - List computedFieldsList = mapper.readValue(computedFields.toString(), new TypeReference>() { - }); - - for (ComputedFields cfs : computedFieldsList) { - IComputedField computedFieldObject = computedFieldFactory.getInstance(cfs.getActionName()); - computedFieldObject.set(requestDto, cfs.getPostAggregationTheory()); - computedFieldObject.add(bucket, cfs.getFields(), cfs.getNewField(), chartNode); - - if (symbolFromPathDataTypeMap.equals(DAYS)) { - - long milidiff = bucket.findValue(cfs.getNewField()).get(IResponseHandler.VALUE).asLong(); - long days = TimeUnit.MILLISECONDS.toDays(milidiff); - value = previousVal + (days); - - } else { - value = previousVal + (bucket.findValue(cfs.getNewField()).get(IResponseHandler.VALUE).asLong()); - - } - } - - } catch (Exception e) { - logger.error("execution of computed field :" + e.getMessage()); - } - - } else { - String jsonStr = bucket.toString(); - JSONObject currObj = new JSONObject(jsonStr); - for (Iterator it = bucket.fieldNames(); it.hasNext(); ) { - String fieldName = it.next(); - if (currObj.get(fieldName) instanceof JSONObject) { - if (bucket.get(fieldName).findValue("buckets") == null) { - value = previousVal + ((bucket.get(fieldName).findValue(IResponseHandler.VALUE) != null) ? bucket.get(fieldName).findValue(IResponseHandler.VALUE).asDouble() : bucket.get(fieldName).findValue(IResponseHandler.DOC_COUNT).asDouble()); - } - - } - } - - //value = previousVal + ((bucket.findValue(IResponseHandler.VALUE) != null) ? bucket.findValue(IResponseHandler.VALUE).asDouble():bucket.findValue(IResponseHandler.DOC_COUNT).asDouble()); - - if (chartNode.get(IS_ROUND_OFF) != null && chartNode.get(IS_ROUND_OFF).asBoolean()) { - value = (double) Math.round(value); - } - } - //double value = previousVal + ((bucket.findValue(IResponseHandler.VALUE) != null) ? bucket.findValue(IResponseHandler.VALUE).asDouble():bucket.findValue(IResponseHandler.DOC_COUNT).asDouble()); - - plotMap.put(key, new Double("0") + value); - totalValues.add(value); - } - } - addIterationResultsToMultiAggrMap(plotMap, multiAggrPlotMap, isCumulative); - plotMap.clear(); - totalValues.clear(); - } - - plotMap = multiAggrPlotMap; - - totalValues = new ArrayList<>(plotMap.values()); - String finalSymbolForPlots= symbolFromPathDataTypeMap; - List plots = plotMap.entrySet().stream().map(e -> new Plot(e.getKey(), e.getValue(), finalSymbolForPlots)).collect(Collectors.toList()); - try{ - Data data = new Data(headerPath.asText(), (totalValues==null || totalValues.isEmpty()) ? 0.0 : totalValues.stream().reduce(0.0, Double::sum),finalSymbolForPlots ); - data.setPlots(plots); - dataList.add(data); - } catch (Exception e) { - logger.error(" Legend/Header "+headerPath.asText() +" exception occurred "+e.getMessage()); - } - // }); - } - - dataList.forEach(data -> { - appendMissingPlot(plotKeys, data, symbol, isCumulative); - }); - return getAggregatedDto(chartNode, dataList, requestDto.getVisualizationCode()); - } - - private void addIterationResultsToMultiAggrMap(Map plotMap, Map multiAggrPlotMap, Boolean isCumulative) { - - Map finalPlotMap = new LinkedHashMap<>(); - - multiAggrPlotMap.keySet().forEach(key -> { - finalPlotMap.put(key, 0.0); - }); - - plotMap.keySet().forEach(key -> { - finalPlotMap.put(key, plotMap.get(key)); - }); - - if(isCumulative) { - Double previousValue = 0.0; - for (String key : finalPlotMap.keySet()) { - if (finalPlotMap.get(key) == 0.0) - finalPlotMap.put(key, previousValue); - previousValue = finalPlotMap.get(key); - } - } - - finalPlotMap.keySet().forEach(key->{ - Double previousValue = multiAggrPlotMap.get(key); - Double currentValue = finalPlotMap.get(key); - multiAggrPlotMap.put(key, previousValue + currentValue); - }); - - if(isCumulative) { - Double previousValue = 0.0; - for (String key : multiAggrPlotMap.keySet()) { - if (multiAggrPlotMap.get(key) == 0.0) - multiAggrPlotMap.put(key, previousValue); - previousValue = multiAggrPlotMap.get(key); - } - } - } - - private void initializeMultiAggrPlotMap(Map multiAggrPlotMap, Set finalBucketKeys) { - finalBucketKeys.forEach(keyName -> { - multiAggrPlotMap.put(keyName, 0.0); - }); - } - - private void enrichBucketKeys(List aggrNodes, Set finalBucketKeys, String interval) { - List bkeyList = new ArrayList<>(); - for(JsonNode aggrNode : aggrNodes) { - if (aggrNode.findValues(IResponseHandler.BUCKETS).size() > 0) { - ArrayNode buckets = (ArrayNode) aggrNode.findValues(IResponseHandler.BUCKETS).get(0); - for(JsonNode bucket : buckets){ - String bkey = bucket.findValue(IResponseHandler.KEY).asText(); - bkeyList.add(bkey); - } - } - } - Collections.sort(bkeyList); - for(String bkey : bkeyList){ - String key = getIntervalKey(bkey, Constants.Interval.valueOf(interval)); - if(!finalBucketKeys.contains(key)) - finalBucketKeys.add(key); - } - - } - - - private String getIntervalKey(String epocString, Constants.Interval interval) { - try { - long epoch = Long.parseLong( epocString ); - Date expiry = new Date( epoch ); - Calendar cal = Calendar.getInstance(); - cal.setTime(expiry); - - String day = String.valueOf(cal.get(Calendar.DATE)); - String month = monthNames(cal.get(Calendar.MONTH)+1); - String year = ""+cal.get(Calendar.YEAR); - - String intervalKey = ""; - if(interval.equals(Constants.Interval.day)) { - intervalKey = day.concat("-").concat(month); - } else if(interval.equals(Constants.Interval.week)){ - intervalKey = day.concat("-").concat(month); - } else if(interval.equals(Constants.Interval.year)){ - intervalKey = year; - } else if(interval.equals(Constants.Interval.month)){ - intervalKey = month.concat("-").concat(year); - } else { - throw new RuntimeException("Invalid interval"); - } - - //String weekMonth = "Week " + cal.get(Calendar.WEEK_OF_YEAR) /*+ " : " + dayMonth*/;//+" of Month "+ (cal.get(Calendar.MONTH) + 1); - return intervalKey; - } catch (Exception e) { - return epocString; - } - } - - private String monthNames(int month) { - if(month == 1) - return "Jan"; - else if(month == 2) - return "Feb"; - else if(month == 3) - return "Mar"; - else if(month == 4) - return "Apr"; - else if(month == 5) - return "May"; - else if(month == 6) - return "Jun"; - else if(month == 7) - return "Jul"; - else if(month == 8) - return "Aug"; - else if(month == 9) - return "Sep"; - else if(month == 10) - return "Oct"; - else if(month == 11) - return "Nov"; - else if(month == 12) - return "Dec"; - else - return "Month"; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricChartResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricChartResponseHandler.java deleted file mode 100644 index e193b76d6f2..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricChartResponseHandler.java +++ /dev/null @@ -1,215 +0,0 @@ -package com.tarento.analytics.handler; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.egov.tracer.model.CustomException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.ConfigurationLoader; -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; -import com.tarento.analytics.helper.ComputeHelper; -import com.tarento.analytics.helper.ComputeHelperFactory; -import com.tarento.analytics.utils.ResponseRecorder; - -/** - * This handles ES response for single index, multiple index to represent single data value - * Creates plots by merging/computing(by summation or by percentage) index values for same key - * ACTION: for the chart config defines the type either summation or computing percentage - * AGGS_PATH : this defines the path/key to be used to search the tree - * - */ -@Component -public class MetricChartResponseHandler implements IResponseHandler{ - public static final Logger logger = LoggerFactory.getLogger(MetricChartResponseHandler.class); - - char insightPrefix = 'i'; - - @Autowired - ConfigurationLoader configurationLoader; - - @Autowired - ComputeHelperFactory computeHelperFactory; - - - - - /** - * Adds the data into ResponseResponder - * @param request - * @param aggregations - * @return - * @throws IOException - */ - - @Override - public AggregateDto translate(AggregateRequestDto request, ObjectNode aggregations) throws IOException { - List dataList = new ArrayList<>(); - String requestId = request.getRequestId(); - String visualizationCode = request.getVisualizationCode(); - - JsonNode aggregationNode = aggregations.get(AGGREGATIONS); - JsonNode chartNode = null; - - // Fetches the chart config - if(request.getVisualizationCode().charAt(0) == insightPrefix) { - String internalChartId = request.getVisualizationCode().substring(1); - chartNode = configurationLoader.get(API_CONFIG_JSON).get(internalChartId); - } else { - chartNode = configurationLoader.get(API_CONFIG_JSON).get(request.getVisualizationCode()); - } - - List totalValues = new ArrayList<>(); - String chartName = chartNode.get(CHART_NAME).asText(); - String action = chartNode.get(ACTION).asText(); - - - /* - * Aggreagation paths are the name of aggregations - * Could have been inferred from aggregationNode i.e from query Dont know why it was added in config? - * */ - List percentageList = new ArrayList<>(); - ArrayNode aggrsPaths = (ArrayNode) chartNode.get(AGGS_PATH); - - /* - * Sums all value of all aggrsPaths i.e all aggregations - * */ - boolean isRoundOff = (chartNode.get(IS_ROUND_OFF)!=null && chartNode.get(IS_ROUND_OFF).asBoolean()) ? true : false; - Plot latestDateplot = new Plot("todaysDate", Double.valueOf(0), "number");; - Plot lastUpdatedTime = new Plot("lastUpdatedTime", Double.valueOf(0), "number"); - Boolean isTodaysCollection = (chartNode.get("TodaysCollection") == null ? Boolean.FALSE : chartNode.get("TodaysCollection").asBoolean()); - for( JsonNode headerPath : aggrsPaths) { - List values = aggregationNode.findValues(headerPath.asText()); - int valueIndex = 0; - Double headerPathValue = new Double(0); - for (JsonNode value : values) { - if (isRoundOff) { - ObjectMapper mapper = new ObjectMapper(); - JsonNode node = value.get("value"); - if (node != null) { - Double roundOff = 0.0d; - try { - roundOff = mapper.treeToValue(node, Double.class); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - if (roundOff != null) { - int finalvalue = (int) Math.round(roundOff); - ((ObjectNode) value).put("value", finalvalue); - } - } - - } - List valueNodes = value.findValues(VALUE).isEmpty() ? value.findValues(DOC_COUNT) - : value.findValues(VALUE); - Double sum = valueNodes.stream().mapToDouble(o -> o.asDouble()).sum(); - - // PreAction Theory should be consdiered and executed to modify the aggregation value - JsonNode preActionTheoryNode = chartNode.get("preActionTheory"); - - if( preActionTheoryNode != null && preActionTheoryNode.findValue(headerPath.asText()) !=null && - !preActionTheoryNode.findValue(headerPath.asText()).asText().isEmpty()) { - ComputeHelper computeHelper = computeHelperFactory.getInstance(preActionTheoryNode.findValue(headerPath.asText()).asText()); - if(computeHelper !=null) { - sum = computeHelper.compute(request, sum); - } - - } - - headerPathValue = Double.sum(headerPathValue, sum); - - if (isTodaysCollection == Boolean.TRUE) { - - String latestDateKey = null; - String lastUpdatedTimeKey = null; - List latestDates = aggregationNode.findValues("todaysDate"); - if (latestDates != null && latestDates.size() > 0) { - JsonNode latestDate = latestDates.get(valueIndex); - if (latestDate != null) { - List latestDateBuckets = latestDate.findValues(BUCKETS); - if (latestDateBuckets != null && latestDateBuckets.size() > 0) { - JsonNode latestDateBucket = latestDateBuckets.get(0); - latestDateKey = (latestDateBucket.findValue(IResponseHandler.KEY) == null ? null - : latestDateBucket.findValue(IResponseHandler.KEY).asText()); - } - if (latestDateKey != null - && ((Double.valueOf(latestDateKey)) > latestDateplot.getValue())) { - latestDateplot.setValue(Double.valueOf(latestDateKey)); - } - - } - ListlastUpdatedTimeNodes = aggregationNode.findValues("lastUpdatedTime"); - if (lastUpdatedTimeNodes != null && lastUpdatedTimeNodes.size() > 0) { - JsonNode lastUpdatedTimeNode = lastUpdatedTimeNodes.get(valueIndex); - if (lastUpdatedTimeNode != null) { - List lastUpdatedTimeBuckets = lastUpdatedTimeNode.findValues(BUCKETS); - if (lastUpdatedTimeBuckets != null && lastUpdatedTimeBuckets.size() > 0) { - JsonNode lastUpdatedTimeBucket = lastUpdatedTimeBuckets.get(0); - lastUpdatedTimeKey = (lastUpdatedTimeBucket.findValue(IResponseHandler.KEY) == null - ? null - : lastUpdatedTimeBucket.findValue(IResponseHandler.KEY).asText()); - } - - if (lastUpdatedTimeKey != null - && ((Double.valueOf(lastUpdatedTimeKey)) > lastUpdatedTime.getValue())) { - lastUpdatedTime.setValue(Double.valueOf(lastUpdatedTimeKey)); - } - } - } - } - - } - valueIndex++; - } - // Why is aggrsPaths.size()==2 required? Is there validation if action = - // PERCENTAGE and aggrsPaths > 2 - if (action.equals(PERCENTAGE) && aggrsPaths.size() == 2) { - percentageList.add(headerPathValue); - } else { - totalValues.add(headerPathValue); - } - - } - - String symbol = chartNode.get(IResponseHandler.VALUE_TYPE).asText(); - - try{ - Data data = new Data(chartName, action.equals(PERCENTAGE) && aggrsPaths.size()==2? percentageValue(percentageList, isRoundOff) : (totalValues==null || totalValues.isEmpty())? 0.0 :totalValues.stream().reduce(0.0, Double::sum), symbol); - //Logic to perform DIVISION action - if (action.equals(DIVISION)){ - if (totalValues.size() == 2) { - if (totalValues.get(1) != 0) - data.setHeaderValue(totalValues.get(0) / totalValues.get(1)); - else - data.setHeaderValue(Double.valueOf(0)); - } - else - throw new CustomException("INVALID_NUMBER_OF_OPERANDS", "Division operation can be performed only with 2 operands."); - } - data.setPlots( Arrays.asList(latestDateplot,lastUpdatedTime)); - request.getResponseRecorder().put(visualizationCode, request.getModuleLevel(), data); - dataList.add(data); - if(chartNode.get(POST_AGGREGATION_THEORY) != null) { - ComputeHelper computeHelper = computeHelperFactory.getInstance(chartNode.get(POST_AGGREGATION_THEORY).asText()); - computeHelper.compute(request, dataList); - } - }catch (Exception e){ - logger.info("data chart name = "+chartName +" ex occurred "+e.getMessage()); - } - - return getAggregatedDto(chartNode, dataList, request.getVisualizationCode()); - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricsInsightsHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricsInsightsHandler.java deleted file mode 100644 index a4d205ad8c6..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/MetricsInsightsHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.tarento.analytics.handler; - -import java.text.DecimalFormat; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.InsightsWidget; -import com.tarento.analytics.model.InsightsConfiguration; -import com.tarento.analytics.utils.ResponseRecorder; - -@Component -public class MetricsInsightsHandler implements InsightsHandler { - -// @Autowired -// private ResponseRecorder responseRecorder; - - @Override - public AggregateDto getInsights(AggregateDto aggregateDto, String visualizationCode, String moduleLevel, InsightsConfiguration insightsConfig , ResponseRecorder responseRecorder) { - String internalVisualizationCode = visualizationCode.substring(1); - Data currentData = (Data) responseRecorder.get(internalVisualizationCode, moduleLevel); - Data pastData = (Data) responseRecorder.get(visualizationCode, moduleLevel); - String textToDisplay = insightsConfig.getTextMessage(); - String insightIndicator = ""; - if(INSIGHT_NUMBER_DIFFERENCE.equals(insightsConfig.getAction())) { - Double difference = (Double)currentData.getHeaderValue() - (Double) pastData.getHeaderValue(); - if(difference >= 0) { - Double insightValue = (difference / (Double)pastData.getHeaderValue()) * 100; - if(insightValue.isInfinite()) - return aggregateDto; - if (insightValue.isNaN()) { - textToDisplay = null; - } else { - textToDisplay = textToDisplay.replace(INDICATOR_PLACEHOLDER, POSITIVE); - if(insightsConfig.getIsRoundOff()!=null && insightsConfig.getIsRoundOff()) { - textToDisplay = textToDisplay.replace(VALUE_PLACEHOLDER, - String.valueOf(Math.round(insightValue))); - }else { - textToDisplay = textToDisplay.replace(VALUE_PLACEHOLDER, - String.valueOf(new DecimalFormat("#.##").format(insightValue))); - } - insightIndicator = INSIGHT_INDICATOR_POSITIVE; - } - } else { - difference = (Double) pastData.getHeaderValue() - (Double) currentData.getHeaderValue(); - Double insightValue = (difference / (Double)pastData.getHeaderValue()) * 100; - if(insightValue.isInfinite()) - return aggregateDto; - if(difference.equals(0.0) && insightValue.equals(0.0)) - return aggregateDto; - textToDisplay = textToDisplay.replace(INDICATOR_PLACEHOLDER, NEGATIVE); - if(insightsConfig.getIsRoundOff()!=null && insightsConfig.getIsRoundOff()) { - textToDisplay = textToDisplay.replace(VALUE_PLACEHOLDER, - String.valueOf(Math.round(insightValue))); - }else { - textToDisplay = textToDisplay.replace(VALUE_PLACEHOLDER, - String.valueOf(new DecimalFormat("#.##").format(insightValue))); - } - insightIndicator = INSIGHT_INDICATOR_NEGATIVE; - } - if (textToDisplay == null) { - return aggregateDto; - } else { - textToDisplay = textToDisplay.replace(INSIGHT_INTERVAL_PLACEHOLDER, - insightsConfig.getInsightInterval()); - InsightsWidget insightsWidget = new InsightsWidget(INSIGHT_WIDGET_NAME, textToDisplay, insightIndicator, - insightIndicator); - List dataList = aggregateDto.getData(); - for (Data data : dataList) { - data.setInsight(insightsWidget); - } - } - } - return aggregateDto; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/PerformanceChartResponeHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/PerformanceChartResponeHandler.java deleted file mode 100644 index 2eaf6b68c02..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/PerformanceChartResponeHandler.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.tarento.analytics.handler; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.ConfigurationLoader; -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; -import com.tarento.analytics.helper.ComputeHelper; -import com.tarento.analytics.helper.ComputeHelperFactory; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.util.*; -import java.util.stream.Collectors; - -@Component -public class PerformanceChartResponeHandler implements IResponseHandler { - - public static final Logger logger = LoggerFactory.getLogger(PerformanceChartResponeHandler.class); - - @Autowired - ComputeHelperFactory computeHelperFactory; - @Override - public AggregateDto translate(AggregateRequestDto requestDto, ObjectNode aggregations) throws IOException { - - JsonNode aggregationNode = aggregations.get(AGGREGATIONS); - JsonNode chartNode = requestDto.getChartNode(); - String symbol = chartNode.get(IResponseHandler.VALUE_TYPE).asText(); - String plotLabel = chartNode.get(PLOT_LABEL).asText(); - String order = chartNode.get(ORDER).asText(); - int limit = chartNode.get(LIMIT).asInt(); - - boolean isRoundOff = (chartNode.get(IS_ROUND_OFF)!=null && chartNode.get(IS_ROUND_OFF).asBoolean()) ? true : false; - - ArrayNode aggrsPaths = (ArrayNode) chartNode.get(IResponseHandler.AGGS_PATH); - Map> mappings = new LinkedHashMap<>();//HashMap<>(); - - aggrsPaths.forEach(headerPath -> { - aggregationNode.findValues(headerPath.asText()).forEach(aggrNode -> { - if (aggrNode.findValues(IResponseHandler.BUCKETS).size() > 0) { - - ArrayNode buckets = (ArrayNode) aggrNode.findValues(IResponseHandler.BUCKETS).get(0); - buckets.forEach(bucket -> { - String key = bucket.findValue(IResponseHandler.KEY).asText(); - Double value = bucket.findValue(IResponseHandler.VALUE).asDouble(); - - for (Iterator it = bucket.fieldNames(); it.hasNext(); ) { - String fieldName = it.next(); - if(bucket.get(fieldName) instanceof JsonNode){ - if(bucket.get(fieldName).findValue(IResponseHandler.BUCKETS) == null){ - JsonNode valueNode =bucket.get(fieldName).findValue(IResponseHandler.VALUE); - value = (valueNode != null ? valueNode.asDouble(): Double.valueOf("0")); - } - - } - } - - // PreAction Theory should be consdiered and executed to modify the aggregation value - JsonNode preActionTheoryNode = chartNode.get("preActionTheory"); - - if( preActionTheoryNode != null && preActionTheoryNode.findValue(headerPath.asText()) !=null && - !preActionTheoryNode.findValue(headerPath.asText()).asText().isEmpty()) { - ComputeHelper computeHelper = computeHelperFactory.getInstance(preActionTheoryNode.findValue(headerPath.asText()).asText()); - if(computeHelper !=null) { - value = computeHelper.compute(requestDto, value); - } - - } - - if (mappings.containsKey(key)) { - Double sum = (mappings.get(key)).containsKey(headerPath.asText()) ? (mappings.get(key)).get(headerPath.asText()) + value : value; - (mappings.get(key)).put(headerPath.asText(), sum); - - } else { - Map additiveMap = new HashMap<>(); - additiveMap.put(aggrsPaths.get(0).asText(), new Double("0")); - additiveMap.put(aggrsPaths.get(1).asText(), new Double("0")); - - additiveMap.put(headerPath.asText(), value); - mappings.put(key, additiveMap); - } - }); - - } - }); - }); - - logger.info("performance chart data mappings : "+mappings); - List plotList = mappings.entrySet().stream().map(e -> new Plot(e.getKey(), getPercentage(e.getValue(), aggrsPaths.get(0).asText(),aggrsPaths.get(1).asText(), isRoundOff), symbol)).collect(Collectors.toList()); - List plots = plotList.stream().filter(plot -> plot.getValue() != 0.0).collect(Collectors.toList()); - - plots.stream().forEach(item -> item.setLabel(plotLabel)); - Comparator plotValueComparator = Comparator.comparing(Plot::getValue); - plots.sort(plotValueComparator.reversed()); - return getAggregatedDto(chartNode, getDataOnPerformingOrder(plots, limit, order, symbol), requestDto.getVisualizationCode()); - } - - /** - * Prepare the plots with it's header Data in performing order - * @param plots - * @param limit n number of plots elements - * @param order top wise or bottom wise performance - * @param symbol - * @return - */ - private List getDataOnPerformingOrder(List plots, int limit, String order, String symbol) { - - List dataList = new ArrayList<>(); - if (order.equals(ASC)) { - for (int i = (plots.size() - 1); i >= 0; i--) { - dataList.add(getRankedPLot(i, symbol, plots)); - } - } else if (order.equals(DESC)) { - for (int i = 0; i < plots.size(); i++) { - dataList.add(getRankedPLot(i, symbol, plots)); - } - } - // return dataList.subList(Math.max(0, 0), Math.min(dataList.size(), limit)); - return dataList; - - } - - private Data getRankedPLot(int rank, String dataType, List plots){ - Data data = new Data(RANK, rank+1, dataType); - List p = new ArrayList(); - p.add(plots.get(rank)); - data.setPlots(p); - return data; - } - -} - - diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/PieChartResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/PieChartResponseHandler.java deleted file mode 100644 index 56d69562e05..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/PieChartResponseHandler.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.tarento.analytics.handler; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.ConfigurationLoader; -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; -import com.tarento.analytics.enums.ChartType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -/** - * This handles ES response for single index, multiple index to represent data as pie figure - * Creates plots by merging/computing(by summation) index values for same key - * AGGS_PATH : this defines the path/key to be used to search the tree - * VALUE_TYPE : defines the data type for the value formed, this could be amount, percentage, number - * - */ -@Component -public class PieChartResponseHandler implements IResponseHandler { - public static final Logger logger = LoggerFactory.getLogger(PieChartResponseHandler.class); - - - @Override - public AggregateDto translate(AggregateRequestDto requestDto, ObjectNode aggregations) throws IOException { - - List dataList = new ArrayList<>(); - - JsonNode aggregationNode = aggregations.get(AGGREGATIONS); - JsonNode chartNode = requestDto.getChartNode(); - String headerKey = chartNode.get(CHART_NAME).asText(); - List headerPlotList = new ArrayList<>(); - List totalValue = new ArrayList<>(); - Map plotMap = new LinkedHashMap<>(); - - String symbol = chartNode.get(IResponseHandler.VALUE_TYPE).asText(); - ArrayNode aggrsPaths = (ArrayNode) chartNode.get(IResponseHandler.AGGS_PATH); - - /** - * For every aggregation on plot object is added - */ - aggrsPaths.forEach(headerPath -> { - aggregationNode.findValues(headerPath.asText()).stream().forEach(valueNode->{ - if(valueNode.has(BUCKETS)){ - JsonNode buckets = valueNode.findValue(BUCKETS); - buckets.forEach(bucket -> { - Double val = valueNode.findValues(VALUE).isEmpty() ? bucket.findValue(DOC_COUNT).asInt() : bucket.findValue(VALUE).asDouble(); - totalValue.add(val); - if(plotMap.containsKey(bucket.findValue(KEY).asText())) { - val = val + plotMap.get(bucket.findValue(KEY).asText()); - } - plotMap.put(bucket.findValue(KEY).asText(), new Double("0") + val); -// Plot plot = new Plot(bucket.findValue(KEY).asText(), val, symbol); -// headerPlotList.add(plot); - }); - - } else { - List valueNodes = valueNode.findValues(VALUE).isEmpty() ? valueNode.findValues(DOC_COUNT) : valueNode.findValues(VALUE); - double sum = valueNodes.stream().mapToLong(o -> o.asLong()).sum(); - totalValue.add(sum); - if(plotMap.containsKey(headerPath.asText())) { - plotMap.put(headerPath.asText(),plotMap.get(headerPath.asText())+sum); - } - else { - plotMap.put(headerPath.asText(), sum); - } -// Plot plot = new Plot(headerPath.asText(), sum, symbol); -// headerPlotList.add(plot); - } - }); - }); - headerPlotList = plotMap.entrySet().stream().map(e -> new Plot(e.getKey(), e.getValue(), symbol)).collect(Collectors.toList()); - Data data = new Data(headerKey, totalValue.stream().reduce(0.0, Double::sum), symbol); - data.setPlots(headerPlotList); - dataList.add(data); - - return getAggregatedDto(chartNode, dataList, requestDto.getVisualizationCode()); - - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/ResponseHandlerFactory.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/ResponseHandlerFactory.java deleted file mode 100644 index 65cb3aec946..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/ResponseHandlerFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.tarento.analytics.handler; - -import com.tarento.analytics.enums.ChartType; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class ResponseHandlerFactory { - - @Autowired - private MetricChartResponseHandler metricChartResponseHandler; - @Autowired - private LineChartResponseHandler lineChartResponseHandler; - @Autowired - private PieChartResponseHandler pieChartResponseHandler; - @Autowired - private PerformanceChartResponeHandler performingBarChartResponeHandler; - @Autowired - private TableChartResponseHandler tableChartResponseHandler; - @Autowired - private AdvanceTableChartResponseHandler advanceTableChartResponseHandler; - - - public IResponseHandler getInstance(ChartType chartType) { - - if (chartType == chartType.METRIC) { - return metricChartResponseHandler; - - } else if (chartType == chartType.LINE) { - return lineChartResponseHandler; - - } else if (chartType == chartType.PIE) { - return pieChartResponseHandler; - - } else if (chartType == chartType.PERFORM) { - return performingBarChartResponeHandler; - - } else if (chartType == chartType.TABLE) { - return tableChartResponseHandler; - - } else if (chartType == chartType.XTABLE) { - return advanceTableChartResponseHandler; - } - - return null; - } - - @Autowired - private TablePostResponseHandler tablePostResponseHandler; - public IPostResponseHandler get(ChartType chartType){ - - if(chartType == chartType.TABLE){ - return tablePostResponseHandler; - } - return null; - } - -} - - diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/TableChartResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/TableChartResponseHandler.java deleted file mode 100644 index 22f97598922..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/TableChartResponseHandler.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.tarento.analytics.handler; - -import java.io.IOException; -import java.util.*; -import java.util.stream.Collectors; - -import com.tarento.analytics.helper.ComputedFieldHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; - -import static com.tarento.analytics.constant.Constants.STRING_DATATYPE; - -/** - * This handles ES response for single index, multiple index to compute performance - * Creates plots by performing ordered (ex: top n performance or last n performance) - * AGGS_PATH : configurable to this defines the path/key to be used to search the tree - * VALUE_TYPE : configurable to define the data type for the value formed, this could be amount, percentage, number - * PLOT_LABEL : configurable to define the label for the plot - * TYPE_MAPPING : defines for a plot data type - */ -@Component -public class TableChartResponseHandler implements IResponseHandler { - public static final Logger logger = LoggerFactory.getLogger(TableChartResponseHandler.class); - - @Autowired - ComputedFieldHelper computedFieldHelper; - - @Value("${egov.targetacheivement.chartname.list}") - public String targetacheivementChartListString; - - - @Override - public AggregateDto translate(AggregateRequestDto requestDto, ObjectNode aggregations) throws IOException { - - JsonNode aggregationNode = aggregations.get(AGGREGATIONS); - JsonNode chartNode = requestDto.getChartNode(); - String postAggrTheoryName = chartNode.get(POST_AGGREGATION_THEORY) == null ? "" : chartNode.get(POST_AGGREGATION_THEORY).asText(); - String plotLabel = chartNode.get(PLOT_LABEL).asText(); - ArrayNode pathDataTypeMap = (ArrayNode) chartNode.get(TYPE_MAPPING); - ArrayNode aggrsPaths = (ArrayNode) chartNode.get(IResponseHandler.AGGS_PATH); - Map> mappings = new HashMap<>(); - List aggrNodes = aggregationNode.findValues(BUCKETS); - - int[] idx = { 1 }; - - aggrNodes.stream().forEach(node -> { - ArrayNode buckets = (ArrayNode) node; - buckets.forEach(bucket -> { - Map plotMap = new LinkedHashMap<>(); - String key = bucket.findValue(IResponseHandler.KEY).asText(); - - aggrsPaths.forEach(headerPath -> { - JsonNode datatype = pathDataTypeMap.findValue(headerPath.asText()); - - if(datatype.asText().equalsIgnoreCase(STRING_DATATYPE)){ - addPlotFromBucketForString(headerPath.asText(),bucket,plotMap); - } - else { - JsonNode valueNode = bucket.findValue(headerPath.asText()); - //Double value = (null == valueNode || null == valueNode.get(VALUE)) ? 0.0 : valueNode.get(VALUE).asDouble(); - Double doc_value = 0.0; - if(valueNode!=null) - doc_value = (null == valueNode.findValue(DOC_COUNT)) ? 0.0 : valueNode.findValue(DOC_COUNT).asDouble(); - Double value = (null == valueNode || null == valueNode.findValue(VALUE)) ? doc_value : valueNode.findValue(VALUE).asDouble(); - Plot plot = new Plot(headerPath.asText(), value, datatype.asText()); - if (mappings.containsKey(key)) { - double newval = mappings.get(key).get(headerPath.asText()) == null ? value : (mappings.get(key).get(headerPath.asText()).getValue() + value); - plot.setValue(newval); - mappings.get(key).put(headerPath.asText(), plot); - } else { - plotMap.put(headerPath.asText(), plot); - } - } - - }); - - if (plotMap.size() > 0) { - Map plots = new LinkedHashMap<>(); - Plot sno = new Plot(SERIAL_NUMBER, TABLE_TEXT); - sno.setLabel("" + idx[0]++); - Plot plotkey = new Plot(plotLabel.isEmpty() ? TABLE_KEY : plotLabel, TABLE_TEXT); - plotkey.setLabel(key); - - plots.put(SERIAL_NUMBER, sno); - plots.put(plotLabel.isEmpty() ? TABLE_KEY : plotLabel, plotkey); - plots.putAll(plotMap); - mappings.put(key, plots); - - } - }); - - }); - - List dataList = new ArrayList<>(); - mappings.entrySet().stream().forEach(plotMap -> { - List plotList = plotMap.getValue().values().stream().collect(Collectors.toList()); - List filterPlot = plotList.stream().filter(c -> (!c.getName().equalsIgnoreCase(SERIAL_NUMBER) && !c.getName().equalsIgnoreCase(plotLabel) && c.getValue() != 0.0)).collect(Collectors.toList()); - - // FIX ME: For all aggragation oath with string the above condition will fail and no data will be retunred - - if(filterPlot.size()>=0){ - Data data = new Data(plotMap.getKey(), Integer.parseInt(String.valueOf(plotMap.getValue().get(SERIAL_NUMBER).getLabel())), null); - data.setPlots(plotList); - -// if(requestDto.getVisualizationCode().equals(PT_DDR_BOUNDARY) || requestDto.getVisualizationCode().equals(PT_BOUNDARY) || requestDto.getVisualizationCode().equals(PT_BOUNDARY_DRILL) -// || requestDto.getVisualizationCode().equals(TL_DDR_BOUNDARY) || requestDto.getVisualizationCode().equals(TL_BOUNDARY) || requestDto.getVisualizationCode().equals(TL_BOUNDARY_DRILL)) { - List targetacheivementChartList = Arrays.asList(this.targetacheivementChartListString.split(",")); - if(targetacheivementChartList.contains(requestDto.getVisualizationCode())) - { - computedFieldHelper.set(requestDto, postAggrTheoryName); - computedFieldHelper.add(data,TARGET_ACHIEVED, TOTAL_COLLECTION, TARGET_COLLECTION ); - } - dataList.add(data); - } - - }); - //dataList.sort((o1, o2) -> ((Integer) o1.getHeaderValue()).compareTo((Integer) o2.getHeaderValue())); - return getAggregatedDto(chartNode, dataList, requestDto.getVisualizationCode()); - } - - /** - * Creates plot object for aggragation paths with datatype as string - * @param headerPath - * @param bucket - * @param plotMap - */ - private void addPlotFromBucketForString(String headerPath, JsonNode bucket, Map plotMap){ - try{ - JsonNode valueNode = bucket.findPath(headerPath); - String key = valueNode.findValue(IResponseHandler.KEY).asText(); - Plot plot = new Plot(headerPath, key, STRING_DATATYPE); - plotMap.put(headerPath, plot); - } - catch (Exception e){ - logger.error("Error while creating plot object for aggragation paths"); - logger.info("headerPath: "+headerPath); - logger.info("bucket: "+bucket); - } - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/TablePostResponseHandler.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/TablePostResponseHandler.java deleted file mode 100644 index 65193be1c68..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/handler/TablePostResponseHandler.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.tarento.analytics.handler; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.constant.Constants; -import com.tarento.analytics.org.service.MdmsService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -@Component -public class TablePostResponseHandler implements IPostResponseHandler { - private static Logger logger = LoggerFactory.getLogger(TablePostResponseHandler.class); - - - @Autowired - MdmsService mdmsService; - - /*String json = "{\"aggregations\":{\"dss-collection_v1\":{\"ULBs \":{\"doc_count_error_upper_bound\":0,\"sum_other_doc_count\":0,\"buckets\":[{\"key\":\"pb.derabassi\",\"doc_count\":448,\"Transactions\":{\"value\":448},\"Assessed Properties\":{\"value\":1251},\"Total Collection\":{\"value\":620938.0}},{\"key\":\"pb.nayagaon\",\"doc_count\":97,\"Transactions\":{\"value\":97},\"Assessed Properties\":{\"value\":235},\"Total Collection\":{\"value\":69108.0}}]}},\"dss-target_v1\":{\"ULBs \":{\"doc_count_error_upper_bound\":0,\"sum_other_doc_count\":0,\"buckets\":[{\"key\":\"pb.derabassi\",\"doc_count\":1,\"Target Collection\":{\"value\":1.5E7}},{\"key\":\"pb.nayagaon\",\"doc_count\":1,\"Target Collection\":{\"value\":3500000.0}}]}}}}"; - String json1 = "{\"aggregations\":{\"DDRCode \":{\"doc_count_error_upper_bound\":0,\"sum_other_doc_count\":0,\"buckets\":[{\"key\":\"1\",\"doc_count\":277,\"Transactions\":{\"value\":277},\"Assessed Properties\":{\"value\":805},\"Total Collection\":{\"value\":618472.0}},{\"key\":\"9\",\"doc_count\":2719,\"Transactions\":{\"value\":2719},\"Assessed Properties\":{\"value\":8434},\"Total Collection\":{\"value\":5572731.0}}]}}}"; - */ - - /** - * Post response handle for replacing the district names from MDMS service map - * @param responseNode - */ - @Override - public void postResponse(ObjectNode responseNode){ - try { - - List nodes = responseNode.findValues(Constants.MDMSKeys.KEY); - Set values = new HashSet(); - nodes.forEach(node -> { - if(!values.contains(node.asText())) - replaceField(responseNode, Constants.MDMSKeys.KEY, node.asText(),mdmsService.getDDRNameByCode(node.asText())); - values.add(node.asText()); - - }); - logger.info("post response handling(DDR values) "+responseNode); - - }catch (Exception e){ - logger.error("post response handling(DDR values) "+e.getMessage()); - } - - } - - - public static void replaceField(ObjectNode parent, String fieldName, String oldValue, String newValue) { - if (parent.has(fieldName) && parent.get(fieldName).asText().equalsIgnoreCase(oldValue)) { - parent.put(fieldName, newValue); - } - parent.fields().forEachRemaining(entry -> { - JsonNode entryValue = entry.getValue(); - if (entryValue.isArray()) { - for (int i = 0; i < entryValue.size(); i++) { - if (entry.getValue().get(i).isObject()) - replaceField((ObjectNode) entry.getValue().get(i), fieldName, oldValue, newValue); - } - } else if (entryValue.isObject()) { - replaceField((ObjectNode) entry.getValue(), fieldName, oldValue, newValue); - } - }); - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/AdditiveComputedField.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/AdditiveComputedField.java deleted file mode 100644 index b8bbb5c9852..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/AdditiveComputedField.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.tarento.analytics.helper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -@Component -public class AdditiveComputedField implements IComputedField { - - public static final Logger logger = LoggerFactory.getLogger(AdditiveComputedField.class); - - - private String postAggrTheoryName; - private AggregateRequestDto aggregateRequestDto; - @Autowired - private ComputeHelperFactory computeHelperFactory; - - @Override - public void set(AggregateRequestDto requestDto, String postAggrTheoryName){ - this.aggregateRequestDto = requestDto; - this.postAggrTheoryName = postAggrTheoryName; - } - - @Override - public void add(Data data, List fields, String newField,JsonNode chartNode ) { - String dataType = "amount"; - try { - Map plotMap = data.getPlots().stream().collect(Collectors.toMap(Plot::getName, Function.identity())); - - double total = 0.0; - for (String field: fields){ - dataType = plotMap.get(field).getSymbol(); - total = total+ plotMap.get(field).getValue(); - } - if(postAggrTheoryName != null && !postAggrTheoryName.isEmpty()) { - ComputeHelper computeHelper = computeHelperFactory.getInstance(postAggrTheoryName); - - total = computeHelper.compute(aggregateRequestDto,total ); - } - - - data.getPlots().add(new Plot(newField, total, dataType)); - - } catch (Exception e) { - // throw new RuntimeException("Computed field configuration not correctly provided"); - logger.error("percentage could not be computed " +e.getMessage()); - data.getPlots().add(new Plot(newField, 0.0, dataType)); - } - - } -} - diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/AverageComputedField.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/AverageComputedField.java deleted file mode 100644 index 71b2de85efa..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/AverageComputedField.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.tarento.analytics.helper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.handler.IResponseHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; - -@Component -public class AverageComputedField implements IComputedField { - - public static final Logger logger = LoggerFactory.getLogger(AverageComputedField.class); - - - private String postAggrTheoryName; - private AggregateRequestDto aggregateRequestDto; - @Autowired - private ComputeHelperFactory computeHelperFactory; - - @Override - public void set(AggregateRequestDto requestDto, String postAggrTheoryName){ - this.aggregateRequestDto = requestDto; - this.postAggrTheoryName = postAggrTheoryName; - } - - @Override - public void add(ObjectNode data, List fields, String newField,JsonNode chartNode ) { - ObjectNode averageNode = JsonNodeFactory.instance.objectNode(); - - try { - - List values = data.findValues(fields.get(0)); - List vals = new ArrayList<>(); - for(JsonNode valueNode : values){ - vals.add(valueNode.get(IResponseHandler.VALUE).asLong()); - } - - Long sum = vals.stream().reduce(new Long(0), (a, b) -> a + b); - logger.info("sum value:: "+sum+" vals.size():: "+vals.size()); - Long average = sum >= vals.size()? sum/vals.size() : 0; - logger.info("average value:: "+average+" total value:: "+sum); - - averageNode.put(IResponseHandler.VALUE, average); - data.set(newField, averageNode); - - - } catch (Exception e) { - // throw new RuntimeException("Computed field configuration not correctly provided"); - logger.error("average could not be computed " +e.getMessage()); - averageNode.put(IResponseHandler.VALUE,0); - data.set(newField, averageNode); - } - - } -} - diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputeHelper.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputeHelper.java deleted file mode 100644 index 3c50469fe94..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputeHelper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.tarento.analytics.helper; - -import java.util.List; - -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; - -/** - * Compute Helper Inferface which receives the Request and the List of Data - * Implementations will derive as to what has to be the computation based on the Business Logic Specifications - * @author darshan - * - */ -public interface ComputeHelper { - - public List compute(AggregateRequestDto request, List data); - public Double compute(AggregateRequestDto request, double value); - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputeHelperFactory.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputeHelperFactory.java deleted file mode 100644 index f6f6a555fda..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputeHelperFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.tarento.analytics.helper; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.tarento.analytics.constant.Constants; - -/** - * Factory Class to supply the right implementation for the Post Aggregation Computation Business Logic - * which has to be supplied based on the Configuration written in the Chart API Configuration - * @author darshan - * - */ -@Component -public class ComputeHelperFactory { - - @Autowired - private TargetPerDateComputeHelper targetPerDateComputeHelper; - - public ComputeHelper getInstance(String intent) { - - if (intent.equals(Constants.PostAggregationTheories.RESPONSE_DIFF_DATES)) { - return targetPerDateComputeHelper; - } - return null; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputedFieldFactory.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputedFieldFactory.java deleted file mode 100644 index 3af853d7ca9..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputedFieldFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.tarento.analytics.helper; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class ComputedFieldFactory { - - @Autowired - private PercentageComputedField percentageComputedField; - @Autowired - private AverageComputedField averageComputedField; - @Autowired - private AdditiveComputedField additiveComputedField; - - public IComputedField getInstance(String className){ - - if(className.equalsIgnoreCase(percentageComputedField.getClass().getSimpleName())){ - return percentageComputedField; - - } else if(className.equalsIgnoreCase(averageComputedField.getClass().getSimpleName())) { - return averageComputedField; - - } else if(className.equalsIgnoreCase(additiveComputedField.getClass().getSimpleName())) { - return additiveComputedField; - - } else { - throw new RuntimeException("Computer field not found for className "+className); - } - - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputedFieldHelper.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputedFieldHelper.java deleted file mode 100644 index f7908b0cecb..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/ComputedFieldHelper.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.tarento.analytics.helper; - -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -@Component -public class ComputedFieldHelper { - - public static final Logger logger = LoggerFactory.getLogger(ComputedFieldHelper.class); - - @Autowired - private ComputeHelperFactory computeHelperFactory; - - private AggregateRequestDto aggregateRequestDto; - private String postAggrTheoryName; - - public void set(AggregateRequestDto requestDto, String postAggrTheoryName){ - - this.aggregateRequestDto = requestDto; - this.postAggrTheoryName = postAggrTheoryName; - } - - public void add(Data data, String newfield, String partField, String wholeField){ - try { - Map plotMap = data.getPlots().stream().collect(Collectors.toMap(Plot::getName, Function.identity())); - - if (plotMap.get(partField).getValue() == 0.0 || plotMap.get(wholeField).getValue() == 0.0) { - - data.getPlots().add(new Plot(newfield, 0.0, "percentage")); - } else { - double wholeValue = plotMap.get(wholeField).getValue(); - double fieldValue = plotMap.get(partField).getValue() / plotMap.get(wholeField).getValue() * 100; - - if(postAggrTheoryName != null && !postAggrTheoryName.isEmpty()) { - //logger.info("Chart name: "+aggregateRequestDto.getVisualizationCode()+" :: postAggrTheoryName : "+postAggrTheoryName); - ComputeHelper computeHelper = computeHelperFactory.getInstance(postAggrTheoryName); - fieldValue = computeHelper.compute(aggregateRequestDto, fieldValue); - wholeValue = computeHelper.compute(aggregateRequestDto, wholeValue); - - } - data.getPlots().stream().filter(plot -> wholeField.equalsIgnoreCase(plot.getName())).findAny().orElse(null).setValue(wholeValue); - data.getPlots().add(new Plot(newfield, fieldValue, "percentage")); - - } - - - } catch (Exception e) { - data.getPlots().add(new Plot(newfield, 0.0, "percentage")); - } - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/IComputedField.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/IComputedField.java deleted file mode 100644 index f564b2f51c9..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/IComputedField.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.tarento.analytics.helper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.tarento.analytics.dto.AggregateRequestDto; - -import java.util.List; - -public interface IComputedField { - - public void set(AggregateRequestDto requestDto, String postAggrTheoryName); - public void add(T data, List fields, String newField,JsonNode chartNode ); - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/PercentageComputedField.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/PercentageComputedField.java deleted file mode 100644 index 92b6daecf9a..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/PercentageComputedField.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.tarento.analytics.helper; - -import com.fasterxml.jackson.databind.JsonNode; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; -import com.tarento.analytics.dto.Plot; -import com.tarento.analytics.handler.IResponseHandler; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -@Component -public class PercentageComputedField implements IComputedField{ - - public static final Logger logger = LoggerFactory.getLogger(PercentageComputedField.class); - - - private String postAggrTheoryName; - private AggregateRequestDto aggregateRequestDto; - @Autowired - private ComputeHelperFactory computeHelperFactory; - - @Override - public void set(AggregateRequestDto requestDto, String postAggrTheoryName){ - this.aggregateRequestDto = requestDto; - this.postAggrTheoryName = postAggrTheoryName; - } - - @Override - public void add(Data data, List fields, String newField, JsonNode chartNode ) { - try { - Map plotMap = data.getPlots().stream().collect(Collectors.toMap(Plot::getName, Function.identity())); - - if (plotMap.get(fields.get(0)).getValue() == 0.0 || plotMap.get(fields.get(1)).getValue() == 0.0) { - - data.getPlots().add(new Plot(newField, 0.0, "percentage")); - } else { - double wholeValue = plotMap.get(fields.get(1)).getValue(); - double fieldValue = plotMap.get(fields.get(0)).getValue() / plotMap.get(fields.get(1)).getValue() * 100; - if(chartNode.get(IResponseHandler.IS_ROUND_OFF)!=null && chartNode.get(IResponseHandler.IS_ROUND_OFF).asBoolean()) { - fieldValue = (double) Math.round(fieldValue); - } - - if(postAggrTheoryName != null && !postAggrTheoryName.isEmpty()) { - ComputeHelper computeHelper = computeHelperFactory.getInstance(postAggrTheoryName); - fieldValue = computeHelper.compute(aggregateRequestDto, fieldValue); - wholeValue = computeHelper.compute(aggregateRequestDto, wholeValue); - } - data.getPlots().stream().filter(plot -> fields.get(1).equalsIgnoreCase(plot.getName())).findAny().orElse(null).setValue(wholeValue); - data.getPlots().add(new Plot(newField, fieldValue, "percentage")); - } - - } catch (Exception e) { - // throw new RuntimeException("Computed field configuration not correctly provided"); - logger.error("percentage could not be computed " +e.getMessage()); - data.getPlots().add(new Plot(newField, 0.0, "percentage")); - } - - } -} - diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/TargetPerDateComputeHelper.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/TargetPerDateComputeHelper.java deleted file mode 100644 index e69ed10ece2..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/helper/TargetPerDateComputeHelper.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.tarento.analytics.helper; - -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.Data; - -/** - * This implementation of Compute Helper is used to compute the difference of dates between the Request Date - * The difference is then multiplied against the Per Day Unit of Target which has been obtained from Elastic Search - * @author darshan - * - */ -@Component -public class TargetPerDateComputeHelper implements ComputeHelper { - private static final Long ROUND_OFF= 19801000l; - private static final Long NUMBER_OF_DAYS = 365l; - private static final Long LAST_HOUR = 23l; - private static final Long LAST_MINUTE = 59l; - public static final Logger logger = LoggerFactory.getLogger(TargetPerDateComputeHelper.class); - @Override - public List compute(AggregateRequestDto request, List data) { - if(request.getRequestDate()!= null && request.getRequestDate().getStartDate() != null && request.getRequestDate().getEndDate() !=null) { - try { - Long sDate = Long.parseLong(request.getRequestDate().getStartDate()); - logger.info("Start Date : " + String.valueOf(sDate)); - Long eDate = Long.parseLong(request.getRequestDate().getEndDate()); - logger.info("End Date : " + String.valueOf(eDate)); - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date(eDate)); - if(cal.get(Calendar.HOUR_OF_DAY) == LAST_HOUR && cal.get(Calendar.MINUTE) == LAST_MINUTE) { - eDate = eDate + ROUND_OFF; - } - logger.info("End Date after Round Off: " + String.valueOf(eDate)); - Long dateDifference = TimeUnit.DAYS.convert((eDate - sDate), TimeUnit.MILLISECONDS); - if(dateDifference == 0l) dateDifference = dateDifference + 1l ; - for(Data eachData : data) { - Double value = (Double) eachData.getHeaderValue(); - logger.info("Value is : " + value + " :: Date Difference is : " + dateDifference); - value = (value / NUMBER_OF_DAYS) * dateDifference; - eachData.setHeaderValue(value); - } - } catch (Exception ex) { - logger.error("Encountered an error while computing the logic in Target Date Computer : " + ex.getMessage()); - } - } - return data; - } - - @Override - public Double compute(AggregateRequestDto request, double value){ - - if(request.getRequestDate()!= null && request.getRequestDate().getStartDate() != null && request.getRequestDate().getEndDate() !=null) { - try { - Long sDate = Long.parseLong(request.getRequestDate().getStartDate()); - logger.info("Start Date : " + String.valueOf(sDate)); - Long eDate = Long.parseLong(request.getRequestDate().getEndDate()); - logger.info("End Date : " + String.valueOf(eDate)); - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date(eDate)); - if(cal.get(Calendar.HOUR_OF_DAY) == LAST_HOUR && cal.get(Calendar.MINUTE) == LAST_MINUTE) { - eDate = eDate + ROUND_OFF; - } - logger.info("End Date after Round Off: " + String.valueOf(eDate)); - Long dateDifference = TimeUnit.DAYS.convert((eDate - sDate), TimeUnit.MILLISECONDS); - if(dateDifference == 0l) dateDifference = dateDifference + 1l ; - - value = (value / NUMBER_OF_DAYS) * dateDifference; - logger.info("Value is : " + value + " :: Date Difference is : " + dateDifference); - - } catch (Exception ex) { - logger.error("Encountered an error while computing the logic in Target Date Computer : " + ex.getMessage()); - } - } - - return value; - - - - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/AmazonS3Config.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/AmazonS3Config.java deleted file mode 100644 index dbf72f9f174..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/AmazonS3Config.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.tarento.analytics.model; - -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.auth.AWSStaticCredentialsProvider; -import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.regions.Region; -import com.amazonaws.regions.Regions; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class AmazonS3Config -{ - @Value("${aws.access.key.id}") - private String awsKeyId; - - @Value("${aws.access.key.secret}") - private String awsKeySecret; - - @Value("${aws.region}") - private String awsRegion; - - @Value("${aws.s3.audio.bucket}") - private String awsS3AudioBucket; - - @Bean(name = "awsKeyId") - public String getAWSKeyId() { - return awsKeyId; - } - - @Bean(name = "awsKeySecret") - public String getAWSKeySecret() { - return awsKeySecret; - } - - @Bean(name = "awsRegion") - public Region getAWSPollyRegion() { - return Region.getRegion(Regions.fromName(awsRegion)); - } - - @Bean(name = "awsCredentialsProvider") - public AWSCredentialsProvider getAWSCredentials() { - BasicAWSCredentials awsCredentials = new BasicAWSCredentials(this.awsKeyId, this.awsKeySecret); - return new AWSStaticCredentialsProvider(awsCredentials); - } - - @Bean(name = "awsS3AudioBucket") - public String getAWSS3AudioBucket() { - return awsS3AudioBucket; - } -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/ComputedFields.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/ComputedFields.java deleted file mode 100644 index 51f60546c27..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/ComputedFields.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.tarento.analytics.model; - -import java.util.ArrayList; -import java.util.List; - -public class ComputedFields { - - private String postAggregationTheory; - private String actionName; - private List fields = new ArrayList<>(); - private String newField; - - public String getPostAggregationTheory() { - return postAggregationTheory; - } - - public void setPostAggregationTheory(String postAggregationTheory) { - this.postAggregationTheory = postAggregationTheory; - } - - public String getActionName() { - return actionName; - } - - public void setActionName(String actionName) { - this.actionName = actionName; - } - - public List getFields() { - return fields; - } - - public void setFields(List fields) { - this.fields = fields; - } - - public String getNewField() { - return newField; - } - - public void setNewField(String newField) { - this.newField = newField; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/ElasticSearchDictator.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/ElasticSearchDictator.java deleted file mode 100644 index ec51d3054bf..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/ElasticSearchDictator.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.tarento.analytics.model; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * - * @author Darshan - * - */ -public class ElasticSearchDictator { - - private String visualisationName; - private String indexName; - private String documentType; - private Map>> queryMap; - private Map>>> aggregationMap; - private Map queryAggregationMap; - - public Map getQueryAggregationMap() { - return queryAggregationMap; - } - - public void setQueryAggregationMap(Map queryAggregationMap) { - this.queryAggregationMap = queryAggregationMap; - } - - public String getVisualisationName() { - return visualisationName; - } - - public void setVisualisationName(String visualisationName) { - this.visualisationName = visualisationName; - } - - public String getIndexName() { - return indexName; - } - - public void setIndexName(String indexName) { - this.indexName = indexName; - } - - public String getDocumentType() { - return documentType; - } - - public void setDocumentType(String documentType) { - this.documentType = documentType; - } - - public Map>> getQueryMap() { - return queryMap; - } - - public void setQueryMap(Map>> queryMap) { - this.queryMap = queryMap; - } - - public Map>>> getAggregationMap() { - return aggregationMap; - } - - public void setAggregationMap(Map>>> aggregationMap) { - this.aggregationMap = aggregationMap; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/InsightsConfiguration.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/InsightsConfiguration.java deleted file mode 100644 index 5b636b24a7c..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/InsightsConfiguration.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.tarento.analytics.model; - - -public class InsightsConfiguration { - private String chartResponseMap; - private String action; - private String upwardIndicator; - private String downwardIndicator; - private String textMessage; - private String colorCode; - private String insightInterval; - private Boolean isRoundOff; - - public String getInsightInterval() { - return insightInterval; - } - public void setInsightInterval(String insightInterval) { - this.insightInterval = insightInterval; - } - public String getChartResponseMap() { - return chartResponseMap; - } - public void setChartResponseMap(String chartResponseMap) { - this.chartResponseMap = chartResponseMap; - } - public String getAction() { - return action; - } - public void setAction(String action) { - this.action = action; - } - public String getUpwardIndicator() { - return upwardIndicator; - } - public void setUpwardIndicator(String upwardIndicator) { - this.upwardIndicator = upwardIndicator; - } - public String getDownwardIndicator() { - return downwardIndicator; - } - public void setDownwardIndicator(String downwardIndicator) { - this.downwardIndicator = downwardIndicator; - } - public String getTextMessage() { - return textMessage; - } - public void setTextMessage(String textMessage) { - this.textMessage = textMessage; - } - public String getColorCode() { - return colorCode; - } - public void setColorCode(String colorCode) { - this.colorCode = colorCode; - } - public Boolean getIsRoundOff() { - return isRoundOff; - } - public void setIsRoundOff(Boolean isRoundOff) { - this.isRoundOff = isRoundOff; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Item.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Item.java deleted file mode 100644 index b1e63e89eae..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Item.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.tarento.analytics.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Item { - - @JsonProperty("name") - private String name; - @JsonProperty("code") - private String code; - @JsonProperty("id") - private Long id; - @JsonProperty("description") - private String description; - @JsonProperty("price") - private Double price; - @JsonProperty("categoryId") - private Long categoryId; - @JsonProperty("subCategoryId") - private Long subCategoryId; - @JsonProperty("name") - - - public String getName() { - return name; - } - - public Long getCategoryId() { - return categoryId; - } - - public void setCategoryId(Long categoryId) { - this.categoryId = categoryId; - } - - public Long getSubCategoryId() { - return subCategoryId; - } - - public void setSubCategoryId(Long subCategoryId) { - this.subCategoryId = subCategoryId; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("code") - public String getCode() { - return code; - } - - @JsonProperty("code") - public void setCode(String code) { - this.code = code; - } - - @JsonProperty("id") - public Long getId() { - return id; - } - - @JsonProperty("id") - public void setId(Long id) { - this.id = id; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("price") - public Double getPrice() { - return price; - } - - @JsonProperty("price") - public void setPrice(Double price) { - this.price = price; - } - - -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/KeyData.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/KeyData.java deleted file mode 100644 index 6a49dd3bd54..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/KeyData.java +++ /dev/null @@ -1,53 +0,0 @@ - -package com.tarento.analytics.model; - -public class KeyData { - - - private Long id; - private Object key; - private String label; - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public Object getKey() { - return key; - } - public void setKey(Object key) { - this.key = key; - } - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((key == null) ? 0 : key.hashCode()); - return result; - } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - KeyData other = (KeyData) obj; - if (key == null) { - if (other.key != null) - return false; - } else if (!key.equals(other.key)) - return false; - return true; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Label.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Label.java deleted file mode 100644 index d0ef0c8e9c1..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Label.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.tarento.analytics.model; - -public class Label { - - private String xLabel; - private String yLabel; - public String getxLabel() { - return xLabel; - } - public void setxLabel(String xLabel) { - this.xLabel = xLabel; - } - public String getyLabel() { - return yLabel; - } - public void setyLabel(String yLabel) { - this.yLabel = yLabel; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/LineData.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/LineData.java deleted file mode 100644 index 532eeb814da..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/LineData.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.tarento.analytics.model; - -public class LineData { - - private String type; - private Object value; - public String getType() { - return type; - } - public void setType(String type) { - this.type = type; - } - public Object getValue() { - return value; - } - public void setValue(Object value) { - this.value = value; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Query.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Query.java deleted file mode 100644 index bf34cdbc082..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Query.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.tarento.analytics.model; - -import java.util.Map; - -public class Query { - - private String dateFilterField; - private Map aggregation; - - public String getDateFilterField() { - return dateFilterField; - } - - public void setDateFilterField(String dateFilterField) { - this.dateFilterField = dateFilterField; - } - - public Map getAggregation() { - return aggregation; - } - - public void setAggregation(Map aggregation) { - this.aggregation = aggregation; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/ServiceQuery.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/ServiceQuery.java deleted file mode 100644 index f6fdd64ed61..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/ServiceQuery.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.tarento.analytics.model; - -public class ServiceQuery { - - private String indexName; - private String queryJson; - private String documentType; - public String getIndexName() { - return indexName; - } - public void setIndexName(String indexName) { - this.indexName = indexName; - } - public String getQueryJson() { - return queryJson; - } - public void setQueryJson(String queryJson) { - this.queryJson = queryJson; - } - public String getDocumentType() { - return documentType; - } - public void setDocumentType(String documentType) { - this.documentType = documentType; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Transaction.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Transaction.java deleted file mode 100644 index 5e5b063df99..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/Transaction.java +++ /dev/null @@ -1,264 +0,0 @@ -package com.tarento.analytics.model; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Transaction Object which gets posted to Elastic Search - * @author Darshan Nagesh - * - */ -public class Transaction { - - @JsonProperty("transactionId") - private Long transactionId; - @JsonProperty("receiptNo") - private String receiptNo; - @JsonProperty("transType") - private String transType; - @JsonProperty("storeCode") - private Long storeCode; - @JsonProperty("posTerminalNo") - private String posTerminalNo; - @JsonProperty("staffId") - private Long staffId; - @JsonProperty("transDate") - private String transDate; - @JsonProperty("transTime") - private String transTime; - @JsonProperty("customerNo") - private Long consumerNo; - @JsonProperty("salesType") - private String salesType; - @JsonProperty("netAmt") - private Double netAmt; - @JsonProperty("grossAmt") - private Double grossAmt; - @JsonProperty("payment") - private Double payment; - @JsonProperty("discountAmt") - private Double discountAmt; - @JsonProperty("costAmt") - private Double costAmt; - @JsonProperty("managerId") - private Long managerId; - @JsonProperty("isTraining") - private Boolean isTraining; - @JsonProperty("statementNo") - private String statementNo; - @JsonProperty("postingStatus") - private String postingStatus; - @JsonProperty("postStatementNo") - private String postStatementNo; - @JsonProperty("customerAgeGroup") - private String customerAgeGroup; - @JsonProperty("customerGender") - private String customerGender; - @JsonProperty("items") - private List items; - @JsonProperty("itemDetails") - private List itemDetails; - @JsonProperty("orgId") - private Long orgId; - - public Long getOrgId() { - return orgId; - } - - public void setOrgId(Long orgId) { - this.orgId = orgId; - } - - public List getItemDetails() { - return itemDetails; - } - - public void setItemDetails(List itemDetails) { - this.itemDetails = itemDetails; - } - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - public String getCustomerAgeGroup() { - return customerAgeGroup; - } - - public void setCustomerAgeGroup(String customerAgeGroup) { - this.customerAgeGroup = customerAgeGroup; - } - - public String getCustomerGender() { - return customerGender; - } - - public void setCustomerGender(String customerGender) { - this.customerGender = customerGender; - } - - public Long getTransactionId() { - return transactionId; - } - - public void setTransactionId(Long transactionId) { - this.transactionId = transactionId; - } - - public String getReceiptNo() { - return receiptNo; - } - - public void setReceiptNo(String receiptNo) { - this.receiptNo = receiptNo; - } - - public String getTransType() { - return transType; - } - - public void setTransType(String transType) { - this.transType = transType; - } - - public Long getStoreCode() { - return storeCode; - } - - public void setStoreCode(Long storeCode) { - this.storeCode = storeCode; - } - - public String getPosTerminalNo() { - return posTerminalNo; - } - - public void setPosTerminalNo(String posTerminalNo) { - this.posTerminalNo = posTerminalNo; - } - - public Long getStaffId() { - return staffId; - } - - public void setStaffId(Long staffId) { - this.staffId = staffId; - } - - public String getTransDate() { - return transDate; - } - - public void setTransDate(String transDate) { - this.transDate = transDate; - } - - public String getTransTime() { - return transTime; - } - - public void setTransTime(String transTime) { - this.transTime = transTime; - } - - public Long getConsumerNo() { - return consumerNo; - } - - public void setConsumerNo(Long consumerNo) { - this.consumerNo = consumerNo; - } - - public String getSalesType() { - return salesType; - } - - public void setSalesType(String salesType) { - this.salesType = salesType; - } - - public Double getNetAmt() { - return netAmt; - } - - public void setNetAmt(Double netAmt) { - this.netAmt = netAmt; - } - - public Double getGrossAmt() { - return grossAmt; - } - - public void setGrossAmt(Double grossAmt) { - this.grossAmt = grossAmt; - } - - public Double getPayment() { - return payment; - } - - public void setPayment(Double payment) { - this.payment = payment; - } - - public Double getDiscountAmt() { - return discountAmt; - } - - public void setDiscountAmt(Double discountAmt) { - this.discountAmt = discountAmt; - } - - public Double getCostAmt() { - return costAmt; - } - - public void setCostAmt(Double costAmt) { - this.costAmt = costAmt; - } - - public Long getManagerId() { - return managerId; - } - - public void setManagerId(Long managerId) { - this.managerId = managerId; - } - - public Boolean getIsTraining() { - return isTraining; - } - - public void setIsTraining(Boolean isTraining) { - this.isTraining = isTraining; - } - - public String getStatementNo() { - return statementNo; - } - - public void setStatementNo(String statementNo) { - this.statementNo = statementNo; - } - - public String getPostingStatus() { - return postingStatus; - } - - public void setPostingStatus(String postingStatus) { - this.postingStatus = postingStatus; - } - - public String getPostStatementNo() { - return postStatementNo; - } - - public void setPostStatementNo(String postStatementNo) { - this.postStatementNo = postStatementNo; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Chart.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Chart.java deleted file mode 100644 index 9a83dbf1ee0..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Chart.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.tarento.analytics.model.dashboardConfig; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Chart { - -@JsonProperty("id") -private Long id; -@JsonProperty("name") -private String name; -@JsonProperty("code") -private String code; -@JsonProperty("serviceApi") -private String serviceApi; -@JsonProperty("chartType") -private String chartType; -@JsonProperty("headersAvailable") -private Boolean headersAvailable; -@JsonProperty("filter") -private String filter; -@JsonProperty("headers") -private List
headers = null; - - -public String getFilter() { - return filter; -} - -public void setFilter(String filter) { - this.filter = filter; -} - -@JsonProperty("id") -public Long getId() { -return id; -} - -@JsonProperty("id") -public void setId(Long id) { -this.id = id; -} - -@JsonProperty("name") -public String getName() { -return name; -} - -@JsonProperty("name") -public void setName(String name) { -this.name = name; -} - -@JsonProperty("code") -public String getCode() { -return code; -} - -@JsonProperty("code") -public void setCode(String code) { -this.code = code; -} - -@JsonProperty("serviceApi") -public String getServiceApi() { -return serviceApi; -} - -@JsonProperty("serviceApi") -public void setServiceApi(String serviceApi) { -this.serviceApi = serviceApi; -} - -@JsonProperty("chartType") -public String getChartType() { -return chartType; -} - -@JsonProperty("chartType") -public void setChartType(String chartType) { -this.chartType = chartType; -} - -@JsonProperty("headersAvailable") -public Boolean getHeadersAvailable() { -return headersAvailable; -} - -@JsonProperty("headersAvailable") -public void setHeadersAvailable(Boolean headersAvailable) { -this.headersAvailable = headersAvailable; -} - -@JsonProperty("headers") -public List
getHeaders() { -return headers; -} - -@JsonProperty("headers") -public void setHeaders(List
headers) { -this.headers = headers; -} - - -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Dashboard.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Dashboard.java deleted file mode 100644 index f06271f7671..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Dashboard.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.tarento.analytics.model.dashboardConfig; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.tarento.analytics.dto.DashboardDto; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Dashboard { - -@JsonProperty("id") -private Long id; -@JsonProperty("name") -private String name; -@JsonProperty("code") -private String code; -@JsonProperty("isActive") -private Boolean isActive; -@JsonProperty("description") -private String description; -@JsonProperty("placement") -private String placement; -@JsonProperty("visualizations") -private List visualizations = null; - -public Dashboard() {} -public Dashboard(DashboardDto dto) { - this.id = dto.getId(); - this.name = dto.getName(); - this.code = dto.getCode(); - this.description = dto.getDescription(); - this.placement = dto.getPlacement(); -} - -public String getPlacement() { - return placement; -} -public void setPlacement(String placement) { - this.placement = placement; -} -public Long getId() { - return id; -} - -public void setId(Long id) { - this.id = id; -} - -@JsonProperty("name") -public String getName() { -return name; -} - -@JsonProperty("name") -public void setName(String name) { -this.name = name; -} - -@JsonProperty("code") -public String getCode() { -return code; -} - -@JsonProperty("code") -public void setCode(String code) { -this.code = code; -} - -@JsonProperty("isActive") -public Boolean getIsActive() { -return isActive; -} - -@JsonProperty("isActive") -public void setIsActive(Boolean isActive) { -this.isActive = isActive; -} - -@JsonProperty("description") -public String getDescription() { -return description; -} - -@JsonProperty("description") -public void setDescription(String description) { -this.description = description; -} - -@JsonProperty("visualizations") -public List getVisualizations() { -return visualizations; -} - -@JsonProperty("visualizations") -public void setVisualizations(List visualizations) { -this.visualizations = visualizations; -} - -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Header.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Header.java deleted file mode 100644 index 60572bbf9ba..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Header.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.tarento.analytics.model.dashboardConfig; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Header { - -@JsonProperty("id") -private Long id; -@JsonProperty("label") -private String label; -@JsonProperty("data") -private String data; -@JsonProperty("field") -private String field; - - -public Long getId() { - return id; -} - -public void setId(Long id) { - this.id = id; -} - -public String getField() { - return field; -} - -public void setField(String field) { - this.field = field; -} - -@JsonProperty("label") -public String getLabel() { -return label; -} - -@JsonProperty("label") -public void setLabel(String label) { -this.label = label; -} - -@JsonProperty("data") -public String getData() { -return data; -} - -@JsonProperty("data") -public void setData(String data) { -this.data = data; -} - -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Visualization.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Visualization.java deleted file mode 100644 index f88286ff8d5..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/model/dashboardConfig/Visualization.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.tarento.analytics.model.dashboardConfig; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Visualization { - -@JsonProperty("id") -private Long id; -@JsonProperty("name") -private String name; -@JsonProperty("description") -private String description; -@JsonProperty("chartType") -private String chartType; -@JsonProperty("charts") -private List charts = null; -private List storeId; -@JsonProperty("salesAreaCode") -private String salesAreaCode; -@JsonProperty("countryCode") -private String countryCode; - - -public List getStoreId() { - return storeId; -} - - -@JsonProperty("visualRank") -private Long visualRank; - - -public void setStoreId(List storeId) { - this.storeId = storeId; -} - -public String getSalesAreaCode() { - return salesAreaCode; -} - -public void setSalesAreaCode(String salesAreaCode) { - this.salesAreaCode = salesAreaCode; -} - -public String getCountryCode() { - return countryCode; -} - -public void setCountryCode(String countryCode) { - this.countryCode = countryCode; -} - -public Long getVisualRank() { - return visualRank; -} - -public void setVisualRank(Long visualRank) { - this.visualRank = visualRank; -} - -public String getChartType() { - return chartType; -} - -public void setChartType(String chartType) { - this.chartType = chartType; -} - -@JsonProperty("id") -public Long getId() { -return id; -} - -@JsonProperty("id") -public void setId(Long id) { -this.id = id; -} - -@JsonProperty("name") -public String getName() { -return name; -} - -@JsonProperty("name") -public void setName(String name) { -this.name = name; -} - -@JsonProperty("description") -public String getDescription() { -return description; -} - -@JsonProperty("description") -public void setDescription(String description) { -this.description = description; -} - -@JsonProperty("charts") -public List getCharts() { -return charts; -} - -@JsonProperty("charts") -public void setCharts(List charts) { -this.charts = charts; -} - - -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/ClientService.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/ClientService.java deleted file mode 100644 index bebe42fc946..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/ClientService.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.tarento.analytics.org.service; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.constant.Constants; -import com.tarento.analytics.dto.*; -import com.tarento.analytics.exception.AINException; - -public interface ClientService { - - public AggregateDto getAggregatedData(AggregateRequestDto req, List roles) throws AINException, IOException; - public List getHeaderData(CummulativeDataRequestDto requestDto, List roles) throws AINException; - - /** - * Default handle request to translates tenant code to a value - */ - default boolean preHandle(AggregateRequestDto request, ObjectNode chartNode, MdmsApiMappings mdmsApiMappings){ - boolean status = Boolean.FALSE; - JsonNode translateNode = chartNode.get(Constants.JsonPaths.TRANSLATE_CODE); - boolean isTranslate = translateNode == null || translateNode.asBoolean()==Boolean.FALSE ? Boolean.FALSE : translateNode.asBoolean(); - boolean valueExist = request.getFilters().containsKey(Constants.MDMSKeys.TENANT_ID); - if(valueExist && isTranslate){ - Object filter = request.getFilters().get(Constants.MDMSKeys.TENANT_ID); - List values = new ArrayList<>(); - if(filter instanceof ArrayList){ - for(Object code : ((ArrayList)request.getFilters().get(Constants.MDMSKeys.TENANT_ID))){ - String val = mdmsApiMappings.valueOf(code.toString()); - if(val!=null) values.add(val); - } - request.getFilters().put(Constants.MDMSKeys.TENANT_ID, values); - status = Boolean.TRUE; - - } else if(filter instanceof String){ - String code = request.getFilters().get(Constants.MDMSKeys.TENANT_ID).toString(); - String value = mdmsApiMappings.valueOf(code); - request.getFilters().put(Constants.MDMSKeys.TENANT_ID, value); - status = Boolean.TRUE; - } - - } - return isTranslate; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/ClientServiceFactory.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/ClientServiceFactory.java deleted file mode 100644 index 0ec5fcdb68e..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/ClientServiceFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.tarento.analytics.org.service; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.ConfigurationLoader; -import com.tarento.analytics.constant.Constants; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class ClientServiceFactory { - - @Autowired - TarentoServiceImpl tarentoServiceImpl; - - @Autowired - MdmsServiceImpl mdmsServiceImpl; - - @Autowired - ConfigurationLoader configurationLoader; - - public ClientService getInstance(Constants.ClienServiceType clientServiceName){ - - if(clientServiceName.equals(Constants.ClienServiceType.DEFAULT_CLIENT)) - return tarentoServiceImpl; - else if(clientServiceName.equals(Constants.ClienServiceType.MDMS_CLIENT)) - return mdmsServiceImpl; - - else - throw new RuntimeException(clientServiceName + "not found"); - - } - - public ClientService get(String chartId){ - - ObjectNode node = configurationLoader.get(Constants.ConfigurationFiles.CHART_API_CONFIG); - ObjectNode chartNode = (ObjectNode) node.get(chartId); - boolean mdmsEnable = chartNode.get(Constants.JsonPaths.IS_MDMS_ENABALED) == null ? false : chartNode.get(Constants.JsonPaths.IS_MDMS_ENABALED).asBoolean(); - - if(mdmsEnable) - return mdmsServiceImpl; - else - return tarentoServiceImpl; - - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/MdmsApiMappings.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/MdmsApiMappings.java deleted file mode 100644 index dcf8a7eeab2..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/MdmsApiMappings.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.tarento.analytics.org.service; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.ConfigurationLoader; -import com.tarento.analytics.constant.Constants; -import com.tarento.analytics.service.impl.RestService; -import org.egov.tracer.model.CustomException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.tarento.analytics.constant.Constants.MDMSKeys.TENANTID_MDC_STRING; -import static com.tarento.analytics.constant.Constants.MDMS_REQUESTINFO; -import static com.tarento.analytics.constant.Constants.TENANTID_PLACEHOLDER; - -@Component -public class MdmsApiMappings { - - private boolean isTranslate = Boolean.FALSE; - private final String TESTING_ID = "pb.testing"; - private final String NAME = "name"; - private final String MDMS_CITY_NAME_CONFIG_FILE_NAME = "TenantCodeNameMappings.json"; - - private static Logger logger = LoggerFactory.getLogger(MdmsApiMappings.class); - - private Map ddrTenantMapping = new HashMap<>(); - private Map> ddrTenantMapping1 = new HashMap<>(); - private Map codeValues = new HashMap<>(); - private Map> ddrValueMap = new HashMap<>(); - - @Autowired - private ConfigurationLoader configurationLoader; - - @Value("${egov.mdms.host}") - private String mdmsServiceHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsSearchEndpoint; - - - @Autowired - private RestService restService; - - @Autowired - private ObjectMapper mapper; - - @Value("${egov.statelevel.tenantId}") - private String stateLevelTenantId ; - - public String valueOf(String code){ - return codeValues.getOrDefault(code, null); - } - - public void setTranslate(boolean isTranslate){ - this.isTranslate = isTranslate; - } - - /** - * This method loads the MDMS city name mappings. - * - * @return - */ - - private Map getMappings() { - ObjectNode objectNode = configurationLoader.get(MDMS_CITY_NAME_CONFIG_FILE_NAME); - ArrayNode objectArrayNode = (ArrayNode) objectNode.get("ulbCityNamesMappings"); - Map ulbCityNamesMappings = new HashMap(); - for (JsonNode node : objectArrayNode) { - ulbCityNamesMappings.put(node.get("tenantCode").asText(), node.get("tenantValue").asText()); - } - return ulbCityNamesMappings; - } - - - @PostConstruct - public void loadMdmsService() throws Exception { - - String REQUEST_INFO_STR = MDMS_REQUESTINFO.replace(TENANTID_PLACEHOLDER,stateLevelTenantId); - // Adding in MDC so that tracer can add it in header - MDC.put(TENANTID_MDC_STRING, stateLevelTenantId); - - JsonNode requestInfo = mapper.readTree(REQUEST_INFO_STR); - try { - JsonNode response = restService.post(mdmsServiceHost + mdmsSearchEndpoint, "", requestInfo); - ArrayNode tenants = (ArrayNode) response.findValues(Constants.MDMSKeys.TENANTS).get(0); - Map ulbCityNamesMappings = getMappings(); - logger.info("ulbCityNamesMappings :: "+ulbCityNamesMappings); - - - for(JsonNode tenant : tenants) { - JsonNode tenantId = tenant.findValue(Constants.MDMSKeys.CODE); - JsonNode ddrCode = tenant.findValue(Constants.MDMSKeys.DISTRICT_CODE); - JsonNode ddrName = tenant.findValue(Constants.MDMSKeys.DDR_NAME); - - //JsonNode name = tenant.findValue(NAME); - //if(!codeValues.containsKey(tenantId.asText())) codeValues.put(tenantId.asText(), name.asText()); - String cityName = ulbCityNamesMappings.get(tenantId.asText()); - if(cityName!=null){ - if(!codeValues.containsKey(tenantId.asText())) codeValues.put(tenantId.asText(), cityName); - } - - - - if(!tenantId.asText().equalsIgnoreCase(TESTING_ID)) { - if(!ddrTenantMapping1.containsKey(ddrName.asText())){ - List tenantList = new ArrayList<>(); - tenantList.add(tenantId.asText()); - ddrTenantMapping1.put(ddrName.asText(),tenantList); - List values = new ArrayList<>(); - //values.add(name.asText()); - if(cityName!=null) values.add(cityName); - ddrValueMap.put(ddrName.asText(), values); - - } else { - ddrTenantMapping1.get(ddrName.asText()).add(tenantId.asText()); - //ddrValueMap.get(ddrName.asText()).add(name.asText()); - if(cityName!=null) ddrValueMap.get(ddrName.asText()).add(cityName); - - } - - if (!ddrTenantMapping.containsKey(ddrCode.asText())){ - ddrTenantMapping.put(ddrCode.asText(), ddrName.asText()); - } - } - - } - } catch (Exception e){ - throw new CustomException("MDMS_ERROR","Failed to fetch DDR's from mdms"); - } - ddrValueMap.entrySet().removeIf(map -> map.getValue().size()==0); - logger.info("ddrValueMap = "+ddrValueMap); - logger.info("codeValues = "+codeValues); - logger.info("ddrTenantMapping1 = "+ddrTenantMapping1); - - } - - public String getDDRNameByCode(String ddrCode){ - return ddrTenantMapping.getOrDefault(ddrCode, ""); - } - - public List getTenantIds(String ddrCode){ - return ddrTenantMapping1.getOrDefault(ddrCode, new ArrayList<>()); - } - - public String getDDRName(String tenantId){ - - for(Map.Entry entry : isTranslate ? ddrValueMap.entrySet() :ddrTenantMapping1.entrySet()){ - List values = (List) entry.getValue(); - if(values.contains(tenantId)) return entry.getKey().toString(); - - } - return null; - - } - - public Map> getGroupedTenants(List tenants){ - - Map> groupTenantIds = new HashMap<>(); - - if(tenants!=null){ - for(String tenant : tenants) { - - String ddrName = getDDRName(tenant); - if(ddrName!=null){ - if (groupTenantIds.containsKey(ddrName)){ - groupTenantIds.get(ddrName).add(tenant); - - } else { - List tenantList = new ArrayList<>(); - tenantList.add(tenant); - groupTenantIds.put(ddrName,tenantList); - } - } - - - } - } - - return groupTenantIds; - } - - - public Map> getAll(){ - return isTranslate ? ddrValueMap : ddrTenantMapping1; - } - - - -} - diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/MdmsService.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/MdmsService.java deleted file mode 100644 index 64bdfb0b51c..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/MdmsService.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.tarento.analytics.org.service; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.tarento.analytics.constant.Constants; -import com.tarento.analytics.service.impl.RestService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.HashMap; -import java.util.Map; - -import static com.tarento.analytics.constant.Constants.MDMS_REQUESTINFO; -import static com.tarento.analytics.constant.Constants.TENANTID_PLACEHOLDER; -import static com.tarento.analytics.constant.Constants.MDMSKeys.TENANTID_MDC_STRING; -import org.slf4j.MDC; - -@Component -public class MdmsService { - - private static Logger logger = LoggerFactory.getLogger(MdmsService.class); - - private Map ddrTenantMapping = new HashMap<>(); - - @Value("${egov.mdms.host}") - private String mdmsServiceHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsSearchEndpoint; - - @Autowired - private RestService restService; - - @Autowired - private ObjectMapper mapper; - - @Value("${egov.statelevel.tenantId}") - private String stateLevelTenantId ; - - @PostConstruct - public void loadMdmsService() throws Exception{ - - String REQUEST_INFO_STR = MDMS_REQUESTINFO.replace(TENANTID_PLACEHOLDER,stateLevelTenantId); - // Adding in MDC so that tracer can add it in header - MDC.put(TENANTID_MDC_STRING, stateLevelTenantId); - - JsonNode requestInfo = mapper.readTree(REQUEST_INFO_STR); - try { - JsonNode response = restService.post(mdmsServiceHost + mdmsSearchEndpoint, "", requestInfo); - ArrayNode tenants = (ArrayNode) response.findValues(Constants.MDMSKeys.TENANTS).get(0); - - - for(JsonNode tenant : tenants) { - JsonNode ddrCode = tenant.findValue(Constants.MDMSKeys.DISTRICT_CODE); - JsonNode ddrName = tenant.findValue(Constants.MDMSKeys.DDR_NAME); - - if (!ddrTenantMapping.containsKey(ddrCode.asText())){ - ddrTenantMapping.put(ddrCode.asText(), ddrName.asText()); - } - } - } catch (Exception e){ - getDefaultMapping(); - logger.error("Loading Mdms service error: "+e.getMessage()+" :: loaded default DDRs"); - } - logger.info("ddrTenantMapping = "+ddrTenantMapping); - } - - public String getDDRNameByCode(String ddrCode){ - return ddrTenantMapping.getOrDefault(ddrCode, ""); - } - - private void getDefaultMapping(){ - - ddrTenantMapping.put("1", "Amritsar-DDR"); - ddrTenantMapping.put("2", "Patiala-DDR"); - ddrTenantMapping.put("3", "Bathinda-DDR"); - ddrTenantMapping.put("4", "Ferozepur-DDR"); - ddrTenantMapping.put("5", "Ludhiana-DDR"); - ddrTenantMapping.put("6", "Ferozepur-DDR"); - ddrTenantMapping.put("7", "Ferozepur-DDR"); - ddrTenantMapping.put("8", "Amritsar-DDR"); - ddrTenantMapping.put("9", "Jalandhar-DDR"); - ddrTenantMapping.put("10", "Jalandhar-DDR"); - - ddrTenantMapping.put("11", "Jalandhar-DDR"); - ddrTenantMapping.put("12", "Ludhiana-DDR"); - ddrTenantMapping.put("13", "Bathinda-DDR"); - ddrTenantMapping.put("14", "Ferozepur-DDR"); - ddrTenantMapping.put("15", "Patiala-DDR"); - ddrTenantMapping.put("16", "Bathinda-DDR"); - ddrTenantMapping.put("17", "Jalandhar-DDR"); - ddrTenantMapping.put("18", "Pathankot-MC"); - ddrTenantMapping.put("19", "Patiala-DDR"); - ddrTenantMapping.put("20", "Ludhiana-DDR"); - ddrTenantMapping.put("21", "Patiala-DDR"); - ddrTenantMapping.put("22", "Bathinda-DDR"); - ddrTenantMapping.put("140001", "Ludhiana-DDR"); - - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/MdmsServiceImpl.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/MdmsServiceImpl.java deleted file mode 100644 index f58a22a5058..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/MdmsServiceImpl.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.tarento.analytics.org.service; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.ConfigurationLoader; -import com.tarento.analytics.constant.Constants; -import com.tarento.analytics.dto.*; -import com.tarento.analytics.enums.ChartType; -import com.tarento.analytics.exception.AINException; -import com.tarento.analytics.handler.IResponseHandler; -import com.tarento.analytics.handler.ResponseHandlerFactory; -import com.tarento.analytics.service.QueryService; -import com.tarento.analytics.service.impl.RestService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -@Component -public class MdmsServiceImpl implements ClientService { - - public static final Logger logger = LoggerFactory.getLogger(MdmsServiceImpl.class); - - @Autowired - private QueryService queryService; - - @Autowired - private RestService restService; - - @Autowired - private ConfigurationLoader configurationLoader; - - @Autowired - private ResponseHandlerFactory responseHandlerFactory; - - @Autowired - private MdmsApiMappings mdmsApiMappings; - - Map> groupTenantIds; - - @Override - @Cacheable(value="versions", key="#request.hashKey") - public AggregateDto getAggregatedData(AggregateRequestDto request, List roles) throws AINException, IOException { - // Read visualization Code - String chartId = request.getVisualizationCode(); - logger.info("chartId >> "+chartId); - - // Load Chart API configuration to Object Node for easy retrieval later - ObjectNode node = configurationLoader.get(Constants.ConfigurationFiles.CHART_API_CONFIG); - logger.info("conf node >> "+node); - - ObjectNode chartNode = (ObjectNode) node.get(chartId); - logger.info("chartNode >> "+chartNode); - boolean isHandle = preHandle(request, chartNode, mdmsApiMappings); - mdmsApiMappings.setTranslate(isHandle); - - ChartType chartType = ChartType.fromValue(chartNode.get(Constants.JsonPaths.CHART_TYPE).asText()); - groupTenantIds = mdmsApiMappings.getGroupedTenants((List) request.getFilters().get("tenantId")); - - - ObjectNode reponseNode = buildResponse(chartNode, request); - - //replacing default values by - request.setChartNode(chartNode); - IResponseHandler responseHandler = responseHandlerFactory.getInstance(chartType); - AggregateDto aggregateDto = new AggregateDto(); - if (reponseNode.fields().hasNext()) { - - aggregateDto = responseHandler.translate(request, reponseNode); - } - return aggregateDto; - } - - public ObjectNode buildResponse(ObjectNode chartNode, AggregateRequestDto request) { - - String plotName = chartNode.get("plotLabel") == null ? "DDR" : chartNode.get("plotLabel").asText(); - ChartType chartType = ChartType.fromValue(chartNode.get(Constants.JsonPaths.CHART_TYPE).asText()); - boolean isDefaultPresent = chartType.equals(ChartType.LINE) && chartNode.get(Constants.JsonPaths.INTERVAL) != null; - boolean isRequestContainsInterval = null == request.getRequestDate() ? false : (request.getRequestDate().getInterval() != null && !request.getRequestDate().getInterval().isEmpty()); - String interval = isRequestContainsInterval ? request.getRequestDate().getInterval() : (isDefaultPresent ? chartNode.get(Constants.JsonPaths.INTERVAL).asText() : ""); - - ObjectNode aggrObjectNode = JsonNodeFactory.instance.objectNode(); - ObjectNode nodes = JsonNodeFactory.instance.objectNode(); - - ArrayNode queries = (ArrayNode) chartNode.get(Constants.JsonPaths.QUERIES); - queries.forEach(query -> { - AggregateRequestDto requestDto = request; - - - String module = query.get(Constants.JsonPaths.MODULE).asText(); - if (request.getModuleLevel().equals(Constants.Modules.HOME_REVENUE) || - request.getModuleLevel().equals(Constants.Modules.HOME_SERVICES) || - query.get(Constants.JsonPaths.MODULE).asText().equals(Constants.Modules.COMMON) || - request.getModuleLevel().equals(module)) { - - String indexName = query.get(Constants.JsonPaths.INDEX_NAME).asText(); - // intercept request + _search operation - ObjectNode aggrResponse = aggrResponseBuilder(plotName, requestDto, query, indexName, interval); - if(nodes.has(indexName)) { - indexName = indexName + "_1"; - } - nodes.set(indexName, aggrResponse); - aggrObjectNode.set(Constants.JsonPaths.AGGREGATIONS, nodes); - } - }); - return aggrObjectNode; - } - - - private ObjectNode aggrResponseBuilder(String nodeName, AggregateRequestDto requestDto, JsonNode query, String indexName, String interval) { - - ObjectNode nodes = JsonNodeFactory.instance.objectNode(); - ArrayNode bucket = JsonNodeFactory.instance.arrayNode(); - - if (groupTenantIds.size() == 0) { //no tenantId filter present - bucket = getBuckets(mdmsApiMappings.getAll(), requestDto, query, indexName); - requestDto.getFilters().clear(); - - } else { //comes from global filter - bucket = getBuckets(groupTenantIds, requestDto, query, indexName); - - } - ObjectNode buckets = JsonNodeFactory.instance.objectNode(); - buckets.set("buckets", bucket); - nodes.put(nodeName, buckets); - return nodes; - - } - - private ArrayNode getBuckets(Map> map, AggregateRequestDto requestDto, JsonNode query, String indexName) { - ObjectNode nodes = JsonNodeFactory.instance.objectNode(); - ArrayNode bucket = JsonNodeFactory.instance.arrayNode(); - for (String ddrkey : map.keySet()) { - List tenantIds = map.get(ddrkey); - requestDto.getFilters().put("tenantId", tenantIds); - ObjectNode requestNode = queryService.getChartConfigurationQuery(requestDto, query, indexName, null); - - try { - ObjectNode aggrNode = (ObjectNode) restService.search(indexName, requestNode.toString()); - - if(!ddrkey.equalsIgnoreCase("null")) bucket.add(((ObjectNode) aggrNode.get(Constants.JsonPaths.AGGREGATIONS)).put("key", ddrkey)); - } catch (Exception e) { - logger.error("Encountered an Exception while Executing the Query : " + e.getMessage()); - } - - } - return bucket; - } - - - - @Override - public List getHeaderData(CummulativeDataRequestDto requestDto, List roles) throws AINException { - return null; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/TarentoServiceImpl.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/TarentoServiceImpl.java deleted file mode 100644 index 9b41c482dc7..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/org/service/TarentoServiceImpl.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.tarento.analytics.org.service; - -import java.io.IOException; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.ConfigurationLoader; -import com.tarento.analytics.constant.Constants; -import com.tarento.analytics.dto.AggregateDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.CummulativeDataRequestDto; -import com.tarento.analytics.dto.DashboardHeaderDto; -import com.tarento.analytics.dto.RoleDto; -import com.tarento.analytics.enums.ChartType; -import com.tarento.analytics.exception.AINException; -import com.tarento.analytics.handler.IResponseHandler; -import com.tarento.analytics.handler.InsightsHandler; -import com.tarento.analytics.handler.InsightsHandlerFactory; -import com.tarento.analytics.handler.ResponseHandlerFactory; -import com.tarento.analytics.model.InsightsConfiguration; -import com.tarento.analytics.service.QueryService; -import com.tarento.analytics.service.impl.RestService; -import com.tarento.analytics.utils.ResponseRecorder; - - -@Component -public class TarentoServiceImpl implements ClientService { - - public static final Logger logger = LoggerFactory.getLogger(TarentoServiceImpl.class); - - ObjectMapper mapper = new ObjectMapper(); - char insightPrefix = 'i'; - - - @Autowired - private QueryService queryService; - - @Autowired - private RestService restService; - - @Autowired - private ConfigurationLoader configurationLoader; - - @Autowired - private ResponseHandlerFactory responseHandlerFactory; - - @Autowired - private InsightsHandlerFactory insightsHandlerFactory; - - @Autowired - private MdmsApiMappings mdmsApiMappings; - - - @Override - @Cacheable(value="versions", key="#request.hashKey") - public AggregateDto getAggregatedData(AggregateRequestDto request, List roles) throws AINException, IOException { - // Read visualization Code - String internalChartId = request.getVisualizationCode(); - ObjectNode aggrObjectNode = JsonNodeFactory.instance.objectNode(); - ObjectNode insightAggrObjectNode = JsonNodeFactory.instance.objectNode(); - ObjectNode nodes = JsonNodeFactory.instance.objectNode(); - ObjectNode insightNodes = JsonNodeFactory.instance.objectNode(); - Boolean continueWithInsight = Boolean.FALSE; - - //TODO should be remove temporary fix for national dashboard - Map filters = request.getFilters(); - if( filters != null && filters.get("ulb") != null) { - filters.put("tenantId", filters.get("ulb")); - } - - - // Load Chart API configuration to Object Node for easy retrieval later - ObjectNode node = configurationLoader.get(Constants.ConfigurationFiles.CHART_API_CONFIG); - ObjectNode chartNode = (ObjectNode) node.get(internalChartId); - InsightsConfiguration insightsConfig = null; - if(chartNode.get(Constants.JsonPaths.INSIGHT) != null) { - insightsConfig = mapper.treeToValue(chartNode.get(Constants.JsonPaths.INSIGHT), InsightsConfiguration.class); - } - ChartType chartType = ChartType.fromValue(chartNode.get(Constants.JsonPaths.CHART_TYPE).asText()); - boolean isDefaultPresent = chartType.equals(ChartType.LINE) && chartNode.get(Constants.JsonPaths.INTERVAL)!=null; - boolean isRequestContainsInterval = null == request.getRequestDate() ? false : (request.getRequestDate().getInterval()!=null && !request.getRequestDate().getInterval().isEmpty()) ; - String interval = isRequestContainsInterval? request.getRequestDate().getInterval(): (isDefaultPresent ? chartNode.get(Constants.JsonPaths.INTERVAL).asText():""); - - executeConfiguredQueries(chartNode, aggrObjectNode, nodes, request, interval); - request.setChartNode(chartNode); - ResponseRecorder responseRecorder = new ResponseRecorder(); - request.setResponseRecorder(responseRecorder); - - IResponseHandler responseHandler = responseHandlerFactory.getInstance(chartType); - AggregateDto aggregateDto = new AggregateDto(); - if(aggrObjectNode.fields().hasNext()){ - aggregateDto = responseHandler.translate(request, aggrObjectNode); - } - - if(insightsConfig != null && StringUtils.isNotBlank(insightsConfig.getInsightInterval())) { - continueWithInsight = getInsightsDate(request, insightsConfig.getInsightInterval()); - if(continueWithInsight) { - String insightVisualizationCode = insightPrefix + request.getVisualizationCode(); - request.setVisualizationCode(insightVisualizationCode); - /* - Data is fetched with updated RequestDates (updated in getInsightsDate which subtracted one interval from the dates) - * - * */ - executeConfiguredQueries(chartNode, insightAggrObjectNode, insightNodes, request, interval); - - request.setChartNode(chartNode); - responseHandler = responseHandlerFactory.getInstance(chartType); - if(insightAggrObjectNode.fields().hasNext()){ - responseHandler.translate(request, insightAggrObjectNode); - } - InsightsHandler insightsHandler = insightsHandlerFactory.getInstance(chartType); - aggregateDto = insightsHandler.getInsights(aggregateDto, request.getVisualizationCode(), request.getModuleLevel(), insightsConfig,request.getResponseRecorder()); - } - } - - return aggregateDto; - } - - /** - * Executes queries and enriches the respons in aggrObjectNode - * @param chartNode The Chart Config defined in ChartApiConfig.json - * @param aggrObjectNode Object in which response is enriched - * @param nodes Don't know why passed as argument should have been defined in function itself - * @param request The API request - * @param interval Interval ( eg: Month) defines in RequestDate in AggregateRequestDto noot needed as seperate argument as it can - * be fetched from AggregateRequestDto - */ - private void executeConfiguredQueries(ObjectNode chartNode, ObjectNode aggrObjectNode, ObjectNode nodes, AggregateRequestDto request, String interval) { - preHandle(request, chartNode, mdmsApiMappings); - - ArrayNode queries = (ArrayNode) chartNode.get(Constants.JsonPaths.QUERIES); - int randIndexCount = 1; - for(JsonNode query : queries) { - String module = query.get(Constants.JsonPaths.MODULE).asText(); - if(request.getModuleLevel().equals(Constants.Modules.HOME_REVENUE) || - request.getModuleLevel().equals(Constants.Modules.HOME_SERVICES) || - query.get(Constants.JsonPaths.MODULE).asText().equals(Constants.Modules.COMMON) || - request.getModuleLevel().equals(module)) { - - String indexName = query.get(Constants.JsonPaths.INDEX_NAME).asText(); - ObjectNode objectNode = queryService.getChartConfigurationQuery(request, query, indexName, interval); - try { - JsonNode aggrNode = restService.search(indexName,objectNode.toString()); - if(nodes.has(indexName)) { - indexName = indexName + "_" + randIndexCount; - randIndexCount += 1; - } - nodes.set(indexName,aggrNode.get(Constants.JsonPaths.AGGREGATIONS)); - }catch (Exception e) { - logger.error("Encountered an Exception while Executing the Query : " + e.getMessage()); - throw new RuntimeException(e); - } - aggrObjectNode.set(Constants.JsonPaths.AGGREGATIONS, nodes); - - } - } - } - - /** - * Updates the RequestDate for insight data - * @param request - * @param insightInterval - * @return - */ - private Boolean getInsightsDate(AggregateRequestDto request, String insightInterval) { - Long daysBetween = daysBetween(Long.parseLong(request.getRequestDate().getStartDate()), - Long.parseLong(request.getRequestDate().getEndDate())); - if(insightInterval.equals(Constants.Interval.month.toString()) && daysBetween > 32) { - return Boolean.FALSE; - } - if(insightInterval.equals(Constants.Interval.week.toString()) && daysBetween > 8) { - return Boolean.FALSE; - } - if(insightInterval.equals(Constants.Interval.year.toString()) && daysBetween > 366) { - return Boolean.FALSE; - } - Calendar startCal = Calendar.getInstance(); - Calendar endCal = Calendar.getInstance(); - startCal.setTime(new Date(Long.parseLong(request.getRequestDate().getStartDate()))); - endCal.setTime(new Date(Long.parseLong(request.getRequestDate().getEndDate()))); - if(insightInterval.equals(Constants.Interval.month.toString())) { - startCal.add(Calendar.MONTH, -1); - endCal.add(Calendar.MONTH, -1); - } else if(insightInterval.equals(Constants.Interval.week.toString())) { - startCal.add(Calendar.WEEK_OF_YEAR, -1); - endCal.add(Calendar.WEEK_OF_YEAR, -1); - } else if(StringUtils.isBlank(insightInterval) || insightInterval.equals(Constants.Interval.year.toString())) { - startCal.add(Calendar.YEAR, -1); - endCal.add(Calendar.YEAR, -1); - } - request.getRequestDate().setStartDate(String.valueOf(startCal.getTimeInMillis())); - request.getRequestDate().setEndDate(String.valueOf(endCal.getTimeInMillis())); - return Boolean.TRUE; - } - - public long daysBetween(Long start, Long end) { - return TimeUnit.MILLISECONDS.toDays(Math.abs(end - start)); - } - - - - @Override - public List getHeaderData(CummulativeDataRequestDto requestDto, List roles) throws AINException { - // TODO Auto-generated method stub - return null; - } - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/Aggregation.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/Aggregation.java deleted file mode 100644 index b7f4c8a28d8..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/Aggregation.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.tarento.analytics.query.model; - -public class Aggregation { - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/Query.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/Query.java deleted file mode 100644 index d48b10b25da..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/Query.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.tarento.analytics.query.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Query { - - @JsonProperty("x_axis") - public XAxis xAxis; - - @JsonProperty("y_axis") - public YAxis yAxis; - - public XAxis getxAxis() { - return xAxis; - } - - public void setxAxis(XAxis xAxis) { - this.xAxis = xAxis; - } - - public YAxis getyAxis() { - return yAxis; - } - - public void setyAxis(YAxis yAxis) { - this.yAxis = yAxis; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/XAxis.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/XAxis.java deleted file mode 100644 index e7b5a9bed83..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/XAxis.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.tarento.analytics.query.model; - -import java.util.Map; - -public class XAxis { - - public Map aggregation; - - public Map getAggregation() { - return aggregation; - } - - public void setAggregation(Map aggregation) { - this.aggregation = aggregation; - } - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/YAxis.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/YAxis.java deleted file mode 100644 index e44af59a16b..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/query/model/YAxis.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.tarento.analytics.query.model; - -import java.util.Map; - -public class YAxis { - - Map aggregation; - - public Map getAggregation() { - return aggregation; - } - - public void setAggregation(Map aggregation) { - this.aggregation = aggregation; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/repository/ElasticSearchRepository.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/repository/ElasticSearchRepository.java deleted file mode 100644 index 4da1f8de971..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/repository/ElasticSearchRepository.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.tarento.analytics.repository; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.HttpServerErrorException; -import org.springframework.web.client.RestTemplate; - -import com.tarento.analytics.dto.MappingDto; -import com.tarento.analytics.model.Transaction; - -/** - * This Repository Class is used to perform the transactions of storing the data into the Elastic Search Repository - * @author Darshan Nagesh - * - */ -@Service -public class ElasticSearchRepository { - - public static final Logger LOGGER = LoggerFactory.getLogger(ElasticSearchRepository.class); - - private final RestTemplate restTemplate; - - public ElasticSearchRepository(RestTemplate restTemplate) { - this.restTemplate = restTemplate; - } - - /** - * Based on the Transaction Index Data Obtained and the URL with Headers, this method will put the Data obtained on the - * Elastic Search Database and returns the response in the form of Positive or Negative outcome (True Or False) - * @param transactionIndex - * @param url - * @param headers - * @return - */ - public Boolean saveTransaction(Transaction transaction, String url, HttpHeaders headers) { - ResponseEntity map = null; - try { - map = restTemplate.exchange(url, HttpMethod.PUT, - new HttpEntity<>(transaction, headers), Map.class); - } catch (final HttpClientErrorException httpClientErrorException) { - LOGGER.error("Error : " + httpClientErrorException); - } catch (HttpServerErrorException httpServerErrorException) { - LOGGER.error("Error : " + httpServerErrorException); - } catch (Exception e) { - LOGGER.error("Error : " + e); - } - if (map != null && map.getStatusCode() != null && (map.getStatusCode() == HttpStatus.OK) || (map.getStatusCode() == HttpStatus.CREATED)) { - return true; - } - return false; - } - - - - // create index - public Boolean createTransactionIndex(MappingDto dto, String url, HttpHeaders headers){ - ResponseEntity map = null; - try { - LOGGER.info("Each Channel Content : " + dto.toString()); - map = restTemplate.exchange(url, HttpMethod.PUT, - new HttpEntity<>(dto, headers), Map.class); - } catch (final HttpClientErrorException httpClientErrorException) { - LOGGER.error("Error : " + httpClientErrorException); - } catch (HttpServerErrorException httpServerErrorException) { - LOGGER.error("Error : " + httpServerErrorException); - } catch (Exception e) { - LOGGER.error("Error : " + e); - } - if (map != null && map.getStatusCode() != null && (map.getStatusCode() == HttpStatus.OK) || (map.getStatusCode() == HttpStatus.CREATED)) { - return true; - } - return false; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/AmazonS3ClientService.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/AmazonS3ClientService.java deleted file mode 100644 index 1ebda9f0d97..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/AmazonS3ClientService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.tarento.analytics.service; - -import org.springframework.web.multipart.MultipartFile; - -public interface AmazonS3ClientService -{ - String uploadFileToS3Bucket(MultipartFile multipartFile, boolean enablePublicReadAccess); - - void deleteFileFromS3Bucket(String fileName); -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/MetadataService.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/MetadataService.java deleted file mode 100644 index 5a2c1c530e8..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/MetadataService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.tarento.analytics.service; - -import java.io.IOException; -import java.util.List; - -import org.json.JSONArray; - -import com.tarento.analytics.dto.RoleDto; -import com.tarento.analytics.exception.AINException; - -public interface MetadataService { - - public Object getDashboardConfiguration(String dashboardId, String catagory, List roleIds) throws AINException, IOException; - public JSONArray getTargetDistrict() throws Exception ; - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/QueryService.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/QueryService.java deleted file mode 100644 index bc97d7582c8..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/QueryService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.tarento.analytics.service; - -import java.io.IOException; - -import org.elasticsearch.search.aggregations.Aggregations; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.exception.AINException; - -public interface QueryService { -/* - List getAggregateData(AggregateRequestDto aggregateDto, String orgId) throws AINException; -*/ - public static final String API_CONFIG_JSON = "ChartApiConfig.json"; - public static final String DATE_SOURCE_FIELD = "dateSourceField"; - public static final String AGG_QUERY_JSON = "aggregationQueryJson"; - public static final String INDEX_NAME = "indexName" ; - public static final String DOCUMENT_TYPE = "documentType"; -/* Aggregations getAggregateData(AggregateRequestDto aggregateDto, String orgId) throws AINException; - Aggregations getAggregateDataV2(AggregateRequestDtoV2 aggregateDto, String orgId) throws AINException, JsonParseException, JsonMappingException, IOException; - */ - ObjectNode getChartConfigurationQuery(AggregateRequestDto req, JsonNode query, String indexName, String interval); - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/AmazonS3ClientServiceImpl.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/AmazonS3ClientServiceImpl.java deleted file mode 100644 index 626eb48a82a..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/AmazonS3ClientServiceImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.tarento.analytics.service.impl; - -import com.amazonaws.AmazonServiceException; -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.regions.Region; -import com.amazonaws.services.s3.AmazonS3; -import com.amazonaws.services.s3.AmazonS3ClientBuilder; -import com.amazonaws.services.s3.model.CannedAccessControlList; -import com.amazonaws.services.s3.model.DeleteObjectRequest; -import com.amazonaws.services.s3.model.PutObjectRequest; -import com.tarento.analytics.model.AmazonS3Config; -import com.tarento.analytics.service.AmazonS3ClientService; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang3.RandomStringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Date; - -@Component -public class AmazonS3ClientServiceImpl implements AmazonS3ClientService -{ - - @Value("${filename.length}") - private Integer filenameLength; - - @Value("${filename.useletters}") - private Boolean useLetters; - - @Value("${filename.usenumbers}") - private Boolean useNumbers; - - - @Autowired - private AmazonS3Config amazonS3Config; - private String awsS3AudioBucket; - private AmazonS3 amazonS3; - private static final Logger logger = LoggerFactory.getLogger(AmazonS3ClientServiceImpl.class); - - @Autowired - public AmazonS3ClientServiceImpl(Region awsRegion, AWSCredentialsProvider awsCredentialsProvider, String awsS3AudioBucket) - { - this.amazonS3 = AmazonS3ClientBuilder.standard() - .withCredentials(awsCredentialsProvider) - .withRegion(awsRegion.getName()).build(); - this.awsS3AudioBucket = awsS3AudioBucket; - } - - @Async - public String uploadFileToS3Bucket(MultipartFile multipartFile, boolean enablePublicReadAccess) - { - String orignalFileName = multipartFile.getOriginalFilename(); - String imageURL = ""; - FileOutputStream fos = null; - try { - - String randomString = RandomStringUtils.random(filenameLength, useLetters, useNumbers); - String imagetype = FilenameUtils.getExtension(orignalFileName); - String fileName = System.currentTimeMillis() + randomString + "." +imagetype; - //creating the file in the server (temporarily) - File file = new File(fileName); - fos = new FileOutputStream(file); - - fos.write(multipartFile.getBytes()); - - PutObjectRequest putObjectRequest = new PutObjectRequest(this.awsS3AudioBucket, fileName, file); - - if (enablePublicReadAccess) { - putObjectRequest.withCannedAcl(CannedAccessControlList.PublicRead); - } - this.amazonS3.putObject(putObjectRequest); - - imageURL = String.valueOf(amazonS3.getUrl( - amazonS3Config.getAWSS3AudioBucket(), //The S3 Bucket To Upload To - file.getName())); - //removing the file created in the server - file.delete(); - } catch (IOException | AmazonServiceException ex) { - logger.error("error [" + ex.getMessage() + "] occurred while uploading [" + orignalFileName + "] "); - }finally { - try { - fos.close(); - } catch (IOException e) { - logger.error("Error occured while closing file output stream."); - } - } - return imageURL; - - } - - @Async - public void deleteFileFromS3Bucket(String fileName) - { - try { - amazonS3.deleteObject(new DeleteObjectRequest(awsS3AudioBucket, fileName)); - } catch (AmazonServiceException ex) { - logger.error("error [" + ex.getMessage() + "] occurred while removing [" + fileName + "] "); - } - } -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/MetadataServiceImpl.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/MetadataServiceImpl.java deleted file mode 100644 index 109cc09c409..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/MetadataServiceImpl.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.tarento.analytics.service.impl; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.net.URI; -import java.util.*; - -import com.tarento.analytics.constant.Constants; -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.gson.Gson; -import com.tarento.analytics.ConfigurationLoader; -import com.tarento.analytics.dto.RoleDto; -import com.tarento.analytics.dto.Tenants; -import com.tarento.analytics.exception.AINException; -import com.tarento.analytics.service.MetadataService; - -@Service("metadataService") -public class MetadataServiceImpl implements MetadataService { - - public static final Logger logger = LoggerFactory.getLogger(MetadataServiceImpl.class); - - @Autowired - private ConfigurationLoader configurationLoader; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private RestTemplate restTemplate; - - @Value("${egov.mdms.host}") - private String mdmsServiceHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsSearchEndpoint; - - @Override - public ArrayNode getDashboardConfiguration(String dashboardId, String catagory, List roleIds) throws AINException, IOException { - - Calendar cal = Calendar.getInstance(); - cal.set(cal.getWeekYear()-1, Calendar.APRIL, 1); - Date startDate = cal.getTime(); - Date endDate = new Date(); - - String fyInfo = "From " + Constants.DASHBOARD_DATE_FORMAT.format(startDate) + " to " + Constants.DASHBOARD_DATE_FORMAT.format(endDate); - - - ObjectNode dashBoardNode = configurationLoader.get(ConfigurationLoader.MASTER_DASHBOARD_CONFIG); - ArrayNode dasboardNodes = (ArrayNode) dashBoardNode.findValue(Constants.DashBoardConfig.DASHBOARDS); - - ObjectNode roleMappingNode = configurationLoader.get(ConfigurationLoader.ROLE_DASHBOARD_CONFIG); - ArrayNode rolesArray = (ArrayNode) roleMappingNode.findValue(Constants.DashBoardConfig.ROLES); - ArrayNode dbArray = JsonNodeFactory.instance.arrayNode(); - for(JsonNode role: rolesArray){ - logger.info("role name: " + role.get("roleName")); - logger.info("role ID: " + role.get("roleId")); - String roleId = role.get("roleId").asText(); - - //Object roleId = roleIds.stream().filter(x -> role.get(Constants.DashBoardConfig.ROLE_ID).asLong() == (x.getId())).findAny().orElse(null); - if (null != roleId) { - ArrayNode visArray = JsonNodeFactory.instance.arrayNode(); - for(JsonNode db : role.get(Constants.DashBoardConfig.DASHBOARDS)){ - ObjectNode copyDashboard = objectMapper.createObjectNode(); - - JsonNode name = JsonNodeFactory.instance.textNode(""); - JsonNode id = JsonNodeFactory.instance.textNode(""); - JsonNode title = JsonNodeFactory.instance.textNode(fyInfo); - if (db.get(Constants.DashBoardConfig.ID).asText().equalsIgnoreCase(dashboardId)) { - //dasboardNodes.forEach(dbNode -> { - for(JsonNode dbNode : dasboardNodes){ - if (dbNode.get(Constants.DashBoardConfig.ID).asText().equalsIgnoreCase(dashboardId)) { - logger.info("dbNode: " + dbNode); - name = dbNode.get(Constants.DashBoardConfig.NAME); - id = dbNode.get(Constants.DashBoardConfig.ID); - - if (catagory != null) { - dbNode.get(Constants.DashBoardConfig.VISUALISATIONS).forEach(visual -> { - if (visual.get(Constants.DashBoardConfig.NAME).asText().equalsIgnoreCase(catagory)) - visArray.add(visual); - }); - } else { - dbNode.get(Constants.DashBoardConfig.VISUALISATIONS).forEach(visual -> { - visArray.add(visual); - }); - } - } - copyDashboard.set(Constants.DashBoardConfig.NAME, name); - copyDashboard.set(Constants.DashBoardConfig.ID, id); - //add TITLE with varible dynamically - copyDashboard.set(Constants.DashBoardConfig.TITLE, title); - - copyDashboard.set(Constants.DashBoardConfig.VISUALISATIONS, visArray); - copyDashboard.set("roleId", role.get("roleId")); - copyDashboard.set("roleName", role.get("roleName")); - - }//); - dbArray.add(copyDashboard); - } - } - - } - } - - return dbArray; - } - -/* @Override - public ArrayNode getDashboardConfiguration(String dashboardId, String catagory, List roleIds) throws AINException, IOException { - - ObjectNode configNode = configurationLoader.get(ConfigurationLoader.ROLE_DASHBOARD_CONFIG); - ArrayNode rolesArray = (ArrayNode) configNode.findValue("roles"); - ArrayNode dbArray = JsonNodeFactory.instance.arrayNode(); - - rolesArray.forEach(role -> { - Object roleId = roleIds.stream().filter(x -> role.get("roleId").asLong() == (x.getId())).findAny().orElse(null); - System.out.println("roleId = "+roleId); - - if (null != roleId) { - role.get("dashboards").forEach(dashboard -> { - ObjectNode copyDashboard = dashboard.deepCopy(); - ArrayNode visArray = JsonNodeFactory.instance.arrayNode(); - if(catagory != null) { - copyDashboard.get("visualizations").forEach(visual ->{ - if(visual.get("name").asText().equalsIgnoreCase(catagory)){ - visArray.add(visual); - } - }); - copyDashboard.set("visualizations", visArray); - } - if(dashboard.get("id").asText().equalsIgnoreCase(dashboardId)){ - dbArray.add(copyDashboard); - } - }); - } - }); - - //List dbs = objectMapper.readValue(dbArray.toString(), new TypeReference>() {}); - return dbArray; - }*/ - - public JSONArray getTargetDistrict() throws Exception { - final String baseUrl = mdmsServiceHost + mdmsSearchEndpoint; - URI uri = new URI(baseUrl); - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - HttpEntity requestEntity = new HttpEntity<>("{}", headers); - ResponseEntity response = restTemplate.exchange(uri, HttpMethod.POST, requestEntity, String.class); - String targetdistrict = response.getBody(); - ObjectMapper objectMapper = new ObjectMapper(); - JsonNode jsonNode = objectMapper.readTree(targetdistrict); - ArrayNode array = (ArrayNode) jsonNode.at("/MdmsRes/tenant/tenants"); - - File getFile = new File( - System.getProperty("user.dir") + System.getProperty("file.separator") + "data/tenants.json"); - BufferedReader br = null; - Tenants sample = null; - try{ - br = new BufferedReader(new FileReader(getFile)); - sample = new Gson().fromJson(br, Tenants.class); - }catch (Exception e){ - logger.info("Error occured while reading tenants file."); - }finally{ - br.close(); - } - JSONArray jsonArray = new JSONArray(); - Map> mapDistrictUlb = new HashMap(); - Map DistrictMap = new HashMap(); - for (int i = 0; i < sample.getTenants().size(); i++) { - String ulbCode = sample.getTenants().get(i).getCode(); - String ulbName = sample.getTenants().get(i).getName(); - String districtName = sample.getTenants().get(i).getCity().getDistrictName(); - String districtCode = sample.getTenants().get(i).getCity().getDistrictCode(); - Map mapUlb = new HashMap(); - Map mapDist = new LinkedHashMap(); - Map mapDistAll = new LinkedHashMap(); - mapDist.put("District Name", districtName); - mapDist.put("District Code", districtCode); - mapUlb.put("Ulb Name", ulbName); - mapUlb.put("tenantId", ulbCode); - mapDistAll.put(districtCode, new JSONObject(mapDist)); - DistrictMap.put(districtCode.toString(), mapDist); - if (mapDistrictUlb.containsKey(districtCode.toString())) { - mapDistrictUlb.get(districtCode.toString()).add(mapUlb); - } else { - List lst = new ArrayList(); - lst.add(mapUlb); - mapDistrictUlb.put(districtCode.toString(), lst); - } - } - for (Map.Entry entry1 : DistrictMap.entrySet()) { - JSONObject getdistrictJson = new JSONObject(); - for (Map.Entry> entry2 : mapDistrictUlb.entrySet()) { - if (entry1.getKey().equals(entry2.getKey())) { - JSONObject getUlbtoDistrict = new JSONObject(); - getdistrictJson.put(entry1.getKey(), entry1.getValue()); - String json = new Gson().toJson(entry1.getValue(), LinkedHashMap.class); - getUlbtoDistrict.put(entry1.getKey(), new JSONObject(json).accumulate("Ulb", entry2.getValue())); - jsonArray.put(getUlbtoDistrict); - } - } - } - return jsonArray; - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/QueryServiceImpl.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/QueryServiceImpl.java deleted file mode 100644 index aa7933190bd..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/QueryServiceImpl.java +++ /dev/null @@ -1,464 +0,0 @@ -package com.tarento.analytics.service.impl; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.elasticsearch.action.search.MultiSearchResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.search.aggregations.Aggregation; -import org.elasticsearch.search.aggregations.Aggregations; -import org.elasticsearch.search.aggregations.bucket.terms.ParsedLongTerms; -import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.elasticsearch.search.aggregations.metrics.avg.ParsedAvg; -import org.elasticsearch.search.aggregations.metrics.sum.ParsedSum; -import org.elasticsearch.search.aggregations.metrics.valuecount.ParsedValueCount; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.tarento.analytics.ConfigurationLoader; -import com.tarento.analytics.constant.Constants; -import com.tarento.analytics.dao.ElasticSearchDao; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.dto.AggregateRequestDto; -import com.tarento.analytics.enums.ChartType; -import com.tarento.analytics.exception.AINException; -import com.tarento.analytics.model.ElasticSearchDictator; -import com.tarento.analytics.model.KeyData; -import com.tarento.analytics.model.Query; -import com.tarento.analytics.model.ServiceQuery; -import com.tarento.analytics.service.QueryService; -import com.tarento.analytics.utils.ElasticProperties; - -@Component -public class QueryServiceImpl implements QueryService { - - public static final Logger logger = LoggerFactory.getLogger(QueryServiceImpl.class); -/* - @Autowired - private MetadataDao metaDataDao;*/ - - @Autowired - private ElasticSearchDao elasticSearchDao; - -/* - @Autowired - private DecoratorService decoratorService; - -*/ - @Autowired - private ConfigurationLoader configurationLoader; - - private static final Map WeekDayMap = createMap(); - - private static Map createMap() { - Map result = new HashMap(); - result.put(1, "SUN"); - result.put(2, "MON"); - result.put(3, "TUE"); - result.put(4, "WED"); - result.put(5, "THU"); - result.put(6, "FRI"); - result.put(7, "SAT"); - - return Collections.unmodifiableMap(result); - } - -/* - @Override - public Aggregations getAggregateData(AggregateRequestDto aggregateDto, String orgId) throws AINException { - - //public List getAggregateData(AggregateRequestDto aggregateDto, String orgId) throws AINException { - Aggregations aggregations = null; - ElasticSearchDictator dictator = null; - ServiceQuery elasticServiceQuery = metaDataDao.getServiceQuery(Long.parseLong(orgId), - aggregateDto.getServiceApi()); - - ObjectMapper mapper = new ObjectMapper(); - */ -/*Map resonseMap = null;*//* - - try { - - //Query Builder - Query queryJson = mapper.readValue(elasticServiceQuery.getQueryJson(), Query.class); - // Set index name and document Type for elastic - Map queryMap = queryJson.getAggregation(); - - //Label Mapping - Map labelMap = new HashMap<>(); - getAggregateLabelRecursively(queryMap,labelMap); - - dictator = elasticSearchDao.createSearchDictator(aggregateDto, elasticServiceQuery.getIndexName(), - elasticServiceQuery.getDocumentType(), queryJson.getDateFilterField()); - dictator.setQueryAggregationMap(queryMap); - SearchRequest searchRequest = elasticSearchDao.buildElasticSearchQuery(dictator); - List searchRequestList = new ArrayList<>(); - searchRequestList.add(searchRequest); - MultiSearchResponse response = elasticSearchDao.executeMultiSearchRequest(searchRequestList, Boolean.TRUE); - SearchResponse searchResponse = response.getResponses()[0].getResponse(); - aggregations = searchResponse.getAggregations(); - */ -/*resonseMap= translateResponse(response, aggregateDto.getChartType(),aggregateDto.getInterval(), labelMap); - decoratorService.getChartData(aggregateDto, chartFormat, chartType, serviceApi, chartCode)*//* - - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return aggregations; - } - - @Override - public Aggregations getAggregateDataV2(AggregateRequestDtoV2 aggregateDto, String orgId) throws AINException, JsonParseException, JsonMappingException, IOException { - Boolean primaryOrNot = Boolean.TRUE; - ServiceQuery elasticServiceQuery = new ServiceQuery(); - String visualizationCode = aggregateDto.getVisualizationCode(); - ObjectNode configNode = configurationLoader.get(API_CONFIG_JSON); - elasticServiceQuery.setIndexName(configNode.get(visualizationCode).get(INDEX_NAME).asText()); - elasticServiceQuery.setDocumentType(configNode.get(visualizationCode).get(DOCUMENT_TYPE).asText()); - elasticServiceQuery.setQueryJson(configNode.get(visualizationCode).get(AGG_QUERY_JSON).asText()); - if(elasticServiceQuery.getIndexName().equals("dss-col-v1")) { - primaryOrNot = Boolean.TRUE; - } else { - primaryOrNot = Boolean.FALSE; - } - ObjectMapper mapper = new ObjectMapper(); - Query queryJson = mapper.readValue(elasticServiceQuery.getQueryJson(), Query.class); - - // Set index name and document Type for elastic - Map queryMap = queryJson.getAggregation(); - - //Label Mapping - Map labelMap = new HashMap<>(); - getAggregateLabelRecursively(queryMap,labelMap); - - Aggregations aggregations = null; - ElasticSearchDictator dictator = null; - - try { - dictator = elasticSearchDao.createSearchDictatorV2(aggregateDto, elasticServiceQuery.getIndexName(), - elasticServiceQuery.getDocumentType(), queryJson.getDateFilterField()); - dictator.setQueryAggregationMap(queryMap); - SearchRequest searchRequest = elasticSearchDao.buildElasticSearchQuery(dictator); - List searchRequestList = new ArrayList<>(); - searchRequestList.add(searchRequest); - MultiSearchResponse response = elasticSearchDao.executeMultiSearchRequest(searchRequestList, primaryOrNot); - SearchResponse searchResponse = response.getResponses()[0].getResponse(); - aggregations = searchResponse.getAggregations(); - } catch (Exception e) { - logger.error("Encountered an error while getting the Aggregated Data : " + e.getMessage()); - } - return aggregations; - } -*/ - -/* private Map translateResponse(MultiSearchResponse response, ChartType chartType, String interval, Map labelMap) { - SearchResponse searchResponse = response.getResponses()[0].getResponse(); - List aggregations = searchResponse.getAggregations().asList(); - Map responseMap = new HashMap<>(); - - if (chartType.equals(ChartType.BAR) || chartType.equals(ChartType.HORIZONTALBAR) - || chartType.equals(ChartType.PIE) || chartType.equals(ChartType.DOUGHNUT)) { - - if (aggregations.get(0) instanceof ParsedLongTerms) { - responseMap = parseParseLongTerms((ParsedLongTerms) aggregations.get(0), chartType, labelMap); - } - } - - return responseMap; - }*/ - - @SuppressWarnings("unchecked") - void getAggregateLabelRecursively(Map queryMap, Map labelMap ){ - try { - if(queryMap.containsKey(ElasticProperties.Query.AGGREGATION_CONDITION.toLowerCase())){ - - Map valueMap =(HashMap)queryMap.get(ElasticProperties.Query.AGGREGATION_CONDITION.toLowerCase()); - getAggregateLabelRecursively(valueMap, labelMap); - } - for (Map.Entry itrQuery : queryMap.entrySet()) { - if(itrQuery.getKey().equals(ElasticProperties.Query.AGGREGATION_CONDITION.toLowerCase())){ - continue; - } - Map propertiesMap = (HashMap)itrQuery.getValue(); - labelMap.put(itrQuery.getKey(), propertiesMap.get(ElasticProperties.Query.LABEL.toLowerCase()).toString()); - } - } catch (Exception e) { - - } - } - /* - * private Map - * parseDateHistogramForMultiLine(List aggregations, ChartType - * chartType, String interval) { Map responseMap = new - * HashMap<>(); - * - * for (Histogram.Bucket bucket : ((ParsedDateHistogram) - * aggregations.get(0)).getBuckets()) { List subAggregations = - * bucket.getAggregations().asList(); if (subAggregations.get(0) instanceof - * ParsedLongTerms) { parseParseLongTermsOnInterval(bucket, chartType, - * interval, responseMap); } - * - * } - * - * return responseMap; - * - * } - */ - - /* - * private Map parseNested(List aggregations, - * ChartType chartType, String interval) { - * - * Map responseMap = new HashMap<>(); for (Aggregation - * aggregationData : ((ParsedNested) aggregations.get(0)).getAggregations()) - * { if (aggregationData instanceof ParsedLongTerms) { responseMap = - * parseParseLongTerms((ParsedLongTerms) aggregationData, chartType, - * interval); } - * - * } return responseMap; - * - * } - */ - - /* - * private Map parseDateHistogram(List - * aggregations, ChartType chartType, String interval) { - * - * Map responseMap = new HashMap<>(); if - * (interval.equals(ElasticSearchConstants.DAY_OF_WEEK)) { Map dayWiseObjectMap = new HashMap() { { put(1, - * null); put(2, null); put(3, null); put(4, null); put(5, null); put(6, - * null); put(7, null); - * - * } }; - * - * for (Histogram.Bucket bucket : ((ParsedDateHistogram) - * aggregations.get(0)).getBuckets()) { Calendar cal = - * Calendar.getInstance(); - * cal.setTimeInMillis(Long.parseLong(bucket.getKeyAsString())); int - * dayofWeek = cal.get(Calendar.DAY_OF_WEEK); - * - * Object val = getAggregationValue(bucket); if - * (dayWiseObjectMap.containsKey(dayofWeek)) { Object dayWiseCount = - * dayWiseObjectMap.get(dayofWeek); if (val instanceof Double) { Double - * doubleValue = 0.0; if (dayWiseCount == null) { doubleValue = 0.0; } else - * { doubleValue = (Double) dayWiseCount; } doubleValue += - * getFormattedDouble((Double) val); dayWiseCount = doubleValue; } else if - * (val instanceof Long) { Long longValue = 0L; if (dayWiseCount == null) { - * longValue = 0L; } else { longValue = (Long) dayWiseCount; } longValue += - * (Long) val; dayWiseCount = longValue; } dayWiseObjectMap.put(dayofWeek, - * dayWiseCount); } else { if (val instanceof Double) { Double doubleValue = - * (Double) val; doubleValue += getFormattedDouble((Double) val); val = - * doubleValue; } dayWiseObjectMap.put(dayofWeek, val); } } for - * (Map.Entry entry : dayWiseObjectMap.entrySet()) { - * - * responseMap.put(WeekDayMap.get(entry.getKey()), (entry.getValue())); } } - * else { for (Histogram.Bucket bucket : ((ParsedDateHistogram) - * aggregations.get(0)).getBuckets()) { List subAggregations = - * bucket.getAggregations().asList(); if (subAggregations.get(0) instanceof - * ParsedLongTerms) { - * - * - * responseMap = parseParseLongTermsOnInterval(bucket, chartType, interval); - * } else { responseMap = parseDateHistogramBasedOnInterval(bucket, - * chartType, interval); } - * - * } } return responseMap; - * - * } - */ - /* - * private void parseParseLongTermsOnInterval(Bucket buckets, ChartType - * chartType, String interval, Map responseMap) { Calendar - * cal = Calendar.getInstance(); - * cal.setTimeInMillis(Long.parseLong(buckets.getKeyAsString())); String key - * = null; if (interval.equals(ElasticSearchConstants.DAY)) { int day = - * cal.get(Calendar.DAY_OF_MONTH); int month = cal.get(Calendar.MONTH) + 1; - * - * key = day + "/" + month; } else if - * (interval.equals(ElasticSearchConstants.HOUR)) { int hour = - * cal.get(Calendar.HOUR_OF_DAY); String suffix = "AM"; if - * (cal.get(Calendar.AM_PM) > 0) suffix = "PM"; - * - * key = String.valueOf(hour + 1) + suffix; - * - * } Map innerResponseMap = new HashMap<>(); - * - * for (Terms.Bucket bucket : ((ParsedLongTerms) buckets).getBuckets()) { - * - * Map valueMap = bucket.getAggregations().getAsMap(); - * Object val = null; - * - * for (Map.Entry aggregation : valueMap.entrySet()) { - * if - * (aggregation.getKey().contains(ElasticProperties.Query.SUM.toLowerCase()) - * ) { ParsedSum sum = (ParsedSum) aggregation.getValue(); val = - * sum.getValue(); } else if - * (aggregation.getKey().contains(ElasticProperties.Query.AVG.toLowerCase()) - * ) { ParsedAvg avg = (ParsedAvg) aggregation.getValue(); val = - * avg.getValue(); - * - * } else if - * (aggregation.getKey().contains(ElasticProperties.Query.COUNT.toLowerCase( - * ))) { ParsedValueCount count = (ParsedValueCount) aggregation.getValue(); - * val = count.getValue(); - * - * } - * - * } innerResponseMap.put(bucket.getKeyAsString(), val); } - * responseMap.put(key, innerResponseMap); - * - * } - */ - - /* - * private Map parseDateHistogramBasedOnInterval(Bucket - * bucket, ChartType chartType, String interval) { Map - * responseMap = new HashMap<>(); Calendar cal = Calendar.getInstance(); - * cal.setTimeInMillis(Long.parseLong(bucket.getKeyAsString())); String key - * = null; Object val = null; if - * (interval.equals(ElasticSearchConstants.DAY)) { int day = - * cal.get(Calendar.DAY_OF_MONTH); int month = cal.get(Calendar.MONTH) + 1; - * - * key = day + "/" + month; val = getAggregationValue(bucket); - * - * } else if (interval.equals(ElasticSearchConstants.HOUR)) { int hour = - * cal.get(Calendar.HOUR_OF_DAY); String suffix = "AM"; if - * (cal.get(Calendar.AM_PM) > 0) suffix = "PM"; val = - * getAggregationValue(bucket); - * - * key = String.valueOf(hour + 1) + suffix; - * - * } responseMap.put(key, val); return responseMap; - * - * } - */ - - /* - * private Object getAggregationValue(Bucket bucket) { Map valueMap = bucket.getAggregations().getAsMap(); Object val = - * null; - * - * for (Map.Entry aggregation : valueMap.entrySet()) { - * if - * (aggregation.getKey().contains(ElasticProperties.Query.SUM.toLowerCase()) - * ) { ParsedSum sum = (ParsedSum) aggregation.getValue(); val = - * sum.getValue(); } else if - * (aggregation.getKey().contains(ElasticProperties.Query.AVG.toLowerCase()) - * ) { ParsedAvg avg = (ParsedAvg) aggregation.getValue(); val = - * avg.getValue(); - * - * } else if - * (aggregation.getKey().contains(ElasticProperties.Query.COUNT.toLowerCase( - * ))) { ParsedValueCount count = (ParsedValueCount) aggregation.getValue(); - * val = count.getValue(); - * - * } } return val; } - */ - - private Map parseParseLongTerms(ParsedLongTerms aggregations, ChartType chartType, Map labelMap) { - - Map keyValueMap = new HashMap<>(); - - for (Terms.Bucket bucket : aggregations.getBuckets()) { - KeyData keyData = new KeyData(); - KeyData valueData = new KeyData(); - - String key = bucket.getKey().toString(); - - Map valueMap = bucket.getAggregations().getAsMap(); - Object val = null; - String valueLabel = null; - for (Map.Entry aggregation : valueMap.entrySet()) { - if (aggregation.getKey().contains(ElasticProperties.Query.SUM.toLowerCase())) { - ParsedSum sum = (ParsedSum) aggregation.getValue(); - val = sum.getValue(); - valueLabel = ElasticProperties.Query.SUM.toLowerCase(); - } else if (aggregation.getKey().contains(ElasticProperties.Query.AVG.toLowerCase())) { - ParsedAvg avg = (ParsedAvg) aggregation.getValue(); - val = avg.getValue(); - valueLabel = ElasticProperties.Query.SUM.toLowerCase(); - - } else if (aggregation.getKey().contains(ElasticProperties.Query.COUNT.toLowerCase())) { - ParsedValueCount count = (ParsedValueCount) aggregation.getValue(); - val = count.getValue(); - valueLabel = ElasticProperties.Query.SUM.toLowerCase(); - - } - - } - keyData.setKey(key); - keyData.setLabel(labelMap.get(ElasticProperties.Query.TERM.toLowerCase())); - valueData.setKey(val); - valueData.setLabel(labelMap.get(valueLabel)); - keyValueMap.put(keyData, valueData); - - } - return keyValueMap; - - } - - private Double getFormattedDouble(double val) { - return (Math.round(new Double(val).isInfinite() ? 0.0 : new Double(val) * 100.0) / 100.0); - } - - @Override - public ObjectNode getChartConfigurationQuery(AggregateRequestDto request, JsonNode query, String indexName, String interval) { - String aggrQuery = query.get(Constants.JsonPaths.AGGREGATION_QUERY).asText(); - if(interval!=null && !interval.isEmpty()) - aggrQuery = aggrQuery.replace(Constants.JsonPaths.INTERVAL_VAL, interval); - String rqMs = query.get(Constants.JsonPaths.REQUEST_QUERY_MAP).asText(); - String dateReferenceField = query.get(Constants.JsonPaths.DATE_REF_FIELD).asText(); - JsonNode requestQueryMaps = null; - ObjectNode objectNode = null; - ObjectMapper mapper = new ObjectMapper(); - Map esFilterMap = new HashMap<>(); - try { - requestQueryMaps = new ObjectMapper().readTree(rqMs); - request.setEsFilters(esFilterMap); - if(query.get(Constants.JsonPaths.MODULE).asText().equals(Constants.Modules.COMMON) && - !request.getModuleLevel().equals(Constants.Modules.HOME_REVENUE) && - !request.getModuleLevel().equals(Constants.Modules.HOME_SERVICES)) { - request.getFilters().put(Constants.Filters.MODULE, request.getModuleLevel()); - } - Iterator> filtersItr = request.getFilters().entrySet().iterator(); - while(filtersItr.hasNext()) { - Entry entry = filtersItr.next(); - if(null != requestQueryMaps.get(entry.getKey()) && !String.valueOf(entry.getValue()).equals(Constants.Filters.FILTER_ALL)) { - // Filters in put filters are added as esfilters usign mapping in requestQueryMap - String esQueryKey = requestQueryMaps.get(entry.getKey()).asText(); - request.getEsFilters().put(esQueryKey, entry.getValue()); - } - } - - ElasticSearchDictator dictator = elasticSearchDao.createSearchDictatorV2(request, indexName, "", dateReferenceField); - - SearchRequest searchRequest = elasticSearchDao.buildElasticSearchQuery(dictator); - JsonNode querySegment = mapper.readTree(searchRequest.source().toString()); - objectNode = (ObjectNode) querySegment; - JsonNode aggrNode = mapper.readTree(aggrQuery).get(Constants.JsonPaths.AGGS); - objectNode.put(Constants.JsonPaths.AGGS, mapper.readTree(aggrQuery).get(Constants.JsonPaths.AGGS)); - } catch (Exception ex) { - logger.error("Encountered an Exception while parsing the JSON : " + ex.getMessage()); - throw new RuntimeException(ex); - } - return objectNode; - - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RestService.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RestService.java deleted file mode 100644 index ffca86a4330..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RestService.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.tarento.analytics.service.impl; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.tomcat.util.codec.binary.Base64; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.http.*; -import org.springframework.stereotype.Component; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import java.io.IOException; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; - -import static com.tarento.analytics.constant.Constants.MDMSKeys.TENANTID_MDC_STRING; -import static javax.servlet.http.HttpServletRequest.BASIC_AUTH; -import static org.apache.commons.codec.CharEncoding.US_ASCII; -import static org.springframework.http.HttpHeaders.AUTHORIZATION; - -@Component -public class RestService { - public static final Logger LOGGER = LoggerFactory.getLogger(RestService.class); - - @Value("${services.esindexer.host}") - private String indexServiceHost; - @Value("${egov.services.esindexer.host.search}") - private String indexServiceHostSearch; - @Value("${services.esindexer.host}") - private String dssindexServiceHost; - @Value("${egov.es.username}") - private String userName; - @Value("${egov.es.password}") - private String password; - - @Value("${egov.statelevel.tenantId}") - private String stateLevelTenantId ; - - @Autowired - private RetryTemplate retryTemplate; - - - /** - * search on Elastic search for a search query - * @param index elastic search index name against which search operation - * @param searchQuery search query as request body - * @return - * @throws IOException - */ - - public JsonNode search(String index, String searchQuery) { - //System.out.println("INSIDE REST"); - String url =( indexServiceHost) + index + indexServiceHostSearch; - HttpHeaders headers = getHttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - //LOGGER.info("Index Name : " + index); - //LOGGER.info("Searching ES for Query: " + searchQuery); - HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); - String reqBody = requestEntity.getBody(); - JsonNode responseNode = null; - - try { - ResponseEntity response = retryTemplate.postForEntity(url, requestEntity); - responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); - //LOGGER.info("RestTemplate response :- "+responseNode); - - } catch (HttpClientErrorException e) { - e.printStackTrace(); - LOGGER.error("client error while searching ES : " + e.getMessage()); - } - return responseNode; - } - - /** - * makes a client rest api call of Http POST option - * @param uri - * @param authToken - * @param requestNode - * @return - * @throws IOException - */ - public JsonNode post(String uri, String authToken, JsonNode requestNode) { - - HttpHeaders headers = new HttpHeaders(); - if(authToken != null && !authToken.isEmpty()) - headers.add("Authorization", "Bearer "+ authToken ); - headers.setContentType(MediaType.APPLICATION_JSON); - - // This line of code is only for central instance changes - headers.set(TENANTID_MDC_STRING,stateLevelTenantId); - - LOGGER.info("Request URI: " + uri + ", Node: " + requestNode); - HttpEntity requestEntity = null; - if(requestNode != null ) requestEntity = new HttpEntity<>(requestNode.toString(), headers); - else requestEntity = new HttpEntity<>("{}", headers); - - JsonNode responseNode = null; - - try { - ResponseEntity response = retryTemplate.postForEntity(uri,requestEntity); - responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); - LOGGER.info("RestTemplate response :- "+responseNode); - - } catch (HttpClientErrorException e) { - LOGGER.error("post client exception: " + e.getMessage()); - } - return responseNode; - } - - /** - * makes a client rest api call of Http GET option - * @param uri - * @param authToken - * @return - * @throws IOException - */ - public JsonNode get(String uri, String authToken) { - - HttpHeaders headers = new HttpHeaders(); - headers.add("Authorization", "Bearer "+ authToken ); - headers.setContentType(MediaType.APPLICATION_JSON); - HttpEntity headerEntity = new HttpEntity<>("{}", headers); - - JsonNode responseNode = null; - try { - ResponseEntity response = retryTemplate.getForEntity(uri, headerEntity); - responseNode = new ObjectMapper().convertValue(response.getBody(), JsonNode.class); - LOGGER.info("RestTemplate response :- "+responseNode); - - } catch (HttpClientErrorException e) { - LOGGER.error("get client exception: " + e.getMessage()); - } - return responseNode; - } - - - private HttpHeaders getHttpHeaders() { - HttpHeaders headers = new HttpHeaders(); - headers.add(AUTHORIZATION, getBase64Value(userName, password)); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - headers.setContentType(MediaType.APPLICATION_JSON); - - List mediaTypes = new ArrayList<>(); - mediaTypes.add(MediaType.APPLICATION_JSON); - headers.setAccept(mediaTypes); - return headers; - } - - /** - * Helper Method to create the Base64Value for headers - * - * @param userName - * @param password - * @return - */ - private String getBase64Value(String userName, String password) { - String authString = String.format("%s:%s", userName, password); - byte[] encodedAuthString = Base64.encodeBase64(authString.getBytes(Charset.forName(US_ASCII))); - return String.format(BASIC_AUTH, new String(encodedAuthString)); - } - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RetryTemplate.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RetryTemplate.java deleted file mode 100644 index e4f1f59f825..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/service/impl/RetryTemplate.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.tarento.analytics.service.impl; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.retry.annotation.Backoff; -import org.springframework.retry.annotation.Retryable; -import org.springframework.stereotype.Component; -import org.springframework.web.client.ResourceAccessException; -import org.springframework.web.client.RestTemplate; -import javax.naming.ServiceUnavailableException; - -/** - * Wraps rest template with retry - */ -@Component -public class RetryTemplate { - - @Autowired - private RestTemplate restTemplate; - - @Retryable(value = {RuntimeException.class, ResourceAccessException.class, ServiceUnavailableException.class}, - maxAttemptsExpression = "#{${service.retry.maxAttempts}}", - backoff = @Backoff(delayExpression = "#{${service.retry.backoff.delay}}")) - public ResponseEntity postForEntity(String url, Object request) { - return restTemplate.postForEntity(url, request, Object.class); - } - - @Retryable(value = {RuntimeException.class, ResourceAccessException.class, ServiceUnavailableException.class}, - maxAttemptsExpression = "#{${service.retry.maxAttempts}}", - backoff = @Backoff(delayExpression = "#{${service.retry.backoff.delay}}")) - public ResponseEntity getForEntity(String url, HttpEntity headerEntity) { - return restTemplate.exchange(url, HttpMethod.GET, headerEntity, Object.class); - } - -} - diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ElasticProperties.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ElasticProperties.java deleted file mode 100644 index c27e7b79a5c..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ElasticProperties.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.tarento.analytics.utils; - -public interface ElasticProperties { - - public interface Property { - final String TRANSACTION_TRANSDATE = "TransDate"; - final String TRANSACTION_STOREID = "StoreId"; - final String TRANSACTION_NETAMOUNT = "NetAmt"; - final String TARGET_TARGETDATE = "targetDate"; - final String TARGET_STORECODE = "storeCode"; - final String TARGET_VERSION = "version"; - final String TARGET_SALESVALUE = "salesValue"; - final String TARGET_AVGVALUE = "avgValue"; - final String TARGET_RECEIPTVALUE = "receiptsValue"; - final String ITEM_DETAILS_CATEGORY_ID = "itemDetails.categoryId"; - final String ITEM_DETAILS_PRICE = "itemDetails.price" ; - final String AVERAGE_RATING = "AvgRating"; - final String SORT_ORDER_DESCENDING = "desc"; - final String SORT_ORDER_ASCENDING = "asc"; - final String COUNTS = "counts"; - final String COUNTS_RATING = "CountsRating"; - final String FEEDBACK_VALUE_RESPONSE = "feedback_value"; - } - - public interface SuccessMessages { - final String STORE_USER = "User and Store successfully mapped" ; - final String STORE_TIMING = "Store Times entered successfully" ; - } - - public interface Query { - final String NESTED = "NESTED"; - final String MATCH_CONDITION = "MATCH"; - final String RANGE_CONDITION = "RANGE"; - final String AGGREGATION_CONDITION = "AGGREGATION"; - final String TRANSACTION_DATE_FIELD = "transDate"; - final String FEEDBACK_DATE_TIME = "serverDateTime"; - final String COUNT_STORE_CODE = "storeId"; - final String COUNT_RATING_VALUE = "value"; - final String COUNT_REASON_KEYWORD = "reasons.keyword"; - final String COUNT_GENDER_KEYWORD = "gender.keyword"; - final String COUNT_AGEGROUP_KEYWORD = "ageGroup.keyword"; - final String SUM = "SUM"; - final String VALUE_COUNT="value_count"; - final String AVG = "AVG"; - final String CUMMULATIVE_SUM="cumulative_sum"; - final String FIELD = "FIELD"; - final String COUNT = "COUNT"; - final String BUCKETS_PATH = "BUCKETS_PATH"; - final String DATE_HISTOGRAM = "DATE_HISTOGRAM"; - final String EXTENDED_BOUNDS = "EXTENDED_BOUNDS"; - final String PATH ="PATH"; - final String MIN = "MIN"; - final String MAX = "MAX"; - final String INTERVAL = "INTERVAL"; - final String HOUR ="HOUR"; - final String DAY ="DAY"; - final String DAY_OF_WEEK ="dayOfWeek"; - final String ASC="ASC"; - final String DESC ="DESC"; - - final String MINUTE ="MINUTE"; - final String MONTH ="MONTH"; - final String TERM ="TERMS"; - final String SIZE="SIZE"; - final String ORDER="ORDER"; - final Integer TOP_CSAT_STORE_COUNT = 5; - final String LABEL="label"; - - - - } - -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ElasticSearchClient.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ElasticSearchClient.java deleted file mode 100644 index b25f722850d..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ElasticSearchClient.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.tarento.analytics.utils; - -import org.apache.http.HttpHost; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.client.RestHighLevelClient; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - - -@Component -public class ElasticSearchClient { - private final String hostName; - private final Integer port; - private final static String HTTP = "http"; - private final Integer topPerformanceCount; - private final String transactionIndex; - private final String transactionType; - private final String targetIndex; - private final String targetType; - - public ElasticSearchClient(@Value("${services.esindexer.host.name}") String hostName, - @Value("${services.esindexer.host.port}") Integer port, - @Value("${top.performance.record.count}") Integer topPerformanceCount, - @Value("${es.index.name}") String transactionIndex, - @Value("${es.document.type}") String transactionType, - @Value("${es.target.index.name}") String targetIndex, - @Value("${es.target.document.type}") String targetType){ - - this.hostName = hostName; - this.port = port; - this.topPerformanceCount = topPerformanceCount; - this.transactionIndex = transactionIndex; - this.transactionType = transactionType; - this.targetIndex = targetIndex; - this.targetType = targetType; - - } - - public RestHighLevelClient getClient() { - return new RestHighLevelClient( - RestClient.builder(new HttpHost(hostName, port,HTTP))); - - } - - - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/JSONObjectUtil.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/JSONObjectUtil.java deleted file mode 100644 index 6a7e33e2c36..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/JSONObjectUtil.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.tarento.analytics.utils; -import org.springframework.beans.factory.annotation.Autowired; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.gson.Gson; - -public class JSONObjectUtil { - @Autowired - public ObjectMapper mapper; - @Autowired - public Gson gson; - - - /** - * @return - */ - public static String getJsonString(ObjectMapper objectMapper,Object object) throws JsonProcessingException { - if(objectMapper != null){ - return objectMapper.writeValueAsString(object); - } - return null; - } - - public ObjectMapper getMapper() { - return mapper; - } - - public void setObjectMapper(ObjectMapper objectMapper){ - mapper=objectMapper; - } - - public Gson getGson() { - return gson; - } - - public void setGson(Gson gsonn) - { - gson = gsonn; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/JsonKey.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/JsonKey.java deleted file mode 100644 index d60097bc794..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/JsonKey.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.tarento.analytics.utils; - -/** - * @author Satish - * - */ -public class JsonKey { - - public static final String STATUS_CODE = "statusCode"; - public static final String STATUS = "statusInfo"; - public static final String STATUS_MESSAGE = "statusMessage"; - public static final String ERROR_MESSAGE = "errorMessage"; - - public static final String RESPONSE_DATA = "responseData"; - - -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/PathRoutes.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/PathRoutes.java deleted file mode 100644 index 75e90b40ca2..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/PathRoutes.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.tarento.analytics.utils; - -public interface PathRoutes { - - public interface DashboardApi { - final String DASHBOARD_ROOT_PATH = "/dashboard"; - - final String TEST_PATH = "/test"; - final String FILE_PATH = "/files"; - - final String GET_CHART = "/getChart"; - final String GET_CHART_V2 = "/getChartV2"; - final String GET_CHART_V3 = "/getChartV3"; - final String GET_DASHBOARD_CONFIG = "/getDashboardConfig"; - final String GET_HOME_CONFIG = "/getHomeConfig"; - final String GET_ALL_VISUALIZATIONS = "/getAllVisualizations"; - final String ADD_NEW_DASHBOARD = "/addNewDashboard"; - final String MAP_DASHBOARD_VISUALIZATIOn = "/mapVisualizationToDashboard"; - final String MAP_VISUALIZATION_ROLE = "/mapVisualizationToRole"; - final String GET_HEADER_DATA = "/getDashboardHeader"; - final String GET_FEEDBACK_MESSAGE="/getPulseFeedbackMessage"; - final String TARGET_DISTRICT_ULB = "/targetDistrict"; - - } - - public interface MetadataApi { - final String METADATA_ROOT_PATH = "/meta"; - - final String GET_CATEGORIES = "/getCategories"; - final String GET_SUB_CATEGORIES = "/getSubCategories"; - final String GET_ITEMS = "/getItems"; - final String GET_MASTERS = "/getMasters"; - final String FLUSH_MASTERS = "/flushMasters"; - final String GET_PULSE_RATING_CONFIG="/getPulseRatingConfig"; - final String GET_RATING_CONFIG = "/getRatingConfiguration"; - final String GET_RATING_CONFIG_ENCODE = "/getRatingConfig"; - final String GET_CONFIG_VERSION = "/getConfigVersion"; - final String PULSE_VERIFY_ORG_PIN = "/verifyOrgs"; - final String PUT_ORG_INDEX ="/putIndex"; - final String PUT_QUERY ="/createQuery"; - - - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ResponseCode.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ResponseCode.java deleted file mode 100644 index ac4dc39622e..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ResponseCode.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.tarento.analytics.utils; - -import com.tarento.analytics.constant.Constants; - -/** - * - * @author Abhishek - * - */ -public enum ResponseCode { - UnAuthorised(Constants.UNAUTHORIZED_ID, Constants.UNAUTHORIZED), Success( - Constants.SUCCESS_ID, Constants.SUCCESS),FAILURE( - Constants.FAILURE_ID, Constants.PROCESS_FAIL); - /** - * error code contains int value - */ - private int errorCode; - /** - * errorMessage contains proper error message. - */ - private String errorMessage; - - - - /** - * @param errorCode - * @param errorMessage - */ - private ResponseCode(int errorCode, String errorMessage) { - this.errorCode = errorCode; - this.errorMessage = errorMessage; - } - - /** - * - * @param errorCode - * @return - */ - public String getMessage(int errorCode) { - return ""; - } - - /** - * @return - */ - public int getErrorCode() { - return errorCode; - } - - /** - * @param errorCode - */ - public void setErrorCode(int errorCode) { - this.errorCode = errorCode; - } - - /** - * @return - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * @param errorMessage - */ - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - /** - * This method will provide status message based on code - * - * @param code - * @return String - */ - public static String getResponseMessage(int code) { - String value = ""; - ResponseCode responseCodes[] = ResponseCode.values(); - for (ResponseCode actionState : responseCodes) { - if (actionState.getErrorCode() == code) { - value = actionState.getErrorMessage(); - } - } - return value; - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ResponseGenerator.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ResponseGenerator.java deleted file mode 100644 index ed7a8984582..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ResponseGenerator.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.tarento.analytics.utils; - - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; - -public class ResponseGenerator { - - - private static ObjectMapper objectMapper = new ObjectMapper(); - - public static String failureResponse() throws JsonProcessingException{ - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.FAILURE.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, - ResponseCode.FAILURE.getErrorMessage()); - response.put(JsonKey.ERROR_MESSAGE, - ResponseCode.FAILURE.getErrorMessage()); - return JSONObjectUtil.getJsonString(objectMapper,response); - } - - - public static String failureResponse(String message) throws JsonProcessingException{ - ObjectNode actualResponse = objectMapper.createObjectNode(); - - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.FAILURE.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, - ResponseCode.FAILURE.getErrorMessage()); - response.put(JsonKey.ERROR_MESSAGE,message); - actualResponse.putPOJO(JsonKey.STATUS,response); - - return JSONObjectUtil.getJsonString(objectMapper,actualResponse); - } - - public static String failureResponse(String errorCode, String message) throws JsonProcessingException{ - ObjectNode actualResponse = objectMapper.createObjectNode(); - - ObjectNode response = objectMapper.createObjectNode(); - response.put(errorCode, message); - response.put(JsonKey.STATUS_MESSAGE, - message); - response.put(JsonKey.ERROR_MESSAGE,message); - actualResponse.putPOJO(JsonKey.STATUS,response); - - return JSONObjectUtil.getJsonString(objectMapper,actualResponse); - } - - public static String successResponse(Object obj) throws JsonProcessingException { - ObjectNode actualResponse = objectMapper.createObjectNode(); - - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.Success.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, ResponseCode.Success.getErrorMessage()); - response.put(JsonKey.ERROR_MESSAGE, ""); - actualResponse.putPOJO(JsonKey.STATUS,response); - if (obj != null) { - actualResponse.putPOJO(JsonKey.RESPONSE_DATA, obj); - } - - return JSONObjectUtil.getJsonString(objectMapper,actualResponse); - } - - /** - * this method will crate success response and send to controller. - * - * @return ObjectNode object. - */ - public static String successResponse(String message) throws JsonProcessingException{ - ObjectNode actualResponse = objectMapper.createObjectNode(); - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.Success.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, - ResponseCode.Success.getErrorMessage()); - //response.put(JsonKey.SUCCESS_MESSAGE, message); - actualResponse.putPOJO(JsonKey.STATUS,response); - response.put(JsonKey.ERROR_MESSAGE, ""); - actualResponse.putPOJO(JsonKey.STATUS,response); - if (message != null) { - actualResponse.putPOJO(JsonKey.RESPONSE_DATA, message); - } - - return JSONObjectUtil.getJsonString(objectMapper,actualResponse); - } -} diff --git a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ResponseRecorder.java b/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ResponseRecorder.java deleted file mode 100644 index 5003d37a5ed..00000000000 --- a/business-services/dashboard-analytics/src/main/java/com/tarento/analytics/utils/ResponseRecorder.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.tarento.analytics.utils; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.web.context.annotation.RequestScope; - -import com.tarento.analytics.constant.Constants; - -//@Component("responseRecorder") -public class ResponseRecorder { - - private static Logger logger = LoggerFactory.getLogger(ResponseRecorder.class); - public static HashMap> requestModuleResponseMap = new HashMap<>(); - - public Object get(String visualizationCode, String module) { - if(!StringUtils.isNotBlank(module)) { - module = Constants.Modules.COMMON.toString(); - } - if(requestModuleResponseMap.get(visualizationCode) != null && requestModuleResponseMap.get(visualizationCode).get(module) != null) { - return requestModuleResponseMap.get(visualizationCode).get(module); - } - return null; - } - - - public Boolean put(String visualizationCode, String module, Object object) { - if(!StringUtils.isNotBlank(module)) { - module = Constants.Modules.COMMON.toString(); - } - if(requestModuleResponseMap.containsKey(visualizationCode)) { - Map innerMap = requestModuleResponseMap.get(visualizationCode); - innerMap.put(module, object); - } else { - Map innerMap = new HashMap<>(); - innerMap.put(module, object); - requestModuleResponseMap.put(visualizationCode, innerMap); - } - return Boolean.TRUE; - } - - -} diff --git a/business-services/dashboard-analytics/src/main/resources/application.properties b/business-services/dashboard-analytics/src/main/resources/application.properties deleted file mode 100644 index 242c406d24d..00000000000 --- a/business-services/dashboard-analytics/src/main/resources/application.properties +++ /dev/null @@ -1,57 +0,0 @@ -server.port=8280 -server.context-path=/dashboard-analytics -server.servlet.context-path=/dashboard-analytics - -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration - -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/test -spring.datasource.username=postgres -spring.datasource.password=postgres - - -#----------------------------- ELASTIC SEARCH CONFIGURATIONS ------------------------------# -services.esindexer.host=http://localhost:9200/ -services.esindexer.host.name=http://localhost -services.esindexer.host.port=9200 -services.esindexer.username=changeme -services.esindexer.password=changeme -es.index.name=_transaction -es.document.type=transaction -es.target.index.name=store_target -es.target.document.type=storeTarget -#egov.mdms-service.target.url=https://dev.digit.org/egov-mdms-service/v1/_get?masterName=tenants&moduleName=tenant&tenantId=pb -config.schema.paths=classpath*:schema/*.json - -#----------------------------- MISCELLANEOUS CONFIGURATION ----------------------------------# -top.performance.record.count=5 - -egov.services.esindexer.host.search=/_search -management.endpoints.web.base-path=/ - -egov.es.username=egov-admin -egov.es.password=TUSYns9mEcRPy77n - -#----------------------------- AMAZON S3 CREDENTIALS -------------------------------------------------# -aws.access.key.id = -aws.access.key.secret = -aws.region = ap-south-1 -aws.s3.audio.bucket = dss-project-bucket - -#---------------------------- MDMS ---------------------------------------------------------------------# -egov.statelevel.tenantId=pb - -egov.mdms.host=https://qa.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search - - -#Paramters for naming file for internal storage -filename.length=10 -filename.useletters=true -filename.usenumbers=false - -# CACHE CONFIG -cache.expiry.time.in.minutes=10 -cache.capacity=120 - -egov.targetacheivement.chartname.list=demandCollectionIndexDDRRevenue,demandCollectionIndexBoundaryRevenue,licenseIssuedDDRRevenue,licenseIssuedBoundaryRevenue diff --git a/business-services/dashboard-analytics/src/main/resources/application.properties.j2 b/business-services/dashboard-analytics/src/main/resources/application.properties.j2 deleted file mode 100644 index 2b63c74159d..00000000000 --- a/business-services/dashboard-analytics/src/main/resources/application.properties.j2 +++ /dev/null @@ -1,75 +0,0 @@ -server.port=8089 - - -spring.datasource.url={{ datasource_url | b64decode }} -spring.datasource.username={{ datasource_user | b64decode }} -spring.datasource.password={{ datasource_pwd | b64decode }} -spring.datasource.driver-class-name=com.mysql.jdbc.Driver - -#----------------------------- ELASTIC SEARCH CONFIGURATIONS ------------------------------# -services.esindexer.host={{ es_host | b64decode }} -services.esindexer.host.name={{ es_host_name | b64decode }} -services.esindexer.host.port=9200 -services.esindexer.username={{ es_user | b64decode }} -services.esindexer.password={{ es_pwd | b64decode }} -es.index.name=_transaction -es.document.type=transaction -es.transaction.index.name=_transaction -es.transaction.document.type=transaction -es.target.index.name=store_target -es.target.document.type=storeTarget -es.index.name.storeTarget=store_target -es.index.name.feedback=_app_feedback -es.index.name.storeFeedback=rain_feedback -es.document.type.storeTarget=storeTarget -es.document.type.feedback=appFeedback -es.document.type.storeFeedback=rainFeedback - -#---------------------------------Microservice details------------------------------------# -services.user.host.name=localhost -services.user.host.port=8081 -services.user.host.url=/user - -#----------------------------- MISCELLANEOUS CONFIGURATION ----------------------------------# -top.performance.store.count=5 - -#------------------------------ KAFKA CONFIGURATIONS ------------------------------# - -# KAFKA SERVER CONFIGURATIONS -kafka.config.bootstrap_server_config=localhost:9092 - -spring.kafka.consumer.value-deserializer=com.tarento.analytics.consumer.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=rain-transaction-chain -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer - -# KAFKA CONSUMER CONFIGURATIONS -kafka.consumer.config.auto_commit=true -kafka.consumer.config.auto_commit_interval=100 -kafka.consumer.config.session_timeout=15000 -kafka.consumer.config.group_id=rain-transaction-chain -kafka.consumer.config.auto_offset_reset=earliest - -# KAFKA PRODUCER CONFIGURATIONS -kafka.producer.config.retries_config=0 -kafka.producer.config.batch_size_config=100000 -kafka.producer.config.linger_ms_config=100 -kafka.producer.config.buffer_memory_config=66554432 - -#--------------------------- KAFKA TOPICS TO CONSUME ---------------------------# - -kafka.topics.notify.newmessage.name=NewContentMessage -kafka.topics.notify.newmessage.key=content - -kafka.topics.transaction.pushdata.name=RainTransactionData -kafka.topics.transaction.pushdata.key=transactiondata - -kafka.topics.target.pushdata.name=NewTargetData -kafka.topics.target.pushdata.key=targetdata - -kafka.topics.feedback.pushdata.name=NewFeedbackData -kafka.topics.feedback.pushdata.key=feedbackdata - -kafka.topics.rating.pushdata.name=RainRatingData -kafka.topics.rating.pushdata.key=ratingdata \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/resources/schema/ChartApiConfig.json b/business-services/dashboard-analytics/src/main/resources/schema/ChartApiConfig.json deleted file mode 100644 index 94bc6b15a8f..00000000000 --- a/business-services/dashboard-analytics/src/main/resources/schema/ChartApiConfig.json +++ /dev/null @@ -1,4790 +0,0 @@ -{ - "wardDrillDown": { - "kind": "drillDown", - "chartName": "Ward", - "queries": [ - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\",\"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\r\n \"AGGR\":{\r\n \"filter\":{\r\n \"bool\":{\r\n \"must_not\":[\r\n {\r\n \"term\":{\r\n \"dataObject.tenantId.keyword\":\"tenant\"\r\n }\r\n },\r\n {\r\n \"terms\":{\r\n \"dataObject.paymentDetails.bill.status.keyword\":[\r\n \"Cancelled\"\r\n ]\r\n }\r\n }\r\n ]\r\n }\r\n },\r\n \"aggs\":{\r\n \"Ward \":{\r\n \"terms\":{\r\n \"field\":\"domainObject.ward.name.keyword\",\r\n \"size\":200\r\n },\r\n \"aggs\":{\r\n \"ULB\":{\r\n \"terms\":{\r\n \"field\":\"domainObject.tenantId.keyword\",\r\n \"size\":200\r\n },\r\n \"aggs\":{\r\n \"Receipt Number\":{\r\n \"terms\":{\r\n \"field\":\"dataObject.paymentDetails.receiptNumber.keyword\"\r\n },\r\n \"aggs\":{\r\n \"Amount Collected\":{\r\n \"sum\":{\r\n \"field\":\"dataObject.paymentDetails.totalAmountPaid\"\r\n }\r\n },\r\n \"Payment Mode\":{\r\n \"terms\":{\r\n \"field\":\"dataObject.paymentMode.keyword\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }}" - } - ], - "chartType": "table", - "valueType": "number", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "plotLabel": "Ward", - "aggregationPaths": [ - "ULB", - "Receipt Number", - "Amount Collected", - "Payment Mode" - ], - "pathDataTypeMapping": [ - { - "ULB": "string" - }, - { - "Receipt Number": "string" - }, - { - "Amount Collected": "amount" - }, - { - "Payment Mode": "string" - } - ], - "insight": { - }, - "_comment": "" - }, - - - "todaysCollectionv2": { - "chartName": "DSS_TODAYS_COLLECTION", - "queries": [ - { - "module": "PT", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\"}", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"term\":{\"dataObject.paymentDetails.bill.billDetails.businessService.keyword\":\"PT\"}},{\"range\":{\"dataObject.paymentDetails.receiptDate\":{\"gt\":\"now-1d/d\",\"lte\":\"now\"}}}]}},\"aggs\":{\"Todays Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}" - }, - { - "module": "TL", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\"}", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"term\":{\"dataObject.paymentDetails.bill.billDetails.businessService.keyword\":\"TL\"}},{\"range\":{\"dataObject.paymentDetails.receiptDate\":{\"gt\":\"now-1d/d\",\"lte\":\"now\"}}}]}},\"aggs\":{\"Todays Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}" - } - ], - "chartType": "metric", - "valueType": "Amount", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "aggregationPaths": [ - "Todays Collection" - ], - "insight": { - "chartResponseMap" : "totalCollection", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " " - }, - - "totalCollectionv2": { - "chartName": "DSS_TOTAL_COLLECTION", - "queries": [ - { - "module": "PT", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\"}", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"term\":{\"dataObject.paymentDetails.businessService.keyword\":\"PT\"}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}" - }, - { - "module": "TL", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\"}", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"term\":{\"dataObject.paymentDetails.businessService.keyword\":\"TL\"}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}" - } - ], - "chartType": "metric", - "valueType": "Amount", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "aggregationPaths": [ - "Total Collection" - ], - "insight": { - "chartResponseMap" : "totalCollection", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " " - }, - - "targetAchievedv2": { - "chartName": "DSS_TARGET_ACHIEVED", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\r\n \"module\" : \"businessService.keyword\", \n\"tenantId\" : \"tenantIdForMunicipalCorporation\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Actual collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"module\" : \"dataObject.paymentDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}" - } - - ], - "chartType": "metric", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "aggregationPaths": [ - "Total Collection", - "Actual collection" - ], - "insight": { - "chartResponseMap" : "targetAchieved", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " " - }, - "cumulativeCollectionv2": { - "chartName": "DSS_TOTAL_CUMULATIVE_COLLECTION", - "queries": [ - { - "module": "COMMON", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"module\" : \"dataObject.paymentDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"PT\",\"TL\"]}}]}},\"aggs\":{\"Collections\":{\"date_histogram\":{\"field\":\"dataObject.paymentDetails.receiptDate\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "line", - "valueType": "amount", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Collections" - ], - "isCumulative": true, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - "topPerformingUlbsv2": { - "chartName": "DSS_PT_TOP_3_PERFORMING_ULBS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\r\n \"module\" : \"businessService.keyword\", \n\"tenantId\" : \"tenantIdForMunicipalCorporation\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"desc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"module\" : \"dataObject.paymentDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"desc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "perform", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "plotLabel": "DSS_TARGET_ACHIEVED", - "order": "desc", - "limit": 3, - "aggregationPaths": [ - "Total Collection","Target Collection" - ], - "insight": { - }, - "_comment": " Top Performing Ulbs for target achieved" - }, - "bottomPerformingUlbsv2": { - "chartName": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\",\"tenantId\" : \"tenantIdForMunicipalCorporation\" }", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"asc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"module\" : \"dataObject.paymentDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"asc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "perform", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "plotLabel": "DSS_TARGET_ACHIEVED", - "order": "asc", - "limit": 3, - "aggregationPaths": [ - "Total Collection", "Target Collection" - ], - "insight": { - }, - "_comment": " Bottom Performing Ulbs for target achieved" - }, - - "collectionByUsageTypev2": { - "chartName": "DSS_PT_COLLECTION_BY_USAGE_TYPE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"module\" : \"dataObject.paymentDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"attrs_root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"Usage Type\":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"size\":200}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "amount", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Usage Type" - ], - "insight": { - }, - "_comment": " collection/amount per usage type" - }, - - - "demandCollectionIndexDDRRevenuev2": { - "chartName": "DSS_PT_KEY_FY_INDICATORS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.paymentDetails.id.keyword\"}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "demandCollectionIndexBoundaryRevenuev2", - "action": "", - "plotLabel": "DDRs", - "isPostResponseHandler": true, - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "demandCollectionIndexBoundaryRevenuev2": { - "chartName": "DSS_PT_DEMAND_COLLECTION_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.paymentDetails.id.keyword\"}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":1000},\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "postAggregationTheory" : "repsonseToDifferenceOfDates", "chartType": "table", - "valueType": "number", - "drillChart": "boundaryDrillDownv2", - "drillFields": [ - "Ward", - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "boundaryDrillDown": { - "kind": "drillDown", - "chartName": "Boundary", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"domainObject.ward.name.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.paymentDetails.id.keyword\"}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}" - } - ], - "chartType": "table", - "valueType": "number", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "plotLabel": "Ward", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "demandCollectionIndexUsageRevenuev2": { - "chartName": "DSS_PT_DEMAND_COLLECTION_USAGETYPE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"UsageType \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"reverse_nested\":{},\"aggs\":{\"top_tags_per_comment\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}},\"Transactions\":{\"reverse_nested\":{},\"aggs\":{\"top_tags_per_comment\":{\"cardinality\":{\"field\":\"dataObject.paymentDetails.id.keyword\"}}}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"attr\":{\"cardinality\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - - ], - "chartType": "table", - "valueType": "number", - "drillChart": "", - "drillFields": [ - "Ward", - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Usage Type", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties" - - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - - "taxHeadsBreakupDDRRevenuev2": { - "chartName": "DSS_PT_TAX_HEAD_BREAKUP_REVENUE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.totalAmount\"}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Time Interest\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_INTEREST\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Round Off\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_ROUNDOFF\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "taxHeadsBreakupRevenuev2", - "isPostResponseHandler": true, - "documentType": "_doc", - "action": "", - "plotLabel": "DDRs", - "aggregationPaths": [ - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty", - "Time Interest","Round Off" - ], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "AdditiveComputedField", - "fields" : [ "PT Tax", "Fire Cess", "Cancer Cess", "Rebate", "Penalty", "Time Interest","Round Off"], - "newField" : "Total Amount", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - "insight": { - }, - "_comment": "" - }, - "taxHeadsBreakupRevenuev2": { - "chartName": "DSS_PT_TAX_HEAD_BREAKUP_REVENUE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"bucket_script\":{\"buckets_path\":{\"c1\":\"PT Tax>aggrFilter>amount\",\"c2\":\"Fire Cess>aggrFilter>amount\",\"c3\":\"Cancer Cess>aggrFilter>amount\",\"c4\":\"Rebate>aggrFilter>amount\",\"c5\":\"Penalty>aggrFilter>amount\",\"c6\":\"Time Interest>aggrFilter>amount\",\"c7\":\"Round Off>aggrFilter>amount\"},\"script\":{\"source\":\"params.c1+params.c2+params.c3+params.c4+params.c5+params.c6+params.c7\"}}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Time Interest\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_INTEREST\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Round Off\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_ROUNDOFF\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "taxHeadsBreakupBoundaryDrillv2", - "drillFields": [ - "Ward", - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty", - "Time Interest","Round Off", "Total Amount" - ], - - "insight": { - }, - "_comment": "" - }, - "taxHeadsBreakupBoundaryDrillv2": { - "chartName": "Tax head Breakup boundary", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"domainObject.ward.name.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"bucket_script\":{\"buckets_path\":{\"c1\":\"PT Tax>aggrFilter>amount\",\"c2\":\"Fire Cess>aggrFilter>amount\",\"c3\":\"Cancer Cess>aggrFilter>amount\",\"c4\":\"Rebate>aggrFilter>amount\",\"c5\":\"Penalty>aggrFilter>amount\",\"c6\":\"Time Interest>aggrFilter>amount\",\"c7\":\"Round Off>aggrFilter>amount\"},\"script\":{\"source\":\"params.c1+params.c2+params.c3+params.c4+params.c5+params.c6+params.c7\"}}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Time Interest\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_INTEREST\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Round Off\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_ROUNDOFF\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "", - "drillFields": [ - "Ward", - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty", - "Time Interest","Round Off","Total Amount" - ], - - "insight": { - }, - "_comment": "" - }, - "taxHeadsBreakupUsagev2": { - "chartName": "DSS_PT_TAX_HEAD_BREAKUP_USAGE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"attrs_root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"Usage \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"bucket_script\":{\"buckets_path\":{\"c1\":\"PT Tax>aggrFilter>amount\",\"c2\":\"Fire Cess>aggrFilter>amount\",\"c3\":\"Cancer Cess>aggrFilter>amount\",\"c4\":\"Rebate>aggrFilter>amount\",\"c5\":\"Penalty>aggrFilter>amount\",\"c6\":\"Time Interest>aggrFilter>amount\",\"c7\":\"Round Off>aggrFilter>amount\"},\"script\":{\"source\":\"params.c1+params.c2+params.c3+params.c4+params.c5+params.c6+params.c7\"}}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Time Interest\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_INTEREST\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Round Off\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_ROUNDOFF\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}}}" - } - ], - "filterKeys": [ - - ], - "chartType": "table", - "valueType": "number", - "drillChart": "", - "documentType": "_doc", - "action": "", - "plotLabel": "Usage Type", - "aggregationPaths": [ - "Total Amount", - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty" - ], - "pathDataTypeMapping": [ - { - "Total Amount": "amount" - }, - { - "PT Tax": "amount" - }, - { - "Fire Cess": "amount" - }, - { - "Cancer Cess": "amount" - }, - { - "Rebate": "amount" - }, - { - "Penalty": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - - - "licenseByLicenseTypev2": { - "chartName": "DSS_TL_LICENSE_BY_TYPE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\"}", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"License Instrument Type\":{\"terms\":{\"field\":\"dataObject.paymentMode.keyword\"},\"aggs\":{\"Licens Issued\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "License Instrument Type" - ], - "insight": { - }, - "_comment": " License Application which are issued by License Type" - }, - - "licenseIssuedDDRRevenuev2": { - "chartName": "DSS_TL_KEY_FY_INDICATORS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.paymentDetails.id.keyword\"}},\"Total Licence Issued\":{\"value_count\":{\"field\":\"domainObject.tradelicense.licensenumber.keyword\"}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "isPostResponseHandler": true, - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "chartType": "table", - "valueType": "number", - "drillChart": "licenseIssuedBoundaryRevenuev2", - "documentType": "_doc", - "action": "", - "plotLabel": "DDRs", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Total Licence Issued", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Total Licence Issued": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "licenseIssuedBoundaryRevenuev2": { - "chartName": "DSS_TL_DEMAND_COLLECTION_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.paymentDetails.id.keyword\"}},\"Total Licence Issued\":{\"value_count\":{\"field\":\"domainObject.tradelicense.licensenumber.keyword\"}}}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":1000},\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "chartType": "table", - "valueType": "number", - "drillChart": "licenseIssuedBoundaryDrillDown", - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Total Licence Issued", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Total Licence Issued": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "licenseIssuedBoundaryDrillDownv2": { - "chartName": "", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"domainObject.ward.name.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.paymentDetails.id.keyword\"}},\"Total Licence Issued\":{\"value_count\":{\"field\":\"domainObject.tradelicense.licensenumber.keyword\"}}}}}}}}" - } - ], - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "chartType": "table", - "valueType": "number", - "drillChart": "", - "documentType": "_doc", - "action": "", - "plotLabel": "Ward", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Total Licence Issued", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Total Licence Issued": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - - "licenceTaxHeadsBreakupDDRv2": { - "chartName": "DSS_TL_TAX_HEAD_BREAKUP_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"TL Tax\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Penalty\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Rebate\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "isPostResponseHandlerA": true, - "chartType": "xtable", - "valueType": "number", - "drillChart": "licenceTaxHeadsBreakupBoundaryv2", - "documentType": "_doc", - "action": "", - "plotLabel": "DDRs", - "aggregationPaths": [ - "TL Tax", - "Adhoc Penalty", - "Adhoc Rebate" - ], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "AdditiveComputedField", - "fields" : ["TL Tax", "Adhoc Penalty", "Adhoc Rebate"], - "newField" : "Total Amount", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - - "insight": { - }, - "_comment": "" - }, - "licenceTaxHeadsBreakupBoundaryv2": { - "chartName": "DSS_TL_TAX_HEAD_BREAKUP_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"bucket_script\":{\"buckets_path\":{\"c1\":\"TL Tax>aggrFilter>amount\",\"c2\":\"Adhoc Penalty>aggrFilter>amount\",\"c3\":\"Adhoc Rebate>aggrFilter>amount\"},\"script\":{\"source\":\"params.c1+params.c2+params.c3\"}}},\"TL Tax\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Penalty\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Rebate\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "licenceTaxHeadsBreakupWard", - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "TL Tax", - "Adhoc Penalty", - "Adhoc Rebate","Total Amount" - ], - "insight": { - }, - "_comment": "" - }, - "licenceTaxHeadsBreakupWardv2": { - "chartName": "DSS_TL_TAX_HEAD_BREAKUP_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"domainObject.ward.name.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"bucket_script\":{\"buckets_path\":{\"c1\":\"TL Tax>aggrFilter>amount\",\"c2\":\"Adhoc Penalty>aggrFilter>amount\",\"c3\":\"Adhoc Rebate>aggrFilter>amount\"},\"script\":{\"source\":\"params.c1+params.c2+params.c3\"}}},\"TL Tax\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Penalty\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Rebate\":{\"nested\":{\"path\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "", - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "TL Tax", - "Adhoc Penalty", - "Adhoc Rebate", "Total Amount" - ], - "insight": { - }, - "_comment": "" - }, - - "totalCollectionDeptWisev2": { - "chartName": "DSS_TOTAL_CUMULATIVE_COLLECTION:_DEPARTMENT_WISE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.paymentDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}", - "dateRefField": "dataObject.paymentDetails.receiptDate", - "indexName": "dss-payment_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.bill.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"terms\":{\"dataObject.paymentDetails.businessService.keyword\":[\"PT\",\"TL\"]}}]}},\"aggs\":{\"Business Service\":{\"terms\":{\"field\":\"dataObject.paymentDetails.businessService.keyword\"},\"aggs\":{\"total\":{\"sum\":{\"field\":\"dataObject.paymentDetails.bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "Amount", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "aggregationPaths": [ - "Business Service" - ], - "insight": { - }, - "_comment": " " - }, - - - - - - - - - - - - - - "_comment": "dss-collectionindex new queries ", - "totalCollection": { - "chartName": "DSS_TOTAL_COLLECTION", - "queries": [ - { - "module": "PT", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"term\":{\"dataObject.Bill.billDetails.businessService.keyword\":\"PT\"}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}" - }, - { - "module": "TL", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"term\":{\"dataObject.Bill.billDetails.businessService.keyword\":\"TL\"}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}" - } - ], - "chartType": "metric", - "valueType": "Amount", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "aggregationPaths": [ - "Total Collection" - ], - "insight": { - "chartResponseMap" : "totalCollection", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " " - }, - "cumulativeCollection": { - "chartName": "DSS_TOTAL_CUMULATIVE_COLLECTION", - "queries": [ - { - "module": "COMMON", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"terms\":{\"dataObject.Bill.billDetails.businessService.keyword\":[\"PT\",\"TL\"]}}]}},\"aggs\":{\"Collections\":{\"date_histogram\":{\"field\":\"dataObject.Bill.billDetails.receiptDate\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "line", - "valueType": "amount", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Collections" - ], - "isCumulative": true, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - "targetAchieved": { - "chartName": "DSS_TARGET_ACHIEVED", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\r\n \"module\" : \"businessService.keyword\", \n\"tenantId\" : \"tenantIdForMunicipalCorporation\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Actual collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"district\" : \"dataObject.tenantData.cityDistrictCode\", \"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}" - } - - ], - "chartType": "metric", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "aggregationPaths": [ - "Total Collection", - "Actual collection" - ], - "insight": { - "chartResponseMap" : "targetAchieved", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " " - }, - "todaysCollection": { - "chartName": "DSS_TOTAL_COLLECTION", - "queries": [ - { - "module": "PT", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"term\":{\"dataObject.Bill.billDetails.businessService.keyword\":\"PT\"}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}" - }, - { - "module": "TL", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"term\":{\"dataObject.Bill.billDetails.businessService.keyword\":\"TL\"}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}" - } - ], - "chartType": "metric", - "valueType": "Amount", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "aggregationPaths": [ - "Total Collection" - ], - "insight": { - }, - "_comment": " " - }, - "totalCollectionDeptWise": { - "chartName": "DSS_TOTAL_CUMULATIVE_COLLECTION:_DEPARTMENT_WISE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}],\"must\":[{\"terms\":{\"dataObject.Bill.billDetails.businessService.keyword\":[\"PT\",\"TL\"]}}]}},\"aggs\":{\"Business Service\":{\"terms\":{\"field\":\"dataObject.Bill.billDetails.businessService.keyword\"},\"aggs\":{\"total\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "Amount", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "aggregationPaths": [ - "Business Service" - ], - "insight": { - }, - "_comment": " " - }, - "topPerformingUlbs": { - "chartName": "DSS_PT_TOP_3_PERFORMING_ULBS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\r\n \"module\" : \"businessService.keyword\", \n\"tenantId\" : \"tenantIdForMunicipalCorporation\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"desc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\r\n \"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \n\"tenantId\" : \"dataObject.tenantId\"}", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"desc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "perform", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "plotLabel": "DSS_TARGET_ACHIEVED", - "order": "desc", - "limit": 3, - "aggregationPaths": [ - "Total Collection","Target Collection" - ], - "insight": { - }, - "_comment": " Top Performing Ulbs for target achieved" - }, - "bottomPerformingUlbs": { - "chartName": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\",\"tenantId\" : \"tenantIdForMunicipalCorporation\" }", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"asc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"asc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "perform", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "plotLabel": "DSS_TARGET_ACHIEVED", - "order": "asc", - "limit": 3, - "aggregationPaths": [ - "Total Collection", "Target Collection" - ], - "insight": { - }, - "_comment": " Bottom Performing Ulbs for target achieved" - }, - "licenseByLicenseType": { - "chartName": "DSS_TL_LICENSE_BY_TYPE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantData.code\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"License Instrument Type\":{\"terms\":{\"field\":\"dataObject.instrument.typeName.keyword\"},\"aggs\":{\"Licens Issued\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "License Instrument Type" - ], - "insight": { - }, - "_comment": " License Application which are issued by License Type" - }, - - "_comment": "COMMON NON-COLLECTION CHARTS", - "totalApplication": { - "chartName": "DSS_TOTAL_APPLICATION", - "queries": [ - { - "module": "PT", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Application\":{\"value_count\":{\"field\":\"Data.propertyId.keyword\"}}}}}}", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tenantId\" \r\n}", - "dateRefField": "Data.@timestamp" - }, - { - "module": "TL", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Application\":{\"value_count\":{\"field\":\"Data.tradelicense.applicationnumber.keyword\"}}}}}}", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tradelicense.tenantid.keyword\" \r\n}", - "dateRefField": "Data.tradelicense.applicationdate" - }, - { - "module": "PGR", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Application\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tenantId\" \r\n}", - "dateRefField": "Data.dateOfComplaint" - } - ], - "chartType": "metric", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Total Application" - ], - "insight": { - "chartResponseMap" : "totalApplication", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " totalApplication is the chartId" - }, - "closedApplication": { - "chartName": "DSS_CLOSED_APPLICATION", - "queries": [ - { - "module": "PT", - "dateRefField": "Data.@timestamp", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tenantId\" \r\n}", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Applications Closed\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"Data.status.keyword\":[\"closed\",\"resolved\"]}}]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.propertyId.keyword\"}}}}}}}}" - }, - { - "module": "TL", - "dateRefField": "Data.tradelicense.applicationdate", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tradelicense.tenantid.keyword\" \r\n}", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Applications Closed\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"Data.status.keyword\":[\"closed\",\"resolved\"]}}]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.tradelicense.applicationnumber.keyword\"}}}}}}}}" - }, - { - "module": "PGR", - "dateRefField": "Data.dateOfComplaint", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tenantId\" \r\n}", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Applications Closed\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"Data.status.keyword\":[\"closed\",\"resolved\"]}}]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}" - } - ], - "chartType": "metric", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Applications Closed" - ], - "insight": { - "chartResponseMap" : "closedApplication", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " totalApplication is the chartId" - }, - "citizenRegistered": { - "chartName": "DSS_CITIZEN_REGISTERED", - "queries": [ - { - "module": "PGR", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Citizen Registered\":{\"terms\":{\"field\":\"Data.citizen.uuid.keyword\"},\"aggs\":{\"type_count\":{\"cardinality\":{\"field\":\"Data.citizen.uuid.keyword\"}}}}}}}}", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"district\" : \"Data.tenantData.city.districtCode\", \"tenantId\" : \"Data.tenantId\", \"status\" : \"Data.status\"}", - "dateRefField": "Data.dateOfComplaint" - } - ], - "chartType": "metric", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Citizen Registered" - ], - "insight": { - "chartResponseMap" : "citizenRegistered", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " totalApplication is the chartId" - }, - "totalApplicationDeptWise": { - "chartName": "DSS_TOTAL_APPLICATIONS:_DEPARTMENT_WISE", - "queries": [ - { - "module": "PT", - "dateRefField": "Data.@timestamp", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tenantId\" \r\n}", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Property Tax\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}" - }, - { - "module": "TL", - "dateRefField": "Data.@timestamp", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tenantId\" \r\n}", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Trade Licence\":{\"value_count\":{\"field\":\"Data.tradelicense.tenantid.keyword\"}}}}}}" - }, - { - "module": "PGR", - "dateRefField": "Data.@timestamp", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tenantId\" \r\n}", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"PGR\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Property Tax", - "Trade Licence", - "PGR" - ], - "insight": { - }, - "_comment": " totalApplication is the chartId" - }, - "totalApplication&ClosedApplication": { - "chartName": "DSS_TOTAL_APPLICATION_&_CLOSED_APPLICATION", - "queries": [ - { - "module": "PT", - "dateRefField": "Data.@timestamp", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tenantId.keyword\" \r\n}", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Application\":{\"date_histogram\":{\"field\":\"Data.@timestamp\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.propertyId.keyword\"}}}},\"Closed Application\":{\"date_histogram\":{\"field\":\"Data.@timestamp\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Applications Closed\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"Data.status.keyword\":[\"closed\",\"resolved\"]}}]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.propertyId.keyword\"}}}}}}}}}}" - }, - { - "module": "TL", - "dateRefField": "Data.tradelicense.applicationdate", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tradelicense.tenantid.keyword\" \r\n}", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Application\":{\"date_histogram\":{\"field\":\"Data.tradelicense.applicationdate\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.tradelicense.applicationnumber.keyword\"}}}},\"Closed Application\":{\"date_histogram\":{\"field\":\"Data.tradelicense.applicationdate\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Applications Closed\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"Data.status.keyword\":[\"closed\",\"resolved\"]}}]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.tradelicense.applicationnumber.keyword\"}}}}}}}}}}" - - }, - { - "module": "PGR", - "dateRefField": "Data.dateOfComplaint", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tenantId\" \r\n}", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Application\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Closed Application\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Applications Closed\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"Data.status.keyword\":[\"closed\",\"resolved\"]}}]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}}}" - - } - ], - "chartType": "line", - "valueType": "number", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Total Application", - "Closed Application" - ], - "isCumulative": false, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - "topPerformingUlbsCompletionRate": { - "chartName": "DSS_PT_TOP_3_PERFORMING_ULBS", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"module\" : \"businessService.keyword\",\"tenantId\" : \"Data.tenantId\" , \"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.@timestamp", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Closed Application\":{\"filter\":{\"term\":{\"Data.status.keyword\":\"resolved\"}},\"aggs\":{\"count\":{\"terms\":{\"field\":\"Data.tenantId.keyword\",\"order\":{\"_key\":\"asc\"},\"size\":100},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}},\"Total Application\":{\"terms\":{\"field\":\"Data.tenantId.keyword\",\"order\":{\"_key\":\"asc\"},\"size\":100},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}" - }, - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"module\" : \"businessService.keyword\",\"tenantId\" : \"Data.tenantId\" , \"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Closed Application\":{\"filter\":{\"exists\":{\"field\":\"Data.propertyId.keyword\"}},\"aggs\":{\"count\":{\"terms\":{\"field\":\"Data.tenantId.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}},\"Total Application\":{\"terms\":{\"field\":\"Data.tenantId.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}" - }, - { - "module": "TL", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"module\" : \"businessService.keyword\",\"tenantId\" : \"Data.tenantData.code\" , \"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.tradelicense.applicationdate", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Closed Application\":{\"filter\":{\"exists\":{\"field\":\"Data.tradelicense.issueddate\"}},\"aggs\":{\"count\":{\"terms\":{\"field\":\"Data.tenantData.code.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantData.code.keyword\"}}}}}},\"Total Application\":{\"filter\":{\"exists\":{\"field\":\"Data.tradelicense.applicationdate\"}},\"aggs\":{\"count\":{\"terms\":{\"field\":\"Data.tenantData.code.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantData.code.keyword\"}}}}}}}}}}" - } - ], - "chartType": "perform", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "plotLabel": "DSS_COMPLETION_RATE", - "order": "desc", - "limit": 3, - "aggregationPaths": [ - "Closed Application", - "Total Application" - ], - "insight": { - }, - "_comment": " Top Performing Ulbs for Completion rate" - }, - "bottomPerformingUlbsCompletionRate": { - "chartName": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"module\" : \"businessService.keyword\",\"tenantId\" : \"Data.tenantId\" , \"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.@timestamp", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Closed Application\":{\"filter\":{\"term\":{\"Data.status.keyword\":\"resolved\"}},\"aggs\":{\"count\":{\"terms\":{\"field\":\"Data.tenantId.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}},\"Total Application\":{\"terms\":{\"field\":\"Data.tenantId.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}" - }, - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"module\" : \"businessService.keyword\",\"tenantId\" : \"Data.tenantId\" ,\"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Closed Application\":{\"filter\":{\"exists\":{\"field\":\"Data.propertyId.keyword\"}},\"aggs\":{\"count\":{\"terms\":{\"field\":\"Data.tenantId.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}},\"Total Application\":{\"terms\":{\"field\":\"Data.tenantId.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}" - }, - { - "module": "TL", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"module\" : \"businessService.keyword\",\"tenantId\" : \"Data.tenantData.code\" , \"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.tradelicense.applicationdate", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Closed Application\":{\"filter\":{\"exists\":{\"field\":\"Data.tradelicense.issueddate\"}},\"aggs\":{\"count\":{\"terms\":{\"field\":\"Data.tenantData.code.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantData.code.keyword\"}}}}}},\"Total Application\":{\"filter\":{\"exists\":{\"field\":\"Data.tradelicense.applicationdate\"}},\"aggs\":{\"count\":{\"terms\":{\"field\":\"Data.tenantData.code.keyword\"},\"aggs\":{\"tenant_count\":{\"value_count\":{\"field\":\"Data.tenantData.code.keyword\"}}}}}}}}}}" - } - ], - "chartType": "perform", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "plotLabel": "DSS_COMPLETION_RATE", - "order": "asc", - "limit": 3, - "aggregationPaths": [ - "Closed Application", - "Total Application" - ], - "insight": { - }, - "_comment": " Bottom Performing Ulbs for Completion rate" - }, - - "_comment": "COMMON COLLECTION CHARTS", - "targetCollection": { - "chartName": "DSS_TARGET_COLLECTION", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}" - } - ], - "chartType": "metric", - "valueType": "amount", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Target Collection" - ], - "isDayUnit": true, - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "insight": { - }, - "_comment": " " - }, - "collectionByUsageType": { - "chartName": "DSS_PT_COLLECTION_BY_USAGE_TYPE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"attrs_root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"Usage Type\":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"size\":200}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "amount", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Usage Type" - ], - "insight": { - }, - "_comment": " collection/amount per usage type" - }, - - "_comment": "PT NON-COLLECTION CHARTS", - "propertiesByUsageType": { - "chartName": "DSS_PT_PROPERTIES_BY_USAGE_TYPE", - "queries": [ - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"module\" : \"Data.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"Data.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Usage Type\":{\"terms\":{\"field\":\"Data.propertyDetails.units.usageCategoryMajor.keyword\"},\"aggs\":{\"Assessed Properties\":{\"value_count\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}}}" - - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Usage Type" - ], - "insight": { - }, - "_comment": " properties having assessmentNumber per usage type" - }, - "propertiesByTenant": { - "chartName": "DSS_PT_PROPERTIES_BY_USAGE_TYPE", - "queries": [ - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"module\" : \"Data.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"Data.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\"}", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Type\":{\"terms\":{\"field\":\"Data.address.city.keyword\"},\"aggs\":{\"Assessed Properties\":{\"value_count\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}}}" - - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Type" - ], - "insight": { - }, - "_comment": " properties having assessmentNumber per usage type" - }, - - "propertiesAssessed": { - "chartName": "DSS_PT_TOTAL_PROPERTIES_ASSESSED", - "queries": [ - { - "module": "PT", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Assessed Properties\":{\"value_count\":{\"field\":\"Data.propertyId.keyword\"}}}}}}", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId\" ,\"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.@timestamp" - } - ], - "chartType": "metric", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Assessed Properties" - ], - "insight": { - "chartResponseMap" : "propertiesAssessed", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " totol properties having assessmentNumber " - }, - "totalAssessment": { - "chartName": "DSS_PT_TOTAL_ASSESSMENTS", - "queries": [ - { - "module": "PT", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Assessed Properties\":{\"value_count\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}", - - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tenantId\" ,\"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.@timestamp" - } - ], - "chartType": "metric", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Assessed Properties" - ], - "insight": { - "chartResponseMap" : "totalAssessment", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " totol properties having assessmentNumber " - }, - "cumulativePropertiesAssessed": { - "chartName": "DSS_PT_CUMULATIVE_PROPERTIES_ASSESSED", - "queries": [ - { - "module": "PT", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Collections\":{\"date_histogram\":{\"field\":\"Data.@timestamp\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}}}", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tenantId\" ,\"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.@timestamp" - } - ], - "chartType": "line", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Collections" - ], - "isCumulative": true, - "interval": "week", - "insight": { - }, - "_comment": " totol properties having assessmentNumber " - }, - "activeUlbs": { - "chartName": "DSS_PT_TOTAL_ACTIVE_ULBS", - "queries": [ - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Active ULBs\":{\"cardinality\":{\"field\":\"Data.tenantId.keyword\"}}}}}}" - }, - { - "module": "TL", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tenantData.code\"}", - "dateRefField": "Data.tradelicense.@timestamp", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantData.code.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Active ULBs\":{\"cardinality\":{\"field\":\"Data.tenantData.code.keyword\"}}}}}}" - } - ], - "chartType": "metric", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Active ULBs" - ], - "insight": { - "chartResponseMap" : "activeUlbs", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " total ULBs count" - }, - - "_comment": "PT COLLECTION CHARTS (Tax heads)", - - "_comment": "PT COLLECTION CHARTS (Demands) ", - "demandCollectionIndexDDRRevenue": { - "chartName": "DSS_PT_KEY_FY_INDICATORS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "demandCollectionIndexBoundaryRevenue", - "action": "", - "plotLabel": "DDRs", - "isPostResponseHandler": true, - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "demandCollectionIndexBoundaryRevenue": { - "chartName": "DSS_PT_DEMAND_COLLECTION_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"domainObject.tenantId.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":1000},\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "postAggregationTheory" : "repsonseToDifferenceOfDates", "chartType": "table", - "valueType": "number", - "drillChart": "boundaryDrillDown", - "drillFields": [ - "Ward", - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "boundaryDrillDown": { - "kind": "drillDown", - "chartName": "Boundary", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\",\"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"domainObject.ward.name.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}" - } - ], - "chartType": "table", - "valueType": "number", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "plotLabel": "Ward", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - - - "_comment": " PT Nested Array related new queries", - "taxHeadsBreakupDDRRevenue": { - "chartName": "DSS_PT_TAX_HEAD_BREAKUP_REVENUE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.totalAmount\"}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Time Interest\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_INTEREST\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Round Off\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_ROUNDOFF\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "taxHeadsBreakupRevenue", - "isPostResponseHandler": true, - "documentType": "_doc", - "action": "", - "plotLabel": "DDRs", - "aggregationPaths": [ - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty", - "Time Interest","Round Off" - ], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "AdditiveComputedField", - "fields" : [ "PT Tax", "Fire Cess", "Cancer Cess", "Rebate", "Penalty", "Time Interest","Round Off"], - "newField" : "Total Amount", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - "insight": { - }, - "_comment": "" - }, - "taxHeadsBreakupRevenue": { - "chartName": "DSS_PT_TAX_HEAD_BREAKUP_REVENUE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"bucket_script\":{\"buckets_path\":{\"c1\":\"PT Tax>aggrFilter>amount\",\"c2\":\"Fire Cess>aggrFilter>amount\",\"c3\":\"Cancer Cess>aggrFilter>amount\",\"c4\":\"Rebate>aggrFilter>amount\",\"c5\":\"Penalty>aggrFilter>amount\",\"c6\":\"Time Interest>aggrFilter>amount\",\"c7\":\"Round Off>aggrFilter>amount\"},\"script\":{\"source\":\"params.c1+params.c2+params.c3+params.c4+params.c5+params.c6+params.c7\"}}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Time Interest\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_INTEREST\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Round Off\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_ROUNDOFF\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "taxHeadsBreakupBoundaryDrill", - "drillFields": [ - "Ward", - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty", - "Time Interest","Round Off", "Total Amount" - ], - - "insight": { - }, - "_comment": "" - }, - "taxHeadsBreakupBoundaryDrill": { - "chartName": "Tax head Breakup boundary", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"usageId\" : \"domainObject.propertyDetails.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"domainObject.ward.name.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"bucket_script\":{\"buckets_path\":{\"c1\":\"PT Tax>aggrFilter>amount\",\"c2\":\"Fire Cess>aggrFilter>amount\",\"c3\":\"Cancer Cess>aggrFilter>amount\",\"c4\":\"Rebate>aggrFilter>amount\",\"c5\":\"Penalty>aggrFilter>amount\",\"c6\":\"Time Interest>aggrFilter>amount\",\"c7\":\"Round Off>aggrFilter>amount\"},\"script\":{\"source\":\"params.c1+params.c2+params.c3+params.c4+params.c5+params.c6+params.c7\"}}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Time Interest\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_INTEREST\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Round Off\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_ROUNDOFF\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "", - "drillFields": [ - "Ward", - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty", - "Time Interest","Round Off","Total Amount" - ], - - "insight": { - }, - "_comment": "" - }, - - "taxHeadsBreakupUsage": { - "chartName": "DSS_PT_TAX_HEAD_BREAKUP_USAGE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"attrs_root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"Usage \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"nested\":{\"path\":\"dataObject.Bill.taxAndPayments\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.taxAndPayments.businessService.keyword\":[\"PT\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.taxAndPayments.taxAmount\"}}}}}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}}}" - } - ], - "filterKeys": [ - - ], - "chartType": "table", - "valueType": "number", - "drillChart": "", - "documentType": "_doc", - "action": "", - "plotLabel": "Usage Type", - "aggregationPaths": [ - "Total Amount", - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty" - ], - "pathDataTypeMapping": [ - { - "Total Amount": "amount" - }, - { - "PT Tax": "amount" - }, - { - "Fire Cess": "amount" - }, - { - "Cancer Cess": "amount" - }, - { - "Rebate": "amount" - }, - { - "Penalty": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "taxHeadsBreakupUsageMinor": { - "chartName": "", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"usageId\" : \"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.units.usageCategoryMinor.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"attrs_root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"Usage \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMinor.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"nested\":{\"path\":\"dataObject.Bill.taxAndPayments\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.taxAndPayments.businessService.keyword\":[\"PT\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.taxAndPayments.taxAmount\"}}}}}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "minorUsageId", "column": "Minor Usage Type"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "taxHeadsBreakupUsageSubMinor", - "documentType": "_doc", - "action": "", - "plotLabel": "Minor Usage Type", - "aggregationPaths": [ - "Total Amount", - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty" - ], - "pathDataTypeMapping": [ - { - "Total Amount": "amount" - }, - { - "PT Tax": "amount" - }, - { - "Fire Cess": "amount" - }, - { - "Cancer Cess": "amount" - }, - { - "Rebate": "amount" - }, - { - "Penalty": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "taxHeadsBreakupUsageSubMinor": { - "chartName": "", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"usageId\" : \"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.units.usageCategoryMinor.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"attrs_root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"Usage \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategorySubMinor.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"nested\":{\"path\":\"dataObject.Bill.taxAndPayments\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.taxAndPayments.businessService.keyword\":[\"PT\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.taxAndPayments.taxAmount\"}}}}}},\"PT Tax\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Fire Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_FIRE_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Cancer Cess\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_CANCER_CESS\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Rebate\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Penalty\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"PT_TIME_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}}}" - } - ], - "filterKeys": [ - "" - ], - "chartType": "table", - "valueType": "number", - "drillChart": "", - "documentType": "_doc", - "action": "", - "plotLabel": "Sub Minor Usage Type", - "aggregationPaths": [ - "Total Amount", - "PT Tax", - "Fire Cess", - "Cancer Cess", - "Rebate", - "Penalty" - ], - "pathDataTypeMapping": [ - { - "Total Amount": "amount" - }, - { - "PT Tax": "amount" - }, - { - "Fire Cess": "amount" - }, - { - "Cancer Cess": "amount" - }, - { - "Rebate": "amount" - }, - { - "Penalty": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "demandCollectionIndexUsageRevenue": { - "chartName": "DSS_PT_DEMAND_COLLECTION_USAGETYPE", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\",\"usageId\" : \"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.units.usageCategoryMinor.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"UsageType \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"reverse_nested\":{},\"aggs\":{\"top_tags_per_comment\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}},\"Transactions\":{\"reverse_nested\":{},\"aggs\":{\"top_tags_per_comment\":{\"cardinality\":{\"field\":\"dataObject.transactionId.keyword\"}}}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"attr\":{\"cardinality\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}}}", - "aggrQuerybc": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}}],\"must\":[{\"term\":{\"dataObject.Bill.billDetails.status.keyword\":\"Approved\"}}]}},\"aggs\":{\"attrs_root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"UsageType \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Assessed Properties\":{\"nested\":{\"path\":\"Data.propertyDetails\"},\"aggs\":{\"attr\":{\"cardinality\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - - ], - "chartType": "table", - "valueType": "number", - "drillChart": "", - "drillFields": [ - "Ward", - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Usage Type", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties" - - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - "usageRevenueDrillDownMinor": { - "chartName": "", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"usageId\" : \"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.units.usageCategoryMinor.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"UsageType \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMinor.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"reverse_nested\":{},\"aggs\":{\"top_tags_per_comment\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}},\"Transactions\":{\"reverse_nested\":{},\"aggs\":{\"top_tags_per_comment\":{\"cardinality\":{\"field\":\"dataObject.transactionId.keyword\"}}}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"attr\":{\"cardinality\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}}}", - "aggrQuerybc": "{\"aggs\":{\"attrs_root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"UsageType \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategoryMinor.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Assessed Properties\":{\"nested\":{\"path\":\"Data.propertyDetails\"},\"aggs\":{\"attr\":{\"cardinality\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "minorUsageId", "column": "Minor Usage Type"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "usageRevenueDrillDownSubMinor", - "documentType": "_doc", - "action": "", - "plotLabel": "Minor Usage Type", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - "usageRevenueDrillDownSubMinor": { - "chartName": "", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"usageId\" : \"domainObject.propertyDetails.units.usageCategoryMajor.keyword\",\"minorUsageId\" : \"domainObject.propertyDetails.units.usageCategoryMinor.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"UsageType \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategorySubMinor.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"reverse_nested\":{},\"aggs\":{\"top_tags_per_comment\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}}}},\"Transactions\":{\"reverse_nested\":{},\"aggs\":{\"top_tags_per_comment\":{\"cardinality\":{\"field\":\"dataObject.transactionId.keyword\"}}}},\"Assessed Properties\":{\"nested\":{\"path\":\"domainObject.propertyDetails\"},\"aggs\":{\"attr\":{\"cardinality\":{\"field\":\"domainObject.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}}}", - "aggrQuerybc": "{\"aggs\":{\"attrs_root\":{\"nested\":{\"path\":\"domainObject.propertyDetails.units\"},\"aggs\":{\"UsageType \":{\"terms\":{\"field\":\"domainObject.propertyDetails.units.usageCategorySubMinor.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Assessed Properties\":{\"nested\":{\"path\":\"Data.propertyDetails\"},\"aggs\":{\"attr\":{\"cardinality\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}}}}}" - } - ], - "filterKeys": [ - - ], - "chartType": "table", - "valueType": "number", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "plotLabel": "Sub Minor Usage Type", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Assessed Properties" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Assessed Properties": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - - - - "_comment": "TL COLLECTION CHARTS", - - "licenseIssuedDDRRevenue": { - "chartName": "DSS_TL_KEY_FY_INDICATORS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Total Licence Issued\":{\"value_count\":{\"field\":\"domainObject.tradelicense.licensenumber.keyword\"}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "isPostResponseHandler": true, - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "chartType": "table", - "valueType": "number", - "drillChart": "licenseIssuedBoundaryRevenue", - "documentType": "_doc", - "action": "", - "plotLabel": "DDRs", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Total Licence Issued", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Total Licence Issued": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "licenseIssuedBoundaryRevenue": { - "chartName": "DSS_TL_DEMAND_COLLECTION_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Total Licence Issued\":{\"value_count\":{\"field\":\"domainObject.tradelicense.licensenumber.keyword\"}}}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":1000},\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "chartType": "table", - "valueType": "number", - "drillChart": "licenseIssuedBoundaryDrillDown", - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Total Licence Issued", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Total Licence Issued": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "licenseIssuedBoundaryDrillDown": { - "chartName": "", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"domainObject.ward.name.keyword\",\"size\":200},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Total Licence Issued\":{\"value_count\":{\"field\":\"domainObject.tradelicense.licensenumber.keyword\"}}}}}}}}" - } - ], - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "chartType": "table", - "valueType": "number", - "drillChart": "", - "documentType": "_doc", - "action": "", - "plotLabel": "Ward", - "aggregationPaths": [ - "Total Collection", - "Transactions", - "Total Licence Issued", - "Target Collection" - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Transactions": "number" - }, - { - "Total Licence Issued": "number" - }, - { - "Target Collection": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - - "_comment": " TL Nested Array related newer queries", - "licenceTaxHeadsBreakupDDR": { - "chartName": "DSS_TL_TAX_HEAD_BREAKUP_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Total Amount\":{\"nested\":{\"path\":\"dataObject.Bill.taxAndPayments\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.taxAndPayments.businessService.keyword\":[\"TL\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.taxAndPayments.taxAmount\"}}}}}},\"TL Tax\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Penalty\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Rebate\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "isPostResponseHandlerA": true, - "chartType": "xtable", - "valueType": "number", - "drillChart": "licenceTaxHeadsBreakupBoundary", - "documentType": "_doc", - "action": "", - "plotLabel": "DDRs", - "aggregationPaths": [ - "TL Tax", - "Adhoc Penalty", - "Adhoc Rebate" - ], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "AdditiveComputedField", - "fields" : ["TL Tax", "Adhoc Penalty", "Adhoc Rebate"], - "newField" : "Total Amount", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - - "insight": { - }, - "_comment": "" - }, - "licenceTaxHeadsBreakupBoundary": { - "chartName": "DSS_TL_TAX_HEAD_BREAKUP_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"bucket_script\":{\"buckets_path\":{\"c1\":\"TL Tax>aggrFilter>amount\",\"c2\":\"Adhoc Penalty>aggrFilter>amount\",\"c3\":\"Adhoc Rebate>aggrFilter>amount\"},\"script\":{\"source\":\"params.c1+params.c2+params.c3\"}}},\"TL Tax\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Penalty\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Rebate\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "licenceTaxHeadsBreakupWard", - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "TL Tax", - "Adhoc Penalty", - "Adhoc Rebate","Total Amount" - ], - "insight": { - }, - "_comment": "" - }, - "licenceTaxHeadsBreakupWard": { - "chartName": "DSS_TL_TAX_HEAD_BREAKUP_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"dataObject.ward.name.keyword\",\"size\":200},\"aggs\":{\"Total Amount\":{\"bucket_script\":{\"buckets_path\":{\"c1\":\"TL Tax>aggrFilter>amount\",\"c2\":\"Adhoc Penalty>aggrFilter>amount\",\"c3\":\"Adhoc Rebate>aggrFilter>amount\"},\"script\":{\"source\":\"params.c1+params.c2+params.c3\"}}},\"TL Tax\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_TAX\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Penalty\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_PENALTY\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}},\"Adhoc Rebate\":{\"nested\":{\"path\":\"dataObject.Bill.billDetails.billAccountDetails\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"dataObject.Bill.billDetails.billAccountDetails.taxHeadCode.keyword\":[\"TL_ADHOC_REBATE\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.billAccountDetails.amount\"}}}}}}}}}}}}" - } - ], - "filterKeys": [ - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "", - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "TL Tax", - "Adhoc Penalty", - "Adhoc Rebate", "Total Amount" - ], - "insight": { - }, - "_comment": "" - }, - - - "_comment": "TL NON-COLLECTION CHARTS", - "licenseIssued": { - "chartName": "DSS_TL_LICENSE_ISSUED", - "queries": [ - { - "module": "TL", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\": {\"License Issued\": {\"value_count\": {\"field\": \"Data.tradelicense.licensenumber.keyword\"}}}}}}", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \r\n \"district\" : \"Data.tenantData.city.districtCode\", \r\n\"tenantId\" : \"Data.tradelicense.tenantid\" \r\n, \r\n\"businessService\" : \"dataObject.Bill.billDetails.businessServices\" \r\n}", - "dateRefField": "Data.tradelicense.issueddate" - } - ], - "chartType": "metric", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "License Issued" - ], - "insight": { - "chartResponseMap" : "licenseIssued", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " licenseIssued is the Chart ID" - }, - "cumulativeLicenseIssued": { - "chartName": "DSS_TL_CUMULATIVE_LICENSE_ISSUED", - "queries": [ - { - "module": "TL", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Trade Licence Issued\":{\"date_histogram\":{\"field\":\"Data.tradelicense.issueddate\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.tradelicense.licensenumber.keyword\"}}}}}}}}", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tenantData.code\" ,\"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.tradelicense.issueddate" - }, - { - "module": "TL", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Application\":{\"date_histogram\":{\"field\":\"Data.tradelicense.applicationdate\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.tradelicense.applicationnumber.keyword\"}}}}}}}}", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tenantData.code\" ,\"district\" : \"Data.tenantData.city.districtCode\"}", - "dateRefField": "Data.tradelicense.applicationdate" - } - ], - "chartType": "line", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Trade Licence Issued", - "Total Application" - ], - "isCumulative": true, - "interval": "month", - "insight": { - }, - "_comment": " Total Number of License having issued" - }, - "licenseApplicationByStatus": { - "chartName": "DSS_TL_LICENSE_BY_STATUS", - "queries": [ - { - "module": "TL", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tenantData.code\", \"district\" : \"Data.tenantData.cityDistrictCode\"}", - "dateRefField": "Data.tradelicense.issueddate", - "indexName": "tlindex-v1", - "aggrQueryBc": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Status\":{\"terms\":{\"field\":\"Data.tradelicense.status.keyword\"},\"aggs\":{\"License Issued\":{\"value_count\":{\"field\":\"Data.tradelicense.status.keyword\"}}}}}}}}", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Status\":{\"terms\":{\"field\":\"Data.tradelicense.status.keyword\",\"size\":1000,\"min_doc_count\":0},\"aggs\":{\"License Issued\":{\"cardinality\":{\"field\":\"Data.tradelicense.licensenumber.keyword\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Status" - ], - "insight": { - }, - "_comment": " License Application which are issued by License Type" - }, - "slaAchieved": { - "chartName": "DSS_SLA_ACHIEVED", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \r\n \"module\" : \"businessService.keyword\", \n\"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Application\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}, \"withinSLA\":{\"range\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc['Data.slaHours'].value\"},\"ranges\":[{\"key\":\"Within SLA\",\"from\":0,\"to\":360}]}}}}}}" - } - ], - "chartType": "metric", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "aggregationPaths": [ - "withinSLA", - "Total Application" - ], - "insight": { - "chartResponseMap" : "slaAchieved", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " SLA Achieved Percentage " - }, - "tlStatusByDDR": { - "chartName": "DSS_TL_STATUS_BY_DDR", - "queries": [ - { - "module": "TL", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tradelicense.tenantid.keyword\" }", - "dateRefField": "Data.tradelicense.issueddate", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Status\":{\"terms\":{\"field\":\"Data.tradelicense.status.keyword\",\"size\":1000,\"min_doc_count\":0},\"aggs\":{\"License Issued\":{\"value_count\":{\"field\":\"Data.tradelicense.licensenumber.keyword\"}}}}}}}}", - "aggrQueryBC": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Status\":{\"filters\":{\"filters\":{\"Approved\":{\"match\":{\"Data.tradelicense.status.keyword\":\"APPROVED\"}},\"Initiated\":{\"match\":{\"Data.tradelicense.status.keyword\":\"INITIATED\"}},\"Applied\":{\"match\":{\"Data.tradelicense.status.keyword\":\"APPLIED\"}},\"Rejected\":{\"match\":{\"Data.tradelicense.status.keyword\":\"REJECTED\"}},\"Pending Approval\":{\"match\":{\"Data.tradelicense.status.keyword\":\"PENDINGAPPROVAL\"}},\"Field Inspection\":{\"match\":{\"Data.tradelicense.status.keyword\":\"FIELDINSPECTION\"}},\"Cancelled\":{\"match\":{\"Data.tradelicense.status.keyword\":\"CANCELLED\"}},\"Pending Payment\":{\"match\":{\"Data.tradelicense.status.keyword\":\"PENDINGPAYMENT\"}},\"Paid\":{\"match\":{\"Data.tradelicense.status.keyword\":\"PAID\"}}}}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "tlStatusByTenant", - "drillFields": [ - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "DDRs", - "aggregationPathsA": [ - "Approved", - "Initiated", - "Applied", - "Rejected", - "Pending Approval", - "Field Inspection", - "Cancelled", - "Pending Payment", - "Paid" - ], - "pathDataTypeMappingA": [ - { - "Approved": "number" - }, - { - "Initiated": "number" - }, - { - "Applied": "number" - }, - { - "Rejected": "number" - }, - { - "Pending Approval": "number" - }, - { - "Field Inspection": "number" - }, - { - "Cancelled": "number" - }, - { - "Pending Payment": "number" - }, - { - "Paid": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - "tlStatusByTenant": { - "chartName": "DSS_TL_STATUS_BY_TENANT", - "queries": [ - { - "module": "TL", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tradelicense.tenantid.keyword\" }", - "dateRefField": "Data.tradelicense.issueddate", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"Data.tradelicense.tenantid.keyword\",\"size\":1000},\"aggs\":{\"Status\":{\"terms\":{\"field\":\"Data.tradelicense.status.keyword\",\"size\":1000,\"min_doc_count\":0},\"aggs\":{\"License Issued\":{\"value_count\":{\"field\":\"Data.tradelicense.licensenumber.keyword\"}}}}}}}}}}", - "aggrQueryBc": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"Data.tradelicense.tenantId.keyword\",\"size\":1000},\"aggs\":{\"Status\":{\"filters\":{\"filters\":{\"Approved\":{\"match\":{\"Data.tradelicense.status.keyword\":\"APPROVED\"}},\"Initiated\":{\"match\":{\"Data.tradelicense.status.keyword\":\"INITIATED\"}},\"Applied\":{\"match\":{\"Data.tradelicense.status.keyword\":\"APPLIED\"}},\"Rejected\":{\"match\":{\"Data.tradelicense.status.keyword\":\"REJECTED\"}},\"Pending Approval\":{\"match\":{\"Data.tradelicense.status.keyword\":\"PENDINGAPPROVAL\"}},\"Field Inspection\":{\"match\":{\"Data.tradelicense.status.keyword\":\"FIELDINSPECTION\"}},\"Cancelled\":{\"match\":{\"Data.tradelicense.status.keyword\":\"CANCELLED\"}},\"Pending Payment\":{\"match\":{\"Data.tradelicense.status.keyword\":\"PENDINGPAYMENT\"}},\"Paid\":{\"match\":{\"Data.tradelicense.status.keyword\":\"PAID\"}}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "tlStatusByTenantDrillDown", - "drillFields": [ - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "ULBs", - "aggregationPaths": [ - - ], - "pathDataTypeMapping": [ - - ], - "insight": { - }, - "_comment": "" - }, - "tlStatusByTenantDrillDown": { - "chartName": "DSS_TL_STATUS_BY_WARD", - "queries": [ - { - "module": "TL", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tradelicense.tenantid.keyword\" }", - "dateRefField": "Data.tradelicense.issueddate", - "indexName": "tlindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantid.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"Data.ward.name.keyword\",\"size\":1000},\"aggs\":{\"Status\":{\"terms\":{\"field\":\"Data.tradelicense.status.keyword\",\"size\":1000,\"min_doc_count\":0},\"aggs\":{\"License Issued\":{\"value_count\":{\"field\":\"Data.tradelicense.licensenumber.keyword\"}}}}}}}}}}", - "aggrQueryBc": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tradelicense.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"Data.ward.name.keyword\",\"size\":1000},\"aggs\":{\"Status\":{\"filters\":{\"filters\":{\"Approved\":{\"match\":{\"Data.tradelicense.status.keyword\":\"APPROVED\"}},\"Initiated\":{\"match\":{\"Data.tradelicense.status.keyword\":\"INITIATED\"}},\"Applied\":{\"match\":{\"Data.tradelicense.status.keyword\":\"APPLIED\"}},\"Rejected\":{\"match\":{\"Data.tradelicense.status.keyword\":\"REJECTED\"}},\"Pending Approval\":{\"match\":{\"Data.tradelicense.status.keyword\":\"PENDINGAPPROVAL\"}},\"Field Inspection\":{\"match\":{\"Data.tradelicense.status.keyword\":\"FIELDINSPECTION\"}},\"Cancelled\":{\"match\":{\"Data.tradelicense.status.keyword\":\"CANCELLED\"}},\"Pending Payment\":{\"match\":{\"Data.tradelicense.status.keyword\":\"PENDINGPAYMENT\"}},\"Paid\":{\"match\":{\"Data.tradelicense.status.keyword\":\"PAID\"}}}}}}}}}}}" - } - ], - "filterKeys": [ - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "", - "drillFields": [ - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Ward", - "aggregationPathsA": [ - "Approved", - "Initiated", - "Applied", - "Rejected", - "Pending Approval", - "Field Inspection", - "Cancelled", - "Pending Payment", - "Paid" - ], - "pathDataTypeMappingA": [ - { - "Approved": "number" - }, - { - "Initiated": "number" - }, - { - "Applied": "number" - }, - { - "Rejected": "number" - }, - { - "Pending Approval": "number" - }, - { - "Field Inspection": "number" - }, - { - "Cancelled": "number" - }, - { - "Pending Payment": "number" - }, - { - "Paid": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - - "_comment": "Enhanced table charts..TODO: refactor to remove xtable type ", - "xlicenseIssuedBoundaryRevenue": { - "chartName": "DSS_TL_DEMAND_COLLECTION_BOUNDARY", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"wardId\" : \"domainObject.ward.name.keyword\",\"module\" : \"dataObject.Bill.billDetails.businessService.keyword\", \"tenantId\" : \"dataObject.tenantId\", \"district\" : \"dataObject.tenantData.cityDistrictCode\" }", - "dateRefField": "dataObject.Bill.billDetails.receiptDate", - "indexName": "dss-collection_v2", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"dataObject.tenantId.keyword\":\"pb.testing\"}},{\"terms\":{\"dataObject.Bill.billDetails.status.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"dataObject.tenantId.keyword\",\"size\":200,\"min_doc_count\":0},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"dataObject.Bill.billDetails.amountPaid\"}},\"Transactions\":{\"value_count\":{\"field\":\"dataObject.transactionId.keyword\"}},\"Total Licence Issued\":{\"value_count\":{\"field\":\"domainObject.tradelicense.licensenumber.keyword\"}}}}}}}}" - }, - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"tenantIdForMunicipalCorporation.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"tenantIdForMunicipalCorporation.keyword\",\"size\":1000,\"min_doc_count\":0},\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "chartType": "xtable", - "valueType": "number", - "drillChart": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - ], - "computedFields": [ - { - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "actionName": "PercentageComputedField", - "fields" : ["Target Collection", "Total Collection"], - "newField" : "Target Achieved", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - }, - { - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "actionName": "PercentageComputedField", - "fields" : ["Target Collection", "Total Collection"], - "newField" : "Target Achieved", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - "pathDataTypeMapping": [ - ], - "insight": { - }, - "_comment": "" - }, - "xptFyByDDR": { - "chartName": "DSS_TL_STATUS_BY_TENANT", - "queries": [ - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId.keyword\" }", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Fys\":{\"terms\":{\"field\":\"Data.propertyDetails.financialYear.keyword\",\"min_doc_count\":0}}}}}}" - }, - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\", \"tenantId\" : \"Data.tenantId.keyword\" }", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total\":{\"value_count\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "xptFyByTenant", - "plotLabel": "DDRs", - "insight": { - }, - "_comment": "" - }, - "xptFyByTenant": { - "chartName": "DSS_TL_STATUS_BY_TENANT", - "queries": [ - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId.keyword\" }", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"ULBS \":{\"terms\":{\"field\":\"Data.tenantId.keyword\"},\"aggs\":{\"Fys\":{\"terms\":{\"field\":\"Data.propertyDetails.financialYear.keyword\",\"min_doc_count\":0}}}}}}}}" - }, - { - "module": "PT", - "requestQueryMap": "{\"wardId\" : \"Data.ward.name.keyword\",\"tenantId\" : \"Data.tenantId.keyword\" }", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"ULBS \":{\"terms\":{\"field\":\"Data.tenantId.keyword\"},\"aggs\":{\"Total\":{\"value_count\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "xptFyByWard", - "plotLabel": "Boundary", - "insight": { - }, - "_comment": "" - }, - "xptFyByWard": { - "chartName": "DSS_TL_STATUS_BY_TENANT", - "queries": [ - { - "module": "PT", - "requestQueryMap": "{\"tenantId\" : \"Data.tenantId.keyword\" , \"wardId\" : \"Data.ward.name.keyword\"}", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"Data.ward.name.keyword\"},\"aggs\":{\"Fys\":{\"terms\":{\"field\":\"Data.propertyDetails.financialYear.keyword\",\"min_doc_count\":0}}}}}}}}" - }, - { - "module": "PT", - "requestQueryMap": "{\"tenantId\" : \"Data.tenantId.keyword\" , \"wardId\" : \"Data.ward.name.keyword\"}", - "dateRefField": "Data.@timestamp", - "indexName": "ptindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"Data.ward.name.keyword\"},\"aggs\":{\"Total\":{\"value_count\":{\"field\":\"Data.propertyDetails.assessmentNumber.keyword\"}}}}}}}}" - } - ], - "filterKeys": [ - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "none", - "plotLabel": "Wards", - "insight": { - }, - "_comment": "" - }, - - "xpgrStatusByDDR": { - "chartName": "DSS_PGR_STATUS_BY_TENANT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId.keyword\" , \"departmentId\" : \"Data.department.keyword\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"withinSLA\":{\"range\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc['Data.slaHours'].value\"},\"ranges\":[{\"key\":\"withinSLA\",\"from\":0,\"to\":360}]}},\"Total Complaints\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}},\"Closed_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"closed\",\"rejected\",\"resolved\"]}},\"aggs\":{\"Closed Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Open_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"open\"]}},\"aggs\":{\"Open Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Reopened_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"reopen\"]}},\"aggs\":{\"Reopened Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "xpgrStatusByTenant", - "plotLabel": "DDRs", - "excludedColumns": ["withinSLA"], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["Closed Complaints", "Total Complaints"], - "newField" : "Completion Rate", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - }, - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["withinSLA","Total Complaints"], - "newField" : "Sla Achieved", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - "insight": { - }, - "_comment": "" - }, - "xpgrStatusByTenant": { - "chartName": "DSS_PGR_STATUS_BY_TENANT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId.keyword\" , \"departmentId\" : \"Data.department.keyword\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"Data.tenantId.keyword\",\"size\":1000},\"aggs\":{\"withinSLA\":{\"range\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc['Data.slaHours'].value\"},\"ranges\":[{\"key\":\"withinSLA\",\"from\":0,\"to\":360}]}},\"Total Complaints\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}},\"Closed_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"closed\",\"rejected\",\"resolved\"]}},\"aggs\":{\"Closed Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Open_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"open\"]}},\"aggs\":{\"Open Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Reopened_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"reopen\"]}},\"aggs\":{\"Reopened Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "xpgrStatusByWard", - "plotLabel": "Boundary", - "excludedColumns": ["withinSLA"], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["Closed Complaints", "Total Complaints"], - "newField" : "Completion Rate", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - }, - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["Total Complaints", "withinSLA"], - "newField" : "Sla Achieved", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - "insight": { - }, - "_comment": "" - }, - "xpgrStatusByWard": { - "chartName": "DSS_PGR_STATUS_BY_TENANT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId.keyword\" , \"departmentId\" : \"Data.department.keyword\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"Data.complaintWard.name.keyword\",\"size\":1000},\"aggs\":{\"withinSLA\":{\"range\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc['Data.slaHours'].value\"},\"ranges\":[{\"key\":\"withinSLA\",\"from\":0,\"to\":360}]}},\"Total Complaints\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}},\"Closed_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"closed\",\"rejected\",\"resolved\"]}},\"aggs\":{\"Closed Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Open_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"open\"]}},\"aggs\":{\"Open Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Reopened_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"reopen\"]}},\"aggs\":{\"Reopened Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "none", - - "documentType": "_doc", - "action": "", - "plotLabel": "Ward", - "excludedColumns": ["withinSLA"], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["Closed Complaints", "Total Complaints"], - "newField" : "Completion Rate", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - }, - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["Total Complaints", "withinSLA"], - "newField" : "Sla Achieved", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - "insight": { - }, - "_comment": "" - }, - "xpgrStatusByDept": { - "chartName": "DSS_PGR_STATUS_BY_TENANT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\",\"tenantId\" : \"Data.tenantId.keyword\" , \"departmentId\" : \"Data.department.keyword\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Department \":{\"terms\":{\"field\":\"Data.department.keyword\",\"size\":1000},\"aggs\":{\"withinSLA\":{\"range\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc['Data.slaHours'].value\"},\"ranges\":[{\"key\":\"withinSLA\",\"from\":0,\"to\":360}]}},\"Total Complaints\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}},\"Closed_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"closed\",\"rejected\",\"resolved\"]}},\"aggs\":{\"Closed Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Open_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"open\"]}},\"aggs\":{\"Open Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Reopened_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"reopen\"]}},\"aggs\":{\"Reopened Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "departmentId", "column": "Department"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "xpgrStatusByCatagory", - - "documentType": "_doc", - "action": "", - "plotLabel": "Department", - "excludedColumns": ["withinSLA"], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["Closed Complaints", "Total Complaints"], - "newField" : "Completion Rate", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - }, - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["Total Complaints", "withinSLA"], - "newField" : "Sla Achieved", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - "insight": { - }, - "_comment": "" - }, - "xpgrStatusByCatagory": { - "chartName": "DSS_PGR_STATUS_BY_TENANT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId.keyword\" , \"departmentId\" : \"Data.department.keyword\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Category \":{\"terms\":{\"field\":\"Data.complainCategory.keyword\",\"size\":1000},\"aggs\":{\"withinSLA\":{\"range\":{\"script\":{\"lang\":\"painless\",\"source\":\"doc['Data.slaHours'].value\"},\"ranges\":[{\"key\":\"withinSLA\",\"from\":0,\"to\":360}]}},\"Total Complaints\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}},\"Closed_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"closed\",\"rejected\",\"resolved\"]}},\"aggs\":{\"Closed Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Open_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"open\"]}},\"aggs\":{\"Open Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Reopened_Complaints\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"reopen\"]}},\"aggs\":{\"Reopened Complaints\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "departmentId", "column": "Department"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "none", - - "documentType": "_doc", - "action": "", - "plotLabel": "Complaint Category", - "excludedColumns": ["withinSLA"], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["Closed Complaints", "Total Complaints"], - "newField" : "Completion Rate", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - }, - { - "postAggregationTheory" : "", - "actionName": "PercentageComputedField", - "fields" : ["Total Complaints", "withinSLA"], - "newField" : "Sla Achieved", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - "insight": { - }, - "_comment": "" - }, - - "_comment": "PGR NON-COLLECTION CHARTS", - "completionRate": { - "chartName": "DSS_PGR_COMPLETION_RATE", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Complaints\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}},\"Closed Complaints\":{\"filters\":{\"filters\":{\"closed\":{\"match\":{\"Data.status.keyword\":\"closed\"}},\"resolved\":{\"match\":{\"Data.status.keyword\":\"resolved\"}},\"rejected\":{\"match\":{\"Data.status.keyword\":\"rejected\"}}}}}}}}}" - } - ], - "chartType": "metric", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "aggregationPaths": [ - "Closed Complaints", - "Total Complaints" - ], - "insight": { - "chartResponseMap" : "completionRate", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " Total Number of Complaints " - }, - "totalComplaints": { - "chartName": "DSS_PGR_TOTAL_COMPLAINTS", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Complaints\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}" - } - ], - "chartType": "metric", - "valueType": "number", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "aggregationPaths": [ - "Total Complaints" - ], - "insight": { - "chartResponseMap" : "totalComplaints", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " Total Number of Complaints " - }, - "closedComplaints": { - "chartName": "DSS_PGR_CLOSED_COMPLAINTS", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Closed Complaints\":{\"filters\":{\"filters\":{\"closed\":{\"match\":{\"Data.status.keyword\":\"closed\"}},\"resolved\":{\"match\":{\"Data.status.keyword\":\"resolved\"}},\"rejected\":{\"match\":{\"Data.status.keyword\":\"rejected\"}}}}}}}}}" - } - ], - "chartType": "metric", - "valueType": "number", - "drillChart": "none", - "documentType": "_doc", - "action": "", - "aggregationPaths": [ - "Closed Complaints" - ], - "insight": { - "chartResponseMap" : "closedComplaints", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " Total Number of Closed Complaints " - }, - "cumulativeClosedComplaints": { - "chartName": "DSS_TOTAL_CUMULATIVE_CLOSED_COMPLAINTS", - "queries": [ - { - "module": "PGR", - "dateRefField": "Data.dateOfComplaint", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\",\"tenantId\" : \"Data.tenantId\"}", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Total Complaints\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}},\"Closed Complaints\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Closed\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"closed\",\"rejected\",\"resolved\"]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}},\"Reopened Complaints\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Reopened\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"reopened\"]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.tenantId.keyword\"}}}}}}}}}}" - } - ], - "chartType": "line", - "valueType": "number", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Closed Complaints", - "Reopened Complaints", - "Total Complaints" - - ], - "isCumulative": true, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - "totalComplaintsbySource": { - "chartName": "DSS_PGR_TOTAL_COMPLAINTS_BY_SOURCE", - "queries": [ - { - "module": "PGR", - "dateRefField": "Data.dateOfComplaint", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Ivr\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"ivr\":{\"filter\":{\"terms\":{\"Data.source.keyword\":[\"ivr\"]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}},\"Web\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"web\":{\"filter\":{\"terms\":{\"Data.source.keyword\":[\"web\"]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}},\"Whatsapp\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"whatapp\":{\"filter\":{\"terms\":{\"Data.source.keyword\":[\"whatsapp\"]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}},\"Mobileapp\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"mobileapp\":{\"filter\":{\"terms\":{\"Data.source.keyword\":[\"mobileapp\"]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}}}" - } - ], - "chartType": "line", - "valueType": "number", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Ivr", - "Web", - "Whatsapp", - "Mobileapp" - ], - "isCumulative": false, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - "totalComplaintsbyStatus": { - "chartName": "DSS_PGR_TOTAL_COMPLAINTS_BY_STATUS", - "queries": [ - { - "module": "PGR", - "dateRefField": "Data.dateOfComplaint", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\",\"tenantId\" : \"Data.tenantId\"}", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Open\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"open\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"open\"]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}},\"Closed\":{\"date_histogram\":{\"field\":\"Data.dateOfComplaint\",\"interval\":\"intervalvalue\"},\"aggs\":{\"closed\":{\"filter\":{\"terms\":{\"Data.status.keyword\":[\"closed\"]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}}}" - } - ], - "chartType": "line", - "valueType": "number", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Open", - "Closed" - ], - "isCumulative": false, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - "complaintsByStatus": { - "chartName": "DSS_PGR_COMPLAINTS_BY_STATUS", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\",\"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Complaints By Status\":{\"terms\":{\"field\":\"Data.status.keyword\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Complaints By Status" - ], - "insight": { - }, - "_comment": " Complaints By Their Statuses" - }, - "complaintsByChannel": { - "chartName": "DSS_PGR_COMPLAINTS_BY_CHANNELS", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Complaints By Channels\":{\"terms\":{\"field\":\"Data.source.keyword\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Complaints By Channels" - ], - "insight": { - }, - "_comment": " Top 3 Channels For Complaints" - }, - "complaintsByCategory": { - "chartName": "DSS_PGR_COMPLAINTS_BY_CATEGORY", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\",\"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Complaints By Category\":{\"terms\":{\"field\":\"Data.complainCategory.keyword\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Complaints By Category" - ], - "insight": { - }, - "_comment": " Top 3 Channels For Complaints" - }, - "complaintsByTenant": { - "chartName": "DSS_PGR_COMPLAINTS_BY_TENANT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Complaints By Tenant\":{\"terms\":{\"field\":\"Data.tenantId.keyword\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Complaints By Tenant" - ], - "insight": { - }, - "_comment": " Complaints by Tenant" - }, - "complaintsByDistrict": { - "chartName": "DSS_PGR_COMPLAINTS_BY_DISTRICT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Complaints By District\":{\"terms\":{\"field\":\"Data.tenantData.city.districtName.keyword\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Complaints By District" - ], - "insight": { - }, - "_comment": " Complaints by District" - }, - "complaintsByDepartment": { - "chartName": "DSS_PGR_COMPLAINTS_BY_DEPARTMENT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Complaints By Department\":{\"terms\":{\"field\":\"Data.department.keyword\"},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.dateOfComplaint\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Complaints By Department" - ], - "insight": { - }, - "_comment": " Complaints by Department" - }, - "pgrStatusByDDR": { - "chartName": "DSS_PGR_STATUS_BY_DDR", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\",\"tenantId\" : \"Data.tenantId.keyword\" , \"departmentId\" : \"Data.department.keyword\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Closed Complaints\":{\"filters\":{\"filters\":{\"Open\":{\"match\":{\"Data.status.keyword\":\"open\"}},\"Reopen\":{\"match\":{\"Data.status.keyword\":\"reopen\"}},\"Assigned\":{\"match\":{\"Data.status.keyword\":\"assigned\"}},\"Closed\":{\"match\":{\"Data.status.keyword\":\"closed\"}},\"Resolved\":{\"match\":{\"Data.status.keyword\":\"resolved\"}},\"Rejected\":{\"match\":{\"Data.status.keyword\":\"rejected\"}},\"ReassignRequested\":{\"match\":{\"Data.status.keyword\":\"reassignrequested\"}}}}}}}}}" - } - ], - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "pgrStatusByTenant", - "drillFields": [ - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "DDRs", - "aggregationPaths": [ - "Open", - "Reopen", - "Assigned", - "Closed", - "Resolved", - "Rejected", - "ReassignRequested" - ], - "pathDataTypeMapping": [ - { - "Open": "number" - }, - { - "Reopen": "number" - }, - { - "Assigned": "number" - }, - { - "Closed": "number" - }, - { - "Resolved": "number" - }, - { - "Rejected": "number" - }, - { - "ReassignRequested": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - "pgrStatusByTenant": { - "chartName": "DSS_PGR_STATUS_BY_TENANT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId.keyword\" , \"departmentId\" : \"Data.department.keyword\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"ULBs \":{\"terms\":{\"field\":\"Data.tenantId.keyword\",\"size\":1000},\"aggs\":{\"Closed Complaints\":{\"filters\":{\"filters\":{\"Open\":{\"match\":{\"Data.status.keyword\":\"open\"}},\"Reopen\":{\"match\":{\"Data.status.keyword\":\"reopen\"}},\"Assigned\":{\"match\":{\"Data.status.keyword\":\"assigned\"}},\"Closed\":{\"match\":{\"Data.status.keyword\":\"closed\"}},\"Resolved\":{\"match\":{\"Data.status.keyword\":\"resolved\"}},\"Rejected\":{\"match\":{\"Data.status.keyword\":\"rejected\"}},\"ReassignRequested\":{\"match\":{\"Data.status.keyword\":\"reassignrequested\"}}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "tenantId", "column": "Boundary"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "pgrStatusWardDrillDown", - "drillFields": [ - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Boundary", - "aggregationPaths": [ - "Open", - "Reopen", - "Assigned", - "Closed", - "Resolved", - "Rejected", - "ReassignRequested" - ], - "pathDataTypeMapping": [ - { - "Open": "number" - }, - { - "Reopen": "number" - }, - { - "Assigned": "number" - }, - { - "Closed": "number" - }, - { - "Resolved": "number" - }, - { - "Rejected": "number" - }, - { - "ReassignRequested": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - "pgrStatusWardDrillDown": { - "chartName": "", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId.keyword\" , \"departmentId\" : \"Data.department.keyword\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Ward \":{\"terms\":{\"field\":\"Data.complaintWard.name.keyword\",\"size\":1000},\"aggs\":{\"Closed Complaints\":{\"filters\":{\"filters\":{\"Open\":{\"match\":{\"Data.status.keyword\":\"open\"}},\"Reopen\":{\"match\":{\"Data.status.keyword\":\"reopen\"}},\"Assigned\":{\"match\":{\"Data.status.keyword\":\"assigned\"}},\"Closed\":{\"match\":{\"Data.status.keyword\":\"closed\"}},\"Resolved\":{\"match\":{\"Data.status.keyword\":\"resolved\"}},\"Rejected\":{\"match\":{\"Data.status.keyword\":\"rejected\"}},\"ReassignRequested\":{\"match\":{\"Data.status.keyword\":\"reassignrequested\"}}}}}}}}}}}" - } - ], - "filterKeys": [ - ], - "chartType": "table", - "valueType": "number", - "drillChart": "", - "drillFields": [ - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Complaint Ward", - "aggregationPaths": [ - "Open", - "Reopen", - "Assigned", - "Closed", - "Resolved", - "Rejected", - "ReassignRequested" - ], - "pathDataTypeMapping": [ - { - "Open": "number" - }, - { - "Reopen": "number" - }, - { - "Assigned": "number" - }, - { - "Closed": "number" - }, - { - "Resolved": "number" - }, - { - "Rejected": "number" - }, - { - "ReassignRequested": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - "pgrStatusByDepartment": { - "chartName": "DSS_PGR_STATUS_BY_DEPARTMENT", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId.keyword\" }", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Department \":{\"terms\":{\"field\":\"Data.department.keyword\",\"size\":1000},\"aggs\":{\"Closed Complaints\":{\"filters\":{\"filters\":{\"Open\":{\"match\":{\"Data.status.keyword\":\"open\"}},\"Reopen\":{\"match\":{\"Data.status.keyword\":\"reopen\"}},\"Assigned\":{\"match\":{\"Data.status.keyword\":\"assigned\"}},\"Closed\":{\"match\":{\"Data.status.keyword\":\"closed\"}},\"Resolved\":{\"match\":{\"Data.status.keyword\":\"resolved\"}},\"Rejected\":{\"match\":{\"Data.status.keyword\":\"rejected\"}},\"ReassignRequested\":{\"match\":{\"Data.status.keyword\":\"reassignrequested\"}}}}}}}}}}}" - } - ], - "filterKeys": [ - {"key": "departmentId", "column": "Department"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "pgrStatusCategoryDrillDown", - "documentType": "_doc", - "action": "", - "plotLabel": "Department", - "aggregationPaths": [ - "Open", - "Reopen", - "Assigned", - "Closed", - "Resolved", - "Rejected", - "ReassignRequested" - ], - "pathDataTypeMapping": [ - { - "Open": "number" - }, - { - "Reopen": "number" - }, - { - "Assigned": "number" - }, - { - "Closed": "number" - }, - { - "Resolved": "number" - }, - { - "Rejected": "number" - }, - { - "ReassignRequested": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - "pgrStatusCategoryDrillDown": { - "chartName": "", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId.keyword\" , \"departmentId\" : \"Data.department.keyword\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Category \":{\"terms\":{\"field\":\"Data.complainCategory.keyword\",\"size\":1000},\"aggs\":{\"Closed Complaints\":{\"filters\":{\"filters\":{\"Open\":{\"match\":{\"Data.status.keyword\":\"open\"}},\"Reopen\":{\"match\":{\"Data.status.keyword\":\"reopen\"}},\"Assigned\":{\"match\":{\"Data.status.keyword\":\"assigned\"}},\"Closed\":{\"match\":{\"Data.status.keyword\":\"closed\"}},\"Resolved\":{\"match\":{\"Data.status.keyword\":\"resolved\"}},\"Rejected\":{\"match\":{\"Data.status.keyword\":\"rejected\"}},\"ReassignRequested\":{\"match\":{\"Data.status.keyword\":\"reassignrequested\"}}}}}}}}}}}" - } - ], - "filterKeys": [ - ], - "chartType": "table", - "valueType": "number", - "drillChart": "", - "drillFields": [ - "" - ], - "documentType": "_doc", - "action": "", - "plotLabel": "Complaint Category", - "aggregationPaths": [ - "Open", - "Reopen", - "Assigned", - "Closed", - "Resolved", - "Rejected", - "ReassignRequested" - ], - "pathDataTypeMapping": [ - { - "Open": "number" - }, - { - "Reopen": "number" - }, - { - "Assigned": "number" - }, - { - "Closed": "number" - }, - { - "Resolved": "number" - }, - { - "Rejected": "number" - }, - { - "ReassignRequested": "number" - } - ], - "insight": { - }, - "_comment": "" - }, - "topFiveComplaints": { - "chartName": "DSS_PGR_TOP_COMPLAINTS", - "queries": [ - { - "module": "PGR", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "dateRefField": "Data.dateOfComplaint", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Complain Category\":{\"terms\":{\"field\":\"Data.complainCategory.keyword\",\"size\":6,\"order\":{\"Count\":\"desc\"}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"Data.complainCategory.keyword\"}}}}}}}}" - } - ], - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Complain Category" - ], - "insight": { - }, - "_comment": " Complaints By Their Statuses" - }, - "averageTurnAroundTime": { - "chartName": "DSS_AVERAGE_TURN_AROUND_TIME", - "queries": [ - { - "module": "PGR", - "dateRefField": "Data.@timestamp", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"Complaints Average Turn Around Time (in Days)\":{\"date_histogram\":{\"field\":\"Data.@timestamp\",\"interval\":\"intervalvalue\"},\"aggs\":{\"each_open\":{\"terms\":{\"field\":\"_id\",\"min_doc_count\":0, \"size\":200},\"aggs\":{\"Open_Complaints\":{\"nested\":{\"path\":\"Data.actionHistory.actions\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"Data.actionHistory.actions.status.keyword\":[\"open\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"Data.actionHistory.actions.when\"}}}}}},\"Closed_Complaints\":{\"nested\":{\"path\":\"Data.actionHistory.actions\"},\"aggs\":{\"aggrFilter\":{\"filter\":{\"terms\":{\"Data.actionHistory.actions.status.keyword\":[\"closed\"]}},\"aggs\":{\"amount\":{\"sum\":{\"field\":\"Data.actionHistory.actions.when\"}}}}}},\"computedValueATA\":{\"bucket_script\":{\"buckets_path\":{\"max\":\"Closed_Complaints>aggrFilter>amount\",\"min\":\"Open_Complaints>aggrFilter>amount\"},\"script\":{\"source\":\"params.max-params.min\"}}}}}}}}}", - "aggrQuerybc": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Complaints Average Turn Around Time (in Days)\":{\"date_histogram\":{\"field\":\"Data.@timestamp\",\"interval\":\"intervalvalue\"},\"aggs\":{\"each_open\":{\"terms\":{\"field\":\"_id\",\"min_doc_count\":0},\"aggs\":{\"Open_Complaints\":{\"min\":{\"field\":\"Data.actionHistory.actions.when\"}},\"Closed_Complaints\":{\"max\":{\"field\":\"Data.actionHistory.actions.when\"}},\"computedValueATA\":{\"bucket_script\":{\"buckets_path\":{\"max\":\"Closed_Complaints\",\"min\":\"Open_Complaints\"},\"script\":{\"source\":\"if(params.max == null && params.min == null) {0} else {params.max-params.min}\"}}}}}}}}}}}" - } - ], - "chartType": "line", - "valueType": "days", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Complaints Average Turn Around Time (in Days)" - ], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "AverageComputedField", - "fields" : ["computedValueATA"], - "newField" : "ATA", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - "isCumulative": false, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - "pgrCitizenOnDateRange": { - "chartName": "DSS_PGR_CITIZEN", - "queries": [ - { - "module": "PGR", - "dateRefField": "Data.@timestamp", - "requestQueryMap": "{\"wardId\" : \"Data.complaintWard.name.keyword\", \"tenantId\" : \"Data.tenantId\"}", - "indexName": "pgrindex-v1", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"Data.tenantId.keyword\":\"pb.testing\"}}]}},\"aggs\":{\"Citizens\":{\"date_histogram\":{\"field\":\"Data.@timestamp\",\"interval\":\"intervalvalue\"},\"aggs\":{\"count\":{\"cardinality\":{\"field\":\"Data.citizen.uuid.keyword\"}}}}}}}}" - } - ], - "chartType": "line", - "valueType": "number", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Citizens" - ], - "isCumulative": false, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - - - - - "_comment": "W&S charts below-----------------------------------------------------------------------", - "wstodaysCollection": { - "chartName": "DSS_W&S_TODAYS_COLLECTION", - "queries": [ - { - "module": "W&S", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"range\":{\"@timestamp\":{\"gte\":\"now-24h\",\"lte\":\"now\"}}}],\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"Total collection\":{\"sum\":{\"field\":\"totalamount\"}}}}}}", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "" - } - ], - "chartType": "metric", - "valueType": "number", - "action": "", - "drillChart": "none", - "aggregationPaths": [ - "Total Collection" - ], - "insight": { - }, - "_comment": "W&S total collections " - }, - "wstotalCollection": { - "chartName": "DSS_W&S_TOTAL_COLLECTION", - "queries": [ - { - "module": "W&S", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"totalamount\"}}}}}}", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "receiptdate" - } - ], - "translateTenantCode": true, - "chartType": "metric", - "valueType": "amount", - "action": "", - "drillChart": "none", - "aggregationPaths": [ - "Total Collection" - ], - "insight": { - }, - "_comment": "W&S total collections " - }, - "wstargetCollection": { - "chartName": "DSS_W&S_TARGET_COLLECTION", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\", \"tenantId\" : \"ulbName.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}" - } - ], - "chartType": "metric", - "valueType": "amount", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Target Collection" - ], - "isDayUnit": true, - "postAggregationTheory" : "repsonseToDifferenceOfDates", - "insight": { - }, - "_comment": " " - }, - "wstargetAchieved": { - "chartName": "DSS_W&S_TARGET_ACHIEVED", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\r\n \"module\" : \"businessService.keyword\", \n\"tenantId\" : \"ulbName.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Actual collection\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "receiptdate", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"Total Collection\":{\"sum\":{\"field\":\"totalamount\"}}}}}}" - } - - ], - "translateTenantCode": true, - "chartType": "metric", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "aggregationPaths": [ - "Total Collection", - "Actual collection" - ], - "insight": { - "chartResponseMap" : "wstargetAchieved", - "action" : "differenceOfNumbers", - "upwardIndicator" : "positive", - "downwardIndicator" : "negative", - "textMessage" : "$indicator$value% than last $insightInterval", - "colorCode" : "#228B22", - "insightInterval" : "month" - }, - "_comment": " " - }, - "wscumulativeCollections": { - "chartName": "DSS_W&S_TOTAL_CUMULATIVE_COLLECTION", - "queries": [ - { - "module": "W&S", - "dateRefField": "receiptdate", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"Water Sewerage\":{\"date_histogram\":{\"field\":\"receiptdate\",\"interval\":\"intervalvalue\"},\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"terms\":{\"status\":[\"Cancelled\"]}}]}},\"aggs\":{\"approved\":{\"sum\":{\"field\":\"totalamount\"}}}}}}}}" - } - ], - "translateTenantCode": true, - "chartType": "line", - "valueType": "amount", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Water Sewerage" - ], - "isCumulative": true, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - - "wstopPerformingUlbs": { - "chartName": "DSS_W&S_TOP_3_PERFORMING_ULBS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\r\n \"module\" : \"businessService.keyword\", \n\"tenantId\" : \"ulbName.keyword\"}", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"terms\":{\"field\":\"ulbName.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"desc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "receiptdate", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"Total Collection\":{\"terms\":{\"field\":\"cityname.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"desc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"totalamount\"}}}}}}}}" - } - ], - "translateTenantCode": true, - "chartType": "perform", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "plotLabel": "DSS_TARGET_ACHIEVED", - "order": "desc", - "limit": 3, - "aggregationPaths": [ - "Total Collection","Target Collection" - ], - "insight": { - }, - "_comment": " Top Performing Ulbs for target achieved" - }, - "wsbottomPerformingUlbs": { - "chartName": "DSS_W&S_BOTTOM_3_PERFORMING_ULBS", - "queries": [ - { - "module": "COMMON", - "requestQueryMap": "{\"module\" : \"businessService.keyword\",\"tenantId\" : \"ulbName.keyword\" }", - "dateRefField": "", - "indexName": "dss-target_v1", - "aggrQuery": "{\"aggs\":{\"Target Collection\":{\"terms\":{\"field\":\"ulbName.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"asc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"budgetProposedForMunicipalCorporation\"}}}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "receiptdate", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"Total Collection\":{\"terms\":{\"field\":\"cityname.keyword\",\"size\":\"200\",\"order\":{\"Sum\":\"asc\"}},\"aggs\":{\"Sum\":{\"sum\":{\"field\":\"totalamount\"}}}}}}}}" - } - ], - "translateTenantCode": true, - "chartType": "perform", - "valueType": "percentage", - "drillChart": "none", - "documentType": "_doc", - "action": "percentage", - "plotLabel": "DSS_TARGET_ACHIEVED", - "order": "asc", - "limit": 3, - "aggregationPaths": [ - "Total Collection", "Target Collection" - ], - "insight": { - }, - "_comment": " Bottom Performing Ulbs for target achieved" - }, - "wscollectionByUsage": { - "chartName": "DSS_W&S_COLLECTION_BY_USAGE", - "queries": [ - { - "module": "W&S", - "dateRefField": "receiptdate", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"Usage Type\":{\"terms\":{\"field\":\"consumertype.keyword\"},\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"approved\":{\"sum\":{\"field\":\"totalamount\"}}}}}}}}" - } - ], - "translateTenantCode": true, - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Usage Type" - ], - "insight": { - }, - "_comment": " " - }, - - "wsFinancialIndicatorDDR": { - "chartName": "DSS_W&S_DEMAND_COLLECTION_BOUNDARY", - "queries": [ - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "receiptdate", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"Total Collection\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"collection\":{\"sum\":{\"field\":\"totalamount\"}}}},\"Total Receipt\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"receipt\":{\"value_count\":{\"field\":\"receiptnumber.keyword\"}}}}}}" - } - - ], - "isMdmsEnabled": true, - "translateTenantCode": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "wsFinancialIndicatorUlb", - "action": "", - "plotLabel": "DDRs", - "isPostResponseHandler": true, - "postAggregationTheory" : "", - "aggregationPaths": [ - "Total Collection", - "Total Receipt", - "No of Bill", - "Project Demand" - - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Total Receipt": "number" - }, - { - "No of Bill": "number" - }, - { - "Project Demand": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "wsFinancialIndicatorUlb": { - "chartName": "DSS_W&S_DEMAND_COLLECTION_BOUNDARY", - "queries": [ - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "receiptdate", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"ULB\":{\"terms\":{\"field\":\"cityname.keyword\"},\"aggs\":{\"Total Collection\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"collection\":{\"sum\":{\"field\":\"totalamount\"}}}},\"Total Receipt\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"receipt\":{\"value_count\":{\"field\":\"receiptnumber.keyword\"}}}}}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{ \"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "billdate", - "indexName": "demandbillconsumers", - "aggrQuery": "{\"aggs\":{\"ULB\":{\"terms\":{\"field\":\"cityname.keyword\"},\"aggs\":{\"No of Bill\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"approved\":{\"value_count\":{\"field\":\"installmentfrom.keyword\"}}}}}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{ \"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "@timestamp", - "indexName": "projecteddemand-consumers", - "aggrQuery": "{\"aggs\":{\"ULB\":{\"terms\":{\"field\":\"cityname.keyword\"},\"aggs\":{\"Project Demand\":{\"sum\":{\"field\":\"projecteddemand\"}}}}}}" - } - ], - "isMdmsEnabled": false, - "translateTenantCode": true, - "filterKeys": [ - {"key": "tenantId", "column": "ULB"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "wsFinancialIndicatorWard", - "action": "", - "plotLabel": "ULB", - "isPostResponseHandler": true, - "postAggregationTheory" : "", - "aggregationPaths": [ - "Total Collection", - "Total Receipt", - "No of Bill", - "Project Demand" - - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Total Receipt": "number" - }, - { - "No of Bill": "number" - }, - { - "Project Demand": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "wsFinancialIndicatorWard": { - "chartName": "DSS_W&S_DEMAND_COLLECTION_BOUNDARY", - "queries": [ - { - "module": "W&S", - "requestQueryMap": "{ \"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "receiptdate", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"Ward\":{\"terms\":{\"field\":\"block\"},\"aggs\":{\"Total Collection\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"collection\":{\"sum\":{\"field\":\"totalamount\"}}}},\"Total Receipt\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"receipt\":{\"value_count\":{\"field\":\"receiptnumber.keyword\"}}}}}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{ \"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "billdate", - "indexName": "demandbillconsumers", - "aggrQuery": "{\"aggs\":{\"Ward\":{\"terms\":{\"field\":\"block.keyword\"},\"aggs\":{\"No of Bill\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"approved\":{\"value_count\":{\"field\":\"installmentfrom.keyword\"}}}}}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{ \"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "@timestamp", - "indexName": "projecteddemand-consumers", - "aggrQuery": "{\"aggs\":{\"Ward\":{\"terms\":{\"field\":\"block.keyword\"},\"aggs\":{\"Project Demand\":{\"sum\":{\"field\":\"projecteddemand\"}}}}}}" - } - ], - "isMdmsEnabled": false, - "translateTenantCode": true, - "filterKeys": [ - - ], - "chartType": "table", - "valueType": "number", - "drillChart": "", - "action": "", - "plotLabel": "Ward", - "isPostResponseHandler": true, - "postAggregationTheory" : "", - "aggregationPaths": [ - "Total Collection", - "Total Receipt", - "No of Bill", - "Project Demand" - - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Total Receipt": "number" - }, - { - "No of Bill": "number" - }, - { - "Project Demand": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - - "wsTaxHeadDDR": { - "chartName": "DSS_W&S_TAX_HEAD_BOUNDARY", - "queries": [ - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "receiptdate", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"Total Collection\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"collection\":{\"sum\":{\"field\":\"totalamount\"}}}},\"Total Receipt\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"receipt\":{\"value_count\":{\"field\":\"receiptnumber.keyword\"}}}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "billdate", - "indexName": "demandbillconsumers", - "aggrQuery": "{\"aggs\":{\"No of Bill\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"approved\":{\"value_count\":{\"field\":\"installmentfrom.keyword\"}}}},\"Late charges\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"penalty\":{\"sum\":{\"field\":\"penaltycollection\"}}}},\"Interest\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"interest\":{\"sum\":{\"field\":\"interestcollection\"}}}},\"Advance\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"advance\":{\"sum\":{\"field\":\"advancecollection\"}}}},\"Current Charges\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"advance\":{\"sum\":{\"field\":\"currentcharges\"}}}},\"Arrear Charges\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"advance\":{\"sum\":{\"field\":\"arrearcharges\"}}}}}}}" - } - ], - "translateTenantCode": true, - "isMdmsEnabled": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "wsTaxHeadUlb", - "action": "", - "plotLabel": "DDRs", - "postAggregationTheory" : "", - "aggregationPaths": [ - "Total Collection", - "Total Receipt", - "No of Bill", - "Late charges", - "Interest", - "Advance", - "Current Charges", - "Arrear Charges" - - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Total Receipt": "number" - }, - { - "No of Bill": "number" - }, - { - "Late charges": "amount" - }, - { - "Interest": "amount" - }, - { - "Advance": "amount" - }, - { - "Current Charges": "amount" - }, - { - "Arrear Charges": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "wsTaxHeadUlb": { - "chartName": "DSS_W&S_TAX_HEAD_BOUNDARY", - "queries": [ - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "receiptdate", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"ULB\":{\"terms\":{\"field\":\"cityname.keyword\"},\"aggs\":{\"Total Collection\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"collection\":{\"sum\":{\"field\":\"totalamount\"}}}},\"Total Reciept\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"reciept\":{\"value_count\":{\"field\":\"receiptnumber.keyword\"}}}}}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "billdate", - "indexName": "demandbillconsumers", - "aggrQuery": "{\"aggs\":{\"ULB\":{\"terms\":{\"field\":\"cityname.keyword\"},\"aggs\":{\"No of Bill\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"approved\":{\"value_count\":{\"field\":\"installmentfrom.keyword\"}}}},\"Late charges\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"penalty\":{\"sum\":{\"field\":\"penaltycollection\"}}}},\"Interest\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"interest\":{\"sum\":{\"field\":\"interestcollection\"}}}},\"Advance\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"advance\":{\"sum\":{\"field\":\"advancecollection\"}}}},\"Current Charges\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"advance\":{\"sum\":{\"field\":\"currentcharges\"}}}},\"Arrear Charges\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"advance\":{\"sum\":{\"field\":\"arrearcharges\"}}}}}}}}" - } - ], - "translateTenantCode": true, - "isMdmsEnabled": false, - "filterKeys": [ - {"key": "tenantId", "column": "ULB"} - ], - "chartType": "table", - "valueType": "number", - "drillChart": "wsTaxHeadWard", - "action": "", - "plotLabel": "ULB", - "postAggregationTheory" : "", - "aggregationPaths": [ - "Total Collection", - "Total Receipt", - "No of Bill", - "Late charges", - "Interest", - "Advance", - "Current Charges", - "Arrear Charges" - - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Total Receipt": "number" - }, - { - "No of Bill": "number" - }, - { - "Late charges": "amount" - }, - { - "Interest": "amount" - }, - { - "Advance": "amount" - }, - { - "Current Charges": "amount" - }, - { - "Arrear Charges": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - "wsTaxHeadWard": { - "chartName": "DSS_W&S_TAX_HEAD_BOUNDARY", - "queries": [ - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "receiptdate", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"Ward\":{\"terms\":{\"field\":\"block\"},\"aggs\":{\"Total Collection\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"collection\":{\"sum\":{\"field\":\"totalamount\"}}}},\"Total Reciept\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"status\":\"Cancelled\"}}]}},\"aggs\":{\"reciept\":{\"value_count\":{\"field\":\"receiptnumber.keyword\"}}}}}}}}" - }, - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "billdate", - "indexName": "demandbillconsumers", - "aggrQuery": "{\"aggs\":{\"Ward\":{\"terms\":{\"field\":\"block.keyword\"},\"aggs\":{\"No of Bill\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"approved\":{\"value_count\":{\"field\":\"installmentfrom.keyword\"}}}},\"Late charges\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"penalty\":{\"sum\":{\"field\":\"penaltycollection\"}}}},\"Interest\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"interest\":{\"sum\":{\"field\":\"interestcollection\"}}}},\"Advance\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"advance\":{\"sum\":{\"field\":\"advancecollection\"}}}},\"Current Charges\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"advance\":{\"sum\":{\"field\":\"currentcharges\"}}}},\"Arrear Charges\":{\"filter\":{\"term\":{\"billgenerated\":true}},\"aggs\":{\"advance\":{\"sum\":{\"field\":\"arrearcharges\"}}}}}}}}" - } - ], - "isMdmsEnabled": false, - "translateTenantCode": true, - "filterKeys": [ - ], - "chartType": "table", - "valueType": "number", - "drillChart": "", - "action": "", - "plotLabel": "Ward", - "postAggregationTheory" : "", - "aggregationPaths": [ - "Total Collection", - "Total Receipt", - "No of Bill", - "Late charges", - "Interest", - "Advance", - "Current Charges", - "Arrear Charges" - - ], - "pathDataTypeMapping": [ - { - "Total Collection": "amount" - }, - { - "Total Receipt": "number" - }, - { - "No of Bill": "number" - }, - { - "Late charges": "amount" - }, - { - "Interest": "amount" - }, - { - "Advance": "amount" - }, - { - "Current Charges": "amount" - }, - { - "Arrear Charges": "amount" - } - ], - "insight": { - }, - "_comment": "" - }, - - "wstotalConnection": { - "chartName": "DSS_W&S_CONNECTIONS", - "queries": [ - { - "module": "W&S", - "indexName": "wsapplications", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"applicationstatus.keyword\":\"Cancelled\"}}],\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Water Charges\",\"Sewerage Charges\"]}}]}},\"aggs\":{\"Total Connection\":{\"value_count\":{\"field\":\"applicationnumber.keyword\"}}}}}}", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "@timestamp" - } - ], - "translateTenantCode": true, - "chartType": "metric", - "valueType": "number", - "action": "", - "drillChart": "none", - "aggregationPaths": [ - "Total Connection" - ], - "insight": { - }, - "_comment": " " - }, - "wsActiveUlbs": { - "chartName": "DSS_W&S_ACTIVE_ULBS", - "queries": [ - { - "module": "W&S", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"Active Ulbs\":{\"cardinality\":{\"field\":\"cityname.keyword\"}}}}", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "receiptdate" - } - ], - "translateTenantCode": true, - "chartType": "metric", - "valueType": "number", - "action": "", - "drillChart": "none", - "aggregationPaths": [ - "Active Ulbs" - ], - "insight": { - }, - "_comment": " " - }, - "wsNewWaterConnection": { - "chartName": "DSS_W&S_WATER_CONNECTIONS", - "queries": [ - { - "module": "W&S", - "indexName": "wsapplications", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"applicationstatus.keyword\":\"Cancelled\"}}],\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Water Charges\"]}}]}},\"aggs\":{\"Water Connections\":{\"value_count\":{\"field\":\"id.keyword\"}}}}}}", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "@timestamp" - } - ], - "translateTenantCode": true, - "chartType": "metric", - "valueType": "number", - "action": "", - "drillChart": "none", - "aggregationPaths": [ - "Water Connections" - ], - "insight": { - }, - "_comment": " " - }, - "wsNewSewerageConnection": { - "chartName": "DSS_W&S_WATER_CONNECTIONS", - "queries": [ - { - "module": "W&S", - "indexName": "wsapplications", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"applicationstatus.keyword\":\"Cancelled\"}}],\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Sewerage Charges\"]}}]}},\"aggs\":{\"Sewerage Connections\":{\"value_count\":{\"field\":\"id.keyword\"}}}}}}", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "dateRefField": "@timestamp" - } - ], - "translateTenantCode": true, - "chartType": "metric", - "valueType": "number", - "action": "", - "drillChart": "none", - "aggregationPaths": [ - "Sewerage Connections" - ], - "insight": { - }, - "_comment": " " - }, - - "wscumulativeConnections": { - "chartName": "DSS_W&S_CUMULATIVE_COLLECTION", - "queries": [ - { - "module": "W&S", - "dateRefField": "@timestamp", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "indexName": "wsapplications", - "aggrQuery": "{\"aggs\":{\"Water Connections\":{\"date_histogram\":{\"field\":\"@timestamp\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Water\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Water Charges\"]}}],\"must_not\":[{\"terms\":{\"applicationstatus.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"id.keyword\"}}}}}},\"Sewerage Connections\":{\"date_histogram\":{\"field\":\"@timestamp\",\"interval\":\"intervalvalue\"},\"aggs\":{\"Water\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Sewerage Charges\"]}}],\"must_not\":[{\"terms\":{\"applicationstatus.keyword\":[\"Cancelled\"]}}]}},\"aggs\":{\"Count\":{\"value_count\":{\"field\":\"id.keyword\"}}}}}}}}" - } - ], - "translateTenantCode": true, - "chartType": "line", - "valueType": "number", - "action": "", - "drillChart": "none", - "documentType": "_doc", - "aggregationPaths": [ - "Water Connections", - "Sewerage Connections" - - ], - "isCumulative": true, - "interval": "month", - "insight": { - }, - "_comment": " " - }, - - "wsConsumersByConnectionType": { - "chartName": "DSS_W&S_WATER_CONNECTION_BY_USAGE", - "queries": [ - { - "module": "W&S", - "dateRefField": "@timestamp", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "indexName": "waterchargesconsumers", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Water Charges\"]}},{\"terms\":{\"connectionstatus.keyword\":[\"ACTIVE\"]}}]}},\"aggs\":{\"Water Consumers by Connection Type\":{\"terms\":{\"field\":\"connectiontype.keyword\",\"size\":170}}}}}}" - } - ], - "translateTenantCode": true, - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "Water Consumers by Connection Type" - ], - "insight": { - }, - "_comment": " " - }, - - "wsConsumersByUsageType": { - "chartName": "DSS_W&S_CONNECTION_BY_USAGE", - "queries": [ - { - "module": "W&S", - "dateRefField": "@timestamp", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "indexName": "waterchargesconsumers", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"applicationstatus.keyword\":\"Cancelled\"}}],\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Water Charges\",\"Sewerage Charges\"]}},{\"terms\":{\"connectionstatus.keyword\":[\"ACTIVE\"]}}]}},\"aggs\":{\"W & S Consumers by Usage Type\":{\"terms\":{\"field\":\"usage.keyword\"}}}}}}" - } - ], - "translateTenantCode": true, - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "W & S Consumers by Usage Type" - ], - "insight": { - }, - "_comment": " " - }, - - "wsConsumersByChannel": { - "chartName": "DSS_W&S_CONNECTION_BY_CHANNEL", - "queries": [ - { - "module": "W&S", - "dateRefField": "@timestamp", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\"}", - "indexName": "receipts-consumers", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must_not\":[{\"term\":{\"channel\":\"FIELD\"}},{\"term\":{\"channel\":\"SYSTEM\"}}],\"must\":[{\"term\":{\"status\":\"Approved\"}}]}},\"aggs\":{\"W & S Consumers by Channel\":{\"terms\":{\"field\":\"channel\",\"size\":7}}}}}}" - } - ], - "translateTenantCode": true, - "chartType": "pie", - "valueType": "number", - "action": "", - "documentType": "_doc", - "drillChart": "none", - "aggregationPaths": [ - "W & S Consumers by Channel" - ], - "insight": { - }, - "_comment": " " - }, - - "wsConnectionAgeingDDR": { - "chartName": "DSS_W&S_CONNECTION_AGEING", - "queries": [ - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "@timestamp", - "indexName": "wsapplications", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Water Charges\",\"Sewerage Charges\"]}},{\"terms\":{\"applicationstatus.keyword\":[\"Created\",\"Rejected\",\"Verified\",\"verified\"]}}]}},\"aggs\":{\"Pending lt 3 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-3d/d\",\"to\":\"now\"}]}},\"Pending gt 3 and lt 7 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-1w\",\"to\":\"now-3d/d\"}]}},\"Pending gt 7 and lt 15 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-15d\",\"to\":\"now-1w\"}]}},\"Pending gt 15 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-2y\",\"to\":\"now-15d\"}]}}}}}}" - } - ], - "isMdmsEnabled": true, - "translateTenantCode": true, - "filterKeys": [ - {"key": "tenantId", "column": "DDRs"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "wsConnectionAgeingUlb", - "action": "", - "plotLabel": "DDRs", - "isPostResponseHandler": true, - "postAggregationTheory" : "", - "aggregationPaths": [ - "Pending lt 3 days", - "Pending gt 3 and lt 7 days", - "Pending gt 7 and lt 15 days", - "Pending gt 15 days" - ], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "AdditiveComputedField", - "fields" : [ "Pending lt 3 days", "Pending gt 3 and lt 7 days", "Pending gt 7 and lt 15 days", "Pending gt 15 days"], - "newField" : "Total Pending", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - - "insight": { - }, - "_comment": "" - }, - "wsConnectionAgeingUlb": { - "chartName": "DSS_W&S_CONNECTION_AGEING", - "queries": [ - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "@timestamp", - "indexName": "wsapplications", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Water Charges\",\"Sewerage Charges\"]}},{\"terms\":{\"applicationstatus.keyword\":[\"Created\",\"Rejected\",\"Verified\",\"verified\"]}}]}},\"aggs\":{\"2\":{\"terms\":{\"field\":\"cityname.keyword\",\"size\":170,\"order\":{\"_key\":\"asc\"}},\"aggs\":{\"Pending lt 3 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-3d/d\",\"to\":\"now\"}]}},\"Pending gt 3 and lt 7 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-1w\",\"to\":\"now-3d/d\"}]}},\"Pending gt 7 and lt 15 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-15d\",\"to\":\"now-1w\"}]}},\"Pending gt 15 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-2y\",\"to\":\"now-15d\"}]}}}}}}}}" - } - ], - "isMdmsEnabled": false, - "translateTenantCode": true, - "filterKeys": [ - {"key": "tenantId", "column": "ULB"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "wsConnectionAgeingWard", - "action": "", - "plotLabel": "ULB", - "isPostResponseHandler": true, - "postAggregationTheory" : "", - "aggregationPaths": [ - "Pending lt 3 days", - "Pending gt 3 and lt 7 days", - "Pending gt 7 and lt 15 days", - "Pending gt 15 days" - - ], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "AdditiveComputedField", - "fields" : [ "Pending lt 3 days", "Pending gt 3 and lt 7 days", "Pending gt 7 and lt 15 days", "Pending gt 15 days"], - "newField" : "Total Pending", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - - "insight": { - }, - "_comment": "" - }, - "wsConnectionAgeingWard": { - "chartName": "DSS_W&S_CONNECTION_AGEING", - "queries": [ - { - "module": "W&S", - "requestQueryMap": "{\"tenantId\" : \"cityname.keyword\", \"wardId\" : \"block.keyword\" }", - "dateRefField": "@timestamp", - "indexName": "wsapplications", - "aggrQuery": "{\"aggs\":{\"AGGR\":{\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"servicetype.keyword\":[\"Water Charges\",\"Sewerage Charges\"]}},{\"terms\":{\"applicationstatus.keyword\":[\"Created\",\"Rejected\",\"Verified\",\"verified\"]}}]}},\"aggs\":{\"2\":{\"terms\":{\"field\":\"block.keyword\",\"size\":170,\"order\":{\"_key\":\"asc\"}},\"aggs\":{\"Pending lt 3 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-3d/d\",\"to\":\"now\"}]}},\"Pending gt 3 and lt 7 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-1w\",\"to\":\"now-3d/d\"}]}},\"Pending gt 7 and lt 15 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-15d\",\"to\":\"now-1w\"}]}},\"Pending gt 15 days\":{\"date_range\":{\"field\":\"applicationdate\",\"ranges\":[{\"from\":\"now-2y\",\"to\":\"now-15d\"}]}}}}}}}}" - } - ], - "isMdmsEnabled": false, - "translateTenantCode": true, - "filterKeys": [ - {"key": "tenantId", "column": "Ward"} - ], - "chartType": "xtable", - "valueType": "number", - "drillChart": "", - "action": "", - "plotLabel": "Ward", - "isPostResponseHandler": true, - "postAggregationTheory" : "", - "aggregationPaths": [ - "Pending lt 3 days", - "Pending gt 3 and lt 7 days", - "Pending gt 7 and lt 15 days", - "Pending gt 15 days" - - ], - "computedFields": [ - { - "postAggregationTheory" : "", - "actionName": "AdditiveComputedField", - "fields" : [ "Pending lt 3 days", "Pending gt 3 and lt 7 days", "Pending gt 7 and lt 15 days", "Pending gt 15 days"], - "newField" : "Total Pending", - "_comments": "fields are field names picked from its aggregation query to use post aggregation newField value with given new field name " - } - ], - - "insight": { - }, - "_comment": "" - } -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/resources/schema/MasterDashboardConfig.json b/business-services/dashboard-analytics/src/main/resources/schema/MasterDashboardConfig.json deleted file mode 100644 index b15e9519c40..00000000000 --- a/business-services/dashboard-analytics/src/main/resources/schema/MasterDashboardConfig.json +++ /dev/null @@ -1,3789 +0,0 @@ -{ - "_comment": "Master dashboard which holds all the possible visualisation. Note new dashboards/visualisations can be added", - "dashboards": [ - { - "name": "DSS_OVERVIEW_DASHBOARD", - "id": "overview", - "isActive": "", - "style": "", - "visualizations": [ - { - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 111, - "name": "DSS_OVERVIEW", - "vizType": "metric-collection", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "todaysCollectionv2", - "name": "DSS_TOTAL_COLLECTION_TODAY", - "code": "", - "chartType": "", - "filter": {"title": "TODAY"}, - "headers": [] - }, - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetCollection", - "name": "DSS_TARGET_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchievedv2", - "name": "DSS_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 112, - "name": "DSS_TOTAL_CUMULATIVE_COLLECTION", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "label": "", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "cumulativeCollectionv2", - "name": "Weekly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 121, - "name": "DSS_TOP_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "topPerformingUlbsv2", - "name": "DSS_TOP_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 122, - "name": "DSS_BOTTOM_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsv2", - "name": "DSS_BOTTOM_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 123, - "name": "DSS_TOTAL_CUMULATIVE_COLLECTION:_DEPARTMENT_WISE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "totalCollectionDeptWisev2", - "name": "DSS_TOTAL_CUMULATIVE_COLLECTION:_DEPARTMENT_WISE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 131, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 450, - "width": 5 - }, - "vizType": "metric-collection", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "totalApplication", - "name": "DSS_TOTAL_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "closedApplication", - "name": "DSS_CLOSED_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "slaAchieved", - "name": "DSS_SLA_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "citizenRegistered", - "name": "DSS_CITIZEN_REGISTERED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 132, - "name": "DSS_TOTAL_APPLICATION_&_CLOSED_APPLICATION", - "dimensions": { - "height": 450, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "totalApplication&ClosedApplication", - "name": "DSS_TOTAL_APPLICATION_&_CLOSED_APPLICATION", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 141, - "name": "DSS_TOP_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "topPerformingUlbsCompletionRate", - "name": "DSS_TOP_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 142, - "name": "DSS_BOTTOM_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsCompletionRate", - "name": "DSS_BOTTOM_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 143, - "name": "DSS_TOTAL_APPLICATIONS:_DEPARTMENT_WISE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "totalApplicationDeptWise", - "name": "DSS_TOTAL_APPLICATIONS:_DEPARTMENT_WISE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - } - ] - }, - { - "name": "DSS_TRADE_LICENSE_DASHBOARD", - "id": "tradeLicense", - "isActive": "", - "style": "linear", - "visualizations": [ - { - "row": 1, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 311, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "label": "DSS_OVERVIEW", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "todaysCollectionv2", - "name": "DSS_TOTAL_COLLECTION_TODAY", - "code": "", - "chartType": "metric", - "filter": {"title": "TODAY"}, - "headers": [] - }, - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetCollection", - "name": "DSS_TARGET_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchievedv2", - "name": "DSS_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 312, - "name": "Total Cumulative Collection", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "label": "", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "cumulativeCollectionv2", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 321, - "name": "DSS_TL_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "topPerformingUlbsv2", - "name": "DSS_TL_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 322, - "name": "DSS_TL_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsv2", - "name": "DSS_TL_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 323, - "name": "DSS_TL_LICENSE_BY_TYPE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "licenseByLicenseTypev2", - "name": "DSS_TL_LICENSE_BY_TYPE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_TL_KEY_FY_INDICATORS", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "licenseIssuedDDRRevenuev2", - "name": "DSS_TL_DEMAND_COLLECTION_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - }, - { - "row": 5, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_TL_TAX_HEAD_BREAKUP", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "licenceTaxHeadsBreakupDDRv2", - "name": "DSS_TL_TAX_HEAD_BREAKUP_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - }, - { - "row": 6, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 341, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "isCollapsible": false, - "label": "DSS_OVERVIEW", - "charts": [ - { - "id": "totalApplication", - "name": "DSS_TOTAL_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "licenseIssued", - "name": "DSS_TL_LICENSE_ISSUED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "activeUlbs", - "name": "DSS_PT_TOTAL_ACTIVE_ULBS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 342, - "name": "DSS_TL_CUMULATIVE_LICENSE_ISSUED", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "cumulativeLicenseIssued", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 7, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 351, - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "topPerformingUlbsCompletionRate", - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 352, - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsCompletionRate", - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 353, - "name": "DSS_TL_LICENSE_BY_STATUS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "licenseApplicationByStatus", - "name": "DSS_TL_LICENSE_BY_STATUS", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 8, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 351, - "name": "DSS_TL_STATUS_BOUNDARY", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "tlStatusByDDR", - "name": "", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - - } - ] - } - ] - } - ] - }, - { - "name": "DSS_PGR_DASHBOARD", - "id": "pgr", - "isActive": "", - "style": "linear", - "visualizations": [ - { - "row": 1, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 412, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "label": "DSS_OVERVIEW", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "totalComplaints", - "name": "DSS_PGR_TOTAL_COMPLAINTS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "closedComplaints", - "name": "DSS_PGR_CLOSED_COMPLAINTS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "slaAchieved", - "name": "DSS_SLA_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "completionRate", - "name": "DSS_PGR_COMPLETION_RATE", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 412, - "name": "DSS_TOTAL_CUMULATIVE_CLOSED_COMPLAINTS", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "cumulativeClosedComplaints", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 412, - "name": "DSS_TOTAL_COMPLAINTS_BY_SOURCE", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "totalComplaintsbySource", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 413, - "name": "DSS_TOTAL_COMPLAINTS_STATUS", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "totalComplaintsbyStatus", - "name": "", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 421, - "name": "DSS_PGR_COMPLAINTS_BY_STATUS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "complaintsByStatus", - "name": "DSS_PGR_COMPLAINTS_BY_STATUS", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 423, - "name": "DSS_PGR_COMPLAINTS_BY_CHANNEL", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "complaintsByChannel", - "name": "DSS_PGR_COMPLAINTS_BY_CHANNEL", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 423, - "name": "DSS_PGR_COMPLAINTS_BY_DEPARTMENT", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "complaintsByDepartment", - "name": "DSS_PGR_COMPLAINTS_BY_DEPARTMENT", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - - ] - }, - { - "row": 4, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 421, - "name": "DSS_PGR_CITIZENS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "pgrCitizenOnDateRange", - "name": "DSS_PGR_CITIZENS", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 424, - "name": "DSS_PGR_TOP_COMPLAINTS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "topFiveComplaints", - "name": "DSS_PGR_TOP_COMPLAINTS", - "code": "", - "chartType": "horizontalBar", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 431, - "name": "DSS_PGR_STATUS_BY_TENANT", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "xpgrStatusByDDR", - "name": "DSS_PGR_STATUS_BY_TENANT", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - }, - { - "id": "xpgrStatusByDept", - "name": "DSS_PGR_STATUS_BY_DEPARTMENT", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Department" - } - ] - } - ] - } - ] - }, - - { - "name": "DSS_HOME_DASHBOARD", - "id": "home", - "isActive": "", - "style": "", - "title": "title", - "visualizations": [ - { - "name": "DSS_OVERVIEW", - "row": 1, - "vizArray": [ - { - "id": 111, - "name": "DSS_OVERVIEW", - "vizType": "collection", - "noUnit": true, - "isCollapsible": false, - "ref": { - "url": "overview", - "logoUrl": "", - "type": "internal" - }, - "charts": [ - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchievedv2", - "name": "DSS_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "totalApplication", - "name": "DSS_TOTAL_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "slaAchieved", - "name": "DSS_SLA_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_OVERVIEW", - "vizArray": [ - { - "id": 121, - "name": "DSS_PROPERTY_TAX", - "vizType": "module", - "moduleLevel": "PT", - "type": "", - "noUnit": false, - "isCollapsible": false, - "ref": { - "url": "propertytax", - "logoUrl": "", - "type": "internal" - }, - "label": "", - "charts": [ - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "propertiesAssessed", - "name": "DSS_PT_TOTAL_PROPERTIES_ASSESSED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 141, - "name": "DSS_TRADE_LICENCE", - "vizType": "module", - "moduleLevel": "TL", - "ref": { - "url": "tradelicense", - "logoUrl": "", - "type": "internal" - }, - "label": "", - "charts": [ - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "totalApplication", - "name": "DSS_TOTAL_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 141, - "name": "DSS_COMPLAINS", - "vizType": "module", - "moduleLevel": "PGR", - "ref": { - "url": "pgr", - "logoUrl": "", - "type": "internal" - }, - "label": "", - "charts": [ - { - "id": "totalComplaints", - "name": "DSS_PGR_TOTAL_COMPLAINTS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "slaAchieved", - "name": "DSS_SLA_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 142, - "name": "DSS_WATER_SEWERAGE", - "vizType": "module", - "moduleLevel": "W&S", - "ref": { - "url": "ws", - "logoUrl": "", - "type": "internal" - }, - "label": "", - "charts": [ - { - "id": "wstotalCollection", - "name": "DSS_WS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wstotalConnection", - "name": "DSS_WS_TOTAL_CONNECTIONS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - } - ] - } - ] - }, - { - "name": "DSS_PROPERTY_TAX_DASHBOARD", - "id": "propertyTax", - "isActive": "", - "style": "linear", - "visualizations": [ - { - "row": 1, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 211, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "noUnit": true, - "isCollapsible": false, - "label": "DSS_OVERVIEW", - "charts": [ - - { - "id": "todaysCollectionv2", - "name": "DSS_TOTAL_COLLECTION_TODAY", - "code": "", - "chartType": "metric", - "filter": {"title": "TODAY"}, - "headers": [] - }, - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetCollection", - "name": "DSS_TARGET_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchievedv2", - "name": "DSS_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 212, - "name": "DSS_TOTAL_CUMULATIVE_COLLECTION", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "cumulativeCollectionv2", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 221, - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "topPerformingUlbsv2", - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 222, - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsv2", - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 223, - "name": "DSS_PT_COLLECTION_BY_USAGE_TYPE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "collectionByUsageTypev2", - "name": "DSS_PT_COLLECTION_BY_USAGE_TYPE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_PT_KEY_FY_INDICATORS", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "demandCollectionIndexDDRRevenuev2", - "name": "DSS_PT_DEMAND_COLLECTION_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - }, - { - "id": "demandCollectionIndexUsageRevenuev2", - "name": "DSS_PT_DEMAND_COLLECTION_USAGETYPE", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Usage" - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_PT_TAX_HEAD", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "taxHeadsBreakupDDRRevenuev2", - "name": "DSS_PT_TAX_HEAD_BREAKUP_REVENUE", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - }, - { - "id": "taxHeadsBreakupUsagev2", - "name": "DSS_PT_TAX_HEAD_BREAKUP_USAGE", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Usage" - } - ] - } - ] - }, - { - "row": 5, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 241, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "isCollapsible": false, - "label": "DSS_OVERVIEW", - "charts": [ - { - "id": "propertiesAssessed", - "name": "DSS_PT_TOTAL_PROPERTIES_ASSESSED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "totalAssessment", - "name": "DSS_PT_TOTAL_ASSESSMENTS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "activeUlbs", - "name": "DSS_PT_TOTAL_ACTIVE_ULBS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 242, - "name": "DSS_PT_CUMULATIVE_PROPERTIES_ASSESSED", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "cumulativePropertiesAssessed", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 6, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 251, - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "topPerformingUlbsCompletionRate", - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 252, - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsCompletionRate", - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 253, - "name": "DSS_PT_PROPERTIES_BY_USAGE_TYPE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "propertiesByUsageType", - "name": "DSS_PT_PROPERTIES_BY_USAGE_TYPE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 254, - "name": "DSS_PT_PROPERTIES_BY_TENANT", - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "propertiesByTenant", - "name": "DSS_PT_PROPERTIES_BY_TENANT", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 7, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 231, - "name": "DSS_PT_PROPERTIES_BY_FINANCIAL_YEAR", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "xptFyByDDR", - "name": "", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - } - ] - }, - - { - "name": "DSS_PGR_DASHBOARD", - "id": "ulb-pgr", - "isActive": "", - "style": "linear", - "visualizations": [ - { - "row": 1, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 412, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "label": "DSS_OVERVIEW", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "totalComplaints", - "name": "DSS_PGR_TOTAL_COMPLAINTS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "closedComplaints", - "name": "DSS_PGR_CLOSED_COMPLAINTS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "slaAchieved", - "name": "DSS_SLA_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "completionRate", - "name": "DSS_PGR_COMPLETION_RATE", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 412, - "name": "DSS_TOTAL_CUMULATIVE_CLOSED_COMPLAINTS", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "cumulativeClosedComplaints", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 412, - "name": "DSS_TOTAL_COMPLAINTS_BY_SOURCE", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "totalComplaintsbySource", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 413, - "name": "DSS_TOTAL_COMPLAINTS_STATUS", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "totalComplaintsbyStatus", - "name": "", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 421, - "name": "DSS_PGR_COMPLAINTS_BY_STATUS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "complaintsByStatus", - "name": "DSS_PGR_COMPLAINTS_BY_STATUS", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 423, - "name": "DSS_PGR_COMPLAINTS_BY_CHANNEL", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "complaintsByChannel", - "name": "DSS_PGR_COMPLAINTS_BY_CHANNEL", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 423, - "name": "DSS_PGR_COMPLAINTS_BY_DEPARTMENT", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "complaintsByDepartment", - "name": "DSS_PGR_COMPLAINTS_BY_DEPARTMENT", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - - ] - }, - { - "row": 4, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 421, - "name": "DSS_PGR_AVARAGE_TURN_AROUND", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "averageTurnAroundTime", - "name": "DSS_PGR_AVARAGE_TURN_AROUND", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 424, - "name": "DSS_PGR_TOP_COMPLAINTS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "topFiveComplaints", - "name": "DSS_PGR_TOP_COMPLAINTS", - "code": "", - "chartType": "horizontalBar", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 431, - "name": "DSS_PGR_STATUS_BY_TENANT", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "xpgrStatusByDDR", - "name": "DSS_PGR_STATUS_BY_TENANT", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - }, - { - "id": "xpgrStatusByDept", - "name": "DSS_PGR_STATUS_BY_DEPARTMENT", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Department" - } - ] - } - ] - } - ] - }, - { - "name": "DSS_PROPERTY_TAX_DASHBOARD", - "id": "ulb-propertyTax", - "isActive": "", - "style": "linear", - "visualizations": [ - { - "row": 1, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 211, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "noUnit": true, - "isCollapsible": false, - "label": "DSS_OVERVIEW", - "charts": [ - { - "id": "todaysCollectionv2", - "name": "DSS_TOTAL_COLLECTION_TODAY", - "code": "", - "chartType": "metric", - "filter": {"title": "TODAY"}, - "headers": [] - }, - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetCollection", - "name": "DSS_TARGET_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchievedv2", - "name": "DSS_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 212, - "name": "DSS_TOTAL_CUMULATIVE_COLLECTION", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "cumulativeCollectionv2", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 221, - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "topPerformingUlbsv2", - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 222, - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsv2", - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 223, - "name": "DSS_PT_COLLECTION_BY_USAGE_TYPE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "collectionByUsageTypev2", - "name": "DSS_PT_COLLECTION_BY_USAGE_TYPE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_PT_DEMAND_COLLECTION", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "demandCollectionIndexDDRRevenuev2", - "name": "DSS_PT_DEMAND_COLLECTION_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - }, - { - "id": "demandCollectionIndexUsageRevenuev2", - "name": "DSS_PT_DEMAND_COLLECTION_USAGETYPE", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Usage" - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_PT_TAX_HEAD", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "taxHeadsBreakupDDRRevenuev2", - "name": "DSS_PT_TAX_HEAD_BREAKUP_REVENUE", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - }, - { - "id": "taxHeadsBreakupUsagev2", - "name": "DSS_PT_TAX_HEAD_BREAKUP_USAGE", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Usage" - } - ] - } - ] - }, - { - "row": 5, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 241, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "isCollapsible": false, - "label": "DSS_OVERVIEW", - "charts": [ - { - "id": "propertiesAssessed", - "name": "DSS_PT_TOTAL_PROPERTIES_ASSESSED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "totalAssessment", - "name": "DSS_PT_TOTAL_ASSESSMENTS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "activeUlbs", - "name": "DSS_PT_TOTAL_ACTIVE_ULBS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 242, - "name": "DSS_PT_CUMULATIVE_PROPERTIES_ASSESSED", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "cumulativePropertiesAssessed", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 6, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 251, - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "topPerformingUlbsCompletionRate", - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 252, - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsCompletionRate", - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 253, - "name": "DSS_PT_PROPERTIES_BY_USAGE_TYPE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "propertiesByUsageType", - "name": "DSS_PT_PROPERTIES_BY_USAGE_TYPE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 7, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 231, - "name": "DSS_PT_PROPERTIES_BY_FINANCIAL_YEAR", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "xptFyByDDR", - "name": "", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - } - ] - }, - { - "name": "DSS_TRADE_LICENSE_DASHBOARD", - "id": "ulb-tradeLicense", - "isActive": "", - "style": "linear", - "visualizations": [ - { - "row": 1, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 311, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "label": "DSS_OVERVIEW", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "todaysCollectionv2", - "name": "DSS_TOTAL_COLLECTION_TODAY", - "code": "", - "chartType": "metric", - "filter": {"title": "TODAY"}, - "headers": [] - }, - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetCollection", - "name": "DSS_TARGET_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchievedv2", - "name": "DSS_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 312, - "name": "Total Cumulative Collection", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "label": "", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "cumulativeCollectionv2", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 321, - "name": "DSS_TL_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "topPerformingUlbsv2", - "name": "DSS_TL_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 322, - "name": "DSS_TL_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsv2", - "name": "DSS_TL_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 323, - "name": "DSS_TL_LICENSE_BY_TYPE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "licenseByLicenseTypev2", - "name": "DSS_TL_LICENSE_BY_TYPE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_TL_KEY_FY_INDICATORS", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "licenseIssuedDDRRevenuev2", - "name": "DSS_TL_DEMAND_COLLECTION_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - }, - { - "row": 5, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_TL_TAX_HEAD_BREAKUP", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "licenceTaxHeadsBreakupDDRv2", - "name": "DSS_TL_TAX_HEAD_BREAKUP_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - }, - { - "row": 6, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 341, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "isCollapsible": false, - "label": "DSS_OVERVIEW", - "charts": [ - { - "id": "totalApplication", - "name": "DSS_TOTAL_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "licenseIssued", - "name": "DSS_TL_LICENSE_ISSUED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "activeUlbs", - "name": "DSS_PT_TOTAL_ACTIVE_ULBS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 342, - "name": "DSS_TL_CUMULATIVE_LICENSE_ISSUED", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "cumulativeLicenseIssued", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 7, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 351, - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "label": "", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "topPerformingUlbsCompletionRate", - "name": "DSS_PT_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 352, - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsCompletionRate", - "name": "DSS_PT_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 353, - "name": "DSS_TL_LICENSE_BY_STATUS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "licenseApplicationByStatus", - "name": "DSS_TL_LICENSE_BY_STATUS", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 8, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 351, - "name": "DSS_TL_STATUS_BOUNDARY", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "tlStatusByDDR", - "name": "", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - - } - ] - } - ] - } - ] - }, - { - "name": "DSS_OVERVIEW_DASHBOARD", - "id": "ulb-overview", - "isActive": "", - "style": "", - "visualizations": [ - { - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 111, - "name": "DSS_OVERVIEW", - "vizType": "metric-collection", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "todaysCollectionv2", - "name": "DSS_TOTAL_COLLECTION_TODAY", - "code": "", - "chartType": "", - "filter": {"title": "TODAY"}, - "headers": [] - }, - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetCollection", - "name": "DSS_TARGET_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchievedv2", - "name": "DSS_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 112, - "name": "DSS_TOTAL_CUMULATIVE_COLLECTION", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "label": "", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "cumulativeCollectionv2", - "name": "Weekly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 121, - "name": "DSS_TOP_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "topPerformingUlbsv2", - "name": "DSS_TOP_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 122, - "name": "DSS_BOTTOM_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsv2", - "name": "DSS_BOTTOM_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 123, - "name": "DSS_TOTAL_CUMULATIVE_COLLECTION:_DEPARTMENT_WISE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "totalCollectionDeptWisev2", - "name": "DSS_TOTAL_CUMULATIVE_COLLECTION:_DEPARTMENT_WISE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 131, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 450, - "width": 5 - }, - "vizType": "metric-collection", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "totalApplication", - "name": "DSS_TOTAL_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "closedApplication", - "name": "DSS_CLOSED_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "slaAchieved", - "name": "DSS_SLA_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "citizenRegistered", - "name": "DSS_CITIZEN_REGISTERED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 132, - "name": "DSS_TOTAL_APPLICATION_&_CLOSED_APPLICATION", - "dimensions": { - "height": 450, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "totalApplication&ClosedApplication", - "name": "DSS_TOTAL_APPLICATION_&_CLOSED_APPLICATION", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 141, - "name": "DSS_TOP_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "topPerformingUlbsCompletionRate", - "name": "DSS_TOP_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 142, - "name": "DSS_BOTTOM_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "isCollapsible": false, - "charts": [ - { - "id": "bottomPerformingUlbsCompletionRate", - "name": "DSS_BOTTOM_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 143, - "name": "DSS_TOTAL_APPLICATIONS:_DEPARTMENT_WISE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "totalApplicationDeptWise", - "name": "DSS_TOTAL_APPLICATIONS:_DEPARTMENT_WISE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - } - ] - }, - { - "name": "DSS_HOME_DASHBOARD", - "id": "ulb-home", - "isActive": "", - "style": "", - "title": "title", - "visualizations": [ - { - "name": "DSS_OVERVIEW", - "row": 1, - "vizArray": [ - { - "id": 111, - "name": "DSS_OVERVIEW", - "vizType": "collection", - "noUnit": true, - "isCollapsible": false, - "ref": { - "url": "ulb-overview", - "logoUrl": "", - "type": "internal" - }, - "charts": [ - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchievedv2", - "name": "DSS_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "totalApplication", - "name": "DSS_TOTAL_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "slaAchieved", - "name": "DSS_SLA_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_OVERVIEW", - "vizArray": [ - { - "id": 121, - "name": "DSS_PROPERTY_TAX", - "vizType": "module", - "moduleLevel": "PT", - "type": "", - "noUnit": false, - "isCollapsible": false, - "ref": { - "url": "ulb-propertyTax", - "logoUrl": "", - "type": "internal" - }, - "label": "", - "charts": [ - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "propertiesAssessed", - "name": "DSS_PT_TOTAL_PROPERTIES_ASSESSED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 131, - "name": "DSS_TRADE_LICENCE", - "vizType": "module", - "moduleLevel": "TL", - "ref": { - "url": "ulb-tradeLicense", - "logoUrl": "", - "type": "internal" - }, - "label": "", - "charts": [ - { - "id": "totalCollectionv2", - "name": "DSS_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "totalApplication", - "name": "DSS_TOTAL_APPLICATION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 141, - "name": "DSS_COMPLAINS", - "vizType": "module", - "moduleLevel": "PGR", - "ref": { - "url": "ulb-pgr", - "logoUrl": "", - "type": "internal" - }, - "label": "", - "charts": [ - { - "id": "totalComplaints", - "name": "DSS_PGR_TOTAL_COMPLAINTS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "slaAchieved", - "name": "DSS_SLA_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - } - ] - } - ] - }, - - { - "name": "DSS_W&S_DASHBOARD", - "id": "ws", - "isActive": "", - "style": "linear", - "visualizations": [ - { - "row": 1, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 211, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "noUnit": true, - "isCollapsible": false, - "label": "DSS_OVERVIEW", - "charts": [ - { - "id": "wstodaysCollection", - "name": "DSS_W&S_TODAYS_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wstotalCollection", - "name": "DSS_W&S_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wstargetCollection", - "name": "DSS_W&S_TARGET_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wstargetAchieved", - "name": "DSS_W&S_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 212, - "name": "DSS_W&S_TOTAL_CUMULATIVE_COLLECTION", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "wscumulativeCollections", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 221, - "name": "DSS_W&S_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "wstopPerformingUlbs", - "name": "DSS_W&S_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 222, - "name": "DSS_W&S_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "wsbottomPerformingUlbs", - "name": "DSS_W&S_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 223, - "name": "DSS_W&S_COLLECTION_BY_USAGE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "wscollectionByUsage", - "name": "DSS_W&S_COLLECTION_BY_USAGE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_W&S_DEMAND_COLLECTION_BOUNDARY", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "wsFinancialIndicatorDDR", - "name": "DSS_W&S_DEMAND_COLLECTION_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_W&S_TAX_HEAD_BOUNDARY", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsTaxHeadDDR", - "name": "DSS_W&S_TAX_HEAD_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - }, - { - "row": 7, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 231, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "metric-collection", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wstotalConnection", - "name": "DSS_W&S_CONNECTIONS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wsNewWaterConnection", - "name": "DSS_W&S_WATER_CONNECTIONS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wsNewSewerageConnection", - "name": "DSS_W&S_SEWERAGE_CONNECTIONS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wsActiveUlbs", - "name": "DSS_W&S_ACTIVE_ULBS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 232, - "name": "DSS_W&S_CUMULATIVE_COLLECTION", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "wscumulativeConnections", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 8, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 231, - "name": "DSS_W&S_WATER_CONNECTION_BY_USAGE", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsConsumersByConnectionType", - "name": "", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 232, - "name": "DSS_W&S_CONNECTION_BY_USAGE", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsConsumersByUsageType", - "name": "", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 233, - "name": "DSS_W&S_CONNECTION_BY_CHANNEL", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsConsumersByChannel", - "name": "", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 9, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 231, - "name": "DSS_W&S_CONNECTION_AGEING", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsConnectionAgeingDDR", - "name": "", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - - ] - } - ] - }, - { - "name": "DSS_W&S_DASHBOARD", - "id": "ulb-ws", - "isActive": "", - "style": "linear", - "visualizations": [ - { - "row": 1, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 211, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "noUnit": true, - "isCollapsible": false, - "label": "DSS_OVERVIEW", - "charts": [ - { - "id": "wstodaysCollection", - "name": "DSS_W&S_TODAYS_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wstotalCollection", - "name": "DSS_W&S_TOTAL_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wstargetCollection", - "name": "DSS_W&S_TARGET_COLLECTION", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wstargetAchieved", - "name": "DSS_W&S_TARGET_ACHIEVED", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 212, - "name": "DSS_W&S_TOTAL_CUMULATIVE_COLLECTION", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "wscumulativeCollections", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 221, - "name": "DSS_W&S_TOP_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "label": "", - "charts": [ - { - "id": "wstopPerformingUlbs", - "name": "DSS_W&S_TOP_3_PERFORMING_ULBS", - "code": "", - "chartType": "", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 222, - "name": "DSS_W&S_BOTTOM_3_PERFORMING_ULBS", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "wsbottomPerformingUlbs", - "name": "DSS_W&S_BOTTOM_3_PERFORMING_ULBS", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 223, - "name": "DSS_W&S_COLLECTION_BY_USAGE", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "noUnit": true, - "isCollapsible": false, - "charts": [ - { - "id": "wscollectionByUsage", - "name": "DSS_W&S_COLLECTION_BY_USAGE", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_W&S_DEMAND_COLLECTION_BOUNDARY", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "noUnit": false, - "isCollapsible": false, - "charts": [ - { - "id": "wsFinancialIndicatorDDR", - "name": "DSS_W&S_DEMAND_COLLECTION_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - }, - { - "row": 4, - "name": "DSS_REVENUE", - "vizArray": [ - { - "id": 231, - "name": "DSS_W&S_TAX_HEAD_BOUNDARY", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsTaxHeadDDR", - "name": "DSS_W&S_TAX_HEAD_BOUNDARY", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - ] - }, - { - "row": 7, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 231, - "name": "DSS_OVERVIEW", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "metric-collection", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wstotalConnection", - "name": "DSS_W&S_CONNECTIONS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wsNewWaterConnection", - "name": "DSS_W&S_WATER_CONNECTIONS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wsNewSewerageConnection", - "name": "DSS_W&S_SEWERAGE_CONNECTIONS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "wsActiveUlbs", - "name": "DSS_W&S_ACTIVE_ULBS", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 232, - "name": "DSS_W&S_CUMULATIVE_COLLECTION", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "isCollapsible": false, - "charts": [ - { - "id": "wscumulativeConnections", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 8, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 231, - "name": "DSS_W&S_WATER_CONNECTION_BY_USAGE", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsConsumersByConnectionType", - "name": "", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 232, - "name": "DSS_W&S_CONNECTION_BY_USAGE", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsConsumersByUsageType", - "name": "", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 233, - "name": "DSS_W&S_CONNECTION_BY_CHANNEL", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsConsumersByChannel", - "name": "", - "code": "", - "chartType": "donut", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 9, - "name": "DSS_SERVICE", - "vizArray": [ - { - "id": 231, - "name": "DSS_W&S_CONNECTION_AGEING", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "label": "", - "noUnit": false, - "isCollapsible": true, - "charts": [ - { - "id": "wsConnectionAgeingDDR", - "name": "", - "code": "", - "chartType": "table", - "filter": "", - "headers": [], - "tabName": "Boundary" - } - ] - } - - ] - } - ] - } - ] -} diff --git a/business-services/dashboard-analytics/src/main/resources/schema/RoleDashboardConfig.json b/business-services/dashboard-analytics/src/main/resources/schema/RoleDashboardConfig.json deleted file mode 100644 index df88cb557b8..00000000000 --- a/business-services/dashboard-analytics/src/main/resources/schema/RoleDashboardConfig.json +++ /dev/null @@ -1,562 +0,0 @@ -{ - "_comment": "TODO: denormalize the role & visualisations", - "roles" : [ - { - "roleId": 6, - "roleName" : "R1", - "isSuper" : "", - "orgId": "", - "dashboards": [ - { - "name": "My Dashboard", - "id": "home", - "isActive": "", - "style" : "tabbed", - "visualizations": [ - { - "row": 1, - "name": "Revenue", - "vizArray": [ - { - "id": 11, - "name": "", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "charts": [ - { - "id": "totalCollection", - "name": "Total Collection", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetCollection", - "name": "Target Collection", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchieved", - "name": "Target Achieved", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 12, - "name": "Total Cumulative Collection", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "charts": [ - { - "id": "cumulativeCollection", - "name": "Weekly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "Revenue", - "vizArray": [ - { - "id": 21, - "name": "Top Performing ULBs", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "charts": [ - { - "id": "topPerformingUlbs", - "name": "Top Performing ULBs", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 22, - "name": "Bottom Performing ULBs", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "charts": [ - { - "id": "bottomPerformingUlbs", - "name": "Bottom Performing ULBs", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 23, - "name": "Total Cumulative Collection: Department Wise", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "charts": [ - { - "id": "totalCollectionDeptWise", - "name": "Total Cumulative Collection: Department Wise", - "code": "", - "chartType": "pie", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "Service", - "vizArray": [ - { - "id": 31, - "name": "", - "dimensions": { - "height": 450, - "width": 5 - }, - "vizType": "metric-collection", - "charts": [ - { - "id": "totalApplication", - "name": "Total Application", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "closedApplication", - "name": "Closed Application", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "", - "name": "SLA Achieved", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "citizenRegistered", - "name": "Citizen Registered", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 32, - "name": "Total Application & Closed Application", - "dimensions": { - "height": 450, - "width": 7 - }, - "vizType": "chart", - "charts": [ - { - "id": "totalApplication&ClosedApplication", - "name": "", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 4, - "name": "Service", - "vizArray": [ - { - "id": 41, - "name": "Top Performing ULBs", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "charts": [ - { - "id": "topPerformingUlbsCompletionRate", - "name": "Top Performing ULBs", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 42, - "name": "Bottom Performing ULBs", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "charts": [ - { - "id": "bottomPerformingUlbsCompletionRate", - "name": "Bottom Performing ULBs", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 43, - "name": "Total Applications: Department Wise", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "charts": [ - { - "id": "totalApplicationDeptWise", - "name": "Total Cumulative Collection: Department Wise", - "code": "", - "chartType": "pie", - "filter": "", - "headers": [] - } - ] - } - ] - } - ] - }, - { - "name": "Property Tax", - "id": "propertyTax", - "isActive":"", - "style" : "linear", - "visualizations": [ - { - "row": 1, - "name": "Revenue", - "vizArray": [ - { - "id": 11, - "name": "", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "charts": [ - { - "id": "totalCollection", - "name": "Total Collection", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetCollection", - "name": "Target Collection", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "targetAchieved", - "name": "Target Achieved", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 12, - "name": "Total Cumulative Collection", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "charts": [ - { - "id": "cumulativeCollection", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 2, - "name": "Revenue", - "vizArray": [ - { - "id": 21, - "name": "Top 3 Performing ULBs", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "charts": [ - { - "id": "topPerformingUlbs", - "name": "Top 3 Performing ULBs", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 22, - "name": "Bottom 3 Performing ULBs", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "charts": [ - { - "id": "bottomPerformingUlbs", - "name": "Bottom 3 Performing ULBs", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 23, - "name": "Collection by Usage type", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "charts": [ - { - "id": "collectionByUsageType", - "name": "Collection by Usage type", - "code": "", - "chartType": "pie", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 3, - "name": "Revenue", - "vizArray": [ - { - "id": 31, - "name": "", - "dimensions": { - "height": 350, - "width": 12 - }, - "vizType": "chart", - "charts": [ - { - "id": "demandCollectionIndexBoundaryRevenue", - "name": "Demand & Collection Index", - "code": "", - "chartType": "table", - "filter": "", - "headers": [] - }, - { - "id": "demandCollectionIndexUsageRevenue", - "name": "Demand & Collection Index", - "code": "", - "chartType": "table", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 4, - "name": "Service", - "vizArray": [ - { - "id": 41, - "name": "", - "dimensions": { - "height": 350, - "width": 5 - }, - "vizType": "metric-collection", - "charts": [ - { - "id": "propertiesAssessed", - "name": "Total Properties Assessed", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "propertiesAssessed", - "name": "Total Assessments", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - }, - { - "id": "activeUlbs", - "name": "Total Active ULBs", - "code": "", - "chartType": "metric", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 42, - "name": "Total Properties Assessed", - "dimensions": { - "height": 350, - "width": 7 - }, - "vizType": "chart", - "charts": [ - { - "id": "cumulativePropertiesAssessed", - "name": "Monthly", - "code": "", - "chartType": "line", - "filter": "", - "headers": [] - } - ] - } - ] - }, - { - "row": 5, - "name": "Service", - "vizArray": [ - { - "id": 21, - "name": "Top 3 Performing ULBs", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "charts": [ - { - "id": "topPerformingUlbsCompletionRate", - "name": "Top 3 Performing ULBs", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 22, - "name": "Bottom 3 Performing ULBs", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "performing-metric", - "charts": [ - { - "id": "bottomPerformingUlbsCompletionRate", - "name": "Bottom 3 Performing ULBs", - "code": "", - "chartType": "bar", - "filter": "", - "headers": [] - } - ] - }, - { - "id": 23, - "name": "Properties by Usage type", - "dimensions": { - "height": 250, - "width": 4 - }, - "vizType": "chart", - "charts": [ - { - "id": "propertiesByUsageType", - "name": "Properties by Usage type", - "code": "", - "chartType": "pie", - "filter": "", - "headers": [] - } - ] - } - ] - } - ] - } - ] - } - ] -} diff --git a/business-services/dashboard-analytics/src/main/resources/schema/RoleDashboardMappingsConf.json b/business-services/dashboard-analytics/src/main/resources/schema/RoleDashboardMappingsConf.json deleted file mode 100644 index f1839227c77..00000000000 --- a/business-services/dashboard-analytics/src/main/resources/schema/RoleDashboardMappingsConf.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "_comment": "Holds mapping for each role with and its associated dashboards", - "roles" : [ - { - "_comment":"This role is super role which can access all the available dashboards: [other/new roles are suppose to be added]", - "roleId": "roleId#1", - "roleName" : "Admin", - "isSuper" : "", - "orgId": "", - "dashboards": [ - { - "name": "My Dashboard", - "id": "home" - }, - { - "name": "My Dashboard v2", - "id": "homev2" - }, - { - "name": "Property Tax", - "id": "propertyTax" - }, - { - "name": "Trade License", - "id": "tradeLicense" - }, - { - "name": "PGR", - "id": "pgr" - }, - { - "id": "overview" - }, - { - "id": "ws" - } - ] - }, - { - "_comment":"This role is super role which can access all the available dashboards: [other/new roles are suppose to be added]", - "roleId": "roleId#2", - "roleName" : "Commissioner", - "isSuper" : "", - "orgId": "", - "dashboards": [ - { - "id": "ulb-pgr" - }, - { - "id": "ulb-propertyTax" - }, - { - "id": "ulb-tradeLicense" - }, - { - "id": "ulb-overview" - }, - { - "id": "ulb-home" - }, - { - "id": "ulb-ws" - } - ] - } - - ] -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/resources/schema/TenantCodeNameMappings.json b/business-services/dashboard-analytics/src/main/resources/schema/TenantCodeNameMappings.json deleted file mode 100644 index 313879e4a17..00000000000 --- a/business-services/dashboard-analytics/src/main/resources/schema/TenantCodeNameMappings.json +++ /dev/null @@ -1,549 +0,0 @@ -{ - "comment" : "This mapping is used for resolving the miss match between MDM citynames and waterchargesconsumers citynames", - "ulbCityNamesMappings": [ - { - "tenantCode":"pb.kapurthala", - "tenantValue":"Kapurthala" - }, - { - "tenantCode": "pb.ropar", - "tenantValue":"Ropar" - }, - { - "tenantCode": "pb.rajpura", - "tenantValue":"Rajpura" - }, - { - "tenantCode":"pb.kharar", - "tenantValue":"Kharar" - }, - { - "tenantCode":"pb.barnala", - "tenantValue":"Barnala" - }, - { - "tenantCode":"pb.abohar", - "tenantValue":"Abohar" - }, - { - "tenantCode":"pb.phagwara", - "tenantValue":"Phagwara" - }, - { - "tenantCode":"pb.sangrur", - "tenantValue":"Sangrur" - }, - { - "tenantCode":"pb.mansa", - "tenantValue":"Mansa" - }, - { - "tenantCode":"pb.ferozepur", - "tenantValue":"Ferozepur" - }, - { - "tenantCode":"pb.dhuri", - "tenantValue":"Dhuri" - }, - { - "tenantCode":"pb.gidderbaha", - "tenantValue":"Gidderbaha" - }, - { - "tenantCode":"pb.moga", - "tenantValue":"Moga" - }, - { - "tenantCode":"pb.fazilka", - "tenantValue":"Fazilka" - }, - { - "tenantCode":"pb.kurali", - "tenantValue":"Kurali" - }, - { - "tenantCode":"pb.sunam", - "tenantValue":"Sunam" - }, - { - "tenantCode":"pb.anandpursahib", - "tenantValue":"Anandpur Sahib" - }, - { - "tenantCode":"pb.malout", - "tenantValue":"Malout" - }, - { - "tenantCode":"pb.nawanshahr", - "tenantValue":"Nawanshahr" - }, - { - "tenantCode":"pb.kotkapura", - "tenantValue":"Kotkapura" - }, - { - "tenantCode":"pb.bhuchomandi", - "tenantValue":"Bhucho Mandi" - }, - { - "tenantCode":"pb.maur", - "tenantValue":"Maur" - }, - { - "tenantCode":"pb.hoshiarpur", - "tenantValue":"Hoshiarpur" - }, - { - "tenantCode": "pb.jaitu", - "tenantValue":"Jaitu" - }, - { - "tenantCode":"pb.samana", - "tenantValue":"Samana" - }, - { - "tenantCode":"pb.ahmedgarh", - "tenantValue":"Ahmedgarh" - }, - { - "tenantCode":"pb.mohali", - "tenantValue":"Mohali" - }, - { - "tenantCode":"pb.derabassi", - "tenantValue":"DeraBassi" - }, - { - "tenantCode":"pb.mandigobindgarh", - "tenantValue":"Mandi Gobindgarh" - }, - { - "tenantCode":"pb.mukerian", - "tenantValue":"Mukerian" - }, - { - "tenantCode":"pb.bhogpur", - "tenantValue":"Bhogpur" - }, - { - "tenantCode":"pb.nabha", - "tenantValue":"Nabha" - }, - { - "tenantCode":"pb.batala", - "tenantValue":"Batala" - }, - { - "tenantCode":"pb.mullanpur", - "tenantValue":"MullanpurDakha" - }, - { - "tenantCode":"pb.budhlada", - "tenantValue":"Budhlada" - }, - { - "tenantCode":"pb.gurdaspur", - "tenantValue":"Gurdaspur" - }, - { - "tenantCode":"pb.jagraon", - "tenantValue":"Jagraon" - }, - { - "tenantCode":"pb.bhawanigarh", - "tenantValue":"Bhawanigarh" - }, - { - "tenantCode":"pb.banga", - "tenantValue":"Banga" - }, - { - "tenantCode":"pb.sirhind", - "tenantValue":"Sirhind" - }, - { - "tenantCode":"pb.phillaur", - "tenantValue":"Phillaur" - }, - { - "tenantCode":"pb.goniana", - "tenantValue":"Goniana" - }, - { - "tenantCode":"pb.talwandibhai", - "tenantValue":"TalwandiBhai" - }, - { - "tenantCode":"pb.khanauri", - "tenantValue":"Khanauri" - }, - { - "tenantCode":"pb.ajnala", - "tenantValue":"Ajnala" - }, - { - "tenantCode":"pb.nakodar", - "tenantValue":"Nakodar" - }, - { - "tenantCode":"pb.sardulgarh", - "tenantValue":"Sardulgarh" - }, - { - "tenantCode":"pb.morinda", - "tenantValue":"Morinda" - }, - { - "tenantCode":"pb.rahon", - "tenantValue":"Rahon" - }, - { - "tenantCode":"pb.raikot", - "tenantValue":"Raikot" - }, - { - "tenantCode":"pb.garhshankar", - "tenantValue":"Garhshankar" - }, - { - "tenantCode":"pb.zira", - "tenantValue":"Zira" - }, - { - "tenantCode":"pb.handiaya", - "tenantValue":"Handiaya" - }, - { - "tenantCode":"pb.lehragaga", - "tenantValue":"Lehragaga" - }, - { - "tenantCode":"pb.nurmahal", - "tenantValue":"Nurmahal" - }, - { - "tenantCode":"pb.goraya", - "tenantValue":"Goraya" - }, - { - "tenantCode":"pb.nangal", - "tenantValue":"Nangal" - }, - { - "tenantCode":"pb.alawalpur", - "tenantValue":"Alawalpur" - }, - { - "tenantCode":"pb.urmartanda", - "tenantValue":"Urmar Tanda" - }, - { - "tenantCode":"pb.doraha", - "tenantValue":"Doraha" - }, - { - "tenantCode":"pb.sanaur", - "tenantValue":"Sanaur" - }, - { - "tenantCode":"pb.mahilpur", - "tenantValue":"Mahilpur" - }, - { - "tenantCode":"pb.sultanpurlodhi", - "tenantValue":"Sultanpur Lodhi" - }, - { - "tenantCode":"pb.ghanaur", - "tenantValue":"Ghanaur" - }, - { - "tenantCode":"pb.malerkotla", - "tenantValue":"Malerkotla" - }, - { - "tenantCode":"pb.srihargobindpur", - "tenantValue":"Sri Hargobindpur" - }, - { - "tenantCode":"pb.talwandisabo", - "tenantValue":"Talwandi Sabo" - }, - { - "tenantCode":"pb.raman", - "tenantValue":"Raman" - }, - { - "tenantCode":"pb.dinanagar", - "tenantValue":"Dina Nagar" - }, - { - "tenantCode":"pb.longowal", - "tenantValue":"Longowal" - }, - { - "tenantCode":"pb.bhulath", - "tenantValue":"Bhulath" - }, - { - "tenantCode":"pb.bhadaur", - "tenantValue":"Bhadaur" - }, - { - "tenantCode":"pb.jandialaguru", - "tenantValue":"Jandiala Guru" - }, - { - "tenantCode":"pb.sangatmandi", - "tenantValue":"Sangat Mandi" - }, - { - "tenantCode":"pb.bareta", - "tenantValue":"Bareta" - }, - { - "tenantCode":"pb.garhdiwala", - "tenantValue":"Garhdiwala" - }, - { - "tenantCode":"pb.kotfatta", - "tenantValue":"Kotfatta" - }, - { - "tenantCode":"pb.faridkot", - "tenantValue":"Faridkot" - }, - { - "tenantCode":"pb.bariwala", - "tenantValue":"Bariwala" - }, - { - "tenantCode":"pb.banur", - "tenantValue":"Banur" - }, - { - "tenantCode":"pb.samrala", - "tenantValue":"Samrala" - }, - { - "tenantCode":"pb.jalalabad", - "tenantValue":"Jalalabad" - }, - { - "tenantCode":"pb.boha", - "tenantValue":"Boha" - }, - { - "tenantCode":"pb.talwara", - "tenantValue":"Talwara" - }, - { - "tenantCode":"pb.quadian", - "tenantValue":"Quadian" - }, - { - "tenantCode":"pb.moonak", - "tenantValue":"Moonak" - }, - { - "tenantCode":"pb.fatehgarhchurian", - "tenantValue":"Fatehgarh Churian" - }, - { - "tenantCode":"pb.dharamkot", - "tenantValue":"Dharamkot" - }, - { - "tenantCode":"pb.payal", - "tenantValue":"Payal" - }, - { - "tenantCode":"pb.dasuya", - "tenantValue":"Dasuya" - }, - { - "tenantCode":"pb.bhikhi", - "tenantValue":"Bhikhi" - }, - { - "tenantCode":"pb.mallanwala", - "tenantValue":"Mallanwala" - }, - { - "tenantCode":"pb.guruharsahai", - "tenantValue":"Guru Harsahai" - }, - { - "tenantCode":"pb.balachaur", - "tenantValue":"Balachaur" - }, - { - "tenantCode":"pb.kartarpur", - "tenantValue":"Kartarpur" - }, - { - "tenantCode":"pb.pathankot", - "tenantValue":"Pathankot" - }, - { - "tenantCode":"pb.tarntaran", - "tenantValue":"Tarn Taran" - }, - { - "tenantCode":"pb.machhiwara", - "tenantValue":"Machiwara" - }, - { - "tenantCode":"pb.sujanpur", - "tenantValue":"Sujanpur" - }, - { - "tenantCode":"pb.shamchurasi", - "tenantValue":"Shamchurasi" - }, - { - "tenantCode":"pb.ramdass", - "tenantValue":"Ramdass" - }, - { - "tenantCode":"pb.dirba", - "tenantValue":"Dirba" - }, - { - "tenantCode":"pb.maloud", - "tenantValue":"Maloud" - }, - { - "tenantCode":"pb.bassipathana", - "tenantValue":"Bassi Pathana" - }, - { - "tenantCode":"pb.baghapurana", - "tenantValue":"Baghapurana" - }, - { - "tenantCode":"pb.rajasansi", - "tenantValue":"Raja Sansi" - }, - { - "tenantCode":"pb.hariana", - "tenantValue":"Hariana" - }, - { - "tenantCode":"pb.cheema", - "tenantValue":"Cheema" - }, - { - "tenantCode":"pb.majitha", - "tenantValue":"Majitha" - }, - { - "tenantCode":"pb.dhanaula", - "tenantValue":"Dhanaula" - }, - { - "tenantCode":"pb.kiratpur", - "tenantValue":"Kiratpur Sahib" - }, - { - "tenantCode":"pb.tapa", - "tenantValue":"Tapa" - }, - { - "tenantCode":"pb.chamkaursahib", - "tenantValue":"Chamkaur Sahib" - }, - { - "tenantCode":"pb.dhilwan", - "tenantValue":"Dhilwan" - }, - { - "tenantCode":"pb.patran", - "tenantValue":"Patran" - }, - { - "tenantCode":"pb.ghagga", - "tenantValue":"Ghagga" - }, - { - "tenantCode":"pb.adampur", - "tenantValue":"Adampur" - }, - { - "tenantCode":"pb.amargarh", - "tenantValue":"Amargarh" - }, - { - "tenantCode":"pb.badhnikalan", - "tenantValue":"Badhni Kalan" - }, - { - "tenantCode":"pb.shahkot", - "tenantValue":"Shahkot" - }, - { - "tenantCode":"pb.lalru", - "tenantValue":"Lalru" - }, - { - "tenantCode":"pb.patti", - "tenantValue":"Patti" - }, - { - "tenantCode":"pb.rayya", - "tenantValue":"Rayya" - }, - { - "tenantCode":"pb.khemkaran", - "tenantValue":"Khemkaran" - }, - { - "tenantCode":"pb.khamano", - "tenantValue":"Khamano" - }, - { - "tenantCode":"pb.bhadson", - "tenantValue":"Bhadson" - }, - { - "tenantCode":"pb.mudki", - "tenantValue":"Mudki" - }, - { - "tenantCode":"pb.begowal", - "tenantValue":"Begowal" - }, - { - "tenantCode":"pb.derababananak", - "tenantValue":"Dera Baba Nanak" - }, - { - "tenantCode":"pb.nihalsinghwala", - "tenantValue":"Nihal Singh Wala" - }, - { - "tenantCode":"pb.amloh", - "tenantValue":"Amloh" - }, - { - "tenantCode":"pb.makhu", - "tenantValue":"Makhu" - }, - { - "tenantCode":"pb.dhariwal", - "tenantValue":"Dhariwal" - }, - { - "tenantCode":"pb.nadala", - "tenantValue":"Nadala" - }, - { - "tenantCode":"pb.amritsar", - "tenantValue":"Amritsar" - }, - { - "tenantCode":"pb.mamdot", - "tenantValue":"Mamdot" - } - ] -} \ No newline at end of file diff --git a/business-services/dashboard-analytics/src/main/resources/schema/getchart.json b/business-services/dashboard-analytics/src/main/resources/schema/getchart.json deleted file mode 100644 index 9f9e5ef8927..00000000000 --- a/business-services/dashboard-analytics/src/main/resources/schema/getchart.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "$schema": "ain/getchart/schema1#", - "title": "getchart", - "description": "getchart api schema", - "type": "object", - "properties": { - "header": { - "type": "object", - "properties": { - "tenantId": { - "type": "string" - } - } - }, - "requestInfo": { - "type": "object", - "properties": { - "chartType":{ - "type":"string", - "enum":["bar","line","stackedbar","pie", "horizontalBar", "doughnut", "doubledonut","heat","radar"] - }, - "chartFormat":{ - "type":"string" - }, - "serviceApi":{ - "type":"string" - }, - "dates":{ - "type":"object", - "properties":{ - "startDate":{ - "type":"string" - }, - "endData":{ - "type":"string" - } - } - } - }, - "required": ["chartType","chartFormat", "serviceApi","dates"] - } - } -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/CHANGELOG.md b/business-services/dashboard-ingest/CHANGELOG.md deleted file mode 100644 index c70c000bcc1..00000000000 --- a/business-services/dashboard-ingest/CHANGELOG.md +++ /dev/null @@ -1,30 +0,0 @@ -#Changelog - -All notable changes to this module will be documented in this file. - -## 1.1.4 - 2022-01-13 -- Updated to log4j2 version 2.17.1 - -## 1.1.3 - 2021-05-11 - -- security fixes - -## 1.1.2 - 2021-03-09 - -- Updated README file - -## 1.1.1 - 2020-09-01 - -- Added README and LOCALSETUP -- Changes in assessment indexing - -## 1.1.0 - 2020-06-23 - -- Added typescript definition generation plugin -- Upgraded to `tracer:2.0.0-SNAPSHOT` -- Upgraded to spring boot `2.2.6-RELEASE` -- Removed Kafka dependency - -## 1.0.0 - -- Base version diff --git a/business-services/dashboard-ingest/LOCALSETUP.md b/business-services/dashboard-ingest/LOCALSETUP.md deleted file mode 100644 index 1fd6e8ee5ad..00000000000 --- a/business-services/dashboard-ingest/LOCALSETUP.md +++ /dev/null @@ -1,27 +0,0 @@ -# Local Setup - -To setup the dashboard-ingest in your local system, clone the [Business Service repository](https://github.com/egovernments/business-services). - -## Dependencies - -### Infra Dependency - -- [ ] Postgres DB -- [ ] Redis -- [X] Elastic search -- [X] Kafka - - [X] Consumer - - [X] Producer - -## Running Locally - -To run the dashboard-ingest locally, update below listed properties in `application.properties` prior to running the project: - -```ini -services.esindexer.host = Elasticsearch hostname -services.esindexer.host.port = Elasticsearch port number -services.esindexer.username = Username for elasticsearch index -services.esindexer.password = Password for elastic search index -spring.data.elasticsearch.cluster.name = Elasticsearch cluster name -spring.data.elasticsearch.cluster.nodes = Elasticsearch node name -``` diff --git a/business-services/dashboard-ingest/README.md b/business-services/dashboard-ingest/README.md deleted file mode 100644 index f6ac05b8f7d..00000000000 --- a/business-services/dashboard-ingest/README.md +++ /dev/null @@ -1,131 +0,0 @@ -# Dashboard-Ingest - -Dashboard-Ingest module runs as a pipeline and manages to validate, transform and enrich the incoming data and pushes the same to ElasticSearch Index. - -### DB UML Diagram - -- To Do - -### Service Dependencies - -- elasticsearch - -### Swagger API Contract - -- Please refer to the [Swagger API contarct](https://raw.githubusercontent.com/egovernments/business-services/master/Docs/dss-dashboard/DSS%20Ingest%20YAML%20Spec%201.0.0.yaml) for dashboard-ingest to understand the structure of APIs and to have visualization of all internal APIs. - - -## Service Details - -Below are list of configurations - -- Topic Context Configurations - -- Validator Schema - -- JOLT Transformation Schema - -- Enrichment Domain Configuration - -- JOLT Domain Transformation Schema - -####Descriptions - -**Topic Context Configurations** - -Topic Context Configuration is an outline to define which data is received on which Kafka Topic. -Indexer Service and many other services are sending out data on different Kafka Topics. If the Ingest Service is asked to receive those data and pass it through the pipeline, the context and the version of the data being received has to be set. This configuration is used to identify as in which kafka topic consumed the data and what is the mapping for that. -[Click here for full configuration](https://github.com/egovernments/configs/blob/master/egov-dss-dashboards/dashboard-ingest/TopicContextConfiguration.json) - -| Parameter Name | Description | -| ----------------------------------| ------------------------------------------------------------------------------------------------------------------| -| `topic` | Holds the name of the Kafka Topic on which the data is being received | -| `dataContext` | Context Name which needs to be set for further actions in the pipeline | -| `dataContextVersion` | Version of the Data Structure is set here as there might be different structured data at different point of time | - -**Validator Schema** - -Validator Schema is a configuration Schema Library from Everit -By passing the data against this schema, it ensures whether the data abides by the rules and requirements of the schema which has been defined. [Click here for example configuration](https://github.com/egovernments/configs/blob/master/egov-dss-dashboards/dashboard-ingest/validator_transaction_v1.json) - - - -**JOLT Transformation Schema** - -JOLT is a JSON to JSON Transformation Library. In order to change the structure of the data and transform it in a generic way, JOLT has been used. -While the transformation schemas are written for each Data Context, the data is transformed against the schema to obtain a transformed data. -[Click here for example configuration](https://github.com/egovernments/configs/blob/master/egov-dss-dashboards/dashboard-ingest/transform_collection_v1.json) - -**Enrichment Domain Configuration** - -This configuration defines and directs the Enrichment Process which the data goes through. - -For example, if the Data which is incoming is belonging to a Collection Module data, then the Collection Domain Config is picked. And the based on the Business Type specified in the data, the right config is picked. -In order to enhance the data of Collection, the domain index specified in the configuration is queried with the right arguments and the response data is obtained, transformed and set. -[Click here for example configuration](https://github.com/egovernments/configs/blob/master/egov-dss-dashboards/dashboard-ingest/DomainConfig.json) - -| Parameter Name | Description | -| ---------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `id` | Unique Identifier for the Configuration within the configuration document | -| `businessType` | This defines as in which kind of Domain / Service is the data related to. Based on this business type, query and enhancements are decided | -| `indexName` | Based on Business Type, Index Name is defined as to which index has to be queried to get the enhancements done from | -| `query` | Query to execute to get the Domain Level Object is defined here. | -| `targetReferences / sourceReferences` | Fields which are variables in order to get the domain level objects are defined here. The variables and where all the values has to be picked from are documented here. | - -**JOLT Domain Transformation Schema** - -As a part of Enhancement, once the domain level object is obtained, we might not need the complete document as is in the end data product. - -Only those parameters which should be or can be used for an aggregation and representation are to be held and others are to be discarded. - -In order to do that, we make use of JOLT again and write schemas to keep the required ones and discard the unwanted ones. - -The [configuration](https://github.com/egovernments/configs/blob/master/egov-dss-dashboards/dashboard-ingest/transform_tl_v1.json) is used to transform the data response in the enrichment layer. - -**JOLT Transformation Schema for collection V2** - -JOLT transformation schema for payment-v1 has taken as a use case to explain the context collection and context version v2. The payment records are processed/transformed with the schema. The schema supports splitting the billing records in a independent new record. So if there are 2 bill items in the collection/payment incoming data then this results into 2 collection records in turn. -[Click for example configuration](https://github.com/egovernments/configs/blob/master/egov-dss-dashboards/dashboard-ingest/transform_collection_v2.json) - -Here: $i, the variable value that gets incremented for the number of records of paymentDetails -$j, the variable value that gets incremented for the number of records of billDetails. - ->Note: For kafka connect to work, Ingest pipeline application properties or in environments direct push must be disabled. -es.push.direct=false - - - -### API Details - -`BasePath` /dashboard-ingest/ingest/[API endpoint] - -##### Method - -- `save` - - This API receives the Transaction Details JSON Request and passes it on to the Service Layer for further process of persisting into elastic search. - -- `upload` - - This API use to provide response for external data upload. Uploded file get parsed and stores target data to Elastic search. - -- `/migrate/{indexName}/{version}` - - This api is used for scroll search. - -- `/pause/{consumerId}` - - This API use to pause a active kafka consumer. - -- `/resume/{consumerId}` - - This API is to resume a paused kafka consumer. - -### Kafka Consumers -Following are the kafka consumer topic -- `ingestData`:- The consumer listen on this kafka topic to get the required data for ingest pipleine. -- `dss-collection-update`:- The consumer listen on this topic to get the collection index data. -- `validData` :- The consumer listen on this topic to valida the data before transformation. -- `transformedData`:- The consumer listen on this topic consumes the collection/incoming data and transforms the data using jolt configurations. -- `egov-dss-ingest-enriched`:- The consumer listen on this kafka topic in order to hook the collection data to its business module data. - -### Kafka Producers -Following are the kafka producer topic -- `validData`:- The producer send the data to this topic to valid the data before transformation. -- `transformedData` :- The producer send the data to this topic in order to transorm collection/incoming data using jolt configurations. -- `egov-dss-ingest-enriched`:- The producer send the data to this topic after transormation in order to hook the collection data to its business module data. diff --git a/business-services/dashboard-ingest/pom.xml b/business-services/dashboard-ingest/pom.xml deleted file mode 100644 index 9fe207633de..00000000000 --- a/business-services/dashboard-ingest/pom.xml +++ /dev/null @@ -1,242 +0,0 @@ - - 4.0.0 - - com.ingestpipeline - ingestpipeline - 1.1.4-SNAPSHOT - jar - - ingestpipeline - - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - - - 2.17.1 - 1.8 - UTF-8 - UTF-8 - 1.8 - 3.0.1 - - - - - org.springframework.boot - spring-boot-starter-web - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - 2.10.3 - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - 2.10.3 - - - com.fasterxml.jackson.core - jackson-annotations - 2.10.3 - - - com.fasterxml.jackson.core - jackson-core - 2.10.3 - - - com.fasterxml.jackson.core - jackson-databind - 2.10.3 - - - org.egov.services - tracer - 2.0.0-SNAPSHOT - - - - com.google.code.gson - gson - 2.8.0 - - - com.bazaarvoice.jolt - jolt-core - 0.1.1 - - - com.bazaarvoice.jolt - json-utils - 0.1.1 - - - javax.ws.rs - jsr311-api - 1.1.1 - - - org.apache.commons - commons-lang3 - 3.4 - - - commons-io - commons-io - 2.6 - - - org.everit.json - org.everit.json.schema - 1.3.0 - - - org.elasticsearch - elasticsearch - 6.6.0 - - - org.elasticsearch.client - elasticsearch-rest-high-level-client - 6.6.0 - - - commons-fileupload - commons-fileupload - 1.4 - - - org.apache.poi - poi - 4.1.0 - - - org.apache.poi - poi-ooxml - 4.1.0 - - - - commons-beanutils - commons-beanutils - 1.8.3 - - - net.sf.ezmorph - ezmorph - 1.0.6 - - - commons-collections - commons-collections - 3.2.2 - - - commons-lang - commons-lang - 2.6 - - - org.json - json - 20160810 - - - - org.springframework.boot - spring-boot-starter-data-jpa - 2.1.4.RELEASE - - - com.h2database - h2 - runtime - 2.1.210 - - - org.apache.commons - commons-lang3 - 3.7 - - - - com.github.wnameless - json-flattener - 0.2.2 - - - - - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework - spring-jdbc - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - org.json - json - 20190722 - - - - com.google.guava - guava - 20.0 - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - com.ingestpipeline.model.TargetData - com.ingestpipeline.model.References - com.ingestpipeline.model.TargetData - - - com.ingestpipeline.util.ResponseCode$ResponseCode:ResponseCode - - Digit - true - module - - - - - \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/AppStartupRunner.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/AppStartupRunner.java deleted file mode 100644 index bdcf3bbdb83..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/AppStartupRunner.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ingestpipeline; - -import com.ingestpipeline.service.IngestServiceImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.stereotype.Component; - -import com.ingestpipeline.config.DomainConfig; -import com.ingestpipeline.config.DomainConfigFactory; -import com.ingestpipeline.controller.RestApiController; -import com.ingestpipeline.util.ConfigLoader; -import com.ingestpipeline.util.ReadUtil; - -/** - * The App Startup Runner runs on the start of the application as it implements Application Runner - * This will be responsible to load the configurations which are necessary for the Enrichment in the Data Pipeline - * Resources and Domain level configurations are fetched here. - * @author Pritha - * - */ -@Component -public class AppStartupRunner implements ApplicationRunner { - - private static Logger logger = LoggerFactory.getLogger(AppStartupRunner.class); - - @Autowired - ConfigLoader configLoader; - @Autowired - DomainConfigFactory domainConfigFactory; - - @Autowired ReadUtil readutil; - - @Autowired RestApiController restApiController; - - @Autowired IngestServiceImpl ingestService; - - @SuppressWarnings("static-access") - @Override - public void run(ApplicationArguments args) throws Exception { - logger.info("On Boot starts loading: config resources "); - configLoader.loadResources(); - for(DomainConfig domainConfig : domainConfigFactory.getAllConfigs()) { - domainConfig.loadDomains(); - } - - ingestService.loadTopicsConfig(); - - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/IngestApp.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/IngestApp.java deleted file mode 100644 index 8f5f90b1945..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/IngestApp.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ingestpipeline; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -import com.ingestpipeline.util.Constants; - - -@SpringBootApplication(scanBasePackages={"com.ingestpipeline"})// same as @Configuration @EnableAutoConfiguration @ComponentScan combined -public class IngestApp { - - public static void main(String[] args) { - SpringApplication.run(IngestApp.class, args); - } - - @Bean - public RestTemplate restTemplate() { - return new RestTemplate(); - } - - @Bean - public WebMvcConfigurer corsConfigurer() { - return new WebMvcConfigurerAdapter() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**").allowedMethods(Constants.ALLOWED_METHODS_GET,Constants.ALLOWED_METHODS_POST - ).allowedOrigins("*") - .allowedHeaders("*"); - } - }; - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/config/DomainConfig.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/config/DomainConfig.java deleted file mode 100644 index 5e553117ba0..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/config/DomainConfig.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ingestpipeline.config; - -import com.ingestpipeline.model.DomainIndexConfig; - -public interface DomainConfig { - - public static final String DOMAIN_CONFIG ="domainConfig"; - public DomainIndexConfig getIndexConfig(String domainName); - public void loadDomains(); - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/config/DomainConfigFactory.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/config/DomainConfigFactory.java deleted file mode 100644 index 67951c31f73..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/config/DomainConfigFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ingestpipeline.config; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.ingestpipeline.configfactory.CollectionDomainConfig; -import com.ingestpipeline.configfactory.EnhanceDomainConfig; - -@Component -public class DomainConfigFactory { - - @Autowired - private CollectionDomainConfig collectionDomainConfig; - - @Autowired - private EnhanceDomainConfig enhanceDomainConfig; - - public DomainConfig getConfiguration(String type) { - - if (type.equals("collection")) { - return collectionDomainConfig; - - } else if(type.equals("dataEnhancement")) { - return enhanceDomainConfig; - - } - return null; - } - - public List getAllConfigs() { - List domainConfigList = new ArrayList<>(); - domainConfigList.add(collectionDomainConfig); - domainConfigList.add(enhanceDomainConfig); - return domainConfigList; - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/config/ElasticSearchConfiguration.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/config/ElasticSearchConfiguration.java deleted file mode 100644 index 2bf42053330..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/config/ElasticSearchConfiguration.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ingestpipeline.config; - -import org.apache.http.HttpHost; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.client.RestHighLevelClient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.beans.factory.config.AbstractFactoryBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.ingestpipeline.service.ElasticService; -import com.ingestpipeline.service.IESService; - -@Configuration -public class ElasticSearchConfiguration extends AbstractFactoryBean { - - private static final Logger logger = LoggerFactory.getLogger(ElasticSearchConfiguration.class); - @Value("${spring.data.elasticsearch.cluster.nodes}") - private String clusterNodes; - @Value("${spring.data.elasticsearch.cluster.name}") - private String clusterName; - private RestHighLevelClient restHighLevelClient; - @Value("${services.esindexer.host.name}") - private String esIndexerHostName; - @Value("${services.esindexer.host.port}") - private int esIndexerHostPort; - - @Override - public void destroy() { - try { - if (restHighLevelClient != null) { - restHighLevelClient.close(); - } - } catch (final Exception e) { - logger.error("Error closing ElasticSearch client: ", e); - } - } - - @Override - public Class getObjectType() { - return RestHighLevelClient.class; - } - - @Override - public boolean isSingleton() { - return false; - } - - @Override - public RestHighLevelClient createInstance() { - return buildClient(); - } - - private RestHighLevelClient buildClient() { - try { - restHighLevelClient = new RestHighLevelClient( - RestClient.builder(new HttpHost(esIndexerHostName, esIndexerHostPort, "http"))); - } catch (Exception e) { - logger.error(e.getMessage()); - } - return restHighLevelClient; - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/configfactory/CollectionDomainConfig.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/configfactory/CollectionDomainConfig.java deleted file mode 100644 index 0f0141d7c1c..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/configfactory/CollectionDomainConfig.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ingestpipeline.configfactory; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.ingestpipeline.config.DomainConfig; -import com.ingestpipeline.model.DomainIndexConfig; -import com.ingestpipeline.util.ConfigLoader; -import com.ingestpipeline.util.Constants; - -//@JsonIgnoreProperties(ignoreUnknown=true) -@Component(Constants.DomainConfigurations.COLLECTION_DOMAIN_CONFIG) -public class CollectionDomainConfig implements DomainConfig { - - private static final Logger LOGGER = LoggerFactory.getLogger(CollectionDomainConfig.class); - private static final String COLLECTION_DOMAIN_CONFIG = Constants.DomainConfigurations.COLLECTION_DOMAIN_CONFIG + ".json"; - - - @Autowired - private ConfigLoader configLoader; - /** - * Holds domain name as key and it's index config detail as value. - */ - private Map domainIndexConfigMap = new HashMap<>(); - - public void putDomain(String domainName, DomainIndexConfig domainIndexConfig){ - domainIndexConfigMap.put(domainName, domainIndexConfig); - } - - @Override - public DomainIndexConfig getIndexConfig(String domainName){ - return domainIndexConfigMap.get(domainName); - } - - - /** - * loads once on application start up. - */ - @Override - public void loadDomains(){ - String collectionConfigContent = configLoader.get(COLLECTION_DOMAIN_CONFIG); - //LOGGER.info("collectionConfigContent json string = "+collectionConfigContent); - - try{ - - ObjectMapper mapper = new ObjectMapper(); - JsonNode root = new ObjectMapper().readTree(collectionConfigContent); - ArrayNode domainConfigArr = (ArrayNode) root.path(DOMAIN_CONFIG); - - Iterator iterator = domainConfigArr.elements(); - while (iterator.hasNext()) { - DomainIndexConfig domainIndexConfig = mapper.readValue(iterator.next().toString(), DomainIndexConfig.class); - LOGGER.info("DomainIndexConfig id:: " + domainIndexConfig.getDomain()); - domainIndexConfigMap.put(domainIndexConfig.getDomain(), domainIndexConfig); - - } - LOGGER.info("After loading, domainIndexConfigMap size = "+ domainIndexConfigMap.size()); - - } catch (Exception e){ - LOGGER.error("Error occurred on construction domain collection map: "+ e.getMessage()); - } - - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/configfactory/EnhanceDomainConfig.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/configfactory/EnhanceDomainConfig.java deleted file mode 100644 index 1d4c7d431d0..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/configfactory/EnhanceDomainConfig.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ingestpipeline.configfactory; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.ingestpipeline.config.DomainConfig; -import com.ingestpipeline.model.DomainIndexConfig; -import com.ingestpipeline.util.ConfigLoader; -import com.ingestpipeline.util.Constants; - -//@JsonIgnoreProperties(ignoreUnknown=true) -@Component(Constants.DomainConfigurations.ENHANCE_DOMAIN_CONFIG) -public class EnhanceDomainConfig implements DomainConfig { - - private static final Logger LOGGER = LoggerFactory.getLogger(EnhanceDomainConfig.class); - private static final String ENHANCE_DOMAIN_CONFIG = Constants.DomainConfigurations.ENHANCE_DOMAIN_CONFIG + ".json"; - - - @Autowired - private ConfigLoader configLoader; - /** - * Holds domain name as key and it's index config detail as value. - */ - private Map domainIndexConfigMap = new HashMap<>(); - - public void putDomain(String domainName, DomainIndexConfig domainIndexConfig){ - domainIndexConfigMap.put(domainName, domainIndexConfig); - } - - @Override - public DomainIndexConfig getIndexConfig(String domainName){ - return domainIndexConfigMap.get(domainName); - } - - - /** - * loads once on application start up. - */ - @Override - public void loadDomains(){ - String enhanceConfigContent = configLoader.get(ENHANCE_DOMAIN_CONFIG); - //LOGGER.info("collectionConfigContent json string = "+collectionConfigContent); - - try{ - - ObjectMapper mapper = new ObjectMapper(); - JsonNode root = new ObjectMapper().readTree(enhanceConfigContent); - ArrayNode domainConfigArr = (ArrayNode) root.path(DOMAIN_CONFIG); - - Iterator iterator = domainConfigArr.elements(); - while (iterator.hasNext()) { - DomainIndexConfig domainIndexConfig = mapper.readValue(iterator.next().toString(), DomainIndexConfig.class); - LOGGER.info("DomainIndexConfig id:: " + domainIndexConfig.getDomain()); - domainIndexConfigMap.put(domainIndexConfig.getDomain(), domainIndexConfig); - - } - LOGGER.info("After loading, domainIndexConfigMap size = "+ domainIndexConfigMap.size()); - - } catch (Exception e){ - LOGGER.error("Error occurred on construction domain collection map: "+ e.getMessage()); - } - - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/ConsumerConfigurations.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/ConsumerConfigurations.java deleted file mode 100644 index 078db23f315..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/ConsumerConfigurations.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.ingestpipeline.consumer; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.kafka.clients.consumer.ConsumerConfig; -import org.apache.kafka.common.serialization.StringDeserializer; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.kafka.annotation.EnableKafka; -import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory; -import org.springframework.kafka.core.ConsumerFactory; -import org.springframework.kafka.core.DefaultKafkaConsumerFactory; -import org.springframework.kafka.support.serializer.JsonDeserializer; - -/** - * The configurations for the Kafka Consumers are fed from this Config Class - * @author Darshan Nagesh - * - */ -@PropertySource(value= {"classpath:application.properties"}) -@Configuration -@EnableKafka -public class ConsumerConfigurations { - - @Autowired - org.springframework.core.env.Environment env; - - @Value("${spring.kafka.bootstrap.servers}") - private String serverConfig; - - @Value("${kafka.consumer.config.auto_commit}") - private Boolean enableAutoCommit; - - @Value("${kafka.consumer.config.auto_commit_interval}") - private String autoCommitInterval; - - @Value("${kafka.consumer.config.session_timeout}") - private String sessionTimeout; - - @Value("${kafka.consumer.config.group_id}") - private String groupId; - - @Value("${kafka.consumer.config.auto_offset_reset}") - private String autoOffsetReset; - - @Value("${spring.kafka.consumer.value-deserializer}") - private String valueDeserializer; - - @Value("${spring.kafka.consumer.key-deserializer}") - private String keyDeserializer; - - - public ConsumerFactory kafkaConsumerFactory() { - JsonDeserializer deserializer = new JsonDeserializer<>(Map.class); - //deserializer.setRemoveTypeHeaders(false); - deserializer.addTrustedPackages("*"); - deserializer.setUseTypeMapperForKey(true); - - Map props = new HashMap<>(); - props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, serverConfig); - props.put(ConsumerConfig.GROUP_ID_CONFIG, groupId); - return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), deserializer); - } - - @Bean - public ConcurrentKafkaListenerContainerFactory incomingKafkaListenerContainerFactory() { - ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); - factory.setConsumerFactory(kafkaConsumerFactory()); - return factory; - } - - - - /*@Bean - KafkaListenerContainerFactory> kafkaListenerContainerFactory() { - System.out.println("kafkaListenerContainerFactory"); - final ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); - factory.setConsumerFactory(consumerFactory()); - factory.setConcurrency(3); - factory.getContainerProperties().setPollTimeout(3000); - return factory; - } - - @Bean - public ConsumerFactory consumerFactory() { - System.out.println("consumerFactory"); - return new DefaultKafkaConsumerFactory<>(consumerConfigs()); - } - - @Bean - public Map consumerConfigs() { - // TODO - Load configs from env vars - final Map propsMap = new HashMap<>(); - propsMap.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, serverConfig); - propsMap.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, enableAutoCommit); - propsMap.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, autoCommitInterval); - propsMap.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, sessionTimeout); - propsMap.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, autoOffsetReset); - propsMap.put(ConsumerConfig.GROUP_ID_CONFIG, groupId); - propsMap.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); - propsMap.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, HashMapDeserializer.class); -*//* propsMap.put(JsonDeserializer., "*"); -*//* return propsMap; - } - - @Bean - public ConcurrentKafkaListenerContainerFactory incomingKafkaListenerContainerFactory() { - ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); - factory.setConsumerFactory(taskConsumerFactory()); - return factory; - } - - public ConsumerFactory taskConsumerFactory() { - Map props = new HashMap<>(); - props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); - props.put(ConsumerConfig.GROUP_ID_CONFIG, "task-group-notify"); - return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(IncomingData.class)); - } -*/ - /* - * @Bean public TransactionPersistConsumer listener() { return new TransactionPersistConsumer(); } - */ -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/DigressionConsumer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/DigressionConsumer.java deleted file mode 100644 index 4c448fbab37..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/DigressionConsumer.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ingestpipeline.consumer; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; - -import com.ingestpipeline.service.DigressService; -import com.ingestpipeline.util.Constants; - -public class DigressionConsumer implements KafkaConsumer { - public static final Logger LOGGER = LoggerFactory.getLogger(DigressionConsumer.class); - public static final String INTENT = "digress"; - - @Autowired - private DigressService digressService; - - @Override - @KafkaListener(topics = "${kafka.transaction.validation.topic}" , containerFactory = Constants.BeanContainerFactory.INCOMING_KAFKA_LISTENER) - public void processMessage(Map incomingData, - @Header(KafkaHeaders.RECEIVED_TOPIC) final String topic) { - LOGGER.info("##KafkaMessageAlert in digress## : key:" + topic + ":" + "value:" + incomingData.size()); - try { - - } catch (final Exception e) { - e.printStackTrace(); - LOGGER.error("Exception Encountered while processing the received message in digress consumer : " + e.getMessage()); - } - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/EnrichmentConsumer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/EnrichmentConsumer.java deleted file mode 100644 index a334e1adb88..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/EnrichmentConsumer.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.ingestpipeline.consumer; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; - -import com.ingestpipeline.producer.IngestProducer; -import com.ingestpipeline.service.EnrichmentService; -import com.ingestpipeline.service.IESService; -import com.ingestpipeline.util.Constants; - -@Service -public class EnrichmentConsumer implements KafkaConsumer { - - public static final Logger LOGGER = LoggerFactory.getLogger(EnrichmentConsumer.class); - private static final String ERROR_INTENT = "DataError"; - private static final String INTENT = "enrichment" ; - - @Value("${es.push.direct}") - private Boolean esPushDirect; - - @Value("${kafka.topics.enriched.data}") - private String enrichedDataTopic; - - @Value("${kafka.topics.enriched.key}") - private String enrichedDataKey; - - @Autowired - private EnrichmentService enrichmentService; - - @Autowired - private IngestProducer ingestProducer; - - @Autowired - private IESService elasticService; - - @KafkaListener(id = INTENT, groupId = INTENT, topics = "${kafka.transaction.transformation.topic}", containerFactory = Constants.BeanContainerFactory.INCOMING_KAFKA_LISTENER) - public void processMessage(final Map incomingData, - @Header(KafkaHeaders.RECEIVED_TOPIC) final String topic) { - - LOGGER.info("##KafkaMessageAlert## : key:" + topic + ":" + "value:" + incomingData.size()); - - if(incomingData.get(Constants.DATA_CONTEXT) != null && !incomingData.get(Constants.DATA_CONTEXT).equals(Constants.TransformationType.COLLECTION) ){ - push(incomingData, null); - } else { - for(Object key : incomingData.keySet()){ - push((Map)incomingData.get(key), key.toString()); - } - } - } - - private void push(Map incomingData, String docId ) { - - try { - Map updatedIncomingData = enrichmentService.enrichData(incomingData); - - if(esPushDirect) { - LOGGER.info("##esPushDirect## : "+esPushDirect); - elasticService.push(incomingData); - } else { - LOGGER.info("Pushing to:: {} :: docId:: {}" , enrichedDataTopic, " docId:: "+docId); - ingestProducer.pushToPipeline(incomingData, enrichedDataTopic, docId); - } - if(updatedIncomingData == null) { - LOGGER.info("Incoming Data is null::"); - ingestProducer.pushToPipeline(incomingData, ERROR_INTENT, null); - } - } catch (final Exception e) { - e.printStackTrace(); - LOGGER.error("Exception Encountered while processing the received message in enrichment consumer : " + e.getMessage()); - } - - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/HashMapDeserializer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/HashMapDeserializer.java deleted file mode 100644 index 76941d4f372..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/HashMapDeserializer.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ingestpipeline.consumer; - -import java.util.HashMap; - -import org.springframework.kafka.support.serializer.JsonDeserializer; - -@SuppressWarnings("rawtypes") -public class HashMapDeserializer extends JsonDeserializer { - - public HashMapDeserializer() { - super(HashMap.class); - } - -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/IngestConsumer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/IngestConsumer.java deleted file mode 100644 index d1a9f4e6bec..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/IngestConsumer.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ingestpipeline.consumer; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; - -import com.ingestpipeline.model.IncomingData; -import com.ingestpipeline.service.IngestService; -import com.ingestpipeline.util.Constants; - -@Service -public class IngestConsumer{ - public static final Logger LOGGER = LoggerFactory.getLogger(IngestConsumer.class); - - @Autowired - private IngestService ingestService; - - @Value("${kafka.topics.collection.datacontext}") - private String dataContext; - - @Value("${kafka.topics.collection.version}") - private String version; - - - @KafkaListener(topics = { "${kafka.topics.incoming.collection}" }, containerFactory = Constants.BeanContainerFactory.INCOMING_KAFKA_LISTENER) - public void processMessage(Map data, - @Header(KafkaHeaders.RECEIVED_TOPIC) final String topic) { - LOGGER.info("##KafkaMessageAlert Ingest Consumer## : key:" + topic + ":" + "value:" + data.size()); - try { - LOGGER.info("IngestConsumer ## get data ## " +data +" ## TOPIC ## "+topic); - //IncomingData incomingData = ingestService.getContextForIncomingTopic(topic); - // LOGGER.info("## incomingData: "+incomingData); - IncomingData incomingData = new IncomingData(); - incomingData.setDataContext(dataContext); - incomingData.setDataContextVersion(version); - incomingData.setDataObject(data.get("Data")); - //incomingData.setDataObject(data); - ingestService.ingestToPipeline(incomingData); - } catch (final Exception e) { - e.printStackTrace(); - LOGGER.error("Exception Encountered while processing the received message in Ingest Consumer : " + e.getMessage()); - } - } - - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/KafkaConsumer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/KafkaConsumer.java deleted file mode 100644 index 69374842c0e..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/KafkaConsumer.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ingestpipeline.consumer; - -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; - -import com.ingestpipeline.model.IncomingData; - -import java.util.Map; - -public interface KafkaConsumer { - - public void processMessage(final Map incomingData, - @Header(KafkaHeaders.RECEIVED_TOPIC) final String topic); - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/TransformConsumer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/TransformConsumer.java deleted file mode 100644 index d87517ac43b..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/TransformConsumer.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ingestpipeline.consumer; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; - -import com.ingestpipeline.producer.IngestProducer; -import com.ingestpipeline.service.TransformService; -import com.ingestpipeline.util.ApplicationProperties; -import com.ingestpipeline.util.Constants; - -@Service -public class TransformConsumer implements KafkaConsumer { - - public static final Logger LOGGER = LoggerFactory.getLogger(TransformConsumer.class); - public static final String INTENT = "transform"; - - @Autowired - @Qualifier(Constants.Qualifiers.TRANSFORM_COLLECTION_SERVICE) - private TransformService collectiontransformService; - - @Autowired - @Qualifier(Constants.Qualifiers.TRANSFORM_SERVICE) - private TransformService defaulttransformService; - - @Autowired - private IngestProducer ingestProducer; - - @Autowired - private ApplicationProperties applicationProperties; - - @Override - @KafkaListener(id = INTENT, groupId = INTENT, topics = "${kafka.transaction.validation.topic}", containerFactory = Constants.BeanContainerFactory.INCOMING_KAFKA_LISTENER) - public void processMessage(Map incomingData, - @Header(KafkaHeaders.RECEIVED_TOPIC) final String topic) { - LOGGER.info("##KafkaMessageAlert Transform Consumer## : key:" + topic + ":" + "value:" + incomingData.size()); - try { - boolean isTransformed = false; - String dataContext = incomingData.get(Constants.DATA_CONTEXT).toString(); - if(dataContext.equals(Constants.TransformationType.COLLECTION)) { - - isTransformed = collectiontransformService.transformData(incomingData); - } else { - - isTransformed = defaulttransformService.transformData(incomingData); - } - if (isTransformed) { - ingestProducer.pushToPipeline(incomingData, applicationProperties.getTransactionTransformationTopic(), null); - } - } catch (final Exception e) { - e.printStackTrace(); - LOGGER.error("Exception Encountered while processing the received message in transform consumer : " + e.getMessage()); - } - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/UpdateConsumer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/UpdateConsumer.java deleted file mode 100644 index c838cfbd5f1..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/UpdateConsumer.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ingestpipeline.consumer; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ingestpipeline.producer.IngestProducer; -import com.ingestpipeline.service.IESService; -import com.ingestpipeline.util.Constants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.ResponseEntity; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Component; - -import java.util.Map; -import java.net.URLEncoder; - -@Component -public class UpdateConsumer { - - - public static final Logger LOGGER = LoggerFactory.getLogger(UpdateConsumer.class); - private static final String ERROR_INTENT = "DataErrorBypass"; - @Autowired - private IngestProducer ingestProducer; - @Autowired - private ObjectMapper mapper; - @Autowired - private IESService elasticService; - - @Value("${kafka.topics.bypass.update.post}") - String updatedPostTopic; - - @Value("${es.bypass.push.direct}") - private Boolean esPushDirect; - - @KafkaListener(topics = "${kafka.topics.bypass.update.data}" , containerFactory = Constants.BeanContainerFactory.INCOMING_KAFKA_LISTENER) - public void processMessage(Map data, - @Header(KafkaHeaders.RECEIVED_TOPIC) final String topic) { - LOGGER.info("##KafkaMessageAlert## : key:" + topic + ":" + "value:" + data.size()); - try { - - String index = data.get("_index").toString(); - String type = data.get("_type").toString(); - JsonNode sourceNode = mapper.convertValue(data.get("_source"), JsonNode.class); - String _id = data.get("_id").toString(); - String id = URLEncoder.encode(data.get("_id").toString()); - - if(esPushDirect){ - ResponseEntity response = elasticService.post(index, type, id, "", sourceNode.toString()); - LOGGER.info("index :: {}, Response :: {} " ,index , response.getStatusCode()); - } else { - ingestProducer.pushToPipeline(sourceNode, updatedPostTopic, _id); - } - - } catch (final Exception e) { - StringBuilder str = new StringBuilder("Exception occurred while processing Message on Topic : "); - str.append(topic).append("Exception: "); - LOGGER.error(str.toString(), e); - if(!esPushDirect) - ingestProducer.pushToPipeline(data, ERROR_INTENT, null); - } - } - - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/ValidatorConsumer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/ValidatorConsumer.java deleted file mode 100644 index 74b52269d13..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/consumer/ValidatorConsumer.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ingestpipeline.consumer; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Service; - -import com.ingestpipeline.producer.IngestProducer; -import com.ingestpipeline.service.ValidationService; -import com.ingestpipeline.util.ApplicationProperties; -import com.ingestpipeline.util.Constants; - -@Service -public class ValidatorConsumer implements KafkaConsumer { - - public static final Logger LOGGER = LoggerFactory.getLogger(ValidatorConsumer.class); - - public static final String INTENT = "validator"; - - @Autowired - private ValidationService validationService; - - @Autowired - private IngestProducer ingestProducer; - - @Autowired - private ApplicationProperties applicationProperties; - - @Value("${kafka.topic.error.data}") - String errorTopic; - - @KafkaListener(id = INTENT, groupId = INTENT, topics = "${kafka.transaction.ingest.topic}", containerFactory = Constants.BeanContainerFactory.INCOMING_KAFKA_LISTENER) - public void processMessage(Map consumerRecord, - @Header(KafkaHeaders.RECEIVED_TOPIC) final String topic) { - LOGGER.info("##KafkaMessageAlert## Message Received at Validator Consumer : key:" + topic + ":" + "value:" + consumerRecord.size()); - try { - boolean isValid = validationService.validateData(consumerRecord); - String nextTopic = ""; - String nextKey = ""; - if (isValid) { - if(applicationProperties.getPipelineRules().get(Constants.PipelineRules.TRANSFORM_DATA)) { - nextTopic = applicationProperties.getTransactionValidationTopic(); - nextKey = applicationProperties.getTransactionValidationKey(); - } else if(applicationProperties.getPipelineRules().get(Constants.PipelineRules.ENRICH_DATA)) { - nextTopic = applicationProperties.getTransactionTransformationTopic(); - nextKey = applicationProperties.getTransactionTransformationKey(); - } - ingestProducer.pushToPipeline(consumerRecord, nextTopic, null); - } else { - ingestProducer.pushToPipeline(consumerRecord, errorTopic, null); - } - LOGGER.info("Next Topic: " + nextTopic); - LOGGER.info("Next Key: " + nextKey); - - } catch (final Exception e) { - e.printStackTrace(); - LOGGER.error("Exception Encountered while processing the received message in validator consumer : " + e.getMessage()); - } - - - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/controller/ProducerController.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/controller/ProducerController.java deleted file mode 100644 index 7acc48402f7..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/controller/ProducerController.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.ingestpipeline.controller; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.ingestpipeline.model.Response; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - - -@RestController -public class ProducerController { - - public static final Logger LOGGER = LoggerFactory.getLogger(ProducerController.class); - - @Value("${kafka.topics.bypass.update.data}") - private String topic; - @Value("${kafka.topics.bypass.update.key}") - private String topickey; - @Autowired - private KafkaTemplate kafkaTemplate; - - @PostMapping("/update/publish") - public ResponseEntity publish(@RequestBody String body){ - LOGGER.info("publishing request body "+body); - try{ - - JsonNode bodyNode = new ObjectMapper().readTree(body); - ArrayNode nodes = (ArrayNode) bodyNode.get("data"); - LOGGER.info("## nodes ## "+nodes); - for(JsonNode node : nodes ){ - LOGGER.info("single node "+node); - kafkaTemplate.send(topic, topickey, node); - - } - LOGGER.info("Published successfully"); - return new ResponseEntity(new Response("sucessful", "Published successfully"), HttpStatus.OK); - - } catch (Exception e){ - LOGGER.error("Published failed "+ e.getMessage()); - return new ResponseEntity(new Response("failed", e.getMessage()), HttpStatus.BAD_REQUEST); - } - - } - - @Value("${kafka.topics.incoming.collection}") - private String testTopic; - @Value("${kafka.topics.enriched.key}") - private String testKey; - - @PostMapping("/update/collection/test") - public String test(@RequestBody String body){ - try{ - JsonNode node = new ObjectMapper().readTree(body); - kafkaTemplate.send(testTopic, testKey, node.get("data")); - LOGGER.info("Published successfully"); - return "Published successfully"; - - } catch (Exception e){ - LOGGER.error("Published failed "+ e.getMessage()); - return "Published failed: "+e.getMessage(); - } - - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/controller/RestApiController.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/controller/RestApiController.java deleted file mode 100644 index 382b94914c2..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/controller/RestApiController.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.ingestpipeline.controller; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.TimeZone; - -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.kafka.config.KafkaListenerEndpointRegistry; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.gson.Gson; -import com.ingestpipeline.model.IncomingData; -import com.ingestpipeline.model.TargetData; -import com.ingestpipeline.repository.TargetDataDao; -import com.ingestpipeline.service.ElasticService; -import com.ingestpipeline.service.IngestService; -import com.ingestpipeline.util.Constants; -import com.ingestpipeline.util.JSONUtil; -import com.ingestpipeline.util.ReadUtil; - -@RestController -@RequestMapping(Constants.Paths.ELASTIC_PUSH_CONTROLLER_PATH) -public class RestApiController { - - public static final Logger logger = LoggerFactory.getLogger(RestApiController.class); - - @Value("${id.timezone}") - private String timeZone; - - @Autowired - IngestService ingestService; - - @Autowired - TargetDataDao targetDataDao; - - @Autowired - private KafkaListenerEndpointRegistry endPointRegistry; - - @Autowired - private ElasticService elasticService; - - /** - * This API use to pause a active kafka consumer - * - * @param consumerId kafka consumer identifier - * @return - */ - @RequestMapping(value = "/pause/{consumerId}", method = RequestMethod.GET) - public Boolean pauseConsumer(@PathVariable final String consumerId) { - endPointRegistry.getListenerContainer(consumerId).pause(); - return Boolean.TRUE; - } - - /** - * This API is to resume a paused kafka consumer - * - * @param consumerId kafka consumer identifier - * @return - */ - @RequestMapping(value = "/resume/{consumerId}", method = RequestMethod.GET) - public Boolean resumeConsumer(@PathVariable final String consumerId) { - endPointRegistry.getListenerContainer(consumerId).resume(); - return Boolean.TRUE; - } - - /** - * This API receives the Transaction Details JSON Request and passes it on to - * the Service Layer for further process of persisting into elastic search - * database - * - * @param transaction - * @return - */ - @RequestMapping(value = Constants.Paths.SAVE, method = RequestMethod.POST) - public ResponseEntity save(@RequestBody IncomingData incomingData) { - logMyTime(); - Boolean status = ingestService.ingestToPipeline(incomingData); - if (status) { - return new ResponseEntity(HttpStatus.CREATED); - } - return new ResponseEntity(HttpStatus.SERVICE_UNAVAILABLE); - } - - /** - * This API use to provide response for external data upload - * - * @param get file - * @author Rahul - * @throws Exception - */ - @RequestMapping(value = Constants.Paths.Targets, method = RequestMethod.GET) - public String getTargets() throws Exception { - List datas = (List) targetDataDao.findAll(); - String response = JSONUtil.getJsonString(new ObjectMapper(), datas); - return response; - } - - /** - * This API use to import external data upload Request - * - * @param upload file - * @author Rahul - * @throws Exception - */ - @RequestMapping(value = Constants.Paths.UPLOAD, method = RequestMethod.POST) - public ResponseEntity handleFileUpload(@RequestParam("file") MultipartFile file) throws Exception { - Boolean status = ingestService.ingestToPipeline(getWrapper(file)); - if (status) { - return new ResponseEntity(HttpStatus.CREATED); - } - return new ResponseEntity(HttpStatus.SERVICE_UNAVAILABLE); - } - - public IncomingData getWrapper(MultipartFile file) throws Exception { - JSONArray jsonArray = new JSONArray(); - jsonArray = ReadUtil.getFiletoDirectory(file); - IncomingData incomingData = new IncomingData(); - incomingData.setDataContext("target"); - incomingData.setDataContextVersion("v1"); - Iterator itr = jsonArray.iterator(); - List list = new ArrayList(); - while (itr.hasNext()) { - JSONObject obj = (JSONObject) itr.next(); - Map mapJ = new Gson().fromJson(obj.toString(), Map.class); - list.add(mapJ); - } - incomingData.setDataObject(list); - return incomingData; - } - - /** - * This API to post documents from ES index - * - * @param post documents - * @author Rahul - * @throws Exception - */ - @RequestMapping(value = "/migrate/{indexName}/{version}", method = RequestMethod.POST) - public ResponseEntity migrateIndex(@PathVariable String indexName, @PathVariable String version) throws Exception { - String index = null, queryString = null, dataContext = null; - Boolean status = elasticService.searchIndex(indexName, queryString, version); - if (status) { - return new ResponseEntity(HttpStatus.CREATED); - } else { - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - } - -/** - * This API to post documents from ES index - * - * @param post documents - * @author Rahul - * @throws Exception - */ - @RequestMapping(value = "/migrateV2/{indexName}/{version}", method = RequestMethod.GET) - public ResponseEntity migrateIndexV2(@PathVariable String indexName, @PathVariable String dataContextVersion) throws Exception { - String index = null, queryString = null, dataContext = null; - Boolean status = elasticService.searchIndex(indexName, queryString, dataContextVersion); - if (status) { - return new ResponseEntity(HttpStatus.CREATED); - } else if (index.equals("notDefinedIndex")) { - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - return new ResponseEntity(HttpStatus.SERVICE_UNAVAILABLE); - } - - private void logMyTime() { - logger.info("System Time is : " + new Date()); - SimpleDateFormat sd = new SimpleDateFormat(Constants.DATE_FORMAT); - Date date = new Date(); - sd.setTimeZone(TimeZone.getTimeZone(timeZone)); - logger.info("Time at timezone IST : " + sd.format(date)); - } -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Consumable.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Consumable.java deleted file mode 100644 index 7f34f9f9539..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Consumable.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ingestpipeline.model; - - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"dataContext", -"topics" -}) -public class Consumable { - -@JsonProperty("dataContext") -private String dataContext; -@JsonProperty("topics") -private List topics = null; -@JsonIgnore -private Map additionalProperties = new HashMap(); - -@JsonProperty("dataContext") -public String getDataContext() { -return dataContext; -} - -@JsonProperty("dataContext") -public void setDataContext(String dataContext) { -this.dataContext = dataContext; -} - -@JsonProperty("topics") -public List getTopics() { -return topics; -} - -@JsonProperty("topics") -public void setTopics(List topics) { -this.topics = topics; -} - -@JsonAnyGetter -public Map getAdditionalProperties() { -return this.additionalProperties; -} - -@JsonAnySetter -public void setAdditionalProperty(String name, Object value) { -this.additionalProperties.put(name, value); -} - -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/DigressionPoint.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/DigressionPoint.java deleted file mode 100644 index e65fd4f7b75..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/DigressionPoint.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ingestpipeline.model; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "dataContext", "paths" }) -public class DigressionPoint { - - @JsonProperty("dataContext") - private String dataContext; - @JsonProperty("paths") - private List paths = null; - - public String getDataContext() { - return dataContext; - } - - public void setDataContext(String dataContext) { - this.dataContext = dataContext; - } - - public List getPaths() { - return paths; - } - - public void setPaths(List paths) { - this.paths = paths; - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/DigressionPointConfig.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/DigressionPointConfig.java deleted file mode 100644 index 94a271e5565..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/DigressionPointConfig.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ingestpipeline.model; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"digressionPoints" -}) -public class DigressionPointConfig { - -@JsonProperty("digressionPoints") -private List digressionPoints = null; -@JsonIgnore -private Map additionalProperties = new HashMap(); - -@JsonProperty("digressionPoints") -public List getDigressionPoints() { -return digressionPoints; -} - -@JsonProperty("digressionPoints") -public void setDigressionPoints(List digressionPoints) { -this.digressionPoints = digressionPoints; -} - -@JsonAnyGetter -public Map getAdditionalProperties() { -return this.additionalProperties; -} - -@JsonAnySetter -public void setAdditionalProperty(String name, Object value) { -this.additionalProperties.put(name, value); -} - -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/DomainIndexConfig.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/DomainIndexConfig.java deleted file mode 100644 index 043db28caec..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/DomainIndexConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.ingestpipeline.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.ArrayList; -import java.util.List; - -public class DomainIndexConfig { - - private String id; - private String domain; - private String indexName; - private String documentType; - private String query; - - private List sourceReferences = new ArrayList<>(); - private List targetReferences = new ArrayList<>(); - - @JsonProperty(value="sourceReferences") - public List getSourceReferences() { - return sourceReferences; - } - - public void setSourceReferences(List sourceReferences) { - this.sourceReferences = sourceReferences; - } - @JsonProperty(value="targetReferences") - public List getTargetReferences() { - return targetReferences; - } - - public void setTargetReferences(List targetReferences) { - this.targetReferences = targetReferences; - } - - @JsonProperty(value="id") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JsonProperty(value="domain") - public String getDomain() { - return domain; - } - - public void setDomain(String businessType) { - this.domain = businessType; - } - - @JsonProperty(value="indexName") - public String getIndexName() { - return indexName; - } - - public void setIndexName(String indexName) { - this.indexName = indexName; - } - - @JsonProperty(value="documentType") - public String getDocumentType() { - return documentType; - } - - public void setDocumentType(String documentType) { - this.documentType = documentType; - } - - @JsonProperty(value="query") - public String getQuery() { - return query; - } - - public void setQuery(String query) { - this.query = query; - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/ErrorWrapper.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/ErrorWrapper.java deleted file mode 100644 index a38b00c64ed..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/ErrorWrapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ingestpipeline.model; - -public class ErrorWrapper { - - private String errorCode; - private String errorMessage; - private Object incomingData; - - public String getErrorCode() { - return errorCode; - } - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - public String getErrorMessage() { - return errorMessage; - } - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - public Object getIncomingData() { - return incomingData; - } - public void setIncomingData(Object incomingData) { - this.incomingData = incomingData; - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/IncomingData.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/IncomingData.java deleted file mode 100644 index ce02ff52fdf..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/IncomingData.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ingestpipeline.model; - -public class IncomingData { - - private String dataContext; - private String dataContextVersion; - private Object dataObject; - - public String getDataContext() { - return dataContext; - } - public void setDataContext(String dataContext) { - this.dataContext = dataContext; - } - public String getDataContextVersion() { - return dataContextVersion; - } - public void setDataContextVersion(String dataContextVersion) { - this.dataContextVersion = dataContextVersion; - } - public Object getDataObject() { - return dataObject; - } - public void setDataObject(Object dataObject) { - this.dataObject = dataObject; - } - @Override - public String toString() { - return "IncomingData [dataContext=" + dataContext + ", dataContextVersion=" + dataContextVersion - + ", dataObject=" + dataObject + "]"; - } - - - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/IncomingDataConfig.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/IncomingDataConfig.java deleted file mode 100644 index f9ac55dce40..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/IncomingDataConfig.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ingestpipeline.model; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"consumables" -}) -public class IncomingDataConfig { - -@JsonProperty("consumables") -private List consumables = null; -@JsonIgnore -private Map additionalProperties = new HashMap(); - -@JsonProperty("consumables") -public List getConsumables() { -return consumables; -} - -@JsonProperty("consumables") -public void setConsumables(List consumables) { -this.consumables = consumables; -} - -@JsonAnyGetter -public Map getAdditionalProperties() { -return this.additionalProperties; -} - -@JsonAnySetter -public void setAdditionalProperty(String name, Object value) { -this.additionalProperties.put(name, value); -} - -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/KeyValuePair.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/KeyValuePair.java deleted file mode 100644 index 3556caf66b3..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/KeyValuePair.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ingestpipeline.model; - -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"name", -"value", -"intent" -}) -public class KeyValuePair { - -@JsonProperty("intent") -private String intent; -@JsonProperty("name") -private String name; -@JsonProperty("value") -private String value; -@JsonIgnore -private Map additionalProperties = new HashMap(); - -@JsonProperty("name") -public String getName() { -return name; -} - -@JsonProperty("name") -public void setName(String name) { -this.name = name; -} - -@JsonProperty("intent") -public String getIntent() { -return intent; -} - -@JsonProperty("intent") -public void setIntent(String intent) { -this.intent = intent; -} - - - -@JsonProperty("value") -public String getValue() { -return value; -} - -@JsonProperty("value") -public void setValue(String value) { -this.value = value; -} - -@JsonAnyGetter -public Map getAdditionalProperties() { -return this.additionalProperties; -} - -@JsonAnySetter -public void setAdditionalProperty(String name, Object value) { -this.additionalProperties.put(name, value); -} - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Path.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Path.java deleted file mode 100644 index 38c35ed9494..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Path.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.ingestpipeline.model; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "route", "paths" }) -public class Path { - - @JsonProperty("route") - private String route; - - @JsonProperty("paths") - private List paths; - - @JsonProperty("removeReplace") - private String removeReplace; - - public String getRemoveReplace() { - return removeReplace; - } - - public void setRemoveReplace(String removeReplace) { - this.removeReplace = removeReplace; - } - - public List getPaths() { - return paths; - } - - public void setPaths(List paths) { - this.paths = paths; - } - - @JsonIgnore - private Map additionalProperties = new HashMap(); - - @JsonProperty("route") - public String getRoute() { - return route; - } - - @JsonProperty("route") - public void setRoute(String route) { - this.route = route; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/References.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/References.java deleted file mode 100644 index 130eac810b0..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/References.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.ingestpipeline.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class References { - - - private String fieldName; - private String argument; - private String dataType; - private String value; - private String seperator; - private String expression; - - @JsonProperty(value="fieldName") - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String fieldName) { - this.fieldName = fieldName; - } - - @JsonProperty(value="argument") - public String getArgument() { - return argument; - } - - public void setArgument(String argument) { - this.argument = argument; - } - - @JsonProperty(value="dataType") - public String getDataType() { - return dataType; - } - - public void setDataType(String dataType) { - this.dataType = dataType; - } - - @JsonProperty(value="value") - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - @JsonProperty(value="seperator") - public String getSeperator() { - return seperator; - } - - public void setSeperator(String seperator) { - this.seperator = seperator; - } - @JsonProperty(value="expression") - public String getExpression() { - return expression; - } - - public void setExpression(String expression) { - this.expression = expression; - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Response.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Response.java deleted file mode 100644 index 84f69a2800e..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Response.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ingestpipeline.model; - -public class Response { - - private String message; - private String status; - - public Response(String status, String message){ - this.message = message; - this.status = status; - } - - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Snippet.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Snippet.java deleted file mode 100644 index 69d1e509c57..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/Snippet.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.ingestpipeline.model; - -public class Snippet { - public static void main(String[] args) { - - } -} - diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/SourceReferences.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/SourceReferences.java deleted file mode 100644 index 7e7fd4ae062..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/SourceReferences.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.ingestpipeline.model; - -public class SourceReferences extends References{ - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TargetData.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TargetData.java deleted file mode 100644 index 168bc94cfec..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TargetData.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.ingestpipeline.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import java.io.Serializable; -import java.math.BigDecimal; - -@Entity -@Table(name = "TargetData") -@JsonIgnoreProperties -public class TargetData implements Serializable { - - @Id /*@GeneratedValue(strategy=GenerationType.AUTO) */ - @Column(name = "id", nullable = false) - private int id; - - @Column(name = "snoForMunicipalCorporation", nullable = false) - private String snoForMunicipalCorporation; - - @Column(name = "tenantIdForMunicipalCorporation", nullable = false) - private String tenantIdForMunicipalCorporation; - - @Column(name = "ulbName", nullable = false) - private String ulbName; - - @Column(name = "actualCollectionForMunicipalCorporation", nullable = false) - private BigDecimal actualCollectionForMunicipalCorporation; - - @Column(name = "budgetProposedForMunicipalCorporation", nullable = false) - private BigDecimal budgetProposedForMunicipalCorporation; - - @Column(name = "actualCollectionBudgetedForMunicipalCorporation", nullable = false) - private BigDecimal actualCollectionBudgetedForMunicipalCorporation; - - @Column(name = "financialYear", nullable = false) - private String financialYear; - - @Column(name = "Timestamp", nullable = false) - private String Timestamp; - - @Column(name = "businessService", nullable = false) - private String businessService; - - public TargetData() { - super(); - // TODO Auto-generated constructor stub - } - - @JsonProperty("id") - public int getId() { - return id; - } - @JsonProperty("id") - public void setId(int id) { - this.id = id; - } - @JsonProperty("snoForMunicipalCorporation") - public String getSnoForMunicipalCorporation() { - return snoForMunicipalCorporation; - } - - public void setSnoForMunicipalCorporation(String snoForMunicipalCorporation) { - this.snoForMunicipalCorporation = snoForMunicipalCorporation; - } - @JsonProperty("tenantIdForMunicipalCorporation") - public String getTenantIdForMunicipalCorporation() { - return tenantIdForMunicipalCorporation; - } - - public void setTenantIdForMunicipalCorporation(String tenantIdForMunicipalCorporation) { - this.tenantIdForMunicipalCorporation = tenantIdForMunicipalCorporation; - } - @JsonProperty("ulbName") - public String getUlbName() { - return ulbName; - } - @JsonProperty("ulbName") - public void setUlbName(String ulbName) { - this.ulbName = ulbName; - } - @JsonProperty("actualCollectionForMunicipalCorporation") - public BigDecimal getActualCollectionForMunicipalCorporation() { - return actualCollectionForMunicipalCorporation; - } - @JsonProperty("actualCollectionForMunicipalCorporation") - public void setActualCollectionForMunicipalCorporation(BigDecimal actualCollectionForMunicipalCorporation) { - this.actualCollectionForMunicipalCorporation = actualCollectionForMunicipalCorporation; - } - @JsonProperty("budgetProposedForMunicipalCorporation") - public BigDecimal getBudgetProposedForMunicipalCorporation() { - return budgetProposedForMunicipalCorporation; - } - @JsonProperty("budgetProposedForMunicipalCorporation") - public void setBudgetProposedForMunicipalCorporation(BigDecimal budgetProposedForMunicipalCorporation) { - this.budgetProposedForMunicipalCorporation = budgetProposedForMunicipalCorporation; - } - @JsonProperty("actualCollectionBudgetedForMunicipalCorporation") - public BigDecimal getActualCollectionBudgetedForMunicipalCorporation() { - return actualCollectionBudgetedForMunicipalCorporation; - } - @JsonProperty("actualCollectionBudgetedForMunicipalCorporation") - public void setActualCollectionBudgetedForMunicipalCorporation(BigDecimal actualCollectionBudgetedForMunicipalCorporation) { - this.actualCollectionBudgetedForMunicipalCorporation = actualCollectionBudgetedForMunicipalCorporation; - } - @JsonProperty("financialYear") - public String getFinancialYear() { - return financialYear; - } - @JsonProperty("financialYear") - public void setFinancialYear(String financialYear) { - this.financialYear = financialYear; - } - @JsonProperty("Timestamp") - public String getTimestamp() { - return Timestamp; - } - @JsonProperty("Timestamp") - public void setTimestamp(String timestamp) { - Timestamp = timestamp; - } - @JsonProperty("businessService") - public String getBusinessService() { - return businessService; - } - @JsonProperty("businessService") - public void setBusinessService(String businessService) { - this.businessService = businessService; - } - - @Override - public String toString() { - return "TargetData [id=" + id + ", snoForMunicipalCorporation=" + snoForMunicipalCorporation - + ", tenantIdForMunicipalCorporation=" + tenantIdForMunicipalCorporation + ", ulbName=" + ulbName - + ", actualCollectionForMunicipalCorporation=" + actualCollectionForMunicipalCorporation - + ", budgetProposedForMunicipalCorporation=" + budgetProposedForMunicipalCorporation - + ", actualCollectionBudgetedForMunicipalCorporation=" + actualCollectionBudgetedForMunicipalCorporation - + ", financialYear=" + financialYear + ", Timestamp=" + Timestamp + ", businessService=" - + businessService + "]"; - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TargetReferences.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TargetReferences.java deleted file mode 100644 index 8e498414680..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TargetReferences.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.ingestpipeline.model; - -public class TargetReferences extends References{ - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TopicContext.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TopicContext.java deleted file mode 100644 index f079c575381..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TopicContext.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ingestpipeline.model; - -public class TopicContext { - - private String topic; - private String dataContext; - private String dataContextVersion; - public String getTopic() { - return topic; - } - public void setTopic(String topic) { - this.topic = topic; - } - public String getDataContext() { - return dataContext; - } - public void setDataContext(String dataContext) { - this.dataContext = dataContext; - } - public String getDataContextVersion() { - return dataContextVersion; - } - public void setDataContextVersion(String dataContextVersion) { - this.dataContextVersion = dataContextVersion; - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TopicContextConfig.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TopicContextConfig.java deleted file mode 100644 index 5662f017a26..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/model/TopicContextConfig.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.ingestpipeline.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.ArrayList; -import java.util.List; - -public class TopicContextConfig { - - private List topicContexts = new ArrayList<>(); - - @JsonProperty(value = "topicContextConfigurations") - public List getTopicContexts() { - return topicContexts; - } - public void setTopicContexts(List topicContexts) { - this.topicContexts = topicContexts; - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/HashMapSerializer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/HashMapSerializer.java deleted file mode 100644 index b2840c3c35b..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/HashMapSerializer.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.ingestpipeline.producer; - -import java.util.Map; - -import org.apache.kafka.common.serialization.Serializer; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class HashMapSerializer implements Serializer { - @Override - public void close() { - // TODO Auto-generated method stub - } - - @Override - public void configure(Map arg0, boolean arg1) { - // TODO Auto-generated method stub - } - - @Override - public byte[] serialize(String topic, Map data) { - byte[] value = null; - ObjectMapper objectMapper = new ObjectMapper(); - try { - value = objectMapper.writeValueAsString(data).getBytes(); - } catch (JsonProcessingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return value; - } -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/IngestProducer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/IngestProducer.java deleted file mode 100644 index 46038684f04..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/IngestProducer.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.ingestpipeline.producer; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.stereotype.Service; - -import com.google.gson.Gson; - -@Service -public class IngestProducer { - - public static final Logger LOGGER = LoggerFactory.getLogger(IngestProducer.class); - - @Autowired - private KafkaTemplate kafkaTemplate; - - public void pushToPipeline(Object object, String topic, String key) { - LOGGER.info("Kafka Topic : " + topic + " Kafka Key : " + key); - kafkaTemplate.send(topic, key, object); - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/IngestProducerConfig.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/IngestProducerConfig.java deleted file mode 100644 index a65fbbb3384..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/IngestProducerConfig.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ingestpipeline.producer; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.kafka.clients.producer.ProducerConfig; -import org.apache.kafka.common.serialization.StringSerializer; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.kafka.annotation.EnableKafka; -import org.springframework.kafka.core.DefaultKafkaProducerFactory; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.kafka.core.ProducerFactory; -import org.springframework.kafka.support.serializer.JsonSerializer; - -@Configuration -@EnableKafka -public class IngestProducerConfig { - - @Value("${spring.kafka.bootstrap.servers}") - private String serverConfig; - - @Value("${kafka.producer.config.retries_config}") - private Integer retriesConfig; - - @Value("${kafka.producer.config.batch_size_config}") - private Integer batchSizeConfig; - - @Value("${kafka.producer.config.linger_ms_config}") - private Integer lingerMsConfig; - - @Value("${kafka.producer.config.buffer_memory_config}") - private Integer bufferMemoryConfig; - - @Bean - public ProducerFactory producerFactory() { - Map configProps = new HashMap<>(); - configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, serverConfig); - configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); - configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class); - return new DefaultKafkaProducerFactory<>(configProps); - } - - @Bean - public KafkaTemplate kafkaTemplate() { - return new KafkaTemplate<>(producerFactory()); - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/JavaSerializer.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/JavaSerializer.java deleted file mode 100644 index b99d213953a..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/producer/JavaSerializer.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ingestpipeline.producer; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.util.Map; - -import org.apache.kafka.common.serialization.Serializer; - -public class JavaSerializer implements Serializer { - - @Override - public byte[] serialize(String topic, Object data) { - try { - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - ObjectOutputStream objectStream = new ObjectOutputStream(byteStream); - objectStream.writeObject(data); - objectStream.flush(); - objectStream.close(); - return byteStream.toByteArray(); - } - catch (IOException e) { - throw new IllegalStateException("Can't serialize object: " + data, e); - } - } - - @Override - public void configure(Map configs, boolean isKey) { - - } - - @Override - public void close() { - - } - -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/repository/ElasticSearchRepository.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/repository/ElasticSearchRepository.java deleted file mode 100644 index 27a9d4a2898..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/repository/ElasticSearchRepository.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.ingestpipeline.repository; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.HttpServerErrorException; -import org.springframework.web.client.RestTemplate; - -import com.ingestpipeline.util.Constants; - -/** - * This Repository Class is used to perform the transactions of storing the data into the Elastic Search Repository - * @author Darshan Nagesh - * - */ -@Service -public class ElasticSearchRepository { - - public static final Logger LOGGER = LoggerFactory.getLogger(ElasticSearchRepository.class); - - private final RestTemplate restTemplate; - - public ElasticSearchRepository(RestTemplate restTemplate) { - this.restTemplate = restTemplate; - } - - /** - * Based on the Transaction Index Data Obtained and the URL with Headers, this method will put the Data obtained on the - * Elastic Search Database and returns the response in the form of Positive or Negative outcome (True Or False) - * @param transactionIndex - * @param url - * @param headers - * @return - */ - public Boolean saveMyDataObject(Object object, String url, HttpHeaders headers) { - ResponseEntity map = null; - try { - map = restTemplate.exchange(url, HttpMethod.PUT, - new HttpEntity<>(object, headers), Map.class); - } catch (final HttpClientErrorException httpClientErrorException) { - LOGGER.error("Error : " + httpClientErrorException); - } catch (HttpServerErrorException httpServerErrorException) { - LOGGER.error("Error : " + httpServerErrorException); - } catch (Exception e) { - LOGGER.error("Error : " + e); - } - if (map != null && map.getStatusCode() != null && (map.getStatusCode() == HttpStatus.OK) || (map.getStatusCode() == HttpStatus.CREATED)) { - return true; - } - return false; - } - - public ResponseEntity fetchMDMSResponse(Object mdmsRequestObject) { - - HttpHeaders headers = new HttpHeaders(); - headers.set(Constants.CONTENT_TYPE, Constants.JSON); - - HttpEntity httpEntity = new HttpEntity<>(mdmsRequestObject, headers); - ResponseEntity result = restTemplate.exchange(Constants.MDMS_URL, HttpMethod.POST, httpEntity, Map.class); - - return result; - } - } diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/repository/TargetDataDao.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/repository/TargetDataDao.java deleted file mode 100644 index 50fea5867df..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/repository/TargetDataDao.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.ingestpipeline.repository; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonSubTypes.Type; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeInfo.As; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.ingestpipeline.model.TargetData; -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface TargetDataDao extends CrudRepository { - -/* public List findAll(); - - public void save(TargetData targetData);*/ -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/CollectionTransformationService.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/CollectionTransformationService.java deleted file mode 100644 index ba47ba7fb7c..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/CollectionTransformationService.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.ingestpipeline.service; - -import com.bazaarvoice.jolt.Chainr; -import com.bazaarvoice.jolt.JsonUtils; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.ingestpipeline.util.ConfigLoader; -import com.ingestpipeline.util.Constants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -@Service(Constants.Qualifiers.TRANSFORM_COLLECTION_SERVICE) -public class CollectionTransformationService implements TransformService { - - public static final Logger LOGGER = LoggerFactory.getLogger(CollectionTransformationService.class); - - - private static final String SEPARATOR = "_"; - private static final String JSON_EXTENSION = ".json"; - private static final String OBJECTIVE = "transform"; - private static final String CONFIGROOT = "config/"; - private static final String JOLT_SPEC = "spec"; - - private static final String TRANSACTION_ID = "transactionId"; - private static final String ID = "id"; - - - - @Autowired - private ConfigLoader configLoader; - - private String previousKey= ""; - - @Override - public Boolean transformData(Map incomingData) { - - Map incomingDataCopy = new HashMap<>(); - incomingDataCopy.putAll(incomingData); - incomingData.clear(); - - String dataContext = incomingDataCopy.get(Constants.DATA_CONTEXT).toString(); - String dataContextVersion = incomingDataCopy.get(Constants.DATA_CONTEXT_VERSION).toString(); - ObjectMapper mapper = new ObjectMapper(); - List chainrSpecJSON = null ; - - try { - - JsonNode incomingNode = mapper.convertValue(incomingDataCopy, JsonNode.class); - //LOGGER.info("incoming data: "+incomingNode); - //JsonNode identifier = incomingNode.get(Constants.DATA_OBJECT).get(TRANSACTION_ID); - - - //To change: for loading the file from config root - String trsFile = OBJECTIVE.concat(SEPARATOR).concat(dataContext).concat(SEPARATOR).concat(dataContextVersion).concat(JSON_EXTENSION); - String strFile = configLoader.get(trsFile); - JsonNode specNode = mapper.readTree(strFile); - // LOGGER.info("specNode:## "+specNode); - - - /*LOGGER.info("sourceUrl## "+strFile); - - String sourceUrl = CONFIGROOT.concat(OBJECTIVE.concat(SEPARATOR).concat(dataContext).concat(SEPARATOR).concat(dataContextVersion).concat(JSON_EXTENSION)); - - LOGGER.info("sourceUrl## "+sourceUrl); - - JsonNode specNode = mapper.readTree(this.getClass().getClassLoader().getResourceAsStream(sourceUrl)); - - LOGGER.info("specNode:## "+specNode);*/ - - //String sourceUrl = (OBJECTIVE.concat(SEPARATOR).concat(dataContext).concat(SEPARATOR).concat(dataContextVersion).concat(JSON_EXTENSION)); - //JsonNode specNode = mapper.readTree(configLoader.get(sourceUrl)); - - String previousField = findParentKey(specNode.findPath(JOLT_SPEC), "$i", ""); - int parentNodeSize = incomingNode.findValues(previousField).get(0).size(); - - for(int i=0; (i> fields = node.fields(); - while (fields.hasNext()) { - Map.Entry entry = fields.next(); - - if (entry.getKey().equalsIgnoreCase(value)) { - previousKey = key; - break; - } else if (entry.getValue().isObject()) { - key = entry.getKey(); - findParentKey(entry.getValue(), value, key); - } - } - return previousKey; - - } - - - /*public void transformData() { - - Map incomingData = new HashMap(); -*//* Map incomingDataCopy = new HashMap(); - incomingDataCopy.putAll(incomingData);*//* - incomingData.clear(); - //String dataContext = incomingData.get(Constants.DATA_CONTEXT).toString(); - //String dataContextVersion = incomingData.get(Constants.DATA_CONTEXT_VERSION).toString(); - ObjectMapper mapper = new ObjectMapper(); - List chainrSpecJSON = null ; - List incomingDataList = new ArrayList<>(); - - try { - - JsonNode specNode = mapper.readTree(configLoader.get("anytransform_collection_v2.json")); - - JsonNode incoming = mapper.readTree(configLoader.get("anyinput.json"));//TODO: use incomming node object - Map incommingMap = new HashMap(); - incommingMap = mapper.convertValue(incoming, new TypeReference>(){}); - - String previousField = findKey(specNode.findPath(JOLT_SPEC), "$i", ""); - int parentNodeSize = incoming.findValues(previousField).get(0).size(); - - for(int i=0; (i productList = null; // getBiProducts(incomingData, digressionPoint); - /*if(productList != null && productList.size() > 0) { - for(JsonNode product : productList) { - Map subData = new HashMap<>(); - subData.put(Constants.DATA_CONTEXT, incomingData.getDataContext()); - subData.put(Constants.DATA_CONTEXT_VERSION, incomingData.getDataContextVersion()); - subData.put(Constants.DATA_OBJECT, product); - } - }*/ - return null; - } - - private Object ingestServiceReplace(Map incomingData) { - - return null; - } - - /*private List getBiProducts(IncomingData incomingData, DigressionPoint point) { - Object dataObject = incomingData.getDataObject(); - List dataObjectList = new ArrayList<>(); - List paths = point.getPaths(); - ObjectMapper mapper = new ObjectMapper(); - Gson gson = new Gson(); - JsonNode mainNode = null; - try { - mainNode = mapper.readTree(gson.toJson(dataObject)); - } catch (Exception ex) { - LOGGER.error("Encountered an error while converting the data to JSON Node : " + ex.getMessage()); - } - List list = generateBiProducts(point.getPaths(), mainNode); - return list; - } - - private List generateBiProducts(List paths, JsonNode mainNode) { - List jsonNodeList = new ArrayList<>(); - for(Path path : paths) { - jsonNodeList = getSplitObjects(path.getRoute(), mainNode, path.getRemoveReplace()); - for(JsonNode subNode : jsonNodeList) { - if(path.getPaths() != null && path.getPaths().size() > 0) { - generateBiProducts(path.getPaths(), subNode); - } - } - } - if(jsonNodeList.size() == 0) { - jsonNodeList.add(mainNode); - } - return jsonNodeList; - } - - private List getSplitObjects(String route, JsonNode mainNode, String removeReplace) { - List nodeList = new ArrayList<>(); - String[] routes = route.split("\\."); - List routesList = Arrays.asList(routes); - JsonNode node = mainNode; - for(String r : routes) { - node = node.path(r); - } - if(node.isArray()) { - ArrayNode arrayNode = (ArrayNode) node; - if(arrayNode.size() > 1) { - ObjectNode finalSubNode = null; - for(int i=0 ; i < arrayNode.size() ; i++) { - ObjectNode subNode = mainNode.deepCopy(); - JsonNode subJsonNode = mainNode.deepCopy(); - for(String r : routes) { - if(subNode.get(r).deepCopy().isArray()) { - ArrayNode arraySubNode = subNode.get(r).deepCopy(); - subNode = arraySubNode.get(i).deepCopy(); - } else { - JsonNode jsonSubNode = subNode.get(r).deepCopy(); - subNode = jsonSubNode.deepCopy(); - } - } - ObjectNode mainObjectNode = mainNode.deepCopy(); - for(String r : routes) { - if(!r.equals(removeReplace)) { - mainObjectNode = mainObjectNode.get(r).deepCopy(); - } else { - mainObjectNode.remove(removeReplace); - routesList.remove(removeReplace); - } - } - for(int j =0 ; j caughtFailedRequests = new HashMap<>(); - - - @Value("${es.index.type}") - public String DOC_PATH; - - @Value("${services.esindexer.host}") - private String indexServiceHost; - - @Value("${egov.services.esindexer.host.search}") - private String indexServiceHostSearch; - - @Value("${es.host.schema}") - private String schema; - - @Value("${services.esindexer.host}") - private String indexerServiceHost; - - @Value("${es.target.index.name}") - private String targetIndexName; - - @Value("${dss.collection.target.index.name}") - private String dssCollectiontargetIndexName; - - @Value("${dss.collection.mapping.path}") - private String dssCollectionMappingPath; - - @Value("${es.index.name}") - private String collectionIndexName; - - @Value("${es.index.searchQuery.collection}") - private String searchQueryCollection; - - @Value("${es.index.searchQuery.billing}") - private String searchQueryBilling; - - @Value("${es.index.searchQuery.payment}") - private String searchQueryPayment; - - @Value("${services.esindexer.username}") - private String userName; - - @Value("${services.esindexer.password}") - private String password; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private RetryTemplate retryTemplate; - - @Autowired - private IngestService ingestService; - - private static final String SLASH_SEPERATOR = "/"; - - private static final String MAPPING = "_mapping"; - - public static final Logger LOGGER = LoggerFactory.getLogger(ElasticService.class); - - public String getSearchQueryCollection() { - return searchQueryCollection; - } - - public void setSearchQueryCollection(String searchQueryCollection) { - this.searchQueryCollection = searchQueryCollection; - } - - public String getSearchQueryPayment() { - return searchQueryPayment; - } - - public void setSearchQueryPayment(String searchQueryPayment) { - this.searchQueryPayment = searchQueryPayment; - } - - public String getSearchQueryBilling() { - return searchQueryBilling; - } - - public void setSearchQueryBilling(String searchQueryBilling) { - this.searchQueryBilling = searchQueryBilling; - } - - private static final String AUTHORIZATION = "Authorization"; - private static final String US_ASCII = "US-ASCII"; - private static final String BASIC_AUTH = "Basic %s"; - - @PostConstruct - void initalizeindexMapping() throws IOException { - StringBuilder uriBuilder = new StringBuilder(indexerServiceHost.concat(dssCollectiontargetIndexName)); - HttpHeaders headers = new HttpHeaders(); - headers.add(AUTHORIZATION, getBase64Value(userName, password)); - headers.setContentType(MediaType.APPLICATION_JSON); - HttpEntity requestEntity = new HttpEntity<>("", headers); - ResponseEntity response = new ResponseEntity(HttpStatus.OK); - try { - LOGGER.info("url:"+uriBuilder.toString()); - LOGGER.info("requestEntity: "+ requestEntity.toString()); - response = retryTemplate.getForEntity(uriBuilder.toString(), requestEntity); - LOGGER.info("Index mapping already present in the system :: {}", response.getStatusCode()); - } catch (HttpClientErrorException e) { - StringBuilder urlBuilder = new StringBuilder(indexerServiceHost.concat(dssCollectiontargetIndexName)); - InputStream in = this.getClass().getResourceAsStream(dssCollectionMappingPath); - String req = IOUtils.toString(in, "UTF-8"); - requestEntity = new HttpEntity<>(req, headers); - - LOGGER.info("create url:"+urlBuilder.toString()); - LOGGER.info("create requestEntity: "+ requestEntity.toString()); - restTemplate.put(urlBuilder.toString(), requestEntity); - LOGGER.info("Index mapping created for DSS Payment in the system"); - } - } - - /** - * Helper Method to create the Base64Value for headers - * - * @param userName - * @param password - * @return - */ - private String getBase64Value(String userName, String password) { - String authString = String.format("%s:%s", userName, password); - byte[] encodedAuthString = Base64.encodeBase64(authString.getBytes(Charset.forName(US_ASCII))); - return String.format(BASIC_AUTH, new String(encodedAuthString)); - } - - - public ResponseEntity post(String index, String type, String id, String authToken, String requestNode) { - - StringBuilder uriBuilder = new StringBuilder(indexerServiceHost.concat(index).concat(SLASH_SEPERATOR).concat(type).concat(SLASH_SEPERATOR).concat(id)); - HttpHeaders headers = new HttpHeaders(); - if(authToken != null && !authToken.isEmpty()) - headers.add("Authorization", "Bearer "+ authToken ); - headers.setContentType(MediaType.APPLICATION_JSON); - - HttpEntity requestEntity = null; - if(requestNode != null ) requestEntity = new HttpEntity<>(requestNode, headers); - else requestEntity = new HttpEntity<>("{}", headers); - - ResponseEntity response = new ResponseEntity(HttpStatus.OK); - - try { - response = retryTemplate.postForEntity(uriBuilder.toString(), requestEntity); - //restTemplate.postForEntity(uri,requestEntity); - LOGGER.info("RestTemplate response status :: {}", response.getStatusCode()); - - } catch (HttpClientErrorException e) { - response = new ResponseEntity(e.getStatusCode()); - LOGGER.error("post client exception: " + e.getMessage()); - } - return response; - } - - @Override - public JsonNode search(String index, ObjectNode searchQuery) throws IOException { - SearchRequest searchRequest = buildSearchRequest(index, searchQuery); - SearchResponse searchResponse = getClient(index, indexServiceHost, 9200, schema).search(searchRequest, - RequestOptions.DEFAULT); - - ArrayNode resultArray = JsonNodeFactory.instance.arrayNode(); - for (SearchHit hit : searchResponse.getHits()) { - JsonNode node = new ObjectMapper().readValue(hit.getSourceAsString(), JsonNode.class); - resultArray.add(node); - } - return resultArray; - } - - @Override - public Map search(String index, String searchQuery) throws Exception { - - String url = indexServiceHost + index + indexServiceHostSearch; - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - - LOGGER.info("searching ES for query::" + searchQuery + "::on::" + index + "::ON URL::" + url); - - HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); - - try { - ResponseEntity response = retryTemplate.postForEntity(url,requestEntity); - - Map responseNode = new ObjectMapper().convertValue(response.getBody(), Map.class); - Map hits = (Map)responseNode.get("hits"); - if((Integer)hits.get("total") >=1) - return (Map)((ArrayList)hits.get("hits")).get(0); - - } catch (HttpClientErrorException e) { - e.printStackTrace(); - LOGGER.error("client error while searching ES : " + e.getMessage()); - - } - return null; - } - - @Override - public Boolean push(Map requestBody) throws Exception { - - Object id = requestBody.get(Constants.IDENTIFIER); - Object trxid = ((Map)requestBody.get(Constants.DATA_OBJECT)).get(Constants.TRANSACTION_ID); - LOGGER.info("request body on ### trxid " +trxid); - //Object dataObjectId = ((Map)requestBody.get(Constants.DATA_OBJECT)).get("id"); - - - - String docId = id!=null ? id.toString(): trxid.toString(); - StringBuilder url = new StringBuilder().append(indexerServiceHost).append(collectionIndexName).append(SLASH_SEPERATOR).append(DOC_PATH).append(SLASH_SEPERATOR).append(docId); - LOGGER.info("url ## " +url); - - - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - - LOGGER.info("Posting request to ES on ::" + collectionIndexName + " with doc id:: "+docId); - - JsonNode request = new ObjectMapper().convertValue(requestBody, JsonNode.class); - //LOGGER.info(" new request body json ### " +request); - - HttpEntity requestEntity = new HttpEntity<>(request.toString(), headers); - ArrayNode hitNodes = null; - - try { - ResponseEntity response = retryTemplate.postForEntity(url.toString(), requestEntity); - LOGGER.info("Status code on pushing to collection index : {}", response.getStatusCode()); - if (response.getStatusCode().value() == HttpStatus.CREATED.value()) - return Boolean.TRUE; - - } catch (HttpClientErrorException e) { - //e.printStackTrace(); - - //caughtFailedRequests.put(dataObjectId.toString(), request); - LOGGER.error("client error while pushing ES collection index : {}, {}" ,e.getMessage(), requestEntity.getBody()); - - } - return Boolean.FALSE; - } - - @Override - public Boolean push(TargetData requestBody) throws Exception { - - Long currentDateTime = new Date().getTime(); - String url = indexerServiceHost + targetIndexName + DOC_TYPE + requestBody.getId(); - - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - - LOGGER.info("Posting request to ES on ## " + targetIndexName); - LOGGER.info("request body on ### " +requestBody); - - JsonNode request = new ObjectMapper().convertValue(requestBody, JsonNode.class); - - HttpEntity requestEntity = new HttpEntity<>(request.toString(), headers); - ArrayNode hitNodes = null; - - try { - ResponseEntity response = retryTemplate.postForEntity(url, requestEntity); - - //ResponseEntity response = restTemplate.exchange(url, HttpMethod.PUT, requestEntity, Object.class); - LOGGER.info("Status code on pushing to target index : " + response.getStatusCode()); - if (response.getStatusCode().value() == 201) - return Boolean.TRUE; - - } catch (HttpClientErrorException e) { - e.printStackTrace(); - LOGGER.error("client error while pushing ES target index : " + e.getMessage()); - - } - return Boolean.FALSE; - } - - @Override - public Boolean searchIndex(String index, String searchQuery, String dataContextVersion) throws Exception { - LOGGER.info("searching ES for query: " + searchQuery + " on " + index); - - Map scrollSearchParams = getScrollIdForScrollSearch(index, dataContextVersion); - LOGGER.info("scrollSearchParams.get(Constants.DataContexts.CONTEXT):: "+scrollSearchParams.get(Constants.DataContexts.CONTEXT)); - - if(scrollSearchParams == null) { - return Boolean.FALSE; - } - new Thread(new Runnable() { - public void run(){ - Map> documentMap = new HashMap<>(); - int docFetchSize = 1; - int totalDocFetchedSize = 0; - int totalDocInIndex = 900000; - - while(docFetchSize > 0 && totalDocFetchedSize < totalDocInIndex) { - documentMap = performScrollSearch(scrollSearchParams); - List listOfDocs = documentMap.get("hits"); - docFetchSize = listOfDocs.size(); - totalDocFetchedSize = docFetchSize + totalDocFetchedSize; - for (Map.Entry> entry : documentMap.entrySet()) { - - for (int i = 0; i < entry.getValue().size(); i++) { - Map innerMap = (Map) entry.getValue().get(i); - Gson gson = new Gson(); - String json = gson.toJson(innerMap.get("_source")); - ObjectMapper mapper = new ObjectMapper(); - JsonNode dataNode = null; - try { - dataNode = mapper.readTree(json); - } catch (IOException e) { - LOGGER.error("Encountered an exception while reading the JSON Node on Thread : " + e.getMessage()); - } - JsonNode dataObjectNode = null; - if(dataNode != null && dataNode.get("Data") == null) { - dataObjectNode = dataNode; - } else { - dataObjectNode= dataNode.get("Data"); - } - Map dataMap = new Gson().fromJson(dataObjectNode.toString(), new TypeToken>() {}.getType() - ); - ingestService.ingestToPipeline( - setIncomingData(scrollSearchParams.get(Constants.DataContexts.CONTEXT), dataContextVersion, dataObjectNode)); - } - } - } - } - }).start(); - - - return Boolean.TRUE; - } - - @Override - public List searchMultiple(String index, String searchQuery) throws Exception { - - String url = indexServiceHost + index + indexServiceHostSearch; - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - - LOGGER.info("searching searchMultiple ES for query::" + searchQuery + "::on::" + index + "::ON URL::" + url); - - HttpEntity requestEntity = new HttpEntity<>(searchQuery, headers); - - try { - ResponseEntity response = retryTemplate.postForEntity(url,requestEntity); - - Map responseNode = new ObjectMapper().convertValue(response.getBody(), Map.class); - Map hits = (Map)responseNode.get("hits"); - if((Integer)hits.get("total") >=1) - return (List) ((ArrayList)hits.get("hits")); - - } catch (HttpClientErrorException e) { - e.printStackTrace(); - LOGGER.error("client error while searchMultiple searching ES : " + e.getMessage()); - - } - return null; - } - - private IncomingData setIncomingData(String index, String version, Object documentValue) { - IncomingData incomingData = new IncomingData(); - incomingData.setDataContext(index); - incomingData.setDataContextVersion(version); - incomingData.setDataObject(documentValue); - return incomingData; - } - - private Map performScrollSearch(Map scrollSearchParams) { - Map> hitsToMap = new LinkedHashMap(); - try { - Map hits = new LinkedHashMap(); - HttpEntity requestEntity = new HttpEntity<>(scrollSearchParams.get(Constants.ScrollSearch.QUERY), getHttpHeaders()); - ResponseEntity response = restTemplate.exchange(scrollSearchParams.get(Constants.ScrollSearch.SEARCH_PATH), HttpMethod.POST, requestEntity, - Object.class); - Map responseNode = new ObjectMapper().convertValue(response.getBody(), Map.class); - hits = (Map) responseNode.get("hits"); - if ((Integer) hits.get("total") >= 1) { - hitsToMap.put("hits", ((ArrayList) hits.get("hits"))); - return hitsToMap; - } - } catch (HttpClientErrorException e) { - LOGGER.error("client error while searching ES : " + e.getMessage()); - } - return hitsToMap; - } - - private Map getScrollIdForScrollSearch(String index, String dataContextVersion) { - Map scrollSearchParams = new HashMap<>(); - String queryString = null; - if (index.equals(Constants.ES_INDEX_COLLECTION)) { - queryString = getSearchQueryCollection(); - scrollSearchParams.put(Constants.DataContexts.CONTEXT, Constants.DataContexts.COLLECTION); - } else if (index.equals(Constants.ES_INDEX_BILLING)) { - queryString = getSearchQueryBilling(); - scrollSearchParams.put(Constants.DataContexts.CONTEXT, Constants.DataContexts.BILLING); - } else if (index.equals(Constants.ES_INDEX_PAYMENT)) { - queryString = getSearchQueryPayment(); - scrollSearchParams.put(Constants.DataContexts.CONTEXT, Constants.DataContexts.COLLECTION); - } else { - return null; - } - String scrollUrl = indexServiceHost + index + indexServiceHostSearch + "?scroll=1m"; - HttpEntity requestEntity = new HttpEntity<>(queryString, getHttpHeaders()); - String str = null; - try { - LOGGER.info("Request Body for Scroll Search : "+requestEntity); - ResponseEntity response = restTemplate.exchange(scrollUrl, HttpMethod.POST, requestEntity, - Object.class); - Map responseNode = new ObjectMapper().convertValue(response.getBody(), Map.class); - - Map> hitsToMap = new LinkedHashMap(); - Map hits = new LinkedHashMap(); - hits = (Map) responseNode.get("hits"); - if ((Integer) hits.get("total") >= 1) { - hitsToMap.put("hits", ((ArrayList) hits.get("hits"))); - } - - for (Entry> entry : hitsToMap.entrySet()) { - - for (int i = 0; i < entry.getValue().size(); i++) { - Map innerMap = (Map) entry.getValue().get(i); - Gson gson = new Gson(); - String json = gson.toJson(innerMap.get("_source")); - ObjectMapper mapper = new ObjectMapper(); - JsonNode dataNode = null; - try { - dataNode = mapper.readTree(json); - } catch (IOException e) { - LOGGER.error("Encountered an exception while reading the JSON Node on Thread : " + e.getMessage()); - } - JsonNode dataObjectNode = null; - if(dataNode != null && dataNode.get("Data") == null) { - dataObjectNode = dataNode; - } else { - dataObjectNode= dataNode.get("Data"); - } - Map dataMap = new Gson().fromJson(dataObjectNode.toString(), new TypeToken>() {}.getType() - ); - ingestService.ingestToPipeline( - setIncomingData(scrollSearchParams.get(Constants.DataContexts.CONTEXT), dataContextVersion, dataObjectNode)); - } - } - str = indexServiceHostSearch.replaceAll("[/]", ""); - scrollSearchParams.put(Constants.ScrollSearch.SCROLL_ID, (String) responseNode.get(Constants.ScrollSearch.SCROLL_ID_PARAMS)); - scrollSearchParams.put(Constants.ScrollSearch.SEARCH_PATH, indexServiceHost + str + "/" + "scroll"); - String queryForScrollId = Constants.ScrollSearch.SCROLL_SEARCH_DEFAULT_QUERY + "\"" + scrollSearchParams.get(Constants.ScrollSearch.SCROLL_ID) + "\"" + "}"; - scrollSearchParams.put(Constants.ScrollSearch.QUERY, queryForScrollId); - } catch (HttpClientErrorException e) { - LOGGER.error("client error while searching ES : " + e.getMessage()); - } - return scrollSearchParams; - } - - - - private HttpHeaders getHttpHeaders() { - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - return headers; - } - - -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/EnrichTransform.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/EnrichTransform.java deleted file mode 100644 index cbcc4641ccd..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/EnrichTransform.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.ingestpipeline.service; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bazaarvoice.jolt.Chainr; -import com.bazaarvoice.jolt.JsonUtils; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ingestpipeline.util.ConfigLoader; - -@Service -public class EnrichTransform { - - public static final Logger LOGGER = LoggerFactory.getLogger(EnrichTransform.class); - - @Autowired - private TransformService transformService; - - @Autowired - private ConfigLoader configLoader; - - private static final String SEPARATOR = "_"; - private static final String JSON_EXTENSION = ".json"; - private static final String OBJECTIVE = "transform"; - private static final String CONFIGROOT = "config/"; - private static final String VERSION = "v1"; - private static final String ENHANCE = "enhance"; - - - - /** - * Tranforms domain raw response from elastic search - * This transformation is specific to domain objects - * - * @param rawResponseNode - * @param businessService - * @return - */ - public Object transform (Map rawResponseNode, String businessService) throws IOException { - - ObjectMapper mapper = new ObjectMapper(); - List chainrSpecJSON = null ; - Object transNode = null; - try { - chainrSpecJSON = mapper.readValue(configLoader.get(OBJECTIVE.concat(SEPARATOR).concat(businessService.toLowerCase()).concat(SEPARATOR).concat(VERSION).concat(JSON_EXTENSION)), List.class); - LOGGER.info("ChainrSpecJSON::" + chainrSpecJSON); - Chainr chainr = Chainr.fromSpec( chainrSpecJSON ); - - Object indexData = rawResponseNode.keySet().contains("_source") ? ((Map)rawResponseNode.get("_source")).get("Data") : null; - transNode = indexData!= null ? chainr.transform(indexData) : null; - - } catch (Exception e) { - LOGGER.error("Encountered an error : businessService {} ", e.getMessage()); - } - - return transNode; - - } - - - /** - * Tranforms domain raw response from elastic search - * This transformation is specific to domain objects - * - * @param rawResponseNode - * @param businessService - * @return - */ - public Object transformEnhanceData (List rawResponseList, String businessService) throws IOException { - - ObjectMapper mapper = new ObjectMapper(); - List chainrSpecJSON = null ; - Object transNode = null; - List response = new ArrayList(); - - try { - chainrSpecJSON = mapper.readValue(configLoader.get(OBJECTIVE.concat(SEPARATOR).concat(businessService.toLowerCase()).concat(SEPARATOR).concat(ENHANCE).concat(SEPARATOR).concat(VERSION).concat(JSON_EXTENSION)), List.class); - LOGGER.info("ChainrSpecJSON::" + chainrSpecJSON); - Chainr chainr = Chainr.fromSpec( chainrSpecJSON ); - - for (Object object : rawResponseList) { - if(object instanceof Map) { - Map rawResponseNode = (Map) object; - Object indexData = rawResponseNode.keySet().contains("_source") ? ((Map)rawResponseNode.get("_source")).get("Data") : null; - transNode = indexData!= null ? chainr.transform(indexData) : null; - response.add(transNode); - } - - } - - } catch (Exception e) { - LOGGER.error("Encountered in transformEnhanceData with an error : businessService {} ", e.getMessage()); - } - - return response; - - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/EnrichmentService.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/EnrichmentService.java deleted file mode 100644 index 6f14ff224a7..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/EnrichmentService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ingestpipeline.service; - -import org.springframework.stereotype.Service; - -import com.ingestpipeline.model.IncomingData; - -import java.util.Map; - -@Service -public interface EnrichmentService { - - Map enrichData(Map incomingData); - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/EnrichmentServiceImpl.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/EnrichmentServiceImpl.java deleted file mode 100644 index 9f42ce8a1b4..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/EnrichmentServiceImpl.java +++ /dev/null @@ -1,323 +0,0 @@ -package com.ingestpipeline.service; - -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.ingestpipeline.model.SourceReferences; -import com.ingestpipeline.model.TargetReferences; -import org.apache.tomcat.util.codec.binary.Base64; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.hash.Hashing; -import com.ingestpipeline.config.DomainConfig; -import com.ingestpipeline.config.DomainConfigFactory; -import com.ingestpipeline.configfactory.CollectionDomainConfig; -import com.ingestpipeline.configfactory.EnhanceDomainConfig; -import com.ingestpipeline.model.DomainIndexConfig; -import com.ingestpipeline.model.TargetData; -import com.ingestpipeline.repository.ElasticSearchRepository; -import com.ingestpipeline.repository.TargetDataDao; -import com.ingestpipeline.util.Constants; -import com.ingestpipeline.util.JSONUtil; - -/** - * This is a Service Implementation for all the actions which are with respect - * to Elastic Search - * - * @author Darshan Nagesh - * - */ -@Service(Constants.Qualifiers.ENRICHMENT_SERVICE) -public class EnrichmentServiceImpl implements EnrichmentService { - - public static final Logger LOGGER = LoggerFactory.getLogger(EnrichmentServiceImpl.class); - private static final String SEPARATOR = "_"; - private static final String JSON_EXTENSION = ".json"; - private static final String OBJECTIVE = "enrichment"; - private final String indexServiceHost; - private final String userName; - private final String password; - private final String elasticSearchIndexName; - private final String elasticSearchDocumentType; - - private static final String AUTHORIZATION = "Authorization"; - private static final String US_ASCII = "US-ASCII"; - private static final String BASIC_AUTH = "Basic %s"; - - private static final String BUSINESS_SERVICE = "businessService"; - private static final String DATA_OBJECT = "dataObject"; - private static final String DATA_CONTEXT = "dataContext"; - private static final String DATA_ENHANCEMENT = "dataEnhancement"; - private static final String TENANTID = "tenantId"; - private static final String MCOLLECT = "MCOLLECT"; - - @Autowired - private ElasticSearchRepository elasticRepository; - - @Autowired - private CollectionDomainConfig collectionDomainConfig; - - @Autowired - private DomainConfigFactory domainConfigFactory; - - @Autowired - private IESService elasticService; - - @Autowired - private TargetDataDao targetDataDao; - - @Autowired - private EnrichTransform enrichTransform; - - @Autowired - private JSONUtil util; - - public EnrichmentServiceImpl(@Value("${services.esindexer.host}") String indexServiceHost, - @Value("${services.esindexer.username}") String userName, - @Value("${services.esindexer.password}") String password, - @Value("${es.index.name}") String elasticSearchIndexName, - @Value("${es.document.type}") String elasticSearchDocumentType, JSONUtil util) { - this.indexServiceHost = indexServiceHost; - this.userName = userName; - this.password = password; - this.elasticSearchIndexName = elasticSearchIndexName; - this.elasticSearchDocumentType = elasticSearchDocumentType; - this.util=util; - } - - @Override - public Map enrichData(Map incomingData) { - - Map dataObject = new ObjectMapper().convertValue(incomingData.get(DATA_OBJECT), Map.class); - String tenantId = dataObject.get(TENANTID).toString(); - - List mCollectCategories = util.fetchMCollectCategories(tenantId); - - DomainConfig domainConfig = domainConfigFactory.getConfiguration(incomingData.get(DATA_CONTEXT).toString()); - LOGGER.info("domainConfig ## "+domainConfig); - - if(domainConfig instanceof CollectionDomainConfig) { - // prepare the query required based on incoming data businessType - ObjectNode incomingNode = new ObjectMapper().convertValue(incomingData.get(DATA_OBJECT), ObjectNode.class); - ObjectNode copyNode = incomingNode.deepCopy(); - String businessTypeVal = copyNode.findValue(BUSINESS_SERVICE).asText(); - - for(String category : mCollectCategories) { - if(category.equalsIgnoreCase(businessTypeVal)) { - businessTypeVal = MCOLLECT; - break; - } - } - - DomainIndexConfig indexConfig = domainConfig.getIndexConfig(businessTypeVal.toString()); - LOGGER.info("indexConfig ## "+indexConfig); - if(indexConfig != null){ - String indexName = indexConfig.getIndexName(); - - String query = indexConfig.getQuery(); - - try { - ObjectNode queryNode = new ObjectMapper().readValue(query, ObjectNode.class); - - Map expValMap = new HashMap<>(); - // Source references to be prepare a map of fieldName & value - for (SourceReferences ref : indexConfig.getSourceReferences()){ - String arg = ref.getFieldName(); - String argVal = copyNode.findValue(arg).asText(); - String[] values = argVal.split(ref.getSeperator()); - - String[] exps = ref.getExpression().split(ref.getSeperator()); - - for(int i=0; i { - TargetData targetData = new ObjectMapper().convertValue(val, TargetData.class); - String hashId = targetData.getFinancialYear() + "-" + targetData.getBusinessService()+"-"+targetData.getUlbName(); - hashId = hashId.replaceAll("(\\s)+", ""); - String sha256hex = Hashing.sha256().hashString(hashId, StandardCharsets.UTF_8).toString(); - targetData.setId(sha256hex.hashCode()); - //targetData.setId(hashId); - try{ - elasticService.push(targetData); - }catch (Exception e ){ - LOGGER.error("Exception occurred while pushing data to ES: " + e.getMessage()); - } - - }); - } - - return incomingData; - } - - private Boolean pushToElasticSearchIndex(Object object) { - Long currentDateTime = new Date().getTime(); - String url = String.format("%s%s/%s/%s", this.indexServiceHost, elasticSearchIndexName, - elasticSearchDocumentType, currentDateTime); - HttpHeaders headers = getHttpHeaders(); - LOGGER.info("Data Object to be added to ES : " + object); - LOGGER.info("URL to invoke : " + url); - elasticRepository.saveMyDataObject(object, url, headers); - return Boolean.TRUE; - } - - /** - * A helper method to create the headers for Rest Connection with UserName and - * Password - * - * @return HttpHeaders - */ - private HttpHeaders getHttpHeaders() { - HttpHeaders headers = new HttpHeaders(); - headers.add(AUTHORIZATION, getBase64Value(userName, password)); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - headers.setContentType(MediaType.APPLICATION_JSON); - return headers; - } - - /** - * Helper Method to create the Base64Value for headers - * - * @param userName - * @param password - * @return - */ - private String getBase64Value(String userName, String password) { - String authString = String.format("%s:%s", userName, password); - byte[] encodedAuthString = Base64.encodeBase64(authString.getBytes(Charset.forName(US_ASCII))); - return String.format(BASIC_AUTH, new String(encodedAuthString)); - } - - /** - * This method used to add the external index data into the es index - * - * @param incomingData - * @return - */ - private Map enhanceData(Map incomingData) { - DomainConfig domainConfig = domainConfigFactory.getConfiguration(DATA_ENHANCEMENT); - LOGGER.info("enhanceDomainConfig ## "+domainConfig); - - if(domainConfig instanceof EnhanceDomainConfig ) { - // prepare the query required based on incoming data businessType - ObjectNode incomingNode = new ObjectMapper().convertValue(incomingData.get(DATA_OBJECT), ObjectNode.class); - ObjectNode copyNode = incomingNode.deepCopy(); - String businessTypeVal = copyNode.findValue(BUSINESS_SERVICE).asText(); - - DomainIndexConfig indexConfig = domainConfig.getIndexConfig(businessTypeVal.toString()); - LOGGER.info("indexConfig ## "+indexConfig); - if(indexConfig != null){ - String indexName = indexConfig.getIndexName(); - String query = indexConfig.getQuery(); - - - try { - ObjectNode queryNode = new ObjectMapper().readValue(query, ObjectNode.class); - LOGGER.info("queryNode 114 ## "+queryNode.toString()); - - Map expValMap = new HashMap<>(); - // Source references to be prepare a map of fieldName & value - for (SourceReferences ref : indexConfig.getSourceReferences()){ - String arg = ref.getFieldName(); - LOGGER.info("arg350## " + arg); - String argVal = copyNode.findValue(arg).asText(); - String[] values = argVal.split(ref.getSeperator()); - String[] exps = ref.getExpression().split(ref.getSeperator()); - - for(int i=0; i post(String index, String type, String id, String authToken, String requestNode); - - /** - * Holds client for each indices. - */ - static Map esClient = new HashMap(); - static final String INVALID_QUERY_ERROR ="invalid query: must be boolean, match_phrase "; - - /** searches documents from ES based on query using RestHighLevelClient - * @param index - ElasticSearch Index - * @param searchQuery - which contains details for search - * @return - */ - JsonNode search(String index, ObjectNode searchQuery) throws IOException; - - Boolean push(TargetData requestBody) throws Exception; - - /** - * searches documents from ES based on query using restTemplate - * @param index - * @param query - * @return - * @throws Exception - */ - Map search(String index, String query) throws Exception; - - List searchMultiple(String index, String query) throws Exception; - Boolean push(Map requestBody) throws Exception; - - - /** - * Translates a string query to SearchRequest - * valid query string has bool type query - * @param queryNode - * @return - */ - default SearchRequest buildSearchRequest(String index, ObjectNode queryNode) throws IOException{ - final BoolQueryBuilder query = QueryBuilders.boolQuery(); - - ArrayNode mustNodeArr = (ArrayNode) queryNode.get("query").get("bool").get("must"); - if(null == mustNodeArr) - throw new IllegalArgumentException(INVALID_QUERY_ERROR); - - mustNodeArr.elements().forEachRemaining(mustNode -> { - mustNode.fields().forEachRemaining(entry -> { - if(entry.getKey().equalsIgnoreCase("match_phrase") && entry.getValue().isObject()){ - JsonNode node = entry.getValue(); - Map.Entry dataNode = node.fields().next(); - query.must(QueryBuilders.matchPhraseQuery(dataNode.getKey(), dataNode.getValue().textValue())); - } - }); - - }); - return new SearchRequest(index).source(new SearchSourceBuilder().query(query)); - } - - /** - * - * @param indexName - * @param hostName - * @param port - * @param schema - * @return - */ - default RestHighLevelClient getClient(String indexName, String hostName, Integer port, String schema){ - RestHighLevelClient client = esClient.get(indexName); - if(null == client){ - client = new RestHighLevelClient(RestClient.builder(new HttpHost(hostName, port, schema))); - esClient.put(indexName, client); - } - return client; - } - - /*default boolean isIndexExists(String indexName) { - Response response; - try { - response = getClient(indexName).getLowLevelClient().performRequest(new Request("HEAD", "/" + indexName)); - return (200 == response.getStatusLine().getStatusCode()); - } catch (IOException e) { - return false; - } - - }*/ - - default boolean createIndex(String indexName){ - //TODO - return Boolean.TRUE; - } - - Boolean searchIndex(String index, String query, String dataContextVersion) throws Exception; -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/IngestService.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/IngestService.java deleted file mode 100644 index 1dc0a4355f8..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/IngestService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ingestpipeline.service; - -import org.springframework.stereotype.Service; - -import com.ingestpipeline.model.IncomingData; - -@Service -public interface IngestService { - - static final String TOPIC_CONTEXT_CONFIG = "TopicContextConfiguration.json"; - Boolean ingestToPipeline(Object incomingData); - IncomingData getContextForIncomingTopic(String topicName) ; - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/IngestServiceImpl.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/IngestServiceImpl.java deleted file mode 100644 index 3f9f6cda13d..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/IngestServiceImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.ingestpipeline.service; - -import com.ingestpipeline.model.TopicContextConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ingestpipeline.model.ErrorWrapper; -import com.ingestpipeline.model.IncomingData; -import com.ingestpipeline.model.TopicContext; -import com.ingestpipeline.producer.IngestProducer; -import com.ingestpipeline.util.ApplicationProperties; -import com.ingestpipeline.util.ConfigLoader; -import com.ingestpipeline.util.Constants; - -import java.util.HashMap; -import java.util.Map; - -/** - * This is a Service Implementation for all the actions which are with respect to Elastic Search - * @author Darshan Nagesh - * - */ -@Service(Constants.Qualifiers.INGEST_SERVICE) -public class IngestServiceImpl implements IngestService { - - public static final Logger LOGGER = LoggerFactory.getLogger(IngestServiceImpl.class); - public static final String INTENT = "INGEST"; - - @Autowired - private IngestProducer ingestProducer; - - @Autowired - private ApplicationProperties applicationProperties; - - @Autowired - private ConfigLoader configLoader; - - @Autowired - private DigressService digressService; - - @Autowired - private ObjectMapper mapper; - - @Value("${kafka.topic.error.data}") - String errorTopic; - - private Map topicContextMap = new HashMap<>(); - public void loadTopicsConfig(){ - TopicContextConfig topicContextConf = null; - try { - topicContextConf = mapper.readValue(configLoader.get(TOPIC_CONTEXT_CONFIG), TopicContextConfig.class); - for (TopicContext topicCxt : topicContextConf.getTopicContexts()){ - - topicContextMap.put(topicCxt.getTopic(), topicCxt); - } - LOGGER.info("topicContexts ## "+topicContextMap); - - } catch (Exception e) { - LOGGER.error("Encountered an error while reading Topic to Context Configuration" + e.getMessage()); - } - } - - @Override - public Boolean ingestToPipeline(Object incomingData) { - LOGGER.info("Fetching the Incoming Data Config for the data received"); - String topic = ""; - String key = ""; - try { - if (applicationProperties.getPipelineRules().get(Constants.PipelineRules.VALIDATE_DATA)) { - topic = applicationProperties.getTransactionIngestTopic(); - key = applicationProperties.getTransactionIngestKey(); - } else if (applicationProperties.getPipelineRules().get(Constants.PipelineRules.TRANSFORM_DATA)) { - topic = applicationProperties.getTransactionValidationTopic(); - key = applicationProperties.getTransactionValidationKey(); - } else if (applicationProperties.getPipelineRules().get(Constants.PipelineRules.ENRICH_DATA)) { - topic = applicationProperties.getTransactionTransformationTopic(); - key = applicationProperties.getTransactionTransformationKey(); - } - } catch (Exception e) { - LOGGER.error("Encountered an Exception while Pushing the Data to pipeline on Ingest Service " + e.getMessage()); - ErrorWrapper errorWrapper = errorHandover(incomingData); - ingestProducer.pushToPipeline(errorWrapper, errorTopic, null); - } - ingestProducer.pushToPipeline(incomingData, topic, null); - return true; - } - - private ErrorWrapper errorHandover(Object incomingData) { - ErrorWrapper errorWrapper = new ErrorWrapper(); - errorWrapper.setErrorCode(INTENT); - errorWrapper.setErrorMessage(Constants.ErrorMessages.errorCodeMessageMap.get(INTENT)); - errorWrapper.setIncomingData(incomingData); - return errorWrapper; - } - - @Override - public IncomingData getContextForIncomingTopic(String topicName) { - ObjectMapper mapper = new ObjectMapper(); - TopicContext topicContext = null; - IncomingData incomingData = null; -/* try { - topicContext = mapper.readValue(configLoader.get(TOPIC_CONTEXT_CONFIG), TopicContext.class); - } catch (Exception e) { - LOGGER.error("Encountered an error while reading Topic to Context Configuration" + e.getMessage()); - }*/ - if(topicContextMap.size()>0 ) { - incomingData = new IncomingData(); - TopicContext topicCxt = topicContextMap.get(topicName); - incomingData.setDataContext(topicCxt.getDataContext()); - incomingData.setDataContextVersion(topicCxt.getDataContextVersion()); - LOGGER.info("###Context Set##"); - } - return incomingData; - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/RetryTemplate.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/RetryTemplate.java deleted file mode 100644 index e42d532e289..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/RetryTemplate.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ingestpipeline.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.retry.annotation.Backoff; -import org.springframework.retry.annotation.Retryable; -import org.springframework.stereotype.Component; -import org.springframework.web.client.ResourceAccessException; -import org.springframework.web.client.RestTemplate; - -import javax.naming.ServiceUnavailableException; - -/** - * Wraps rest template with retry - */ -@Component -public class RetryTemplate { - - @Autowired - private RestTemplate restTemplate; - - @Retryable(value = {RuntimeException.class, ResourceAccessException.class, ServiceUnavailableException.class}, - maxAttemptsExpression = "#{${service.retry.maxAttempts}}", - backoff = @Backoff(delayExpression = "#{${service.retry.backoff.delay}}")) - public ResponseEntity postForEntity(String url, Object request) { - return restTemplate.postForEntity(url, request, Object.class); - } - - @Retryable(value = {RuntimeException.class, ResourceAccessException.class, ServiceUnavailableException.class}, - maxAttemptsExpression = "#{${service.retry.maxAttempts}}", - backoff = @Backoff(delayExpression = "#{${service.retry.backoff.delay}}")) - public ResponseEntity getForEntity(String url, HttpEntity headerEntity) { - return restTemplate.exchange(url, HttpMethod.GET, headerEntity, Object.class); - } - -} - diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/TransformService.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/TransformService.java deleted file mode 100644 index 84781d8066f..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/TransformService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ingestpipeline.service; - -import org.springframework.stereotype.Service; - -import com.ingestpipeline.model.IncomingData; - -import java.util.Map; - -@Service -public interface TransformService { - - Boolean transformData(Map incomingData); - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/TransformServiceImpl.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/TransformServiceImpl.java deleted file mode 100644 index ba9dc34fb29..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/TransformServiceImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.ingestpipeline.service; - -import java.io.InputStream; -import java.util.List; -import java.util.Map; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.bazaarvoice.jolt.Chainr; -import com.bazaarvoice.jolt.JsonUtils; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.gson.Gson; -import com.ingestpipeline.model.DigressionPoint; -import com.ingestpipeline.util.ConfigLoader; -import com.ingestpipeline.util.Constants; - -/** - * This is a Service Implementation for all the actions which are with respect to Elastic Search - * @author Darshan Nagesh - * - */ -@Service(Constants.Qualifiers.TRANSFORM_SERVICE) -public class TransformServiceImpl implements TransformService { - - public static final Logger LOGGER = LoggerFactory.getLogger(TransformServiceImpl.class); - private static final String SEPARATOR = "_"; - private static final String JSON_EXTENSION = ".json"; - private static final String OBJECTIVE = "transform"; - private static final String CONFIGROOT = "config/"; - - @Autowired - private ConfigLoader configLoader; - - @Override - public Boolean transformData(Map incomingData) { - String dataContext = incomingData.get(Constants.DATA_CONTEXT).toString(); - String dataContextVersion = incomingData.get(Constants.DATA_CONTEXT_VERSION).toString(); - ObjectMapper mapper = new ObjectMapper(); - List chainrSpecJSON = null ; - InputStream inputStream = null; - try { - String sourceUrl = CONFIGROOT.concat(OBJECTIVE.concat(SEPARATOR).concat(dataContext).concat(SEPARATOR).concat(dataContextVersion).concat(JSON_EXTENSION)); - inputStream = this.getClass().getClassLoader().getResourceAsStream(sourceUrl); - chainrSpecJSON = JsonUtils.jsonToList(inputStream); - - } catch (Exception e) { - LOGGER.error("Encountered an error : " + e.getMessage()); - } - finally { - IOUtils.closeQuietly(inputStream); - } - - - /*Map deepRouteSpecSize = new HashMap<>(); - - Object dataObject = incomingData.get(Constants.DATA_OBJECT); - String digressConfig = configLoader.get(Constants.ConfigurationFileNames.DIGRESSION_POINTS); - Gson gson = new Gson(); - JsonNode mainNode = null; - try { - mainNode = mapper.readTree(gson.toJson(dataObject)); - } catch (Exception ex) { - LOGGER.error("Encountered an error while converting the data to JSON Node : " + ex.getMessage()); - } - ObjectNode objectNode = mainNode.deepCopy(); - DigressionPointConfig config = gson.fromJson(digressConfig, DigressionPointConfig.class); - if (config != null && config.getDigressionPoints() != null && config.getDigressionPoints().size() > 0) { - for (DigressionPoint point : config.getDigressionPoints()) { - if (incomingData.get(Constants.DATA_CONTEXT).equals(point.getDataContext())) { - List paths = point.getPaths(); - for(String path : paths) { - if(objectNode.findValue(path).isArray()) { - ArrayNode objectAtPathArray = (ArrayNode) objectNode.findValue(path); - int size = objectAtPathArray.size(); - deepRouteSpecSize.put(path, size); - } - } - - } - } - } - - - for(int i=0; i< chainrSpecJSON.size() ; i++) { - LinkedHashMap chainSpec = (LinkedHashMap) chainrSpecJSON.get(i); - for(Map.Entry entry : deepRouteSpecSize.entrySet()) { - String key = entry.getKey(); - int iterationsForKey = entry.getValue(); - for() - } - chainSpec.toString(); - }*/ - - - Chainr chainr = Chainr.fromSpec( chainrSpecJSON ); - Object inputJSON = incomingData.get(Constants.DATA_OBJECT); - try { - Object transformedOutput = chainr.transform( inputJSON ); - incomingData.put(Constants.DATA_OBJECT , transformedOutput); - return Boolean.TRUE; - } catch (Exception e) { - LOGGER.error("Encountered an error while tranforming the JSON : " + e.getMessage()); - return Boolean.FALSE; - } - } - - public Boolean digressData(Object dataObject, DigressionPoint digressionPoint) { - ObjectMapper mapper = new ObjectMapper(); - Gson gson = new Gson(); - JsonNode mainNode = null; - try { - mainNode = mapper.readTree(gson.toJson(dataObject)); - } catch (Exception ex) { - LOGGER.error("Encountered an error while converting the data to JSON Node : " + ex.getMessage()); - } - return null; - } -} - \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/ValidationService.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/ValidationService.java deleted file mode 100644 index d06e5cde22a..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/ValidationService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ingestpipeline.service; - -import org.springframework.stereotype.Service; - -import com.ingestpipeline.model.IncomingData; - -import java.util.Map; - -@Service -public interface ValidationService { - - Boolean validateData(Map incomingData); - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/ValidationServiceImpl.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/ValidationServiceImpl.java deleted file mode 100644 index e211230ea75..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/service/ValidationServiceImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.ingestpipeline.service; - -import java.util.HashMap; -import java.util.Map; - -import org.everit.json.schema.Schema; -import org.everit.json.schema.ValidationException; -import org.everit.json.schema.loader.SchemaLoader; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.google.gson.GsonBuilder; -import com.ingestpipeline.util.Constants; - -/** - * This is a Service Implementation for all the actions which are with respect to Elastic Search - * @author Darshan Nagesh - * - */ -@Service(Constants.Qualifiers.VALIDATOR_SERVICE) -public class ValidationServiceImpl implements ValidationService { - - public static final Logger LOGGER = LoggerFactory.getLogger(ValidationServiceImpl.class); - private static final String OBJECTIVE = "validator"; - private static final String SEPARATOR = "_"; - private static final String JSON_EXTENSION = ".json"; - private static final String CONFIGROOT = "config/"; - private static Map schemaCache = new HashMap<>(); - - @Override - public Boolean validateData(Map incomingData) { - - //JSONObject jsonSubject = new JSONObject(new GsonBuilder().create().toJson(incomingData.getDataObject())); - JSONObject jsonSubject = new JSONObject(new GsonBuilder().create().toJson(incomingData.get("dataObject"))); - - try { - //getSchema(OBJECTIVE.concat(SEPARATOR).concat(incomingData.getDataContext()).concat(SEPARATOR).concat(incomingData.getDataContextVersion()) - getSchema(OBJECTIVE.concat(SEPARATOR).concat(incomingData.get("dataContext").toString()).concat(SEPARATOR).concat(incomingData.get("dataContextVersion").toString()) - .concat(JSON_EXTENSION)).validate(jsonSubject); - } catch (ValidationException ve) { - LOGGER.info("Validation Exception : " + ve.getMessage()); - return Boolean.FALSE; - } catch (Exception e) { - LOGGER.info("Validation Exception : " + e); - return Boolean.FALSE; - } - return Boolean.TRUE; - } - - private Schema getSchema(String location) { - Schema schema = schemaCache.get(location); - if (schema == null) { - try { - schema = loadSchema(location); - schemaCache.put(location, schema); - } catch(Exception e) { - LOGGER.error("Encountered an Exception while loading Schema : " + e.getMessage()); - } - } - return schema; - } - - private Schema loadSchema(String location) { - JSONObject jsonSchema = new JSONObject( - new JSONTokener(ClassLoader.getSystemClassLoader().getResourceAsStream(CONFIGROOT + location))); - return SchemaLoader.load(jsonSchema); - } - -} - \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ApplicationProperties.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ApplicationProperties.java deleted file mode 100644 index 4ef134419a3..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ApplicationProperties.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.ingestpipeline.util; - -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.annotation.Order; -import org.springframework.core.env.Environment; - -@Configuration -@PropertySource(value = { "classpath:config/config.properties" }, ignoreResourceNotFound = true) -@Order(0) -public class ApplicationProperties { - - @Value("${kafka.transaction.ingest.topic}") - private String transactionIngestTopic; - - @Value("${kafka.transaction.ingest.key}") - private String transactionIngestKey; - - @Value("${kafka.transaction.validation.topic}") - private String transactionValidationTopic; - - @Value("${kafka.transaction.validation.key}") - private String transactionValidationKey; - - @Value("${kafka.transaction.transformation.topic}") - private String transactionTransformationTopic; - - @Value("${kafka.transaction.transformation.key}") - private String transactionTransformationKey; - - @Value("${schema.transaction.validation}") - private String transactionValidationSchema; - - @Value("${schema.transaction.transformation}") - private String transactionTransformSchema; - - @Value("${schema.transaction.enrichment}") - private String transactionEnrichmentSchema; - - @Value("${transformation.config.location}") - private static String transformationConfigLocations; - - @Value("#{${pipelinerules}}") - private Map pipelineRules; - - @Autowired - private Environment environment; - - public static String getTransformationConfigLocations() { - return transformationConfigLocations; - } - - public static void setTransformationConfigLocations(String transformationConfigLocations) { - ApplicationProperties.transformationConfigLocations = transformationConfigLocations; - } - - public String getTransactionValidationSchema() { - return transactionValidationSchema; - } - - public void setTransactionValidationSchema(String transactionValidationSchema) { - this.transactionValidationSchema = transactionValidationSchema; - } - - public String getTransactionTransformSchema() { - return transactionTransformSchema; - } - - public void setTransactionTransformSchema(String transactionTransformSchema) { - this.transactionTransformSchema = transactionTransformSchema; - } - - public String getTransactionEnrichmentSchema() { - return transactionEnrichmentSchema; - } - - public void setTransactionEnrichmentSchema(String transactionEnrichmentSchema) { - this.transactionEnrichmentSchema = transactionEnrichmentSchema; - } - - public Map getPipelineRules() { - return pipelineRules; - } - - public void setPipelineRules(Map pipelineRules) { - this.pipelineRules = pipelineRules; - } - - public String getTransactionIngestTopic() { - return transactionIngestTopic; - } - - public void setTransactionIngestTopic(String transactionIngestTopic) { - this.transactionIngestTopic = transactionIngestTopic; - } - - public String getTransactionIngestKey() { - return transactionIngestKey; - } - - public void setTransactionIngestKey(String transactionIngestKey) { - this.transactionIngestKey = transactionIngestKey; - } - - public String getTransactionValidationTopic() { - return transactionValidationTopic; - } - - public void setTransactionValidationTopic(String transactionValidationTopic) { - this.transactionValidationTopic = transactionValidationTopic; - } - - public String getTransactionValidationKey() { - return transactionValidationKey; - } - - public void setTransactionValidationKey(String transactionValidationKey) { - this.transactionValidationKey = transactionValidationKey; - } - - public String getTransactionTransformationTopic() { - return transactionTransformationTopic; - } - - public void setTransactionTransformationTopic(String transactionTransformationTopic) { - this.transactionTransformationTopic = transactionTransformationTopic; - } - - public String getTransactionTransformationKey() { - return transactionTransformationKey; - } - - public void setTransactionTransformationKey(String transactionTransformationKey) { - this.transactionTransformationKey = transactionTransformationKey; - } - - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ConfigLoader.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ConfigLoader.java deleted file mode 100644 index d308f6af0f8..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ConfigLoader.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.ingestpipeline.util; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; -import org.springframework.core.io.support.ResourcePatternUtils; -import org.springframework.stereotype.Component; - -@Component("configLoader") -public class ConfigLoader { - - private static Logger logger = LoggerFactory.getLogger(ConfigLoader.class); - private Map nameContentMap = new HashMap<>(); - @Autowired - private ResourceLoader resourceLoader; - - @Value("${config.schema.paths}") - private String RESOURCE_LOCATION; - - /** - * Loads config resources - * @throws Exception - */ - public void loadResources() throws Exception { - logger.info("RESOURCE_LOCATION:: "+RESOURCE_LOCATION); - Resource[] resources = getResources(RESOURCE_LOCATION); - - for (Resource resource : resources) { - String jsonContent = getContent(resource); - nameContentMap.put(resource.getFilename(), jsonContent); - } - logger.info("Number of resources loaded " + nameContentMap.size()); - - } - - /** - * To fetch a particular string content for a give resource/file name - * @param name - * @return - */ - public String get(String name) { - return nameContentMap.get(name); - } - - /** - * Loads all the resources/files with a given pattern *.json - * @param pattern path with *json - * @return - * @throws IOException - */ - private Resource[] getResources(String pattern) throws IOException { - Resource[] resources = ResourcePatternUtils.getResourcePatternResolver(resourceLoader).getResources(pattern); - return resources; - } - - /** - * Returns a content of resource - * - * @param resource - * @return - */ - private String getContent(Resource resource) { - String content = null; - InputStream is = null; - try { - is = resource.getInputStream(); - byte[] encoded = IOUtils.toByteArray(is); - content = new String(encoded, Charset.forName("UTF-8")); - - } catch (IOException e) { - logger.error("Cannot load resource " + resource.getFilename()); - - } finally{ - try { - is.close(); - } catch (IOException e) { - logger.error("Error while closing input stream. "); - } - } - return content; - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/Constants.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/Constants.java deleted file mode 100644 index d1608b69d48..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/Constants.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.ingestpipeline.util; - -import java.util.HashMap; -import java.util.Map; - -/** - * Constants which are with respect to the Ingest App - * - * @author Darshan Nagesh - * - */ - -public interface Constants { - public interface Paths { - final String ELASTIC_PUSH_CONTROLLER_PATH = "/ingest"; - final String SAVE = "/save"; - final String UPLOAD = "/upload"; - final String Targets = "/targets"; - final String Collections = "/getCollections"; - final String ES_INDEX = "/migrate/{indexName}/{version}"; - } - - public interface Qualifiers { - final String INGEST_SERVICE = "ingestService"; - final String VALIDATOR_SERVICE = "validatorService"; - final String TRANSFORM_SERVICE = "transformService"; - final String ENRICHMENT_SERVICE = "enrichmentService"; - final String TRANSFORM_COLLECTION_SERVICE = "transformCollectionService"; - final String DIGRESS_SERVICE = "digressService"; - } - - public static String SUCCESS = "success"; - public static int UNAUTHORIZED_ID = 401; - public static int SUCCESS_ID = 200; - public static int FAILURE_ID = 320; - public static String UNAUTHORIZED = "Invalid credentials. Please try again."; - public static String PROCESS_FAIL = "Process failed, Please try again."; - public static String DATE_FORMAT = "yyyy.MM.dd G 'at' HH:mm:ss z"; - public static String INDIAN_TIMEZONE = "IST"; - - public static String ALLOWED_METHODS_GET = "GET"; - public static String ALLOWED_METHODS_POST = "POST"; - - public static String MDMS_MCOLLECT_SEARCH = "{\"MdmsCriteria\":{\"tenantId\":\"TENANTID_PLACEHOLDER\",\"moduleDetails\":[{\"moduleName\":\"BillingService\",\"masterDetails\":[{\"name\":\"BusinessService\",\"filter\":\"[?(@.type=='Adhoc')]\"}]}]},\"RequestInfo\":{}}"; - public static String TENANTID_PLACEHOLDER = "TENANTID_PLACEHOLDER"; - public static String CONTENT_TYPE = "content-type"; - public static String JSON = "application/json;charset=UTF-8"; - public static String MDMS_URL = "http://egov-mdms-service.egov:8080/egov-mdms-service/v1/_search"; - public static String MDMS_RES = "MdmsRes"; - public static String BUSINESS_SERVICE="BusinessService"; - public static String BILLING_SERVICE = "BillingService"; - public static String CATEGORY_CODE= "code"; - - public interface KafkaTopics { - public static final String INGEST_DATA = "ingestData"; - public static final String VALID_DATA = "validData"; - public static final String TRANSFORMED_DATA = "transformedData"; - public static final String ERROR_INTENT = "DataError"; - public static final String TOPIC_ONE = "topicOne"; - public static final String TOPIC_TWO = "topicTwo"; - public static final String TOPIC_THREE = "topicThree"; - public static final String TOPIC_FOUR = "topicFour"; - } - - public interface BeanContainerFactory { - public static final String INCOMING_KAFKA_LISTENER = "incomingKafkaListenerContainerFactory"; - } - - public interface DomainConfigurations { - public static final String COLLECTION_DOMAIN_CONFIG = "DomainConfig"; - public static final String ENHANCE_DOMAIN_CONFIG = "EnhanceDomainConfig"; - } - - public interface PipelineRules { - public static final String VALIDATE_DATA = "VALIDATE"; - public static final String TRANSFORM_DATA = "TRANSFORM"; - public static final String ENRICH_DATA = "ENRICH"; - } - - public interface ScrollSearch { - public static final String SCROLL_ID = "scrollId"; - public static final String SEARCH_PATH = "searchPath"; - public static final String QUERY = "query"; - public static final String SCROLL_ID_PARAMS = "_scroll_id"; - public static final String SCROLL_SEARCH_DEFAULT_QUERY = "{\"scroll\":\"1m\",\"scroll_id\":"; - } - - public interface DataContexts { - public static final String CONTEXT = "context"; - public static final String COLLECTION = "collection"; - public static final String BILLING = "billing" ; - public static final String PAYMENT = "payment" ; - } - - public static String DATA_CONTEXT = "dataContext"; - public static String DATA_CONTEXT_VERSION = "dataContextVersion"; - public static String DATA_OBJECT = "dataObject"; - - public static String ERROR_IN_PIPEINE = "errorPipeline"; - - public static int HEADER_ROW = 1; - public static String MUNICIPAL_CORPORATIONS = "Municipal Corporations"; - public static String ES_INDEX_COLLECTION = "collectionsindex-v1"; - public static String ES_INDEX_BILLING = "billingservice"; - public static String ES_INDEX_PAYMENT = "paymentsindex-v1"; - - public interface ErrorMessages { - Map errorCodeMessageMap = new HashMap() {{ - put("INGEST","Error finding Context for the Topic"); - put("VALIDATE","Error while validating the Document"); - put("TRANSFORM","Error while transforming the Document"); - put("ENRICH","Error while enriching the Document"); - }}; - } - - public static interface ConfigurationFileNames { - public static final String DIGRESSION_POINTS = "DigressionPoints.json"; - } - public static interface TransformationType { - public static final String COLLECTION = "collection"; - - } - public static final String IDENTIFIER = "identifier"; - public static final String TRANSACTION_ID = "transactionId"; - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/CustomErrorType.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/CustomErrorType.java deleted file mode 100644 index 687121237bb..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/CustomErrorType.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ingestpipeline.util; - - -public class CustomErrorType { - - private String errorMessage; - - public CustomErrorType(String errorMessage){ - this.errorMessage = errorMessage; - } - - public String getErrorMessage() { - return errorMessage; - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/JSONUtil.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/JSONUtil.java deleted file mode 100644 index 55b120f208d..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/JSONUtil.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.ingestpipeline.util; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.gson.Gson; -import com.ingestpipeline.repository.ElasticSearchRepository; - -import org.json.JSONArray; -import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -@Service -public class JSONUtil { - @Autowired - public ObjectMapper mapper; - @Autowired - public Gson gson; - @Autowired - private ElasticSearchRepository elasticRepository; - - /** - * Field value to replace by new text. Replace node by given text to Parent's - * hierarchy. Field will not be added if not found existing already - * - * @param parent - * @param fieldName - * @param newValue - */ - public static void replaceFieldValue(ObjectNode parent, String fieldName, String newValue) { - if (parent.has(fieldName)) { - parent.put(fieldName, newValue); - } - parent.fields().forEachRemaining(entry -> { - JsonNode entryValue = entry.getValue(); - if (entryValue.isArray()) { - for (int i = 0; i < entryValue.size(); i++) { - if (entry.getValue().get(i).isObject()) - replaceFieldValue((ObjectNode) entry.getValue().get(i), fieldName, newValue); - } - } else if (entryValue.isObject()) { - replaceFieldValue((ObjectNode) entry.getValue(), fieldName, newValue); - } - }); - } - - /** - * Finds the value for a given key from the tree - * @param parent the tree - * @param key the field name - * @param value the value for the given field - */ - public static void findValue(ObjectNode parent, String key, StringBuffer value) { - parent.fields().forEachRemaining(entry -> { - if(entry.getKey().equalsIgnoreCase(key)){ - value.append(entry.getValue().asText()); - } else { - JsonNode entryValue = entry.getValue(); - if(entryValue.isArray()){ - for (int i=0; i < entryValue.size(); i++){ - if (entry.getValue().get(i).isObject()) - findValue((ObjectNode) entry.getValue().get(i), key, value); - } - } else if (entryValue.isObject()){ - findValue((ObjectNode) entry.getValue(), key, value); - } - } - }); - } - - - /** - * @return - */ - public static String getJsonString(ObjectMapper objectMapper,Object object) throws JsonProcessingException { - if(objectMapper != null){ - return objectMapper.writeValueAsString(object); - } - return null; - } - - public ObjectMapper getMapper() { - return mapper; - } - - public void setObjectMapper(ObjectMapper objectMapper){ - mapper=objectMapper; - } - - public Gson getGson() { - return gson; - } - - public void setGson(Gson gsonn) - { - gson = gsonn; - } - - public List fetchMCollectCategories (String tenantId) { - - String mdmsRequestString = Constants.MDMS_MCOLLECT_SEARCH.replace(Constants.TENANTID_PLACEHOLDER, tenantId); - Object mdmsRequestObject = mdmsRequestString; - - ResponseEntity result = elasticRepository.fetchMDMSResponse(mdmsRequestObject); - - Map body = result.getBody(); - JSONObject jsonObj = new JSONObject(body); - JSONArray jsonArray = jsonObj.getJSONObject(Constants.MDMS_RES).getJSONObject(Constants.BILLING_SERVICE).getJSONArray(Constants.BUSINESS_SERVICE); - List categoriesList = new ArrayList(); - - for(int i = 0 ; i < jsonArray.length() ; i++){ - categoriesList.add(jsonArray.getJSONObject(i).getString(Constants.CATEGORY_CODE)); - } - - return categoriesList; - - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/JSONUtils.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/JSONUtils.java deleted file mode 100644 index b317e8be03b..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/JSONUtils.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ingestpipeline.util; - -import org.json.JSONObject; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonPropertyOrder({ "dataContext", "dataContextVersion", "dataObject"}) -public class JSONUtils { - public JSONObject JSONWrapper(JSONObject json) { - JSONObject obj = new JSONObject(); - obj.put("dataContext", "target"); - obj.put("dataContextVersion", "v1"); - obj.put("dataObject", json); - return obj; - } - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/JsonKey.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/JsonKey.java deleted file mode 100644 index 27dcd8a3294..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/JsonKey.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - */ -package com.ingestpipeline.util; - -/** - * @author Abhishek - * - */ -public class JsonKey { - - public static final String STATUS_CODE = "statusCode"; - public static final String STATUS = "statusInfo"; - public static final String STATUS_MESSAGE = "statusMessage"; - public static final String ERROR_MESSAGE = "errorMessage"; - - public static final String RESPONSE_DATA = "responseData"; - - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/MockMultipartFile.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/MockMultipartFile.java deleted file mode 100644 index f678698ef46..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/MockMultipartFile.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ingestpipeline.util; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import org.springframework.web.multipart.MultipartFile; - -public class MockMultipartFile implements MultipartFile { - - private String name; - private String originalFileName; - private String contentType; - private byte[] content; - - public MockMultipartFile(String name, String originalFileName, String contentType, byte[] content) { - super(); - this.name = name; - this.originalFileName = originalFileName; - this.contentType = contentType; - this.content = content; - } - - @Override - public String getName() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getOriginalFilename() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getContentType() { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isEmpty() { - // TODO Auto-generated method stub - return false; - } - - @Override - public long getSize() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public byte[] getBytes() throws IOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getInputStream() throws IOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void transferTo(File dest) throws IOException, IllegalStateException { - // TODO Auto-generated method stub - - } - - - - - - -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ReadUtil.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ReadUtil.java deleted file mode 100644 index 5f7290ff58d..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ReadUtil.java +++ /dev/null @@ -1,390 +0,0 @@ -package com.ingestpipeline.util; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.text.DateFormat; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.NavigableMap; -import java.util.Scanner; -import java.util.TreeMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.fileupload.disk.DiskFileItem; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellType; -import org.apache.poi.ss.usermodel.DataFormatter; -import org.apache.poi.ss.usermodel.DateUtil; -import org.apache.poi.ss.usermodel.RichTextString; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; -import org.apache.poi.ss.util.CellRangeAddress; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.commons.CommonsMultipartFile; - -import com.ingestpipeline.controller.RestApiController; -import com.ingestpipeline.service.IngestService; - -@Component("readUtil") -public class ReadUtil { - - - @Value("${filename.length}") - private Integer filenameLengthValue; - - - @Value("${filename.useletters}") - private Boolean useLettersValue; - - @Value("${filename.usenumbers}") - private Boolean useNumbersValue; - - - private static Integer filenameLength; - - private static Boolean useLetters; - - private static Boolean useNumbers; - - @Value("${filename.length}") - public void setFilenameLength(Integer filenameLengthValue) { - ReadUtil.filenameLength = filenameLengthValue; - } - - @Value("${filename.useletters}") - public void setUseLetters(Boolean useLettersValue) { - ReadUtil.useLetters = useLettersValue; - } - - @Value("${filename.usenumbers}") - public void setUseNumbers(Boolean useNumbersValue) { - ReadUtil.useNumbers = useNumbersValue; - } - - public static final Logger LOGGER = LoggerFactory.getLogger(ReadUtil.class); - private static String UPLOADED_FOLDER = ""; - public static Path path; - public static File uploadFile = new File( - System.getProperty("user.dir") + System.getProperty("file.separator") + "uploads"); - - public static JSONArray getFiletoDirectory(MultipartFile file) throws Exception { - byte[] bytes = file.getBytes(); - if (!uploadFile.exists()) { - uploadFile.mkdir(); - } - UPLOADED_FOLDER = uploadFile.toString(); - - - String orignalFileName = file.getOriginalFilename(); - String randomString = RandomStringUtils.random(filenameLength, useLetters, useNumbers); - String fileName = System.currentTimeMillis() + randomString; - String extension = FilenameUtils.getExtension(orignalFileName); - - path = Paths.get(UPLOADED_FOLDER + System.getProperty("file.separator") + fileName + '.' + extension); - Files.write(path, bytes); - JSONArray fileIntoJsonArray = readFilefromDirectory(); - String jsonArrayFileName = fileName + ".json"; - writeJsonArrayToFile(fileIntoJsonArray, jsonArrayFileName); - return fileIntoJsonArray; - } - - private static JSONArray readFilefromDirectory() throws Exception { - String workbookSheetName = null; - int workbookSheetIndex = -1; - String getFileExtension = FilenameUtils.getExtension(path.toString()); - Workbook workbook = null; - if (getFileExtension.endsWith("xlsx")) { - workbook = new XSSFWorkbook(); - workbook = WorkbookFactory.create(new File(path.toString())); - } else { - throw new Exception("invalid file, should be xlsx"); - } - - JSONArray workbookToJsonArray = new JSONArray(); - for (int i = 0; i < workbook.getNumberOfSheets(); i++) { - Sheet sheet = workbook.getSheetAt(i); - workbookSheetName = sheet.getSheetName(); - workbookSheetIndex = workbook.getSheetIndex(workbookSheetName); - if (workbookSheetName != null && workbookSheetName.length() > 0) { - workbookToJsonArray = workbookToJsonArray.put(getSheetToJsonObject(workbook, sheet)); - } - } - - JSONArray bookInJsonArray = new JSONArray(); - for (int i = 0; i < workbookToJsonArray.length(); i++) { - JSONArray sheetInJsonArray = new JSONArray(); - sheetInJsonArray = (JSONArray) workbookToJsonArray.get(i); - Iterator itr = sheetInJsonArray.iterator(); - while (itr.hasNext()) { - JSONObject obj = (JSONObject) itr.next(); - bookInJsonArray.put(obj); - } - } - return bookInJsonArray; - } - - private static JSONArray getSheetToJsonObject(Workbook workbook, Sheet sheet) { - String workbookSheetName = sheet.getSheetName(); - int workbookSheetIndex = workbook.getSheetIndex(workbookSheetName); - Object financialYear = null; - int firstRowNum = sheet.getFirstRowNum(), lastRowNum = sheet.getLastRowNum(), - ulbFirstRowNumber = Constants.HEADER_ROW + 2, ulbDestRowNumber = -1; - Row row = null; - int rowFirstCellNum = -1, rowLastCellNum = -1; - List> rowRecordList = new LinkedList>(); - Map> rowRecordMap = new LinkedHashMap>(); - Map> municipalCity = new LinkedHashMap>(); - - if (lastRowNum > 0) { - for (int i = firstRowNum; i <= lastRowNum; i++) { - row = sheet.getRow(i); - if (row != null) { - rowFirstCellNum = row.getFirstCellNum(); - rowLastCellNum = sheet.getRow(i).getLastCellNum(); - List rowRecord = new LinkedList(); - Map> singleRowDataMap = new LinkedHashMap>(); - for (int j = rowFirstCellNum; j < rowLastCellNum; j++) { - Cell cell = row.getCell(j); - if (isMergedRegion(workbook, sheet, i, j)) { - sheet = getSheetMergerCellRegion(workbook, sheet, i, j); - } - singleRowDataMap.put(i, getRowRecord(cell, rowRecord)); - } - - if (!rowRecord.isEmpty()) { - rowRecordList.add(rowRecord); - // rowRecordMap.put(i, rowRecord); - rowRecordMap.putAll(singleRowDataMap); - - } - - if (rowRecordList.size() == 1) { - financialYear = rowRecordList.get(Constants.HEADER_ROW - 1).get(3).toString().trim(); - } - } - } - } - - List sheetHeaderList = new LinkedList(); - List customHeaderList = new LinkedList(); - Map customHeaderMap = new LinkedHashMap(); - JSONArray getMunicipalCityToJsonArray = new JSONArray(); - Map> lastRowRecord = new LinkedHashMap>(); - customHeaderList.add("Sheet Name"); - customHeaderList.add("Financial Year"); - customHeaderList.add("Timestamp"); - // customHeaderList.add("Municipal Corporations"); - customHeaderMap.put(customHeaderList.get(0), workbookSheetName); - customHeaderMap.put(customHeaderList.get(1), financialYear); - DateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:S"); - Date dateobj = new Date(); - customHeaderMap.put(customHeaderList.get(2), df.format(dateobj)); - JSONObject customHeaderJsonObject = new JSONObject(); - JSONArray municipalCitiesIntoJsonArray = new JSONArray(); - for (Map.Entry> itrRowRecordMap : rowRecordMap.entrySet()) { - if (itrRowRecordMap.getKey() == Constants.HEADER_ROW) { - sheetHeaderList.addAll(itrRowRecordMap.getValue()); - } - if (itrRowRecordMap.getKey() >= ulbFirstRowNumber) { - JSONObject municipalCitiesIntoJsonObject = new JSONObject(); - Map mc = new LinkedHashMap(); - municipalCity.put(itrRowRecordMap.getKey(), itrRowRecordMap.getValue()); - for (Map.Entry itrCustomHeaderMap : customHeaderMap.entrySet()) { - municipalCitiesIntoJsonObject.accumulate(itrCustomHeaderMap.getKey().toString(), - itrCustomHeaderMap.getValue()); - } - - for (int i = 0; i < sheetHeaderList.size(); i++) { - if ((!sheetHeaderList.get(i).toString().contentEquals("-")) - && (!itrRowRecordMap.getValue().get(i).toString().contentEquals("-"))) { - - municipalCitiesIntoJsonObject.put(sheetHeaderList.get(i).toString(), - itrRowRecordMap.getValue().get(i)); - } - } - - municipalCitiesIntoJsonArray.put(municipalCitiesIntoJsonObject); - } - } - return municipalCitiesIntoJsonArray; - } - - private static List getRowRecord(Cell cell, List rowRecord) { - switch (cell.getCellType()) { - case STRING: - String str = cell.getRichStringCellValue().getString(); - str = str.replaceAll("(\\n\\s)+|(\\r\\n\\s)+|(\\r\\s)+|(\\r)+|(\\n)+|(\\s)+", " "); - rowRecord.add(str); - break; - case NUMERIC: - if (DateUtil.isCellDateFormatted(cell)) { - rowRecord.add(cell.getDateCellValue()); - break; - } else { - Double d = cell.getNumericCellValue(); - DecimalFormat numberFormat = new DecimalFormat("#.00"); - rowRecord.add(Double.parseDouble(numberFormat.format(d))); - } - break; - case BOOLEAN: - rowRecord.add(cell.getBooleanCellValue()); - break; - case FORMULA: - if (cell.getCachedFormulaResultType().equals(CellType.NUMERIC)) { - Double d = cell.getNumericCellValue() * 100; - DecimalFormat numberFormat = new DecimalFormat("#.00"); - rowRecord.add(Double.parseDouble(numberFormat.format(d))); - break; - } else if (cell.getCachedFormulaResultType().equals(CellType.STRING)) { - rowRecord.add(cell.getNumericCellValue()); - break; - } - break; - case BLANK: - rowRecord.add("-"); - break; - default: - rowRecord.add("no type match"); - break; - } - return rowRecord; - } - - private static boolean isMergedRegion(Workbook workbook, Sheet sheet, int cellRow, int cellColumn) { - int retVal = 0; - int sheetMergerCount = sheet.getNumMergedRegions(); - for (int i = 0; i < sheetMergerCount; i++) { - CellRangeAddress region = sheet.getMergedRegion(i); - int firstRow = region.getFirstRow(), firstCol = region.getFirstColumn(), lastRow = region.getLastRow(), - lastCol = region.getLastColumn(); - if (cellRow >= firstRow && cellRow <= lastRow) { - if (cellColumn >= firstCol && cellColumn <= lastCol) { - retVal = lastCol - firstCol + 1; - if (retVal > 0) { - return true; - } - break; - } - } - } - return false; - } - - private static Sheet getSheetMergerCellRegion(Workbook workbook, Sheet sheet, int cellRow, int cellColumn) { - int retVal = 0; - int sheetMergerCount = sheet.getNumMergedRegions(); - for (int i = 0; i < sheetMergerCount; i++) { - CellRangeAddress region = sheet.getMergedRegion(i); - int firstRow = region.getFirstRow(); - int firstCol = region.getFirstColumn(); - int lastRow = region.getLastRow(); - int lastCol = region.getLastColumn(); - if (cellRow >= firstRow && cellRow <= lastRow) { - if (cellColumn >= firstCol && cellColumn <= lastCol) { - retVal = lastCol - firstCol + 1; - Row row = sheet.getRow(i); - if (retVal > 0) { - for (int j = firstRow; j <= lastRow; j++) { - for (int k = firstCol; k <= lastCol; k++) { - Cell cell = sheet.getRow(region.getFirstRow()).getCell(region.getFirstColumn()); - String stringValue1 = null; - Double doubleValue1 = -1.00; - Date dateValue1 = new Date(); - Boolean booleanValue1 = false; - RichTextString formulaValue1 = null; - switch (cell.getCellType()) { - case STRING: - stringValue1 = sheet.getRow(region.getFirstRow()).getCell(region.getFirstColumn()) - .getRichStringCellValue().getString(); - sheet.getRow(j).getCell(k).setCellValue(stringValue1); - break; - case NUMERIC: - if (DateUtil.isCellDateFormatted( - sheet.getRow(region.getFirstRow()).getCell(region.getFirstColumn()))) { - dateValue1 = sheet.getRow(region.getFirstRow()).getCell(region.getFirstColumn()) - .getDateCellValue(); - sheet.getRow(j).getCell(k).setCellValue(dateValue1); - } else { - doubleValue1 = sheet.getRow(region.getFirstRow()) - .getCell(region.getFirstColumn()).getNumericCellValue(); - sheet.getRow(j).getCell(k).setCellValue(doubleValue1); - } - break; - case BOOLEAN: - booleanValue1 = sheet.getRow(region.getFirstRow()).getCell(region.getFirstColumn()) - .getBooleanCellValue(); - sheet.getRow(j).getCell(k).setCellValue(booleanValue1); - break; - case FORMULA: - if (cell.getCachedFormulaResultType().equals(CellType.NUMERIC)) { - doubleValue1 = cell.getNumericCellValue() * 100; - sheet.getRow(j).getCell(k).setCellValue(doubleValue1); - break; - } else if (cell.getCachedFormulaResultType().equals(CellType.STRING)) { - formulaValue1 = cell.getRichStringCellValue(); - sheet.getRow(j).getCell(k).setCellValue(formulaValue1); - break; - } - break; - case BLANK: - break; - default: - } - } - } - } - } - } - } - return sheet; - } - - private static void writeJsonArrayToFile(JSONArray data, String fileName) throws IOException { - String currentWorkingFolder = System.getProperty("user.dir"), - filePathSeperator = System.getProperty("file.separator"), - filePath = currentWorkingFolder + filePathSeperator + fileName; - BufferedWriter bufferedWriter = null; - try { - bufferedWriter = new BufferedWriter(new FileWriter(new File(filePath))); - bufferedWriter.write(data.toString()); - }catch (Exception e){ - LOGGER.error("Error while writing to file. "); - }finally { - bufferedWriter.flush(); - bufferedWriter.close(); - } - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ResponseCode.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ResponseCode.java deleted file mode 100644 index fe20fbf7f9a..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ResponseCode.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ingestpipeline.util; - -/** - * - * @author Abhishek - * - */ -public enum ResponseCode { - UnAuthorised(Constants.UNAUTHORIZED_ID, Constants.UNAUTHORIZED), Success( - Constants.SUCCESS_ID, Constants.SUCCESS),FAILURE( - Constants.FAILURE_ID, Constants.PROCESS_FAIL); - /** - * error code contains int value - */ - private int errorCode; - /** - * errorMessage contains proper error message. - */ - private String errorMessage; - - - - /** - * @param errorCode - * @param errorMessage - */ - private ResponseCode(int errorCode, String errorMessage) { - this.errorCode = errorCode; - this.errorMessage = errorMessage; - } - - /** - * - * @param errorCode - * @return - */ - public String getMessage(int errorCode) { - return ""; - } - - /** - * @return - */ - public int getErrorCode() { - return errorCode; - } - - /** - * @param errorCode - */ - public void setErrorCode(int errorCode) { - this.errorCode = errorCode; - } - - /** - * @return - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * @param errorMessage - */ - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - /** - * This method will provide status message based on code - * - * @param code - * @return String - */ - public static String getResponseMessage(int code) { - String value = ""; - ResponseCode responseCodes[] = ResponseCode.values(); - for (ResponseCode actionState : responseCodes) { - if (actionState.getErrorCode() == code) { - value = actionState.getErrorMessage(); - } - } - return value; - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ResponseGenerator.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ResponseGenerator.java deleted file mode 100644 index 46b73508c0c..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ResponseGenerator.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ingestpipeline.util; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; - -public class ResponseGenerator { - - - private static ObjectMapper objectMapper = new ObjectMapper(); - - public static String failureResponse() throws JsonProcessingException{ - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.FAILURE.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, - ResponseCode.FAILURE.getErrorMessage()); - response.put(JsonKey.ERROR_MESSAGE, - ResponseCode.FAILURE.getErrorMessage()); - return JSONUtil.getJsonString(objectMapper,response); - } - - - public static String failureResponse(String message) throws JsonProcessingException{ - ObjectNode actualResponse = objectMapper.createObjectNode(); - - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.FAILURE.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, - ResponseCode.FAILURE.getErrorMessage()); - response.put(JsonKey.ERROR_MESSAGE,message); - actualResponse.putPOJO(JsonKey.STATUS,response); - - return JSONUtil.getJsonString(objectMapper,actualResponse); - } - - public static String feedbackFailureResponse(String message) throws JsonProcessingException{ - ObjectNode actualResponse = objectMapper.createObjectNode(); - - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.FAILURE.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, - ResponseCode.FAILURE.getErrorMessage()); - response.put(JsonKey.ERROR_MESSAGE,message); - actualResponse.putPOJO(JsonKey.STATUS,response); - - return JSONUtil.getJsonString(objectMapper,actualResponse); - } - - public static String successResponse(Object obj) throws JsonProcessingException { - ObjectNode actualResponse = objectMapper.createObjectNode(); - - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.Success.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, ResponseCode.Success.getErrorMessage()); - response.put(JsonKey.ERROR_MESSAGE, ""); - actualResponse.putPOJO(JsonKey.STATUS,response); - if (obj != null) { - actualResponse.putPOJO(JsonKey.RESPONSE_DATA, obj); - } - - return JSONUtil.getJsonString(objectMapper,actualResponse); - } - - public static String feedbackSuccessResponse(Object obj) throws JsonProcessingException { - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.Success.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, ResponseCode.Success.getErrorMessage()); - response.put(JsonKey.ERROR_MESSAGE, ""); - return JSONUtil.getJsonString(objectMapper,response); - } - - public static String feedbackSuccessResponse(String message) throws JsonProcessingException { - ObjectNode response = objectMapper.createObjectNode(); - response.put(JsonKey.STATUS_CODE, ResponseCode.Success.getErrorCode()); - response.put(JsonKey.STATUS_MESSAGE, ResponseCode.Success.getErrorMessage()); - response.put(JsonKey.ERROR_MESSAGE, ""); - return JSONUtil.getJsonString(objectMapper, response); - } -} diff --git a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ResponseMessages.java b/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ResponseMessages.java deleted file mode 100644 index 5f75d4415b3..00000000000 --- a/business-services/dashboard-ingest/src/main/java/com/ingestpipeline/util/ResponseMessages.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ingestpipeline.util; - -public interface ResponseMessages { - - public interface ErrorMessages { - } - - public interface SuccessMessages { - } - -} diff --git a/business-services/dashboard-ingest/src/main/resources/application.properties b/business-services/dashboard-ingest/src/main/resources/application.properties deleted file mode 100644 index 7095fdabbda..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/application.properties +++ /dev/null @@ -1,89 +0,0 @@ -#--------------------------- PATH & PORT CONFIGURATIONS ---------------------------# - -# SET CONTEXT PATH -server.port=8080 -server.context-path=/dashboard-ingest -server.servlet.context-path=/dashboard-ingest - -# KAFKA SERVER CONFIGURATIONS -spring.kafka.bootstrap.servers=localhost:9092 - -spring.kafka.consumer.value-deserializer=com.ingestpipeline.consumer.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=pipeline-group -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer -spring.kafka.listener.missing-topics-fatal=false - -# KAFKA CONSUMER CONFIGURATIONS -kafka.consumer.config.auto_commit=true -kafka.consumer.config.auto_commit_interval=100 -kafka.consumer.config.session_timeout=15000 -kafka.consumer.config.group_id=pipeline-group -kafka.consumer.config.auto_offset_reset=earliest - -# KAFKA PRODUCER CONFIGURATIONS -kafka.producer.config.retries_config=0 -kafka.producer.config.batch_size_config=100000 -kafka.producer.config.linger_ms_config=100 -kafka.producer.config.buffer_memory_config=66554432 - -#----------------------------- ELASTIC SEARCH CONFIGURATIONS ------------------------------# -services.esindexer.host=http://104.211.240.72:9200/ -services.esindexer.host.name=104.211.240.72 -services.esindexer.host.port=9200 -services.esindexer.username=egov-admin -services.esindexer.password=TUSYns9mEcRPy77n -kafka.topics.incoming.data=tarento-dss-collection -kafka.topics.incoming.collection=dss-collection-update -kafka.topics.collection.datacontext=collection -kafka.topics.collection.version=v1 - - - -kafka.topics.enriched.data=egov-dss-ingest-enriched -kafka.topics.enriched.key=enrData -kafka.topics.bypass.update.data=egov-dss-update-receive -kafka.topics.bypass.update.post=egov-dss-update-post -kafka.topics.bypass.update.key=updateTopicKey -es.target.index.name = dss-target_v1 -es.index.name=dss-payment_v2 -es.index.type=general -es.document.type=pipeline_data -es.host.schema=https -es.push.direct=true -es.bypass.push.direct = true -es.index.searchQuery.collection = {\"size\": \"10\",\"query\":{\"bool\":{\"must\":[{\"wildcard\": {\"Data.tenantId.keyword\":\"pb.*\"}}]}}} -es.index.searchQuery.billing = {\"size\": \"10\",\"query\":{\"bool\":{\"must\":[{\"wildcard\": {\"tenantid.keyword\":\"pb.*\"}}]}}} -es.index.searchQuery.payment = {\"size\": \"10\"} -egov.services.esindexer.host.search=/_search - -spring.data.elasticsearch.cluster.name=elasticsearch-v1 -spring.data.elasticsearch.cluster.nodes=elasticsearch-v1 - -service.retry.maxAttempts=3 -service.retry.backoff.delay=1000 -management.endpoints.web.base-path=/ - -#----------------------------- Pipeline Schema Config Locations ------------------------------# -transformation.config.location=config/transform_transaction_v1.json - -schema.transaction.validation=config/validator_transaction_v1.json -schema.transaction.transformation=config/transform_transaction_v1.json -schema.transaction.enrichment=config/enrichment_transaction_v1.json - -config.schema.paths=classpath*:config/*.json - -#Paramters for naming file for internal storage -filename.length=10 -filename.useletters=true -filename.usenumbers=false - -id.timezone=IST - -#-------------------------------------------------KAFKA TOPICS----------------------------------# -kafka.topic.error.data=DataError - - -dss.collection.mapping.path=/payment_index_mapping.json -dss.collection.target.index.name=dss-collection_v2 \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/resources/config/CollectionDomainConfig.json b/business-services/dashboard-ingest/src/main/resources/config/CollectionDomainConfig.json deleted file mode 100644 index 5265a5350b4..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/CollectionDomainConfig.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "domainConfig": [ - { - "id": "1", - "businessType": "PT", - "indexName": "ptindex-v1", - "documentType": "", - "query": "{\"query\":{\"bool\":{\"must\":[{\"match_phrase\":{\"Data.propertyDetails.assessmentNumber\":\"value\"}},{\"match_phrase\":{\"Data.propertyId\":\"value\"}}]}}}", - "references": [ - { - "fieldName": "consumerCode", - "argument": "Data.propertyId", - "dataType": "String" - }, - { - "fieldName": "consumerCode", - "argument": "Data.propertyDetails.assessmentNumber", - "dataType": "String" - } - ] - }, - { - "id": "2", - "businessType": "TL", - "indexName": "tlindex-v1", - "documentType": "", - "query": "{\"query\":{\"bool\":{\"must\":[{\"match_phrase\":{\"Data.tradelicense.applicationnumber\":\"value\"}}]}}}", - "references": [ - { - "fieldName": "consumerCode", - "argument": "Data.tradelicense.applicationnumber", - "dataType": "String" - } - ] - }, - { - "id": "3", - "businessType": "PGR", - "indexName": "pgrindex-v1", - "documentType": "", - "query": "{}", - "references": [ - { - "fieldName": "consumerCode", - "argument": "complainNumber", - "dataType": "String" - } - ] - } - ] -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/resources/config/DigressionPoints.json b/business-services/dashboard-ingest/src/main/resources/config/DigressionPoints.json deleted file mode 100644 index 2ebf20de3f3..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/DigressionPoints.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "digressionPoints": [ - { - "dataContext": "collection", - "paths": [ "Bill", "billDetails" ] - } - ] -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/resources/config/DomainConfig.json b/business-services/dashboard-ingest/src/main/resources/config/DomainConfig.json deleted file mode 100644 index 17079e97fdb..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/DomainConfig.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "domainConfig": [ - { - "id": "1", - "domain": "PT", - "indexName": "ptindex-v1", - "documentType": "", - "query": "{\"query\":{\"bool\":{\"must\":[{\"match_phrase\":{\"Data.propertyDetails.assessmentNumber\":\"value\"}},{\"match_phrase\":{\"Data.propertyId\":\"value\"}}]}}}", - "targetReferences": [ - { - "fieldName": "propertyId", - "argument": "Data.propertyId", - "dataType": "String", - "value": "$value", - "seperator": " ", - "expression": "propertyId" - }, - { - "fieldName": "assessmentNumber", - "argument": "Data.propertyDetails.assessmentNumber", - "dataType": "String", - "value": "$value", - "seperator": " ", - "expression": "assessmentNumber" - } - ], - "sourceReferences": [ - { - "fieldName": "consumerCode", - "argument": "Bill.billDetails.consumerCode", - "dataType": "String", - "value": "$value", - "seperator": ":", - "expression": "propertyId:assessmentNumber" - } - ] - }, - { - "id": "2", - "domain": "TL", - "indexName": "tlindex-v1", - "documentType": "", - "query": "{\"query\":{\"bool\":{\"must\":[{\"match_phrase\":{\"Data.tradelicense.applicationnumber\":\"value\"}}]}}}", - "targetReferences": [ - { - "fieldName": "applicationnumber", - "argument": "Data.tradelicense.applicationnumber", - "dataType": "String", - "value": "$value", - "seperator": " ", - "expression": "applicationnumber" - } - ], - "sourceReferences": [ - { - "fieldName": "consumerCode", - "argument": "Data.tradelicense.applicationnumber", - "dataType": "String", - "value": "$value", - "seperator": " ", - "expression": "applicationnumber" - } - ] - }, - { - "id": "3", - "domain": "PGR", - "indexName": "pgrindex-v1", - "documentType": "", - "query": "{}", - "targetReferences": [ - { - "fieldName": "complainNumber", - "argument": "Data.complainNumber", - "dataType": "String", - "value": "$value", - "seperator": " ", - "expression": "complainNumber" - } - ], - "sourceReferences": [ - { - "fieldName": "consumerCode", - "argument": "Data.complainNumber", - "value": "$value", - "seperator": " ", - "expression": "complainNumber" - } - ] - } - ] -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/resources/config/EnhanceDomainConfig.json b/business-services/dashboard-ingest/src/main/resources/config/EnhanceDomainConfig.json deleted file mode 100644 index d157119fb3c..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/EnhanceDomainConfig.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "domainConfig": [ - { - "id": "1", - "domain": "PT", - "indexName": "property-assessments", - "documentType": "", - "query": "{\"query\":{\"bool\":{\"must\":[{\"match_phrase\":{\"Data.propertyId\":\"value\"}}]}}}", - "targetReferences": [ - { - "fieldName": "propertyId", - "argument": "Data.propertyId", - "dataType": "String", - "value": "$value", - "seperator": " ", - "expression": "propertyId" - } - ], - "sourceReferences": [ - { - "fieldName": "consumerCode", - "argument": "paymentDetails.bill.consumerCode", - "dataType": "String", - "value": "$value", - "seperator": ":", - "expression": "propertyId" - } - ] - } - ] -} diff --git a/business-services/dashboard-ingest/src/main/resources/config/TopicContextConfiguration.json b/business-services/dashboard-ingest/src/main/resources/config/TopicContextConfiguration.json deleted file mode 100644 index beb133611a7..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/TopicContextConfiguration.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "topicContextConfigurations": [ - { - "topic": "dss-collection-update", - "dataContext": "collection", - "dataContextVersion": "v1" - }, - { - "topic": "topicTwo", - "dataContext": "billing", - "dataContextVersion": "v1" - } - ] -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/resources/config/config.properties b/business-services/dashboard-ingest/src/main/resources/config/config.properties deleted file mode 100644 index 96dd3064bd6..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/config.properties +++ /dev/null @@ -1,15 +0,0 @@ -#--------------------------- Kafka Topics & Configurations ---------------------------# -dataContext=transaction - -kafka.transaction.ingest.topic=ingestData -kafka.transaction.ingest.key=ingestKey - -kafka.transaction.validation.topic=validData -kafka.transaction.validation.key=validKey - -kafka.transaction.transformation.topic=transformedData -kafka.transaction.transformation.key=transformedKey - -pipelinerules={'VALIDATE':false,'TRANSFORM':true,'ENRICH':true} - -transformation.config.location=config/transform_transaction_v1.json diff --git a/business-services/dashboard-ingest/src/main/resources/config/enrichment_transaction_v1.json b/business-services/dashboard-ingest/src/main/resources/config/enrichment_transaction_v1.json deleted file mode 100644 index 038c1be330c..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/enrichment_transaction_v1.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "dataCollectorName": "UserInformation", - "collectionSource": "UserService", - "basePath": "http://rain.idc.tarento.com/user/", - "collectionPoints": [ - { - "name": "UserMetaInfo", - "extensionPath": "/getUserMetaInfo", - "paramsPassed": [ - { - "sourceParam": "Transaction.KioskOperator.Id", - "pathLabel": "id", - "dataType": "Long", - "defaultValue": "0" - }, - { - "sourceParam": null, - "pathLabel": "isActive", - "dataType": "Boolean", - "defaultValue": "TRUE" - } - ], - "responseStructure": "{}", - "responseMapping": [ - { - - } - ] - }, - { - "name": "UserRoleInfo", - "extensionPath": "/getUserRole", - "paramsPassed": [ - { - "sourceParam": "Transaction.KioskOperator.Id", - "pathLabel": "userId", - "dataType": "Long", - "defaultValue": "0" - }, - { - "sourceParam": null, - "pathLabel": "isActive", - "dataType": "Boolean", - "defaultValue": "TRUE" - } - ] - } - ] -} diff --git a/business-services/dashboard-ingest/src/main/resources/config/transform_collection_v1.json b/business-services/dashboard-ingest/src/main/resources/config/transform_collection_v1.json deleted file mode 100644 index 3bed7dd5941..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/transform_collection_v1.json +++ /dev/null @@ -1,98 +0,0 @@ -[ - { - "operation": "shift", - "spec": { - "tenantId": "tenantId", - "transactionId": "transactionId", - "@timestamp": "@timestamp", - "Bill": { - "$i": { - "billDetails": { - "$j": { - "voucherHeader": "Bill.billDetails.voucherHeader", - "boundary": "Bill.billDetails.boundary", - "collectedAmount": "Bill.billDetails.collectedAmount", - "channel": "Bill.billDetails.channel", - "manualReceiptDate": "Bill.billDetails.manualReceiptDate", - "expiryDate": "Bill.billDetails.expiryDate", - "demandId": "Bill.billDetails.demandId", - "amountPaid": "Bill.billDetails.amountPaid", - "consumerCode": "Bill.billDetails.consumerCode", - "id": "Bill.billDetails.id", - "department": "Bill.billDetails.department", - "receiptNumber": "Bill.billDetails.receiptNumber", - "businessService": "Bill.billDetails.businessService", - "receiptType": "Bill.billDetails.receiptType", - "fromPeriod": "Bill.billDetails.fromPeriod", - "stateId": "Bill.billDetails.stateId", - "receiptDate": "Bill.billDetails.receiptDate", - "bill": "Bill.billDetails.bill", - "billDate": "Bill.billDetails.billDate", - "consumerType": "Bill.billDetails.consumerType", - "totalAmount": "Bill.billDetails.totalAmount", - "collectionType": "Bill.billDetails.collectionType", - "fund": "Bill.billDetails.fund", - "manualReceiptNumber": "Bill.billDetails.manualReceiptNumber", - "tenantId": "Bill.billDetails.tenantId", - "toPeriod": "Bill.billDetails.toPeriod", - "partPaymentAllowed": "Bill.billDetails.partPaymentAllowed", - "billNumber": "Bill.billDetails.billNumber", - "status": "Bill.billDetails.status", - "billAccountDetails": { - "*": { - "taxHeadCode": "Bill.billDetails.billAccountDetails.[&1].taxHeadCode", - "glcode": "Bill.billDetails.billAccountDetails.[&1].glcode", - "amount": "Bill.billDetails.billAccountDetails.[&1].amount", - "billDetail": "Bill.billDetails.billAccountDetails.[&1].billDetail", - "purpose": "Bill.billDetails.billAccountDetails.[&1].purpose", - "adjustedAmount": "Bill.billDetails.billAccountDetails.[&1].adjustedAmount", - "tenantId": "Bill.billDetails.billAccountDetails.[&1].tenantId", - "id": "Bill.billDetails.billAccountDetails.[&1].id", - "demandDetailId": "Bill.billDetails.billAccountDetails.[&1].demandDetailId" - } - } - } - }, - "isCancelled": "Bill.isCancelled", - "paidBy": "Bill.paidBy", - "mobileNumber": "Bill.mobileNumber", - "payerId": "Bill.payerId", - "isActive": "Bill.isActive", - "additionalDetails": "Bill.additionalDetails", - "payerAddress": "Bill.payerAddress", - "taxAndPayments": "Bill.taxAndPayments", - "auditDetails": "Bill.auditDetails", - "tenantId": "Bill.tenantId", - "payerName": "Bill.payerName", - "id": "Bill.id", - "payerEmail": "Bill.payerEmail" - } - }, - "instrument": { - "bankAccount": "instrument.bankAccount", - "transactionDateInput": "instrument.transactionDateInput", - "amount": "instrument.amount", - "instrumentType": { - "instrumentTypeProperties": "instrument.typeProperties", - "name": "instrument.typeName", - "id": "instrument.typeId" - }, - "instrumentNumber": "instrument.number" - }, - "tenantData": { - "code": "tenantData.code", - "name": "tenantData.name", - "type": "tenantData.type", - "city": { - "name": "tenantData.cityName", - "localName": "tenantData.cityLocalName", - "districtCode": "tenantData.cityDistrictCode", - "districtName": "tenantData.cityDistrictName", - "regionName": "tenantData.cityRegionName", - "ulbGrade": "tenantData.cityUlbGrade", - "code": "tenantData.cityCode" - } - } - } - } -] diff --git a/business-services/dashboard-ingest/src/main/resources/config/transform_collection_v2.json b/business-services/dashboard-ingest/src/main/resources/config/transform_collection_v2.json deleted file mode 100644 index cfd516bf9d8..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/transform_collection_v2.json +++ /dev/null @@ -1,100 +0,0 @@ -[ - { - "operation": "shift", - "spec": { - "tenantId": "tenantId", - "id": "id", - "paymentMode": "paymentMode", - "paymentStatus": "paymentStatus", - "transactionId": "transactionNumber", - "paidBy": "paidBy", - "payer": "payer", - "paymentDetails": { - "$i": { - "businessService": "paymentDetails.businessService", - "receiptType": "paymentDetails.receiptType", - "totalDue": "paymentDetails.totalDue", - "receiptDate": "paymentDetails.receiptDate", - "bill": { - "billDetails": { - "$j": { - "boundary": "paymentDetails.bill.billDetails.boundary", - "amount": "paymentDetails.bill.billDetails.amount", - "fromPeriod": "paymentDetails.bill.billDetails.fromPeriod", - "voucherHeader": "paymentDetails.bill.billDetails.voucherHeader", - "channel": "paymentDetails.bill.billDetails.channel", - "additionalDetails": "paymentDetails.bill.billDetails.additionalDetails", - "cancellationRemarks": "paymentDetails.bill.billDetails.cancellationRemarks", - "manualReceiptDate": "paymentDetails.bill.billDetails.manualReceiptDate", - "expiryDate": "paymentDetails.bill.billDetails.expiryDate", - "collectionType": "paymentDetails.bill.billDetails.collectionType", - "displayMessage": "paymentDetails.bill.billDetails.displayMessage", - "demandId": "paymentDetails.bill.billDetails.demandId", - "amountPaid": "paymentDetails.bill.billDetails.amountPaid", - "manualReceiptNumber": "paymentDetails.bill.billDetails.manualReceiptNumber", - "billId": "paymentDetails.bill.billDetails.billId", - "auditDetails": "paymentDetails.bill.billDetails.auditDetails", - "tenantId": "paymentDetails.bill.billDetails.tenantId", - "toPeriod": "paymentDetails.bill.billDetails.toPeriod", - "billDescription": "paymentDetails.bill.billDetails.billDescription", - "id": "paymentDetails.bill.billDetails.id", - "callBackForApportioning": "paymentDetails.bill.billDetails.callBackForApportioning", - "billAccountDetails": { - "*": { - "amount": "paymentDetails.bill.billDetails.billAccountDetails.[&1].amount", - "taxHeadCode": "paymentDetails.bill.billDetails.billAccountDetails.[&1].taxHeadCode", - "purpose": "paymentDetails.bill.billDetails.billAccountDetails.[&1].purpose", - "adjustedAmount": "paymentDetails.bill.billDetails.billAccountDetails.[&1].adjustedAmount", - "auditDetails": "paymentDetails.bill.billDetails.billAccountDetails.[&1].auditDetails", - "tenantId": "paymentDetails.bill.billDetails.billAccountDetails.[&1].tenantId", - "id": "paymentDetails.bill.billDetails.billAccountDetails.[&1].id", - "billDetailId": "paymentDetails.bill.billDetails.billAccountDetails.[&1].billDetailId", - "additionalDetails": "paymentDetails.bill.billDetails.billAccountDetails.[&1].additionalDetails", - "demandDetailId": "paymentDetails.bill.billDetails.billAccountDetails.[&1].demandDetailId", - "order": "paymentDetails.bill.billDetails.billAccountDetails.[&1].order", - "isActualDemand": "paymentDetails.bill.billDetails.billAccountDetails.[&1].isActualDemand" - } - } - } - }, - "isAdvanceAllowed": "paymentDetails.bill.isAdvanceAllowed", - "businessService": "paymentDetails.bill.businessService", - "isCancelled": "paymentDetails.bill.isCancelled", - "collectionModesNotAllowed": "paymentDetails.bill.collectionModesNotAllowed", - "paidBy": "paymentDetails.bill.paidBy", - "mobileNumber": "paymentDetails.bill.mobileNumber", - "payerId": "paymentDetails.bill.payerId", - "reasonForCancellation": "paymentDetails.bill.reasonForCancellation", - "minimumAmountToBePaid": "paymentDetails.bill.minimumAmountToBePaid", - "billDate": "paymentDetails.bill.billDate", - "additionalDetails": "paymentDetails.bill.additionalDetails", - "totalAmount": "paymentDetails.bill.totalAmount", - "payerAddress": "paymentDetails.bill.payerAddress", - "auditDetails": "paymentDetails.bill.auditDetails", - "tenantId": "paymentDetails.bill.tenantId", - "payerName": "paymentDetails.bill.payerName", - "partPaymentAllowed": "paymentDetails.bill.partPaymentAllowed", - "consumerCode": "paymentDetails.bill.consumerCode", - "id": "paymentDetails.bill.id", - "billNumber": "paymentDetails.bill.billNumber", - "payerEmail": "paymentDetails.bill.payerEmail", - "status": "paymentDetails.bill.status" - }, - "totalAmountPaid": "paymentDetails.totalAmountPaid", - "additionalDetails": "paymentDetails.additionalDetails", - "manualReceiptDate": "paymentDetails.manualReceiptDate", - "manualReceiptNumber": "paymentDetails.manualReceiptNumber", - "billId": "paymentDetails.billId", - "auditDetails": "paymentDetails.auditDetails", - "tenantId": "paymentDetails.tenantId", - "id": "paymentDetails.id", - "receiptNumber": "paymentDetails.receiptNumber" - } - }, - "auditDetails": "auditDetails", - "additionalDetails": "additionalDetails", - "tenantData": "tenantData", - "@timestamp": "@timestamp" - } - } -] diff --git a/business-services/dashboard-ingest/src/main/resources/config/transform_pgr_v1.json b/business-services/dashboard-ingest/src/main/resources/config/transform_pgr_v1.json deleted file mode 100644 index e1d93fe4ca5..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/transform_pgr_v1.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "operation": "shift", - "spec": { - "tenantId": "tenantId", - "serviceRequestId": "serviceRequestId", - "complainCategory": "complainCategory", - "dateOfComplaint": "dateOfComplaint" - - } - } -] diff --git a/business-services/dashboard-ingest/src/main/resources/config/transform_pt_enhance_v1.json b/business-services/dashboard-ingest/src/main/resources/config/transform_pt_enhance_v1.json deleted file mode 100644 index 722d01a3a06..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/transform_pt_enhance_v1.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "operation": "shift", - "spec": { - "assessmentNumber": "assessmentNumber", - "assessmentDate": "assessmentDate", - "financialYear": "financialYear", - "status" : "status", - "propertyId": "propertyId" - } - } -] diff --git a/business-services/dashboard-ingest/src/main/resources/config/transform_pt_v1.json b/business-services/dashboard-ingest/src/main/resources/config/transform_pt_v1.json deleted file mode 100644 index 1bc6766b79a..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/transform_pt_v1.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "operation": "shift", - "spec": { - "tenantId": "tenantId", - "propertyId": "propertyId", - "propertyDetails": "propertyDetails", - "ward" : "ward" - } - } -] diff --git a/business-services/dashboard-ingest/src/main/resources/config/transform_target_v1.json b/business-services/dashboard-ingest/src/main/resources/config/transform_target_v1.json deleted file mode 100644 index da01e1ffeae..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/transform_target_v1.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "operation": "shift", - "spec": { - "*": { - "S. No.": "[&1].snoForMunicipalCorporation", - "Tenant Id": "[&1].tenantIdForMunicipalCorporation", - "ULB Name": "[&1].ulbName", - "Actual Collection (in Lakhs)": "[&1].actualCollectionForMunicipalCorporation", - "Budget Proposed (in Lakhs)": "[&1].budgetProposedForMunicipalCorporation", - "% Actual Collection over Budgeted": "[&1].actualCollectionBudgetedForMunicipalCorporation", - "Financial Year": "[&1].financialYear", - "Timestamp": "[&1].Timestamp", - "Sheet Name": "[&1].businessService" - } - } - } -] - - diff --git a/business-services/dashboard-ingest/src/main/resources/config/transform_tl_v1.json b/business-services/dashboard-ingest/src/main/resources/config/transform_tl_v1.json deleted file mode 100644 index 4f6ae47e902..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/transform_tl_v1.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "operation": "shift", - "spec": { - "tradelicense": { - "tenantid": "tenantId", - "calculation": "tradeLicense.calculation", - "licensenumber": "tradeLicense.licenseNumber", - "commencementdate": "tradeLicense.commencementDate", - "licensetype": "tradeLicense.licenseType", - "financialyear": "tradeLicense.finYear", - "tradename": "tradeLicense.tradeName", - "applicationnumber": "tradeLicense.applicationNumber", - "accountid": "tradeLicense.accountId", - "applicationdate": "tradeLicense.applicationDate", - "oldpropertyid": "tradeLicense.oldPropertyId", - "action": "tradeLicense.action" - }, - "ward": "ward" - } - } -] - - - - - - diff --git a/business-services/dashboard-ingest/src/main/resources/config/transform_transaction_v1.json b/business-services/dashboard-ingest/src/main/resources/config/transform_transaction_v1.json deleted file mode 100644 index 0fd6b03efde..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/transform_transaction_v1.json +++ /dev/null @@ -1,29 +0,0 @@ - [ - { - "operation": "shift", - "spec": { - "rating": { - "primary": { - "value": "Rating", - "max": "RatingRange" - }, - "*": { - "max": "SecondaryRatings.&1.Range", - "value": "SecondaryRatings.&1.Value", - "$": "SecondaryRatings.&1.Id" - } - } - } - }, - { - "operation": "default", - "spec": { - "Range": 5, - "SecondaryRatings": { - "*": { - "Range": 5 - } - } - } - } - ] diff --git a/business-services/dashboard-ingest/src/main/resources/config/validator_transaction_v1.json b/business-services/dashboard-ingest/src/main/resources/config/validator_transaction_v1.json deleted file mode 100644 index e451ebda542..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/config/validator_transaction_v1.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "transaction", - "description": "Each Transaction has to go through this validation conditions", - "type": "object", - "items": { - "type": "object", - "properties": { - "rating": { - "type": "object", - "items": { - "type": "object", - "properties": { - "primary": { - "type": "object", - "properties": { - "value": { - "type": "integer", - "minimum": 1, - "maximum": 5 - } - } - } - } - } - } - } - }, - "required": [ - "rating" - ] -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/resources/data.sql b/business-services/dashboard-ingest/src/main/resources/data.sql deleted file mode 100644 index e8d22e21f82..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/data.sql +++ /dev/null @@ -1,13 +0,0 @@ -/*DROP TABLE IF EXISTS targetcollection; - -CREATE TABLE targetcollection ( - Serial Number INT PRIMARY KEY, - City Name VARCHAR(250) NOT NULL, - Code VARCHAR(250) NOT NULL, - Budget Proposed(in Lakhs) VARCHAR(250) NOT NULL, - Actual Collection(in Lakhs) VARCHAR(250) NOT NULL - % Actual Collection over Budgeted VARCHAR(250) NOT NULL -); - -INSERT INTO targetcollection (Serial Number, City Name, Code, Budget Proposed(in Lakhs), Actual Collection(in Lakhs),% Actual Collection over Budgeted) VALUES - (?,?,?,?,?,?)*/ \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/main/resources/payment_index_mapping.json b/business-services/dashboard-ingest/src/main/resources/payment_index_mapping.json deleted file mode 100644 index 9aaa5735eaf..00000000000 --- a/business-services/dashboard-ingest/src/main/resources/payment_index_mapping.json +++ /dev/null @@ -1,2652 +0,0 @@ -{ - "mappings": { - "general": { - "properties": { - "TextField5": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "dataContext": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "dataContextVersion": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "dataObject": { - "properties": { - "additionalDetails": { - "properties": { - "bankDetails": { - "properties": { - "ADDRESS": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "BANK": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "BANKCODE": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "BRANCH": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "CENTRE": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "CITY": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "CONTACT": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "DISTRICT": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "IFSC": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "IMPS": { - "type": "boolean" - }, - "ISO3166": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "MICR": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "NEFT": { - "type": "boolean" - }, - "RTGS": { - "type": "boolean" - }, - "STATE": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "SWIFT": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "UPI": { - "type": "boolean" - } - } - }, - "isWhatsapp": { - "type": "boolean" - }, - "paidBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "taxAndPayments": { - "properties": { - "amountPaid": { - "type": "long" - }, - "billId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - } - } - }, - "auditDetails": { - "properties": { - "createdBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "createdTime": { - "type": "long" - }, - "lastModifiedBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "lastModifiedTime": { - "type": "long" - } - } - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "paidBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "payer": { - "properties": { - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "paymentDetails": { - "properties": { - "auditDetails": { - "properties": { - "createdBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "createdTime": { - "type": "long" - }, - "lastModifiedBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "lastModifiedTime": { - "type": "long" - } - } - }, - "bill": { - "properties": { - "additionalDetails": { - "properties": { - "type": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "value": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "auditDetails": { - "properties": { - "createdBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "createdTime": { - "type": "long" - }, - "lastModifiedBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "lastModifiedTime": { - "type": "long" - } - } - }, - "billDate": { - "type": "long" - }, - "billDetails": { - "properties": { - "additionalDetails": { - "properties": { - "HI": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "address": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "calculationDescription": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "comment": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "propertyId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "amount": { - "type": "long" - }, - "amountPaid": { - "type": "long" - }, - "billAccountDetails": { - "type": "nested", - "properties": { - "adjustedAmount": { - "type": "long" - }, - "amount": { - "type": "long" - }, - "billDetailId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "demandDetailId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "isActualDemand": { - "type": "boolean" - }, - "order": { - "type": "long" - }, - "purpose": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "taxHeadCode": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "billId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "callBackForApportioning": { - "type": "boolean" - }, - "demandId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "expiryDate": { - "type": "long" - }, - "fromPeriod": { - "type": "long" - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "manualReceiptDate": { - "type": "long" - }, - "manualReceiptNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "toPeriod": { - "type": "long" - } - } - }, - "billNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "businessService": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "collectionModesNotAllowed": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "consumerCode": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "isAdvanceAllowed": { - "type": "boolean" - }, - "isCancelled": { - "type": "boolean" - }, - "mobileNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "paidBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "partPaymentAllowed": { - "type": "boolean" - }, - "payerAddress": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "payerName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "status": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "totalAmount": { - "type": "long" - } - } - }, - "billId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "businessService": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "manualReceiptDate": { - "type": "long" - }, - "manualReceiptNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "receiptDate": { - "type": "date", - "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis" - }, - "receiptNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "receiptType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "totalAmountPaid": { - "type": "long" - }, - "totalDue": { - "type": "long" - } - } - }, - "paymentMode": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "paymentStatus": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantData": { - "properties": { - "OfficeTimings": { - "properties": { - "Mon - Fri": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "Sat": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "address": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "city": { - "properties": { - "code": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ddrName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "districtCode": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "districtName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "districtTenantCode": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "latitude": { - "type": "float" - }, - "localName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "longitude": { - "type": "float" - }, - "municipalityName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "regionCode": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "regionName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ulbGrade": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "code": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "contactNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "description": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "domainUrl": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "emailId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "facebookUrl": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "helpLineNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "imageId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "logoId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "pdfContactDetails": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "pdfHeader": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "pincode": { - "type": "long" - }, - "twitterUrl": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "type": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "transactionNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "domainObject": { - "properties": { - "Department": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "additionalDetail": { - "properties": { - "cb": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "code": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "additionalDetails": { - "properties": { - "adhocPenalty": { - "type": "long" - }, - "adhocPenaltyComment": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "adhocPenaltyReason": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "adhocRebate": { - "type": "long" - }, - "adhocRebateComment": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "adhocRebateReason": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "appCreatedDate": { - "type": "long" - }, - "applicationType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "avarageMeterReading": { - "type": "long" - }, - "billingType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "compositionFee": { - "type": "long" - }, - "connectionCategory": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "detailsProvidedBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "estimationFileStoreId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "estimationLetterDate": { - "type": "long" - }, - "initialMeterReading": { - "type": "long" - }, - "ledgerId": { - "type": "long" - }, - "locality": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "meterMake": { - "type": "long" - }, - "othersFee": { - "type": "long" - }, - "ownerMobileNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ownerName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "sanctionFileStoreId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "serviceType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "typeOfArchitect": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "userCharges": { - "type": "long" - }, - "waterSubUsageType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "age": { - "type": "long" - }, - "applicationNo": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "applicationStatus": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "applicationType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "assessmentsDetails": { - "type": "nested", - "properties": { - "assessmentDate": { - "type": "long" - }, - "assessmentNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "financialYear": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "propertyId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "status": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "auditDetails": { - "properties": { - "createdBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "createdTime": { - "type": "long" - }, - "lastModifiedBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "lastModifiedTime": { - "type": "long" - } - } - }, - "birthCertificateNo": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "birthDtlId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "birthPlace": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "channel": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "connectionType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "dateofbirth": { - "type": "long" - }, - "dateofdeath": { - "type": "long" - }, - "dateofissue": { - "type": "long" - }, - "dateofreport": { - "type": "long" - }, - "deathCertificateNo": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "deathDtlId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "edcrNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "gender": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "propertyId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "propertyUsageType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "riskType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "source": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "state": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "status": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tradeType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tradelicense": { - "properties": { - "accountId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "action": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "applicationDate": { - "type": "float" - }, - "applicationNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "calculation": { - "properties": { - "accessoryBillingIds": { - "properties": { - "billingSlabIds": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fee": { - "type": "long" - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "taxHeadEstimates": { - "properties": { - "category": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "estimateAmount": { - "type": "long" - }, - "taxHeadCode": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tradeTypeBillingIds": { - "properties": { - "billingSlabIds": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fee": { - "type": "long" - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - } - } - }, - "commencementDate": { - "type": "float" - }, - "financialYear": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "licenseNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "licenseType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tradeLicenseDetail": { - "properties": { - "accessories": { - "properties": { - "accessoryCategory": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "active": { - "type": "boolean" - }, - "count": { - "type": "long" - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "uom": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "uomValue": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "additionalDetail": { - "properties": { - "applicationType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "approveDetail": { - "properties": { - "check": { - "type": "boolean" - }, - "checklist": { - "properties": { - "hygieneLevels": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "localityHarmed": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "safetyNorms": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - } - } - }, - "electricityConnectionNo": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "gstNo": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "isSameAsPropertyOwner": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "propertyId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tradeGstNo": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "address": { - "properties": { - "buildingName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "city": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "doorNo": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "landmark": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "locality": { - "properties": { - "code": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "label": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "pincode": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "street": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "adhocExemption": { - "type": "long" - }, - "adhocExemptionReason": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "adhocPenalty": { - "type": "long" - }, - "adhocPenaltyReason": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "applicationDocuments": { - "properties": { - "active": { - "type": "boolean" - }, - "documentType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fileStoreId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "auditDetails": { - "properties": { - "createdBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "createdTime": { - "type": "long" - }, - "lastModifiedBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "lastModifiedTime": { - "type": "long" - } - } - }, - "channel": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "institution": { - "properties": { - "active": { - "type": "boolean" - }, - "contactNo": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "designation": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "instituionName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "noOfEmployees": { - "type": "long" - }, - "operationalArea": { - "type": "long" - }, - "owners": { - "properties": { - "accountLocked": { - "type": "boolean" - }, - "active": { - "type": "boolean" - }, - "altContactNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "correspondenceAddress": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "createdBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "createdDate": { - "type": "long" - }, - "dob": { - "type": "long" - }, - "emailId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "fatherOrHusbandName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "gender": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "id": { - "type": "long" - }, - "institutionId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "lastModifiedBy": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "lastModifiedDate": { - "type": "long" - }, - "mobileNumber": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ownerType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "pan": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "permanentAddress": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "permanentCity": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "permanentPinCode": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "photo": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "pwdExpiryDate": { - "type": "long" - }, - "relationship": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "roles": { - "properties": { - "code": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "type": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "userActive": { - "type": "boolean" - }, - "userName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "uuid": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "structureType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "subOwnerShipCategory": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tradeUnits": { - "type": "nested", - "properties": { - "active": { - "type": "boolean" - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tradeType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "uom": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "uomValue": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - } - } - }, - "tradeName": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "units": { - "type": "nested", - "properties": { - "active": { - "type": "boolean" - }, - "arv": { - "type": "long" - }, - "constructionDetail": { - "properties": { - "builtUpArea": { - "type": "long" - }, - "carpetArea": { - "type": "long" - }, - "constructionDate": { - "type": "long" - }, - "plinthArea": { - "type": "long" - }, - "superBuiltUpArea": { - "type": "long" - } - } - }, - "floorNo": { - "type": "long" - }, - "id": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "occupancyDate": { - "type": "long" - }, - "occupancyType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "tenantId": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "unitType": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "usageCategory": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - }, - "usageCategory": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "ward": { - "properties": { - "area": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "boundaryNum": { - "type": "long" - }, - "children": { - "properties": { - "area": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "boundaryNum": { - "type": "long" - }, - "code": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "label": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "pincode": { - "type": "long" - } - } - }, - "code": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "label": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "name": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - }, - "pincode": { - "type": "long" - } - } - } - } - }, - "identifier": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 256 - } - } - } - } - } - } -} \ No newline at end of file diff --git a/business-services/dashboard-ingest/src/test/java/com/ingestpipeline/testcases/IngestTestClient.java b/business-services/dashboard-ingest/src/test/java/com/ingestpipeline/testcases/IngestTestClient.java deleted file mode 100644 index ea23eb13bad..00000000000 --- a/business-services/dashboard-ingest/src/test/java/com/ingestpipeline/testcases/IngestTestClient.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ingestpipeline.testcases; - -import java.util.LinkedHashMap; -import java.util.List; - -import org.springframework.web.client.RestTemplate; - - -public class IngestTestClient { - - public static final String REST_SERVICE_URI = "http://localhost:8081/ingest/api"; - - /* GET */ - @SuppressWarnings("unchecked") - private static void listAllUsers(){ - System.out.println("Testing listAllUsers API-----------"); - - RestTemplate restTemplate = new RestTemplate(); - List> usersMap = restTemplate.getForObject(REST_SERVICE_URI+"/user/", List.class); - - if(usersMap!=null){ - for(LinkedHashMap map : usersMap){ - System.out.println("User : id="+map.get("id")+", Name="+map.get("name")+", Age="+map.get("age")+", Salary="+map.get("salary"));; - } - }else{ - System.out.println("No user exist----------"); - } - } - - /* DELETE */ - private static void deleteUser() { - System.out.println("Testing delete User API----------"); - RestTemplate restTemplate = new RestTemplate(); - restTemplate.delete(REST_SERVICE_URI+"/user/3"); - } - - - /* DELETE */ - private static void deleteAllUsers() { - System.out.println("Testing all delete Users API----------"); - RestTemplate restTemplate = new RestTemplate(); - restTemplate.delete(REST_SERVICE_URI+"/user/"); - } - - public static void main(String args[]){ - listAllUsers(); - listAllUsers(); - listAllUsers(); - //deleteUser(); - listAllUsers(); - //deleteAllUsers(); - listAllUsers(); - } -} \ No newline at end of file diff --git a/business-services/egf-instrument/.gitignore b/business-services/egf-instrument/.gitignore deleted file mode 100644 index 2af7cefb0a3..00000000000 --- a/business-services/egf-instrument/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ \ No newline at end of file diff --git a/business-services/egf-instrument/CHANGELOG.md b/business-services/egf-instrument/CHANGELOG.md deleted file mode 100644 index 9460b47c76b..00000000000 --- a/business-services/egf-instrument/CHANGELOG.md +++ /dev/null @@ -1,18 +0,0 @@ -# Changelog -All notable changes to this module will be documented in this file. -## 1.1.4 - 2022-01-13 -- Updated to log4j2 version 2.17.1 - -## 1.1.2 - 2021-02-26 -- Updated domain name in application.properties - -## 1.1.1 - 2020-10-09 -- Ignore and start server even Kafka topic is missing - -## 1.1.0 - 2020-06-22 -- Upgraded to `tracer:2.0.0-SNAPSHOT` -- Upgraded to `Spring boot 2.2.6` - -## 1.0.0 - -- Base version diff --git a/business-services/egf-instrument/LOCALSETUP.md b/business-services/egf-instrument/LOCALSETUP.md deleted file mode 100644 index 7b3b45f5d46..00000000000 --- a/business-services/egf-instrument/LOCALSETUP.md +++ /dev/null @@ -1,30 +0,0 @@ -# Local Setup - -To setup the egf-instrument service in your local system, clone the [Business services repository](https://github.com/egovernments/business-services). - -## Dependencies - - -### Infra Dependency - -- [X] Postgres DB -- [ ] Redis -- [ ] Elasticsearch -- [X] Kafka - - [X] Consumer - - [X] Producer - -## Running Locally - -To run the egf-instrument service locally, you need to port forward below services. - -```bash -function kgpt(){kubectl get pods -n egov --selector=app=$1 --no-headers=true | head -n1 | awk '{print $1}'} -kubectl port-forward -n egov $(kgpt egf-master) 8081:8080 -``` - -Update below listed properties in `application.properties` before running the project: - -```ini -egov.services.egfmaster.hostname = http://127.0.0.1:8081 -``` diff --git a/business-services/egf-instrument/README.md b/business-services/egf-instrument/README.md deleted file mode 100644 index dce2bee2e12..00000000000 --- a/business-services/egf-instrument/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# egf-instrument service - -egf-instrument service used to create, search, update and delete instruments. - -### DB UML Diagram - -NA - -### Service Dependencies - -- egf-master - -### Swagger API Contract - -NA - -## Service Details - -egf-instrument service used to create, search, update and delete instruments. - -### API Details - -`/instruments/_create` : API to create instrument -`/instruments/_update` : API to update instrument -`/instruments/_delete` : API to delete instrument -`/instruments/_search` : API to search instrument - -### Kafka Consumers - -kafka.topics.egf.instrument.validated.topic : egov.egf.instrument.validated.topic - Kafka Consumer listens to this topic and create/update/delete instrument and publish and event to kafka - -### Kafka Producers - -kafka.topics.egf.instrument.completed.topic=egov.egf.instrument.completed - Kafka Producer publishes an event to this topic with the instrument information diff --git a/business-services/egf-instrument/mvnw b/business-services/egf-instrument/mvnw deleted file mode 100644 index 5bf251c0774..00000000000 --- a/business-services/egf-instrument/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/business-services/egf-instrument/mvnw.cmd b/business-services/egf-instrument/mvnw.cmd deleted file mode 100644 index 019bd74d766..00000000000 --- a/business-services/egf-instrument/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/business-services/egf-instrument/pom.xml b/business-services/egf-instrument/pom.xml deleted file mode 100644 index 01af863b751..00000000000 --- a/business-services/egf-instrument/pom.xml +++ /dev/null @@ -1,207 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - org.egov - egf-instrument - 1.1.4-SNAPSHOT - egf-instrument - egf instrument service for egov services - - 2.17.1 - UTF-8 - 1.8 - UTF-8 - 1.18.8 - - - - org.flywaydb - flyway-core - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework.kafka - spring-kafka - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - org.postgresql - postgresql - runtime - - - org.projectlombok - lombok - true - - - org.elasticsearch.client - transport - - - - org.elasticsearch - elasticsearch - - - - org.apache.logging.log4j - log4j-to-slf4j - 2.8.2 - - - org.apache.commons - commons-lang3 - 3.0 - - - commons-io - commons-io - 2.5 - - - org.egov.services - tracer - 2.1.0-SNAPSHOT - - - org.egov.services - services-common - 0.11.1 - - - org.egov - egf-master - 0.0.1 - common - - - org.egov - egf-master - 0.0.1 - client - - - org.springframework.boot - spring-boot-starter-test - test - - - - - repo.egovernments.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - - default-prepare-agent - - prepare-agent - - - - default-report - prepare-package - - report - - - - default-check - - check - - - - - CLASS - - org.egov.EgfInstrumentApplication - org.egov.egf.instrument.persistence.queue.* - org.egov.egf.instrument.web.advice.CustomControllerAdvice - org.egov.egf.instrument.web.contract.* - org.egov.egf.instrument.persistence.entity.* - org.egov.egf.instrument.domain.model.* - org.egov.egf.instrument.web.requests.* - org.egov.egf.instrument.domain.repository.InstrumentTypeESRepository - org.egov.egf.instrument.domain.repository.InstrumentAccountCodeESRepository - org.egov.egf.instrument.domain.repository.InstrumentESRepository - org.egov.egf.instrument.domain.repository.SurrenderReasonESRepository - org.egov.egf.instrument.domain.repository.ElasticSearchQueryFactory - org.egov.egf.instrument.domain.repository.ElasticSearchUtils - org.egov.egf.instrument.persistence.repository.InstrumentJdbcRepository - org.egov.egf.instrument.web.mapper.InstrumentTypeMapper: - - - - LINE - COVEREDRATIO - 0.05 - - - - - BUNDLE - - - COMPLEXITY - COVEREDRATIO - 0.05 - - - - - - - - - - - diff --git a/business-services/egf-instrument/src/main/java/org/egov/EgfInstrumentApplication.java b/business-services/egf-instrument/src/main/java/org/egov/EgfInstrumentApplication.java deleted file mode 100644 index e5260fd0ccf..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/EgfInstrumentApplication.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.egov; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.tracer.config.TracerConfiguration; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.transport.client.PreBuiltTransportClient; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -import javax.annotation.PostConstruct; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.text.SimpleDateFormat; -import java.util.TimeZone; - -@Import({ TracerConfiguration.class }) -@SpringBootApplication -public class EgfInstrumentApplication { - - public static void main(String[] args) { - SpringApplication.run(EgfInstrumentApplication.class, args); - } - - private static final String CLUSTER_NAME = "cluster.name"; - - @Value("${app.timezone}") - private String timeZone; - - @Value("${es.host}") - private String elasticSearchHost; - - @Value("${es.transport.port}") - private Integer elasticSearchTransportPort; - - @Value("${es.cluster.name}") - private String elasticSearchClusterName; - - private TransportClient client; - - @PostConstruct - public void init() throws UnknownHostException { - TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); - Settings settings = Settings.builder().put(CLUSTER_NAME, elasticSearchClusterName).build(); - final InetAddress esAddress = InetAddress.getByName(elasticSearchHost); - final TransportAddress transportAddress = new TransportAddress(esAddress, elasticSearchTransportPort); - client = new PreBuiltTransportClient(settings).addTransportAddress(transportAddress); - } - - @Bean - public MappingJackson2HttpMessageConverter jacksonConverter() { - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - ObjectMapper mapper = new ObjectMapper(); - mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - // mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, - // false); - mapper.setDateFormat(new SimpleDateFormat("dd-MM-yyyy")); - mapper.setTimeZone(TimeZone.getTimeZone(timeZone)); - converter.setObjectMapper(mapper); - return converter; - } - - @Bean - public WebMvcConfigurerAdapter webMvcConfigurerAdapter() { - return new WebMvcConfigurerAdapter() { - - @Override - public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { - configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8); - } - - }; - } - - @Bean - public TransportClient getTransportClient() { - return client; - } - - @Bean - public RestTemplate restTemplate() { - return new RestTemplate(); - } - - @Bean - public FlywayMigrationStrategy cleanMigrateStrategy() { - return flyway -> { - flyway.repair(); - flyway.migrate(); - }; - } -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/DishonorReason.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/DishonorReason.java deleted file mode 100644 index c96ccf4fb83..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/DishonorReason.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -import javax.validation.constraints.Size; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.NotBlank; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class DishonorReason extends Auditable { - /** - * id is the unique Identifier of the reason - */ - private String id; - /** - * name is the reason of instrument surrender. Example "Damaged cheque", "Cheque to be scrapped" etc - */ - @NotBlank - @Size(max = 50, min = 5) - private String reason; - /** - * description is detailed description of the surrender of a instrument - */ - @NotBlank - @Size(max = 250) - private String remarks; - private String instrument; - private String reversalVoucherId; - private Long dishonorDate; - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/DishonorReasonSearch.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/DishonorReasonSearch.java deleted file mode 100644 index 95d750351d1..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/DishonorReasonSearch.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class DishonorReasonSearch extends DishonorReason { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/ECSType.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/ECSType.java deleted file mode 100644 index 7d51f5509d8..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/ECSType.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.instrument.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class ECSType { - - /* - * id is the unique reference to ECS type entered in the system. - */ - private String id; - - /* - * type will give you name of the ECSType of ECS receipt made. Ex - ICICI, ONLINE, etc,. - */ - private String type; - - /* - * active specifies whether the type is active for transacting. - */ - - private String active; - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/Instrument.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/Instrument.java deleted file mode 100644 index d6fb95429bc..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/Instrument.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.instrument.domain.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.domain.model.Auditable; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.hibernate.validator.constraints.NotBlank; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class Instrument extends Auditable { - - /* - * id is the unique reference to Instrument Header entered in the system. - */ - private String id; - - /* - * transactionNumber unique number of the instrument. For cheque type this is cheque date. For DD type it is DD number - */ - @NotBlank - @Size(max = 50) - private String transactionNumber; - - /* - * transactionDate is the date of instrument . For cheque type it is cheque date. for DD it is DD date - */ - @NotNull - private Date transactionDate; - - /* - * amount is the instrument amount. For cheque type it is cheque amount. - */ - @NotNull - @Min(value = 1) - @Max(value = 999999999) - private BigDecimal amount; - - /* - * instrumentType specifies the type of the instrument - The folowing are the different types Cash,Cheque,DD,POC - */ - @NotNull - private InstrumentType instrumentType; - - /* - * bank references to the bank from which the payment/Receipt is made. - */ - private BankContract bank; - - /* - * branchName is the branch name entered in the collection Receipt. - */ - - @Size(max = 50) - private String branchName; - - /* - * bankAccount is the reference of the Bank account from which the payment instrument is assigned - */ - private BankAccountContract bankAccount; - - /* - * instrumentStatus gives the current status of the instrument. - */ - private FinancialStatusContract financialStatus; - - private String remittanceVoucherId; - - /* - * transactionType are of two kinds -Debit and Credit. When its a receipt instrument it is Debit and in case of payment - * instrument its credit. - */ - @NotNull - private TransactionType transactionType; - - /* - * payee is the entity who is making the payment via instrument - */ - @Size(max = 50) - private String payee; - - /* - * drawer is the entity to which the payment is made. - */ - @Size(max = 100) - private String drawer; - - /* - * surrendarReason is the reason from the defined list seleted while surrendering a payment cheque. Depending on the reason, - * the cheque can be re-used or not is decided. - */ - private SurrenderReason surrenderReason; - - private DishonorReason dishonorReason; - /* - * serialNo is the series of the cheque numbers from which the instrument is assigned from. The cheque numbers in an account - * is defined based on Year, Bank account and tagged to a department. - */ - // @NotBlank - @Size(max = 50, min = 2) - private String serialNo; - - @Size(max = 256) - private String payinSlipId; - - @Min(value = 1) - @Max(value = 999999999) - private BigDecimal reconciledAmount; - - private Date reconciledOn; - - /* - * instrumentVouchers is the reference to the payment vouchers for which the instrument is attached. - */ - // @DrillDownTable - private List instrumentVouchers = new ArrayList<>(); - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentAccountCode.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentAccountCode.java deleted file mode 100644 index 1020289fbca..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentAccountCode.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.instrument.domain.model; - -import org.egov.common.domain.model.Auditable; -import org.egov.egf.master.web.contract.ChartOfAccountContract; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "instrumentType" }, callSuper = false) -public class InstrumentAccountCode extends Auditable { - - /* - * id is the unique reference to Instrument AccountCodes entered in the system. - */ - private String id; - - /* - * instrumentType specifies the mode/type of transaction that can be made - i.e Cheque,DD,RTGS. For receipt - Cheque,DD,RTGS - */ - private InstrumentType instrumentType; - - /* - * accountCode is the COA that is tagged to a instrument type used in ledger posting. - */ - private ChartOfAccountContract accountCode; - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentAccountCodeSearch.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentAccountCodeSearch.java deleted file mode 100644 index 9cfce0325cc..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentAccountCodeSearch.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentAccountCodeSearch extends InstrumentAccountCode { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentSearch.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentSearch.java deleted file mode 100644 index 8e0b611b99b..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentSearch.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -import java.util.Date; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentSearch extends Instrument { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private String instrumentTypes; - private String financialStatuses; - private Date transactionFromDate; - private Date transactionToDate; - private String receiptIds; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentType.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentType.java deleted file mode 100644 index cbd805def54..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentType.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.instrument.domain.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.NotBlank; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class InstrumentType extends Auditable { - - /* - * id is the unique reference to instrument type entered in the system. - */ - private String id; - - /* - * type specifies the mode/type of transaction that can be made - i.e Cheque,DD,RTGS. For receipt - Cheque,DD,RTGS - */ - @NotNull - @NotBlank - @Size(max = 50, min = 2) - private String name; - - /* - * description specifies details of the instrument type . For example type DD description may be Demand Draft - */ - - @Size(max = 100) - private String description; - - /* - * active specifies whether the type is active for transacting. - */ - @NotNull - private Boolean active; - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentTypeProperty.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentTypeProperty.java deleted file mode 100644 index ea68c221552..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentTypeProperty.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.egov.egf.master.web.contract.FinancialStatusContract; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class InstrumentTypeProperty extends Auditable { - - private String id; - @NotNull - private TransactionType transactionType; - @NotNull - private Boolean reconciledOncreate; - @NotNull - private FinancialStatusContract statusOnCreate; - @NotNull - private FinancialStatusContract statusOnUpdate; - @NotNull - private FinancialStatusContract statusOnReconcile; - @NotNull - private InstrumentType instrumentType; - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentTypeSearch.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentTypeSearch.java deleted file mode 100644 index 83f27e118ee..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentTypeSearch.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class InstrumentTypeSearch extends InstrumentType { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentVoucher.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentVoucher.java deleted file mode 100644 index e9beec9fc70..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentVoucher.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.instrument.domain.model; - -import org.egov.common.domain.model.Auditable; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class InstrumentVoucher extends Auditable { - - /* - * instrumentHeaderId is the reference of the instrument attached to a voucher - */ - private Instrument instrument; - - /* - * voucherHeaderId is the reference of the voucher attached to a instrument. - */ - private String voucherHeaderId; - - /* - * receiptHeaderId is the reference of the receipt attached to a instrument. - */ - private String receiptHeaderId; - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentVoucherSearch.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentVoucherSearch.java deleted file mode 100644 index 80bae2bd0b4..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/InstrumentVoucherSearch.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentVoucherSearch extends InstrumentVoucher { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private String instruments; - private String receiptIds; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/SurrenderReason.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/SurrenderReason.java deleted file mode 100644 index 27a53c7ae04..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/SurrenderReason.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -import javax.validation.constraints.Size; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.NotBlank; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class SurrenderReason extends Auditable { - /** - * id is the unique Identifier of the reason - */ - private String id; - /** - * name is the reason of instrument surrender. Example "Damaged cheque", "Cheque to be scrapped" etc - */ - @NotBlank - @Size(max = 50, min = 5) - private String name; - /** - * description is detailed description of the surrender of a instrument - */ - @NotBlank - @Size(max = 250) - private String description; - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/SurrenderReasonSearch.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/SurrenderReasonSearch.java deleted file mode 100644 index dd50c41f510..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/SurrenderReasonSearch.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SurrenderReasonSearch extends SurrenderReason { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/TransactionType.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/TransactionType.java deleted file mode 100644 index c4624899348..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/model/TransactionType.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.egov.egf.instrument.domain.model; - -public enum TransactionType { - Debit, Credit - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/DishonorReasonRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/DishonorReasonRepository.java deleted file mode 100644 index 7814a70b94f..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/DishonorReasonRepository.java +++ /dev/null @@ -1,223 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.DishonorReason; -import org.egov.egf.instrument.domain.model.DishonorReasonSearch; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.persistence.entity.DishonorReasonEntity; -import org.egov.egf.instrument.persistence.entity.SurrenderReasonEntity; -import org.egov.egf.instrument.persistence.queue.repository.SurrenderReasonQueueRepository; -import org.egov.egf.instrument.persistence.repository.DishonorReasonJdbcRepository; -import org.egov.egf.instrument.persistence.repository.SurrenderReasonJdbcRepository; -import org.egov.egf.instrument.web.contract.DishonorReasonSearchContract; -import org.egov.egf.instrument.web.contract.SurrenderReasonSearchContract; -import org.egov.egf.instrument.web.mapper.DishonorReasonMapper; -import org.egov.egf.instrument.web.mapper.SurrenderReasonMapper; -import org.egov.egf.instrument.web.requests.DishonorReasonRequest; -import org.egov.egf.instrument.web.requests.SurrenderReasonRequest; -import org.egov.egf.master.web.repository.FinancialConfigurationContractRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class DishonorReasonRepository { - - private DishonorReasonJdbcRepository dishonorReasonJdbcRepository; - -// private SurrenderReasonQueueRepository surrenderReasonQueueRepository; - - private String persistThroughKafka; - - private FinancialConfigurationContractRepository financialConfigurationContractRepository; - - private SurrenderReasonESRepository surrenderReasonESRepository; - - @Autowired - public DishonorReasonRepository(DishonorReasonJdbcRepository dishonorReasonJdbcRepository, - @Value("${persist.through.kafka}") String persistThroughKafka, - FinancialConfigurationContractRepository financialConfigurationContractRepository, - SurrenderReasonESRepository surrenderReasonESRepository) { - this.dishonorReasonJdbcRepository = dishonorReasonJdbcRepository; -// this.surrenderReasonQueueRepository = surrenderReasonQueueRepository; - this.persistThroughKafka = persistThroughKafka; - this.financialConfigurationContractRepository = financialConfigurationContractRepository; - this.surrenderReasonESRepository = surrenderReasonESRepository; - - } - - public DishonorReason findById(DishonorReason dishonorReason) { - DishonorReasonEntity entity = dishonorReasonJdbcRepository - .findById(new DishonorReasonEntity().toEntity(dishonorReason)); - if (entity != null) - return entity.toDomain(); - - return null; - - } - - @Transactional - public List save(List dishonorReasons, RequestInfo requestInfo) { - - DishonorReasonMapper mapper = new DishonorReasonMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - DishonorReasonRequest request = new DishonorReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (DishonorReason iac : dishonorReasons) - request.getSurrenderReasons().add(mapper.toContract(iac)); - -// surrenderReasonQueueRepository.addToQue(request); - - return dishonorReasons; - } else { - - List resultList = new ArrayList(); - - for (DishonorReason iac : dishonorReasons) - resultList.add(save(iac)); - - DishonorReasonRequest request = new DishonorReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - -// for (SurrenderReason iac : resultList) -// request.getSurrenderReasons().add(mapper.toContract(iac)); -// -// dishonorReasonQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List update(List dishonorReasons, RequestInfo requestInfo) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); -// request.setdishonorReasons(new ArrayList<>()); - - for (SurrenderReason iac : dishonorReasons) - request.getSurrenderReasons().add(mapper.toContract(iac)); - -// dishonorReasonQueueRepository.addToQue(request); - - return dishonorReasons; - } else { - - List resultList = new ArrayList(); - -// for (SurrenderReason iac : dishonorReasons) -// resultList.add(update(iac)); - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (SurrenderReason iac : resultList) - request.getSurrenderReasons().add(mapper.toContract(iac)); - -// surrenderReasonQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List delete(List surrenderReasons, RequestInfo requestInfo) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (SurrenderReason iac : surrenderReasons) - request.getSurrenderReasons().add(mapper.toContract(iac)); - -// surrenderReasonQueueRepository.addToQue(request); - - return surrenderReasons; - } else { - - List resultList = new ArrayList(); - -// for (SurrenderReason iac : surrenderReasons) -// resultList.add(delete(iac)); - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (SurrenderReason iac : resultList) - request.getSurrenderReasons().add(mapper.toContract(iac)); - -// surrenderReasonQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public DishonorReason save(DishonorReason dishonorReason) { - DishonorReasonEntity entity = dishonorReasonJdbcRepository - .create(new DishonorReasonEntity().toEntity(dishonorReason)); - return entity.toDomain(); - } - - @Transactional - public DishonorReason update(DishonorReason dishonorReason) { - DishonorReasonEntity entity = dishonorReasonJdbcRepository - .update(new DishonorReasonEntity().toEntity(dishonorReason)); - return entity.toDomain(); - } - - @Transactional - public DishonorReason delete(DishonorReason surrenderReason) { - DishonorReasonEntity entity = dishonorReasonJdbcRepository - .delete(new DishonorReasonEntity().toEntity(surrenderReason)); - return entity.toDomain(); - } - - public Pagination search(DishonorReasonSearch domain) { - -// if (financialConfigurationContractRepository.fetchDataFrom() != null -// && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { -// -// DishonorReasonMapper mapper = new DishonorReasonMapper(); -// DishonorReasonSearchContract dishonorReasonSearchContract = new DishonorReasonSearchContract(); -// dishonorReasonSearchContract = mapper.toSearchContract(domain); -// -// return surrenderReasonESRepository.search(dishonorReasonSearchContract); -// -// } else - return dishonorReasonJdbcRepository.search(domain); - - } - - public boolean uniqueCheck(String fieldName, DishonorReason dishonorReason) { - return dishonorReasonJdbcRepository.uniqueCheck(fieldName, new DishonorReasonEntity().toEntity(dishonorReason)); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/ElasticSearchQueryFactory.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/ElasticSearchQueryFactory.java deleted file mode 100644 index a63a6104b20..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/ElasticSearchQueryFactory.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import static org.elasticsearch.index.query.QueryBuilders.boolQuery; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.egov.common.util.ElasticSearchUtils; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeSearchContract; -import org.egov.egf.instrument.web.contract.InstrumentSearchContract; -import org.egov.egf.instrument.web.contract.InstrumentTypeSearchContract; -import org.egov.egf.instrument.web.contract.SurrenderReasonSearchContract; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ElasticSearchQueryFactory { - - @Autowired - private ElasticSearchUtils elasticSearchUtils; - - public BoolQueryBuilder searchInstrument(InstrumentSearchContract instrumentSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (instrumentSearchContract.getIds() != null && !instrumentSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(instrumentSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getTransactionNumber(), "transactionNumber", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getTransactionDate(), "transactionDate", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getAmount(), "amount", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getInstrumentType(), "instrumentType", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getBank(), "bank", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getBranchName(), "branchName", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getBankAccount(), "bankAccount", boolQueryBuilder); - - elasticSearchUtils.add(instrumentSearchContract.getFinancialStatus(), "financialStatus", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getTransactionType(), "transactionType", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getPayee(), "payee", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getDrawer(), "drawer", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getSurrenderReason(), "surrenderReason", boolQueryBuilder); - elasticSearchUtils.add(instrumentSearchContract.getSerialNo(), "serialNo", boolQueryBuilder); - if (!instrumentSearchContract.getInstrumentVouchers().isEmpty()) - elasticSearchUtils.add(instrumentSearchContract.getInstrumentVouchers(), "instrumentVouchers", boolQueryBuilder); - - return boolQueryBuilder; - } - - public BoolQueryBuilder searchInstrumentType(InstrumentTypeSearchContract instrumentTypeSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (instrumentTypeSearchContract.getIds() != null && !instrumentTypeSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(instrumentTypeSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(instrumentTypeSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(instrumentTypeSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(instrumentTypeSearchContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(instrumentTypeSearchContract.getActive(), "active", boolQueryBuilder); - // elasticSearchUtils.add(instrumentTypeSearchContract.getInstrumentTypeProperties(), "instrumentTypeProperties", - // boolQueryBuilder); - return boolQueryBuilder; - } - - public BoolQueryBuilder searchInstrumentAccountCode(InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (instrumentAccountCodeSearchContract.getIds() != null && !instrumentAccountCodeSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(instrumentAccountCodeSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(instrumentAccountCodeSearchContract.getInstrumentType(), "instrumentType", boolQueryBuilder); - elasticSearchUtils.add(instrumentAccountCodeSearchContract.getAccountCode(), "accountCode", boolQueryBuilder); - return boolQueryBuilder; - } - - public BoolQueryBuilder searchSurrenderReason(SurrenderReasonSearchContract surrenderReasonSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (surrenderReasonSearchContract.getIds() != null && !surrenderReasonSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(surrenderReasonSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(surrenderReasonSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(surrenderReasonSearchContract.getDescription(), "description", boolQueryBuilder); - return boolQueryBuilder; - } - - public List prepareOrderBys(String sortBy) { - List orderByList = new ArrayList(); - List sortByList = new ArrayList(); - if (sortBy.contains(",")) - sortByList = Arrays.asList(sortBy.split(",")); - else - sortByList = Arrays.asList(sortBy); - for (String s : sortByList) - if (s.contains(" ") && (s.toLowerCase().trim().endsWith("asc") || s.toLowerCase().trim().endsWith("desc"))) - orderByList.add(s.trim()); - else - orderByList.add(s.trim() + " asc"); - - return orderByList; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentAccountCodeESRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentAccountCodeESRepository.java deleted file mode 100644 index ac7f614a4ce..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentAccountCodeESRepository.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.persistence.entity.InstrumentAccountCodeEntity; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class InstrumentAccountCodeESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger logger = LoggerFactory.getLogger(InstrumentAccountCodeESRepository.class); - - public InstrumentAccountCodeESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(instrumentAccountCodeSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToInstrumentAccountCodeList(searchResponse); - } - - @SuppressWarnings("deprecation") - private Pagination mapToInstrumentAccountCodeList(SearchResponse searchResponse) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) - return page; - List instrumentAccountCodes = new ArrayList(); - InstrumentAccountCode instrumentAccountCode = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - instrumentAccountCode = mapper.readValue(hit.getSourceAsString(), InstrumentAccountCode.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - logger.error("Error occurred while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - logger.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - logger.error("IO exception occured: " + e1.getMessage()); - } - - instrumentAccountCodes.add(instrumentAccountCode); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(instrumentAccountCodes); - - return page; - } - - private SearchRequestBuilder getSearchRequest(InstrumentAccountCodeSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), InstrumentAccountCodeEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchInstrumentAccountCode(criteria); - SearchRequestBuilder searchRequestBuilder = esClient - .prepareSearch(InstrumentAccountCode.class.getSimpleName().toLowerCase()) - .setTypes(InstrumentAccountCode.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) - for (String orderBy : orderByList) - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentAccountCodeRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentAccountCodeRepository.java deleted file mode 100644 index f90ebbc6957..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentAccountCodeRepository.java +++ /dev/null @@ -1,221 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.persistence.entity.InstrumentAccountCodeEntity; -import org.egov.egf.instrument.persistence.queue.repository.InstrumentAccountCodeQueueRepository; -import org.egov.egf.instrument.persistence.repository.InstrumentAccountCodeJdbcRepository; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeSearchContract; -import org.egov.egf.instrument.web.mapper.InstrumentAccountCodeMapper; -import org.egov.egf.instrument.web.requests.InstrumentAccountCodeRequest; -import org.egov.egf.master.web.repository.FinancialConfigurationContractRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class InstrumentAccountCodeRepository { - - private InstrumentAccountCodeJdbcRepository instrumentAccountCodeJdbcRepository; - - private InstrumentAccountCodeQueueRepository instrumentAccountCodeQueueRepository; - - private String persistThroughKafka; - - private InstrumentAccountCodeESRepository instrumentAccountCodeESRepository; - - private FinancialConfigurationContractRepository financialConfigurationContractRepository; - - @Autowired - public InstrumentAccountCodeRepository(InstrumentAccountCodeJdbcRepository instrumentAccountCodeJdbcRepository, - InstrumentAccountCodeQueueRepository instrumentAccountCodeQueueRepository, - @Value("${persist.through.kafka}") String persistThroughKafka, - InstrumentAccountCodeESRepository instrumentAccountCodeESRepository, - FinancialConfigurationContractRepository financialConfigurationContractRepository) { - this.instrumentAccountCodeJdbcRepository = instrumentAccountCodeJdbcRepository; - this.instrumentAccountCodeQueueRepository = instrumentAccountCodeQueueRepository; - this.persistThroughKafka = persistThroughKafka; - this.financialConfigurationContractRepository = financialConfigurationContractRepository; - this.instrumentAccountCodeESRepository = instrumentAccountCodeESRepository; - - } - - public InstrumentAccountCode findById(InstrumentAccountCode instrumentAccountCode) { - InstrumentAccountCodeEntity entity = instrumentAccountCodeJdbcRepository - .findById(new InstrumentAccountCodeEntity().toEntity(instrumentAccountCode)); - if (entity != null) - return entity.toDomain(); - - return null; - - } - - @Transactional - public List save(List instrumentAccountCodes, - RequestInfo requestInfo) { - - InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentAccountCodes(new ArrayList<>()); - - for (InstrumentAccountCode iac : instrumentAccountCodes) - request.getInstrumentAccountCodes().add(mapper.toContract(iac)); - - instrumentAccountCodeQueueRepository.addToQue(request); - - return instrumentAccountCodes; - } else { - - List resultList = new ArrayList(); - - for (InstrumentAccountCode iac : instrumentAccountCodes) - resultList.add(save(iac)); - - InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentAccountCodes(new ArrayList<>()); - - for (InstrumentAccountCode iac : resultList) - request.getInstrumentAccountCodes().add(mapper.toContract(iac)); - - instrumentAccountCodeQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List update(List instrumentAccountCodes, - RequestInfo requestInfo) { - - InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentAccountCodes(new ArrayList<>()); - - for (InstrumentAccountCode iac : instrumentAccountCodes) - request.getInstrumentAccountCodes().add(mapper.toContract(iac)); - - instrumentAccountCodeQueueRepository.addToQue(request); - - return instrumentAccountCodes; - } else { - - List resultList = new ArrayList(); - - for (InstrumentAccountCode iac : instrumentAccountCodes) - resultList.add(update(iac)); - - InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentAccountCodes(new ArrayList<>()); - - for (InstrumentAccountCode iac : resultList) - request.getInstrumentAccountCodes().add(mapper.toContract(iac)); - - instrumentAccountCodeQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List delete(List instrumentAccountCodes, - RequestInfo requestInfo) { - - InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentAccountCodes(new ArrayList<>()); - - for (InstrumentAccountCode iac : instrumentAccountCodes) - request.getInstrumentAccountCodes().add(mapper.toContract(iac)); - - instrumentAccountCodeQueueRepository.addToQue(request); - - return instrumentAccountCodes; - } else { - - List resultList = new ArrayList(); - - for (InstrumentAccountCode iac : instrumentAccountCodes) - resultList.add(delete(iac)); - - InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentAccountCodes(new ArrayList<>()); - - for (InstrumentAccountCode iac : resultList) - request.getInstrumentAccountCodes().add(mapper.toContract(iac)); - - instrumentAccountCodeQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public InstrumentAccountCode save(InstrumentAccountCode instrumentAccountCode) { - InstrumentAccountCodeEntity entity = instrumentAccountCodeJdbcRepository - .create(new InstrumentAccountCodeEntity().toEntity(instrumentAccountCode)); - return entity.toDomain(); - } - - @Transactional - public InstrumentAccountCode update(InstrumentAccountCode instrumentAccountCode) { - InstrumentAccountCodeEntity entity = instrumentAccountCodeJdbcRepository - .update(new InstrumentAccountCodeEntity().toEntity(instrumentAccountCode)); - return entity.toDomain(); - } - - @Transactional - public InstrumentAccountCode delete(InstrumentAccountCode instrumentAccountCode) { - InstrumentAccountCodeEntity entity = instrumentAccountCodeJdbcRepository - .delete(new InstrumentAccountCodeEntity().toEntity(instrumentAccountCode)); - return entity.toDomain(); - } - - public Pagination search(InstrumentAccountCodeSearch domain) { - - if (financialConfigurationContractRepository.fetchDataFrom() != null - && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { - - InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); - InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract = new InstrumentAccountCodeSearchContract(); - instrumentAccountCodeSearchContract = mapper.toSearchContract(domain); - - return instrumentAccountCodeESRepository.search(instrumentAccountCodeSearchContract); - - } else - return instrumentAccountCodeJdbcRepository.search(domain); - - } - - public boolean uniqueCheck(String fieldName, InstrumentAccountCode instrumentAccountCode) { - return instrumentAccountCodeJdbcRepository.uniqueCheck(fieldName, - new InstrumentAccountCodeEntity().toEntity(instrumentAccountCode)); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentESRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentESRepository.java deleted file mode 100644 index 1776f4b0af6..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentESRepository.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.persistence.entity.InstrumentEntity; -import org.egov.egf.instrument.web.contract.InstrumentSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class InstrumentESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger logger = LoggerFactory.getLogger(InstrumentESRepository.class); - - public InstrumentESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(InstrumentSearchContract instrumentSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(instrumentSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToInstrumentList(searchResponse); - } - - @SuppressWarnings("deprecation") - protected Pagination mapToInstrumentList(SearchResponse searchResponse) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) - return page; - List instruments = new ArrayList(); - Instrument instrument = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - instrument = mapper.readValue(hit.getSourceAsString(), Instrument.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - logger.error("Error occurred while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - logger.error("JSON Mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - logger.error("IO Exception occurred: " + e1.getMessage()); - } - - instruments.add(instrument); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(instruments); - - return page; - } - - protected SearchRequestBuilder getSearchRequest(InstrumentSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), InstrumentEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchInstrument(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(Instrument.class.getSimpleName().toLowerCase()) - .setTypes(Instrument.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) - for (String orderBy : orderByList) - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentRepository.java deleted file mode 100644 index 979d4d257ab..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentRepository.java +++ /dev/null @@ -1,239 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.model.InstrumentVoucher; -import org.egov.egf.instrument.persistence.entity.DishonorReasonEntity; -import org.egov.egf.instrument.persistence.entity.InstrumentEntity; -import org.egov.egf.instrument.persistence.entity.InstrumentVoucherEntity; -import org.egov.egf.instrument.persistence.queue.repository.InstrumentQueueRepository; -import org.egov.egf.instrument.persistence.repository.DishonorReasonJdbcRepository; -import org.egov.egf.instrument.persistence.repository.InstrumentJdbcRepository; -import org.egov.egf.instrument.persistence.repository.InstrumentVoucherJdbcRepository; -import org.egov.egf.instrument.web.contract.InstrumentSearchContract; -import org.egov.egf.instrument.web.mapper.InstrumentMapper; -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.egov.egf.master.web.repository.FinancialConfigurationContractRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class InstrumentRepository { - - private InstrumentJdbcRepository instrumentJdbcRepository; - - private InstrumentVoucherJdbcRepository instrumentVoucherJdbcRepository; - - private InstrumentQueueRepository instrumentQueueRepository; - - private String persistThroughKafka; - - private InstrumentESRepository instrumentESRepository; - - private FinancialConfigurationContractRepository financialConfigurationContractRepository; - - private DishonorReasonJdbcRepository dishonorReasonJdbcRepository; - - @Autowired - public InstrumentRepository(InstrumentJdbcRepository instrumentJdbcRepository, - InstrumentQueueRepository instrumentQueueRepository, - @Value("${persist.through.kafka}") String persistThroughKafka, - InstrumentESRepository instrumentESRepository, - FinancialConfigurationContractRepository financialConfigurationContractRepository, - InstrumentVoucherJdbcRepository instrumentVoucherJdbcRepository, - DishonorReasonJdbcRepository dishonorReasonJdbcRepository) { - this.instrumentJdbcRepository = instrumentJdbcRepository; - this.instrumentQueueRepository = instrumentQueueRepository; - this.persistThroughKafka = persistThroughKafka; - this.instrumentESRepository = instrumentESRepository; - this.financialConfigurationContractRepository = financialConfigurationContractRepository; - this.instrumentVoucherJdbcRepository = instrumentVoucherJdbcRepository; - this.dishonorReasonJdbcRepository = dishonorReasonJdbcRepository; - - } - - public Instrument findById(Instrument instrument) { - InstrumentEntity entity = instrumentJdbcRepository.findById(new InstrumentEntity().toEntity(instrument)); - if (entity != null) - return entity.toDomain(); - - return null; - - } - - @Transactional - public List save(List instruments, RequestInfo requestInfo) { - - InstrumentMapper mapper = new InstrumentMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - InstrumentRequest request = new InstrumentRequest(); - request.setRequestInfo(requestInfo); - request.setInstruments(new ArrayList<>()); - - for (Instrument iac : instruments) - request.getInstruments().add(mapper.toContract(iac)); - - instrumentQueueRepository.addToQue(request); - - return instruments; - } else { - - List resultList = new ArrayList(); - - for (Instrument iac : instruments) - resultList.add(save(iac)); - - InstrumentRequest request = new InstrumentRequest(); - request.setRequestInfo(requestInfo); - request.setInstruments(new ArrayList<>()); - - for (Instrument iac : resultList) - request.getInstruments().add(mapper.toContract(iac)); - - instrumentQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List update(List instruments, RequestInfo requestInfo) { - - InstrumentMapper mapper = new InstrumentMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - InstrumentRequest request = new InstrumentRequest(); - request.setRequestInfo(requestInfo); - request.setInstruments(new ArrayList<>()); - - for (Instrument iac : instruments) - request.getInstruments().add(mapper.toContract(iac)); - - instrumentQueueRepository.addToQue(request); - - return instruments; - } else { - - List resultList = new ArrayList(); - - for (Instrument iac : instruments) - resultList.add(update(iac)); - - InstrumentRequest request = new InstrumentRequest(); - request.setRequestInfo(requestInfo); - request.setInstruments(new ArrayList<>()); - - for (Instrument iac : resultList) - request.getInstruments().add(mapper.toContract(iac)); - - instrumentQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List delete(List instruments, RequestInfo requestInfo) { - - InstrumentMapper mapper = new InstrumentMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - InstrumentRequest request = new InstrumentRequest(); - request.setRequestInfo(requestInfo); - request.setInstruments(new ArrayList<>()); - - for (Instrument iac : instruments) - request.getInstruments().add(mapper.toContract(iac)); - - instrumentQueueRepository.addToQue(request); - - return instruments; - } else { - - List resultList = new ArrayList(); - - for (Instrument iac : instruments) - resultList.add(delete(iac)); - - InstrumentRequest request = new InstrumentRequest(); - request.setRequestInfo(requestInfo); - request.setInstruments(new ArrayList<>()); - - for (Instrument iac : resultList) - request.getInstruments().add(mapper.toContract(iac)); - - instrumentQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public Instrument save(Instrument instrument) { - InstrumentEntity entity = instrumentJdbcRepository.create(new InstrumentEntity().toEntity(instrument)); - if (instrument.getInstrumentVouchers() != null) - for (InstrumentVoucher iv : instrument.getInstrumentVouchers()) - instrumentVoucherJdbcRepository.create(new InstrumentVoucherEntity().toEntity(iv)); - if (instrument.getDishonorReason() != null) - dishonorReasonJdbcRepository.create(new DishonorReasonEntity().toEntity(instrument.getDishonorReason())); - return entity.toDomain(); - } - - @Transactional - public Instrument update(Instrument instrument) { - InstrumentEntity entity = instrumentJdbcRepository.update(new InstrumentEntity().toEntity(instrument)); - instrumentVoucherJdbcRepository.delete(instrument.getTenantId(), instrument.getId()); - dishonorReasonJdbcRepository.delete(instrument.getTenantId(), instrument.getId()); - if (instrument.getInstrumentVouchers() != null) - for (InstrumentVoucher iv : instrument.getInstrumentVouchers()) - instrumentVoucherJdbcRepository.create(new InstrumentVoucherEntity().toEntity(iv)); - if (instrument.getDishonorReason() != null) - dishonorReasonJdbcRepository.create(new DishonorReasonEntity().toEntity(instrument.getDishonorReason())); - return entity.toDomain(); - } - - @Transactional - public Instrument delete(Instrument instrument) { - InstrumentEntity entity = instrumentJdbcRepository.delete(new InstrumentEntity().toEntity(instrument)); - return entity.toDomain(); - } - - public Pagination search(InstrumentSearch domain) { - - if (financialConfigurationContractRepository.fetchDataFrom() != null - && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { - - InstrumentMapper mapper = new InstrumentMapper(); - InstrumentSearchContract instrumentSearchContract = new InstrumentSearchContract(); - instrumentSearchContract = mapper.toSearchContract(domain); - Pagination instruments = instrumentESRepository.search(instrumentSearchContract); - - return instruments; - - } else - return instrumentJdbcRepository.search(domain); - - } - - public boolean uniqueCheck(String fieldName, Instrument instrument) { - return instrumentJdbcRepository.uniqueCheck(fieldName, new InstrumentEntity().toEntity(instrument)); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentTypeESRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentTypeESRepository.java deleted file mode 100644 index 4a6b539dd2e..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentTypeESRepository.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.persistence.entity.InstrumentTypeEntity; -import org.egov.egf.instrument.web.contract.InstrumentTypeSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class InstrumentTypeESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger logger = LoggerFactory.getLogger(InstrumentTypeESRepository.class); - - public InstrumentTypeESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(InstrumentTypeSearchContract instrumentTypeSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(instrumentTypeSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToInstrumentTypeList(searchResponse); - } - - @SuppressWarnings("deprecation") - private Pagination mapToInstrumentTypeList(SearchResponse searchResponse) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) - return page; - List instrumentTypes = new ArrayList(); - InstrumentType instrumentType = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - instrumentType = mapper.readValue(hit.getSourceAsString(), InstrumentType.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - logger.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - logger.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - logger.error("IO Exception occurred: " + e1.getMessage()); - } - - instrumentTypes.add(instrumentType); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(instrumentTypes); - - return page; - } - - private SearchRequestBuilder getSearchRequest(InstrumentTypeSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), InstrumentTypeEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchInstrumentType(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(InstrumentType.class.getSimpleName().toLowerCase()) - .setTypes(InstrumentType.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) - for (String orderBy : orderByList) - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentTypePropertyRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentTypePropertyRepository.java deleted file mode 100644 index 15bf2d322fb..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentTypePropertyRepository.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import org.egov.egf.instrument.domain.model.InstrumentTypeProperty; -import org.egov.egf.instrument.persistence.entity.InstrumentTypePropertyEntity; -import org.egov.egf.instrument.persistence.repository.InstrumentTypePropertyJdbcRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class InstrumentTypePropertyRepository { - - @Autowired - private InstrumentTypePropertyJdbcRepository instrumentTypePropertyJdbcRepository; - - public InstrumentTypeProperty findById(InstrumentTypeProperty instrumentTypeProperty) { - InstrumentTypePropertyEntity entity = instrumentTypePropertyJdbcRepository - .findById(new InstrumentTypePropertyEntity().toEntity(instrumentTypeProperty)); - if (entity != null) - return entity.toDomain(); - - return null; - - } - - @Transactional - public InstrumentTypeProperty save(InstrumentTypeProperty instrumentTypeProperty) { - InstrumentTypePropertyEntity entity = instrumentTypePropertyJdbcRepository - .create(new InstrumentTypePropertyEntity().toEntity(instrumentTypeProperty)); - return entity.toDomain(); - } - - @Transactional - public InstrumentTypeProperty update(InstrumentTypeProperty instrumentTypeProperty) { - InstrumentTypePropertyEntity entity = instrumentTypePropertyJdbcRepository - .update(new InstrumentTypePropertyEntity().toEntity(instrumentTypeProperty)); - return entity.toDomain(); - } - - /* - * public Pagination search(InstrumentTypePropertySearch domain) { return - * instrumentTypePropertyJdbcRepository.search(domain); } - */ - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentTypeRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentTypeRepository.java deleted file mode 100644 index 038f7a680fd..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentTypeRepository.java +++ /dev/null @@ -1,218 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.persistence.entity.InstrumentTypeEntity; -import org.egov.egf.instrument.persistence.queue.repository.InstrumentTypeQueueRepository; -import org.egov.egf.instrument.persistence.repository.InstrumentTypeJdbcRepository; -import org.egov.egf.instrument.web.contract.InstrumentTypeSearchContract; -import org.egov.egf.instrument.web.mapper.InstrumentTypeMapper; -import org.egov.egf.instrument.web.requests.InstrumentTypeRequest; -import org.egov.egf.master.web.repository.FinancialConfigurationContractRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class InstrumentTypeRepository { - - private InstrumentTypeJdbcRepository instrumentTypeJdbcRepository; - - private InstrumentTypeQueueRepository instrumentTypeQueueRepository; - - private String persistThroughKafka; - - private FinancialConfigurationContractRepository financialConfigurationContractRepository; - - private InstrumentTypeESRepository instrumentTypeESRepository; - - @Autowired - public InstrumentTypeRepository(InstrumentTypeJdbcRepository instrumentTypeJdbcRepository, - InstrumentTypeQueueRepository instrumentTypeQueueRepository, - @Value("${persist.through.kafka}") String persistThroughKafka, - FinancialConfigurationContractRepository financialConfigurationContractRepository, - InstrumentTypeESRepository instrumentTypeESRepository) { - this.instrumentTypeJdbcRepository = instrumentTypeJdbcRepository; - this.instrumentTypeQueueRepository = instrumentTypeQueueRepository; - this.persistThroughKafka = persistThroughKafka; - this.financialConfigurationContractRepository = financialConfigurationContractRepository; - this.instrumentTypeESRepository = instrumentTypeESRepository; - - } - - public InstrumentType findById(InstrumentType instrumentType) { - InstrumentTypeEntity entity = instrumentTypeJdbcRepository - .findById(new InstrumentTypeEntity().toEntity(instrumentType)); - if (entity != null) - return entity.toDomain(); - - return null; - - } - - @Transactional - public List save(List instrumentTypes, RequestInfo requestInfo) { - - InstrumentTypeMapper mapper = new InstrumentTypeMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - InstrumentTypeRequest request = new InstrumentTypeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentTypes(new ArrayList<>()); - - for (InstrumentType iac : instrumentTypes) - request.getInstrumentTypes().add(mapper.toContract(iac)); - - instrumentTypeQueueRepository.addToQue(request); - - return instrumentTypes; - } else { - - List resultList = new ArrayList(); - - for (InstrumentType iac : instrumentTypes) - resultList.add(save(iac)); - - InstrumentTypeRequest request = new InstrumentTypeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentTypes(new ArrayList<>()); - - for (InstrumentType iac : resultList) - request.getInstrumentTypes().add(mapper.toContract(iac)); - - instrumentTypeQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List update(List instrumentTypes, RequestInfo requestInfo) { - - InstrumentTypeMapper mapper = new InstrumentTypeMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - InstrumentTypeRequest request = new InstrumentTypeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentTypes(new ArrayList<>()); - - for (InstrumentType iac : instrumentTypes) - request.getInstrumentTypes().add(mapper.toContract(iac)); - - instrumentTypeQueueRepository.addToQue(request); - - return instrumentTypes; - } else { - - List resultList = new ArrayList(); - - for (InstrumentType iac : instrumentTypes) - resultList.add(update(iac)); - - InstrumentTypeRequest request = new InstrumentTypeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentTypes(new ArrayList<>()); - - for (InstrumentType iac : resultList) - request.getInstrumentTypes().add(mapper.toContract(iac)); - - instrumentTypeQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List delete(List instrumentTypes, RequestInfo requestInfo) { - - InstrumentTypeMapper mapper = new InstrumentTypeMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - InstrumentTypeRequest request = new InstrumentTypeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentTypes(new ArrayList<>()); - - for (InstrumentType iac : instrumentTypes) - request.getInstrumentTypes().add(mapper.toContract(iac)); - - instrumentTypeQueueRepository.addToQue(request); - - return instrumentTypes; - } else { - - List resultList = new ArrayList(); - - for (InstrumentType iac : instrumentTypes) - resultList.add(delete(iac)); - - InstrumentTypeRequest request = new InstrumentTypeRequest(); - request.setRequestInfo(requestInfo); - request.setInstrumentTypes(new ArrayList<>()); - - for (InstrumentType iac : resultList) - request.getInstrumentTypes().add(mapper.toContract(iac)); - - instrumentTypeQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public InstrumentType save(InstrumentType instrumentType) { - InstrumentTypeEntity entity = instrumentTypeJdbcRepository - .create(new InstrumentTypeEntity().toEntity(instrumentType)); - return entity.toDomain(); - } - - @Transactional - public InstrumentType update(InstrumentType instrumentType) { - InstrumentTypeEntity entity = instrumentTypeJdbcRepository - .update(new InstrumentTypeEntity().toEntity(instrumentType)); - return entity.toDomain(); - } - - @Transactional - public InstrumentType delete(InstrumentType instrumentType) { - InstrumentTypeEntity entity = instrumentTypeJdbcRepository.delete(new InstrumentTypeEntity().toEntity(instrumentType)); - return entity.toDomain(); - } - - public Pagination search(InstrumentTypeSearch domain) { - - if (financialConfigurationContractRepository.fetchDataFrom() != null - && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { - - InstrumentTypeSearchContract instrumentTypeSearchContract = new InstrumentTypeSearchContract(); - InstrumentTypeMapper mapper = new InstrumentTypeMapper(); - instrumentTypeSearchContract = mapper.toSearchContract(domain); - Pagination instrumenttypes = instrumentTypeESRepository - .search(instrumentTypeSearchContract); - - return instrumenttypes; - - } else - return instrumentTypeJdbcRepository.search(domain); - - } - - public boolean uniqueCheck(String fieldName, InstrumentType instrumentType) { - return instrumentTypeJdbcRepository.uniqueCheck(fieldName, new InstrumentTypeEntity().toEntity(instrumentType)); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentVoucherRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentVoucherRepository.java deleted file mode 100644 index 361f3448642..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/InstrumentVoucherRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import org.egov.egf.instrument.domain.model.InstrumentVoucher; -import org.egov.egf.instrument.persistence.entity.InstrumentVoucherEntity; -import org.egov.egf.instrument.persistence.repository.InstrumentVoucherJdbcRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class InstrumentVoucherRepository { - - @Autowired - private InstrumentVoucherJdbcRepository instrumentVoucherJdbcRepository; - - public InstrumentVoucher findById(InstrumentVoucher instrumentVoucher) { - InstrumentVoucherEntity entity = instrumentVoucherJdbcRepository - .findById(new InstrumentVoucherEntity().toEntity(instrumentVoucher)); - if (entity != null) - return entity.toDomain(); - - return null; - - } - - @Transactional - public InstrumentVoucher save(InstrumentVoucher instrumentVoucher) { - InstrumentVoucherEntity entity = instrumentVoucherJdbcRepository - .create(new InstrumentVoucherEntity().toEntity(instrumentVoucher)); - return entity.toDomain(); - } - - @Transactional - public InstrumentVoucher update(InstrumentVoucher instrumentVoucher) { - InstrumentVoucherEntity entity = instrumentVoucherJdbcRepository - .update(new InstrumentVoucherEntity().toEntity(instrumentVoucher)); - return entity.toDomain(); - } - - /* - * public void add(CommonRequest request) { instrumentVoucherQueueRepository.add(request); } - */ - - /* - * public Pagination search(InstrumentVoucherSearch domain) { return - * instrumentVoucherJdbcRepository.search(domain); } - */ - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/SurrenderReasonESRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/SurrenderReasonESRepository.java deleted file mode 100644 index 7efabb84acc..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/SurrenderReasonESRepository.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.persistence.entity.SurrenderReasonEntity; -import org.egov.egf.instrument.web.contract.SurrenderReasonSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class SurrenderReasonESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger logger = LoggerFactory.getLogger(SurrenderReasonESRepository.class); - - public SurrenderReasonESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(SurrenderReasonSearchContract surrenderReasonSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(surrenderReasonSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToSurrenderReasonList(searchResponse); - } - - @SuppressWarnings("deprecation") - private Pagination mapToSurrenderReasonList(SearchResponse searchResponse) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) - return page; - List surrenderReasons = new ArrayList(); - SurrenderReason surrenderReason = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - surrenderReason = mapper.readValue(hit.getSourceAsString(), SurrenderReason.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - logger.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - logger.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - logger.error("IO Exception occurred: " + e1.getMessage()); - } - - surrenderReasons.add(surrenderReason); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(surrenderReasons); - - return page; - } - - private SearchRequestBuilder getSearchRequest(SurrenderReasonSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), SurrenderReasonEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchSurrenderReason(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(SurrenderReason.class.getSimpleName().toLowerCase()) - .setTypes(SurrenderReason.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) - for (String orderBy : orderByList) - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/SurrenderReasonRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/SurrenderReasonRepository.java deleted file mode 100644 index 2378f76fabf..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/repository/SurrenderReasonRepository.java +++ /dev/null @@ -1,217 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.persistence.entity.SurrenderReasonEntity; -import org.egov.egf.instrument.persistence.queue.repository.SurrenderReasonQueueRepository; -import org.egov.egf.instrument.persistence.repository.SurrenderReasonJdbcRepository; -import org.egov.egf.instrument.web.contract.SurrenderReasonSearchContract; -import org.egov.egf.instrument.web.mapper.SurrenderReasonMapper; -import org.egov.egf.instrument.web.requests.SurrenderReasonRequest; -import org.egov.egf.master.web.repository.FinancialConfigurationContractRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class SurrenderReasonRepository { - - private SurrenderReasonJdbcRepository surrenderReasonJdbcRepository; - - private SurrenderReasonQueueRepository surrenderReasonQueueRepository; - - private String persistThroughKafka; - - private FinancialConfigurationContractRepository financialConfigurationContractRepository; - - private SurrenderReasonESRepository surrenderReasonESRepository; - - @Autowired - public SurrenderReasonRepository(SurrenderReasonJdbcRepository surrenderReasonJdbcRepository, - SurrenderReasonQueueRepository surrenderReasonQueueRepository, - @Value("${persist.through.kafka}") String persistThroughKafka, - FinancialConfigurationContractRepository financialConfigurationContractRepository, - SurrenderReasonESRepository surrenderReasonESRepository) { - this.surrenderReasonJdbcRepository = surrenderReasonJdbcRepository; - this.surrenderReasonQueueRepository = surrenderReasonQueueRepository; - this.persistThroughKafka = persistThroughKafka; - this.financialConfigurationContractRepository = financialConfigurationContractRepository; - this.surrenderReasonESRepository = surrenderReasonESRepository; - - } - - public SurrenderReason findById(SurrenderReason surrenderReason) { - SurrenderReasonEntity entity = surrenderReasonJdbcRepository - .findById(new SurrenderReasonEntity().toEntity(surrenderReason)); - if (entity != null) - return entity.toDomain(); - - return null; - - } - - @Transactional - public List save(List surrenderReasons, RequestInfo requestInfo) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (SurrenderReason iac : surrenderReasons) - request.getSurrenderReasons().add(mapper.toContract(iac)); - - surrenderReasonQueueRepository.addToQue(request); - - return surrenderReasons; - } else { - - List resultList = new ArrayList(); - - for (SurrenderReason iac : surrenderReasons) - resultList.add(save(iac)); - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (SurrenderReason iac : resultList) - request.getSurrenderReasons().add(mapper.toContract(iac)); - - surrenderReasonQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List update(List surrenderReasons, RequestInfo requestInfo) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (SurrenderReason iac : surrenderReasons) - request.getSurrenderReasons().add(mapper.toContract(iac)); - - surrenderReasonQueueRepository.addToQue(request); - - return surrenderReasons; - } else { - - List resultList = new ArrayList(); - - for (SurrenderReason iac : surrenderReasons) - resultList.add(update(iac)); - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (SurrenderReason iac : resultList) - request.getSurrenderReasons().add(mapper.toContract(iac)); - - surrenderReasonQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public List delete(List surrenderReasons, RequestInfo requestInfo) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (SurrenderReason iac : surrenderReasons) - request.getSurrenderReasons().add(mapper.toContract(iac)); - - surrenderReasonQueueRepository.addToQue(request); - - return surrenderReasons; - } else { - - List resultList = new ArrayList(); - - for (SurrenderReason iac : surrenderReasons) - resultList.add(delete(iac)); - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - request.setRequestInfo(requestInfo); - request.setSurrenderReasons(new ArrayList<>()); - - for (SurrenderReason iac : resultList) - request.getSurrenderReasons().add(mapper.toContract(iac)); - - surrenderReasonQueueRepository.addToSearchQue(request); - - return resultList; - } - - } - - @Transactional - public SurrenderReason save(SurrenderReason surrenderReason) { - SurrenderReasonEntity entity = surrenderReasonJdbcRepository - .create(new SurrenderReasonEntity().toEntity(surrenderReason)); - return entity.toDomain(); - } - - @Transactional - public SurrenderReason update(SurrenderReason surrenderReason) { - SurrenderReasonEntity entity = surrenderReasonJdbcRepository - .update(new SurrenderReasonEntity().toEntity(surrenderReason)); - return entity.toDomain(); - } - - @Transactional - public SurrenderReason delete(SurrenderReason surrenderReason) { - SurrenderReasonEntity entity = surrenderReasonJdbcRepository - .delete(new SurrenderReasonEntity().toEntity(surrenderReason)); - return entity.toDomain(); - } - - public Pagination search(SurrenderReasonSearch domain) { - - if (financialConfigurationContractRepository.fetchDataFrom() != null - && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - SurrenderReasonSearchContract surrenderReasonSearchContract = new SurrenderReasonSearchContract(); - surrenderReasonSearchContract = mapper.toSearchContract(domain); - - return surrenderReasonESRepository.search(surrenderReasonSearchContract); - - } else - return surrenderReasonJdbcRepository.search(domain); - - } - - public boolean uniqueCheck(String fieldName, SurrenderReason surrenderReason) { - return surrenderReasonJdbcRepository.uniqueCheck(fieldName, new SurrenderReasonEntity().toEntity(surrenderReason)); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/InstrumentAccountCodeService.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/InstrumentAccountCodeService.java deleted file mode 100644 index d9d5cf63b94..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/InstrumentAccountCodeService.java +++ /dev/null @@ -1,226 +0,0 @@ -package org.egov.egf.instrument.domain.service; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.domain.repository.InstrumentAccountCodeRepository; -import org.egov.egf.instrument.domain.repository.InstrumentTypeRepository; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.egov.egf.master.web.repository.ChartOfAccountContractRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class InstrumentAccountCodeService { - - public static final String ACTION_CREATE = "create"; - public static final String ACTION_UPDATE = "update"; - public static final String ACTION_DELETE = "delete"; - public static final String ACTION_VIEW = "view"; - public static final String ACTION_EDIT = "edit"; - public static final String ACTION_SEARCH = "search"; - - private InstrumentAccountCodeRepository instrumentAccountCodeRepository; - - private SmartValidator validator; - - private ChartOfAccountContractRepository chartOfAccountContractRepository; - - private InstrumentTypeRepository instrumentTypeRepository; - - @Autowired - public InstrumentAccountCodeService(SmartValidator validator, - InstrumentAccountCodeRepository instrumentAccountCodeRepository, - ChartOfAccountContractRepository chartOfAccountContractRepository, - InstrumentTypeRepository instrumentTypeRepository) { - this.validator = validator; - this.instrumentAccountCodeRepository = instrumentAccountCodeRepository; - this.chartOfAccountContractRepository = chartOfAccountContractRepository; - this.instrumentTypeRepository = instrumentTypeRepository; - } - - @Transactional - public List create(List instrumentAccountCodes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - instrumentAccountCodes = fetchRelated(instrumentAccountCodes, requestInfo); - - validate(instrumentAccountCodes, ACTION_CREATE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return instrumentAccountCodeRepository.save(instrumentAccountCodes, requestInfo); - - } - - @Transactional - public List update(List instrumentAccountCodes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - instrumentAccountCodes = fetchRelated(instrumentAccountCodes, requestInfo); - - validate(instrumentAccountCodes, ACTION_UPDATE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return instrumentAccountCodeRepository.update(instrumentAccountCodes, requestInfo); - - } - - @Transactional - public List delete(List instrumentAccountCodes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - validate(instrumentAccountCodes, ACTION_DELETE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - - } - - return instrumentAccountCodeRepository.delete(instrumentAccountCodes, requestInfo); - } - - private BindingResult validate(List instrumentaccountcodes, String method, - BindingResult errors) { - - try { - switch (method) { - case ACTION_VIEW: - // validator.validate(instrumentAccountCodeContractRequest.getInstrumentAccountCode(), - // errors); - break; - case ACTION_CREATE: - if (instrumentaccountcodes == null) - throw new InvalidDataException("instrumentaccountcodes", ErrorCode.NOT_NULL.getCode(), null); - for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes) { - validator.validate(instrumentAccountCode, errors); - if (!instrumentAccountCodeRepository.uniqueCheck("instrumentTypeId", instrumentAccountCode)) - errors.addError(new FieldError("instrumentAccountCode", "instrumentType", - instrumentAccountCode.getInstrumentType(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - break; - case ACTION_UPDATE: - if (instrumentaccountcodes == null) - throw new InvalidDataException("instrumentaccountcodes", ErrorCode.NOT_NULL.getCode(), null); - for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes) { - if (instrumentAccountCode.getId() == null) - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - instrumentAccountCode.getId()); - validator.validate(instrumentAccountCode, errors); - if (!instrumentAccountCodeRepository.uniqueCheck("instrumentTypeId", instrumentAccountCode)) - errors.addError(new FieldError("instrumentAccountCode", "instrumentType", - instrumentAccountCode.getInstrumentType(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - break; - case ACTION_DELETE: - if (instrumentaccountcodes == null) - throw new InvalidDataException("instrumentaccountcodes", ErrorCode.NOT_NULL.getCode(), null); - for (InstrumentAccountCode instrumentaccountcode : instrumentaccountcodes) - if (instrumentaccountcode.getId() == null) - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - instrumentaccountcode.getId()); - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - - } - - public List fetchRelated(List instrumentaccountcodes, RequestInfo requestInfo) { - - if (instrumentaccountcodes != null) - for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes) { - - // fetch related items - - if (instrumentAccountCode.getInstrumentType() != null - && instrumentAccountCode.getInstrumentType().getName() != null) { - InstrumentTypeSearch instrumentTypeSearch = new InstrumentTypeSearch(); - instrumentTypeSearch.setName(instrumentAccountCode.getInstrumentType().getName()); - instrumentTypeSearch.setTenantId(instrumentAccountCode.getInstrumentType().getTenantId()); - Pagination response = instrumentTypeRepository.search(instrumentTypeSearch); - if (response == null || response.getPagedData() == null || response.getPagedData().isEmpty()) - throw new InvalidDataException("instrumentTypeSearchResult", ErrorCode.INVALID_REF_VALUE.getCode(), null); - instrumentAccountCode.setInstrumentType(response.getPagedData().get(0)); - } - - if (instrumentAccountCode.getAccountCode() != null - && instrumentAccountCode.getAccountCode().getGlcode() != null) { - - instrumentAccountCode.getAccountCode().setTenantId(instrumentAccountCode.getTenantId()); - ChartOfAccountContract accountCode = chartOfAccountContractRepository - .findByGlcode(instrumentAccountCode.getAccountCode(), requestInfo); - - if (accountCode == null) - throw new InvalidDataException("accountCode", ErrorCode.INVALID_REF_VALUE.getCode(), null); - - instrumentAccountCode.setAccountCode(accountCode); - } - - } - - return instrumentaccountcodes; - } - - @Transactional - public InstrumentAccountCode delete(InstrumentAccountCode instrumentAccountCode) { - return instrumentAccountCodeRepository.delete(instrumentAccountCode); - } - - public Pagination search(InstrumentAccountCodeSearch instrumentAccountCodeSearch) { - return instrumentAccountCodeRepository.search(instrumentAccountCodeSearch); - } - - @Transactional - public InstrumentAccountCode save(InstrumentAccountCode instrumentAccountCode) { - return instrumentAccountCodeRepository.save(instrumentAccountCode); - } - - @Transactional - public InstrumentAccountCode update(InstrumentAccountCode instrumentAccountCode) { - return instrumentAccountCodeRepository.update(instrumentAccountCode); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/InstrumentService.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/InstrumentService.java deleted file mode 100644 index e76bfa80f76..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/InstrumentService.java +++ /dev/null @@ -1,343 +0,0 @@ -package org.egov.egf.instrument.domain.service; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; -import java.util.UUID; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.domain.repository.InstrumentRepository; -import org.egov.egf.instrument.domain.repository.InstrumentTypeRepository; -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.egov.egf.master.web.repository.BankAccountContractRepository; -import org.egov.egf.master.web.repository.BankContractRepository; -import org.egov.egf.master.web.repository.FinancialStatusContractRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class InstrumentService { - - public static final String ACTION_CREATE = "create"; - public static final String ACTION_UPDATE = "update"; - public static final String ACTION_DELETE = "delete"; - public static final String ACTION_VIEW = "view"; - public static final String ACTION_EDIT = "edit"; - public static final String ACTION_SEARCH = "search"; - - private InstrumentRepository instrumentRepository; - - private SmartValidator validator; - - private BankContractRepository bankContractRepository; - - private FinancialStatusContractRepository financialStatusContractRepository; - - private BankAccountContractRepository bankAccountContractRepository; - - private InstrumentTypeRepository instrumentTypeRepository; - - @Autowired - public InstrumentService(SmartValidator validator, InstrumentRepository instrumentRepository, BankContractRepository bankContractRepository, - FinancialStatusContractRepository financialStatusContractRepository, - BankAccountContractRepository bankAccountContractRepository, - InstrumentTypeRepository instrumentTypeRepository) { - this.validator = validator; - this.instrumentRepository = instrumentRepository; - this.bankContractRepository = bankContractRepository; - this.financialStatusContractRepository = financialStatusContractRepository; - this.bankAccountContractRepository = bankAccountContractRepository; - this.instrumentTypeRepository = instrumentTypeRepository; - } - - @Transactional - public List create(List instruments, BindingResult errors, RequestInfo requestInfo) { - - try { - - instruments = fetchRelated(instruments, requestInfo); - - validate(instruments, ACTION_CREATE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return instrumentRepository.save(instruments, requestInfo); - - } - - @Transactional - public List update(List instruments, BindingResult errors, RequestInfo requestInfo) { - - try { - - instruments = fetchRelated(instruments, requestInfo); - - validate(instruments, ACTION_UPDATE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return instrumentRepository.update(instruments, requestInfo); - - } - - @Transactional - public List delete(List instruments, BindingResult errors, RequestInfo requestInfo) { - - try { - - validate(instruments, ACTION_DELETE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return instrumentRepository.delete(instruments, requestInfo); - - } - - private BindingResult validate(List instruments, String method, BindingResult errors) { - - try { - switch (method) { - case ACTION_VIEW: - // validator.validate(instrumentContractRequest.getInstrument(), - // errors); - break; - case ACTION_CREATE: - if (instruments == null) - throw new InvalidDataException("instruments", ErrorCode.NOT_NULL.getCode(), null); - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.MONTH, -6); - Calendar cal1 = Calendar.getInstance(); - for (Instrument instrument : instruments) { - switch (instrument.getInstrumentType().getName().toLowerCase()) { - case "cash": - if (instrument.getTransactionNumber() == null) - throw new InvalidDataException("TransactionNumber(Cash)", ErrorCode.NOT_NULL.getCode(), null); - // Assert.isTrue(DateUtils.isSameDay(instrument.getTransactionDate(), Calendar.getInstance().getTime()), - // "Cash Transaction Date must be current date"); - // Assert.notNull(instrument.getPayee(), "Payee Details for Cash Transaction must not be null"); - break; - case "cheque": - if (instrument.getTransactionNumber() == null) - throw new InvalidDataException("TransactionNumber(Cheque)", ErrorCode.NOT_NULL.getCode(), null); - // Assert.notNull(instrument.getPayee(), "Cheque Payee Details must not be null"); - // cal1.setTime(instrument.getTransactionDate()); - // Assert.isTrue(cal1.after(cal), "Cheque Transaction should be before 6 months of current date or a - // future date"); - if (instrument.getBank() == null) - throw new InvalidDataException("BankDetails(Cheque)", ErrorCode.NOT_NULL.getCode(), null); - break; - case "dd": - if (instrument.getTransactionNumber() == null) - throw new InvalidDataException("TransactionNumber(DD)", ErrorCode.NOT_NULL.getCode(), null); - cal1.setTime(instrument.getTransactionDate()); - // Assert.isTrue(cal1.after(cal), "DD Transaction should be before 6 months of current date or a future - // date"); - // Assert.notNull(instrument.getPayee(), "DD Payee Details must not be null"); - if (instrument.getBank() == null) - throw new InvalidDataException("BankDetails(DD)", ErrorCode.NOT_NULL.getCode(), null); - break; - case "online": - if (instrument.getTransactionNumber() == null) - throw new InvalidDataException("TransactionNumber(Online)", ErrorCode.NOT_NULL.getCode(), null); - // Assert.notNull(instrument.getPayee(), "Online Payee Details must not be null"); - // cal1.setTime(instrument.getTransactionDate()); - // Assert.isTrue(cal1.after(cal), "DD Transaction should be before 6 months of current date or a future - // date"); - break; - case "bankchallan": - if (instrument.getTransactionNumber() == null) - throw new InvalidDataException("TransactionNumber(BankChallan)", ErrorCode.NOT_NULL.getCode(), null); - if (instrument.getBank() == null) - throw new InvalidDataException("BankDetails(BankChallan)", ErrorCode.NOT_NULL.getCode(), null); - if (instrument.getBankAccount() == null) - throw new InvalidDataException("BankAccountDetails(BankChallan)", ErrorCode.NOT_NULL.getCode(), null); - // Assert.notNull(instrument.getPayee(), "Bank Challan Payee Details must not be null"); - // cal1.setTime(instrument.getTransactionDate()); - // Assert.isTrue(cal1.after(cal), "DD Transaction should be before 6 months of current date or a future - // date"); - break; - } - validator.validate(instrument, errors); - } - break; - case ACTION_UPDATE: - if (instruments == null) - throw new InvalidDataException("instruments", ErrorCode.NOT_NULL.getCode(), null); - for (Instrument instrument : instruments) { - if (instrument.getId() == null) - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), instrument.getId()); - validator.validate(instrument, errors); - } - break; - case ACTION_DELETE: - if (instruments == null) - throw new InvalidDataException("instruments", ErrorCode.NOT_NULL.getCode(), null); - for (Instrument instrument : instruments) - if (instrument.getId() == null) - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), instrument.getId()); - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - - } - - public List fetchRelated(List instruments, RequestInfo requestInfo) { - - if (instruments != null) - for (Instrument instrument : instruments) { - - if ("create".equalsIgnoreCase(requestInfo.getAction())) - instrument.setId(UUID.randomUUID().toString().replace("-", "")); - - // fetch related items - - if (instrument.getInstrumentType() != null && instrument.getInstrumentType().getName() != null) { - InstrumentTypeSearch instrumentTypeSearch = new InstrumentTypeSearch(); - instrumentTypeSearch.setName(instrument.getInstrumentType().getName()); - instrumentTypeSearch.setTenantId(instrument.getTenantId()); - Pagination response = instrumentTypeRepository.search(instrumentTypeSearch); - if (response == null || response.getPagedData() == null || response.getPagedData().isEmpty()) - throw new InvalidDataException("instrumentType", "instrumentType.invalid", - " Invalid instrumentType"); - instrument.setInstrumentType(response.getPagedData().get(0)); - } - bankContractRepository.getClass(); - /* if (instrument.getBank() != null && instrument.getBank().getId() != null) { - instrument.getBank().setTenantId(instrument.getTenantId()); - BankContract bank = bankContractRepository.findById(instrument.getBank(), requestInfo); - if (bank == null) - throw new InvalidDataException("bank", "bank.invalid", " Invalid bank"); - instrument.setBank(bank); - }*/ - /* if (instrument.getBankAccount() != null && instrument.getBankAccount().getAccountNumber() != null) { - instrument.getBankAccount().setTenantId(instrument.getTenantId()); - BankAccountContract bankAccount = bankAccountContractRepository - .findByAccountNumber(instrument.getBankAccount(), requestInfo); - if (bankAccount == null) - throw new InvalidDataException("bankAccount", "bankAccount.invalid", " Invalid bankAccount"); - instrument.setBankAccount(bankAccount); - }*/ - bankAccountContractRepository.getClass(); -// if (instrument.getFinancialStatus() != null) { -// instrument.getFinancialStatus().setTenantId(instrument.getTenantId()); -// FinancialStatusContract financialStatus = financialStatusContractRepository -// .findById(instrument.getFinancialStatus(), requestInfo); -// if (financialStatus == null) -// throw new InvalidDataException("financialStatus", "financialStatus.invalid", -// " Invalid financialStatus"); -// instrument.setFinancialStatus(financialStatus); -// } - - //Reason for instrument surrender is not initiated by collection service so that for now we are commenting out the validation from this service. - - /* if (instrument.getSurrenderReason() != null) { - instrument.getSurrenderReason().setTenantId(instrument.getTenantId()); - SurrenderReason surrenderReason = surrenderReasonRepository - .findById(instrument.getSurrenderReason()); - if (surrenderReason == null) - throw new InvalidDataException("surrenderReason", "surrenderReason.invalid", - " Invalid surrenderReason"); - instrument.setSurrenderReason(surrenderReason); - } */ - - } - - return instruments; - } - - public Pagination search(InstrumentSearch instrumentSearch) { - return instrumentRepository.search(instrumentSearch); - } - - @Transactional - public Instrument save(Instrument instrument) { - return instrumentRepository.save(instrument); - } - - @Transactional - public Instrument update(Instrument instrument) { - return instrumentRepository.update(instrument); - } - - @Transactional - public Instrument delete(Instrument instrument) { - return instrumentRepository.delete(instrument); - } - - public List deposit(InstrumentRequest instrumentDepositRequest, BindingResult errors, - RequestInfo requestInfo) { - Instrument instrument = new Instrument(); - instrument.setId(instrumentDepositRequest.getInstruments().get(0).getId()); - instrument.setTenantId(instrumentDepositRequest.getInstruments().get(0).getTenantId()); - - FinancialStatusContract financialStatusContract = new FinancialStatusContract(); - financialStatusContract.setCode("Deposited"); - financialStatusContract.setModuleType("Instrument"); - - instrument = instrumentRepository.findById(instrument); - FinancialStatusContract financialStatusContract1 = new FinancialStatusContract(); - financialStatusContract1 = financialStatusContractRepository.findByModuleCode(financialStatusContract); - instrument.setFinancialStatus(financialStatusContract1); - instrument.setRemittanceVoucherId(instrumentDepositRequest.getInstruments().get(0).getRemittanceVoucherId()); - List instrumentsToUpdate = new ArrayList<>(); - instrumentsToUpdate.add(instrument); - return instrumentRepository.update(instrumentsToUpdate, requestInfo); - } - - public List dishonor(InstrumentRequest instrumentDepositRequest, BindingResult errors, - RequestInfo requestInfo) { - Instrument instrument = new Instrument(); - instrument.setId(instrumentDepositRequest.getInstruments().get(0).getId()); - instrument.setTenantId(instrumentDepositRequest.getInstruments().get(0).getTenantId()); - - FinancialStatusContract financialStatusContract = new FinancialStatusContract(); - financialStatusContract.setCode("Deposited"); - financialStatusContract.setModuleType("Instrument"); - - instrument = instrumentRepository.findById(instrument); - FinancialStatusContract financialStatusContract1 = new FinancialStatusContract(); - financialStatusContract1 = financialStatusContractRepository.findByModuleCode(financialStatusContract); - instrument.setFinancialStatus(financialStatusContract1); - List instrumentsToUpdate = new ArrayList<>(); - instrumentsToUpdate.add(instrument); - return instrumentRepository.update(instrumentsToUpdate, requestInfo); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/InstrumentTypeService.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/InstrumentTypeService.java deleted file mode 100644 index a62b9cbb541..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/InstrumentTypeService.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.egov.egf.instrument.domain.service; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.domain.repository.InstrumentTypeRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class InstrumentTypeService { - - public static final String ACTION_CREATE = "create"; - public static final String ACTION_UPDATE = "update"; - public static final String ACTION_DELETE = "delete"; - public static final String ACTION_VIEW = "view"; - public static final String ACTION_EDIT = "edit"; - public static final String ACTION_SEARCH = "search"; - - private InstrumentTypeRepository instrumentTypeRepository; - - private SmartValidator validator; - - @Autowired - public InstrumentTypeService(SmartValidator validator, InstrumentTypeRepository instrumentTypeRepository) { - this.validator = validator; - this.instrumentTypeRepository = instrumentTypeRepository; - } - - @Transactional - public List create(List instrumentTypes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - instrumentTypes = fetchRelated(instrumentTypes); - - validate(instrumentTypes, ACTION_CREATE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return instrumentTypeRepository.save(instrumentTypes, requestInfo); - - } - - @Transactional - public List update(List instrumentTypes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - instrumentTypes = fetchRelated(instrumentTypes); - - validate(instrumentTypes, ACTION_UPDATE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return instrumentTypeRepository.update(instrumentTypes, requestInfo); - - } - - @Transactional - public List delete(List instrumentTypes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - validate(instrumentTypes, ACTION_DELETE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return instrumentTypeRepository.delete(instrumentTypes, requestInfo); - - } - - private BindingResult validate(List instrumenttypes, String method, BindingResult errors) { - - try { - switch (method) { - case ACTION_VIEW: - // validator.validate(instrumentTypeContractRequest.getInstrumentType(), - // errors); - break; - case ACTION_CREATE: - if (instrumenttypes == null) - throw new InvalidDataException("instruments", ErrorCode.NOT_NULL.getCode(), null); - for (InstrumentType instrumentType : instrumenttypes) { - validator.validate(instrumentType, errors); - if (!instrumentTypeRepository.uniqueCheck("name", instrumentType)) - errors.addError(new FieldError("instrumentType", "name", instrumentType.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - break; - case ACTION_UPDATE: - if (instrumenttypes == null) - throw new InvalidDataException("instruments", ErrorCode.NOT_NULL.getCode(), null); - for (InstrumentType instrumentType : instrumenttypes) { - if (instrumentType.getId() == null) - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), instrumentType.getId()); - validator.validate(instrumentType, errors); - if (!instrumentTypeRepository.uniqueCheck("name", instrumentType)) - errors.addError(new FieldError("instrumentType", "name", instrumentType.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - break; - case ACTION_DELETE: - if (instrumenttypes == null) - throw new InvalidDataException("instruments", ErrorCode.NOT_NULL.getCode(), null); - for (InstrumentType instrumenttype : instrumenttypes) - if (instrumenttype.getId() == null) - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), instrumenttype.getId()); - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - - } - - @Transactional - public InstrumentType delete(InstrumentType instrumentType) { - return instrumentTypeRepository.delete(instrumentType); - } - - public List fetchRelated(List instrumenttypes) { - - return instrumenttypes; - } - - public Pagination search(InstrumentTypeSearch instrumentTypeSearch) { - return instrumentTypeRepository.search(instrumentTypeSearch); - } - - @Transactional - public InstrumentType save(InstrumentType instrumentType) { - return instrumentTypeRepository.save(instrumentType); - } - - @Transactional - public InstrumentType update(InstrumentType instrumentType) { - return instrumentTypeRepository.update(instrumentType); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/SurrenderReasonService.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/SurrenderReasonService.java deleted file mode 100644 index c7d1b2f8d29..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/domain/service/SurrenderReasonService.java +++ /dev/null @@ -1,181 +0,0 @@ -package org.egov.egf.instrument.domain.service; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.domain.repository.SurrenderReasonRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class SurrenderReasonService { - - public static final String ACTION_CREATE = "create"; - public static final String ACTION_UPDATE = "update"; - public static final String ACTION_DELETE = "delete"; - public static final String ACTION_VIEW = "view"; - public static final String ACTION_EDIT = "edit"; - public static final String ACTION_SEARCH = "search"; - - @Autowired - private SurrenderReasonRepository surrenderReasonRepository; - - @Autowired - private SmartValidator validator; - - @Autowired - public SurrenderReasonService(SmartValidator validator, SurrenderReasonRepository surrenderReasonRepository) { - this.validator = validator; - this.surrenderReasonRepository = surrenderReasonRepository; - } - - @Transactional - public List create(List surrenderReasons, BindingResult errors, - RequestInfo requestInfo) { - - try { - - surrenderReasons = fetchRelated(surrenderReasons); - - validate(surrenderReasons, ACTION_CREATE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return surrenderReasonRepository.save(surrenderReasons, requestInfo); - - } - - @Transactional - public List update(List surrenderReasons, BindingResult errors, - RequestInfo requestInfo) { - - try { - - surrenderReasons = fetchRelated(surrenderReasons); - - validate(surrenderReasons, ACTION_UPDATE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return surrenderReasonRepository.update(surrenderReasons, requestInfo); - - } - - @Transactional - public List delete(List surrenderReasons, BindingResult errors, - RequestInfo requestInfo) { - - try { - - validate(surrenderReasons, ACTION_DELETE, errors); - - if (errors.hasErrors()) - throw new CustomBindException(errors); - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - - } - - return surrenderReasonRepository.delete(surrenderReasons, requestInfo); - - } - - private BindingResult validate(List surrenderreasons, String method, BindingResult errors) { - - try { - switch (method) { - case ACTION_VIEW: - // validator.validate(surrenderReasonContractRequest.getSurrenderReason(), - // errors); - break; - case ACTION_CREATE: - if (surrenderreasons == null) - throw new InvalidDataException("surrenderreasons", ErrorCode.NOT_NULL.getCode(), null); - for (SurrenderReason surrenderReason : surrenderreasons) { - validator.validate(surrenderReason, errors); - if (!surrenderReasonRepository.uniqueCheck("name", surrenderReason)) - errors.addError(new FieldError("surrenderReason", "name", surrenderReason.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - break; - case ACTION_UPDATE: - if (surrenderreasons == null) - throw new InvalidDataException("surrenderreasons", ErrorCode.NOT_NULL.getCode(), null); - for (SurrenderReason surrenderReason : surrenderreasons) { - if (surrenderReason.getId() == null) - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - surrenderReason.getId()); - validator.validate(surrenderReason, errors); - if (!surrenderReasonRepository.uniqueCheck("name", surrenderReason)) - errors.addError(new FieldError("surrenderReason", "name", surrenderReason.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - case ACTION_DELETE: - if (surrenderreasons == null) - throw new InvalidDataException("surrenderreasons", ErrorCode.NOT_NULL.getCode(), null); - for (SurrenderReason surrenderreason : surrenderreasons) - if (surrenderreason.getId() == null) - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - surrenderreason.getId()); - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - - } - - @Transactional - public SurrenderReason delete(SurrenderReason surrenderReason) { - return surrenderReasonRepository.delete(surrenderReason); - } - - public List fetchRelated(List surrenderreasons) { - - return surrenderreasons; - } - - public Pagination search(SurrenderReasonSearch surrenderReasonSearch) { - return surrenderReasonRepository.search(surrenderReasonSearch); - } - - @Transactional - public SurrenderReason save(SurrenderReason surrenderReason) { - return surrenderReasonRepository.save(surrenderReason); - } - - @Transactional - public SurrenderReason update(SurrenderReason surrenderReason) { - return surrenderReasonRepository.update(surrenderReason); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/DishonorReasonEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/DishonorReasonEntity.java deleted file mode 100644 index 9293ec347c4..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/DishonorReasonEntity.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.instrument.domain.model.DishonorReason; -import org.egov.egf.instrument.domain.model.Instrument; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class DishonorReasonEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_instrumentdishonor"; - private String id; - private String reason; - private String remarks; - private String instrumentid; - private String reversalVoucherId; - private Long dishonorDate; - - public DishonorReason toDomain() { - DishonorReason dishonorReason = new DishonorReason(); - super.toDomain(dishonorReason); - dishonorReason.setId(id); - dishonorReason.setReason(reason); - dishonorReason.setRemarks(remarks); - dishonorReason.setInstrument(instrumentid); - dishonorReason.setReversalVoucherId(reversalVoucherId); - dishonorReason.setDishonorDate(dishonorDate); - return dishonorReason; - } - - public DishonorReasonEntity toEntity(DishonorReason dishonorReason) { - super.toEntity(dishonorReason); - id = dishonorReason.getId(); - reason = dishonorReason.getReason(); - remarks = dishonorReason.getRemarks(); - instrumentid = dishonorReason.getInstrument(); - reversalVoucherId = dishonorReason.getReversalVoucherId(); - dishonorDate = dishonorReason.getDishonorDate(); - return this; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/DishonorReasonSearchEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/DishonorReasonSearchEntity.java deleted file mode 100644 index 93816ef2bdb..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/DishonorReasonSearchEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.egf.instrument.domain.model.DishonorReason; -import org.egov.egf.instrument.domain.model.DishonorReasonSearch; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class DishonorReasonSearchEntity extends DishonorReasonEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - - @Override - public DishonorReason toDomain() { - DishonorReason dishonorReason = new DishonorReason(); - super.toDomain(dishonorReason); - return dishonorReason; - } - - public DishonorReasonSearchEntity toEntity(DishonorReasonSearch dishonorReasonSearch) { - super.toEntity(dishonorReasonSearch); - pageSize = dishonorReasonSearch.getPageSize(); - offset = dishonorReasonSearch.getOffset(); - sortBy = dishonorReasonSearch.getSortBy(); - ids = dishonorReasonSearch.getIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentAccountCodeEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentAccountCodeEntity.java deleted file mode 100644 index 6bd2db532c0..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentAccountCodeEntity.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.master.web.contract.ChartOfAccountContract; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class InstrumentAccountCodeEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_instrumentaccountcode"; - private String id; - private String instrumentTypeId; - private String accountCodeId; - - public InstrumentAccountCode toDomain() { - InstrumentAccountCode instrumentAccountCode = new InstrumentAccountCode(); - super.toDomain(instrumentAccountCode); - instrumentAccountCode.setId(id); - instrumentAccountCode.setInstrumentType(InstrumentType.builder().name(instrumentTypeId).build()); - instrumentAccountCode.setAccountCode(ChartOfAccountContract.builder().glcode(accountCodeId).build()); - return instrumentAccountCode; - } - - public InstrumentAccountCodeEntity toEntity(InstrumentAccountCode instrumentAccountCode) { - super.toEntity(instrumentAccountCode); - id = instrumentAccountCode.getId(); - instrumentTypeId = instrumentAccountCode.getInstrumentType() != null - ? instrumentAccountCode.getInstrumentType().getName() : null; - accountCodeId = instrumentAccountCode.getAccountCode() != null - ? instrumentAccountCode.getAccountCode().getGlcode() : null; - return this; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentAccountCodeSearchEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentAccountCodeSearchEntity.java deleted file mode 100644 index 1bd7f89eebd..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentAccountCodeSearchEntity.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentAccountCodeSearchEntity extends InstrumentAccountCodeEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - - @Override - public InstrumentAccountCode toDomain() { - InstrumentAccountCode instrumentAccountCode = new InstrumentAccountCode(); - super.toDomain(instrumentAccountCode); - return instrumentAccountCode; - } - - public InstrumentAccountCodeSearchEntity toEntity(InstrumentAccountCodeSearch instrumentAccountCodeSearch) { - super.toEntity(instrumentAccountCodeSearch); - pageSize = instrumentAccountCodeSearch.getPageSize(); - offset = instrumentAccountCodeSearch.getOffset(); - sortBy = instrumentAccountCodeSearch.getSortBy(); - ids = instrumentAccountCodeSearch.getIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentEntity.java deleted file mode 100644 index 8d68faec394..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentEntity.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import java.math.BigDecimal; -import java.util.Date; - -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.TransactionType; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.FinancialStatusContract; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class InstrumentEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_instrument"; - private String id; - private String transactionNumber; - private Date transactionDate; - private BigDecimal amount; - private String instrumentTypeId; - private String bankId; - private String branchName; - private String bankAccountId; - private String financialStatusId; - private String remittanceVoucherId; - private String transactionType; - private String payee; - private String drawer; - private String surrenderReasonId; - private String serialNo; - private String payinSlipId; - private BigDecimal reconciledAmount; - private Date reconciledOn; - - public Instrument toDomain() { - Instrument instrument = new Instrument(); - super.toDomain(instrument); - instrument.setId(id); - instrument.setTransactionNumber(transactionNumber); - instrument.setTransactionDate(transactionDate); - instrument.setAmount(amount); - instrument.setInstrumentType(InstrumentType.builder().name(instrumentTypeId).build()); - instrument.setBank(BankContract.builder().id(bankId).build()); - instrument.setBranchName(branchName); - instrument.setBankAccount(BankAccountContract.builder().accountNumber(bankAccountId).build()); - instrument.setFinancialStatus(FinancialStatusContract.builder().id(financialStatusId).build()); - instrument.setRemittanceVoucherId(remittanceVoucherId); - if (transactionType != null) - instrument.setTransactionType(TransactionType.valueOf(transactionType)); - instrument.setPayee(payee); - instrument.setDrawer(drawer); - instrument.setSurrenderReason(SurrenderReason.builder().id(surrenderReasonId).build()); - instrument.setSerialNo(serialNo); - instrument.setPayinSlipId(payinSlipId); - instrument.setReconciledAmount(reconciledAmount); - instrument.setReconciledOn(reconciledOn); - return instrument; - } - - public InstrumentEntity toEntity(Instrument instrument) { - super.toEntity(instrument); - id = instrument.getId(); - transactionNumber = instrument.getTransactionNumber(); - transactionDate = instrument.getTransactionDate(); - amount = instrument.getAmount(); - instrumentTypeId = instrument.getInstrumentType() != null ? instrument.getInstrumentType().getName() - : null; - bankId = instrument.getBank() != null ? instrument.getBank().getId() : null; - branchName = instrument.getBranchName(); - bankAccountId = instrument.getBankAccount() != null ? instrument.getBankAccount().getAccountNumber() - : null; - financialStatusId = instrument.getFinancialStatus() != null ? instrument.getFinancialStatus().getCode() - : null; - remittanceVoucherId = instrument.getRemittanceVoucherId(); - transactionType = instrument.getTransactionType() != null ? instrument.getTransactionType().toString() - : null; - payee = instrument.getPayee(); - drawer = instrument.getDrawer(); - surrenderReasonId = instrument.getSurrenderReason() != null ? instrument.getSurrenderReason().getId() - : null; - serialNo = instrument.getSerialNo(); - payinSlipId = instrument.getPayinSlipId(); - reconciledAmount = instrument.getReconciledAmount(); - reconciledOn = instrument.getReconciledOn(); - return this; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentSearchEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentSearchEntity.java deleted file mode 100644 index c02bc43ad1b..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentSearchEntity.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import java.util.Date; - -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentSearchEntity extends InstrumentEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private String instrumentTypes; - private String financialStatuses; - private Date transactionFromDate; - private Date transactionToDate; - private String receiptIds; - - @Override - public Instrument toDomain() { - Instrument instrument = new Instrument(); - super.toDomain(instrument); - return instrument; - } - - public InstrumentSearchEntity toEntity(InstrumentSearch instrumentSearch) { - super.toEntity(instrumentSearch); - pageSize = instrumentSearch.getPageSize(); - offset = instrumentSearch.getOffset(); - sortBy = instrumentSearch.getSortBy(); - ids = instrumentSearch.getIds(); - financialStatuses = instrumentSearch.getFinancialStatuses(); - instrumentTypes = instrumentSearch.getInstrumentTypes(); - transactionFromDate = instrumentSearch.getTransactionFromDate(); - transactionToDate = instrumentSearch.getTransactionToDate(); - receiptIds = instrumentSearch.getReceiptIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentTypeEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentTypeEntity.java deleted file mode 100644 index de16b2abb55..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentTypeEntity.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.instrument.domain.model.InstrumentType; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class InstrumentTypeEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_instrumenttype"; - private String id; - private String name; - private String description; - private Boolean active; - - public InstrumentType toDomain() { - InstrumentType instrumentType = new InstrumentType(); - super.toDomain(instrumentType); - instrumentType.setId(id); - instrumentType.setName(name); - instrumentType.setDescription(description); - instrumentType.setActive(active); - return instrumentType; - } - - public InstrumentTypeEntity toEntity(InstrumentType instrumentType) { - super.toEntity(instrumentType); - id = instrumentType.getId(); - name = instrumentType.getName(); - description = instrumentType.getDescription(); - active = instrumentType.getActive(); - return this; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentTypePropertyEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentTypePropertyEntity.java deleted file mode 100644 index e9e6a1f054e..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentTypePropertyEntity.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeProperty; -import org.egov.egf.instrument.domain.model.TransactionType; -import org.egov.egf.master.web.contract.FinancialStatusContract; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class InstrumentTypePropertyEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_instrumenttypeproperty"; - private String id; - private String transactionType; - private Boolean reconciledOncreate; - private String statusOnCreateId; - private String statusOnUpdateId; - private String statusOnReconcileId; - private String instrumentTypeId; - - public InstrumentTypeProperty toDomain() { - InstrumentTypeProperty instrumentTypeProperty = new InstrumentTypeProperty(); - super.toDomain(instrumentTypeProperty); - instrumentTypeProperty.setTransactionType(TransactionType.valueOf(transactionType)); - instrumentTypeProperty.setReconciledOncreate(reconciledOncreate); - instrumentTypeProperty.setStatusOnCreate(FinancialStatusContract.builder().code(statusOnCreateId).build()); - instrumentTypeProperty.setStatusOnUpdate(FinancialStatusContract.builder().code(statusOnUpdateId).build()); - instrumentTypeProperty - .setStatusOnReconcile(FinancialStatusContract.builder().code(statusOnReconcileId).build()); - instrumentTypeProperty.setInstrumentType(InstrumentType.builder().id(instrumentTypeId).build()); - return instrumentTypeProperty; - } - - public InstrumentTypePropertyEntity toEntity(InstrumentTypeProperty instrumentTypeProperty) { - super.toEntity(instrumentTypeProperty); - - transactionType = instrumentTypeProperty.getTransactionType() != null - ? instrumentTypeProperty.getTransactionType().toString() : null; - - reconciledOncreate = instrumentTypeProperty.getReconciledOncreate(); - statusOnCreateId = instrumentTypeProperty.getStatusOnCreate() != null - ? instrumentTypeProperty.getStatusOnCreate().getCode() : null; - statusOnUpdateId = instrumentTypeProperty.getStatusOnUpdate() != null - ? instrumentTypeProperty.getStatusOnUpdate().getCode() : null; - statusOnReconcileId = instrumentTypeProperty.getStatusOnReconcile() != null - ? instrumentTypeProperty.getStatusOnReconcile().getCode() : null; - - instrumentTypeId = instrumentTypeProperty.getInstrumentType() != null - ? instrumentTypeProperty.getInstrumentType().getId() : null; - return this; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentTypeSearchEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentTypeSearchEntity.java deleted file mode 100644 index 3246332cfb8..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentTypeSearchEntity.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentTypeSearchEntity extends InstrumentTypeEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - - @Override - public InstrumentType toDomain() { - InstrumentType instrumentType = new InstrumentType(); - super.toDomain(instrumentType); - return instrumentType; - } - - public InstrumentTypeSearchEntity toEntity(InstrumentTypeSearch instrumentTypeSearch) { - super.toEntity(instrumentTypeSearch); - pageSize = instrumentTypeSearch.getPageSize(); - offset = instrumentTypeSearch.getOffset(); - sortBy = instrumentTypeSearch.getSortBy(); - ids = instrumentTypeSearch.getIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentVoucherEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentVoucherEntity.java deleted file mode 100644 index 1fb4f32b844..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentVoucherEntity.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentVoucher; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class InstrumentVoucherEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_instrumentvoucher"; - private String id; - private String instrumentId; - private String voucherHeaderId; - private String receiptHeaderId; - - public InstrumentVoucher toDomain() { - InstrumentVoucher instrumentVoucher = new InstrumentVoucher(); - super.toDomain(instrumentVoucher); - instrumentVoucher.setInstrument(Instrument.builder().id(instrumentId).build()); - instrumentVoucher.setVoucherHeaderId(voucherHeaderId); - instrumentVoucher.setReceiptHeaderId(receiptHeaderId); - return instrumentVoucher; - } - - public InstrumentVoucherEntity toEntity(InstrumentVoucher instrumentVoucher) { - super.toEntity(instrumentVoucher); - instrumentId = instrumentVoucher.getInstrument() != null ? instrumentVoucher.getInstrument().getId() - : null; - voucherHeaderId = instrumentVoucher.getVoucherHeaderId(); - receiptHeaderId = instrumentVoucher.getReceiptHeaderId(); - return this; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentVoucherSearchEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentVoucherSearchEntity.java deleted file mode 100644 index 75731029095..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/InstrumentVoucherSearchEntity.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.egf.instrument.domain.model.InstrumentVoucher; -import org.egov.egf.instrument.domain.model.InstrumentVoucherSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentVoucherSearchEntity extends InstrumentVoucherEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private String instruments; - private String receiptIds; - - @Override - public InstrumentVoucher toDomain() { - InstrumentVoucher instrumentVoucher = new InstrumentVoucher(); - super.toDomain(instrumentVoucher); - return instrumentVoucher; - } - - public InstrumentVoucherSearchEntity toEntity(InstrumentVoucherSearch instrumentVoucherSearch) { - super.toEntity(instrumentVoucherSearch); - pageSize = instrumentVoucherSearch.getPageSize(); - offset = instrumentVoucherSearch.getOffset(); - sortBy = instrumentVoucherSearch.getSortBy(); - ids = instrumentVoucherSearch.getIds(); - instruments = instrumentVoucherSearch.getInstruments(); - receiptIds = instrumentVoucherSearch.getReceiptIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/SurrenderReasonEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/SurrenderReasonEntity.java deleted file mode 100644 index 8a66f03f5e7..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/SurrenderReasonEntity.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.instrument.domain.model.SurrenderReason; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class SurrenderReasonEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_surrenderreason"; - private String id; - private String name; - private String description; - - public SurrenderReason toDomain() { - SurrenderReason surrenderReason = new SurrenderReason(); - super.toDomain(surrenderReason); - surrenderReason.setId(id); - surrenderReason.setName(name); - surrenderReason.setDescription(description); - return surrenderReason; - } - - public SurrenderReasonEntity toEntity(SurrenderReason surrenderReason) { - super.toEntity(surrenderReason); - id = surrenderReason.getId(); - name = surrenderReason.getName(); - description = surrenderReason.getDescription(); - return this; - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/SurrenderReasonSearchEntity.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/SurrenderReasonSearchEntity.java deleted file mode 100644 index 5f38a64e3c3..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/entity/SurrenderReasonSearchEntity.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.egov.egf.instrument.persistence.entity; - -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SurrenderReasonSearchEntity extends SurrenderReasonEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - - @Override - public SurrenderReason toDomain() { - SurrenderReason surrenderReason = new SurrenderReason(); - super.toDomain(surrenderReason); - return surrenderReason; - } - - public SurrenderReasonSearchEntity toEntity(SurrenderReasonSearch surrenderReasonSearch) { - super.toEntity(surrenderReasonSearch); - pageSize = surrenderReasonSearch.getPageSize(); - offset = surrenderReasonSearch.getOffset(); - sortBy = surrenderReasonSearch.getSortBy(); - ids = surrenderReasonSearch.getIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/FinancialInstrumentListener.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/FinancialInstrumentListener.java deleted file mode 100644 index 715526b71cc..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/FinancialInstrumentListener.java +++ /dev/null @@ -1,273 +0,0 @@ -package org.egov.egf.instrument.persistence.queue; - -import java.util.HashMap; - -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.service.InstrumentAccountCodeService; -import org.egov.egf.instrument.domain.service.InstrumentService; -import org.egov.egf.instrument.domain.service.InstrumentTypeService; -import org.egov.egf.instrument.domain.service.SurrenderReasonService; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeContract; -import org.egov.egf.instrument.web.contract.InstrumentContract; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; -import org.egov.egf.instrument.web.mapper.InstrumentAccountCodeMapper; -import org.egov.egf.instrument.web.mapper.InstrumentMapper; -import org.egov.egf.instrument.web.mapper.InstrumentTypeMapper; -import org.egov.egf.instrument.web.mapper.SurrenderReasonMapper; -import org.egov.egf.instrument.web.requests.InstrumentAccountCodeRequest; -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.egov.egf.instrument.web.requests.InstrumentTypeRequest; -import org.egov.egf.instrument.web.requests.SurrenderReasonRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class FinancialInstrumentListener { - - @Value("${kafka.topics.egf.instrument.completed.topic}") - private String completedTopic; - - @Value("${kafka.topics.egf.instrument.instrument.accountcode.completed.key}") - private String instrumentAccountCodeCompletedKey; - - @Value("${kafka.topics.egf.instrument.instrument.completed.key}") - private String instrumentCompletedKey; - - @Value("${kafka.topics.egf.instrument.instrument.type.completed.key}") - private String instrumentTypeCompletedKey; - - @Value("${kafka.topics.egf.instrument.surrender.reason.completed.key}") - private String surrenderReasonCompletedKey; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private FinancialInstrumentProducer financialProducer; - - @Autowired - private InstrumentAccountCodeService instrumentAccountCodeService; - - @Autowired - private InstrumentService instrumentService; - - @Autowired - private InstrumentTypeService instrumentTypeService; - - @Autowired - private SurrenderReasonService surrenderReasonService; - - @KafkaListener(id = "${kafka.topics.egf.instrument.validated.id}", topics = "${kafka.topics.egf.instrument.validated.topic}", groupId = "${kafka.topics.egf.instrument.validated.group}") - public void process(HashMap mastersMap) { - - InstrumentAccountCodeMapper accountCodeMapper = new InstrumentAccountCodeMapper(); - InstrumentMapper instrumentMapper = new InstrumentMapper(); - InstrumentTypeMapper typeMapper = new InstrumentTypeMapper(); - SurrenderReasonMapper srMapper = new SurrenderReasonMapper(); - - if (mastersMap.get("instrumentaccountcode_create") != null) { - - InstrumentAccountCodeRequest request = objectMapper - .convertValue(mastersMap.get("instrumentaccountcode_create"), InstrumentAccountCodeRequest.class); - - for (InstrumentAccountCodeContract instrumentAccountCodeContract : request.getInstrumentAccountCodes()) { - InstrumentAccountCode domain = accountCodeMapper.toDomain(instrumentAccountCodeContract); - instrumentAccountCodeService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("instrumentaccountcode_persisted", request); - financialProducer.sendMessage(completedTopic, instrumentAccountCodeCompletedKey, mastersMap); - } - - if (mastersMap.get("instrumentaccountcode_update") != null) - - { - - InstrumentAccountCodeRequest request = objectMapper - .convertValue(mastersMap.get("instrumentaccountcode_update"), InstrumentAccountCodeRequest.class); - - for (InstrumentAccountCodeContract instrumentAccountCodeContract : request.getInstrumentAccountCodes()) { - InstrumentAccountCode domain = accountCodeMapper.toDomain(instrumentAccountCodeContract); - instrumentAccountCodeService.update(domain); - } - - mastersMap.clear(); - mastersMap.put("instrumentaccountcode_persisted", request); - financialProducer.sendMessage(completedTopic, instrumentAccountCodeCompletedKey, mastersMap); - } - - if (mastersMap.get("instrumentaccountcode_delete") != null) - - { - - InstrumentAccountCodeRequest request = objectMapper - .convertValue(mastersMap.get("instrumentaccountcode_delete"), InstrumentAccountCodeRequest.class); - - for (InstrumentAccountCodeContract instrumentAccountCodeContract : request.getInstrumentAccountCodes()) { - InstrumentAccountCode domain = accountCodeMapper.toDomain(instrumentAccountCodeContract); - instrumentAccountCodeService.delete(domain); - } - - mastersMap.clear(); - mastersMap.put("instrumentaccountcode_deleted", request); - financialProducer.sendMessage(completedTopic, instrumentAccountCodeCompletedKey, mastersMap); - } - - if (mastersMap.get("instrument_create") != null) { - - InstrumentRequest request = objectMapper.convertValue(mastersMap.get("instrument_create"), - InstrumentRequest.class); - - for (InstrumentContract instrumentContract : request.getInstruments()) { - Instrument domain = instrumentMapper.toDomain(instrumentContract); - instrumentService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("instrument_persisted", request); - financialProducer.sendMessage(completedTopic, instrumentCompletedKey, mastersMap); - } - - if (mastersMap.get("instrument_update") != null) - - { - - InstrumentRequest request = objectMapper.convertValue(mastersMap.get("instrument_update"), - InstrumentRequest.class); - - for (InstrumentContract instrumentContract : request.getInstruments()) { - Instrument domain = instrumentMapper.toDomain(instrumentContract); - instrumentService.update(domain); - } - - mastersMap.clear(); - mastersMap.put("instrument_persisted", request); - financialProducer.sendMessage(completedTopic, instrumentCompletedKey, mastersMap); - } - - if (mastersMap.get("instrument_delete") != null) - - { - - InstrumentRequest request = objectMapper.convertValue(mastersMap.get("instrument_delete"), - InstrumentRequest.class); - - for (InstrumentContract instrumentContract : request.getInstruments()) { - Instrument domain = instrumentMapper.toDomain(instrumentContract); - instrumentService.delete(domain); - } - - mastersMap.clear(); - mastersMap.put("instrument_deleted", request); - financialProducer.sendMessage(completedTopic, instrumentCompletedKey, mastersMap); - } - - if (mastersMap.get("instrumenttype_create") != null) { - - InstrumentTypeRequest request = objectMapper.convertValue(mastersMap.get("instrumenttype_create"), - InstrumentTypeRequest.class); - - for (InstrumentTypeContract instrumentTypeContract : request.getInstrumentTypes()) { - InstrumentType domain = typeMapper.toDomain(instrumentTypeContract); - instrumentTypeService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("instrumenttype_persisted", request); - financialProducer.sendMessage(completedTopic, instrumentTypeCompletedKey, mastersMap); - } - - if (mastersMap.get("instrumenttype_update") != null) - - { - - InstrumentTypeRequest request = objectMapper.convertValue(mastersMap.get("instrumenttype_update"), - InstrumentTypeRequest.class); - - for (InstrumentTypeContract instrumentTypeContract : request.getInstrumentTypes()) { - InstrumentType domain = typeMapper.toDomain(instrumentTypeContract); - instrumentTypeService.update(domain); - } - - mastersMap.clear(); - mastersMap.put("instrumenttype_persisted", request); - financialProducer.sendMessage(completedTopic, instrumentTypeCompletedKey, mastersMap); - } - - if (mastersMap.get("instrumenttype_delete") != null) - - { - - InstrumentTypeRequest request = objectMapper.convertValue(mastersMap.get("instrumenttype_delete"), - InstrumentTypeRequest.class); - - for (InstrumentTypeContract instrumentTypeContract : request.getInstrumentTypes()) { - InstrumentType domain = typeMapper.toDomain(instrumentTypeContract); - instrumentTypeService.delete(domain); - } - - mastersMap.clear(); - mastersMap.put("instrumenttype_deleted", request); - financialProducer.sendMessage(completedTopic, instrumentTypeCompletedKey, mastersMap); - } - - if (mastersMap.get("surrenderreason_create") != null) { - - SurrenderReasonRequest request = objectMapper.convertValue(mastersMap.get("surrenderreason_create"), - SurrenderReasonRequest.class); - - for (SurrenderReasonContract surrenderReasonContract : request.getSurrenderReasons()) { - SurrenderReason domain = srMapper.toDomain(surrenderReasonContract); - surrenderReasonService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("surrenderreason_persisted", request); - financialProducer.sendMessage(completedTopic, surrenderReasonCompletedKey, mastersMap); - } - - if (mastersMap.get("surrenderreason_update") != null) - - { - - SurrenderReasonRequest request = objectMapper.convertValue(mastersMap.get("surrenderreason_update"), - SurrenderReasonRequest.class); - - for (SurrenderReasonContract surrenderReasonContract : request.getSurrenderReasons()) { - SurrenderReason domain = srMapper.toDomain(surrenderReasonContract); - surrenderReasonService.update(domain); - } - - mastersMap.clear(); - mastersMap.put("surrenderreason_persisted", request); - financialProducer.sendMessage(completedTopic, surrenderReasonCompletedKey, mastersMap); - } - - if (mastersMap.get("surrenderreason_delete") != null) - - { - SurrenderReasonRequest request = objectMapper.convertValue(mastersMap.get("surrenderreason_delete"), - SurrenderReasonRequest.class); - - for (SurrenderReasonContract surrenderReasonContract : request.getSurrenderReasons()) { - SurrenderReason domain = srMapper.toDomain(surrenderReasonContract); - surrenderReasonService.delete(domain); - } - - mastersMap.clear(); - mastersMap.put("surrenderreason_deleted", request); - financialProducer.sendMessage(completedTopic, surrenderReasonCompletedKey, mastersMap); - } - - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/FinancialInstrumentProducer.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/FinancialInstrumentProducer.java deleted file mode 100644 index de2eb6d1b7a..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/FinancialInstrumentProducer.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.egf.instrument.persistence.queue; - -import java.util.Map; - -import org.egov.tracer.kafka.LogAwareKafkaTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class FinancialInstrumentProducer { - - private LogAwareKafkaTemplate kafkaTemplate; - - @Autowired - public FinancialInstrumentProducer(LogAwareKafkaTemplate kafkaTemplate) { - this.kafkaTemplate = kafkaTemplate; - } - - public void sendMessage(String topic, String key, Map message) { - kafkaTemplate.send(topic, key, message); - } - -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/ObjectMapperFactory.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/ObjectMapperFactory.java deleted file mode 100644 index 1ace36f8229..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/ObjectMapperFactory.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.instrument.persistence.queue; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class ObjectMapperFactory { - - private ObjectMapper objectMapper; - - public ObjectMapperFactory(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - - public ObjectMapper create() { - objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - return objectMapper; - } -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentAccountCodeQueueRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentAccountCodeQueueRepository.java deleted file mode 100644 index b50907cbc19..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentAccountCodeQueueRepository.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.egov.egf.instrument.persistence.queue.repository; - -import java.util.HashMap; - -import org.egov.egf.instrument.persistence.queue.FinancialInstrumentProducer; -import org.egov.egf.instrument.web.requests.InstrumentAccountCodeRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -@Service -public class InstrumentAccountCodeQueueRepository { - - private FinancialInstrumentProducer financialInstrumentProducer; - - private String validatedTopic; - - private String instrumentAccountCodeValidatedKey; - - private String completedTopic; - - private String instrumentAccountCodeCompletedKey; - - @Autowired - public InstrumentAccountCodeQueueRepository(FinancialInstrumentProducer financialInstrumentProducer, - @Value("${kafka.topics.egf.instrument.validated.topic}") String validatedTopic, - @Value("${kafka.topics.egf.instrument.instrument.accountcode.validated.key}") String instrumentAccountCodeValidatedKey, - @Value("${kafka.topics.egf.instrument.completed.topic}") String completedTopic, - @Value("${kafka.topics.egf.instrument.instrument.accountcode.completed.key}") String instrumentAccountCodeCompletedKey) { - - this.financialInstrumentProducer = financialInstrumentProducer; - this.validatedTopic = validatedTopic; - this.instrumentAccountCodeValidatedKey = instrumentAccountCodeValidatedKey; - this.completedTopic = completedTopic; - this.instrumentAccountCodeCompletedKey = instrumentAccountCodeCompletedKey; - } - - public void addToQue(InstrumentAccountCodeRequest request) { - HashMap topicMap = new HashMap(); - - switch (request.getRequestInfo().getAction().toLowerCase()) { - - case "create": - topicMap.put("instrumentaccountcode_create", request); - System.out.println("push create topic" + request); - break; - case "update": - topicMap.put("instrumentaccountcode_update", request); - break; - case "delete": - topicMap.put("instrumentaccountcode_delete", request); - break; - - } - financialInstrumentProducer.sendMessage(validatedTopic, instrumentAccountCodeValidatedKey, topicMap); - } - - public void addToSearchQue(InstrumentAccountCodeRequest request) { - - HashMap topicMap = new HashMap(); - - if (!request.getInstrumentAccountCodes().isEmpty()) { - - topicMap.put("instrumentaccountcode_persisted", request); - - System.out.println("push search topic" + request); - - } - - financialInstrumentProducer.sendMessage(completedTopic, instrumentAccountCodeCompletedKey, topicMap); - - } -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentQueueRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentQueueRepository.java deleted file mode 100644 index 2c4c677fbf1..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentQueueRepository.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.egov.egf.instrument.persistence.queue.repository; - -import java.util.HashMap; - -import org.egov.egf.instrument.persistence.queue.FinancialInstrumentProducer; -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -@Service -public class InstrumentQueueRepository { - - private FinancialInstrumentProducer financialInstrumentProducer; - - private String validatedTopic; - - private String instrumentValidatedKey; - - private String completedTopic; - - private String instrumentCompletedKey; - - @Autowired - public InstrumentQueueRepository(FinancialInstrumentProducer financialInstrumentProducer, - @Value("${kafka.topics.egf.instrument.validated.topic}") String validatedTopic, - @Value("${kafka.topics.egf.instrument.instrument.validated.key}") String instrumentValidatedKey, - @Value("${kafka.topics.egf.instrument.completed.topic}") String completedTopic, - @Value("${kafka.topics.egf.instrument.instrument.completed.key}") String instrumentCompletedKey) { - - this.financialInstrumentProducer = financialInstrumentProducer; - this.validatedTopic = validatedTopic; - this.instrumentValidatedKey = instrumentValidatedKey; - this.completedTopic = completedTopic; - this.instrumentCompletedKey = instrumentCompletedKey; - } - - public void addToQue(InstrumentRequest request) { - HashMap topicMap = new HashMap(); - - switch (request.getRequestInfo().getAction().toLowerCase()) { - - case "create": - topicMap.put("instrument_create", request); - System.out.println("push create topic" + request); - break; - case "update": - topicMap.put("instrument_update", request); - break; - case "delete": - topicMap.put("instrument_delete", request); - break; - - } - financialInstrumentProducer.sendMessage(validatedTopic, instrumentValidatedKey, topicMap); - } - - public void addToSearchQue(InstrumentRequest request) { - - HashMap topicMap = new HashMap(); - - if (!request.getInstruments().isEmpty()) { - - topicMap.put("instrument_persisted", request); - - System.out.println("push search topic" + request); - - } - - financialInstrumentProducer.sendMessage(completedTopic, instrumentCompletedKey, topicMap); - - } -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentTypeQueueRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentTypeQueueRepository.java deleted file mode 100644 index 4cb3867869b..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentTypeQueueRepository.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.egov.egf.instrument.persistence.queue.repository; - -import java.util.HashMap; - -import org.egov.egf.instrument.persistence.queue.FinancialInstrumentProducer; -import org.egov.egf.instrument.web.requests.InstrumentTypeRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -@Service -public class InstrumentTypeQueueRepository { - - private FinancialInstrumentProducer financialInstrumentProducer; - - private String validatedTopic; - - private String instrumentTypeValidatedKey; - - private String completedTopic; - - private String instrumentTypeCompletedKey; - - @Autowired - public InstrumentTypeQueueRepository(FinancialInstrumentProducer financialInstrumentProducer, - @Value("${kafka.topics.egf.instrument.validated.topic}") String validatedTopic, - @Value("${kafka.topics.egf.instrument.instrument.type.validated.key}") String instrumentTypeValidatedKey, - @Value("${kafka.topics.egf.instrument.completed.topic}") String completedTopic, - @Value("${kafka.topics.egf.instrument.instrument.type.completed.key}") String instrumentTypeCompletedKey) { - - this.financialInstrumentProducer = financialInstrumentProducer; - this.validatedTopic = validatedTopic; - this.instrumentTypeValidatedKey = instrumentTypeValidatedKey; - this.completedTopic = completedTopic; - this.instrumentTypeCompletedKey = instrumentTypeCompletedKey; - } - - public void addToQue(InstrumentTypeRequest request) { - HashMap topicMap = new HashMap(); - - switch (request.getRequestInfo().getAction().toLowerCase()) { - - case "create": - topicMap.put("instrumenttype_create", request); - System.out.println("push create topic" + request); - break; - case "update": - topicMap.put("instrumenttype_update", request); - break; - case "delete": - topicMap.put("instrumenttype_delete", request); - break; - - } - financialInstrumentProducer.sendMessage(validatedTopic, instrumentTypeValidatedKey, topicMap); - } - - public void addToSearchQue(InstrumentTypeRequest request) { - - HashMap topicMap = new HashMap(); - - if (!request.getInstrumentTypes().isEmpty()) { - - topicMap.put("instrumenttype_persisted", request); - - System.out.println("push search topic" + request); - - } - - financialInstrumentProducer.sendMessage(completedTopic, instrumentTypeCompletedKey, topicMap); - - } -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/SurrenderReasonQueueRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/SurrenderReasonQueueRepository.java deleted file mode 100644 index 640ff6bc93b..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/queue/repository/SurrenderReasonQueueRepository.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.egov.egf.instrument.persistence.queue.repository; - -import java.util.HashMap; - -import org.egov.egf.instrument.persistence.queue.FinancialInstrumentProducer; -import org.egov.egf.instrument.web.requests.SurrenderReasonRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -@Service -public class SurrenderReasonQueueRepository { - - private FinancialInstrumentProducer financialInstrumentProducer; - - private String validatedTopic; - - private String surrenderReasonValidatedKey; - - private String completedTopic; - - private String surrenderReasonCompletedKey; - - @Autowired - public SurrenderReasonQueueRepository(FinancialInstrumentProducer financialInstrumentProducer, - @Value("${kafka.topics.egf.instrument.validated.topic}") String validatedTopic, - @Value("${kafka.topics.egf.instrument.surrender.reason.validated.key}") String surrenderReasonValidatedKey, - @Value("${kafka.topics.egf.instrument.completed.topic}") String completedTopic, - @Value("${kafka.topics.egf.instrument.surrender.reason.completed.key}") String surrenderReasonCompletedKey) { - - this.financialInstrumentProducer = financialInstrumentProducer; - this.validatedTopic = validatedTopic; - this.surrenderReasonValidatedKey = surrenderReasonValidatedKey; - this.completedTopic = completedTopic; - this.surrenderReasonCompletedKey = surrenderReasonCompletedKey; - } - - public void addToQue(SurrenderReasonRequest request) { - HashMap topicMap = new HashMap(); - - switch (request.getRequestInfo().getAction().toLowerCase()) { - - case "create": - topicMap.put("surrenderreason_create", request); - System.out.println("push create topic" + request); - break; - case "update": - topicMap.put("surrenderreason_update", request); - break; - case "delete": - topicMap.put("surrenderreason_delete", request); - break; - - } - financialInstrumentProducer.sendMessage(validatedTopic, surrenderReasonValidatedKey, topicMap); - } - - public void addToSearchQue(SurrenderReasonRequest request) { - - HashMap topicMap = new HashMap(); - - if (!request.getSurrenderReasons().isEmpty()) { - - topicMap.put("surrenderreason_persisted", request); - - System.out.println("push search topic" + request); - - } - - financialInstrumentProducer.sendMessage(completedTopic, surrenderReasonCompletedKey, topicMap); - - } -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/DishonorReasonJdbcRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/DishonorReasonJdbcRepository.java deleted file mode 100644 index b2274fb0d57..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/DishonorReasonJdbcRepository.java +++ /dev/null @@ -1,175 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.instrument.domain.model.DishonorReason; -import org.egov.egf.instrument.domain.model.DishonorReasonSearch; -import org.egov.egf.instrument.persistence.entity.DishonorReasonEntity; -import org.egov.egf.instrument.persistence.entity.DishonorReasonSearchEntity; -import org.egov.egf.instrument.persistence.entity.InstrumentVoucherEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class DishonorReasonJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(DishonorReasonJdbcRepository.class); - - static { - LOG.debug("init dishonorrReason"); - init(DishonorReasonEntity.class); - LOG.debug("end init dishonorrReason"); - } - - public DishonorReasonJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - this.jdbcTemplate = jdbcTemplate; - } - - public DishonorReasonEntity create(DishonorReasonEntity entity) { - - entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public DishonorReasonEntity update(DishonorReasonEntity entity) { - super.update(entity); - return entity; - - } - - public DishonorReasonEntity delete(DishonorReasonEntity entity) { - super.delete(DishonorReasonEntity.TABLE_NAME, entity.getId()); - return entity; - } - - @Override - public void delete(final String tenantId, final String instrumentId) { - super.delete(DishonorReasonEntity.TABLE_NAME, tenantId, "instrumentid", instrumentId); - } - - public Pagination search(DishonorReasonSearch domain) { - DishonorReasonSearchEntity dishonorReasonSearchEntity = new DishonorReasonSearchEntity(); - dishonorReasonSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (dishonorReasonSearchEntity.getSortBy() != null && !dishonorReasonSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(dishonorReasonSearchEntity.getSortBy()); - validateEntityFieldName(dishonorReasonSearchEntity.getSortBy(), DishonorReasonEntity.class); - } - - String orderBy = "order by id"; - if (dishonorReasonSearchEntity.getSortBy() != null && !dishonorReasonSearchEntity.getSortBy().isEmpty()) - orderBy = "order by " + dishonorReasonSearchEntity.getSortBy(); - - searchQuery = searchQuery.replace(":tablename", DishonorReasonEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (dishonorReasonSearchEntity.getTenantId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", dishonorReasonSearchEntity.getTenantId()); - } - if (dishonorReasonSearchEntity.getId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id =:id"); - paramValues.put("id", dishonorReasonSearchEntity.getId()); - } - if (dishonorReasonSearchEntity.getReason() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("reason =:reason"); - paramValues.put("reason", dishonorReasonSearchEntity.getReason()); - } - if (dishonorReasonSearchEntity.getRemarks() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("remarks =:remarks"); - paramValues.put("remarks", dishonorReasonSearchEntity.getRemarks()); - } - if (dishonorReasonSearchEntity.getIds() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id in (:ids)"); - paramValues.put("ids", dishonorReasonSearchEntity.getIds()); - } - if (dishonorReasonSearchEntity.getInstrumentid() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("instrumentid in (:instrumentids)"); - paramValues.put("instrumentids", new ArrayList(Arrays.asList(dishonorReasonSearchEntity.getInstrumentid().split(",")))); - } - - Pagination page = new Pagination<>(); - if (dishonorReasonSearchEntity.getOffset() != null) - page.setOffset(dishonorReasonSearchEntity.getOffset()); - if (dishonorReasonSearchEntity.getPageSize() != null) - page.setPageSize(dishonorReasonSearchEntity.getPageSize()); - - if (params.length() > 0) - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(DishonorReasonEntity.class); - - List dishonorReasonEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(dishonorReasonEntities.size()); - - List dishonorreasons = new ArrayList<>(); - for (DishonorReasonEntity dishonorReasonEntity : dishonorReasonEntities) - dishonorreasons.add(dishonorReasonEntity.toDomain()); - page.setPagedData(dishonorreasons); - - return page; - } - - public DishonorReasonEntity findById(DishonorReasonEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) - paramValues.put(s, getValue(getField(entity, s), entity)); - - List dishonorreasons = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(DishonorReasonEntity.class)); - if (dishonorreasons.isEmpty()) - return null; - else - return dishonorreasons.get(0); - - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentAccountCodeJdbcRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentAccountCodeJdbcRepository.java deleted file mode 100644 index c4fd24e038c..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentAccountCodeJdbcRepository.java +++ /dev/null @@ -1,164 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.persistence.entity.InstrumentAccountCodeEntity; -import org.egov.egf.instrument.persistence.entity.InstrumentAccountCodeSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class InstrumentAccountCodeJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(InstrumentAccountCodeJdbcRepository.class); - - static { - LOG.debug("init instrumentAccountCode"); - init(InstrumentAccountCodeEntity.class); - LOG.debug("end init instrumentAccountCode"); - } - - public InstrumentAccountCodeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - this.jdbcTemplate = jdbcTemplate; - } - - public InstrumentAccountCodeEntity create(InstrumentAccountCodeEntity entity) { - - entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public InstrumentAccountCodeEntity update(InstrumentAccountCodeEntity entity) { - super.update(entity); - return entity; - - } - - public InstrumentAccountCodeEntity delete(InstrumentAccountCodeEntity entity) { - super.delete(InstrumentAccountCodeEntity.TABLE_NAME, entity.getId()); - return entity; - } - - public Pagination search(InstrumentAccountCodeSearch domain) { - InstrumentAccountCodeSearchEntity instrumentAccountCodeSearchEntity = new InstrumentAccountCodeSearchEntity(); - instrumentAccountCodeSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (instrumentAccountCodeSearchEntity.getSortBy() != null - && !instrumentAccountCodeSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(instrumentAccountCodeSearchEntity.getSortBy()); - validateEntityFieldName(instrumentAccountCodeSearchEntity.getSortBy(), InstrumentAccountCodeEntity.class); - } - - String orderBy = "order by id"; - if (instrumentAccountCodeSearchEntity.getSortBy() != null - && !instrumentAccountCodeSearchEntity.getSortBy().isEmpty()) - orderBy = "order by " + instrumentAccountCodeSearchEntity.getSortBy(); - - searchQuery = searchQuery.replace(":tablename", InstrumentAccountCodeEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (instrumentAccountCodeSearchEntity.getTenantId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", instrumentAccountCodeSearchEntity.getTenantId()); - } - if (instrumentAccountCodeSearchEntity.getId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id =:id"); - paramValues.put("id", instrumentAccountCodeSearchEntity.getId()); - } - if (instrumentAccountCodeSearchEntity.getInstrumentTypeId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("instrumentTypeId =:instrumentType"); - paramValues.put("instrumentType", instrumentAccountCodeSearchEntity.getInstrumentTypeId()); - } - if (instrumentAccountCodeSearchEntity.getAccountCodeId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("accountCodeId =:accountCode"); - paramValues.put("accountCode", instrumentAccountCodeSearchEntity.getAccountCodeId()); - } - if (instrumentAccountCodeSearchEntity.getIds() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id in (:ids)"); - paramValues.put("ids", instrumentAccountCodeSearchEntity.getIds()); - } - - Pagination page = new Pagination<>(); - if (instrumentAccountCodeSearchEntity.getOffset() != null) - page.setOffset(instrumentAccountCodeSearchEntity.getOffset()); - if (instrumentAccountCodeSearchEntity.getPageSize() != null) - page.setPageSize(instrumentAccountCodeSearchEntity.getPageSize()); - - if (params.length() > 0) - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(InstrumentAccountCodeEntity.class); - - List instrumentAccountCodeEntities = namedParameterJdbcTemplate - .query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(instrumentAccountCodeEntities.size()); - - List instrumentaccountcodes = new ArrayList<>(); - for (InstrumentAccountCodeEntity instrumentAccountCodeEntity : instrumentAccountCodeEntities) - instrumentaccountcodes.add(instrumentAccountCodeEntity.toDomain()); - page.setPagedData(instrumentaccountcodes); - - return page; - } - - public InstrumentAccountCodeEntity findById(InstrumentAccountCodeEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) - paramValues.put(s, getValue(getField(entity, s), entity)); - - List instrumentaccountcodes = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(InstrumentAccountCodeEntity.class)); - if (instrumentaccountcodes.isEmpty()) - return null; - else - return instrumentaccountcodes.get(0); - - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentJdbcRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentJdbcRepository.java deleted file mode 100644 index 658b7346aef..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentJdbcRepository.java +++ /dev/null @@ -1,341 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.instrument.domain.model.DishonorReason; -import org.egov.egf.instrument.domain.model.DishonorReasonSearch; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.model.InstrumentVoucher; -import org.egov.egf.instrument.domain.model.InstrumentVoucherSearch; -import org.egov.egf.instrument.persistence.entity.InstrumentEntity; -import org.egov.egf.instrument.persistence.entity.InstrumentSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class InstrumentJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(InstrumentJdbcRepository.class); - - private final InstrumentVoucherJdbcRepository instrumentVoucherJdbcRepository; - private final DishonorReasonJdbcRepository dishonorReasonJdbcRepository; - - static { - LOG.debug("init instrument"); - init(InstrumentEntity.class); - LOG.debug("end init instrument"); - } - - public InstrumentJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate, - InstrumentVoucherJdbcRepository instrumentVoucherJdbcRepository, DishonorReasonJdbcRepository dishonorReasonJdbcRepository) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - this.jdbcTemplate = jdbcTemplate; - this.instrumentVoucherJdbcRepository = instrumentVoucherJdbcRepository; - this.dishonorReasonJdbcRepository = dishonorReasonJdbcRepository; - } - - public InstrumentEntity create(InstrumentEntity entity) { - - // entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public InstrumentEntity update(InstrumentEntity entity) { - super.update(entity); - return entity; - - } - - public InstrumentEntity delete(InstrumentEntity entity) { - super.delete(entity, entity.getDeleteReason()); - return entity; - } - - public Pagination search(InstrumentSearch domain) { - InstrumentSearchEntity instrumentSearchEntity = new InstrumentSearchEntity(); - instrumentSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (instrumentSearchEntity.getSortBy() != null && !instrumentSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(instrumentSearchEntity.getSortBy()); - validateEntityFieldName(instrumentSearchEntity.getSortBy(), InstrumentEntity.class); - } - - String orderBy = "order by id"; - if (instrumentSearchEntity.getSortBy() != null && !instrumentSearchEntity.getSortBy().isEmpty()) - orderBy = "order by " + instrumentSearchEntity.getSortBy(); - - searchQuery = searchQuery.replace(":tablename", InstrumentEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (instrumentSearchEntity.getTenantId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", instrumentSearchEntity.getTenantId()); - } - if (instrumentSearchEntity.getId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id =:id"); - paramValues.put("id", instrumentSearchEntity.getId()); - } - if (instrumentSearchEntity.getTransactionNumber() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("transactionNumber =:transactionNumber"); - paramValues.put("transactionNumber", instrumentSearchEntity.getTransactionNumber()); - } - if (instrumentSearchEntity.getTransactionDate() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("transactionDate =:transactionDate"); - paramValues.put("transactionDate", instrumentSearchEntity.getTransactionDate()); - } - if (instrumentSearchEntity.getAmount() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("amount =:amount"); - paramValues.put("amount", instrumentSearchEntity.getAmount()); - } - if (instrumentSearchEntity.getInstrumentTypeId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("instrumentTypeid =:instrumentType"); - paramValues.put("instrumentType", instrumentSearchEntity.getInstrumentTypeId()); - } - if (instrumentSearchEntity.getBankId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("bankid =:bank"); - paramValues.put("bank", instrumentSearchEntity.getBankId()); - } - if (instrumentSearchEntity.getBranchName() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("branchName =:branchName"); - paramValues.put("branchName", instrumentSearchEntity.getBranchName()); - } - if (instrumentSearchEntity.getBankAccountId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("bankAccountid =:bankAccount"); - paramValues.put("bankAccount", instrumentSearchEntity.getBankAccountId()); - } - if (instrumentSearchEntity.getFinancialStatusId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("financialStatusid =:financialStatus"); - paramValues.put("financialStatus", instrumentSearchEntity.getFinancialStatusId()); - } - if (instrumentSearchEntity.getRemittanceVoucherId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("remittanceVoucherId =:remittanceVoucherId"); - paramValues.put("remittanceVoucherId", instrumentSearchEntity.getRemittanceVoucherId()); - } - if (instrumentSearchEntity.getTransactionType() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("transactionType =:transactionType"); - paramValues.put("transactionType", instrumentSearchEntity.getTransactionType()); - } - if (instrumentSearchEntity.getPayee() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("payee =:payee"); - paramValues.put("payee", instrumentSearchEntity.getPayee()); - } - if (instrumentSearchEntity.getDrawer() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("drawer =:drawer"); - paramValues.put("drawer", instrumentSearchEntity.getDrawer()); - } - if (instrumentSearchEntity.getSurrenderReasonId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("surrenderReasonid =:surrenderReason"); - paramValues.put("surrenderReason", instrumentSearchEntity.getSurrenderReasonId()); - } - if (instrumentSearchEntity.getSerialNo() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("serialNo =:serialNo"); - paramValues.put("serialNo", instrumentSearchEntity.getSerialNo()); - } - - if (instrumentSearchEntity.getReceiptIds() != null) { - InstrumentVoucherSearch ivs = new InstrumentVoucherSearch(); - ivs.setTenantId(instrumentSearchEntity.getTenantId()); - ivs.setReceiptIds(instrumentSearchEntity.getReceiptIds()); - Pagination instrumentVoucherList = instrumentVoucherJdbcRepository.search(ivs); - if (instrumentVoucherList != null && instrumentVoucherList.getPagedData() != null - && !instrumentVoucherList.getPagedData().isEmpty()) { - List idList = new ArrayList<>(); - for (InstrumentVoucher iv : instrumentVoucherList.getPagedData()) { - idList.add(iv.getInstrument().getId()); - } - if (!idList.isEmpty()) { - if (params.length() > 0) - params.append(" and "); - params.append("id in (:ids)"); - paramValues.put("ids", idList); - } - } - } - - if (instrumentSearchEntity.getIds() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id in (:ids)"); - paramValues.put("ids", new ArrayList(Arrays.asList(instrumentSearchEntity.getIds().split(",")))); - } - if (instrumentSearchEntity.getFinancialStatuses() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("financialStatusId in (:financialStatuses)"); - paramValues.put("financialStatuses", - new ArrayList(Arrays.asList(instrumentSearchEntity.getFinancialStatuses().split(",")))); - } - if (instrumentSearchEntity.getInstrumentTypes() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("instrumentTypeId in (:instrumentTypes)"); - paramValues.put("instrumentTypes", - new ArrayList(Arrays.asList(instrumentSearchEntity.getInstrumentTypes().split(",")))); - } - if (instrumentSearchEntity.getTransactionFromDate() != null && instrumentSearchEntity.getTransactionToDate() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("transactionDate >= :fromDate and transactionDate <= :toDate"); - paramValues.put("fromDate", instrumentSearchEntity.getTransactionFromDate()); - paramValues.put("toDate", instrumentSearchEntity.getTransactionToDate()); - } - - Pagination page = new Pagination<>(); - if (instrumentSearchEntity.getOffset() != null) - page.setOffset(instrumentSearchEntity.getOffset()); - if (instrumentSearchEntity.getPageSize() != null) - page.setPageSize(instrumentSearchEntity.getPageSize()); - - if (params.length() > 0) - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(InstrumentEntity.class); - - List instrumentEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(instrumentEntities.size()); - - List instruments = new ArrayList<>(); - StringBuffer ids = new StringBuffer(); - for (InstrumentEntity instrumentEntity : instrumentEntities) { - if (ids != null && ids.length() > 0) { - ids.append(","); - } - ids.append(instrumentEntity.getId()); - instruments.add(instrumentEntity.toDomain()); - } - populateInstrumentVouchers(instruments, ids, domain.getTenantId()); - populateIntrumentDishonor(instruments, ids, domain.getTenantId()); - page.setPagedData(instruments); - - return page; - } - - private void populateIntrumentDishonor(List instruments, StringBuffer ids, String tenantId) { - DishonorReasonSearch drs = new DishonorReasonSearch(); - drs.setTenantId(tenantId); - drs.setInstrument(ids.toString()); - Pagination dishonorList = dishonorReasonJdbcRepository.search(drs); - if(dishonorList != null && dishonorList.getPagedData() != null && !dishonorList.getPagedData().isEmpty()){ - Map map = dishonorList.getPagedData().stream().collect(Collectors.toMap(DishonorReason::getInstrument, Function.identity())); - instruments.stream().forEach(ins -> { - if(map.get(ins.getId()) != null) - ins.setDishonorReason(map.get(ins.getId())); - }); - }else{ - instruments.stream().forEach(ins -> { - ins.setDishonorReason(null); - }); - } - } - - private void populateInstrumentVouchers(List instruments, StringBuffer ids, String tenantId) { - InstrumentVoucherSearch ivs = new InstrumentVoucherSearch(); - ivs.setTenantId(tenantId); - ivs.setInstruments(ids.toString()); - Map> instrumentVoucherMap = new HashMap<>(); - Pagination instrumentVouchers = instrumentVoucherJdbcRepository.search(ivs); - if (instrumentVouchers != null && instrumentVouchers.getPagedData() != null) { - for (InstrumentVoucher iv : instrumentVouchers.getPagedData()) { - if (instrumentVoucherMap.get(iv.getInstrument().getId()) == null) { - ArrayList list = new ArrayList<>(); - list.add(iv); - instrumentVoucherMap.put(iv.getInstrument().getId(), list); - } else { - instrumentVoucherMap.get(iv.getInstrument().getId()).add(iv); - } - } - } - - for (Instrument i : instruments) { - if (instrumentVoucherMap.get(i.getId()) != null) { - i.setInstrumentVouchers(instrumentVoucherMap.get(i.getId())); - } - } - - } - - public InstrumentEntity findById(InstrumentEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) - paramValues.put(s, getValue(getField(entity, s), entity)); - - List instruments = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(InstrumentEntity.class)); - if (instruments.isEmpty()) - return null; - else - return instruments.get(0); - - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentTypeJdbcRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentTypeJdbcRepository.java deleted file mode 100644 index deeaf01b857..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentTypeJdbcRepository.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.persistence.entity.InstrumentTypeEntity; -import org.egov.egf.instrument.persistence.entity.InstrumentTypeSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class InstrumentTypeJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(InstrumentTypeJdbcRepository.class); - - static { - LOG.debug("init instrumentType"); - init(InstrumentTypeEntity.class); - LOG.debug("end init instrumentType"); - } - - public InstrumentTypeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - this.jdbcTemplate = jdbcTemplate; - } - - public InstrumentTypeEntity create(InstrumentTypeEntity entity) { - - // entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public InstrumentTypeEntity update(InstrumentTypeEntity entity) { - super.update(entity); - return entity; - - } - - public InstrumentTypeEntity delete(InstrumentTypeEntity entity) { - super.delete(InstrumentTypeEntity.TABLE_NAME, entity.getId()); - return entity; - } - - public Pagination search(InstrumentTypeSearch domain) { - InstrumentTypeSearchEntity instrumentTypeSearchEntity = new InstrumentTypeSearchEntity(); - instrumentTypeSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (instrumentTypeSearchEntity.getSortBy() != null && !instrumentTypeSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(instrumentTypeSearchEntity.getSortBy()); - validateEntityFieldName(instrumentTypeSearchEntity.getSortBy(), InstrumentTypeEntity.class); - } - - String orderBy = "order by id"; - if (instrumentTypeSearchEntity.getSortBy() != null && !instrumentTypeSearchEntity.getSortBy().isEmpty()) - orderBy = "order by " + instrumentTypeSearchEntity.getSortBy(); - - searchQuery = searchQuery.replace(":tablename", InstrumentTypeEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (instrumentTypeSearchEntity.getTenantId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", instrumentTypeSearchEntity.getTenantId()); - } - if (instrumentTypeSearchEntity.getId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id =:id"); - paramValues.put("id", instrumentTypeSearchEntity.getId()); - } - if (instrumentTypeSearchEntity.getName() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("name =:name"); - paramValues.put("name", instrumentTypeSearchEntity.getName()); - } - if (instrumentTypeSearchEntity.getDescription() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("description =:description"); - paramValues.put("description", instrumentTypeSearchEntity.getDescription()); - } - if (instrumentTypeSearchEntity.getActive() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("active =:active"); - paramValues.put("active", instrumentTypeSearchEntity.getActive()); - } - - if (instrumentTypeSearchEntity.getIds() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id in (:ids)"); - paramValues.put("ids", instrumentTypeSearchEntity.getIds()); - } - - Pagination page = new Pagination<>(); - if (instrumentTypeSearchEntity.getOffset() != null) - page.setOffset(instrumentTypeSearchEntity.getOffset()); - if (instrumentTypeSearchEntity.getPageSize() != null) - page.setPageSize(instrumentTypeSearchEntity.getPageSize()); - - if (params.length() > 0) - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - else - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(InstrumentTypeEntity.class); - - /* - * searchQuery= "select * from egf_instrumenttype egf_instrumenttype, egf_instrumenttypeproperty properties where " + - * "egf_instrumenttype.name=properties.instrumentTypeId"; - */ - - List instrumentTypeEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(instrumentTypeEntities.size()); - - List instrumenttypes = new ArrayList<>(); - for (InstrumentTypeEntity instrumentTypeEntity : instrumentTypeEntities) - instrumenttypes.add(instrumentTypeEntity.toDomain()); - page.setPagedData(instrumenttypes); - - return page; - } - - public InstrumentTypeEntity findById(InstrumentTypeEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) - paramValues.put(s, getValue(getField(entity, s), entity)); - - List instrumenttypes = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(InstrumentTypeEntity.class)); - if (instrumenttypes.isEmpty()) - return null; - else - return instrumenttypes.get(0); - - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentTypePropertyJdbcRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentTypePropertyJdbcRepository.java deleted file mode 100644 index ecdda28668a..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentTypePropertyJdbcRepository.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.instrument.persistence.entity.InstrumentTypePropertyEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class InstrumentTypePropertyJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(InstrumentTypePropertyJdbcRepository.class); - - static { - LOG.debug("init instrumentTypeProperty"); - init(InstrumentTypePropertyEntity.class); - LOG.debug("end init instrumentTypeProperty"); - } - - public InstrumentTypePropertyJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public InstrumentTypePropertyEntity create(InstrumentTypePropertyEntity entity) { - - entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public InstrumentTypePropertyEntity update(InstrumentTypePropertyEntity entity) { - super.update(entity); - return entity; - - } - - /* - * public Pagination search(InstrumentTypeProperty domain) { InstrumentTypePropertyEntity - * instrumentTypePropertySearchEntity = new InstrumentTypePropertyEntity(); - * instrumentTypePropertySearchEntity.toEntity(domain); String searchQuery = - * "select :selectfields from :tablename :condition :orderby "; Map paramValues = new HashMap<>(); - * StringBuffer params = new StringBuffer(); if (instrumentTypePropertySearchEntity.getSortBy() != null && - * !instrumentTypePropertySearchEntity.getSortBy().isEmpty()) { - * validateSortByOrder(instrumentTypePropertySearchEntity.getSortBy()); - * validateEntityFieldName(instrumentTypePropertySearchEntity.getSortBy(), InstrumentTypePropertyEntity.class); } String - * orderBy = "order by id"; if (instrumentTypePropertySearchEntity.getSortBy() != null && - * !instrumentTypePropertySearchEntity.getSortBy().isEmpty()) orderBy = "order by " + - * instrumentTypePropertySearchEntity.getSortBy(); searchQuery = searchQuery.replace(":tablename", - * InstrumentTypePropertyEntity.TABLE_NAME); searchQuery = searchQuery.replace(":selectfields", " * "); // implement jdbc - * specfic search if (instrumentTypePropertySearchEntity.getTransactionTypeId() != null) { if (params.length() > 0) - * params.append(" and "); params.append( "transactionType =:transactionType"); paramValues.put("transactionType", - * instrumentTypePropertySearchEntity.getTransactionTypeId()); } if - * (instrumentTypePropertySearchEntity.getReconciledOncreate() != null) { if (params.length() > 0) params.append(" and "); - * params.append( "reconciledOncreate =:reconciledOncreate"); paramValues.put("reconciledOncreate", - * instrumentTypePropertySearchEntity.getReconciledOncreate()); } if (instrumentTypePropertySearchEntity.getStatusOnCreateId() - * != null) { if (params.length() > 0) params.append(" and "); params.append( "statusOnCreate =:statusOnCreate"); - * paramValues.put("statusOnCreate", instrumentTypePropertySearchEntity.getStatusOnCreateId()); } if - * (instrumentTypePropertySearchEntity.getStatusOnUpdateId() != null) { if (params.length() > 0) params.append(" and "); - * params.append( "statusOnUpdate =:statusOnUpdate"); paramValues.put("statusOnUpdate", - * instrumentTypePropertySearchEntity.getStatusOnUpdateId()); } if - * (instrumentTypePropertySearchEntity.getStatusOnReconcileId() != null) { if (params.length() > 0) params.append(" and "); - * params.append( "statusOnReconcile =:statusOnReconcile"); paramValues.put("statusOnReconcile", - * instrumentTypePropertySearchEntity.getStatusOnReconcileId()); } Pagination page = new - * Pagination<>(); if (instrumentTypePropertySearchEntity.getOffset() != null) - * page.setOffset(instrumentTypePropertySearchEntity.getOffset()); if (instrumentTypePropertySearchEntity.getPageSize() != - * null) page.setPageSize(instrumentTypePropertySearchEntity.getPageSize()); if (params.length() > 0) { searchQuery = - * searchQuery.replace(":condition", " where " + params.toString()); } else { searchQuery = searchQuery.replace(":condition", - * ""); } searchQuery = searchQuery.replace(":orderby", orderBy); page = (Pagination) - * getPagination(searchQuery, page, paramValues); searchQuery = searchQuery + " :pagination"; searchQuery = - * searchQuery.replace(":pagination", "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - * BeanPropertyRowMapper row = new BeanPropertyRowMapper(InstrumentTypePropertyEntity.class); - * List instrumentTypePropertyEntities = namedParameterJdbcTemplate - * .query(searchQuery.toString(), paramValues, row); page.setTotalResults(instrumentTypePropertyEntities.size()); - * List instrumenttypeproperties = new ArrayList<>(); for (InstrumentTypePropertyEntity - * instrumentTypePropertyEntity : instrumentTypePropertyEntities) { - * instrumenttypeproperties.add(instrumentTypePropertyEntity.toDomain()); } page.setPagedData(instrumenttypeproperties); - * return page; } - */ - - public InstrumentTypePropertyEntity findById(InstrumentTypePropertyEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) - paramValues.put(s, getValue(getField(entity, s), entity)); - - List instrumenttypeproperties = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(InstrumentTypePropertyEntity.class)); - if (instrumenttypeproperties.isEmpty()) - return null; - else - return instrumenttypeproperties.get(0); - - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentVoucherJdbcRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentVoucherJdbcRepository.java deleted file mode 100644 index 8160e491567..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/InstrumentVoucherJdbcRepository.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.instrument.domain.model.InstrumentVoucher; -import org.egov.egf.instrument.domain.model.InstrumentVoucherSearch; -import org.egov.egf.instrument.persistence.entity.InstrumentVoucherEntity; -import org.egov.egf.instrument.persistence.entity.InstrumentVoucherSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class InstrumentVoucherJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(InstrumentVoucherJdbcRepository.class); - - static { - LOG.debug("init instrumentVoucher"); - init(InstrumentVoucherEntity.class); - LOG.debug("end init instrumentVoucher"); - } - - public InstrumentVoucherJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - @Override - public void delete(final String tenantId, final String instrumentId) { - super.delete(InstrumentVoucherEntity.TABLE_NAME, tenantId, "instrumentId", instrumentId); - } - - public InstrumentVoucherEntity create(InstrumentVoucherEntity entity) { - - entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public InstrumentVoucherEntity update(InstrumentVoucherEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(InstrumentVoucherSearch domain) { - InstrumentVoucherSearchEntity instrumentVoucherSearchEntity = new InstrumentVoucherSearchEntity(); - instrumentVoucherSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (instrumentVoucherSearchEntity.getSortBy() != null && !instrumentVoucherSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(instrumentVoucherSearchEntity.getSortBy()); - validateEntityFieldName(instrumentVoucherSearchEntity.getSortBy(), InstrumentVoucherEntity.class); - } - - String orderBy = "order by id"; - if (instrumentVoucherSearchEntity.getSortBy() != null && !instrumentVoucherSearchEntity.getSortBy().isEmpty()) - orderBy = "order by " + instrumentVoucherSearchEntity.getSortBy(); - - searchQuery = searchQuery.replace(":tablename", InstrumentVoucherEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (instrumentVoucherSearchEntity.getTenantId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", instrumentVoucherSearchEntity.getTenantId()); - } - - if (instrumentVoucherSearchEntity.getInstruments() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("instrumentId in (:instruments)"); - paramValues.put("instruments", - new ArrayList(Arrays.asList(instrumentVoucherSearchEntity.getInstruments().split(",")))); - } - - if (instrumentVoucherSearchEntity.getReceiptIds() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("receiptHeaderId in (:receiptIds)"); - paramValues.put("receiptIds", - new ArrayList(Arrays.asList(instrumentVoucherSearchEntity.getReceiptIds().split(",")))); - } - - Pagination page = new Pagination<>(); - if (instrumentVoucherSearchEntity.getOffset() != null) - page.setOffset(instrumentVoucherSearchEntity.getOffset()); - if (instrumentVoucherSearchEntity.getPageSize() != null) - page.setPageSize(instrumentVoucherSearchEntity.getPageSize()); - - if (params.length() > 0) - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(InstrumentVoucherEntity.class); - - List instrumentVoucherEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(instrumentVoucherEntities.size()); - - List instrumentVouchers = new ArrayList<>(); - for (InstrumentVoucherEntity instrumentVoucherEntity : instrumentVoucherEntities) { - instrumentVouchers.add(instrumentVoucherEntity.toDomain()); - } - page.setPagedData(instrumentVouchers); - - return page; - } - - public InstrumentVoucherEntity findById(InstrumentVoucherEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) - paramValues.put(s, getValue(getField(entity, s), entity)); - - List instrumentvouchers = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(InstrumentVoucherEntity.class)); - if (instrumentvouchers.isEmpty()) - return null; - else - return instrumentvouchers.get(0); - - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/SurrenderReasonJdbcRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/SurrenderReasonJdbcRepository.java deleted file mode 100644 index eeffb9128a2..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/persistence/repository/SurrenderReasonJdbcRepository.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.persistence.entity.SurrenderReasonEntity; -import org.egov.egf.instrument.persistence.entity.SurrenderReasonSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class SurrenderReasonJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(SurrenderReasonJdbcRepository.class); - - static { - LOG.debug("init surrenderReason"); - init(SurrenderReasonEntity.class); - LOG.debug("end init surrenderReason"); - } - - public SurrenderReasonJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - this.jdbcTemplate = jdbcTemplate; - } - - public SurrenderReasonEntity create(SurrenderReasonEntity entity) { - - entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public SurrenderReasonEntity update(SurrenderReasonEntity entity) { - super.update(entity); - return entity; - - } - - public SurrenderReasonEntity delete(SurrenderReasonEntity entity) { - super.delete(SurrenderReasonEntity.TABLE_NAME, entity.getId()); - return entity; - } - - public Pagination search(SurrenderReasonSearch domain) { - SurrenderReasonSearchEntity surrenderReasonSearchEntity = new SurrenderReasonSearchEntity(); - surrenderReasonSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (surrenderReasonSearchEntity.getSortBy() != null && !surrenderReasonSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(surrenderReasonSearchEntity.getSortBy()); - validateEntityFieldName(surrenderReasonSearchEntity.getSortBy(), SurrenderReasonEntity.class); - } - - String orderBy = "order by id"; - if (surrenderReasonSearchEntity.getSortBy() != null && !surrenderReasonSearchEntity.getSortBy().isEmpty()) - orderBy = "order by " + surrenderReasonSearchEntity.getSortBy(); - - searchQuery = searchQuery.replace(":tablename", SurrenderReasonEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (surrenderReasonSearchEntity.getTenantId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", surrenderReasonSearchEntity.getTenantId()); - } - if (surrenderReasonSearchEntity.getId() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id =:id"); - paramValues.put("id", surrenderReasonSearchEntity.getId()); - } - if (surrenderReasonSearchEntity.getName() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("name =:name"); - paramValues.put("name", surrenderReasonSearchEntity.getName()); - } - if (surrenderReasonSearchEntity.getDescription() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("description =:description"); - paramValues.put("description", surrenderReasonSearchEntity.getDescription()); - } - if (surrenderReasonSearchEntity.getIds() != null) { - if (params.length() > 0) - params.append(" and "); - params.append("id in (:ids)"); - paramValues.put("ids", surrenderReasonSearchEntity.getIds()); - } - - Pagination page = new Pagination<>(); - if (surrenderReasonSearchEntity.getOffset() != null) - page.setOffset(surrenderReasonSearchEntity.getOffset()); - if (surrenderReasonSearchEntity.getPageSize() != null) - page.setPageSize(surrenderReasonSearchEntity.getPageSize()); - - if (params.length() > 0) - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(SurrenderReasonEntity.class); - - List surrenderReasonEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(surrenderReasonEntities.size()); - - List surrenderreasons = new ArrayList<>(); - for (SurrenderReasonEntity surrenderReasonEntity : surrenderReasonEntities) - surrenderreasons.add(surrenderReasonEntity.toDomain()); - page.setPagedData(surrenderreasons); - - return page; - } - - public SurrenderReasonEntity findById(SurrenderReasonEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) - paramValues.put(s, getValue(getField(entity, s), entity)); - - List surrenderreasons = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(SurrenderReasonEntity.class)); - if (surrenderreasons.isEmpty()) - return null; - else - return surrenderreasons.get(0); - - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/advice/CustomControllerAdvice.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/advice/CustomControllerAdvice.java deleted file mode 100644 index ec134139001..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/advice/CustomControllerAdvice.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.egov.egf.instrument.web.advice; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.Error; -import org.egov.common.contract.response.ErrorField; -import org.egov.common.contract.response.ErrorResponse; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.exception.UnauthorizedAccessException; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.MissingServletRequestParameterException; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; - -@ControllerAdvice -@RestController -public class CustomControllerAdvice { - - @ResponseStatus(HttpStatus.BAD_REQUEST) - @ExceptionHandler(MissingServletRequestParameterException.class) - public String handleMissingParamsError(Exception ex) { - return ex.getMessage(); - } - - @ResponseStatus(HttpStatus.BAD_REQUEST) - @ExceptionHandler(CustomBindException.class) - public ErrorResponse handleBindingErrors(CustomBindException ex) { - ErrorResponse errRes = new ErrorResponse(); - BindingResult errors = ex.getErrors(); - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.BAD_REQUEST.toString()); - errRes.setResponseInfo(responseInfo); - Error error = new Error(); - - if (errors.getGlobalError() != null) { - error.setCode(Integer.valueOf(errors.getGlobalError().getCode())); - error.setMessage(errors.getGlobalError().getObjectName()); - error.setDescription(errors.getGlobalError().getDefaultMessage()); - } else if (errors.getFieldErrorCount() > 0) - error.setDescription("Missing fields"); - if (errors.hasFieldErrors()) { - error.setFields(new ArrayList()); - List fieldErrors = errors.getFieldErrors(); - for (org.springframework.validation.FieldError errs : fieldErrors) { - ErrorField f = new ErrorField(errs.getCode(), errs.getDefaultMessage(), errs.getField()); - error.getFields().add(f); - - } - } - errRes.setError(error); - return errRes; - } - - @ResponseStatus(HttpStatus.BAD_REQUEST) - @ExceptionHandler(InvalidDataException.class) - public ErrorResponse handleBindingErrors(InvalidDataException ex) { - ErrorResponse errRes = new ErrorResponse(); - - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.BAD_REQUEST.toString()); - errRes.setResponseInfo(responseInfo); - Error error = new Error(); - error.setCode(Integer.valueOf(InvalidDataException.code)); - error.setMessage(ex.getFieldName()); - error.setDescription(ex.getMessage()); - errRes.setError(error); - - return errRes; - } - - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - @ExceptionHandler(Throwable.class) - public ErrorResponse handleThrowable(Exception ex) { - ErrorResponse errRes = new ErrorResponse(); - ex.printStackTrace(); - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.BAD_REQUEST.toString()); - errRes.setResponseInfo(responseInfo); - Error error = new Error(); - - error.setCode(500); - error.setMessage("Internal Server Error"); - error.setDescription(ex.getMessage()); - return errRes; - } - - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - @ExceptionHandler(Exception.class) - public ErrorResponse handleServerError(Exception ex) { - ex.printStackTrace(); - ErrorResponse errRes = new ErrorResponse(); - - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.toString()); - errRes.setResponseInfo(responseInfo); - Error error = new Error(); - - error.setCode(500); - error.setMessage("Internal Server Error"); - error.setDescription(ex.getMessage()); - errRes.setError(error); - return errRes; - } - - @ResponseStatus(HttpStatus.UNAUTHORIZED) - @ExceptionHandler(UnauthorizedAccessException.class) - public ErrorResponse handleAuthenticationError(UnauthorizedAccessException ex) { - ex.printStackTrace(); - ErrorResponse errRes = new ErrorResponse(); - - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.UNAUTHORIZED.toString()); - errRes.setResponseInfo(responseInfo); - Error error = new Error(); - - error.setCode(404); - error.setMessage("Un Authorized Access"); - error.setDescription(ex.getMessage()); - errRes.setError(error); - return errRes; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/DishonorReasonContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/DishonorReasonContract.java deleted file mode 100644 index 0042d0d2613..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/DishonorReasonContract.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.egf.instrument.web.contract; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.web.contract.AuditableContract; -import org.egov.egf.instrument.domain.model.Instrument; -import org.hibernate.validator.constraints.NotBlank; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "reason", "remarks", "instrument", "reversalVoucherId", "dishonorDate" }) -public class DishonorReasonContract extends AuditableContract { - /** - * id is the unique Identifier of the reason - */ - private String id; - /** - * name is the reason of instrument surrender. Example "Damaged cheque","Cheque to be scrapped" etc - */ - @NotBlank - @Size(max = 100, min = 5) - private String reason; - /** - * description is detailed description of the surrender of a instrument - */ - @NotBlank - @Size(max = 250) - private String remarks; - @NotBlank - @Size(max = 250) - private String instrument; - private String reversalVoucherId; - @NotNull - private Long dishonorDate; - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/DishonorReasonSearchContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/DishonorReasonSearchContract.java deleted file mode 100644 index 02c7d100f5c..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/DishonorReasonSearchContract.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.instrument.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class DishonorReasonSearchContract extends DishonorReasonContract { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentAccountCodeContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentAccountCodeContract.java deleted file mode 100644 index 3cdaa4d45df..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentAccountCodeContract.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.instrument.web.contract; - -import org.egov.common.web.contract.AuditableContract; -import org.egov.egf.master.web.contract.ChartOfAccountContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "instrumentType", "accountCode" }) -public class InstrumentAccountCodeContract extends AuditableContract { - - /* - * id is the unique reference to Instrument AccountCodes entered in the system. - */ - private String id; - - /* - * instrumentType specifies the mode/type of transaction that can be made - i.e Cheque,DD,RTGS. For receipt - Cheque,DD,RTGS - */ - private InstrumentTypeContract instrumentType; - - /* - * accountCode is the COA that is tagged to a instrument type used in ledger posting. - */ - private ChartOfAccountContract accountCode; - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentAccountCodeSearchContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentAccountCodeSearchContract.java deleted file mode 100644 index dcdca88040b..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentAccountCodeSearchContract.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.instrument.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentAccountCodeSearchContract extends InstrumentAccountCodeContract { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentContract.java deleted file mode 100644 index ab13ae24d02..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentContract.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.instrument.web.contract; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.web.contract.AuditableContract; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.hibernate.validator.constraints.NotBlank; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "transactionNumber", "transactionDate", "amount", "instrumentType", "bank", "branchName", - "bankAccount", "financialStatus", "remittanceVoucherId", "transactionType", "payee", "drawer", "surrendarReason", - "serialNo", - "instrumentVouchers" }) -public class InstrumentContract extends AuditableContract { - - /* - * id is the unique reference to InstrumentContract Header entered in the system. - */ - private String id; - - /* - * transactionNumber unique number of the instrument. For cheque type this is cheque date. For DD type it is DD number - */ - @NotBlank - @Size(max = 50, min = 6) - private String transactionNumber; - - /* - * transactionDate is the date of instrument . For cheque type it is cheque date. for DD it is DD date - */ - @NotNull - private Date transactionDate; - - /* - * amount is the instrument amount. For cheque type it is cheque amount. - */ - @NotNull - @Min(value = 1) - @Max(value = 999999999) - private BigDecimal amount; - - /* - * instrumentType specifies the type of the instrument - The folowing are the different types Cash,Cheque,DD,POC - */ - private InstrumentTypeContract instrumentType; - - /* - * bank references to the bank from which the payment/Receipt is made. - */ - private BankContract bank; - - /* - * branchName is the branch name entered in the collection Receipt. - */ - - @Size(max = 50) - private String branchName; - - /* - * bankAccount is the reference of the Bank account from which the payment instrument is assigned - */ - private BankAccountContract bankAccount; - - /* - * instrumentStatus gives the current status of the instrument. - */ - private FinancialStatusContract financialStatus; - - private String remittanceVoucherId; - - /* - * transactionType are of two kinds -Debit and Credit. When its a receipt instrument it is Debit and in case of payment - * instrument its credit. - */ - @NotNull - private TransactionTypeContract transactionType; - - /* - * payee is the entity who is making the payment via instrument - */ - @Size(max = 50) - private String payee; - - /* - * drawer is the entity to which the payment is made. - */ - @Size(max = 100) - private String drawer; - - /* - * surrenderReason is the reason from the defined list seleted while surrendering a payment cheque. Depending on the reason, - * the cheque can be re-used or not is decided. - */ - private SurrenderReasonContract surrenderReason; - - private DishonorReasonContract dishonor; - - /* - * serialNo is the series of the cheque numbers from which the instrument is assigned from. The cheque numbers in an account - * is defined based on Year, Bank account and tagged to a department. - */ - @NotBlank - @Size(max = 50, min = 2) - private String serialNo; - - private String payinSlipId; - - @Min(value = 1) - @Max(value = 999999999) - private BigDecimal reconciledAmount; - - private Date reconciledOn; - - /* - * instrumentVouchers is the reference to the payment vouchers for which the instrument is attached. - */ - private List instrumentVouchers = new ArrayList<>(); - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentSearchContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentSearchContract.java deleted file mode 100644 index 976d3af9a88..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentSearchContract.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.egov.egf.instrument.web.contract; - -import java.util.Date; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentSearchContract extends InstrumentContract { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private String instrumentTypes; - private String receiptIds; - private String financialStatuses; - private Date transactionFromDate; - private Date transactionToDate; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentTypeContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentTypeContract.java deleted file mode 100644 index 1804330ad71..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentTypeContract.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.instrument.web.contract; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.NotBlank; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "description", "active", "instrumentTypeProperties" }) -public class InstrumentTypeContract extends AuditableContract { - - /* - * id is the unique reference to instrument type entered in the system. - */ - private String id; - - /* - * type specifies the mode/type of transaction that can be made - i.e Cheque,DD,RTGS. For receipt - Cheque,DD,RTGS - */ - @NotNull - @NotBlank - @Size(max = 50, min = 2) - private String name; - - /* - * description specifies details of the instrument type . For example type DD description may be Demand Draft - */ - - @Size(max = 100) - private String description; - - /* - * active specifies whether the type is active for transacting. - */ - @NotNull - private Boolean active; - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentTypePropertyContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentTypePropertyContract.java deleted file mode 100644 index ad15f1c3389..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentTypePropertyContract.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.egf.instrument.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.egov.egf.master.web.contract.FinancialStatusContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "transactionType", "reconciledOncreate", "statusOnCreate", "statusOnUpdate", "statusOnReconcile" }) -public class InstrumentTypePropertyContract extends AuditableContract { - - private String id; - @NotNull - private TransactionTypeContract transactionType; - @NotNull - private Boolean reconciledOncreate; - @NotNull - private FinancialStatusContract statusOnCreate; - @NotNull - private FinancialStatusContract statusOnUpdate; - @NotNull - private FinancialStatusContract statusOnReconcile; - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentTypeSearchContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentTypeSearchContract.java deleted file mode 100644 index 2be4f7eac68..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentTypeSearchContract.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.instrument.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentTypeSearchContract extends InstrumentTypeContract { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentVoucherContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentVoucherContract.java deleted file mode 100644 index 2199ed62e9c..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/InstrumentVoucherContract.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.instrument.web.contract; - -import org.egov.common.web.contract.AuditableContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "instrument", "voucherHeaderId", "receiptHeaderId" }) -public class InstrumentVoucherContract extends AuditableContract { - - /* - * instrumentHeaderId is the reference of the instrument attached to a voucher - */ - private String instrument; - - /* - * voucherHeaderId is the reference of the voucher attached to a instrument. - */ - private String voucherHeaderId; - - /* - * receiptHeaderId is the reference of the receipt attached to a instrument. - */ - private String receiptHeaderId; - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/SurrenderReasonContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/SurrenderReasonContract.java deleted file mode 100644 index 89d8ae6aeaf..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/SurrenderReasonContract.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.egov.egf.instrument.web.contract; - -import javax.validation.constraints.Size; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.NotBlank; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "description" }) -public class SurrenderReasonContract extends AuditableContract { - /** - * id is the unique Identifier of the reason - */ - private String id; - /** - * name is the reason of instrument surrender. Example "Damaged cheque","Cheque to be scrapped" etc - */ - @NotBlank - @Size(max = 50, min = 5) - private String name; - /** - * description is detailed description of the surrender of a instrument - */ - @NotBlank - @Size(max = 250) - private String description; - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/SurrenderReasonSearchContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/SurrenderReasonSearchContract.java deleted file mode 100644 index 3ec169340ee..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/SurrenderReasonSearchContract.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.instrument.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SurrenderReasonSearchContract extends SurrenderReasonContract { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/TransactionTypeContract.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/TransactionTypeContract.java deleted file mode 100644 index f0dc8098dd3..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/contract/TransactionTypeContract.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.egov.egf.instrument.web.contract; - -public enum TransactionTypeContract { - Debit, Credit -} diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/InstrumentAccountCodeController.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/InstrumentAccountCodeController.java deleted file mode 100644 index 2f0ff88912b..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/InstrumentAccountCodeController.java +++ /dev/null @@ -1,182 +0,0 @@ -package org.egov.egf.instrument.web.controller; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.domain.service.InstrumentAccountCodeService; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeContract; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeSearchContract; -import org.egov.egf.instrument.web.mapper.InstrumentAccountCodeMapper; -import org.egov.egf.instrument.web.requests.InstrumentAccountCodeRequest; -import org.egov.egf.instrument.web.requests.InstrumentAccountCodeResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/instrumentaccountcodes") -public class InstrumentAccountCodeController { - - public static final String ACTION_CREATE = "create"; - public static final String ACTION_UPDATE = "update"; - public static final String ACTION_DELETE = "delete"; - public static final String PLACEHOLDER = "placeholder"; - - @Autowired - private InstrumentAccountCodeService instrumentAccountCodeService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest, - BindingResult errors) { - - InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); - InstrumentAccountCodeResponse instrumentAccountCodeResponse = new InstrumentAccountCodeResponse(); - instrumentAccountCodeResponse.setResponseInfo(getResponseInfo(instrumentAccountCodeRequest.getRequestInfo())); - List instrumentaccountcodes = new ArrayList<>(); - InstrumentAccountCode instrumentAccountCode; - List instrumentAccountCodeContracts = new ArrayList<>(); - InstrumentAccountCodeContract contract; - - instrumentAccountCodeRequest.getRequestInfo().setAction(ACTION_CREATE); - - for (InstrumentAccountCodeContract instrumentAccountCodeContract : instrumentAccountCodeRequest - .getInstrumentAccountCodes()) { - instrumentAccountCode = mapper.toDomain(instrumentAccountCodeContract); - instrumentAccountCode.setCreatedDate(new Date()); - instrumentAccountCode.setCreatedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); - instrumentAccountCode.setLastModifiedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); - instrumentaccountcodes.add(instrumentAccountCode); - } - - instrumentaccountcodes = instrumentAccountCodeService.create(instrumentaccountcodes, errors, - instrumentAccountCodeRequest.getRequestInfo()); - - for (InstrumentAccountCode iac : instrumentaccountcodes) { - contract = mapper.toContract(iac); - instrumentAccountCodeContracts.add(contract); - } - - instrumentAccountCodeResponse.setInstrumentAccountCodes(instrumentAccountCodeContracts); - - return instrumentAccountCodeResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentAccountCodeResponse update(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest, - BindingResult errors) { - - InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); - instrumentAccountCodeRequest.getRequestInfo().setAction(ACTION_UPDATE); - InstrumentAccountCodeResponse instrumentAccountCodeResponse = new InstrumentAccountCodeResponse(); - List instrumentaccountcodes = new ArrayList<>(); - instrumentAccountCodeResponse.setResponseInfo(getResponseInfo(instrumentAccountCodeRequest.getRequestInfo())); - InstrumentAccountCode instrumentAccountCode; - InstrumentAccountCodeContract contract; - List instrumentAccountCodeContracts = new ArrayList<>(); - - for (InstrumentAccountCodeContract instrumentAccountCodeContract : instrumentAccountCodeRequest - .getInstrumentAccountCodes()) { - instrumentAccountCode = mapper.toDomain(instrumentAccountCodeContract); - instrumentAccountCode.setLastModifiedBy(instrumentAccountCodeRequest.getRequestInfo().getUserInfo()); - instrumentAccountCode.setLastModifiedDate(new Date()); - instrumentaccountcodes.add(instrumentAccountCode); - } - - instrumentaccountcodes = instrumentAccountCodeService.update(instrumentaccountcodes, errors, - instrumentAccountCodeRequest.getRequestInfo()); - - for (InstrumentAccountCode iac : instrumentaccountcodes) { - contract = mapper.toContract(iac); - instrumentAccountCodeContracts.add(contract); - } - - instrumentAccountCodeResponse.setInstrumentAccountCodes(instrumentAccountCodeContracts); - - return instrumentAccountCodeResponse; - } - - @PostMapping("/_delete") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentAccountCodeResponse delete(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest, - BindingResult errors) { - - InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); - instrumentAccountCodeRequest.getRequestInfo().setAction(ACTION_DELETE); - InstrumentAccountCodeResponse instrumentAccountCodeResponse = new InstrumentAccountCodeResponse(); - List instrumentaccountcodes = new ArrayList<>(); - instrumentAccountCodeResponse.setResponseInfo(getResponseInfo(instrumentAccountCodeRequest.getRequestInfo())); - InstrumentAccountCode instrumentAccountCode; - InstrumentAccountCodeContract contract; - List instrumentAccountCodeContracts = new ArrayList<>(); - - for (InstrumentAccountCodeContract instrumentAccountCodeContract : instrumentAccountCodeRequest - .getInstrumentAccountCodes()) { - instrumentAccountCode = mapper.toDomain(instrumentAccountCodeContract); - instrumentaccountcodes.add(instrumentAccountCode); - } - - instrumentaccountcodes = instrumentAccountCodeService.delete(instrumentaccountcodes, errors, - instrumentAccountCodeRequest.getRequestInfo()); - - for (InstrumentAccountCode iac : instrumentaccountcodes) { - contract = mapper.toContract(iac); - instrumentAccountCodeContracts.add(contract); - } - - instrumentAccountCodeResponse.setInstrumentAccountCodes(instrumentAccountCodeContracts); - - return instrumentAccountCodeResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public InstrumentAccountCodeResponse search( - @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract, - RequestInfo requestInfo, BindingResult errors) { - - InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); - InstrumentAccountCodeSearch domain = mapper.toSearchDomain(instrumentAccountCodeSearchContract); - InstrumentAccountCodeContract contract; - List instrumentAccountCodeContracts = new ArrayList<>(); - Pagination instrumentaccountcodes = instrumentAccountCodeService.search(domain); - - if (instrumentaccountcodes.getPagedData() != null) - for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes.getPagedData()) { - contract = mapper.toContract(instrumentAccountCode); - instrumentAccountCodeContracts.add(contract); - } - - InstrumentAccountCodeResponse response = new InstrumentAccountCodeResponse(); - response.setInstrumentAccountCodes(instrumentAccountCodeContracts); - response.setPage(new PaginationContract(instrumentaccountcodes)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .ts(new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date())).resMsgId(requestInfo.getMsgId()) - .resMsgId(PLACEHOLDER).status(PLACEHOLDER).build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/InstrumentController.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/InstrumentController.java deleted file mode 100644 index 3c0f4785a02..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/InstrumentController.java +++ /dev/null @@ -1,220 +0,0 @@ -package org.egov.egf.instrument.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.service.InstrumentService; -import org.egov.egf.instrument.web.contract.InstrumentContract; -import org.egov.egf.instrument.web.contract.InstrumentSearchContract; -import org.egov.egf.instrument.web.mapper.InstrumentMapper; -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.egov.egf.instrument.web.requests.InstrumentResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/instruments") -public class InstrumentController { - - public static final String ACTION_CREATE = "create"; - public static final String ACTION_UPDATE = "update"; - public static final String ACTION_DELETE = "delete"; - public static final String PLACEHOLDER = "placeholder"; - - @Autowired - private InstrumentService instrumentService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentResponse create(@RequestBody InstrumentRequest instrumentRequest, BindingResult errors) { - - InstrumentMapper mapper = new InstrumentMapper(); - InstrumentResponse instrumentResponse = new InstrumentResponse(); - instrumentResponse.setResponseInfo(getResponseInfo(instrumentRequest.getRequestInfo())); - List instruments = new ArrayList<>(); - Instrument instrument; - List instrumentContracts = new ArrayList<>(); - InstrumentContract contract; - - instrumentRequest.getRequestInfo().setAction(ACTION_CREATE); - - for (InstrumentContract instrumentContract : instrumentRequest.getInstruments()) { - instrument = mapper.toDomain(instrumentContract); - instrument.setCreatedDate(new Date()); - instrument.setCreatedBy(instrumentRequest.getRequestInfo().getUserInfo()); - instrument.setLastModifiedBy(instrumentRequest.getRequestInfo().getUserInfo()); - instruments.add(instrument); - } - - instruments = instrumentService.create(instruments, errors, instrumentRequest.getRequestInfo()); - - for (Instrument i : instruments) { - contract = mapper.toContract(i); - instrumentContracts.add(contract); - } - - instrumentResponse.setInstruments(instrumentContracts); - - return instrumentResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentResponse update(@RequestBody InstrumentRequest instrumentRequest, BindingResult errors) { - - InstrumentMapper mapper = new InstrumentMapper(); - instrumentRequest.getRequestInfo().setAction(ACTION_UPDATE); - InstrumentResponse instrumentResponse = new InstrumentResponse(); - List instruments = new ArrayList<>(); - instrumentResponse.setResponseInfo(getResponseInfo(instrumentRequest.getRequestInfo())); - Instrument instrument; - InstrumentContract contract; - List instrumentContracts = new ArrayList<>(); - - for (InstrumentContract instrumentContract : instrumentRequest.getInstruments()) { - instrument = mapper.toDomain(instrumentContract); - instrument.setLastModifiedBy(instrumentRequest.getRequestInfo().getUserInfo()); - instrument.setLastModifiedDate(new Date()); - instruments.add(instrument); - } - - instruments = instrumentService.update(instruments, errors, instrumentRequest.getRequestInfo()); - - for (Instrument i : instruments) { - contract = mapper.toContract(i); - instrumentContracts.add(contract); - } - - instrumentResponse.setInstruments(instrumentContracts); - - return instrumentResponse; - } - - @PostMapping("/_delete") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentResponse delete(@RequestBody InstrumentRequest instrumentRequest, BindingResult errors) { - - InstrumentMapper mapper = new InstrumentMapper(); - instrumentRequest.getRequestInfo().setAction(ACTION_DELETE); - InstrumentResponse instrumentResponse = new InstrumentResponse(); - List instruments = new ArrayList<>(); - instrumentResponse.setResponseInfo(getResponseInfo(instrumentRequest.getRequestInfo())); - Instrument instrument; - InstrumentContract contract; - List instrumentContracts = new ArrayList<>(); - - for (InstrumentContract instrumentContract : instrumentRequest.getInstruments()) { - instrument = mapper.toDomain(instrumentContract); - instruments.add(instrument); - } - - instruments = instrumentService.delete(instruments, errors, instrumentRequest.getRequestInfo()); - - for (Instrument i : instruments) { - contract = mapper.toContract(i); - instrumentContracts.add(contract); - } - - instrumentResponse.setInstruments(instrumentContracts); - - return instrumentResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public InstrumentResponse search(@ModelAttribute InstrumentSearchContract instrumentSearchContract, - RequestInfo requestInfo, BindingResult errors) { - - InstrumentMapper mapper = new InstrumentMapper(); - InstrumentSearch domain = mapper.toSearchDomain(instrumentSearchContract); - InstrumentContract contract; - List instrumentContracts = new ArrayList<>(); - Pagination instruments = instrumentService.search(domain); - - if (instruments.getPagedData() != null) - for (Instrument instrument : instruments.getPagedData()) { - contract = mapper.toContract(instrument); - instrumentContracts.add(contract); - } - - InstrumentResponse response = new InstrumentResponse(); - response.setInstruments(instrumentContracts); - response.setPage(new PaginationContract(instruments)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - @PostMapping("/_deposit") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentResponse depositInstrument(@RequestBody InstrumentRequest instrumentDepositRequest, BindingResult errors) { - - InstrumentMapper mapper = new InstrumentMapper(); - InstrumentResponse instrumentResponse = new InstrumentResponse(); - instrumentResponse.setResponseInfo(getResponseInfo(instrumentDepositRequest.getRequestInfo())); - List instruments = new ArrayList<>(); - List instrumentContracts = new ArrayList<>(); - InstrumentContract contract; - - instrumentDepositRequest.getRequestInfo().setAction(ACTION_UPDATE); - - instruments = instrumentService.deposit(instrumentDepositRequest, errors, instrumentDepositRequest.getRequestInfo()); - - for (Instrument i : instruments) { - contract = mapper.toContract(i); - instrumentContracts.add(contract); - } - - instrumentResponse.setInstruments(instrumentContracts); - - return instrumentResponse; - } - - @PostMapping("/_dishonor") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentResponse dishonorInstrument(@RequestBody InstrumentRequest instrumentDepositRequest, BindingResult errors) { - - InstrumentMapper mapper = new InstrumentMapper(); - InstrumentResponse instrumentResponse = new InstrumentResponse(); - instrumentResponse.setResponseInfo(getResponseInfo(instrumentDepositRequest.getRequestInfo())); - List instruments = new ArrayList<>(); - List instrumentContracts = new ArrayList<>(); - InstrumentContract contract; - - instrumentDepositRequest.getRequestInfo().setAction(ACTION_UPDATE); - - instruments = instrumentService.dishonor(instrumentDepositRequest, errors, instrumentDepositRequest.getRequestInfo()); - - for (Instrument i : instruments) { - contract = mapper.toContract(i); - instrumentContracts.add(contract); - } - - instrumentResponse.setInstruments(instrumentContracts); - - return instrumentResponse; - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId(PLACEHOLDER).status(PLACEHOLDER).build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/InstrumentTypeController.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/InstrumentTypeController.java deleted file mode 100644 index b1caacd7f12..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/InstrumentTypeController.java +++ /dev/null @@ -1,173 +0,0 @@ -package org.egov.egf.instrument.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.domain.service.InstrumentTypeService; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.egov.egf.instrument.web.contract.InstrumentTypeSearchContract; -import org.egov.egf.instrument.web.mapper.InstrumentTypeMapper; -import org.egov.egf.instrument.web.requests.InstrumentTypeRequest; -import org.egov.egf.instrument.web.requests.InstrumentTypeResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/instrumenttypes") -public class InstrumentTypeController { - - public static final String ACTION_CREATE = "create"; - public static final String ACTION_UPDATE = "update"; - public static final String ACTION_DELETE = "delete"; - public static final String PLACEHOLDER = "placeholder"; - - @Autowired - private InstrumentTypeService instrumentTypeService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentTypeResponse create(@RequestBody InstrumentTypeRequest instrumentTypeRequest, - BindingResult errors) { - - InstrumentTypeMapper mapper = new InstrumentTypeMapper(); - InstrumentTypeResponse instrumentTypeResponse = new InstrumentTypeResponse(); - instrumentTypeResponse.setResponseInfo(getResponseInfo(instrumentTypeRequest.getRequestInfo())); - List instrumenttypes = new ArrayList<>(); - InstrumentType instrumentType; - List instrumentTypeContracts = new ArrayList<>(); - InstrumentTypeContract contract; - - instrumentTypeRequest.getRequestInfo().setAction(ACTION_CREATE); - - for (InstrumentTypeContract instrumentTypeContract : instrumentTypeRequest.getInstrumentTypes()) { - instrumentType = mapper.toDomain(instrumentTypeContract); - instrumentType.setCreatedDate(new Date()); - instrumentType.setCreatedBy(instrumentTypeRequest.getRequestInfo().getUserInfo()); - instrumentType.setLastModifiedBy(instrumentTypeRequest.getRequestInfo().getUserInfo()); - instrumenttypes.add(instrumentType); - } - - instrumenttypes = instrumentTypeService.create(instrumenttypes, errors, instrumentTypeRequest.getRequestInfo()); - - for (InstrumentType it : instrumenttypes) { - contract = mapper.toContract(it); - instrumentTypeContracts.add(contract); - } - - instrumentTypeResponse.setInstrumentTypes(instrumentTypeContracts); - - return instrumentTypeResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentTypeResponse update(@RequestBody InstrumentTypeRequest instrumentTypeRequest, - BindingResult errors) { - - InstrumentTypeMapper mapper = new InstrumentTypeMapper(); - instrumentTypeRequest.getRequestInfo().setAction(ACTION_UPDATE); - InstrumentTypeResponse instrumentTypeResponse = new InstrumentTypeResponse(); - List instrumenttypes = new ArrayList<>(); - instrumentTypeResponse.setResponseInfo(getResponseInfo(instrumentTypeRequest.getRequestInfo())); - InstrumentType instrumentType; - InstrumentTypeContract contract; - List instrumentTypeContracts = new ArrayList<>(); - - for (InstrumentTypeContract instrumentTypeContract : instrumentTypeRequest.getInstrumentTypes()) { - instrumentType = mapper.toDomain(instrumentTypeContract); - instrumentType.setLastModifiedBy(instrumentTypeRequest.getRequestInfo().getUserInfo()); - instrumentType.setLastModifiedDate(new Date()); - instrumenttypes.add(instrumentType); - } - - instrumenttypes = instrumentTypeService.update(instrumenttypes, errors, instrumentTypeRequest.getRequestInfo()); - - for (InstrumentType it : instrumenttypes) { - contract = mapper.toContract(it); - instrumentTypeContracts.add(contract); - } - - instrumentTypeResponse.setInstrumentTypes(instrumentTypeContracts); - - return instrumentTypeResponse; - } - - @PostMapping("/_delete") - @ResponseStatus(HttpStatus.CREATED) - public InstrumentTypeResponse delete(@RequestBody InstrumentTypeRequest instrumentTypeRequest, - BindingResult errors) { - - InstrumentTypeMapper mapper = new InstrumentTypeMapper(); - instrumentTypeRequest.getRequestInfo().setAction(ACTION_DELETE); - InstrumentTypeResponse instrumentTypeResponse = new InstrumentTypeResponse(); - List instrumenttypes = new ArrayList<>(); - instrumentTypeResponse.setResponseInfo(getResponseInfo(instrumentTypeRequest.getRequestInfo())); - InstrumentType instrumentType; - InstrumentTypeContract contract; - List instrumentTypeContracts = new ArrayList<>(); - - for (InstrumentTypeContract instrumentTypeContract : instrumentTypeRequest.getInstrumentTypes()) { - instrumentType = mapper.toDomain(instrumentTypeContract); - instrumenttypes.add(instrumentType); - } - - instrumenttypes = instrumentTypeService.delete(instrumenttypes, errors, instrumentTypeRequest.getRequestInfo()); - - for (InstrumentType it : instrumenttypes) { - contract = mapper.toContract(it); - instrumentTypeContracts.add(contract); - } - - instrumentTypeResponse.setInstrumentTypes(instrumentTypeContracts); - - return instrumentTypeResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public InstrumentTypeResponse search(@ModelAttribute InstrumentTypeSearchContract instrumentTypeSearchContract, - RequestInfo requestInfo, BindingResult errors) { - - InstrumentTypeMapper mapper = new InstrumentTypeMapper(); - InstrumentTypeSearch domain = mapper.toSearchDomain(instrumentTypeSearchContract); - InstrumentTypeContract contract; - List instrumentTypeContracts = new ArrayList<>(); - Pagination instrumenttypes = instrumentTypeService.search(domain); - - if (instrumenttypes.getPagedData() != null) - for (InstrumentType instrumentType : instrumenttypes.getPagedData()) { - contract = mapper.toContract(instrumentType); - instrumentTypeContracts.add(contract); - } - - InstrumentTypeResponse response = new InstrumentTypeResponse(); - response.setInstrumentTypes(instrumentTypeContracts); - response.setPage(new PaginationContract(instrumenttypes)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId(PLACEHOLDER).status(PLACEHOLDER).build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/SurrenderReasonController.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/SurrenderReasonController.java deleted file mode 100644 index 25773b72a9a..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/controller/SurrenderReasonController.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.egov.egf.instrument.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.domain.service.SurrenderReasonService; -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; -import org.egov.egf.instrument.web.contract.SurrenderReasonSearchContract; -import org.egov.egf.instrument.web.mapper.SurrenderReasonMapper; -import org.egov.egf.instrument.web.requests.SurrenderReasonRequest; -import org.egov.egf.instrument.web.requests.SurrenderReasonResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/surrenderreasons") -public class SurrenderReasonController { - - public static final String ACTION_CREATE = "create"; - public static final String ACTION_UPDATE = "update"; - public static final String ACTION_DELETE = "delete"; - public static final String PLACEHOLDER = "placeholder"; - - @Autowired - private SurrenderReasonService surrenderReasonService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public SurrenderReasonResponse create(@RequestBody SurrenderReasonRequest surrenderReasonRequest, - BindingResult errors) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - SurrenderReasonResponse surrenderReasonResponse = new SurrenderReasonResponse(); - surrenderReasonResponse.setResponseInfo(getResponseInfo(surrenderReasonRequest.getRequestInfo())); - List surrenderreasons = new ArrayList<>(); - SurrenderReason surrenderReason; - List surrenderReasonContracts = new ArrayList<>(); - SurrenderReasonContract contract; - - surrenderReasonRequest.getRequestInfo().setAction(ACTION_CREATE); - - for (SurrenderReasonContract surrenderReasonContract : surrenderReasonRequest.getSurrenderReasons()) { - surrenderReason = mapper.toDomain(surrenderReasonContract); - surrenderReason.setCreatedDate(new Date()); - surrenderReason.setCreatedBy(surrenderReasonRequest.getRequestInfo().getUserInfo()); - surrenderReason.setLastModifiedBy(surrenderReasonRequest.getRequestInfo().getUserInfo()); - surrenderreasons.add(surrenderReason); - } - - surrenderreasons = surrenderReasonService.create(surrenderreasons, errors, - surrenderReasonRequest.getRequestInfo()); - - for (SurrenderReason sr : surrenderreasons) { - contract = mapper.toContract(sr); - surrenderReasonContracts.add(contract); - } - - surrenderReasonResponse.setSurrenderReasons(surrenderReasonContracts); - - return surrenderReasonResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public SurrenderReasonResponse update(@RequestBody SurrenderReasonRequest surrenderReasonRequest, - BindingResult errors) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - surrenderReasonRequest.getRequestInfo().setAction(ACTION_UPDATE); - SurrenderReasonResponse surrenderReasonResponse = new SurrenderReasonResponse(); - List surrenderreasons = new ArrayList<>(); - surrenderReasonResponse.setResponseInfo(getResponseInfo(surrenderReasonRequest.getRequestInfo())); - SurrenderReason surrenderReason; - SurrenderReasonContract contract; - List surrenderReasonContracts = new ArrayList<>(); - - for (SurrenderReasonContract surrenderReasonContract : surrenderReasonRequest.getSurrenderReasons()) { - surrenderReason = mapper.toDomain(surrenderReasonContract); - surrenderReason.setLastModifiedBy(surrenderReasonRequest.getRequestInfo().getUserInfo()); - surrenderReason.setLastModifiedDate(new Date()); - surrenderreasons.add(surrenderReason); - } - - surrenderreasons = surrenderReasonService.update(surrenderreasons, errors, - surrenderReasonRequest.getRequestInfo()); - - for (SurrenderReason sr : surrenderreasons) { - contract = mapper.toContract(sr); - surrenderReasonContracts.add(contract); - } - surrenderReasonResponse.setSurrenderReasons(surrenderReasonContracts); - - return surrenderReasonResponse; - } - - @PostMapping("/_delete") - @ResponseStatus(HttpStatus.CREATED) - public SurrenderReasonResponse delete(@RequestBody SurrenderReasonRequest surrenderReasonRequest, - BindingResult errors) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - surrenderReasonRequest.getRequestInfo().setAction(ACTION_DELETE); - SurrenderReasonResponse surrenderReasonResponse = new SurrenderReasonResponse(); - List surrenderreasons = new ArrayList<>(); - surrenderReasonResponse.setResponseInfo(getResponseInfo(surrenderReasonRequest.getRequestInfo())); - SurrenderReason surrenderReason; - SurrenderReasonContract contract; - List surrenderReasonContracts = new ArrayList<>(); - - for (SurrenderReasonContract surrenderReasonContract : surrenderReasonRequest.getSurrenderReasons()) { - surrenderReason = mapper.toDomain(surrenderReasonContract); - surrenderreasons.add(surrenderReason); - } - - surrenderreasons = surrenderReasonService.delete(surrenderreasons, errors, - surrenderReasonRequest.getRequestInfo()); - - for (SurrenderReason sr : surrenderreasons) { - contract = mapper.toContract(sr); - surrenderReasonContracts.add(contract); - } - surrenderReasonResponse.setSurrenderReasons(surrenderReasonContracts); - - return surrenderReasonResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public SurrenderReasonResponse search(@ModelAttribute SurrenderReasonSearchContract surrenderReasonSearchContract, - RequestInfo requestInfo, BindingResult errors) { - - SurrenderReasonMapper mapper = new SurrenderReasonMapper(); - SurrenderReasonSearch domain = mapper.toSearchDomain(surrenderReasonSearchContract); - SurrenderReasonContract contract; - List surrenderReasonContracts = new ArrayList<>(); - Pagination surrenderreasons = surrenderReasonService.search(domain); - - if (surrenderreasons.getPagedData() != null) - for (SurrenderReason surrenderReason : surrenderreasons.getPagedData()) { - contract = mapper.toContract(surrenderReason); - surrenderReasonContracts.add(contract); - } - - SurrenderReasonResponse response = new SurrenderReasonResponse(); - response.setSurrenderReasons(surrenderReasonContracts); - response.setPage(new PaginationContract(surrenderreasons)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId(PLACEHOLDER).status(PLACEHOLDER).build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/DishonorReasonMapper.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/DishonorReasonMapper.java deleted file mode 100644 index 23c6be37c8b..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/DishonorReasonMapper.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.egov.egf.instrument.web.mapper; - -import org.egov.egf.instrument.domain.model.DishonorReason; -import org.egov.egf.instrument.domain.model.DishonorReasonSearch; -import org.egov.egf.instrument.web.contract.DishonorReasonContract; -import org.egov.egf.instrument.web.contract.DishonorReasonSearchContract; - -public class DishonorReasonMapper { - - public DishonorReason toDomain(DishonorReasonContract contract) { - - DishonorReason dishonorReason = new DishonorReason(); - - dishonorReason.setId(contract.getId()); - dishonorReason.setReason(contract.getReason()); - dishonorReason.setRemarks(contract.getRemarks()); - dishonorReason.setCreatedBy(contract.getCreatedBy()); - dishonorReason.setCreatedDate(contract.getCreatedDate()); - dishonorReason.setLastModifiedBy(contract.getLastModifiedBy()); - dishonorReason.setLastModifiedDate(contract.getLastModifiedDate()); - dishonorReason.setTenantId(contract.getTenantId()); - - return dishonorReason; - } - - public DishonorReasonContract toContract(DishonorReason dishonorReason) { - - DishonorReasonContract contract = new DishonorReasonContract(); - - contract.setId(dishonorReason.getId()); - contract.setReason(dishonorReason.getReason()); - contract.setRemarks(dishonorReason.getRemarks()); - contract.setCreatedBy(dishonorReason.getCreatedBy()); - contract.setCreatedDate(dishonorReason.getCreatedDate()); - contract.setLastModifiedBy(dishonorReason.getLastModifiedBy()); - contract.setLastModifiedDate(dishonorReason.getLastModifiedDate()); - contract.setTenantId(dishonorReason.getTenantId()); - - return contract; - } - - public DishonorReasonSearch toSearchDomain(DishonorReasonSearchContract contract) { - - DishonorReasonSearch dishonorReasonSearch = new DishonorReasonSearch(); - - dishonorReasonSearch.setId(contract.getId()); - dishonorReasonSearch.setReason(contract.getReason()); - dishonorReasonSearch.setRemarks(contract.getRemarks()); - dishonorReasonSearch.setCreatedBy(contract.getCreatedBy()); - dishonorReasonSearch.setCreatedDate(contract.getCreatedDate()); - dishonorReasonSearch.setLastModifiedBy(contract.getLastModifiedBy()); - dishonorReasonSearch.setLastModifiedDate(contract.getLastModifiedDate()); - dishonorReasonSearch.setTenantId(contract.getTenantId()); - dishonorReasonSearch.setPageSize(contract.getPageSize()); - dishonorReasonSearch.setOffset(contract.getOffset()); - dishonorReasonSearch.setSortBy(contract.getSortBy()); - dishonorReasonSearch.setIds(contract.getIds()); - - return dishonorReasonSearch; - } - - public DishonorReasonSearchContract toSearchContract(DishonorReasonSearch dishonorReasonSearch) { - - DishonorReasonSearchContract contract = new DishonorReasonSearchContract(); - - contract.setId(dishonorReasonSearch.getId()); - contract.setReason(dishonorReasonSearch.getReason()); - contract.setRemarks(dishonorReasonSearch.getRemarks()); - contract.setCreatedBy(dishonorReasonSearch.getCreatedBy()); - contract.setCreatedDate(dishonorReasonSearch.getCreatedDate()); - contract.setLastModifiedBy(dishonorReasonSearch.getLastModifiedBy()); - contract.setLastModifiedDate(dishonorReasonSearch.getLastModifiedDate()); - contract.setTenantId(dishonorReasonSearch.getTenantId()); - contract.setPageSize(dishonorReasonSearch.getPageSize()); - contract.setOffset(dishonorReasonSearch.getOffset()); - contract.setSortBy(dishonorReasonSearch.getSortBy()); - contract.setIds(dishonorReasonSearch.getIds()); - - return contract; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/InstrumentAccountCodeMapper.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/InstrumentAccountCodeMapper.java deleted file mode 100644 index d55e96cd5f8..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/InstrumentAccountCodeMapper.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.egov.egf.instrument.web.mapper; - -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeContract; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeSearchContract; - -public class InstrumentAccountCodeMapper { - - private InstrumentTypeMapper typeMapper = new InstrumentTypeMapper(); - - public InstrumentAccountCode toDomain(InstrumentAccountCodeContract contract) { - - InstrumentAccountCode instrumentAccountCode = new InstrumentAccountCode(); - - instrumentAccountCode.setId(contract.getId()); - - if (contract.getInstrumentType() != null) - instrumentAccountCode.setInstrumentType(typeMapper.toDomain(contract.getInstrumentType())); - - if (contract.getAccountCode() != null) - instrumentAccountCode.setAccountCode(contract.getAccountCode()); - - instrumentAccountCode.setCreatedBy(contract.getCreatedBy()); - instrumentAccountCode.setCreatedDate(contract.getCreatedDate()); - instrumentAccountCode.setLastModifiedBy(contract.getLastModifiedBy()); - instrumentAccountCode.setLastModifiedDate(contract.getLastModifiedDate()); - instrumentAccountCode.setTenantId(contract.getTenantId()); - - return instrumentAccountCode; - } - - public InstrumentAccountCodeContract toContract(InstrumentAccountCode instrumentAccountCode) { - - InstrumentAccountCodeContract contract = new InstrumentAccountCodeContract(); - - contract.setId(instrumentAccountCode.getId()); - - if (instrumentAccountCode.getInstrumentType() != null) - contract.setInstrumentType(typeMapper.toContract(instrumentAccountCode.getInstrumentType())); - - if (instrumentAccountCode.getAccountCode() != null) - contract.setAccountCode(instrumentAccountCode.getAccountCode()); - - contract.setCreatedBy(instrumentAccountCode.getCreatedBy()); - contract.setCreatedDate(instrumentAccountCode.getCreatedDate()); - contract.setLastModifiedBy(instrumentAccountCode.getLastModifiedBy()); - contract.setLastModifiedDate(instrumentAccountCode.getLastModifiedDate()); - contract.setTenantId(instrumentAccountCode.getTenantId()); - - return contract; - } - - public InstrumentAccountCodeSearch toSearchDomain(InstrumentAccountCodeSearchContract contract) { - - InstrumentAccountCodeSearch instrumentAccountCodeSearch = new InstrumentAccountCodeSearch(); - - instrumentAccountCodeSearch.setId(contract.getId()); - - if (contract.getInstrumentType() != null) - instrumentAccountCodeSearch.setInstrumentType(typeMapper.toDomain(contract.getInstrumentType())); - - if (contract.getAccountCode() != null) - instrumentAccountCodeSearch.setAccountCode(contract.getAccountCode()); - - instrumentAccountCodeSearch.setCreatedBy(contract.getCreatedBy()); - instrumentAccountCodeSearch.setCreatedDate(contract.getCreatedDate()); - instrumentAccountCodeSearch.setLastModifiedBy(contract.getLastModifiedBy()); - instrumentAccountCodeSearch.setLastModifiedDate(contract.getLastModifiedDate()); - instrumentAccountCodeSearch.setTenantId(contract.getTenantId()); - instrumentAccountCodeSearch.setPageSize(contract.getPageSize()); - instrumentAccountCodeSearch.setOffset(contract.getOffset()); - instrumentAccountCodeSearch.setSortBy(contract.getSortBy()); - instrumentAccountCodeSearch.setIds(contract.getIds()); - - return instrumentAccountCodeSearch; - } - - public InstrumentAccountCodeSearchContract toSearchContract( - InstrumentAccountCodeSearch instrumentAccountCodeSearch) { - - InstrumentAccountCodeSearchContract contract = new InstrumentAccountCodeSearchContract(); - - contract.setId(instrumentAccountCodeSearch.getId()); - - if (instrumentAccountCodeSearch.getInstrumentType() != null) - contract.setInstrumentType(typeMapper.toContract(instrumentAccountCodeSearch.getInstrumentType())); - - if (instrumentAccountCodeSearch.getAccountCode() != null) - contract.setAccountCode(instrumentAccountCodeSearch.getAccountCode()); - - contract.setCreatedBy(instrumentAccountCodeSearch.getCreatedBy()); - contract.setCreatedDate(instrumentAccountCodeSearch.getCreatedDate()); - contract.setLastModifiedBy(instrumentAccountCodeSearch.getLastModifiedBy()); - contract.setLastModifiedDate(instrumentAccountCodeSearch.getLastModifiedDate()); - contract.setTenantId(instrumentAccountCodeSearch.getTenantId()); - contract.setPageSize(instrumentAccountCodeSearch.getPageSize()); - contract.setOffset(instrumentAccountCodeSearch.getOffset()); - contract.setSortBy(instrumentAccountCodeSearch.getSortBy()); - contract.setIds(instrumentAccountCodeSearch.getIds()); - - return contract; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/InstrumentMapper.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/InstrumentMapper.java deleted file mode 100644 index b6f07add540..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/InstrumentMapper.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.egov.egf.instrument.web.mapper; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.egf.instrument.domain.model.DishonorReason; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.model.InstrumentVoucher; -import org.egov.egf.instrument.domain.model.TransactionType; -import org.egov.egf.instrument.web.contract.DishonorReasonContract; -import org.egov.egf.instrument.web.contract.InstrumentContract; -import org.egov.egf.instrument.web.contract.InstrumentSearchContract; -import org.egov.egf.instrument.web.contract.InstrumentVoucherContract; -import org.egov.egf.instrument.web.contract.TransactionTypeContract; - -public class InstrumentMapper { - - private InstrumentTypeMapper typeMapper = new InstrumentTypeMapper(); - private SurrenderReasonMapper srMapper = new SurrenderReasonMapper(); - private DishonorReasonMapper drMapper = new DishonorReasonMapper(); - - public Instrument toDomain(InstrumentContract contract) { - - Instrument instrument = new Instrument(); - - instrument.setId(contract.getId()); - instrument.setAmount(contract.getAmount()); - instrument.setBank(contract.getBank()); - instrument.setBankAccount(contract.getBankAccount()); - instrument.setBranchName(contract.getBranchName()); - instrument.setDrawer(contract.getDrawer()); - instrument.setFinancialStatus(contract.getFinancialStatus()); - instrument.setRemittanceVoucherId(contract.getRemittanceVoucherId()); - - if (contract.getInstrumentType() != null) - instrument.setInstrumentType(typeMapper.toDomain(contract.getInstrumentType())); - - if (contract.getSurrenderReason() != null) - instrument.setSurrenderReason(srMapper.toDomain(contract.getSurrenderReason())); - - if (contract.getDishonor() != null){ - DishonorReasonContract dishonor = contract.getDishonor(); -// instrument.setDishonorReason(drMapper.toDomain(contract.getDishonor())); - DishonorReason dishonorReason = new DishonorReason().builder().reason(dishonor.getReason()) - .dishonorDate(dishonor.getDishonorDate()) - .remarks(dishonor.getRemarks()) - .instrument(dishonor.getInstrument()) - .reversalVoucherId(dishonor.getReversalVoucherId()) - .build(); - dishonorReason.setTenantId(contract.getTenantId()); - instrument.setDishonorReason(dishonorReason); - } - - if (contract.getInstrumentVouchers() != null) { - - List instrumentVouchers = new ArrayList<>(); - - if (contract.getInstrumentVouchers() != null) - for (InstrumentVoucherContract ivc : contract.getInstrumentVouchers()) - instrumentVouchers.add(InstrumentVoucher.builder().voucherHeaderId(ivc.getVoucherHeaderId()) - .receiptHeaderId(ivc.getReceiptHeaderId()).build()); - - instrument.setInstrumentVouchers(instrumentVouchers); - - } - - instrument.setPayee(contract.getPayee()); - instrument.setSerialNo(contract.getSerialNo()); - instrument.setTransactionDate(contract.getTransactionDate()); - instrument.setTransactionNumber(contract.getTransactionNumber()); - instrument.setTransactionType(contract.getTransactionType() != null - ? TransactionType.valueOf(contract.getTransactionType().name()) : null); - instrument.setPayinSlipId(contract.getPayinSlipId()); - instrument.setReconciledAmount(contract.getReconciledAmount()); - instrument.setReconciledOn(contract.getReconciledOn()); - instrument.setCreatedBy(contract.getCreatedBy()); - instrument.setCreatedDate(contract.getCreatedDate()); - instrument.setLastModifiedBy(contract.getLastModifiedBy()); - instrument.setLastModifiedDate(contract.getLastModifiedDate()); - instrument.setTenantId(contract.getTenantId()); - instrument.setDeleteReason(contract.getDeleteReason()); - for (InstrumentVoucher iv : instrument.getInstrumentVouchers()) { - iv.setInstrument(instrument); - iv.setTenantId(instrument.getTenantId()); - } - return instrument; - } - - public InstrumentContract toContract(Instrument instrument) { - - InstrumentContract contract = new InstrumentContract(); - - contract.setId(instrument.getId()); - contract.setAmount(instrument.getAmount()); - contract.setBank(instrument.getBank()); - contract.setBankAccount(instrument.getBankAccount()); - contract.setBranchName(instrument.getBranchName()); - contract.setDrawer(instrument.getDrawer()); - contract.setFinancialStatus(instrument.getFinancialStatus()); - contract.setRemittanceVoucherId(instrument.getRemittanceVoucherId()); - - if (instrument.getInstrumentType() != null) - contract.setInstrumentType(typeMapper.toContract(instrument.getInstrumentType())); - - if (instrument.getSurrenderReason() != null) - contract.setSurrenderReason(srMapper.toContract(instrument.getSurrenderReason())); - - if (instrument.getDishonorReason() != null){ - DishonorReason dishonorReason = instrument.getDishonorReason(); - DishonorReasonContract dishonorReasonContract = new DishonorReasonContract().builder() - .id(dishonorReason.getId()) - .reason(dishonorReason.getReason()) - .remarks(dishonorReason.getRemarks()) - .instrument(dishonorReason.getInstrument()) - .dishonorDate(dishonorReason.getDishonorDate()) - .reversalVoucherId(dishonorReason.getReversalVoucherId()) - .build(); - dishonorReasonContract.setTenantId(instrument.getTenantId()); - contract.setDishonor(dishonorReasonContract); - } - - if (instrument.getInstrumentVouchers() != null) { - - List instrumentVouchers = new ArrayList<>(); - - if (instrument.getInstrumentVouchers() != null) - for (InstrumentVoucher iv : instrument.getInstrumentVouchers()) - instrumentVouchers - .add(InstrumentVoucherContract.builder().instrument(contract.getId()) - .voucherHeaderId(iv.getVoucherHeaderId()).receiptHeaderId(iv.getReceiptHeaderId()).build()); - - contract.setInstrumentVouchers(instrumentVouchers); - - } - - contract.setPayee(instrument.getPayee()); - contract.setSerialNo(instrument.getSerialNo()); - contract.setTransactionDate(instrument.getTransactionDate()); - contract.setTransactionNumber(instrument.getTransactionNumber()); - contract.setTransactionType(instrument.getTransactionType() != null - ? TransactionTypeContract.valueOf(instrument.getTransactionType().name()) : null); - contract.setPayinSlipId(instrument.getPayinSlipId()); - contract.setReconciledAmount(instrument.getReconciledAmount()); - contract.setReconciledOn(instrument.getReconciledOn()); - contract.setCreatedBy(instrument.getCreatedBy()); - contract.setCreatedDate(instrument.getCreatedDate()); - contract.setLastModifiedBy(instrument.getLastModifiedBy()); - contract.setLastModifiedDate(instrument.getLastModifiedDate()); - contract.setTenantId(instrument.getTenantId()); - contract.setDeleteReason(instrument.getDeleteReason()); - return contract; - } - - public InstrumentSearch toSearchDomain(InstrumentSearchContract contract) { - - InstrumentSearch instrumentSearch = new InstrumentSearch(); - - instrumentSearch.setId(contract.getId()); - instrumentSearch.setAmount(contract.getAmount()); - instrumentSearch.setBank(contract.getBank()); - instrumentSearch.setBankAccount(contract.getBankAccount()); - instrumentSearch.setBranchName(contract.getBranchName()); - instrumentSearch.setDrawer(contract.getDrawer()); - instrumentSearch.setFinancialStatus(contract.getFinancialStatus()); - instrumentSearch.setRemittanceVoucherId(contract.getRemittanceVoucherId()); - - if (contract.getInstrumentType() != null) - instrumentSearch.setInstrumentType(typeMapper.toDomain(contract.getInstrumentType())); - - if (contract.getSurrenderReason() != null) - instrumentSearch.setSurrenderReason(srMapper.toDomain(contract.getSurrenderReason())); - - if (contract.getInstrumentVouchers() != null) { - - List instrumentVouchers = new ArrayList<>(); - if (contract.getInstrumentVouchers() != null) - for (InstrumentVoucherContract ivc : contract.getInstrumentVouchers()) - instrumentVouchers.add(InstrumentVoucher.builder().voucherHeaderId(ivc.getVoucherHeaderId()) - .receiptHeaderId(ivc.getReceiptHeaderId()).build()); - - instrumentSearch.setInstrumentVouchers(instrumentVouchers); - - } - instrumentSearch.setPayee(contract.getPayee()); - instrumentSearch.setSerialNo(contract.getSerialNo()); - instrumentSearch.setTransactionDate(contract.getTransactionDate()); - instrumentSearch.setTransactionNumber(contract.getTransactionNumber()); - instrumentSearch.setTransactionType(contract.getTransactionType() != null - ? TransactionType.valueOf(contract.getTransactionType().name()) : null); - instrumentSearch.setPayinSlipId(contract.getPayinSlipId()); - instrumentSearch.setReconciledAmount(contract.getReconciledAmount()); - instrumentSearch.setReconciledOn(contract.getReconciledOn()); - instrumentSearch.setCreatedBy(contract.getCreatedBy()); - instrumentSearch.setCreatedDate(contract.getCreatedDate()); - instrumentSearch.setLastModifiedBy(contract.getLastModifiedBy()); - instrumentSearch.setLastModifiedDate(contract.getLastModifiedDate()); - instrumentSearch.setTenantId(contract.getTenantId()); - instrumentSearch.setPageSize(contract.getPageSize()); - instrumentSearch.setOffset(contract.getOffset()); - instrumentSearch.setSortBy(contract.getSortBy()); - instrumentSearch.setIds(contract.getIds()); - instrumentSearch.setInstrumentTypes(contract.getInstrumentTypes()); - instrumentSearch.setFinancialStatuses(contract.getFinancialStatuses()); - instrumentSearch.setTransactionFromDate(contract.getTransactionFromDate()); - instrumentSearch.setTransactionToDate(contract.getTransactionToDate()); - instrumentSearch.setDeleteReason(contract.getDeleteReason()); - instrumentSearch.setReceiptIds(contract.getReceiptIds()); - return instrumentSearch; - } - - public InstrumentSearchContract toSearchContract(InstrumentSearch instrumentSearch) { - - InstrumentSearchContract contract = new InstrumentSearchContract(); - - contract.setId(instrumentSearch.getId()); - contract.setAmount(instrumentSearch.getAmount()); - contract.setBank(instrumentSearch.getBank()); - contract.setBankAccount(instrumentSearch.getBankAccount()); - contract.setBranchName(instrumentSearch.getBranchName()); - contract.setDrawer(instrumentSearch.getDrawer()); - contract.setFinancialStatus(instrumentSearch.getFinancialStatus()); - contract.setRemittanceVoucherId(instrumentSearch.getRemittanceVoucherId()); - - if (instrumentSearch.getInstrumentType() != null) - contract.setInstrumentType(typeMapper.toContract(instrumentSearch.getInstrumentType())); - - if (instrumentSearch.getSurrenderReason() != null) - contract.setSurrenderReason(srMapper.toContract(instrumentSearch.getSurrenderReason())); - - if (instrumentSearch.getInstrumentVouchers() != null) { - - List instrumentVouchers = new ArrayList<>(); - - if (instrumentSearch.getInstrumentVouchers() != null) - for (InstrumentVoucher iv : instrumentSearch.getInstrumentVouchers()) - instrumentVouchers - .add(InstrumentVoucherContract.builder().instrument(contract.getId()) - .voucherHeaderId(iv.getVoucherHeaderId()).receiptHeaderId(iv.getReceiptHeaderId()).build()); - - contract.setInstrumentVouchers(instrumentVouchers); - - } - - contract.setPayee(instrumentSearch.getPayee()); - contract.setSerialNo(instrumentSearch.getSerialNo()); - contract.setTransactionDate(instrumentSearch.getTransactionDate()); - contract.setTransactionNumber(instrumentSearch.getTransactionNumber()); - contract.setTransactionType(instrumentSearch.getTransactionType() != null - ? TransactionTypeContract.valueOf(instrumentSearch.getTransactionType().name()) : null); - contract.setPayinSlipId(instrumentSearch.getPayinSlipId()); - contract.setReconciledAmount(instrumentSearch.getReconciledAmount()); - contract.setReconciledOn(instrumentSearch.getReconciledOn()); - contract.setCreatedBy(instrumentSearch.getCreatedBy()); - contract.setCreatedDate(instrumentSearch.getCreatedDate()); - contract.setLastModifiedBy(instrumentSearch.getLastModifiedBy()); - contract.setLastModifiedDate(instrumentSearch.getLastModifiedDate()); - contract.setTenantId(instrumentSearch.getTenantId()); - contract.setPageSize(instrumentSearch.getPageSize()); - contract.setOffset(instrumentSearch.getOffset()); - contract.setSortBy(instrumentSearch.getSortBy()); - contract.setIds(instrumentSearch.getIds()); - contract.setFinancialStatuses(instrumentSearch.getFinancialStatuses()); - contract.setInstrumentTypes(instrumentSearch.getInstrumentTypes()); - contract.setTransactionFromDate(instrumentSearch.getTransactionFromDate()); - contract.setTransactionToDate(instrumentSearch.getTransactionToDate()); - contract.setDeleteReason(instrumentSearch.getDeleteReason()); - return contract; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/InstrumentTypeMapper.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/InstrumentTypeMapper.java deleted file mode 100644 index 7f6a5b2c5b0..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/InstrumentTypeMapper.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.egov.egf.instrument.web.mapper; - -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.egov.egf.instrument.web.contract.InstrumentTypeSearchContract; - -public class InstrumentTypeMapper { - - public InstrumentType toDomain(InstrumentTypeContract contract) { - - InstrumentType instrumentType = new InstrumentType(); - - instrumentType.setId(contract.getId()); - - instrumentType.setActive(contract.getActive()); - instrumentType.setDescription(contract.getDescription()); - instrumentType.setName(contract.getName()); - instrumentType.setCreatedBy(contract.getCreatedBy()); - instrumentType.setCreatedDate(contract.getCreatedDate()); - instrumentType.setLastModifiedBy(contract.getLastModifiedBy()); - instrumentType.setLastModifiedDate(contract.getLastModifiedDate()); - instrumentType.setTenantId(contract.getTenantId()); - - return instrumentType; - } - - public InstrumentTypeContract toContract(InstrumentType instrumentType) { - - InstrumentTypeContract contract = new InstrumentTypeContract(); - - contract.setId(instrumentType.getId()); - - contract.setActive(instrumentType.getActive()); - contract.setDescription(instrumentType.getDescription()); - contract.setName(instrumentType.getName()); - - contract.setCreatedBy(instrumentType.getCreatedBy()); - contract.setCreatedDate(instrumentType.getCreatedDate()); - contract.setLastModifiedBy(instrumentType.getLastModifiedBy()); - contract.setLastModifiedDate(instrumentType.getLastModifiedDate()); - contract.setTenantId(instrumentType.getTenantId()); - - return contract; - } - - public InstrumentTypeSearch toSearchDomain(InstrumentTypeSearchContract contract) { - - InstrumentTypeSearch instrumentTypeSearch = new InstrumentTypeSearch(); - - instrumentTypeSearch.setId(contract.getId()); - - instrumentTypeSearch.setActive(contract.getActive()); - instrumentTypeSearch.setDescription(contract.getDescription()); - instrumentTypeSearch.setName(contract.getName()); - instrumentTypeSearch.setCreatedBy(contract.getCreatedBy()); - instrumentTypeSearch.setCreatedDate(contract.getCreatedDate()); - instrumentTypeSearch.setLastModifiedBy(contract.getLastModifiedBy()); - instrumentTypeSearch.setLastModifiedDate(contract.getLastModifiedDate()); - instrumentTypeSearch.setTenantId(contract.getTenantId()); - instrumentTypeSearch.setPageSize(contract.getPageSize()); - instrumentTypeSearch.setOffset(contract.getOffset()); - instrumentTypeSearch.setSortBy(contract.getSortBy()); - instrumentTypeSearch.setIds(contract.getIds()); - - return instrumentTypeSearch; - } - - public InstrumentTypeSearchContract toSearchContract(InstrumentTypeSearch instrumentTypeSearch) { - - InstrumentTypeSearchContract contract = new InstrumentTypeSearchContract(); - - contract.setId(instrumentTypeSearch.getId()); - - contract.setActive(instrumentTypeSearch.getActive()); - contract.setDescription(instrumentTypeSearch.getDescription()); - contract.setName(instrumentTypeSearch.getName()); - contract.setCreatedBy(instrumentTypeSearch.getCreatedBy()); - contract.setCreatedDate(instrumentTypeSearch.getCreatedDate()); - contract.setLastModifiedBy(instrumentTypeSearch.getLastModifiedBy()); - contract.setLastModifiedDate(instrumentTypeSearch.getLastModifiedDate()); - contract.setTenantId(instrumentTypeSearch.getTenantId()); - contract.setPageSize(instrumentTypeSearch.getPageSize()); - contract.setOffset(instrumentTypeSearch.getOffset()); - contract.setSortBy(instrumentTypeSearch.getSortBy()); - contract.setIds(instrumentTypeSearch.getIds()); - return contract; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/SurrenderReasonMapper.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/SurrenderReasonMapper.java deleted file mode 100644 index 8dcf9efcbb3..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/mapper/SurrenderReasonMapper.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.egov.egf.instrument.web.mapper; - -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; -import org.egov.egf.instrument.web.contract.SurrenderReasonSearchContract; - -public class SurrenderReasonMapper { - - public SurrenderReason toDomain(SurrenderReasonContract contract) { - - SurrenderReason surrenderReason = new SurrenderReason(); - - surrenderReason.setId(contract.getId()); - surrenderReason.setName(contract.getName()); - surrenderReason.setDescription(contract.getDescription()); - surrenderReason.setCreatedBy(contract.getCreatedBy()); - surrenderReason.setCreatedDate(contract.getCreatedDate()); - surrenderReason.setLastModifiedBy(contract.getLastModifiedBy()); - surrenderReason.setLastModifiedDate(contract.getLastModifiedDate()); - surrenderReason.setTenantId(contract.getTenantId()); - - return surrenderReason; - } - - public SurrenderReasonContract toContract(SurrenderReason surrenderReason) { - - SurrenderReasonContract contract = new SurrenderReasonContract(); - - contract.setId(surrenderReason.getId()); - contract.setName(surrenderReason.getName()); - contract.setDescription(surrenderReason.getDescription()); - contract.setCreatedBy(surrenderReason.getCreatedBy()); - contract.setCreatedDate(surrenderReason.getCreatedDate()); - contract.setLastModifiedBy(surrenderReason.getLastModifiedBy()); - contract.setLastModifiedDate(surrenderReason.getLastModifiedDate()); - contract.setTenantId(surrenderReason.getTenantId()); - - return contract; - } - - public SurrenderReasonSearch toSearchDomain(SurrenderReasonSearchContract contract) { - - SurrenderReasonSearch surrenderReasonSearch = new SurrenderReasonSearch(); - - surrenderReasonSearch.setId(contract.getId()); - surrenderReasonSearch.setName(contract.getName()); - surrenderReasonSearch.setDescription(contract.getDescription()); - surrenderReasonSearch.setCreatedBy(contract.getCreatedBy()); - surrenderReasonSearch.setCreatedDate(contract.getCreatedDate()); - surrenderReasonSearch.setLastModifiedBy(contract.getLastModifiedBy()); - surrenderReasonSearch.setLastModifiedDate(contract.getLastModifiedDate()); - surrenderReasonSearch.setTenantId(contract.getTenantId()); - surrenderReasonSearch.setPageSize(contract.getPageSize()); - surrenderReasonSearch.setOffset(contract.getOffset()); - surrenderReasonSearch.setSortBy(contract.getSortBy()); - surrenderReasonSearch.setIds(contract.getIds()); - - return surrenderReasonSearch; - } - - public SurrenderReasonSearchContract toSearchContract(SurrenderReasonSearch surrenderReasonSearch) { - - SurrenderReasonSearchContract contract = new SurrenderReasonSearchContract(); - - contract.setId(surrenderReasonSearch.getId()); - contract.setName(surrenderReasonSearch.getName()); - contract.setDescription(surrenderReasonSearch.getDescription()); - contract.setCreatedBy(surrenderReasonSearch.getCreatedBy()); - contract.setCreatedDate(surrenderReasonSearch.getCreatedDate()); - contract.setLastModifiedBy(surrenderReasonSearch.getLastModifiedBy()); - contract.setLastModifiedDate(surrenderReasonSearch.getLastModifiedDate()); - contract.setTenantId(surrenderReasonSearch.getTenantId()); - contract.setPageSize(surrenderReasonSearch.getPageSize()); - contract.setOffset(surrenderReasonSearch.getOffset()); - contract.setSortBy(surrenderReasonSearch.getSortBy()); - contract.setIds(surrenderReasonSearch.getIds()); - - return contract; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/InstrumentAccountCodeContractRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/InstrumentAccountCodeContractRepository.java deleted file mode 100644 index dee2aa3897a..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/InstrumentAccountCodeContractRepository.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.egov.egf.instrument.web.repository; - -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeContract; -import org.egov.egf.instrument.web.requests.InstrumentAccountCodeResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class InstrumentAccountCodeContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-instrument/instrumentaccountcodes/_search?"; - - public InstrumentAccountCodeContractRepository(@Value("${egf.instrument.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public InstrumentAccountCodeContract findById(InstrumentAccountCodeContract instrumentAccountCodeContract) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (instrumentAccountCodeContract.getId() != null) - content.append("id=" + instrumentAccountCodeContract.getId()); - - if (instrumentAccountCodeContract.getTenantId() != null) - content.append("&tenantId=" + instrumentAccountCodeContract.getTenantId()); - url = url + content.toString(); - InstrumentAccountCodeResponse result = restTemplate.postForObject(url, null, - InstrumentAccountCodeResponse.class); - - if (result.getInstrumentAccountCodes() != null && result.getInstrumentAccountCodes().size() == 1) - return result.getInstrumentAccountCodes().get(0); - else - return null; - - } -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/InstrumentContractRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/InstrumentContractRepository.java deleted file mode 100644 index 03e0c6fa3e9..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/InstrumentContractRepository.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.egf.instrument.web.repository; - -import org.egov.egf.instrument.web.contract.InstrumentContract; -import org.egov.egf.instrument.web.requests.InstrumentResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class InstrumentContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-instrument/instruments/_search?"; - - public InstrumentContractRepository(@Value("${egf.instrument.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public InstrumentContract findById(InstrumentContract instrumentContract) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (instrumentContract.getId() != null) - content.append("id=" + instrumentContract.getId()); - - if (instrumentContract.getTenantId() != null) - content.append("&tenantId=" + instrumentContract.getTenantId()); - url = url + content.toString(); - InstrumentResponse result = restTemplate.postForObject(url, null, InstrumentResponse.class); - - if (result.getInstruments() != null && result.getInstruments().size() == 1) - return result.getInstruments().get(0); - else - return null; - - } -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/InstrumentTypeContractRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/InstrumentTypeContractRepository.java deleted file mode 100644 index 09af5490808..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/InstrumentTypeContractRepository.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.egf.instrument.web.repository; - -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.egov.egf.instrument.web.requests.InstrumentTypeResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class InstrumentTypeContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-instrument/instrumenttypes/_search?"; - - public InstrumentTypeContractRepository(@Value("${egf.instrument.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public InstrumentTypeContract findById(InstrumentTypeContract instrumentTypeContract) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (instrumentTypeContract.getId() != null) - content.append("id=" + instrumentTypeContract.getId()); - - if (instrumentTypeContract.getTenantId() != null) - content.append("&tenantId=" + instrumentTypeContract.getTenantId()); - url = url + content.toString(); - InstrumentTypeResponse result = restTemplate.postForObject(url, null, InstrumentTypeResponse.class); - - if (result.getInstrumentTypes() != null && result.getInstrumentTypes().size() == 1) - return result.getInstrumentTypes().get(0); - else - return null; - - } -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/SurrenderReasonContractRepository.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/SurrenderReasonContractRepository.java deleted file mode 100644 index 79403a0de3f..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/repository/SurrenderReasonContractRepository.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.egf.instrument.web.repository; - -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; -import org.egov.egf.instrument.web.requests.SurrenderReasonResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class SurrenderReasonContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-instrument/surrenderreasons/_search?"; - - public SurrenderReasonContractRepository(@Value("${egf.instrument.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public SurrenderReasonContract findById(SurrenderReasonContract surrenderReasonContract) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (surrenderReasonContract.getId() != null) - content.append("id=" + surrenderReasonContract.getId()); - - if (surrenderReasonContract.getTenantId() != null) - content.append("&tenantId=" + surrenderReasonContract.getTenantId()); - url = url + content.toString(); - SurrenderReasonResponse result = restTemplate.postForObject(url, null, SurrenderReasonResponse.class); - - if (result.getSurrenderReasons() != null && result.getSurrenderReasons().size() == 1) - return result.getSurrenderReasons().get(0); - else - return null; - - } -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/DishonorReasonRequest.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/DishonorReasonRequest.java deleted file mode 100644 index 3e8fa70c828..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/DishonorReasonRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.egov.egf.instrument.web.requests; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.instrument.web.contract.DishonorReasonContract; - -import lombok.Data; - -public @Data class DishonorReasonRequest { - private RequestInfo requestInfo = new RequestInfo(); - private List surrenderReasons = new ArrayList(); -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentAccountCodeRequest.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentAccountCodeRequest.java deleted file mode 100644 index d18f9ac3648..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentAccountCodeRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.egov.egf.instrument.web.requests; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeContract; - -import lombok.Data; - -public @Data class InstrumentAccountCodeRequest { - private RequestInfo requestInfo = new RequestInfo(); - private List instrumentAccountCodes = new ArrayList(); -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentAccountCodeResponse.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentAccountCodeResponse.java deleted file mode 100644 index b8f39e6793e..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentAccountCodeResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.egf.instrument.web.requests; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class InstrumentAccountCodeResponse { - private ResponseInfo responseInfo; - private List instrumentAccountCodes; - private PaginationContract page; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentRequest.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentRequest.java deleted file mode 100644 index 2ddda97c888..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.egov.egf.instrument.web.requests; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.instrument.web.contract.InstrumentContract; - -import lombok.Data; - -public @Data class InstrumentRequest { - private RequestInfo requestInfo = new RequestInfo(); - private List instruments = new ArrayList(); -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentResponse.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentResponse.java deleted file mode 100644 index 433291b7cc6..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.egf.instrument.web.requests; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.instrument.web.contract.InstrumentContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class InstrumentResponse { - private ResponseInfo responseInfo; - private List instruments; - private PaginationContract page; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentTypeRequest.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentTypeRequest.java deleted file mode 100644 index bfbdb08c6bb..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentTypeRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.egov.egf.instrument.web.requests; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; - -import lombok.Data; - -public @Data class InstrumentTypeRequest { - private RequestInfo requestInfo = new RequestInfo(); - private List instrumentTypes = new ArrayList(); -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentTypeResponse.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentTypeResponse.java deleted file mode 100644 index 057ef4e1b55..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/InstrumentTypeResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.egf.instrument.web.requests; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class InstrumentTypeResponse { - private ResponseInfo responseInfo; - private List instrumentTypes; - private PaginationContract page; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/SurrenderReasonRequest.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/SurrenderReasonRequest.java deleted file mode 100644 index 7e90c7a2e0e..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/SurrenderReasonRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.egov.egf.instrument.web.requests; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; - -import lombok.Data; - -public @Data class SurrenderReasonRequest { - private RequestInfo requestInfo = new RequestInfo(); - private List surrenderReasons = new ArrayList(); -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/SurrenderReasonResponse.java b/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/SurrenderReasonResponse.java deleted file mode 100644 index 82e8aded7ab..00000000000 --- a/business-services/egf-instrument/src/main/java/org/egov/egf/instrument/web/requests/SurrenderReasonResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.egf.instrument.web.requests; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class SurrenderReasonResponse { - private ResponseInfo responseInfo; - private List surrenderReasons; - private PaginationContract page; -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/resources/application.properties b/business-services/egf-instrument/src/main/resources/application.properties deleted file mode 100644 index af67d585095..00000000000 --- a/business-services/egf-instrument/src/main/resources/application.properties +++ /dev/null @@ -1,74 +0,0 @@ -server.context-path=/egf-instrument -server.servlet.context-path=/egf-instrument -server.port=8480 - -persist.through.kafka=yes - -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/egf-instrument -spring.datasource.username=postgres -spring.datasource.password=psql -management.endpoints.web.base-path=/ - -spring.flyway.enabled=true -spring.flyway.user=postgres -spring.flyway.password=psql -spring.flyway.outOfOrder=true -spring.flyway.table=egf_instrument_schema_version -spring.flyway.baseline-on-migrate=true -spring.flyway.url=jdbc:postgresql://localhost:5432/egf-instrument -spring.flyway.locations=classpath:/db/migration/main,db/migration/seed - -spring.jpa.showSql=true -spring.jpa.database=POSTGRESQL -spring.data.jpa.repositories.enabled=true -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl -spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl -spring.jpa.open-in-view=true - -app.timezone=UTC - -fetch_data_from=db - -es.host=localhost -es.transport.port=9300 -es.cluster.name=docker-cluster -es.fund.index.name=fund -es.fund.document.type=fund - -#Kafka Topic config -spring.kafka.consumer.properties.spring.json.use.type.headers=false -management.endpoints.web.base-path=/ - -spring.kafka.listener.missing-topics-fatal=false -#Kafka Topic config -kafka.topics.egf.instrument.validated.topic=egov.egf.instrument.validated.topic -kafka.topics.egf.instrument.validated.group=egov.egf.instrument.validated.group -kafka.topics.egf.instrument.validated.id=egov.egf.instrument.validated.id - -kafka.topics.egf.instrument.completed.topic=egov.egf.instrument.completed -kafka.topics.egf.instrument.completed.group=egov.egf.instrument.completed.group - -kafka.topics.egf.instrument.instrument.accountcode.validated.key=egov.egf.instrument.instrument.accountcode.validated.key -kafka.topics.egf.instrument.instrument.validated.key=egov.egf.instrument.budgetdetail.validated.key -kafka.topics.egf.instrument.instrument.type.validated.key=egov.egf.instrument.budgetreapp.validated.key -kafka.topics.egf.instrument.surrender.reason.validated.key=egov.egf.instrument.surrender.reason.validated.key - -kafka.topics.egf.instrument.instrument.accountcode.completed.key=egov.egf.instrument.instrument.accountcode.completed.key -kafka.topics.egf.instrument.instrument.completed.key=egov.egf.instrument.instrument.completed.key -kafka.topics.egf.instrument.instrument.type.completed.key=egov.egf.instrument.instrument.type.completed.key -kafka.topics.egf.instrument.surrender.reason.completed.key=egov.egf.instrument.surrender.reason.completed.key - - -egf.instrument.host.url=http://localhost:8480 - -egf.master.host.url=https://dev.digit.org - -logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} - - -spring.kafka.consumer.value-deserializer=org.egov.common.queue.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=egf-instrument -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer diff --git a/business-services/egf-instrument/src/main/resources/db/Dockerfile b/business-services/egf-instrument/src/main/resources/db/Dockerfile deleted file mode 100644 index aa911735f99..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM egovio/flyway:4.1.2 - -COPY ./migration/main /flyway/sql - -COPY ./migration/seed /flyway/seed - -COPY migrate.sh /usr/bin/migrate.sh - -RUN chmod +x /usr/bin/migrate.sh - -CMD ["/usr/bin/migrate.sh"] diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150656__egf-instrument_InstrumentStatus_ddl.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150656__egf-instrument_InstrumentStatus_ddl.sql deleted file mode 100644 index 1f8f13de0bd..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150656__egf-instrument_InstrumentStatus_ddl.sql +++ /dev/null @@ -1,16 +0,0 @@ - -Create table egf_instrumentstatus -( - id varchar(50) NOT NULL, - moduleType varchar(50) NOT NULL, - name varchar(20) NOT NULL, - description varchar(250) NOT NULL, - createdby varchar(50), - createddate timestamp without time zone, - lastmodifiedby varchar(50), - lastmodifieddate timestamp without time zone, - tenantId varchar(250), - version bigint -); -alter table egf_instrumentstatus add constraint pk_egf_instrumentstatus primary key (id); -create sequence seq_egf_instrumentstatus; diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150657__egf-instrument_InstrumentType_ddl.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150657__egf-instrument_InstrumentType_ddl.sql deleted file mode 100644 index 7a2855995d9..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150657__egf-instrument_InstrumentType_ddl.sql +++ /dev/null @@ -1,16 +0,0 @@ - -Create table egf_instrumenttype -( - id varchar(50), - name varchar(50) NOT NULL, - description varchar(100), - active boolean NOT NULL, - createdby varchar(50), - createddate timestamp without time zone, - lastmodifiedby varchar(50), - lastmodifieddate timestamp without time zone, - tenantId varchar(250), - version bigint -); -alter table egf_instrumenttype add constraint pk_egf_instrumenttype primary key (id); -create sequence seq_egf_instrumenttype; diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150658__egf-instrument_InstrumentTypeProperty_ddl.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150658__egf-instrument_InstrumentTypeProperty_ddl.sql deleted file mode 100644 index d54b4d4a6be..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150658__egf-instrument_InstrumentTypeProperty_ddl.sql +++ /dev/null @@ -1,18 +0,0 @@ - -Create table egf_instrumenttypeproperty( -id varchar(50) not null, - transactionType varchar(6) NOT NULL, - reconciledOncreate boolean NOT NULL, - statusOnCreateId varchar(50) NOT NULL, - statusOnUpdateId varchar(50) NOT NULL, - statusOnReconcileId varchar(50) NOT NULL, - InstrumentTypeId varchar(50), - createdby varchar(50), - createddate timestamp without time zone, - lastmodifiedby varchar(50), - lastmodifieddate timestamp without time zone, - tenantId varchar(250), - version bigint -); -alter table egf_instrumenttypeproperty add constraint pk_egf_instrumenttypeproperty primary key (id); -create sequence seq_egf_instrumenttypeproperty; diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150659__egf-instrument_InstrumentAccountCode_ddl.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150659__egf-instrument_InstrumentAccountCode_ddl.sql deleted file mode 100644 index 43af38d7ba7..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150659__egf-instrument_InstrumentAccountCode_ddl.sql +++ /dev/null @@ -1,15 +0,0 @@ - -Create table egf_instrumentaccountcode -( - id varchar(50), - instrumentTypeId varchar(50), - accountCodeId varchar(50), - createdby varchar(50), - createddate timestamp without time zone, - lastmodifiedby varchar(50), - lastmodifieddate timestamp without time zone, - tenantId varchar(250), - version bigint -); -alter table egf_instrumentaccountcode add constraint pk_egf_instrumentaccountcode primary key (id); -create sequence seq_egf_instrumentaccountcode; diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150700__egf-instrument_SurrenderReason_ddl.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150700__egf-instrument_SurrenderReason_ddl.sql deleted file mode 100644 index d452590b2fa..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150700__egf-instrument_SurrenderReason_ddl.sql +++ /dev/null @@ -1,14 +0,0 @@ - -Create table egf_surrenderreason( - id varchar(50), - name varchar(50), - description varchar(250), - createdby varchar(50), - createddate timestamp without time zone, - lastmodifiedby varchar(50), - lastmodifieddate timestamp without time zone, - tenantId varchar(250), - version bigint -); -alter table egf_surrenderreason add constraint pk_egf_surrenderreason primary key (id); -create sequence seq_egf_surrenderreason; diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150701__egf-instrument_Instrument_ddl.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150701__egf-instrument_Instrument_ddl.sql deleted file mode 100644 index 3dfe458bf32..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150701__egf-instrument_Instrument_ddl.sql +++ /dev/null @@ -1,25 +0,0 @@ - -Create table egf_instrument( - id varchar(50), - transactionNumber varchar(50) Not null, - transactionDate date NOT NULL, - amount numeric (13,2) NOT NULL, - instrumentTypeId varchar(50) NOT NULL, - bankId varchar(50), - branchName varchar(50), - bankAccountId varchar(50), - financialStatusId varchar(50), - transactionType varchar(6), - payee varchar(50), - drawer varchar(100), - surrendarReasonId varchar(50), - serialNo varchar(50), - createdby varchar(50), - createddate timestamp without time zone, - lastmodifiedby varchar(50), - lastmodifieddate timestamp without time zone, - tenantId varchar(250), - version bigint -); -alter table egf_instrument add constraint pk_egf_instrument primary key (id); -create sequence seq_egf_instrument; diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150702__egf-instrument_InstrumentVoucher_ddl.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150702__egf-instrument_InstrumentVoucher_ddl.sql deleted file mode 100644 index 2e4dec200e4..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170719150702__egf-instrument_InstrumentVoucher_ddl.sql +++ /dev/null @@ -1,14 +0,0 @@ - -Create table egf_instrumentvoucher( - id varchar(50), - voucherHeaderId varchar(50), - InstrumentId varchar(50), - createdby varchar(50), - createddate timestamp without time zone, - lastmodifiedby varchar(50), - lastmodifieddate timestamp without time zone, - tenantId varchar(250), - version bigint -); -alter table egf_instrumentvoucher add constraint pk_egf_instrumentvoucher primary key (id); -create sequence seq_egf_instrumentvoucher; diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170731184801__egf-instrument_instrument_surrendarReasonId_rename.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20170731184801__egf-instrument_instrument_surrendarReasonId_rename.sql deleted file mode 100644 index 1fdab4e9d43..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170731184801__egf-instrument_instrument_surrendarReasonId_rename.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egf_instrument RENAME COLUMN surrendarReasonId TO surrenderReasonId; diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170810172600__egf-instrument_instrument_ddl.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20170810172600__egf-instrument_instrument_ddl.sql deleted file mode 100644 index 9297a0ee6f9..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20170810172600__egf-instrument_instrument_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -alter table egf_instrument add column remittanceVoucherId varchar(50); \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20181009162220__egf-instrument_add_new_columns.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20181009162220__egf-instrument_add_new_columns.sql deleted file mode 100644 index 05d43c42cad..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20181009162220__egf-instrument_add_new_columns.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE egf_instrument ADD COLUMN payinSlipId varchar(256); - -ALTER TABLE egf_instrument ADD COLUMN reconciledAmount numeric (13,2); - -ALTER TABLE egf_instrument ADD COLUMN reconciledOn date; \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20181010130920__egf-instrument_voucher_add_receipt_ref.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20181010130920__egf-instrument_voucher_add_receipt_ref.sql deleted file mode 100644 index 9acadc18b40..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20181010130920__egf-instrument_voucher_add_receipt_ref.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egf_instrumentvoucher ADD COLUMN receiptHeaderId varchar(256); \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/resources/db/migration/main/V20200424144745__egf-instrument_dishonorReason_ddl.sql b/business-services/egf-instrument/src/main/resources/db/migration/main/V20200424144745__egf-instrument_dishonorReason_ddl.sql deleted file mode 100644 index 19dfbeeb5be..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/main/V20200424144745__egf-instrument_dishonorReason_ddl.sql +++ /dev/null @@ -1,17 +0,0 @@ - -Create table egf_instrumentdishonor( - id varchar(50), - reason varchar(100), - remarks varchar(250), - instrumentid varchar(50), - reversalVoucherId varchar(50), - dishonorDate bigint NOT NULL, - createdby varchar(50), - createddate timestamp without time zone, - lastmodifiedby varchar(50), - lastmodifieddate timestamp without time zone, - tenantId varchar(250), - version bigint -); -alter table egf_instrumentdishonor add constraint pk_egf_instrumentdishonor primary key (id); -create sequence seq_egf_instrumentdishonor; diff --git a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170726210235__egf_instrument_type.sql b/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170726210235__egf_instrument_type.sql deleted file mode 100644 index ad449780321..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170726210235__egf_instrument_type.sql +++ /dev/null @@ -1,38 +0,0 @@ -INSERT INTO egf_instrumenttype( - id, name, description, active, createdby, createddate, lastmodifiedby, - lastmodifieddate, tenantid, version) - VALUES ('2ac21f85-58ab-4a0b-9fd6-9b8d155a5003', 'Cash', 'Instrument type cash', true, '1', now(), 1, - now(), 'default', 0); - - -INSERT INTO egf_instrumenttype( - id, name, description, active, createdby, createddate, lastmodifiedby, - lastmodifieddate, tenantid, version) - VALUES ('25218408-4628-4d80-95c3-fcfaa8170765', 'Cheque', 'Instrument type Cheque', true, '1', now(), 1, - now(), 'default', 0); - - -INSERT INTO egf_instrumenttype( - id, name, description, active, createdby, createddate, lastmodifiedby, - lastmodifieddate, tenantid, version) - VALUES ('f3ae954c-74b0-47d9-9c17-088362c31e35', 'DD', 'Instrument type DD', true, '1', now(), 1, - now(), 'default', 0); - - -INSERT INTO egf_instrumenttype( - id, name, description, active, createdby, createddate, lastmodifiedby, - lastmodifieddate, tenantid, version) - VALUES ('c0da4c81-62b0-4c4d-9077-b6e1110ba268', 'Card', 'Instrument type Cards', true, '1', now(), 1, - now(), 'default', 0); - - -INSERT INTO egf_instrumenttype( - id, name, description, active, createdby, createddate, lastmodifiedby, - lastmodifieddate, tenantid, version) - VALUES ('a93567f2-0cf2-467c-b0a6-acc5c4aecd25', 'BankChallan', 'Instrument type BankChallan', true, '1', now(), 1, - now(), 'default', 0); - - - - - \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170726210246__egf_instrument_type_properties.sql b/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170726210246__egf_instrument_type_properties.sql deleted file mode 100644 index 4ebbf83325e..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170726210246__egf_instrument_type_properties.sql +++ /dev/null @@ -1,13 +0,0 @@ -INSERT INTO egf_instrumenttypeproperty( - id, transactiontype, reconciledoncreate, statusoncreateid, statusonupdateid, - statusonreconcileid, instrumenttypeid, createdby, createddate, - lastmodifiedby, lastmodifieddate, tenantid, version) - VALUES ('25e9cd51-e27d-4ece-8ce2-f4da53bb3436', 'Debit', false, 'New', 'Deposited', 'Reconciled' - , 'Cheque', '1', now(),1,now(), 'default', 0); - -INSERT INTO egf_instrumenttypeproperty( - id, transactiontype, reconciledoncreate, statusoncreateid, statusonupdateid, - statusonreconcileid, instrumenttypeid, createdby, createddate, - lastmodifiedby, lastmodifieddate, tenantid, version) - VALUES ('6fc1765c-2e97-4fe6-937a-f7391384b670', 'Credit', false, 'New', 'Deposited', 'Reconciled' - , 'Cheque', '1', now(),1,now(), 'default', 0); diff --git a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170827210235__egf_instrument_type_Online.sql b/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170827210235__egf_instrument_type_Online.sql deleted file mode 100644 index 2f4dac7548b..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170827210235__egf_instrument_type_Online.sql +++ /dev/null @@ -1,9 +0,0 @@ -INSERT INTO egf_instrumenttype( - id, name, description, active, createdby, createddate, lastmodifiedby, - lastmodifieddate, tenantid, version) - VALUES ('2dfcf972-efb2-4509-99fe-5c42167b2ea7', 'Online', 'Instrument type online', true, '1', now(), 1, - now(), 'default', 0); - - - - \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170827210246__egf_instrument_type_properties_online.sql b/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170827210246__egf_instrument_type_properties_online.sql deleted file mode 100644 index 25107ad3fbb..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170827210246__egf_instrument_type_properties_online.sql +++ /dev/null @@ -1,13 +0,0 @@ -INSERT INTO egf_instrumenttypeproperty( - id, transactiontype, reconciledoncreate, statusoncreateid, statusonupdateid, - statusonreconcileid, instrumenttypeid, createdby, createddate, - lastmodifiedby, lastmodifieddate, tenantid, version) - VALUES ('0ee4059b-e056-4070-90dd-8e52747fe5be', 'Debit', false, 'New', 'Deposited', 'Reconciled' - , 'Online', '1', now(),1,now(), 'default', 0); - -INSERT INTO egf_instrumenttypeproperty( - id, transactiontype, reconciledoncreate, statusoncreateid, statusonupdateid, - statusonreconcileid, instrumenttypeid, createdby, createddate, - lastmodifiedby, lastmodifieddate, tenantid, version) - VALUES ('a4b62acb-0d1b-4bbd-902d-1b5731ec3abd', 'Credit', false, 'New', 'Deposited', 'Reconciled' - , 'Online', '1', now(),1,now(), 'default', 0); diff --git a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170829170821__collection_instrumentaccountcodes.sql b/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170829170821__collection_instrumentaccountcodes.sql deleted file mode 100644 index 0ed5a3d7d91..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20170829170821__collection_instrumentaccountcodes.sql +++ /dev/null @@ -1,6 +0,0 @@ -delete from egf_instrumentaccountcode where instrumenttypeid in ('Cash','Cheque') and tenantid='default'; - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cash', 4501001, 1, 'default'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cheque', 4501051, 1, 'default'); - diff --git a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20180928161817__egf_instrumentmapping_jal_amr.sql b/business-services/egf-instrument/src/main/resources/db/migration/seed/V20180928161817__egf_instrumentmapping_jal_amr.sql deleted file mode 100644 index cd564115011..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20180928161817__egf_instrumentmapping_jal_amr.sql +++ /dev/null @@ -1,20 +0,0 @@ -delete from egf_instrumentaccountcode where instrumenttypeid in ('Cash','Cheque','DD','Card') and tenantid='pb.jalandhar'; - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cash', 4501001, 1, 'pb.jalandhar'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cheque', 4501051, 1, 'pb.jalandhar'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'DD', 4501051, 1, 'pb.jalandhar'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Card', 4501091, 1, 'pb.jalandhar'); - -delete from egf_instrumentaccountcode where instrumenttypeid in ('Cash','Cheque','DD','Card') and tenantid='pb.amritsar'; - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cash', 4501001, 1, 'pb.amritsar'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cheque', 4501051, 1, 'pb.amritsar'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'DD', 4501051, 1, 'pb.amritsar'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Card', 4501091, 1, 'pb.amritsar'); - diff --git a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20181010160919__egf_instrument_type_for_punjab.sql b/business-services/egf-instrument/src/main/resources/db/migration/seed/V20181010160919__egf_instrument_type_for_punjab.sql deleted file mode 100644 index 772638955be..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20181010160919__egf_instrument_type_for_punjab.sql +++ /dev/null @@ -1,76 +0,0 @@ -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff0acc-cc75-11e8-a8d5-f2801f1b9fd1', 'Cash', 'Instrument type cash', true, '1', now(), 1, now(), 'pb.mohali', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff1332-cc75-11e8-a8d5-f2801f1b9fd1', 'Cheque', 'Instrument type Cheque', true, '1', now(), 1, now(), 'pb.mohali', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff14cc-cc75-11e8-a8d5-f2801f1b9fd1', 'DD', 'Instrument type DD', true, '1', now(), 1, now(), 'pb.mohali', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff160c-cc75-11e8-a8d5-f2801f1b9fd1', 'Card', 'Instrument type Cards', true, '1', now(), 1, now(), 'pb.mohali', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff1738-cc75-11e8-a8d5-f2801f1b9fd1', 'BankChallan', 'Instrument type BankChallan', true, '1', now(), 1, now(), 'pb.mohali', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff1864-cc75-11e8-a8d5-f2801f1b9fd1', 'Cash', 'Instrument type cash', true, '1', now(), 1, now(), 'pb.jalandhar', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff1a1c-cc75-11e8-a8d5-f2801f1b9fd1', 'Cheque', 'Instrument type Cheque', true, '1', now(), 1, now(), 'pb.jalandhar', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff1e18-cc75-11e8-a8d5-f2801f1b9fd1', 'DD', 'Instrument type DD', true, '1', now(), 1, now(), 'pb.jalandhar', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff1f62-cc75-11e8-a8d5-f2801f1b9fd1', 'Card', 'Instrument type Cards', true, '1', now(), 1, now(), 'pb.jalandhar', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff20ac-cc75-11e8-a8d5-f2801f1b9fd1', 'BankChallan', 'Instrument type BankChallan', true, '1', now(), 1, now(), 'pb.jalandhar', 0); - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff21d8-cc75-11e8-a8d5-f2801f1b9fd1', 'Cash', 'Instrument type cash', true, '1', now(), 1, now(), 'pb.nayagaon', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff2304-cc75-11e8-a8d5-f2801f1b9fd1', 'Cheque', 'Instrument type Cheque', true, '1', now(), 1, now(), 'pb.nayagaon', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff2430-cc75-11e8-a8d5-f2801f1b9fd1', 'DD', 'Instrument type DD', true, '1', now(), 1, now(), 'pb.nayagaon', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff2854-cc75-11e8-a8d5-f2801f1b9fd1', 'Card', 'Instrument type Cards', true, '1', now(), 1, now(), 'pb.nayagaon', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff29bc-cc75-11e8-a8d5-f2801f1b9fd1', 'BankChallan', 'Instrument type BankChallan', true, '1', now(), 1, now(), 'pb.nayagaon', 0); - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff2ae8-cc75-11e8-a8d5-f2801f1b9fd1', 'Cash', 'Instrument type cash', true, '1', now(), 1, now(), 'pb.amritsar', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff2c14-cc75-11e8-a8d5-f2801f1b9fd1', 'Cheque', 'Instrument type Cheque', true, '1', now(), 1, now(), 'pb.amritsar', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff2d40-cc75-11e8-a8d5-f2801f1b9fd1', 'DD', 'Instrument type DD', true, '1', now(), 1, now(), 'pb.amritsar', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff2e6c-cc75-11e8-a8d5-f2801f1b9fd1', 'Card', 'Instrument type Cards', true, '1', now(), 1, now(), 'pb.amritsar', 0); - - -INSERT INTO egf_instrumenttype(id, name, description, active, createdby, createddate, lastmodifiedby, lastmodifieddate, tenantid, version) -VALUES ('48ff2f98-cc75-11e8-a8d5-f2801f1b9fd1', 'BankChallan', 'Instrument type BankChallan', true, '1', now(), 1, now(), 'pb.amritsar', 0); \ No newline at end of file diff --git a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20181015141827__egf_instrumentmapping_mohali_nayagaon.sql b/business-services/egf-instrument/src/main/resources/db/migration/seed/V20181015141827__egf_instrumentmapping_mohali_nayagaon.sql deleted file mode 100644 index 5f0c89a6a18..00000000000 --- a/business-services/egf-instrument/src/main/resources/db/migration/seed/V20181015141827__egf_instrumentmapping_mohali_nayagaon.sql +++ /dev/null @@ -1,20 +0,0 @@ -delete from egf_instrumentaccountcode where instrumenttypeid in ('Cash','Cheque','DD','Card') and tenantid='pb.mohali'; - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cash', 4501001, 1, 'pb.mohali'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cheque', 4501051, 1, 'pb.mohali'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'DD', 4501051, 1, 'pb.mohali'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Card', 4501091, 1, 'pb.mohali'); - -delete from egf_instrumentaccountcode where instrumenttypeid in ('Cash','Cheque','DD','Card') and tenantid='pb.nayagaon'; - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cash', 4501001, 1, 'pb.nayagaon'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Cheque', 4501051, 1, 'pb.nayagaon'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'DD', 4501051, 1, 'pb.nayagaon'); - -insert into egf_instrumentaccountcode(id,instrumenttypeid, accountcodeid, createdby, tenantid) values(nextval('seq_egf_instrumentaccountcode'),'Card', 4501091, 1, 'pb.nayagaon'); - diff --git a/business-services/egf-instrument/src/postman/InstrumentAccountCodeNegative.postman_collection.json b/business-services/egf-instrument/src/postman/InstrumentAccountCodeNegative.postman_collection.json deleted file mode 100644 index b7a6843a764..00000000000 --- a/business-services/egf-instrument/src/postman/InstrumentAccountCodeNegative.postman_collection.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "variables": [], - "info": { - "name": "InstrumentAccountCodeNegative", - "_postman_id": "1574dd69-49ad-4925-49a8-fd0fd51a4474", - "description": "", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "localhost:8480/egf-instrument/instrumentaccountcodes/_update", - "request": { - "url": "localhost:8480/egf-instrument/instrumentaccountcodes/_update", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instrumentAccountCodes\":[\n \t\t{\n\t\t\t \"instrumentType\":{\n\t \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n\t \"name\":\"DD\"\n \t},\n \t\"accountCode\":{\n \t\t\"id\":\"1\",\n \t\t\"glcode\":\"2\",\n \t\t\"tenantId\":\"default\"\n \t},\n\t\t\t\"tenantId\":\"default\"\n \t\t}\n \t]\n}" - }, - "description": "InstrumentAccountCode update failed because no id" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instrumentaccountcodes/_create", - "request": { - "url": "localhost:8480/egf-instrument/instrumentaccountcodes/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instrumentAccountCodes\":[\n \t\t{\n\t\t\t \"instrumentType\":{\n\t \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n\t \"name\":\"DD\"\n \t},\n \t\"accountCode\":{\n \t\t\"id\":\"1\",\n \t\t\"tenantId\":\"default\"\n \t},\n\t\t\t\"tenantId\":\"default\"\n \t\t}\n \t]\n}" - }, - "description": "InstrumentAccountCode creation failed no glcode is passed" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/postman/InstrumentAccountCodePositive.postman_collection.json b/business-services/egf-instrument/src/postman/InstrumentAccountCodePositive.postman_collection.json deleted file mode 100644 index e94eab18f18..00000000000 --- a/business-services/egf-instrument/src/postman/InstrumentAccountCodePositive.postman_collection.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "variables": [], - "info": { - "name": "InstrumentAccountCodePositive", - "_postman_id": "35f48d0d-3a3c-da79-2c00-f187e84f44e9", - "description": "InstrumentAccountCode create success\n", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "localhost:8480/egf-instrument/instrumentaccountcodes/_update", - "request": { - "url": "localhost:8480/egf-instrument/instrumentaccountcodes/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instrumentAccountCodes\":[\n \t\t{\n\t\t\t \"instrumentType\":{\n\t \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n\t \"name\":\"DD\"\n \t},\n \t\"accountCode\":{\n \t\t\"id\":\"1\",\n \t\t\"glcode\":\"1\",\n \t\t\"tenantId\":\"default\"\n \t},\n\t\t\t\"tenantId\":\"default\"\n \t\t}\n \t]\n}" - }, - "description": "InstrumentAccountCode creation success" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instrumentaccountcodes/_update", - "request": { - "url": "localhost:8480/egf-instrument/instrumentaccountcodes/_update", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instrumentAccountCodes\":[\n \t\t{\n \t\t\t\"id\":\"e0b3c3d5715f4163b11ca7b269e95603\",\n\t\t\t \"instrumentType\":{\n\t \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n\t \"name\":\"DD\"\n \t},\n \t\"accountCode\":{\n \t\t\"id\":\"1\",\n \t\t\"glcode\":\"2\",\n \t\t\"tenantId\":\"default\"\n \t},\n\t\t\t\"tenantId\":\"default\"\n \t\t}\n \t]\n}" - }, - "description": "InstrumentAccountCode creation success" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/postman/InstrumentNegative.postman_collection.json b/business-services/egf-instrument/src/postman/InstrumentNegative.postman_collection.json deleted file mode 100644 index f77ba5b286e..00000000000 --- a/business-services/egf-instrument/src/postman/InstrumentNegative.postman_collection.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "variables": [], - "info": { - "name": "InstrumentNegative", - "_postman_id": "d2c8c9db-ea19-422c-9490-3f337330883f", - "description": "", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "localhost:8480/egf-instrument/instruments/_create", - "request": { - "url": "localhost:8480/egf-instrument/instruments/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instruments\":[\n {\n \"id\":\"hello\",\n \n \"transactionDate\":\"23-08-2017\",\n \"amount\":100,\n \"payee\":\"payee\",\n \"transactionType\":\"Credit\",\n \"bank\":{\n \"id\":10,\n \"code\":\"10\",\n \"name\":\"nameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"bankAccount\":{\n \t\"id\":\"1\",\n \"bankBranch\":{\n \"id\":\"1\",\n \"bank\":{\n \"id\":10000,\n \"code\":\"10\",\n \"name\":\"neameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"code\":\"Rajesh\",\n \"name\":\"Rajesh\",\n \"active\":true,\n \"micr\":\"Rajesh\",\n \"tenantId\":\"default\"\n },\n \"chartOfAccount\":{\n \"id\":\"1223\",\n \"tenantId\":\"default\"\n },\n \"fund\":{\n \"id\":\"1\",\n \"tenantId\":\"default\"\n },\n \"accountNumber\":\"000000000001\",\n \"accountType\":\"OTHER SCHEDULED BANKS\",\n \"active\":true,\n \"type\":\"RECEIPTS_PAYMENTS\",\n \"tenantId\":\"default\"\n },\n \"instrumentType\":{\n \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n \"name\":\"DD\",\n \"active\":\"true\",\n \"tenantId\":\"default\"\n },\n \"serialNo\":\"serialNo\",\n \"tenantId\":\"default\"\n }\n ]\n}" - }, - "description": "Negative : DD InstrumentType without Transaction Number" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instruments/_create", - "request": { - "url": "localhost:8480/egf-instrument/instruments/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instruments\":[\n {\n \"id\":\"hello\",\n \n \"transactionDate\":\"23-08-2017\",\n \"amount\":100,\n \"payee\":\"payee\",\n \"transactionType\":\"Credit\",\n \"bank\":{\n \"id\":10,\n \"code\":\"10\",\n \"name\":\"nameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"bankAccount\":{\n \t\"id\":\"1\",\n \"bankBranch\":{\n \"id\":\"1\",\n \"bank\":{\n \"id\":10000,\n \"code\":\"10\",\n \"name\":\"neameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"code\":\"Rajesh\",\n \"name\":\"Rajesh\",\n \"active\":true,\n \"micr\":\"Rajesh\",\n \"tenantId\":\"default\"\n },\n \"chartOfAccount\":{\n \"id\":\"1223\",\n \"tenantId\":\"default\"\n },\n \"fund\":{\n \"id\":\"1\",\n \"tenantId\":\"default\"\n },\n \"accountNumber\":\"000000000001\",\n \"accountType\":\"OTHER SCHEDULED BANKS\",\n \"active\":true,\n \"type\":\"RECEIPTS_PAYMENTS\",\n \"tenantId\":\"default\"\n },\n \"instrumentType\":{\n \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n \"name\":\"Cheque\",\n \"active\":\"true\",\n \"tenantId\":\"default\"\n },\n \"serialNo\":\"serialNo\",\n \"tenantId\":\"default\"\n }\n ]\n}" - }, - "description": "Negative : Cheque InstrumentType, without Transaction Number, Instrument creation fails" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instruments/_create", - "request": { - "url": "localhost:8480/egf-instrument/instruments/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instruments\":[\n {\n \"id\":\"hello\",\n \n \"transactionDate\":\"23-08-2017\",\n \"amount\":100,\n \"payee\":\"payee\",\n \"transactionType\":\"Credit\",\n \"bank\":{\n \"id\":10,\n \"code\":\"10\",\n \"name\":\"nameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"bankAccount\":{\n \t\"id\":\"1\",\n \"bankBranch\":{\n \"id\":\"1\",\n \"bank\":{\n \"id\":10000,\n \"code\":\"10\",\n \"name\":\"neameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"code\":\"Rajesh\",\n \"name\":\"Rajesh\",\n \"active\":true,\n \"micr\":\"Rajesh\",\n \"tenantId\":\"default\"\n },\n \"chartOfAccount\":{\n \"id\":\"1223\",\n \"tenantId\":\"default\"\n },\n \"fund\":{\n \"id\":\"1\",\n \"tenantId\":\"default\"\n },\n \"accountNumber\":\"000000000001\",\n \"accountType\":\"OTHER SCHEDULED BANKS\",\n \"active\":true,\n \"type\":\"RECEIPTS_PAYMENTS\",\n \"tenantId\":\"default\"\n },\n \"instrumentType\":{\n \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n \"name\":\"Cash\",\n \"active\":\"true\",\n \"tenantId\":\"default\"\n },\n \"serialNo\":\"serialNo\",\n \"tenantId\":\"default\"\n }\n ]\n}" - }, - "description": "Negative : Cash InstrumentType, without Transaction Number, Instrument creation fails" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instruments/_create", - "request": { - "url": "localhost:8480/egf-instrument/instruments/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instruments\":[\n {\n \"id\":\"hello\",\n \"transactionNumber\":\"transactionNumber\",\n \"transactionDate\":\"23-08-2017\",\n \"amount\":100,\n \"payee\":\"payee\",\n \"transactionType\":\"Credit\",\n\n \"bankAccount\":{\n \t\"id\":\"1\",\n \"bankBranch\":{\n \"id\":\"1\",\n \"bank\":{\n \"id\":10000,\n \"code\":\"10\",\n \"name\":\"neameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"code\":\"Rajesh\",\n \"name\":\"Rajesh\",\n \"active\":true,\n \"micr\":\"Rajesh\",\n \"tenantId\":\"default\"\n },\n \"chartOfAccount\":{\n \"id\":\"1223\",\n \"tenantId\":\"default\"\n },\n \"fund\":{\n \"id\":\"1\",\n \"tenantId\":\"default\"\n },\n \"accountNumber\":\"000000000001\",\n \"accountType\":\"OTHER SCHEDULED BANKS\",\n \"active\":true,\n \"type\":\"RECEIPTS_PAYMENTS\",\n \"tenantId\":\"default\"\n },\n \"instrumentType\":{\n \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n \"name\":\"BankChallan\",\n \"active\":\"true\",\n \"tenantId\":\"default\"\n },\n \"serialNo\":\"serialNo\",\n \"tenantId\":\"default\"\n }\n ]\n}" - }, - "description": "Negative : BankChallan InstrumentType, without Bank Details, Instrument creation fails" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/postman/InstrumentPositive.postman_collection.json b/business-services/egf-instrument/src/postman/InstrumentPositive.postman_collection.json deleted file mode 100644 index c06fd3b5530..00000000000 --- a/business-services/egf-instrument/src/postman/InstrumentPositive.postman_collection.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "variables": [], - "info": { - "name": "InstrumentPositive", - "_postman_id": "ba7cac8b-86e4-87b3-fc4e-d3e91166cdd9", - "description": "", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "localhost:8480/egf-instrument/instruments/_create", - "request": { - "url": "localhost:8480/egf-instrument/instruments/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instruments\":[\n {\n \"id\":\"hello\",\n \"transactionNumber\":\"transactionNumber\",\n \"transactionDate\":\"23-08-2017\",\n \"amount\":100,\n \"payee\":\"payee\",\n \"transactionType\":\"Credit\",\n \"bank\":{\n \"id\":10,\n \"code\":\"10\",\n \"name\":\"nameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"bankAccount\":{\n \t\"id\":\"1\",\n \"bankBranch\":{\n \"id\":\"1\",\n \"bank\":{\n \"id\":10000,\n \"code\":\"10\",\n \"name\":\"neameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"code\":\"Rajesh\",\n \"name\":\"Rajesh\",\n \"active\":true,\n \"micr\":\"Rajesh\",\n \"tenantId\":\"default\"\n },\n \"chartOfAccount\":{\n \"id\":\"1223\",\n \"tenantId\":\"default\"\n },\n \"fund\":{\n \"id\":\"1\",\n \"tenantId\":\"default\"\n },\n \"accountNumber\":\"000000000001\",\n \"accountType\":\"OTHER SCHEDULED BANKS\",\n \"active\":true,\n \"type\":\"RECEIPTS_PAYMENTS\",\n \"tenantId\":\"default\"\n },\n \"instrumentType\":{\n \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n \"name\":\"DD\",\n \"active\":\"true\",\n \"tenantId\":\"default\"\n },\n \"serialNo\":\"serialNo\",\n \"tenantId\":\"default\"\n }\n ]\n}" - }, - "description": "Positive : DD Instrument Type, create Instrument success" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instruments/_create", - "request": { - "url": "localhost:8480/egf-instrument/instruments/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instruments\":[\n {\n \"id\":\"hello\",\n \"transactionNumber\":\"transactionNumber\",\n \"transactionDate\":\"23-08-2017\",\n \"amount\":100,\n \"payee\":\"payee\",\n \"transactionType\":\"Credit\",\n \"bank\":{\n \"id\":10,\n \"code\":\"10\",\n \"name\":\"nameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"bankAccount\":{\n \t\"id\":\"1\",\n \"bankBranch\":{\n \"id\":\"1\",\n \"bank\":{\n \"id\":10000,\n \"code\":\"10\",\n \"name\":\"neameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"code\":\"Rajesh\",\n \"name\":\"Rajesh\",\n \"active\":true,\n \"micr\":\"Rajesh\",\n \"tenantId\":\"default\"\n },\n \"chartOfAccount\":{\n \"id\":\"1223\",\n \"tenantId\":\"default\"\n },\n \"fund\":{\n \"id\":\"1\",\n \"tenantId\":\"default\"\n },\n \"accountNumber\":\"000000000001\",\n \"accountType\":\"OTHER SCHEDULED BANKS\",\n \"active\":true,\n \"type\":\"RECEIPTS_PAYMENTS\",\n \"tenantId\":\"default\"\n },\n \"instrumentType\":{\n \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n \"name\":\"Cheque\",\n \"active\":\"true\",\n \"tenantId\":\"default\"\n },\n \"serialNo\":\"serialNo\",\n \"tenantId\":\"default\"\n }\n ]\n}" - }, - "description": "Positive : Cheque InstrumentType, Instrument Create success" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instruments/_create", - "request": { - "url": "localhost:8480/egf-instrument/instruments/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instruments\":[\n {\n \"id\":\"hello\",\n \"transactionNumber\":\"transactionNumber\",\n \"transactionDate\":\"24-08-2017\",\n \"amount\":100,\n \"payee\":\"payee\",\n \"transactionType\":\"Credit\",\n \"bank\":{\n \"id\":10,\n \"code\":\"10\",\n \"name\":\"nameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"bankAccount\":{\n \t\"id\":\"1\",\n \"bankBranch\":{\n \"id\":\"1\",\n \"bank\":{\n \"id\":10000,\n \"code\":\"10\",\n \"name\":\"neameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"code\":\"Rajesh\",\n \"name\":\"Rajesh\",\n \"active\":true,\n \"micr\":\"Rajesh\",\n \"tenantId\":\"default\"\n },\n \"chartOfAccount\":{\n \"id\":\"1223\",\n \"tenantId\":\"default\"\n },\n \"fund\":{\n \"id\":\"1\",\n \"tenantId\":\"default\"\n },\n \"accountNumber\":\"000000000001\",\n \"accountType\":\"OTHER SCHEDULED BANKS\",\n \"active\":true,\n \"type\":\"RECEIPTS_PAYMENTS\",\n \"tenantId\":\"default\"\n },\n \"instrumentType\":{\n \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n \"name\":\"Cash\",\n \"active\":\"true\",\n \"tenantId\":\"default\"\n },\n \"serialNo\":\"serialNo\",\n \"tenantId\":\"default\"\n }\n ]\n}" - }, - "description": "Positive : Cash InstrumentType, Instrument Create success" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instruments/_create", - "request": { - "url": "localhost:8480/egf-instrument/instruments/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instruments\":[\n {\n \"id\":\"hello\",\n \"transactionNumber\":\"transactionNumber\",\n \"transactionDate\":\"23-08-2017\",\n \"amount\":100,\n \"payee\":\"payee\",\n \"transactionType\":\"Credit\",\n \"bank\":{\n \"id\":10,\n \"code\":\"10\",\n \"name\":\"nameupdate\",\n \"description\":\"descriptionupdate\",\n \"active\":true,\n \"type\":\"typeupdate\",\n \"tenantId\":\"default\"\n },\n \"bankAccount\":{\n \t\"id\":\"1\",\n \"bankBranch\":{\n \"id\":\"1\",\n\n \"code\":\"Rajesh\",\n \"name\":\"Rajesh\",\n \"active\":true,\n \"micr\":\"Rajesh\",\n \"tenantId\":\"default\"\n },\n \"chartOfAccount\":{\n \"id\":\"1223\",\n \"tenantId\":\"default\"\n },\n \"fund\":{\n \"id\":\"1\",\n \"tenantId\":\"default\"\n },\n \"accountNumber\":\"000000000001\",\n \"accountType\":\"OTHER SCHEDULED BANKS\",\n \"active\":true,\n \"type\":\"RECEIPTS_PAYMENTS\",\n \"tenantId\":\"default\"\n },\n \"instrumentType\":{\n \"id\":\"f3ae954c-74b0-47d9-9c17-088362c31e35\",\n \"name\":\"BankChallan\",\n \"active\":\"true\",\n \"tenantId\":\"default\"\n },\n \"serialNo\":\"serialNo\",\n \"tenantId\":\"default\"\n }\n ]\n}" - }, - "description": "Positive : BankChallan InstrumentType, Instrument create success" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/postman/InstrumentTypeNegative.postman_collection.json b/business-services/egf-instrument/src/postman/InstrumentTypeNegative.postman_collection.json deleted file mode 100644 index a634792eacf..00000000000 --- a/business-services/egf-instrument/src/postman/InstrumentTypeNegative.postman_collection.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "variables": [], - "info": { - "name": "InstrumentType Negative", - "_postman_id": "c8b42fd1-0246-6507-20ab-1fc65a08c198", - "description": "", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "localhost:8480/egf-instrument/instrumenttypes/_create", - "request": { - "url": "localhost:8480/egf-instrument/instrumenttypes/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instrumentTypes\":[\n \t\t{\n \t\t\t\"id\":\"1\",\n \t\t\t\"description\":\"newdescription\",\n \t\t\t\"active\":true,\n \t\t\t\"tenantId\":\"default\",\n \t\t\t\"instrumentTypeProperties\":[\n \t\t\t\t{\n \t\t\t\t\t\"id\":\"0ee4059b-e056-4070-90dd-8e52747fe5be\",\n \t\t\t\t\t\"transactionType\":\"Credit\",\n \t\t\t\t\t\"reconciledOncreate\":false,\n \t\t\t\t\t\"statusOnCreate\":\"New\",\n \t\t\t\t\t\"statusOnUpdate\":\"Deposited\",\n \t\t\t\t\t\"statusOnReconcile\":\"Reconciled\",\n \t\t\t\t\t\"instrumentType\":\"Online\"\n \t\t\t\t\n \t\t\t},\n \t\t\t{\n \t\t\t\t\"id\":\"0ee4059b-e056-4070-90dd-8e52747fe5be\",\n \t\t\t\t\t\"transactionType\":\"Debit\",\n \t\t\t\t\t\"reconciledOncreate\":false,\n \t\t\t\t\t\"statusOnCreate\":\"New\",\n \t\t\t\t\t\"statusOnUpdate\":\"Deposited\",\n \t\t\t\t\t\"statusOnReconcile\":\"Reconciled\",\n \t\t\t\t\t\"instrumentType\":\"Online\"\n \t\t\t\t\n \t\t\t}\n \t\t\t\t]\n \t\t}\n \t]\n}" - }, - "description": "Instrumenttype create failed because name is not mentioned and it is mandatory" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instrumenttypes/_update", - "request": { - "url": "localhost:8480/egf-instrument/instrumenttypes/_update", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instrumentTypes\":[\n \t\t{\n \t\t\t\"id\":\"12861237\",\n \t\t\t\"name\":\"asdabarathnewn234am213e\",\n \t\t\t\"description\":\"newdescription\",\n \t\t\t\"active\":true,\n \t\t\t\"instrumentTypeProperties\":[\n \t\t\t\t{\n \t\t\t\t\t\"id\":\"0ee4059b-e056-4070-90dd-8e52747fe5be\",\n \t\t\t\t\t\"transactionType\":\"Credit\",\n \t\t\t\t\t\"reconciledOncreate\":false,\n \t\t\t\t\t\"statusOnCreate\":\"New\",\n \t\t\t\t\t\"statusOnUpdate\":\"Deposited\",\n \t\t\t\t\t\"statusOnReconcile\":\"Reconciled\",\n \t\t\t\t\t\"instrumentType\":\"Online\"\n \t\t\t\t\n \t\t\t},\n \t\t\t{\n \t\t\t\t\"id\":\"0ee4059b-e056-4070-90dd-8e52747fe5be\",\n \t\t\t\t\t\"transactionType\":\"Debit\",\n \t\t\t\t\t\"reconciledOncreate\":false,\n \t\t\t\t\t\"statusOnCreate\":\"New\",\n \t\t\t\t\t\"statusOnUpdate\":\"Deposited\",\n \t\t\t\t\t\"statusOnReconcile\":\"Reconciled\",\n \t\t\t\t\t\"instrumentType\":\"Online\"\n \t\t\t\t\n \t\t\t}\n \t\t\t\t]\n \t\t}\n \t]\n}" - }, - "description": "Update failed since tenantId is not mentioned" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/postman/InstrumentTypesPositive.postman_collection.json b/business-services/egf-instrument/src/postman/InstrumentTypesPositive.postman_collection.json deleted file mode 100644 index 5d55076505c..00000000000 --- a/business-services/egf-instrument/src/postman/InstrumentTypesPositive.postman_collection.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "variables": [], - "info": { - "name": "InstrumentTypesPositive", - "_postman_id": "3dbce50e-48f3-d89b-c2d8-fef8db1218c5", - "description": "", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "localhost:8480/egf-instrument/instrumenttypes/_create", - "request": { - "url": "localhost:8480/egf-instrument/instrumenttypes/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instrumentTypes\":[\n \t\t{\n \t\t\t\"id\":\"1\",\n \t\t\t\"name\":\"newname\",\n \t\t\t\"description\":\"newdescription\",\n \t\t\t\"active\":true,\n \t\t\t\"tenantId\":\"default\",\n \t\t\t\"instrumentTypeProperties\":[\n \t\t\t\t{\n \t\t\t\t\t\"id\":\"0ee4059b-e056-4070-90dd-8e52747fe5be\",\n \t\t\t\t\t\"transactionType\":\"Credit\",\n \t\t\t\t\t\"reconciledOncreate\":false,\n \t\t\t\t\t\"statusOnCreate\":\"New\",\n \t\t\t\t\t\"statusOnUpdate\":\"Deposited\",\n \t\t\t\t\t\"statusOnReconcile\":\"Reconciled\",\n \t\t\t\t\t\"instrumentType\":\"Online\"\n \t\t\t\t\n \t\t\t},\n \t\t\t{\n \t\t\t\t\"id\":\"0ee4059b-e056-4070-90dd-8e52747fe5be\",\n \t\t\t\t\t\"transactionType\":\"Debit\",\n \t\t\t\t\t\"reconciledOncreate\":false,\n \t\t\t\t\t\"statusOnCreate\":\"New\",\n \t\t\t\t\t\"statusOnUpdate\":\"Deposited\",\n \t\t\t\t\t\"statusOnReconcile\":\"Reconciled\",\n \t\t\t\t\t\"instrumentType\":\"Online\"\n \t\t\t\t\n \t\t\t}\n \t\t\t\t]\n \t\t}\n \t]\n}" - }, - "description": "Instrumenttype create success" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/instrumenttypes/_update", - "request": { - "url": "localhost:8480/egf-instrument/instrumenttypes/_update", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"instrumentTypes\":[\n \t\t{\n \t\t\t\"id\":\"12861237\",\n \t\t\t\"name\":\"barathnewn234am213e\",\n \t\t\t\"description\":\"newdescription\",\n \t\t\t\"active\":true,\n \t\t\t\"tenantId\":\"default\",\n \t\t\t\"instrumentTypeProperties\":[\n \t\t\t\t{\n \t\t\t\t\t\"id\":\"0ee4059b-e056-4070-90dd-8e52747fe5be\",\n \t\t\t\t\t\"transactionType\":\"Credit\",\n \t\t\t\t\t\"reconciledOncreate\":false,\n \t\t\t\t\t\"statusOnCreate\":\"New\",\n \t\t\t\t\t\"statusOnUpdate\":\"Deposited\",\n \t\t\t\t\t\"statusOnReconcile\":\"Reconciled\",\n \t\t\t\t\t\"instrumentType\":\"Online\"\n \t\t\t\t\n \t\t\t},\n \t\t\t{\n \t\t\t\t\"id\":\"0ee4059b-e056-4070-90dd-8e52747fe5be\",\n \t\t\t\t\t\"transactionType\":\"Debit\",\n \t\t\t\t\t\"reconciledOncreate\":false,\n \t\t\t\t\t\"statusOnCreate\":\"New\",\n \t\t\t\t\t\"statusOnUpdate\":\"Deposited\",\n \t\t\t\t\t\"statusOnReconcile\":\"Reconciled\",\n \t\t\t\t\t\"instrumentType\":\"Online\"\n \t\t\t\t\n \t\t\t}\n \t\t\t\t]\n \t\t}\n \t]\n}" - }, - "description": "Update success" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/postman/SurrenderReasonNegative.postman_collection.json b/business-services/egf-instrument/src/postman/SurrenderReasonNegative.postman_collection.json deleted file mode 100644 index 69abd38ca20..00000000000 --- a/business-services/egf-instrument/src/postman/SurrenderReasonNegative.postman_collection.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "variables": [], - "info": { - "name": "SurrenderReasonNegative", - "_postman_id": "771f2fbe-d3cf-6bb5-120f-c1215cf7419e", - "description": "", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "localhost:8480/egf-instrument/surrenderreasons/_create", - "request": { - "url": "localhost:8480/egf-instrument/surrenderreasons/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"surrenderReasons\":[\n \t\t{\n\t\t\t\"name\":\"Reason4\",\n\t\t\t\"description\": \"Reason4 Description\"\n \t\t}\n \t]\n}" - }, - "description": "Surrender Reason create failed because no tenantId specifieds" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/surrenderreasons/_update", - "request": { - "url": "localhost:8480/egf-instrument/surrenderreasons/_update", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"surrenderReasons\":[\n \t\t{\n \t\t\t\"id\":\"b7263b99e85b41449be5b675f286c043\",\n\t\t\t\"name\":\"Reason3\",\n\t\t\t\"description\": \"Reason3 Description Update\"\n \t\t}\n \t]\n}" - }, - "description": "SurrenderReason Update filed because no tenantId specified" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/surrenderreasons/_delete", - "request": { - "url": "localhost:8480/egf-instrument/surrenderreasons/_delete", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"surrenderReasons\":[\n \t{\n \t\t\n \t}\n \t]\n}" - }, - "description": "SurrenderReason delete fails because no ID is specified" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/postman/SurrenderReasonPositive.postman_collection.json b/business-services/egf-instrument/src/postman/SurrenderReasonPositive.postman_collection.json deleted file mode 100644 index eb776ffabcd..00000000000 --- a/business-services/egf-instrument/src/postman/SurrenderReasonPositive.postman_collection.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "variables": [], - "info": { - "name": "SurrenderReasonPositive", - "_postman_id": "859345ff-98dc-21dc-7fe8-bf235f57a4c7", - "description": "Surrender Reason postman Test cases\n", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "localhost:8480/egf-instrument/surrenderreasons/_update", - "request": { - "url": "localhost:8480/egf-instrument/surrenderreasons/_update", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"surrenderReasons\":[\n \t\t{\n \t\t\t\"id\":\"b7263b99e85b41449be5b675f286c043\",\n\t\t\t\"name\":\"Reason3\",\n\t\t\t\"description\": \"Reason3 Description Update\",\n\t\t\t\"tenantId\":\"default\"\n \t\t}\n \t]\n}" - }, - "description": "Surrender Reason create API success" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/surrenderreasons/_create", - "request": { - "url": "localhost:8480/egf-instrument/surrenderreasons/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"surrenderReasons\":[\n \t\t{\n\t\t\t\"name\":\"Reason3\",\n\t\t\t\"description\": \"Reason3 Description\",\n\t\t\t\"tenantId\":\"default\"\n \t\t}\n \t]\n}" - }, - "description": "Surrender Reason create API success" - }, - "response": [] - }, - { - "name": "localhost:8480/egf-instrument/surrenderreasons/_delete", - "request": { - "url": "localhost:8480/egf-instrument/surrenderreasons/_delete", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"requestInfo\":{\n \"resMsgId\":\"placeholder\",\n \"status\":\"200\",\n \"apiId\":null,\n \"ver\":null,\n \"ts\":\"01-01-2017 01:01:01\",\n \"key\":null,\n \"authToken\":\"\",\n \"userInfo\":{\n \"id\":1\n }\n },\n \"surrenderReasons\":[\n \t{\n \t\t\"id\":\"b7263b99e85b41449be5b675f286c043\"\n \t}\n \t]\n}" - }, - "description": "SurrenderReason delete success" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/TestConfiguration.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/TestConfiguration.java deleted file mode 100644 index ed935721b6c..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/TestConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.instrument; - -import static org.mockito.Mockito.mock; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.kafka.core.KafkaTemplate; - -@Configuration -public class TestConfiguration { - - @Bean - @SuppressWarnings("unchecked") - public KafkaTemplate kafkaTemplate() { - return mock(KafkaTemplate.class); - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentAccountCodeRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentAccountCodeRepositoryTest.java deleted file mode 100644 index 5079e8964af..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentAccountCodeRepositoryTest.java +++ /dev/null @@ -1,301 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.persistence.entity.InstrumentAccountCodeEntity; -import org.egov.egf.instrument.persistence.queue.repository.InstrumentAccountCodeQueueRepository; -import org.egov.egf.instrument.persistence.repository.InstrumentAccountCodeJdbcRepository; -import org.egov.egf.instrument.web.requests.InstrumentAccountCodeRequest; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.egov.egf.master.web.repository.FinancialConfigurationContractRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentAccountCodeRepositoryTest { - - private InstrumentAccountCodeRepository instrumentAccountCodeRepositoryWithKafka; - - private InstrumentAccountCodeRepository instrumentAccountCodeRepositoryWithOutKafka; - - @Mock - private InstrumentAccountCodeJdbcRepository instrumentAccountCodeJdbcRepository; - - @Mock - private InstrumentAccountCodeQueueRepository instrumentAccountCodeQueueRepository; - - @Mock - private FinancialConfigurationContractRepository financialConfigurationContractRepository; - - @Mock - private InstrumentAccountCodeESRepository instrumentAccountCodeESRepository; - - @Captor - private ArgumentCaptor captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - instrumentAccountCodeRepositoryWithKafka = new InstrumentAccountCodeRepository( - instrumentAccountCodeJdbcRepository, instrumentAccountCodeQueueRepository, "yes", - instrumentAccountCodeESRepository, financialConfigurationContractRepository); - - instrumentAccountCodeRepositoryWithOutKafka = new InstrumentAccountCodeRepository( - instrumentAccountCodeJdbcRepository, instrumentAccountCodeQueueRepository, "no", - instrumentAccountCodeESRepository, financialConfigurationContractRepository); - } - - @Test - public void test_find_by_id() { - InstrumentAccountCodeEntity entity = getInstrumentAccountCodeEntity(); - InstrumentAccountCode expectedResult = entity.toDomain(); - - when(instrumentAccountCodeJdbcRepository.findById(any(InstrumentAccountCodeEntity.class))).thenReturn(entity); - - InstrumentAccountCode actualResult = instrumentAccountCodeRepositoryWithKafka - .findById(getInstrumentAccountCodeDomin()); - - assertEquals(expectedResult.getAccountCode().getId(), actualResult.getAccountCode().getId()); - assertEquals(expectedResult.getInstrumentType().getId(), actualResult.getInstrumentType().getId()); - } - - @Test - public void test_find_by_id_return_null() { - InstrumentAccountCodeEntity entity = getInstrumentAccountCodeEntity(); - - Mockito.lenient().when(instrumentAccountCodeJdbcRepository.findById(null)).thenReturn(entity); - - InstrumentAccountCode actualResult = instrumentAccountCodeRepositoryWithKafka - .findById(getInstrumentAccountCodeDomin()); - - assertEquals(null, actualResult); - } - - @Test - public void test_save_with_kafka() { - - List expectedResult = getInstrumentAccountCodes(); - - instrumentAccountCodeRepositoryWithKafka.save(expectedResult, requestInfo); - - verify(instrumentAccountCodeQueueRepository).addToQue(captor.capture()); - - final InstrumentAccountCodeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getInstrumentType().getName(), - actualRequest.getInstrumentAccountCodes().get(0).getInstrumentType().getName()); - assertEquals(expectedResult.get(0).getAccountCode().getGlcode(), - actualRequest.getInstrumentAccountCodes().get(0).getAccountCode().getGlcode()); - assertEquals(expectedResult.get(0).getTenantId(), - actualRequest.getInstrumentAccountCodes().get(0).getTenantId()); - } - - @Test - public void test_save_with_out_kafka() { - - List expectedResult = getInstrumentAccountCodes(); - - InstrumentAccountCodeEntity entity = new InstrumentAccountCodeEntity().toEntity(expectedResult.get(0)); - - when(instrumentAccountCodeJdbcRepository.create(any(InstrumentAccountCodeEntity.class))).thenReturn(entity); - - instrumentAccountCodeRepositoryWithOutKafka.save(expectedResult, requestInfo); - - verify(instrumentAccountCodeQueueRepository).addToSearchQue(captor.capture()); - - final InstrumentAccountCodeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getInstrumentType().getName(), - actualRequest.getInstrumentAccountCodes().get(0).getInstrumentType().getName()); - assertEquals(expectedResult.get(0).getAccountCode().getGlcode(), - actualRequest.getInstrumentAccountCodes().get(0).getAccountCode().getGlcode()); - assertEquals(expectedResult.get(0).getTenantId(), - actualRequest.getInstrumentAccountCodes().get(0).getTenantId()); - } - - @Test - public void test_update_with_kafka() { - - List expectedResult = getInstrumentAccountCodes(); - - instrumentAccountCodeRepositoryWithKafka.update(expectedResult, requestInfo); - - verify(instrumentAccountCodeQueueRepository).addToQue(captor.capture()); - - final InstrumentAccountCodeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getInstrumentType().getName(), - actualRequest.getInstrumentAccountCodes().get(0).getInstrumentType().getName()); - assertEquals(expectedResult.get(0).getAccountCode().getGlcode(), - actualRequest.getInstrumentAccountCodes().get(0).getAccountCode().getGlcode()); - assertEquals(expectedResult.get(0).getTenantId(), - actualRequest.getInstrumentAccountCodes().get(0).getTenantId()); - } - - @Test - public void test_delete_with_kafka() { - - List expectedResult = getInstrumentAccountCodes(); - - instrumentAccountCodeRepositoryWithKafka.delete(expectedResult, requestInfo); - - verify(instrumentAccountCodeQueueRepository).addToQue(captor.capture()); - - final InstrumentAccountCodeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getInstrumentType().getName(), - actualRequest.getInstrumentAccountCodes().get(0).getInstrumentType().getName()); - assertEquals(expectedResult.get(0).getAccountCode().getGlcode(), - actualRequest.getInstrumentAccountCodes().get(0).getAccountCode().getGlcode()); - assertEquals(expectedResult.get(0).getTenantId(), - actualRequest.getInstrumentAccountCodes().get(0).getTenantId()); - } - - @Test - public void test_update_with_out_kafka() { - - List expectedResult = getInstrumentAccountCodes(); - - InstrumentAccountCodeEntity entity = new InstrumentAccountCodeEntity().toEntity(expectedResult.get(0)); - - when(instrumentAccountCodeJdbcRepository.update(any(InstrumentAccountCodeEntity.class))).thenReturn(entity); - - instrumentAccountCodeRepositoryWithOutKafka.update(expectedResult, requestInfo); - - verify(instrumentAccountCodeQueueRepository).addToSearchQue(captor.capture()); - - final InstrumentAccountCodeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getInstrumentType().getName(), - actualRequest.getInstrumentAccountCodes().get(0).getInstrumentType().getName()); - assertEquals(expectedResult.get(0).getAccountCode().getGlcode(), - actualRequest.getInstrumentAccountCodes().get(0).getAccountCode().getGlcode()); - assertEquals(expectedResult.get(0).getTenantId(), - actualRequest.getInstrumentAccountCodes().get(0).getTenantId()); - } - - @Test - public void test_delete_with_out_kafka() { - - List expectedResult = getInstrumentAccountCodes(); - - InstrumentAccountCodeEntity entity = new InstrumentAccountCodeEntity().toEntity(expectedResult.get(0)); - - when(instrumentAccountCodeJdbcRepository.delete(any(InstrumentAccountCodeEntity.class))).thenReturn(entity); - - instrumentAccountCodeRepositoryWithOutKafka.delete(expectedResult, requestInfo); - - verify(instrumentAccountCodeQueueRepository).addToSearchQue(captor.capture()); - - final InstrumentAccountCodeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getInstrumentType().getName(), - actualRequest.getInstrumentAccountCodes().get(0).getInstrumentType().getName()); - assertEquals(expectedResult.get(0).getAccountCode().getGlcode(), - actualRequest.getInstrumentAccountCodes().get(0).getAccountCode().getGlcode()); - assertEquals(expectedResult.get(0).getTenantId(), - actualRequest.getInstrumentAccountCodes().get(0).getTenantId()); - } - - @Test - public void test_save() { - - InstrumentAccountCodeEntity entity = getInstrumentAccountCodeEntity(); - InstrumentAccountCode expectedResult = entity.toDomain(); - - when(instrumentAccountCodeJdbcRepository.create(any(InstrumentAccountCodeEntity.class))).thenReturn(entity); - - InstrumentAccountCode actualResult = instrumentAccountCodeRepositoryWithKafka - .save(getInstrumentAccountCodeDomin()); - - assertEquals(expectedResult.getAccountCode().getId(), actualResult.getAccountCode().getId()); - assertEquals(expectedResult.getInstrumentType().getId(), actualResult.getInstrumentType().getId()); - - } - - @Test - public void test_update() { - - InstrumentAccountCodeEntity entity = getInstrumentAccountCodeEntity(); - InstrumentAccountCode expectedResult = entity.toDomain(); - - when(instrumentAccountCodeJdbcRepository.update(any(InstrumentAccountCodeEntity.class))).thenReturn(entity); - - InstrumentAccountCode actualResult = instrumentAccountCodeRepositoryWithKafka - .update(getInstrumentAccountCodeDomin()); - - assertEquals(expectedResult.getAccountCode().getId(), actualResult.getAccountCode().getId()); - assertEquals(expectedResult.getInstrumentType().getId(), actualResult.getInstrumentType().getId()); - } - - @Test - public void test_search() { - - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - - when(financialConfigurationContractRepository.fetchDataFrom()).thenReturn("db"); - when(instrumentAccountCodeJdbcRepository.search(any(InstrumentAccountCodeSearch.class))) - .thenReturn(expectedResult); - - Pagination actualResult = instrumentAccountCodeRepositoryWithKafka - .search(getInstrumentAccountCodeSearch()); - - assertEquals(expectedResult, actualResult); - - } - - private InstrumentAccountCode getInstrumentAccountCodeDomin() { - InstrumentAccountCode instrumentAccountCodeDetail = new InstrumentAccountCode(); - instrumentAccountCodeDetail.setAccountCode(ChartOfAccountContract.builder().id("accountCodeId").build()); - instrumentAccountCodeDetail.setInstrumentType(InstrumentType.builder().id("instrumentTypeId").build()); - instrumentAccountCodeDetail.setTenantId("default"); - return instrumentAccountCodeDetail; - } - - private InstrumentAccountCodeEntity getInstrumentAccountCodeEntity() { - InstrumentAccountCodeEntity entity = new InstrumentAccountCodeEntity(); - entity.setAccountCodeId("accountCodeId"); - entity.setInstrumentTypeId("instrumentTypeId"); - entity.setTenantId("default"); - return entity; - } - - private InstrumentAccountCodeSearch getInstrumentAccountCodeSearch() { - InstrumentAccountCodeSearch instrumentAccountCodeSearch = new InstrumentAccountCodeSearch(); - instrumentAccountCodeSearch.setPageSize(500); - instrumentAccountCodeSearch.setOffset(0); - return instrumentAccountCodeSearch; - - } - - private List getInstrumentAccountCodes() { - List instrumentAccountCodes = new ArrayList(); - InstrumentAccountCode instrumentAccountCode = InstrumentAccountCode.builder() - .instrumentType(InstrumentType.builder().active(true).id("instrumenttypeid").build()) - .accountCode(ChartOfAccountContract.builder().id("accountcodeid").build()).build(); - instrumentAccountCode.setTenantId("default"); - instrumentAccountCodes.add(instrumentAccountCode); - return instrumentAccountCodes; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentRepositoryTest.java deleted file mode 100644 index 232d5a157fe..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentRepositoryTest.java +++ /dev/null @@ -1,330 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.TransactionType; -import org.egov.egf.instrument.persistence.entity.InstrumentEntity; -import org.egov.egf.instrument.persistence.queue.repository.InstrumentQueueRepository; -import org.egov.egf.instrument.persistence.repository.DishonorReasonJdbcRepository; -import org.egov.egf.instrument.persistence.repository.InstrumentJdbcRepository; -import org.egov.egf.instrument.persistence.repository.InstrumentVoucherJdbcRepository; -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.egov.egf.master.web.repository.FinancialConfigurationContractRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentRepositoryTest { - - private InstrumentRepository instrumentRepositoryWithKafka; - - private InstrumentRepository instrumentRepositoryWithOutKafka; - - @Mock - private InstrumentQueueRepository instrumentQueueRepository; - - @Mock - private InstrumentJdbcRepository instrumentJdbcRepository; - - @Mock - private InstrumentVoucherJdbcRepository instrumentVoucherJdbcRepository; - - @Mock - private InstrumentESRepository instrumentESRepository; - - @Mock - private FinancialConfigurationContractRepository financialConfigurationContractRepository; - - @Mock - private DishonorReasonJdbcRepository dishonorReasonJdbcRepository; - - @Captor - private ArgumentCaptor captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - instrumentRepositoryWithKafka = new InstrumentRepository(instrumentJdbcRepository, instrumentQueueRepository, - "yes", instrumentESRepository, financialConfigurationContractRepository, instrumentVoucherJdbcRepository, dishonorReasonJdbcRepository); - - instrumentRepositoryWithOutKafka = new InstrumentRepository(instrumentJdbcRepository, instrumentQueueRepository, - "no", instrumentESRepository, financialConfigurationContractRepository, instrumentVoucherJdbcRepository, dishonorReasonJdbcRepository); - } - - @Test - public void test_find_by_id() { - InstrumentEntity entity = getInstrumentEntity(); - Instrument expectedResult = entity.toDomain(); - - when(instrumentJdbcRepository.findById(any(InstrumentEntity.class))).thenReturn(entity); - - Instrument actualResult = instrumentRepositoryWithKafka.findById(getInstrumentDomin()); - - assertEquals(expectedResult.getAmount(), actualResult.getAmount()); - assertEquals(expectedResult.getTransactionNumber(), actualResult.getTransactionNumber()); - assertEquals(expectedResult.getSerialNo(), actualResult.getSerialNo()); - assertEquals(expectedResult.getTransactionType(), actualResult.getTransactionType()); - assertEquals(expectedResult.getInstrumentType().getId(), actualResult.getInstrumentType().getId()); - } - - @Test - public void test_find_by_id_return_null() { - InstrumentEntity entity = getInstrumentEntity(); - - Mockito.lenient().when(instrumentJdbcRepository.findById(null)).thenReturn(entity); - - Instrument actualResult = instrumentRepositoryWithKafka.findById(getInstrumentDomin()); - - assertEquals(null, actualResult); - } - - @Test - public void test_save_with_kafka() { - - List expectedResult = getInstruments(); - - instrumentRepositoryWithKafka.save(expectedResult, requestInfo); - - verify(instrumentQueueRepository).addToQue(captor.capture()); - - final InstrumentRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getAmount(), actualRequest.getInstruments().get(0).getAmount()); - assertEquals(expectedResult.get(0).getTransactionNumber(), - actualRequest.getInstruments().get(0).getTransactionNumber()); - assertEquals(expectedResult.get(0).getSerialNo(), actualRequest.getInstruments().get(0).getSerialNo()); - assertEquals(expectedResult.get(0).getTransactionType().name(), - actualRequest.getInstruments().get(0).getTransactionType().name()); - assertEquals(expectedResult.get(0).getInstrumentType().getId(), - actualRequest.getInstruments().get(0).getInstrumentType().getId()); - - } - - @Test - public void test_save_with_out_kafka() { - - List expectedResult = getInstruments(); - - InstrumentEntity entity = new InstrumentEntity().toEntity(expectedResult.get(0)); - - when(instrumentJdbcRepository.create(any(InstrumentEntity.class))).thenReturn(entity); - - instrumentRepositoryWithOutKafka.save(expectedResult, requestInfo); - - verify(instrumentQueueRepository).addToSearchQue(captor.capture()); - - final InstrumentRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getAmount(), actualRequest.getInstruments().get(0).getAmount()); - assertEquals(expectedResult.get(0).getTransactionNumber(), - actualRequest.getInstruments().get(0).getTransactionNumber()); - assertEquals(expectedResult.get(0).getSerialNo(), actualRequest.getInstruments().get(0).getSerialNo()); - assertEquals(expectedResult.get(0).getTransactionType().name(), - actualRequest.getInstruments().get(0).getTransactionType().name()); - assertEquals(expectedResult.get(0).getInstrumentType().getId(), - actualRequest.getInstruments().get(0).getInstrumentType().getId()); - } - - @Test - public void test_update_with_kafka() { - - List expectedResult = getInstruments(); - - instrumentRepositoryWithKafka.update(expectedResult, requestInfo); - - verify(instrumentQueueRepository).addToQue(captor.capture()); - - final InstrumentRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getAmount(), actualRequest.getInstruments().get(0).getAmount()); - assertEquals(expectedResult.get(0).getTransactionNumber(), - actualRequest.getInstruments().get(0).getTransactionNumber()); - assertEquals(expectedResult.get(0).getSerialNo(), actualRequest.getInstruments().get(0).getSerialNo()); - assertEquals(expectedResult.get(0).getTransactionType().name(), - actualRequest.getInstruments().get(0).getTransactionType().name()); - assertEquals(expectedResult.get(0).getInstrumentType().getId(), - actualRequest.getInstruments().get(0).getInstrumentType().getId()); - } - - @Test - public void test_delete_with_kafka() { - - List expectedResult = getInstruments(); - - instrumentRepositoryWithKafka.delete(expectedResult, requestInfo); - - verify(instrumentQueueRepository).addToQue(captor.capture()); - - final InstrumentRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getAmount(), actualRequest.getInstruments().get(0).getAmount()); - assertEquals(expectedResult.get(0).getTransactionNumber(), - actualRequest.getInstruments().get(0).getTransactionNumber()); - assertEquals(expectedResult.get(0).getSerialNo(), actualRequest.getInstruments().get(0).getSerialNo()); - assertEquals(expectedResult.get(0).getTransactionType().name(), - actualRequest.getInstruments().get(0).getTransactionType().name()); - assertEquals(expectedResult.get(0).getInstrumentType().getId(), - actualRequest.getInstruments().get(0).getInstrumentType().getId()); - } - - @Test - public void test_update_with_out_kafka() { - - List expectedResult = getInstruments(); - - InstrumentEntity entity = new InstrumentEntity().toEntity(expectedResult.get(0)); - - when(instrumentJdbcRepository.update(any(InstrumentEntity.class))).thenReturn(entity); - - instrumentRepositoryWithOutKafka.update(expectedResult, requestInfo); - - verify(instrumentQueueRepository).addToSearchQue(captor.capture()); - - final InstrumentRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getAmount(), actualRequest.getInstruments().get(0).getAmount()); - assertEquals(expectedResult.get(0).getTransactionNumber(), - actualRequest.getInstruments().get(0).getTransactionNumber()); - assertEquals(expectedResult.get(0).getSerialNo(), actualRequest.getInstruments().get(0).getSerialNo()); - assertEquals(expectedResult.get(0).getTransactionType().name(), - actualRequest.getInstruments().get(0).getTransactionType().name()); - assertEquals(expectedResult.get(0).getInstrumentType().getId(), - actualRequest.getInstruments().get(0).getInstrumentType().getId()); - } - - @Test - public void test_delete_with_out_kafka() { - - List expectedResult = getInstruments(); - - InstrumentEntity entity = new InstrumentEntity().toEntity(expectedResult.get(0)); - - when(instrumentJdbcRepository.delete(any(InstrumentEntity.class))).thenReturn(entity); - - instrumentRepositoryWithOutKafka.delete(expectedResult, requestInfo); - - verify(instrumentQueueRepository).addToSearchQue(captor.capture()); - - final InstrumentRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getAmount(), actualRequest.getInstruments().get(0).getAmount()); - assertEquals(expectedResult.get(0).getTransactionNumber(), - actualRequest.getInstruments().get(0).getTransactionNumber()); - assertEquals(expectedResult.get(0).getSerialNo(), actualRequest.getInstruments().get(0).getSerialNo()); - assertEquals(expectedResult.get(0).getTransactionType().name(), - actualRequest.getInstruments().get(0).getTransactionType().name()); - assertEquals(expectedResult.get(0).getInstrumentType().getId(), - actualRequest.getInstruments().get(0).getInstrumentType().getId()); - } - - @Test - public void test_save() { - - InstrumentEntity entity = getInstrumentEntity(); - Instrument expectedResult = entity.toDomain(); - - when(instrumentJdbcRepository.create(any(InstrumentEntity.class))).thenReturn(entity); - - Instrument actualResult = instrumentRepositoryWithKafka.save(getInstrumentDomin()); - - assertEquals(expectedResult.getAmount(), actualResult.getAmount()); - assertEquals(expectedResult.getTransactionNumber(), actualResult.getTransactionNumber()); - assertEquals(expectedResult.getSerialNo(), actualResult.getSerialNo()); - assertEquals(expectedResult.getTransactionType(), actualResult.getTransactionType()); - assertEquals(expectedResult.getInstrumentType().getId(), actualResult.getInstrumentType().getId()); - - } - - @Test - public void test_update() { - - InstrumentEntity entity = getInstrumentEntity(); - Instrument expectedResult = entity.toDomain(); - - when(instrumentJdbcRepository.update(any(InstrumentEntity.class))).thenReturn(entity); - - Instrument actualResult = instrumentRepositoryWithKafka.update(getInstrumentDomin()); - - assertEquals(expectedResult.getAmount(), actualResult.getAmount()); - assertEquals(expectedResult.getTransactionNumber(), actualResult.getTransactionNumber()); - assertEquals(expectedResult.getSerialNo(), actualResult.getSerialNo()); - assertEquals(expectedResult.getTransactionType(), actualResult.getTransactionType()); - assertEquals(expectedResult.getInstrumentType().getId(), actualResult.getInstrumentType().getId()); - } - - @Test - public void test_search() { - - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - - when(financialConfigurationContractRepository.fetchDataFrom()).thenReturn("db"); - when(instrumentJdbcRepository.search(any(InstrumentSearch.class))).thenReturn(expectedResult); - - Pagination actualResult = instrumentRepositoryWithKafka.search(getInstrumentSearch()); - - assertEquals(expectedResult, actualResult); - - } - - private Instrument getInstrumentDomin() { - Instrument instrumentDetail = new Instrument(); - instrumentDetail.setAmount(BigDecimal.ONE); - instrumentDetail.setTransactionNumber("transactionNumber"); - instrumentDetail.setSerialNo("serialNo"); - instrumentDetail.setTransactionType(TransactionType.Credit); - instrumentDetail.setInstrumentType(InstrumentType.builder().id("instrumentTypeId").build()); - instrumentDetail.setTenantId("default"); - return instrumentDetail; - } - - private InstrumentEntity getInstrumentEntity() { - InstrumentEntity entity = new InstrumentEntity(); - entity.setAmount(BigDecimal.ONE); - entity.setTransactionNumber("transactionNumber"); - entity.setSerialNo("serialNo"); - entity.setTransactionType(TransactionType.Credit.name()); - entity.setInstrumentTypeId("instrumentTypeId"); - entity.setTenantId("default"); - return entity; - } - - private InstrumentSearch getInstrumentSearch() { - InstrumentSearch instrumentSearch = new InstrumentSearch(); - instrumentSearch.setPageSize(500); - instrumentSearch.setOffset(0); - return instrumentSearch; - - } - - private List getInstruments() { - List instruments = new ArrayList(); - Instrument instrument = Instrument.builder().transactionNumber("transactionNumber").amount(BigDecimal.ONE) - .transactionType(TransactionType.Credit).serialNo("serialNo") - .instrumentType(InstrumentType.builder().active(true).name("instrumenttype").build()).build(); - instrument.setTenantId("default"); - instruments.add(instrument); - return instruments; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentTypePropertyRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentTypePropertyRepositoryTest.java deleted file mode 100644 index c2c9f4c826e..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentTypePropertyRepositoryTest.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import org.egov.egf.instrument.domain.model.InstrumentTypeProperty; -import org.egov.egf.instrument.domain.model.TransactionType; -import org.egov.egf.instrument.persistence.entity.InstrumentTypePropertyEntity; -import org.egov.egf.instrument.persistence.repository.InstrumentTypePropertyJdbcRepository; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentTypePropertyRepositoryTest { - - @InjectMocks - private InstrumentTypePropertyRepository instrumentTypePropertyRepository; - - @Mock - private InstrumentTypePropertyJdbcRepository instrumentTypePropertyJdbcRepository; - - @Test - public void test_find_by_id() { - InstrumentTypePropertyEntity entity = getInstrumentTypePropertyEntity(); - InstrumentTypeProperty expectedResult = entity.toDomain(); - - when(instrumentTypePropertyJdbcRepository.findById(any(InstrumentTypePropertyEntity.class))).thenReturn(entity); - - InstrumentTypeProperty actualResult = instrumentTypePropertyRepository - .findById(getInstrumentTypePropertyDomin()); - - assertEquals(expectedResult.getTransactionType(), actualResult.getTransactionType()); - assertEquals(expectedResult.getReconciledOncreate(), actualResult.getReconciledOncreate()); - assertEquals(expectedResult.getStatusOnCreate().getId(), actualResult.getStatusOnCreate().getId()); - assertEquals(expectedResult.getStatusOnReconcile().getId(), actualResult.getStatusOnReconcile().getId()); - assertEquals(expectedResult.getStatusOnUpdate().getId(), actualResult.getStatusOnUpdate().getId()); - - } - - @Test - public void test_find_by_id_return_null() { - InstrumentTypePropertyEntity entity = getInstrumentTypePropertyEntity(); - - Mockito.lenient().when(instrumentTypePropertyJdbcRepository.findById(null)).thenReturn(entity); - - InstrumentTypeProperty actualResult = instrumentTypePropertyRepository - .findById(getInstrumentTypePropertyDomin()); - - assertEquals(null, actualResult); - } - - @Test - public void test_save() { - - InstrumentTypePropertyEntity entity = getInstrumentTypePropertyEntity(); - InstrumentTypeProperty expectedResult = entity.toDomain(); - - when(instrumentTypePropertyJdbcRepository.create(any(InstrumentTypePropertyEntity.class))).thenReturn(entity); - - InstrumentTypeProperty actualResult = instrumentTypePropertyRepository.save(getInstrumentTypePropertyDomin()); - - assertEquals(expectedResult.getTransactionType(), actualResult.getTransactionType()); - assertEquals(expectedResult.getReconciledOncreate(), actualResult.getReconciledOncreate()); - assertEquals(expectedResult.getStatusOnCreate().getId(), actualResult.getStatusOnCreate().getId()); - assertEquals(expectedResult.getStatusOnReconcile().getId(), actualResult.getStatusOnReconcile().getId()); - assertEquals(expectedResult.getStatusOnUpdate().getId(), actualResult.getStatusOnUpdate().getId()); - - } - - @Test - public void test_update() { - - InstrumentTypePropertyEntity entity = getInstrumentTypePropertyEntity(); - InstrumentTypeProperty expectedResult = entity.toDomain(); - - when(instrumentTypePropertyJdbcRepository.update(any(InstrumentTypePropertyEntity.class))).thenReturn(entity); - - InstrumentTypeProperty actualResult = instrumentTypePropertyRepository.update(getInstrumentTypePropertyDomin()); - - assertEquals(expectedResult.getTransactionType(), actualResult.getTransactionType()); - assertEquals(expectedResult.getReconciledOncreate(), actualResult.getReconciledOncreate()); - assertEquals(expectedResult.getStatusOnCreate().getId(), actualResult.getStatusOnCreate().getId()); - assertEquals(expectedResult.getStatusOnReconcile().getId(), actualResult.getStatusOnReconcile().getId()); - assertEquals(expectedResult.getStatusOnUpdate().getId(), actualResult.getStatusOnUpdate().getId()); - } - - private InstrumentTypeProperty getInstrumentTypePropertyDomin() { - InstrumentTypeProperty instrumentTypePropertyDetail = new InstrumentTypeProperty(); - instrumentTypePropertyDetail.setTransactionType(TransactionType.Credit); - instrumentTypePropertyDetail.setReconciledOncreate(true); - instrumentTypePropertyDetail.setStatusOnCreate(FinancialStatusContract.builder().id("statusId").build()); - instrumentTypePropertyDetail.setStatusOnReconcile(FinancialStatusContract.builder().id("statusId").build()); - instrumentTypePropertyDetail.setStatusOnUpdate(FinancialStatusContract.builder().id("statusId").build()); - instrumentTypePropertyDetail.setTenantId("default"); - return instrumentTypePropertyDetail; - } - - private InstrumentTypePropertyEntity getInstrumentTypePropertyEntity() { - InstrumentTypePropertyEntity entity = new InstrumentTypePropertyEntity(); - entity.setTransactionType(TransactionType.Credit.name()); - entity.setReconciledOncreate(true); - entity.setStatusOnCreateId("statusId"); - entity.setStatusOnReconcileId("statusId"); - entity.setStatusOnUpdateId("statusId"); - entity.setTenantId("default"); - return entity; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentTypeRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentTypeRepositoryTest.java deleted file mode 100644 index 1675199a69d..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentTypeRepositoryTest.java +++ /dev/null @@ -1,292 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.persistence.entity.InstrumentTypeEntity; -import org.egov.egf.instrument.persistence.queue.repository.InstrumentTypeQueueRepository; -import org.egov.egf.instrument.persistence.repository.InstrumentTypeJdbcRepository; -import org.egov.egf.instrument.web.requests.InstrumentTypeRequest; -import org.egov.egf.master.web.repository.FinancialConfigurationContractRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentTypeRepositoryTest { - - @Mock - private InstrumentTypeJdbcRepository instrumentTypeJdbcRepository; - - private InstrumentTypeRepository instrumentTypeRepositoryWithKafka; - - private InstrumentTypeRepository instrumentTypeRepositoryWithOutKafka; - - @Mock - private InstrumentTypeQueueRepository instrumentTypeQueueRepository; - - @Mock - private FinancialConfigurationContractRepository financialConfigurationContractRepository; - - @Captor - private ArgumentCaptor captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Mock - private InstrumentTypeESRepository instrumentTypeESRepository; - - @Before - public void setup() { - instrumentTypeRepositoryWithKafka = new InstrumentTypeRepository(instrumentTypeJdbcRepository, - instrumentTypeQueueRepository, "yes", financialConfigurationContractRepository, instrumentTypeESRepository); - - instrumentTypeRepositoryWithOutKafka = new InstrumentTypeRepository(instrumentTypeJdbcRepository, - instrumentTypeQueueRepository, "no", financialConfigurationContractRepository, instrumentTypeESRepository); - } - - @Test - public void test_find_by_id() { - InstrumentTypeEntity entity = getInstrumentTypeEntity(); - InstrumentType expectedResult = entity.toDomain(); - - when(instrumentTypeJdbcRepository.findById(any(InstrumentTypeEntity.class))).thenReturn(entity); - - InstrumentType actualResult = instrumentTypeRepositoryWithKafka.findById(getInstrumentTypeDomin()); - - assertEquals(expectedResult.getActive(), actualResult.getActive()); - assertEquals(expectedResult.getName(), actualResult.getName()); - assertEquals(expectedResult.getDescription(), actualResult.getDescription()); - assertEquals(expectedResult.getTenantId(), actualResult.getTenantId()); - } - - @Test - public void test_find_by_id_return_null() { - InstrumentTypeEntity entity = getInstrumentTypeEntity(); - - Mockito.lenient().when(instrumentTypeJdbcRepository.findById(null)).thenReturn(entity); - - InstrumentType actualResult = instrumentTypeRepositoryWithKafka.findById(getInstrumentTypeDomin()); - - assertEquals(null, actualResult); - } - - @Test - public void test_save_with_kafka() { - - List expectedResult = getInstrumentTypes(); - - instrumentTypeRepositoryWithKafka.save(expectedResult, requestInfo); - - verify(instrumentTypeQueueRepository).addToQue(captor.capture()); - - final InstrumentTypeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getActive(), actualRequest.getInstrumentTypes().get(0).getActive()); - assertEquals(expectedResult.get(0).getName(), actualRequest.getInstrumentTypes().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getInstrumentTypes().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getInstrumentTypes().get(0).getTenantId()); - - } - - @Test - public void test_save_with_out_kafka() { - - List expectedResult = getInstrumentTypes(); - - InstrumentTypeEntity entity = new InstrumentTypeEntity().toEntity(expectedResult.get(0)); - - when(instrumentTypeJdbcRepository.create(any(InstrumentTypeEntity.class))).thenReturn(entity); - - instrumentTypeRepositoryWithOutKafka.save(expectedResult, requestInfo); - - verify(instrumentTypeQueueRepository).addToSearchQue(captor.capture()); - - final InstrumentTypeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getActive(), actualRequest.getInstrumentTypes().get(0).getActive()); - assertEquals(expectedResult.get(0).getName(), actualRequest.getInstrumentTypes().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getInstrumentTypes().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getInstrumentTypes().get(0).getTenantId()); - } - - @Test - public void test_update_with_kafka() { - - List expectedResult = getInstrumentTypes(); - - instrumentTypeRepositoryWithKafka.update(expectedResult, requestInfo); - - verify(instrumentTypeQueueRepository).addToQue(captor.capture()); - - final InstrumentTypeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getActive(), actualRequest.getInstrumentTypes().get(0).getActive()); - assertEquals(expectedResult.get(0).getName(), actualRequest.getInstrumentTypes().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getInstrumentTypes().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getInstrumentTypes().get(0).getTenantId()); - } - - @Test - public void test_delete_with_kafka() { - - List expectedResult = getInstrumentTypes(); - - instrumentTypeRepositoryWithKafka.delete(expectedResult, requestInfo); - - verify(instrumentTypeQueueRepository).addToQue(captor.capture()); - - final InstrumentTypeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getActive(), actualRequest.getInstrumentTypes().get(0).getActive()); - assertEquals(expectedResult.get(0).getName(), actualRequest.getInstrumentTypes().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getInstrumentTypes().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getInstrumentTypes().get(0).getTenantId()); - } - - @Test - public void test_update_with_out_kafka() { - - List expectedResult = getInstrumentTypes(); - - InstrumentTypeEntity entity = new InstrumentTypeEntity().toEntity(expectedResult.get(0)); - - when(instrumentTypeJdbcRepository.update(any(InstrumentTypeEntity.class))).thenReturn(entity); - - instrumentTypeRepositoryWithOutKafka.update(expectedResult, requestInfo); - - verify(instrumentTypeQueueRepository).addToSearchQue(captor.capture()); - - final InstrumentTypeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getActive(), actualRequest.getInstrumentTypes().get(0).getActive()); - assertEquals(expectedResult.get(0).getName(), actualRequest.getInstrumentTypes().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getInstrumentTypes().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getInstrumentTypes().get(0).getTenantId()); - } - - @Test - public void test_delete_with_out_kafka() { - - List expectedResult = getInstrumentTypes(); - - InstrumentTypeEntity entity = new InstrumentTypeEntity().toEntity(expectedResult.get(0)); - - when(instrumentTypeJdbcRepository.delete(any(InstrumentTypeEntity.class))).thenReturn(entity); - - instrumentTypeRepositoryWithOutKafka.delete(expectedResult, requestInfo); - - verify(instrumentTypeQueueRepository).addToSearchQue(captor.capture()); - - final InstrumentTypeRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getActive(), actualRequest.getInstrumentTypes().get(0).getActive()); - assertEquals(expectedResult.get(0).getName(), actualRequest.getInstrumentTypes().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getInstrumentTypes().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getInstrumentTypes().get(0).getTenantId()); - } - - @Test - public void test_save() { - - InstrumentTypeEntity entity = getInstrumentTypeEntity(); - InstrumentType expectedResult = entity.toDomain(); - - when(instrumentTypeJdbcRepository.create(any(InstrumentTypeEntity.class))).thenReturn(entity); - - InstrumentType actualResult = instrumentTypeRepositoryWithKafka.save(getInstrumentTypeDomin()); - - assertEquals(expectedResult.getActive(), actualResult.getActive()); - assertEquals(expectedResult.getName(), actualResult.getName()); - assertEquals(expectedResult.getDescription(), actualResult.getDescription()); - assertEquals(expectedResult.getTenantId(), actualResult.getTenantId()); - - } - - @Test - public void test_update() { - - InstrumentTypeEntity entity = getInstrumentTypeEntity(); - InstrumentType expectedResult = entity.toDomain(); - - when(instrumentTypeJdbcRepository.update(any(InstrumentTypeEntity.class))).thenReturn(entity); - - InstrumentType actualResult = instrumentTypeRepositoryWithKafka.update(getInstrumentTypeDomin()); - - assertEquals(expectedResult.getActive(), actualResult.getActive()); - assertEquals(expectedResult.getName(), actualResult.getName()); - assertEquals(expectedResult.getDescription(), actualResult.getDescription()); - assertEquals(expectedResult.getTenantId(), actualResult.getTenantId()); - } - - @Test - public void test_search() { - - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - - when(financialConfigurationContractRepository.fetchDataFrom()).thenReturn("db"); - when(instrumentTypeJdbcRepository.search(any(InstrumentTypeSearch.class))).thenReturn(expectedResult); - - Pagination actualResult = instrumentTypeRepositoryWithKafka.search(getInstrumentTypeSearch()); - - assertEquals(expectedResult, actualResult); - - } - - private InstrumentType getInstrumentTypeDomin() { - InstrumentType instrumentTypeDetail = new InstrumentType(); - instrumentTypeDetail.setActive(true); - instrumentTypeDetail.setName("name"); - instrumentTypeDetail.setDescription("description"); - instrumentTypeDetail.setTenantId("default"); - return instrumentTypeDetail; - } - - private InstrumentTypeEntity getInstrumentTypeEntity() { - InstrumentTypeEntity entity = new InstrumentTypeEntity(); - entity.setActive(true); - entity.setName("name"); - entity.setDescription("description"); - entity.setTenantId("default"); - return entity; - } - - private InstrumentTypeSearch getInstrumentTypeSearch() { - InstrumentTypeSearch instrumentTypeSearch = new InstrumentTypeSearch(); - instrumentTypeSearch.setPageSize(500); - instrumentTypeSearch.setOffset(0); - return instrumentTypeSearch; - - } - - private List getInstrumentTypes() { - List instrumentTypes = new ArrayList(); - InstrumentType instrumentType = InstrumentType.builder().name("name").description("description").active(true) - .build(); - instrumentType.setTenantId("default"); - instrumentTypes.add(instrumentType); - return instrumentTypes; - } -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentVoucherRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentVoucherRepositoryTest.java deleted file mode 100644 index bd9ac06fe48..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/InstrumentVoucherRepositoryTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentVoucher; -import org.egov.egf.instrument.persistence.entity.InstrumentVoucherEntity; -import org.egov.egf.instrument.persistence.repository.InstrumentVoucherJdbcRepository; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentVoucherRepositoryTest { - - @InjectMocks - private InstrumentVoucherRepository instrumentVoucherRepository; - - @Mock - private InstrumentVoucherJdbcRepository instrumentVoucherJdbcRepository; - - @Test - public void test_find_by_id() { - InstrumentVoucherEntity entity = getInstrumentVoucherEntity(); - InstrumentVoucher expectedResult = entity.toDomain(); - - when(instrumentVoucherJdbcRepository.findById(any(InstrumentVoucherEntity.class))).thenReturn(entity); - - InstrumentVoucher actualResult = instrumentVoucherRepository.findById(getInstrumentVoucherDomin()); - - assertEquals(expectedResult.getVoucherHeaderId(), actualResult.getVoucherHeaderId()); - assertEquals(expectedResult.getInstrument().getId(), actualResult.getInstrument().getId()); - } - - @Test - public void test_find_by_id_return_null() { - InstrumentVoucherEntity entity = getInstrumentVoucherEntity(); - - Mockito.lenient().when(instrumentVoucherJdbcRepository.findById(null)).thenReturn(entity); - - InstrumentVoucher actualResult = instrumentVoucherRepository.findById(getInstrumentVoucherDomin()); - - assertEquals(null, actualResult); - } - - @Test - public void test_save() { - - InstrumentVoucherEntity entity = getInstrumentVoucherEntity(); - InstrumentVoucher expectedResult = entity.toDomain(); - - when(instrumentVoucherJdbcRepository.create(any(InstrumentVoucherEntity.class))).thenReturn(entity); - - InstrumentVoucher actualResult = instrumentVoucherRepository.save(getInstrumentVoucherDomin()); - - assertEquals(expectedResult.getVoucherHeaderId(), actualResult.getVoucherHeaderId()); - assertEquals(expectedResult.getInstrument().getId(), actualResult.getInstrument().getId()); - - } - - @Test - public void test_update() { - - InstrumentVoucherEntity entity = getInstrumentVoucherEntity(); - InstrumentVoucher expectedResult = entity.toDomain(); - - when(instrumentVoucherJdbcRepository.update(any(InstrumentVoucherEntity.class))).thenReturn(entity); - - InstrumentVoucher actualResult = instrumentVoucherRepository.update(getInstrumentVoucherDomin()); - - assertEquals(expectedResult.getVoucherHeaderId(), actualResult.getVoucherHeaderId()); - assertEquals(expectedResult.getInstrument().getId(), actualResult.getInstrument().getId()); - } - - private InstrumentVoucher getInstrumentVoucherDomin() { - InstrumentVoucher instrumentVoucherDetail = new InstrumentVoucher(); - instrumentVoucherDetail.setVoucherHeaderId("voucherHeaderId"); - instrumentVoucherDetail.setInstrument(Instrument.builder().id("instrumentId").build()); - instrumentVoucherDetail.setTenantId("default"); - return instrumentVoucherDetail; - } - - private InstrumentVoucherEntity getInstrumentVoucherEntity() { - InstrumentVoucherEntity entity = new InstrumentVoucherEntity(); - entity.setVoucherHeaderId("voucherHeaderId"); - entity.setInstrumentId("instrumentId"); - entity.setTenantId("default"); - return entity; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/SurrenderReasonRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/SurrenderReasonRepositoryTest.java deleted file mode 100644 index 4fc07e6f27a..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/repository/SurrenderReasonRepositoryTest.java +++ /dev/null @@ -1,282 +0,0 @@ -package org.egov.egf.instrument.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.persistence.entity.SurrenderReasonEntity; -import org.egov.egf.instrument.persistence.queue.repository.SurrenderReasonQueueRepository; -import org.egov.egf.instrument.persistence.repository.SurrenderReasonJdbcRepository; -import org.egov.egf.instrument.web.requests.SurrenderReasonRequest; -import org.egov.egf.master.web.repository.FinancialConfigurationContractRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class SurrenderReasonRepositoryTest { - - @Mock - private SurrenderReasonJdbcRepository surrenderReasonJdbcRepository; - - private SurrenderReasonRepository surrenderReasonRepositoryWithKafka; - - private SurrenderReasonRepository surrenderReasonRepositoryWithOutKafka; - - @Mock - private SurrenderReasonQueueRepository surrenderReasonQueueRepository; - - @Captor - private ArgumentCaptor captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Mock - private FinancialConfigurationContractRepository financialConfigurationContractRepository; - - @Mock - private SurrenderReasonESRepository surrenderReasonESRepository; - - @Before - public void setup() { - surrenderReasonRepositoryWithKafka = new SurrenderReasonRepository(surrenderReasonJdbcRepository, - surrenderReasonQueueRepository, "yes", financialConfigurationContractRepository, surrenderReasonESRepository); - - surrenderReasonRepositoryWithOutKafka = new SurrenderReasonRepository(surrenderReasonJdbcRepository, - surrenderReasonQueueRepository, "no", financialConfigurationContractRepository, surrenderReasonESRepository); - } - - @Test - public void test_find_by_id() { - SurrenderReasonEntity entity = getSurrenderReasonEntity(); - SurrenderReason expectedResult = entity.toDomain(); - - when(surrenderReasonJdbcRepository.findById(any(SurrenderReasonEntity.class))).thenReturn(entity); - - SurrenderReason actualResult = surrenderReasonRepositoryWithKafka.findById(getSurrenderReasonDomin()); - - assertEquals(expectedResult.getName(), actualResult.getName()); - assertEquals(expectedResult.getDescription(), actualResult.getDescription()); - assertEquals(expectedResult.getTenantId(), actualResult.getTenantId()); - } - - @Test - public void test_find_by_id_return_null() { - SurrenderReasonEntity entity = getSurrenderReasonEntity(); - - Mockito.lenient().when(surrenderReasonJdbcRepository.findById(null)).thenReturn(entity); - - SurrenderReason actualResult = surrenderReasonRepositoryWithKafka.findById(getSurrenderReasonDomin()); - - assertEquals(null, actualResult); - } - - @Test - public void test_save_with_kafka() { - - List expectedResult = getSurrenderReasons(); - - surrenderReasonRepositoryWithKafka.save(expectedResult, requestInfo); - - verify(surrenderReasonQueueRepository).addToQue(captor.capture()); - - final SurrenderReasonRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getName(), actualRequest.getSurrenderReasons().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getSurrenderReasons().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getSurrenderReasons().get(0).getTenantId()); - - } - - @Test - public void test_save_with_out_kafka() { - - List expectedResult = getSurrenderReasons(); - - SurrenderReasonEntity entity = new SurrenderReasonEntity().toEntity(expectedResult.get(0)); - - when(surrenderReasonJdbcRepository.create(any(SurrenderReasonEntity.class))).thenReturn(entity); - - surrenderReasonRepositoryWithOutKafka.save(expectedResult, requestInfo); - - verify(surrenderReasonQueueRepository).addToSearchQue(captor.capture()); - - final SurrenderReasonRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getName(), actualRequest.getSurrenderReasons().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getSurrenderReasons().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getSurrenderReasons().get(0).getTenantId()); - } - - @Test - public void test_update_with_kafka() { - - List expectedResult = getSurrenderReasons(); - - surrenderReasonRepositoryWithKafka.update(expectedResult, requestInfo); - - verify(surrenderReasonQueueRepository).addToQue(captor.capture()); - - final SurrenderReasonRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getName(), actualRequest.getSurrenderReasons().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getSurrenderReasons().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getSurrenderReasons().get(0).getTenantId()); - } - - @Test - public void test_delete_with_kafka() { - - List expectedResult = getSurrenderReasons(); - - surrenderReasonRepositoryWithKafka.delete(expectedResult, requestInfo); - - verify(surrenderReasonQueueRepository).addToQue(captor.capture()); - - final SurrenderReasonRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getName(), actualRequest.getSurrenderReasons().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getSurrenderReasons().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getSurrenderReasons().get(0).getTenantId()); - } - - @Test - public void test_update_with_out_kafka() { - - List expectedResult = getSurrenderReasons(); - - SurrenderReasonEntity entity = new SurrenderReasonEntity().toEntity(expectedResult.get(0)); - - when(surrenderReasonJdbcRepository.update(any(SurrenderReasonEntity.class))).thenReturn(entity); - - surrenderReasonRepositoryWithOutKafka.update(expectedResult, requestInfo); - - verify(surrenderReasonQueueRepository).addToSearchQue(captor.capture()); - - final SurrenderReasonRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getName(), actualRequest.getSurrenderReasons().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getSurrenderReasons().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getSurrenderReasons().get(0).getTenantId()); - } - - @Test - public void test_delete_with_out_kafka() { - - List expectedResult = getSurrenderReasons(); - - SurrenderReasonEntity entity = new SurrenderReasonEntity().toEntity(expectedResult.get(0)); - - when(surrenderReasonJdbcRepository.delete(any(SurrenderReasonEntity.class))).thenReturn(entity); - - surrenderReasonRepositoryWithOutKafka.delete(expectedResult, requestInfo); - - verify(surrenderReasonQueueRepository).addToSearchQue(captor.capture()); - - final SurrenderReasonRequest actualRequest = captor.getValue(); - - assertEquals(expectedResult.get(0).getName(), actualRequest.getSurrenderReasons().get(0).getName()); - assertEquals(expectedResult.get(0).getDescription(), - actualRequest.getSurrenderReasons().get(0).getDescription()); - assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getSurrenderReasons().get(0).getTenantId()); - } - - @Test - public void test_save() { - - SurrenderReasonEntity entity = getSurrenderReasonEntity(); - SurrenderReason expectedResult = entity.toDomain(); - - when(surrenderReasonJdbcRepository.create(any(SurrenderReasonEntity.class))).thenReturn(entity); - - SurrenderReason actualResult = surrenderReasonRepositoryWithKafka.save(getSurrenderReasonDomin()); - - assertEquals(expectedResult.getName(), actualResult.getName()); - assertEquals(expectedResult.getDescription(), actualResult.getDescription()); - assertEquals(expectedResult.getTenantId(), actualResult.getTenantId()); - - } - - @Test - public void test_update() { - - SurrenderReasonEntity entity = getSurrenderReasonEntity(); - SurrenderReason expectedResult = entity.toDomain(); - - when(surrenderReasonJdbcRepository.update(any(SurrenderReasonEntity.class))).thenReturn(entity); - - SurrenderReason actualResult = surrenderReasonRepositoryWithKafka.update(getSurrenderReasonDomin()); - - assertEquals(expectedResult.getName(), actualResult.getName()); - assertEquals(expectedResult.getDescription(), actualResult.getDescription()); - assertEquals(expectedResult.getTenantId(), actualResult.getTenantId()); - } - - @Test - public void test_search() { - - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - - when(financialConfigurationContractRepository.fetchDataFrom()).thenReturn("db"); - when(surrenderReasonJdbcRepository.search(any(SurrenderReasonSearch.class))).thenReturn(expectedResult); - - Pagination actualResult = surrenderReasonRepositoryWithKafka - .search(getSurrenderReasonSearch()); - - assertEquals(expectedResult, actualResult); - - } - - private SurrenderReason getSurrenderReasonDomin() { - SurrenderReason surrenderReasonDetail = new SurrenderReason(); - surrenderReasonDetail.setName("name"); - surrenderReasonDetail.setDescription("description"); - surrenderReasonDetail.setTenantId("default"); - return surrenderReasonDetail; - } - - private SurrenderReasonEntity getSurrenderReasonEntity() { - SurrenderReasonEntity entity = new SurrenderReasonEntity(); - entity.setName("name"); - entity.setDescription("description"); - entity.setTenantId("default"); - return entity; - } - - private SurrenderReasonSearch getSurrenderReasonSearch() { - SurrenderReasonSearch surrenderReasonSearch = new SurrenderReasonSearch(); - surrenderReasonSearch.setPageSize(500); - surrenderReasonSearch.setOffset(0); - return surrenderReasonSearch; - - } - - private List getSurrenderReasons() { - List surrenderReasons = new ArrayList(); - SurrenderReason surrenderReason = SurrenderReason.builder().name("name").description("description").build(); - surrenderReason.setTenantId("default"); - surrenderReasons.add(surrenderReason); - return surrenderReasons; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/InstrumentAccountCodeServiceTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/InstrumentAccountCodeServiceTest.java deleted file mode 100644 index 4dc1f6bd0ee..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/InstrumentAccountCodeServiceTest.java +++ /dev/null @@ -1,340 +0,0 @@ -package org.egov.egf.instrument.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.TestConfiguration; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.repository.InstrumentAccountCodeRepository; -import org.egov.egf.instrument.domain.repository.InstrumentTypeRepository; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.egov.egf.master.web.repository.ChartOfAccountContractRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Matchers; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class InstrumentAccountCodeServiceTest { - - private InstrumentAccountCodeService instrumentAccountCodeService; - - @Mock - private InstrumentAccountCodeRepository instrumentAccountCodeRepository; - - @Mock - private SmartValidator validator; - - @Mock - private ChartOfAccountContractRepository chartOfAccountContractRepository; - - @Mock - private InstrumentTypeRepository instrumentTypeRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - instrumentAccountCodeService = new InstrumentAccountCodeService(validator, instrumentAccountCodeRepository, - chartOfAccountContractRepository, instrumentTypeRepository); - } - - @Test - public final void test_create() { - - List expextedResult = getInstrumentAccountCodes(); - - when(instrumentAccountCodeRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - when(instrumentAccountCodeRepository.uniqueCheck(any(String.class), any(InstrumentAccountCode.class))).thenReturn(true); - List actualResult = instrumentAccountCodeService.create(expextedResult, errors, - requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = CustomBindException.class) - public final void test_create_unique_false() { - - List expextedResult = getInstrumentAccountCodes(); - - when(instrumentAccountCodeRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - when(instrumentAccountCodeRepository.uniqueCheck(any(String.class), any(InstrumentAccountCode.class))).thenReturn(false); - List actualResult = instrumentAccountCodeService.create(expextedResult, errors, - requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_create_and_with_null_req() { - - List expextedResult = getInstrumentAccountCodes(); - - when(instrumentAccountCodeRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentAccountCodeService.create(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_update_() { - - List expextedResult = getInstrumentAccountCodes(); - - when(instrumentAccountCodeRepository.update(any(List.class), any(RequestInfo.class))) - .thenReturn(expextedResult); - when(instrumentAccountCodeRepository.uniqueCheck(any(String.class), any(InstrumentAccountCode.class))).thenReturn(true); - List actualResult = instrumentAccountCodeService.update(expextedResult, errors, - requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_update_null_id() { - - List expextedResult = getInstrumentAccountCodes(); - expextedResult.get(0).setId(null); - - when(instrumentAccountCodeRepository.update(any(List.class), any(RequestInfo.class))) - .thenReturn(expextedResult); - when(instrumentAccountCodeRepository.uniqueCheck(any(String.class), any(InstrumentAccountCode.class))).thenReturn(true); - List actualResult = instrumentAccountCodeService.update(expextedResult, errors, - requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = CustomBindException.class) - public final void test_update_unique_false() { - - List expextedResult = getInstrumentAccountCodes(); - - when(instrumentAccountCodeRepository.update(any(List.class), any(RequestInfo.class))) - .thenReturn(expextedResult); - when(instrumentAccountCodeRepository.uniqueCheck(any(String.class), any(InstrumentAccountCode.class))).thenReturn(false); - List actualResult = instrumentAccountCodeService.update(expextedResult, errors, - requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_delete_() { - - List expextedResult = getInstrumentAccountCodes(); - - when(instrumentAccountCodeRepository.delete(any(List.class), any(RequestInfo.class))) - .thenReturn(expextedResult); - - List actualResult = instrumentAccountCodeService.delete(expextedResult, errors, - requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_delete_null_req() { - - List expextedResult = getInstrumentAccountCodes(); - - when(instrumentAccountCodeRepository.delete(any(List.class), any(RequestInfo.class))) - .thenReturn(expextedResult); - - List actualResult = instrumentAccountCodeService.delete(null, errors, - requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_delete_null_id() { - - List expextedResult = getInstrumentAccountCodes(); - expextedResult.get(0).setId(null); - - when(instrumentAccountCodeRepository.delete(any(List.class), any(RequestInfo.class))) - .thenReturn(expextedResult); - - List actualResult = instrumentAccountCodeService.delete(expextedResult, errors, - requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_update_with_null_req() { - - List expextedResult = getInstrumentAccountCodes(); - - when(instrumentAccountCodeRepository.update(any(List.class), any(RequestInfo.class))) - .thenReturn(expextedResult); - - List actualResult = instrumentAccountCodeService.update(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_search() { - - List instrumentAccountCodes = getInstrumentAccountCodes(); - InstrumentAccountCodeSearch instrumentAccountCodeSearch = new InstrumentAccountCodeSearch(); - Pagination expextedResult = new Pagination<>(); - - expextedResult.setPagedData(instrumentAccountCodes); - - when(instrumentAccountCodeRepository.search(instrumentAccountCodeSearch)).thenReturn(expextedResult); - - Pagination actualResult = instrumentAccountCodeService - .search(instrumentAccountCodeSearch); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_save() { - - InstrumentAccountCode expextedResult = getInstrumentAccountCodes().get(0); - - when(instrumentAccountCodeRepository.save(any(InstrumentAccountCode.class))).thenReturn(expextedResult); - - InstrumentAccountCode actualResult = instrumentAccountCodeService.save(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_update() { - - InstrumentAccountCode expextedResult = getInstrumentAccountCodes().get(0); - - when(instrumentAccountCodeRepository.update(any(InstrumentAccountCode.class))).thenReturn(expextedResult); - - InstrumentAccountCode actualResult = instrumentAccountCodeService.update(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_delete() { - - InstrumentAccountCode expextedResult = getInstrumentAccountCodes().get(0); - - when(instrumentAccountCodeRepository.delete(any(InstrumentAccountCode.class))).thenReturn(expextedResult); - - InstrumentAccountCode actualResult = instrumentAccountCodeService.delete(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test(expected = InvalidDataException.class) - public final void test_fetch_instrumenttype() { - - List instrumentAccountCodes = getInstrumentAccountCodes(); - - InstrumentType expextedResult = InstrumentType.builder().name("name").description("description").active(true) - .id("1").build(); - - instrumentAccountCodes.get(0).setInstrumentType(expextedResult); - - when(instrumentTypeRepository.findById(any(InstrumentType.class))).thenReturn(expextedResult); - - List actualResult = instrumentAccountCodeService.fetchRelated(instrumentAccountCodes, - new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getInstrumentType()); - } - - @Test - public final void test_fetch_accountcode() { - - List instrumentAccountCodes = getInstrumentAccountCodes(); - - ChartOfAccountContract expextedResult = ChartOfAccountContract.builder().glcode("glcode").id("1").build(); - - instrumentAccountCodes.get(0).setAccountCode(expextedResult); - - when(chartOfAccountContractRepository.findByGlcode(any(ChartOfAccountContract.class), Matchers.anyObject())) - .thenReturn(expextedResult); - - List actualResult = instrumentAccountCodeService.fetchRelated(instrumentAccountCodes, - new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getAccountCode()); - } - - @Test(expected = InvalidDataException.class) - public final void test_fetch_instrumenttype_null() { - - List instrumentAccountCodes = getInstrumentAccountCodes(); - - InstrumentType expextedResult = InstrumentType.builder().name("name").description("description").active(true) - .id("1").build(); - - instrumentAccountCodes.get(0).setInstrumentType(expextedResult); - - when(instrumentTypeRepository.findById(null)).thenReturn(expextedResult); - - List actualResult = instrumentAccountCodeService.fetchRelated(instrumentAccountCodes, - new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getInstrumentType()); - } - - @Test(expected = InvalidDataException.class) - public final void test_fetch_accountcode_null() { - - List instrumentAccountCodes = getInstrumentAccountCodes(); - - ChartOfAccountContract expextedResult = ChartOfAccountContract.builder().glcode("glcode").id("1").build(); - - instrumentAccountCodes.get(0).setAccountCode(expextedResult); - - when(chartOfAccountContractRepository.findByGlcode(null, new RequestInfo())).thenReturn(expextedResult); - - List actualResult = instrumentAccountCodeService.fetchRelated(instrumentAccountCodes, - new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getAccountCode()); - } - - private List getInstrumentAccountCodes() { - List instrumentAccountCodes = new ArrayList(); - InstrumentAccountCode instrumentAccountCode = InstrumentAccountCode.builder().id("1").build(); - instrumentAccountCode.setTenantId("default"); - instrumentAccountCodes.add(instrumentAccountCode); - return instrumentAccountCodes; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/InstrumentServiceTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/InstrumentServiceTest.java deleted file mode 100644 index e565316f8b6..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/InstrumentServiceTest.java +++ /dev/null @@ -1,933 +0,0 @@ -package org.egov.egf.instrument.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.when; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.TestConfiguration; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.repository.InstrumentRepository; -import org.egov.egf.instrument.domain.repository.InstrumentTypeRepository; -import org.egov.egf.instrument.domain.repository.SurrenderReasonRepository; -import org.egov.egf.instrument.web.contract.InstrumentContract; -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.egov.egf.master.web.repository.BankAccountContractRepository; -import org.egov.egf.master.web.repository.BankContractRepository; -import org.egov.egf.master.web.repository.FinancialStatusContractRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Matchers; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class InstrumentServiceTest { - - private InstrumentService instrumentService; - - @Mock - private InstrumentRepository instrumentRepository; - - @Mock - private SmartValidator validator; - - @Mock - private SurrenderReasonRepository surrenderReasonRepository; - - @Mock - private BankContractRepository bankContractRepository; - - @Mock - private FinancialStatusContractRepository financialStatusContractRepository; - - @Mock - private BankAccountContractRepository bankAccountContractRepository; - - @Mock - private InstrumentTypeRepository instrumentTypeRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - instrumentService = new InstrumentService(validator, instrumentRepository, - bankContractRepository, financialStatusContractRepository, bankAccountContractRepository, - instrumentTypeRepository); - } - - @Test - public final void test_create_dd() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("dd"); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("dd"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_create_dd_null_transnumber() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("dd"); - expextedResult.get(0).setTransactionNumber(null); - expextedResult.get(0).setBank(null); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("dd"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(false); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_create_dd_null_bankdetails() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("dd"); - expextedResult.get(0).setBank(null); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("dd"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(false); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_create_cheque() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("cheque"); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("cheque"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), Matchers.anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_create_cheque_null_transnumber() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("cheque"); - expextedResult.get(0).setTransactionNumber(null); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("cheque"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), Matchers.anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_create_cheque_null_bankdetails() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("cheque"); - expextedResult.get(0).setBank(null); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("cheque"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), Matchers.anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_create_cash() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("cash"); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("cash"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_create_cash_zero_amount() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("cash"); - expextedResult.get(0).setAmount(new BigDecimal(0)); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("cash"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - - - @Test(expected = InvalidDataException.class) - public final void test_create_cash_null_transnumber() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("cash"); - expextedResult.get(0).setTransactionNumber(null); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("cash"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), Matchers.anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_create_online() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("online"); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("online"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_create_online_null_transnumber() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("online"); - expextedResult.get(0).setTransactionNumber(null); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("online"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_create_bankchallan() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("bankchallan"); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("bankchallan"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), Matchers.anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_create_bankchallan_null_transnumber() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("bankchallan"); - expextedResult.get(0).setTransactionNumber(null); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("bankchallan"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_create_bankchallan_null_bankdetails() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("bankchallan"); - expextedResult.get(0).setBank(null); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("bankchallan"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_create_bankchallan_null_bankaccountdetails() { - - List expextedResult = getInstruments(); - expextedResult.get(0).getInstrumentType().setName("bankchallan"); - expextedResult.get(0).setBankAccount(null); - - Pagination pit = getInstrumentType(); - pit.getPagedData().get(0).setName("bankchallan"); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(pit); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(getBankContract()); - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(getBankAccountContract()); - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(getFinancialStatusContract()); - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(getSurrenderReason()); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - private SurrenderReason getSurrenderReason() { - return SurrenderReason.builder().name("name").description("description").id("1") - .build(); - } - - private BankAccountContract getBankAccountContract() { - return BankAccountContract.builder().accountNumber("accountNumber") - .description("description").active(true).id("1").build(); - } - - private BankContract getBankContract() { - return BankContract.builder().code("code").description("description").active(true) - .id("1").build(); - } - - private Pagination getInstrumentType() { - Pagination page = new Pagination<>(); - page.setPagedData(getInstrumentTypes()); - return page; - } - - @Test(expected = InvalidDataException.class) - public final void test_save_with_null_req() { - - List expextedResult = getInstruments(); - - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(false); - when(instrumentRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.create(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_update_() { - - List expextedResult = getInstrumentss(); - expextedResult.get(0).setId("1"); - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - when(instrumentRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.update(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_update_null_id() { - - List expextedResult = getInstruments(); - expextedResult.get(0).setId(null); - - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - when(instrumentRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.update(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_delete_() { - - List expextedResult = getInstruments(); - - expextedResult.get(0).setId("1"); - - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - when(instrumentRepository.delete(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.delete(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_delete_null_id() { - - List expextedResult = getInstruments(); - expextedResult.get(0).setId(null); - - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - when(instrumentRepository.delete(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.delete(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_update_with_null_req() { - - List expextedResult = getInstruments(); - - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - when(instrumentRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.update(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_update_without_id() { - - List expextedResult = getInstruments(); - expextedResult.get(0).setId(null); - - when(instrumentRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.update(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_delete_with_null_req() { - - List expextedResult = getInstruments(); - - when(instrumentRepository.uniqueCheck(any(String.class), any(Instrument.class))).thenReturn(true); - when(instrumentRepository.delete(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.delete(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_search() { - - List instruments = getInstruments(); - InstrumentSearch instrumentSearch = new InstrumentSearch(); - Pagination expextedResult = new Pagination<>(); - - expextedResult.setPagedData(instruments); - - when(instrumentRepository.search(instrumentSearch)).thenReturn(expextedResult); - - Pagination actualResult = instrumentService.search(instrumentSearch); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_save() { - - Instrument expextedResult = getInstruments().get(0); - - when(instrumentRepository.save(any(Instrument.class))).thenReturn(expextedResult); - - Instrument actualResult = instrumentService.save(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_update() { - - Instrument expextedResult = getInstruments().get(0); - - when(instrumentRepository.update(any(Instrument.class))).thenReturn(expextedResult); - - Instrument actualResult = instrumentService.update(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_delete() { - - Instrument expextedResult = getInstruments().get(0); - - when(instrumentRepository.delete(any(Instrument.class))).thenReturn(expextedResult); - - Instrument actualResult = instrumentService.delete(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_fetch_instrumenttype() { - - List instruments = getInstrumentss(); - Pagination expextedResult = new Pagination<>(); - InstrumentType it = InstrumentType.builder().name("name").description("description").active(true).id("1") - .build(); - expextedResult.setPagedData(new ArrayList<>()); - expextedResult.getPagedData().add(it); - instruments.get(0).setInstrumentType(it); - - when(instrumentTypeRepository.search(any(InstrumentTypeSearch.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult.getPagedData().get(0), actualResult.get(0).getInstrumentType()); - } - - @Test - public final void test_fetch_bank() { - - List instruments = getInstrumentss(); - - BankContract expextedResult = BankContract.builder().id("id").description("description").active(true) - .id("1").build(); - - instruments.get(0).setBank(expextedResult); - - when(bankContractRepository.findById(any(BankContract.class), anyObject())).thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getBank()); - } - - @Test - public final void test_fetch_bankaccount() { - - List instruments = getInstrumentss(); - - BankAccountContract expextedResult = BankAccountContract.builder().accountNumber("accountNumber") - .description("description").active(true).id("1").build(); - - instruments.get(0).setBankAccount(expextedResult); - - when(bankAccountContractRepository.findByAccountNumber(any(BankAccountContract.class), anyObject())) - .thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getBankAccount()); - } - - @Test - public final void test_fetch_financialstatus() { - - List instruments = getInstrumentss(); - - FinancialStatusContract expextedResult = FinancialStatusContract.builder().name("name") - .description("description").id("1").build(); - - instruments.get(0).setFinancialStatus(expextedResult); - - when(financialStatusContractRepository.findById(any(FinancialStatusContract.class), Matchers.anyObject())) - .thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getFinancialStatus()); - } - - @Test - public final void test_fetch_surrenderreason() { - - List instruments = getInstrumentss(); - - SurrenderReason expextedResult = SurrenderReason.builder().name("name").description("description").id("1") - .build(); - - instruments.get(0).setSurrenderReason(expextedResult); - - when(surrenderReasonRepository.findById(any(SurrenderReason.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getSurrenderReason()); - } - - @Test(expected = InvalidDataException.class) - public final void test_fetch_instrumenttype_null() { - - List instruments = getInstrumentss(); - Pagination expextedResult = new Pagination<>(); - InstrumentType it = InstrumentType.builder().name("name").description("description").active(true).id("1") - .build(); - expextedResult.setPagedData(new ArrayList<>()); - expextedResult.getPagedData().add(it); - instruments.get(0).setInstrumentType(it); - - when(instrumentTypeRepository.search(null)).thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult.getPagedData().get(0), actualResult.get(0).getInstrumentType()); - - } - - /* @Test(expected = InvalidDataException.class) - public final void test_fetch_bank_null() { - - List instruments = getInstrumentss(); - - BankContract expextedResult = BankContract.builder().name("name").description("description").id("1").build(); - - instruments.get(0).setBank(expextedResult); - - when(bankContractRepository.findById(null, new RequestInfo())).thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getBank()); - }*/ - - /* @Test(expected = InvalidDataException.class) - public final void test_fetch_bankaccount_null() { - - List instruments = getInstrumentss(); - - BankAccountContract expextedResult = BankAccountContract.builder().accountNumber("accountNumber") - .description("description").id("1").build(); - - instruments.get(0).setBankAccount(expextedResult); - - when(bankAccountContractRepository.findByAccountNumber(null, null)).thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getBankAccount()); - }*/ - @Test - public final void test_fetch_financialstatus_null() { - - List instruments = getInstrumentss(); - - FinancialStatusContract expextedResult = FinancialStatusContract.builder().name("name") - .description("description").id("1").build(); - - instruments.get(0).setFinancialStatus(expextedResult); - - when(financialStatusContractRepository.findById(null, new RequestInfo())).thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getFinancialStatus()); - } - - @Test - public final void test_fetch_surrenderreason_null() { - - List instruments = getInstrumentss(); - - SurrenderReason expextedResult = SurrenderReason.builder().name("name").description("description").id("1").build(); - - instruments.get(0).setSurrenderReason(expextedResult); - - when(surrenderReasonRepository.findById(null)).thenReturn(expextedResult); - - List actualResult = instrumentService.fetchRelated(instruments, new RequestInfo()); - - assertEquals(expextedResult, actualResult.get(0).getSurrenderReason()); - } - - @Test - public final void test_deposit() { - - List expextedResult = getInstruments(); - - when(instrumentRepository.findById(any(Instrument.class))).thenReturn(getInstruments().get(0)); - when(financialStatusContractRepository.findByModuleCode(any(FinancialStatusContract.class))) - .thenReturn(getFinancialStatusContract()); - when(instrumentRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.deposit(getInstrumentRequest(), errors, requestInfo); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_dishonor() { - - List expextedResult = getInstruments(); - - when(instrumentRepository.findById(any(Instrument.class))).thenReturn(getInstruments().get(0)); - when(financialStatusContractRepository.findByModuleCode(any(FinancialStatusContract.class))) - .thenReturn(getFinancialStatusContract()); - when(instrumentRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentService.dishonor(getInstrumentRequest(), errors, requestInfo); - - assertEquals(expextedResult, actualResult); - } - - private FinancialStatusContract getFinancialStatusContract() { - return FinancialStatusContract.builder().code("Deposit").moduleType("Instrument").build(); - } - - private InstrumentRequest getInstrumentRequest() { - InstrumentRequest instrumentDepositRequest = new InstrumentRequest(); - instrumentDepositRequest.setInstruments(getInstrumentContracts()); - instrumentDepositRequest.getInstruments().get(0).setId("instrumentDepositId"); - return instrumentDepositRequest; - } - - private List getInstruments() { - List instruments = new ArrayList(); - InstrumentType it = InstrumentType.builder().name("dd").build(); - it.setTenantId("default"); - Instrument instrument = Instrument.builder().amount(BigDecimal.ONE).id("1") - .payee("payee") - .bank(BankContract.builder().code("code").description("description").active(true) - .id("1").build()) - .bankAccount(BankAccountContract.builder().accountNumber("accountNumber") - .description("description").active(true).id("1").build()) - .financialStatus(FinancialStatusContract.builder().name("name") - .description("description").id("1").build()) - .surrenderReason(SurrenderReason.builder().name("name").description("description").id("1") - .build()) - .instrumentType(it) - .transactionNumber("1") - .transactionDate(new Date()).build(); - instrument.setTenantId("default"); - instruments.add(instrument); - return instruments; - } - - private List getInstrumentss() { - List instruments = new ArrayList(); - Instrument instrument = Instrument.builder().build(); - instrument.setTenantId("default"); - instruments.add(instrument); - return instruments; - } - - private List getInstrumentContracts() { - List instrumentContracts = new ArrayList(); - InstrumentContract instrumentContract = InstrumentContract.builder().build(); - instrumentContract.setTenantId("default"); - instrumentContracts.add(instrumentContract); - return instrumentContracts; - } - - private List getInstrumentTypes() { - List lits = new ArrayList<>(); - InstrumentType it = InstrumentType.builder().name("cheque").build(); - it.setTenantId("default"); - lits.add(it); - return lits; - } -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/InstrumentTypeServiceTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/InstrumentTypeServiceTest.java deleted file mode 100644 index ef2be78cc7d..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/InstrumentTypeServiceTest.java +++ /dev/null @@ -1,246 +0,0 @@ -package org.egov.egf.instrument.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.TestConfiguration; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.domain.repository.InstrumentTypeRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class InstrumentTypeServiceTest { - - private InstrumentTypeService instrumentTypeService; - - @Mock - private SmartValidator validator; - - @Mock - private InstrumentTypeRepository instrumentTypeRepository; - - private RequestInfo requestInfo = new RequestInfo(); - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - - @Before - public void setup() { - instrumentTypeService = new InstrumentTypeService(validator, instrumentTypeRepository); - } - - @Test - public final void test_save_with_out_kafka() { - - List expextedResult = getInstrumentTypes(); - - when(instrumentTypeRepository.uniqueCheck(any(String.class), any(InstrumentType.class))).thenReturn(true); - when(instrumentTypeRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = CustomBindException.class) - public final void test_save_with_out_kafka_unique_false() { - - List expextedResult = getInstrumentTypes(); - - when(instrumentTypeRepository.uniqueCheck(any(String.class), any(InstrumentType.class))).thenReturn(false); - when(instrumentTypeRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_save_with_out_kafka_and_with_null_req() { - - List expextedResult = getInstrumentTypes(); - - when(instrumentTypeRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.create(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_update_with_out_kafka() { - - List expextedResult = getInstrumentTypes(); - - when(instrumentTypeRepository.uniqueCheck(any(String.class), any(InstrumentType.class))).thenReturn(true); - when(instrumentTypeRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.update(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_update_with_out_kafka_null_id() { - - List expextedResult = getInstrumentTypes(); - expextedResult.get(0).setId(null); - - when(instrumentTypeRepository.uniqueCheck(any(String.class), any(InstrumentType.class))).thenReturn(true); - when(instrumentTypeRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.update(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = CustomBindException.class) - public final void test_update_with_out_kafka_unique_false() { - - List expextedResult = getInstrumentTypes(); - - when(instrumentTypeRepository.uniqueCheck(any(String.class), any(InstrumentType.class))).thenReturn(false); - when(instrumentTypeRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.update(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_delete_with_out_kafka() { - - List expextedResult = getInstrumentTypes(); - - when(instrumentTypeRepository.delete(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.delete(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_delete_with_out_kafka_nullrequest() { - - List expextedResult = getInstrumentTypes(); - - when(instrumentTypeRepository.delete(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.delete(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_delete_with_out_kafka_null_id() { - - List expextedResult = getInstrumentTypes(); - expextedResult.get(0).setId(null); - - when(instrumentTypeRepository.delete(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.delete(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_update_with_out_kafka_and_with_null_req() { - - List expextedResult = getInstrumentTypes(); - - when(instrumentTypeRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = instrumentTypeService.update(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_search() { - - List instrumentTypes = getInstrumentTypes(); - InstrumentTypeSearch instrumentTypeSearch = new InstrumentTypeSearch(); - Pagination expextedResult = new Pagination<>(); - - expextedResult.setPagedData(instrumentTypes); - - when(instrumentTypeRepository.search(instrumentTypeSearch)).thenReturn(expextedResult); - - Pagination actualResult = instrumentTypeService.search(instrumentTypeSearch); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_save() { - - InstrumentType expextedResult = getInstrumentTypes().get(0); - - when(instrumentTypeRepository.save(any(InstrumentType.class))).thenReturn(expextedResult); - - InstrumentType actualResult = instrumentTypeService.save(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_update() { - - InstrumentType expextedResult = getInstrumentTypes().get(0); - - when(instrumentTypeRepository.update(any(InstrumentType.class))).thenReturn(expextedResult); - - InstrumentType actualResult = instrumentTypeService.update(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_delete() { - - InstrumentType expextedResult = getInstrumentTypes().get(0); - - when(instrumentTypeRepository.delete(any(InstrumentType.class))).thenReturn(expextedResult); - - InstrumentType actualResult = instrumentTypeService.delete(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - private List getInstrumentTypes() { - List instrumentTypes = new ArrayList(); - InstrumentType instrumentType = InstrumentType.builder().id("1").build(); - instrumentType.setTenantId("default"); - instrumentTypes.add(instrumentType); - return instrumentTypes; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/SurrenderReasonServiceTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/SurrenderReasonServiceTest.java deleted file mode 100644 index 1aaca97633b..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/domain/service/SurrenderReasonServiceTest.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.egov.egf.instrument.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.TestConfiguration; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.domain.repository.SurrenderReasonRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class SurrenderReasonServiceTest { - - private SurrenderReasonService surrenderReasonService; - - @Mock - private SmartValidator validator; - - @Mock - private SurrenderReasonRepository surrenderReasonRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - surrenderReasonService = new SurrenderReasonService(validator, surrenderReasonRepository); - } - - @Test - public final void test_save_with_out_kafka() { - - List expextedResult = getSurrenderReasons(); - - when(surrenderReasonRepository.uniqueCheck(any(String.class), any(SurrenderReason.class))).thenReturn(true); - when(surrenderReasonRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = surrenderReasonService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = CustomBindException.class) - public final void test_save_with_out_kafka_unique_false() { - - List expextedResult = getSurrenderReasons(); - - when(surrenderReasonRepository.uniqueCheck(any(String.class), any(SurrenderReason.class))).thenReturn(false); - when(surrenderReasonRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = surrenderReasonService.create(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_save_with_out_kafka_and_with_null_req() { - - List expextedResult = getSurrenderReasons(); - - when(surrenderReasonRepository.uniqueCheck(any(String.class), any(SurrenderReason.class))).thenReturn(false); - when(surrenderReasonRepository.save(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = surrenderReasonService.create(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_update_with_out_kafka() { - - List expextedResult = getSurrenderReasons(); - - when(surrenderReasonRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - when(surrenderReasonRepository.uniqueCheck(any(String.class), any(SurrenderReason.class))).thenReturn(true); - List actualResult = surrenderReasonService.update(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = CustomBindException.class) - public final void test_update_with_out_kafka_unique_false() { - - List expextedResult = getSurrenderReasons(); - - when(surrenderReasonRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - when(surrenderReasonRepository.uniqueCheck(any(String.class), any(SurrenderReason.class))).thenReturn(false); - List actualResult = surrenderReasonService.update(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_delete_with_out_kafka() { - - List expextedResult = getSurrenderReasons(); - - when(surrenderReasonRepository.delete(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = surrenderReasonService.delete(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_update_with_out_kafka_and_with_null_req() { - - List expextedResult = getSurrenderReasons(); - - when(surrenderReasonRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = surrenderReasonService.update(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_update_without_id() { - - List expextedResult = getSurrenderReasons(); - expextedResult.get(0).setId(null); - - when(surrenderReasonRepository.update(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = surrenderReasonService.update(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test - public final void test_search() { - - List surrenderReasons = getSurrenderReasons(); - SurrenderReasonSearch surrenderReasonSearch = new SurrenderReasonSearch(); - Pagination expextedResult = new Pagination<>(); - - expextedResult.setPagedData(surrenderReasons); - - when(surrenderReasonRepository.search(surrenderReasonSearch)).thenReturn(expextedResult); - - Pagination actualResult = surrenderReasonService.search(surrenderReasonSearch); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_save() { - - SurrenderReason expextedResult = getSurrenderReasons().get(0); - - when(surrenderReasonRepository.save(any(SurrenderReason.class))).thenReturn(expextedResult); - - SurrenderReason actualResult = surrenderReasonService.save(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_update() { - - SurrenderReason expextedResult = getSurrenderReasons().get(0); - - when(surrenderReasonRepository.update(any(SurrenderReason.class))).thenReturn(expextedResult); - - SurrenderReason actualResult = surrenderReasonService.update(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_delete() { - - SurrenderReason expextedResult = getSurrenderReasons().get(0); - - when(surrenderReasonRepository.delete(any(SurrenderReason.class))).thenReturn(expextedResult); - - SurrenderReason actualResult = surrenderReasonService.delete(expextedResult); - - assertEquals(expextedResult, actualResult); - } - - @Test(expected = InvalidDataException.class) - public final void test_delete_with_out_surrenderreasons() { - - List expextedResult = getSurrenderReasons(); - expextedResult.get(0).setId(null); - - when(surrenderReasonRepository.delete(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = surrenderReasonService.delete(null, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - @Test(expected = InvalidDataException.class) - public final void test_delete_with_out_id() { - - List expextedResult = getSurrenderReasons(); - expextedResult.get(0).setId(null); - - when(surrenderReasonRepository.delete(any(List.class), any(RequestInfo.class))).thenReturn(expextedResult); - - List actualResult = surrenderReasonService.delete(expextedResult, errors, requestInfo); - - assertEquals(expextedResult, actualResult); - - } - - private List getSurrenderReasons() { - List surrenderReasons = new ArrayList(); - SurrenderReason surrenderReason = SurrenderReason.builder().id("1").name("name").build(); - surrenderReason.setTenantId("default"); - SurrenderReason surrenderReason1 = SurrenderReason.builder().id("1").name("name").build(); - surrenderReason.setTenantId("default"); - surrenderReasons.add(surrenderReason); - surrenderReasons.add(surrenderReason1); - return surrenderReasons; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/FinancialInstrumentProducerTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/FinancialInstrumentProducerTest.java deleted file mode 100644 index b75709b70cc..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/FinancialInstrumentProducerTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.egf.instrument.persistence.queue; - -import static org.mockito.Mockito.verify; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.egov.tracer.kafka.LogAwareKafkaTemplate; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class FinancialInstrumentProducerTest { - - private static final String TOPIC_NAME = "topic"; - - private static final String KEY_NAME = "key"; - - @Mock - private LogAwareKafkaTemplate kafkaTemplate; - - @InjectMocks - private FinancialInstrumentProducer financialInstrumentProducer; - - @Before - public void setup() { - financialInstrumentProducer = new FinancialInstrumentProducer(kafkaTemplate); - } - - @Test - public void test_send_message() { - - InstrumentRequest request = new InstrumentRequest(); - - Map message = new HashMap<>(); - message.put("instrument_create", request); - - financialInstrumentProducer.sendMessage(TOPIC_NAME, KEY_NAME, message); - - verify(kafkaTemplate).send(TOPIC_NAME, KEY_NAME, message); - - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/ObjectMapperFactoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/ObjectMapperFactoryTest.java deleted file mode 100644 index 05d8dab2844..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/ObjectMapperFactoryTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.egf.instrument.persistence.queue; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.verify; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -@RunWith(MockitoJUnitRunner.class) -public class ObjectMapperFactoryTest { - - @Mock - private ObjectMapper objectMapper; - - private ObjectMapperFactory objectMapperFactory; - - @Before - public void setup() { - objectMapperFactory = new ObjectMapperFactory(objectMapper); - } - - @Test - public void test_create() { - - ObjectMapper actualRequest = objectMapperFactory.create(); - - verify(objectMapper).disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - - assertEquals(objectMapper, actualRequest); - - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentAccountCodeQueueRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentAccountCodeQueueRepositoryTest.java deleted file mode 100644 index 4f75001911f..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentAccountCodeQueueRepositoryTest.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.egov.egf.instrument.persistence.queue.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.instrument.persistence.queue.FinancialInstrumentProducer; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeContract; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.egov.egf.instrument.web.requests.InstrumentAccountCodeRequest; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentAccountCodeQueueRepositoryTest { - - @Mock - private InstrumentAccountCodeQueueRepository instrumentAccountCodeQueueRepository; - - @Mock - private FinancialInstrumentProducer financialInstrumentProducer; - - private static final String TOPIC_NAME = "topic"; - - private static final String KEY_NAME = "key"; - - @Before - public void setup() { - instrumentAccountCodeQueueRepository = new InstrumentAccountCodeQueueRepository(financialInstrumentProducer, - TOPIC_NAME, KEY_NAME, TOPIC_NAME, KEY_NAME); - } - - @Test - public void test_add_to_queue_while_create() { - - InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); - - request.setInstrumentAccountCodes(getInstrumentAccountCodes()); - request.setRequestInfo(new RequestInfo()); - request.getRequestInfo().setAction("create"); - - instrumentAccountCodeQueueRepository.addToQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("instrumentaccountcode_create")); - - } - - @Test - public void test_add_to_queue_while_update() { - - InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); - - request.setInstrumentAccountCodes(getInstrumentAccountCodes()); - request.setRequestInfo(new RequestInfo()); - request.getRequestInfo().setAction("update"); - - instrumentAccountCodeQueueRepository.addToQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("instrumentaccountcode_update")); - - } - - @Test - public void test_add_to_search_queue() { - - InstrumentAccountCodeRequest request = new InstrumentAccountCodeRequest(); - - request.setInstrumentAccountCodes(getInstrumentAccountCodes()); - - instrumentAccountCodeQueueRepository.addToSearchQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("instrumentaccountcode_persisted")); - - } - - private List getInstrumentAccountCodes() { - - List instrumentAccountCodes = new ArrayList(); - InstrumentAccountCodeContract instrumentAccountCode = InstrumentAccountCodeContract.builder() - .instrumentType(InstrumentTypeContract.builder().active(true).name("instrumenttype").build()) - .accountCode(ChartOfAccountContract.builder().glcode("glcode").build()).build(); - instrumentAccountCode.setTenantId("default"); - instrumentAccountCodes.add(instrumentAccountCode); - - return instrumentAccountCodes; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentQueueRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentQueueRepositoryTest.java deleted file mode 100644 index 873540e9a37..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentQueueRepositoryTest.java +++ /dev/null @@ -1,118 +0,0 @@ -package org.egov.egf.instrument.persistence.queue.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.instrument.persistence.queue.FinancialInstrumentProducer; -import org.egov.egf.instrument.web.contract.InstrumentContract; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.egov.egf.instrument.web.contract.TransactionTypeContract; -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentQueueRepositoryTest { - - @Mock - private InstrumentQueueRepository instrumentQueueRepository; - - @Mock - private FinancialInstrumentProducer financialInstrumentProducer; - - private static final String TOPIC_NAME = "topic"; - - private static final String KEY_NAME = "key"; - - @Before - public void setup() { - instrumentQueueRepository = new InstrumentQueueRepository(financialInstrumentProducer, TOPIC_NAME, KEY_NAME, - TOPIC_NAME, KEY_NAME); - } - - @Test - public void test_add_to_queue_while_create() { - - InstrumentRequest request = new InstrumentRequest(); - - request.setInstruments(getInstruments()); - request.setRequestInfo(new RequestInfo()); - request.getRequestInfo().setAction("create"); - - instrumentQueueRepository.addToQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("instrument_create")); - - } - - @Test - public void test_add_to_queue_while_update() { - - InstrumentRequest request = new InstrumentRequest(); - - request.setInstruments(getInstruments()); - request.setRequestInfo(new RequestInfo()); - request.getRequestInfo().setAction("update"); - - instrumentQueueRepository.addToQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("instrument_update")); - - } - - @Test - public void test_add_to_search_queue() { - - InstrumentRequest request = new InstrumentRequest(); - - request.setInstruments(getInstruments()); - - instrumentQueueRepository.addToSearchQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("instrument_persisted")); - - } - - private List getInstruments() { - - List instruments = new ArrayList(); - - InstrumentContract instrument = InstrumentContract.builder().transactionNumber("transactionNumber") - .amount(BigDecimal.ONE).transactionType(TransactionTypeContract.Credit).serialNo("serialNo") - .instrumentType(InstrumentTypeContract.builder().active(true).name("instrumenttype").build()).build(); - instrument.setTenantId("default"); - instruments.add(instrument); - - return instruments; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentTypeQueueRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentTypeQueueRepositoryTest.java deleted file mode 100644 index 39d7fbb0ced..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/InstrumentTypeQueueRepositoryTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.egov.egf.instrument.persistence.queue.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.instrument.persistence.queue.FinancialInstrumentProducer; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.egov.egf.instrument.web.requests.InstrumentTypeRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentTypeQueueRepositoryTest { - - @Mock - private InstrumentTypeQueueRepository instrumentTypeQueueRepository; - - @Mock - private FinancialInstrumentProducer financialInstrumentProducer; - - private static final String TOPIC_NAME = "topic"; - - private static final String KEY_NAME = "key"; - - @Before - public void setup() { - instrumentTypeQueueRepository = new InstrumentTypeQueueRepository(financialInstrumentProducer, TOPIC_NAME, - KEY_NAME, TOPIC_NAME, KEY_NAME); - } - - @Test - public void test_add_to_queue_while_create() { - - InstrumentTypeRequest request = new InstrumentTypeRequest(); - - request.setInstrumentTypes(getInstrumentTypes()); - request.setRequestInfo(new RequestInfo()); - request.getRequestInfo().setAction("create"); - - instrumentTypeQueueRepository.addToQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("instrumenttype_create")); - - } - - @Test - public void test_add_to_queue_while_update() { - - InstrumentTypeRequest request = new InstrumentTypeRequest(); - - request.setInstrumentTypes(getInstrumentTypes()); - request.setRequestInfo(new RequestInfo()); - request.getRequestInfo().setAction("update"); - - instrumentTypeQueueRepository.addToQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("instrumenttype_update")); - - } - - @Test - public void test_add_to_search_queue() { - - InstrumentTypeRequest request = new InstrumentTypeRequest(); - - request.setInstrumentTypes(getInstrumentTypes()); - - instrumentTypeQueueRepository.addToSearchQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("instrumenttype_persisted")); - - } - - private List getInstrumentTypes() { - - List instrumentTypes = new ArrayList(); - - InstrumentTypeContract instrumentType = InstrumentTypeContract.builder().name("name").description("description") - .active(true).build(); - instrumentType.setTenantId("default"); - instrumentTypes.add(instrumentType); - return instrumentTypes; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/SurrenderReasonQueueRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/SurrenderReasonQueueRepositoryTest.java deleted file mode 100644 index d1015d8875d..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/queue/repository/SurrenderReasonQueueRepositoryTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.egov.egf.instrument.persistence.queue.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.instrument.persistence.queue.FinancialInstrumentProducer; -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; -import org.egov.egf.instrument.web.requests.SurrenderReasonRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class SurrenderReasonQueueRepositoryTest { - - @Mock - private SurrenderReasonQueueRepository surrenderReasonQueueRepository; - - @Mock - private FinancialInstrumentProducer financialInstrumentProducer; - - private static final String TOPIC_NAME = "topic"; - - private static final String KEY_NAME = "key"; - - @Before - public void setup() { - surrenderReasonQueueRepository = new SurrenderReasonQueueRepository(financialInstrumentProducer, TOPIC_NAME, - KEY_NAME, TOPIC_NAME, KEY_NAME); - } - - @Test - public void test_add_to_queue_while_create() { - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - - request.setSurrenderReasons(getSurrenderReasons()); - request.setRequestInfo(new RequestInfo()); - request.getRequestInfo().setAction("create"); - - surrenderReasonQueueRepository.addToQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("surrenderreason_create")); - - } - - @Test - public void test_add_to_queue_while_update() { - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - - request.setSurrenderReasons(getSurrenderReasons()); - request.setRequestInfo(new RequestInfo()); - request.getRequestInfo().setAction("update"); - - surrenderReasonQueueRepository.addToQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("surrenderreason_update")); - - } - - @Test - public void test_add_to_search_queue() { - - SurrenderReasonRequest request = new SurrenderReasonRequest(); - - request.setSurrenderReasons(getSurrenderReasons()); - - surrenderReasonQueueRepository.addToSearchQue(request); - - final ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(HashMap.class); - - verify(financialInstrumentProducer).sendMessage(any(String.class), any(String.class), argumentCaptor.capture()); - - final HashMap actualRequest = argumentCaptor.getValue(); - - assertEquals(request, actualRequest.get("surrenderreason_persisted")); - - } - - private List getSurrenderReasons() { - - List surrenderReasons = new ArrayList(); - SurrenderReasonContract surrenderReason = SurrenderReasonContract.builder().name("name") - .description("description").build(); - surrenderReason.setTenantId("default"); - surrenderReasons.add(surrenderReason); - - return surrenderReasons; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentAccountCodeJdbcRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentAccountCodeJdbcRepositoryTest.java deleted file mode 100644 index b85803d777e..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentAccountCodeJdbcRepositoryTest.java +++ /dev/null @@ -1,224 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.persistence.entity.InstrumentAccountCodeEntity; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class InstrumentAccountCodeJdbcRepositoryTest { - - private InstrumentAccountCodeJdbcRepository instrumentAccountCodeJdbcRepository; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Before - public void setUp() throws Exception { - instrumentAccountCodeJdbcRepository = new InstrumentAccountCodeJdbcRepository(namedParameterJdbcTemplate, jdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/instrumentaccountcode/clearInstrumentAccountCode.sql" }) - public void test_create() { - - InstrumentAccountCodeEntity instrumentAccountCode = InstrumentAccountCodeEntity.builder().instrumentTypeId("1") - .accountCodeId("1").build(); - instrumentAccountCode.setTenantId("default"); - InstrumentAccountCodeEntity actualResult = instrumentAccountCodeJdbcRepository.create(instrumentAccountCode); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentAccountCode", - new InstrumentAccountCodeResultExtractor()); - Map row = result.get(0); - assertThat(row.get("instrumentTypeId")).isEqualTo(actualResult.getInstrumentTypeId()); - assertThat(row.get("accountCodeId")).isEqualTo(actualResult.getAccountCodeId()); - - } - - @Test - @Sql(scripts = { "/sql/instrumentaccountcode/clearInstrumentAccountCode.sql", - "/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql" }) - public void test_update() { - - InstrumentAccountCodeEntity instrumentAccountCode = InstrumentAccountCodeEntity.builder().instrumentTypeId("name") - .accountCodeId("glcode").build(); - instrumentAccountCode.setTenantId("default"); - InstrumentAccountCodeEntity actualResult = instrumentAccountCodeJdbcRepository.update(instrumentAccountCode); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentAccountCode", - new InstrumentAccountCodeResultExtractor()); - Map row = result.get(0); - assertThat(row.get("instrumentTypeId")).isEqualTo(actualResult.getInstrumentTypeId()); - assertThat(row.get("accountCodeId")).isEqualTo(actualResult.getAccountCodeId()); - - } - - @Test - @Sql(scripts = { "/sql/instrumentaccountcode/clearInstrumentAccountCode.sql", - "/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql" }) - public void test_delete() { - - InstrumentAccountCodeEntity instrumentAccountCode = InstrumentAccountCodeEntity.builder().id("1").instrumentTypeId("name") - .accountCodeId("glcode").build(); - instrumentAccountCode.setTenantId("default"); - InstrumentAccountCodeEntity actualResult = instrumentAccountCodeJdbcRepository.delete(instrumentAccountCode); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentAccountCode", - new InstrumentAccountCodeResultExtractor()); - assertTrue("Result set length is zero", result.size() == 0); - } - - @Test - @Sql(scripts = { "/sql/instrumentaccountcode/clearInstrumentAccountCode.sql", - "/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql" }) - public void test_search() { - - Pagination page = (Pagination) instrumentAccountCodeJdbcRepository - .search(getInstrumentAccountCodeSearch()); - assertThat(page.getPagedData().get(0).getAccountCode().getGlcode()).isEqualTo("glcode"); - assertThat(page.getPagedData().get(0).getInstrumentType().getName()).isEqualTo("name"); - - } - - @Test - @Sql(scripts = { "/sql/instrumentaccountcode/clearInstrumentAccountCode.sql", - "/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql" }) - public void test_invalid_search() { - - Pagination page = (Pagination) instrumentAccountCodeJdbcRepository - .search(getInstrumentAccountCodeSearch1()); - assertThat(page.getPagedData().size()).isEqualTo(0); - - } - - @Test - @Sql(scripts = { "/sql/instrumentaccountcode/clearInstrumentAccountCode.sql", - "/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql" }) - public void test_find_by_id() { - - InstrumentAccountCodeEntity instrumentAccountCodeEntity = InstrumentAccountCodeEntity.builder().id("1").build(); - instrumentAccountCodeEntity.setTenantId("default"); - InstrumentAccountCodeEntity result = instrumentAccountCodeJdbcRepository.findById(instrumentAccountCodeEntity); - assertThat(result.getAccountCodeId()).isEqualTo("glcode"); - assertThat(result.getInstrumentTypeId()).isEqualTo("name"); - - } - - @Test - @Sql(scripts = { "/sql/instrumentaccountcode/clearInstrumentAccountCode.sql", - "/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - InstrumentAccountCodeEntity instrumentAccountCodeEntity = InstrumentAccountCodeEntity.builder().id("5").build(); - instrumentAccountCodeEntity.setTenantId("default"); - InstrumentAccountCodeEntity result = instrumentAccountCodeJdbcRepository.findById(instrumentAccountCodeEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/instrumentaccountcode/clearInstrumentAccountCode.sql", - "/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql" }) - public void test_search_invalid_sort_option() { - - InstrumentAccountCodeSearch search = getInstrumentAccountCodeSearch(); - search.setSortBy("desc"); - instrumentAccountCodeJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/instrumentaccountcode/clearInstrumentAccountCode.sql", - "/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - InstrumentAccountCodeSearch search = getInstrumentAccountCodeSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) instrumentAccountCodeJdbcRepository - .search(getInstrumentAccountCodeSearch()); - assertThat(page.getPagedData().get(0).getAccountCode().getGlcode()).isEqualTo("glcode"); - assertThat(page.getPagedData().get(0).getInstrumentType().getName()).isEqualTo("name"); - - } - - class InstrumentAccountCodeResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("instrumentTypeId", resultSet.getString("instrumentTypeId")); - put("accountCodeId", resultSet.getString("accountCodeId")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private InstrumentAccountCodeSearch getInstrumentAccountCodeSearch1() { - InstrumentAccountCodeSearch instrumentAccountCodeSearch = new InstrumentAccountCodeSearch(); - instrumentAccountCodeSearch.setId("id"); - instrumentAccountCodeSearch.setInstrumentType(InstrumentType.builder().id("10").build()); - instrumentAccountCodeSearch.setAccountCode(ChartOfAccountContract.builder().id("1").build()); - instrumentAccountCodeSearch.setTenantId("tenantId"); - instrumentAccountCodeSearch.setPageSize(500); - instrumentAccountCodeSearch.setOffset(0); - instrumentAccountCodeSearch.setSortBy("accountCodeId desc"); - return instrumentAccountCodeSearch; - } - - private InstrumentAccountCodeSearch getInstrumentAccountCodeSearch() { - InstrumentAccountCodeSearch instrumentAccountCodeSearch = new InstrumentAccountCodeSearch(); - instrumentAccountCodeSearch.setId("1"); - instrumentAccountCodeSearch.setIds("1"); - instrumentAccountCodeSearch.setInstrumentType(InstrumentType.builder().name("name").build()); - instrumentAccountCodeSearch.setAccountCode(ChartOfAccountContract.builder().glcode("glcode").build()); - instrumentAccountCodeSearch.setPageSize(500); - instrumentAccountCodeSearch.setOffset(0); - instrumentAccountCodeSearch.setSortBy("accountCodeId desc"); - return instrumentAccountCodeSearch; - } -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentJdbcRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentJdbcRepositoryTest.java deleted file mode 100644 index 61288604e6c..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentJdbcRepositoryTest.java +++ /dev/null @@ -1,319 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.math.BigDecimal; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.TransactionType; -import org.egov.egf.instrument.persistence.entity.InstrumentEntity; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class InstrumentJdbcRepositoryTest { - - @Autowired - private InstrumentVoucherJdbcRepository instrumentVoucherJdbcRepository; - - private InstrumentJdbcRepository instrumentJdbcRepository; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private JdbcTemplate jdbcTemplate; - @Autowired - private DishonorReasonJdbcRepository dishonorReasonJdbcRepository; - - @Before - public void setUp() throws Exception { - instrumentJdbcRepository = new InstrumentJdbcRepository(namedParameterJdbcTemplate, jdbcTemplate, - instrumentVoucherJdbcRepository, dishonorReasonJdbcRepository); - } - - @Test - @Sql(scripts = { "/sql/instrument/clearInstrument.sql" }) - public void test_create() { - - InstrumentEntity instrument = InstrumentEntity.builder().id("1").amount(BigDecimal.ONE) - .bankAccountId("accountNumber").bankId("code").branchName("branchName").drawer("drawer") - .financialStatusId("1").instrumentTypeId("name").payee("payee").serialNo("serialNo") - .surrenderReasonId("1").transactionNumber("transactionNumber").transactionDate(new Date()) - .transactionType("Credit").build(); - instrument.setTenantId("default"); - InstrumentEntity actualResult = instrumentJdbcRepository.create(instrument); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrument", - new InstrumentResultExtractor()); - Map row = result.get(0); - - assertThat(row.get("amount").toString()).isEqualTo("1.00"); - assertThat(row.get("bankId")).isEqualTo(actualResult.getBankId()); - assertThat(row.get("bankAccountId")).isEqualTo(actualResult.getBankAccountId()); - assertThat(row.get("branchName")).isEqualTo(actualResult.getBranchName()); - assertThat(row.get("drawer")).isEqualTo(actualResult.getDrawer()); - assertThat(row.get("financialStatusId")).isEqualTo(actualResult.getFinancialStatusId()); - assertThat(row.get("instrumentTypeId")).isEqualTo(actualResult.getInstrumentTypeId()); - assertThat(row.get("payee")).isEqualTo(actualResult.getPayee()); - assertThat(row.get("serialNo")).isEqualTo(actualResult.getSerialNo()); - assertThat(row.get("surrenderReasonId")).isEqualTo(actualResult.getSurrenderReasonId()); - assertThat(row.get("transactionNumber")).isEqualTo(actualResult.getTransactionNumber()); - assertThat(row.get("transactionType")).isEqualTo(actualResult.getTransactionType()); - - } - - @Test - @Sql(scripts = { "/sql/instrument/clearInstrument.sql", "/sql/instrument/insertInstrumentData.sql" }) - public void test_update() { - - InstrumentEntity instrument = InstrumentEntity.builder().id("1").amount(BigDecimal.ONE).bankAccountId("1") - .bankId("1").branchName("branchName").drawer("drawer").financialStatusId("1").instrumentTypeId("1") - .payee("payee").serialNo("serialNo").surrenderReasonId("1").transactionNumber("transactionNumber") - .transactionDate(new Date()).transactionType("Credit").build(); - instrument.setTenantId("default"); - InstrumentEntity actualResult = instrumentJdbcRepository.update(instrument); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrument", - new InstrumentResultExtractor()); - Map row = result.get(0); - - assertThat(row.get("amount").toString()).isEqualTo("1.00"); - assertThat(row.get("bankId")).isEqualTo(actualResult.getBankId()); - assertThat(row.get("bankAccountId")).isEqualTo(actualResult.getBankAccountId()); - assertThat(row.get("branchName")).isEqualTo(actualResult.getBranchName()); - assertThat(row.get("drawer")).isEqualTo(actualResult.getDrawer()); - assertThat(row.get("financialStatusId")).isEqualTo(actualResult.getFinancialStatusId()); - assertThat(row.get("instrumentTypeId")).isEqualTo(actualResult.getInstrumentTypeId()); - assertThat(row.get("payee")).isEqualTo(actualResult.getPayee()); - assertThat(row.get("serialNo")).isEqualTo(actualResult.getSerialNo()); - assertThat(row.get("surrenderReasonId")).isEqualTo(actualResult.getSurrenderReasonId()); - assertThat(row.get("transactionNumber")).isEqualTo(actualResult.getTransactionNumber()); - assertThat(row.get("transactionType")).isEqualTo(actualResult.getTransactionType()); - - } - - @Test - @Sql(scripts = { "/sql/instrument/clearInstrument.sql", "/sql/instrument/insertInstrumentData.sql" }) - public void test_search() { - - Pagination page = (Pagination) instrumentJdbcRepository.search(getInstrumentSearch()); - - assertThat(page.getPagedData().get(0).getAmount()).isEqualTo("1.00"); - assertThat(page.getPagedData().get(0).getBank().getId()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getBankAccount().getAccountNumber()).isEqualTo("accountNumber"); - assertThat(page.getPagedData().get(0).getBranchName()).isEqualTo("branchName"); - assertThat(page.getPagedData().get(0).getDrawer()).isEqualTo("drawer"); - assertThat(page.getPagedData().get(0).getFinancialStatus().getId()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getInstrumentType().getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getPayee()).isEqualTo("payee"); - assertThat(page.getPagedData().get(0).getSerialNo()).isEqualTo("serialNo"); - assertThat(page.getPagedData().get(0).getSurrenderReason().getId()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getTransactionNumber()).isEqualTo("transactionNumber"); - assertThat(page.getPagedData().get(0).getTransactionType()).isEqualTo(TransactionType.Credit); - } - - @Test - @Sql(scripts = { "/sql/instrument/clearInstrument.sql", "/sql/instrument/insertInstrumentData.sql" }) - public void test_invalid_search() { - - Pagination page = (Pagination) instrumentJdbcRepository.search(getInstrumentSearch1()); - assertThat(page.getPagedData().size()).isEqualTo(0); - - } - - @Test - @Sql(scripts = { "/sql/instrument/clearInstrument.sql", "/sql/instrument/insertInstrumentData.sql" }) - public void test_find_by_id() { - - InstrumentEntity instrumentEntity = InstrumentEntity.builder().id("1").build(); - instrumentEntity.setTenantId("default"); - InstrumentEntity result = instrumentJdbcRepository.findById(instrumentEntity); - - assertThat(result.getAmount()).isEqualTo("1.00"); - assertThat(result.getBankId()).isEqualTo("code"); - assertThat(result.getBankAccountId()).isEqualTo("accountNumber"); - assertThat(result.getBranchName()).isEqualTo("branchName"); - assertThat(result.getDrawer()).isEqualTo("drawer"); - assertThat(result.getFinancialStatusId()).isEqualTo("1"); - assertThat(result.getInstrumentTypeId()).isEqualTo("name"); - assertThat(result.getPayee()).isEqualTo("payee"); - assertThat(result.getSerialNo()).isEqualTo("serialNo"); - assertThat(result.getSurrenderReasonId()).isEqualTo("1"); - assertThat(result.getTransactionNumber()).isEqualTo("transactionNumber"); - assertThat(result.getTransactionType()).isEqualTo("Credit"); - - } - - @Test - @Sql(scripts = { "/sql/instrument/clearInstrument.sql", "/sql/instrument/insertInstrumentData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - InstrumentEntity instrumentEntity = InstrumentEntity.builder().id("5").build(); - instrumentEntity.setTenantId("default"); - InstrumentEntity result = instrumentJdbcRepository.findById(instrumentEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/instrument/clearInstrument.sql", "/sql/instrument/insertInstrumentData.sql" }) - public void test_search_invalid_sort_option() { - - InstrumentSearch search = getInstrumentSearch(); - search.setSortBy("desc"); - instrumentJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/instrument/clearInstrument.sql", "/sql/instrument/insertInstrumentData.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - InstrumentSearch search = getInstrumentSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) instrumentJdbcRepository.search(getInstrumentSearch()); - - assertThat(page.getPagedData().get(0).getAmount()).isEqualTo("1.00"); - assertThat(page.getPagedData().get(0).getBank().getId()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getBankAccount().getAccountNumber()).isEqualTo("accountNumber"); - assertThat(page.getPagedData().get(0).getBranchName()).isEqualTo("branchName"); - assertThat(page.getPagedData().get(0).getDrawer()).isEqualTo("drawer"); - assertThat(page.getPagedData().get(0).getFinancialStatus().getId()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getInstrumentType().getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getPayee()).isEqualTo("payee"); - assertThat(page.getPagedData().get(0).getSerialNo()).isEqualTo("serialNo"); - assertThat(page.getPagedData().get(0).getSurrenderReason().getId()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getTransactionNumber()).isEqualTo("transactionNumber"); - assertThat(page.getPagedData().get(0).getTransactionType()).isEqualTo(TransactionType.Credit); - - } - - class InstrumentResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("amount", resultSet.getString("amount")); - put("bankId", resultSet.getString("bankId")); - put("bankAccountId", resultSet.getString("bankAccountId")); - put("branchName", resultSet.getString("branchName")); - put("drawer", resultSet.getString("drawer")); - put("financialStatusId", resultSet.getString("financialStatusId")); - put("instrumentTypeId", resultSet.getString("instrumentTypeId")); - put("payee", resultSet.getString("payee")); - put("serialNo", resultSet.getString("serialNo")); - put("transactionNumber", resultSet.getString("transactionNumber")); - put("transactionType", resultSet.getString("transactionType")); - put("surrenderReasonId", resultSet.getString("surrenderReasonId")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private InstrumentSearch getInstrumentSearch1() { - InstrumentSearch instrumentSearch = new InstrumentSearch(); - instrumentSearch.setId("id"); - instrumentSearch.setAmount(BigDecimal.ONE); - instrumentSearch.setBank(BankContract.builder().id("1").build()); - instrumentSearch.setBankAccount(BankAccountContract.builder().id("1").build()); - instrumentSearch.setBranchName("branchName"); - instrumentSearch.setDrawer("drawer"); - instrumentSearch.setFinancialStatus(FinancialStatusContract.builder().id("1").build()); - instrumentSearch.setRemittanceVoucherId("1"); - instrumentSearch.setInstrumentType(InstrumentType.builder().id("1").build()); - instrumentSearch.setPayee("payee"); - instrumentSearch.setSerialNo("serialNo"); - instrumentSearch.setSurrenderReason(SurrenderReason.builder().id("1").build()); - instrumentSearch.setTransactionNumber("transactionNumber"); - instrumentSearch.setTransactionType(TransactionType.Credit); - instrumentSearch.setReceiptIds("1"); - instrumentSearch.setTenantId("default"); - instrumentSearch.setPageSize(500); - instrumentSearch.setOffset(0); - instrumentSearch.setSortBy("id desc"); - return instrumentSearch; - } - - private InstrumentSearch getInstrumentSearch() { - InstrumentSearch instrumentSearch = new InstrumentSearch(); - instrumentSearch.setId("1"); - instrumentSearch.setIds("1"); - instrumentSearch.setAmount(BigDecimal.ONE); - instrumentSearch.setBank(BankContract.builder().id("code").build()); - instrumentSearch.setBankAccount(BankAccountContract.builder().accountNumber("accountNumber").build()); - instrumentSearch.setBranchName("branchName"); - instrumentSearch.setDrawer("drawer"); - instrumentSearch.setFinancialStatus(FinancialStatusContract.builder().id("1").build()); - instrumentSearch.setFinancialStatuses("1"); - instrumentSearch.setRemittanceVoucherId("1"); - instrumentSearch.setInstrumentType(InstrumentType.builder().name("name").build()); - instrumentSearch.setInstrumentTypes("name"); - instrumentSearch.setPayee("payee"); - instrumentSearch.setSerialNo("serialNo"); - instrumentSearch.setSurrenderReason(SurrenderReason.builder().id("1").build()); - instrumentSearch.setTransactionNumber("transactionNumber"); - instrumentSearch.setTransactionType(TransactionType.Credit); - instrumentSearch.setReceiptIds("1"); - try { - String startDateString = "07/27/2017"; - DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); - Date startDate; - startDate = df.parse(startDateString); - instrumentSearch.setTransactionFromDate(startDate); - instrumentSearch.setTransactionToDate(startDate); - } catch (Exception e) { - e.printStackTrace(); - } - instrumentSearch.setTenantId("default"); - instrumentSearch.setPageSize(500); - instrumentSearch.setOffset(0); - instrumentSearch.setSortBy("id desc"); - return instrumentSearch; - } -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentTypeJdbcRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentTypeJdbcRepositoryTest.java deleted file mode 100644 index b712b06bf93..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentTypeJdbcRepositoryTest.java +++ /dev/null @@ -1,230 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.persistence.entity.InstrumentTypeEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class InstrumentTypeJdbcRepositoryTest { - - private InstrumentTypeJdbcRepository instrumentTypeJdbcRepository; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Before - public void setUp() throws Exception { - instrumentTypeJdbcRepository = new InstrumentTypeJdbcRepository(namedParameterJdbcTemplate, jdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql" }) - public void test_create() { - - InstrumentTypeEntity instrumentType = InstrumentTypeEntity.builder().id("1").name("name").description("description") - .active(true).build(); - instrumentType.setTenantId("default"); - InstrumentTypeEntity actualResult = instrumentTypeJdbcRepository.create(instrumentType); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentType", - new InstrumentTypeResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("description")).isEqualTo(actualResult.getDescription()); - assertThat(row.get("active")).isEqualTo(actualResult.getActive()); - - } - - @Test - @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql", - "/sql/instrumenttype/insertInstrumentTypeData.sql" }) - public void test_update() { - - InstrumentTypeEntity instrumentType = InstrumentTypeEntity.builder().id("1").name("name").description("description") - .active(true).build(); - instrumentType.setTenantId("default"); - InstrumentTypeEntity actualResult = instrumentTypeJdbcRepository.update(instrumentType); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentType", - new InstrumentTypeResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("description")).isEqualTo(actualResult.getDescription()); - assertThat(row.get("active")).isEqualTo(actualResult.getActive()); - - } - - @Test - @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql", - "/sql/instrumenttype/insertInstrumentTypeData.sql" }) - public void test_delete() { - - InstrumentTypeEntity instrumentType = InstrumentTypeEntity.builder().id("1").name("name").description("description") - .active(true).build(); - instrumentType.setTenantId("default"); - InstrumentTypeEntity actualResult = instrumentTypeJdbcRepository.delete(instrumentType); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentType", - new InstrumentTypeResultExtractor()); - assertTrue("Result set length is zero", result.size() == 0); - } - - @Test - @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql", - "/sql/instrumenttype/insertInstrumentTypeData.sql" }) - public void test_search() { - - Pagination page = (Pagination) instrumentTypeJdbcRepository - .search(getInstrumentTypeSearch()); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getDescription()).isEqualTo("description"); - - } - - @Test - @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql", - "/sql/instrumenttype/insertInstrumentTypeData.sql" }) - public void test_invalid_search() { - - Pagination page = (Pagination) instrumentTypeJdbcRepository - .search(getInstrumentTypeSearch1()); - assertThat(page.getPagedData().size()).isEqualTo(0); - - } - - @Test - @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql", - "/sql/instrumenttype/insertInstrumentTypeData.sql" }) - public void test_find_by_id() { - - InstrumentTypeEntity instrumentTypeEntity = InstrumentTypeEntity.builder().id("1").build(); - instrumentTypeEntity.setTenantId("default"); - InstrumentTypeEntity result = instrumentTypeJdbcRepository.findById(instrumentTypeEntity); - assertThat(result.getName()).isEqualTo("name"); - assertThat(result.getDescription()).isEqualTo("description"); - assertThat(result.getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql", - "/sql/instrumenttype/insertInstrumentTypeData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - InstrumentTypeEntity instrumentTypeEntity = InstrumentTypeEntity.builder().id("5").build(); - instrumentTypeEntity.setTenantId("default"); - InstrumentTypeEntity result = instrumentTypeJdbcRepository.findById(instrumentTypeEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql", - "/sql/instrumenttype/insertInstrumentTypeData.sql" }) - public void test_search_invalid_sort_option() { - - InstrumentTypeSearch search = getInstrumentTypeSearch(); - search.setSortBy("desc"); - instrumentTypeJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/instrumenttype/clearInstrumentType.sql", - "/sql/instrumenttype/insertInstrumentTypeData.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - InstrumentTypeSearch search = getInstrumentTypeSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) instrumentTypeJdbcRepository - .search(getInstrumentTypeSearch()); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getDescription()).isEqualTo("description"); - - } - - class InstrumentTypeResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("name", resultSet.getString("name")); - put("description", resultSet.getString("description")); - put("active", resultSet.getBoolean("active")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private InstrumentTypeSearch getInstrumentTypeSearch1() { - InstrumentTypeSearch instrumentTypeSearch = new InstrumentTypeSearch(); - instrumentTypeSearch.setId("id"); - instrumentTypeSearch.setName("name"); - instrumentTypeSearch.setDescription("description"); - instrumentTypeSearch.setActive(true); - instrumentTypeSearch.setTenantId("tenantId"); - instrumentTypeSearch.setPageSize(500); - instrumentTypeSearch.setOffset(0); - instrumentTypeSearch.setSortBy("name desc"); - return instrumentTypeSearch; - } - - private InstrumentTypeSearch getInstrumentTypeSearch() { - InstrumentTypeSearch instrumentTypeSearch = new InstrumentTypeSearch(); - instrumentTypeSearch.setId("1"); - instrumentTypeSearch.setIds("1"); - instrumentTypeSearch.setName("name"); - instrumentTypeSearch.setDescription("description"); - instrumentTypeSearch.setActive(true); - instrumentTypeSearch.setPageSize(500); - instrumentTypeSearch.setOffset(0); - instrumentTypeSearch.setSortBy("name desc"); - return instrumentTypeSearch; - } -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentTypePropertyJdbcRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentTypePropertyJdbcRepositoryTest.java deleted file mode 100644 index 03a76d5a109..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentTypePropertyJdbcRepositoryTest.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.egf.instrument.persistence.entity.InstrumentTypePropertyEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class InstrumentTypePropertyJdbcRepositoryTest { - - private InstrumentTypePropertyJdbcRepository instrumentTypePropertyJdbcRepository; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - instrumentTypePropertyJdbcRepository = new InstrumentTypePropertyJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql" }) - public void test_create() { - - InstrumentTypePropertyEntity instrumentTypeProperty = InstrumentTypePropertyEntity.builder().id("1") - .transactionType("Credit").reconciledOncreate(true).statusOnCreateId("1").statusOnReconcileId("1") - .statusOnUpdateId("1").build(); - instrumentTypeProperty.setTenantId("default"); - InstrumentTypePropertyEntity actualResult = instrumentTypePropertyJdbcRepository.create(instrumentTypeProperty); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentTypeProperty", - new InstrumentTypePropertyResultExtractor()); - Map row = result.get(0); - - assertThat(row.get("transactionType")).isEqualTo(actualResult.getTransactionType()); - assertThat(row.get("reconciledOncreate")).isEqualTo(actualResult.getReconciledOncreate()); - assertThat(row.get("statusOnCreateId")).isEqualTo(actualResult.getStatusOnCreateId()); - assertThat(row.get("statusOnReconcileId")).isEqualTo(actualResult.getStatusOnReconcileId()); - assertThat(row.get("statusOnUpdateId")).isEqualTo(actualResult.getStatusOnUpdateId()); - - } - - @Test - @Sql(scripts = { "/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql", - "/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql" }) - public void test_update() { - - InstrumentTypePropertyEntity instrumentTypeProperty = InstrumentTypePropertyEntity.builder().id("1") - .transactionType("Credit").reconciledOncreate(true).statusOnCreateId("1").statusOnReconcileId("1") - .statusOnUpdateId("1").build(); - instrumentTypeProperty.setTenantId("default"); - InstrumentTypePropertyEntity actualResult = instrumentTypePropertyJdbcRepository.update(instrumentTypeProperty); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentTypeProperty", - new InstrumentTypePropertyResultExtractor()); - Map row = result.get(0); - - assertThat(row.get("transactionType")).isEqualTo(actualResult.getTransactionType()); - assertThat(row.get("reconciledOncreate")).isEqualTo(actualResult.getReconciledOncreate()); - assertThat(row.get("statusOnCreateId")).isEqualTo(actualResult.getStatusOnCreateId()); - assertThat(row.get("statusOnReconcileId")).isEqualTo(actualResult.getStatusOnReconcileId()); - assertThat(row.get("statusOnUpdateId")).isEqualTo(actualResult.getStatusOnUpdateId()); - - } - - @Test - @Sql(scripts = { "/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql", - "/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql" }) - public void test_find_by_id() { - - InstrumentTypePropertyEntity instrumentTypePropertyEntity = InstrumentTypePropertyEntity.builder().id("1") - .build(); - instrumentTypePropertyEntity.setTenantId("default"); - InstrumentTypePropertyEntity result = instrumentTypePropertyJdbcRepository - .findById(instrumentTypePropertyEntity); - - assertThat(result.getTransactionType()).isEqualTo("Credit"); - assertThat(result.getReconciledOncreate()).isEqualTo(true); - assertThat(result.getStatusOnCreateId()).isEqualTo("created"); - assertThat(result.getStatusOnReconcileId()).isEqualTo("reconciled"); - assertThat(result.getStatusOnUpdateId()).isEqualTo("updated"); - - } - - @Test - @Sql(scripts = { "/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql", - "/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - InstrumentTypePropertyEntity instrumentTypePropertyEntity = InstrumentTypePropertyEntity.builder().id("5") - .build(); - instrumentTypePropertyEntity.setTenantId("default"); - InstrumentTypePropertyEntity result = instrumentTypePropertyJdbcRepository - .findById(instrumentTypePropertyEntity); - assertNull(result); - - } - - /* - * @Test - * @Sql(scripts = { "/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql", - * "/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql" }) public void test_search() { - * Pagination page = (Pagination) instrumentTypePropertyJdbcRepository - * .search(getInstrumentTypePropertySearch()); assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - * assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - * assertThat(page.getPagedData().get(0).getDescription()).isEqualTo( "description"); } - */ - - /* - * @Test - * @Sql(scripts = { "/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql", - * "/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql" }) public void test_invalid_search() { - * Pagination page = (Pagination) instrumentTypePropertyJdbcRepository - * .search(getInstrumentTypePropertySearch1()); assertThat(page.getPagedData().size()).isEqualTo(0); } - */ - - /* - * @Test(expected = InvalidDataException.class) - * @Sql(scripts = { "/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql", - * "/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql" }) public void test_search_invalid_sort_option() { - * InstrumentTypePropertySearch search = getInstrumentTypePropertySearch(); search.setSortBy("desc"); - * instrumentTypePropertyJdbcRepository.search(search); } - * @Test - * @Sql(scripts = { "/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql", - * "/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql" }) public void - * test_search_without_pagesize_offset_sortby() { InstrumentTypePropertySearch search = getInstrumentTypePropertySearch(); - * search.setSortBy(null); search.setPageSize(null); search.setOffset(null); Pagination page = - * (Pagination) instrumentTypePropertyJdbcRepository .search(getInstrumentTypePropertySearch()); - * assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - * assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - * assertThat(page.getPagedData().get(0).getDescription()).isEqualTo( "description"); } - */ - - class InstrumentTypePropertyResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("transactionType", resultSet.getString("transactionType")); - put("reconciledOncreate", resultSet.getBoolean("reconciledOncreate")); - put("statusOnCreateId", resultSet.getString("statusOnCreateId")); - put("statusOnUpdateId", resultSet.getString("statusOnUpdateId")); - put("statusOnReconcileId", resultSet.getString("statusOnReconcileId")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - /* - * private InstrumentTypePropertySearch getInstrumentTypePropertySearch1() { InstrumentTypePropertySearch - * instrumentTypePropertySearch = new InstrumentTypePropertySearch(); instrumentTypePropertySearch.setId("id"); - * instrumentTypePropertySearch.setName("name"); instrumentTypePropertySearch.setDescription("description"); - * instrumentTypePropertySearch.setActive(true); instrumentTypePropertySearch.setTenantId("tenantId"); - * instrumentTypePropertySearch.setPageSize(500); instrumentTypePropertySearch.setOffset(0); - * instrumentTypePropertySearch.setSortBy("name desc"); return instrumentTypePropertySearch; } private - * InstrumentTypePropertySearch getInstrumentTypePropertySearch() { InstrumentTypePropertySearch instrumentTypePropertySearch - * = new InstrumentTypePropertySearch(); instrumentTypePropertySearch.setName("name"); - * instrumentTypePropertySearch.setDescription("description"); instrumentTypePropertySearch.setActive(true); - * instrumentTypePropertySearch.setPageSize(500); instrumentTypePropertySearch.setOffset(0); - * instrumentTypePropertySearch.setSortBy("name desc"); return instrumentTypePropertySearch; } - */ -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentVoucherJdbcRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentVoucherJdbcRepositoryTest.java deleted file mode 100644 index 46f7f3dff02..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/InstrumentVoucherJdbcRepositoryTest.java +++ /dev/null @@ -1,203 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentVoucher; -import org.egov.egf.instrument.domain.model.InstrumentVoucherSearch; -import org.egov.egf.instrument.persistence.entity.InstrumentVoucherEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class InstrumentVoucherJdbcRepositoryTest { - - private InstrumentVoucherJdbcRepository instrumentVoucherJdbcRepository; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - instrumentVoucherJdbcRepository = new InstrumentVoucherJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/instrumentvoucher/clearInstrumentVoucher.sql" }) - public void test_create() { - - InstrumentVoucherEntity instrumentVoucher = InstrumentVoucherEntity.builder().id("1").instrumentId("1") - .voucherHeaderId("1").receiptHeaderId("1").build(); - instrumentVoucher.setTenantId("default"); - InstrumentVoucherEntity actualResult = instrumentVoucherJdbcRepository.create(instrumentVoucher); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentVoucher", - new InstrumentVoucherResultExtractor()); - Map row = result.get(0); - - assertThat(row.get("instrumentId")).isEqualTo(actualResult.getInstrumentId()); - assertThat(row.get("voucherHeaderId")).isEqualTo(actualResult.getVoucherHeaderId()); - assertThat(row.get("receiptHeaderId")).isEqualTo(actualResult.getReceiptHeaderId()); - - } - - @Test - @Sql(scripts = { "/sql/instrumentvoucher/clearInstrumentVoucher.sql", - "/sql/instrumentvoucher/insertInstrumentVoucherData.sql" }) - public void test_update() { - - InstrumentVoucherEntity instrumentVoucher = InstrumentVoucherEntity.builder().id("1").instrumentId("1") - .voucherHeaderId("1").receiptHeaderId("1").build(); - instrumentVoucher.setTenantId("default"); - InstrumentVoucherEntity actualResult = instrumentVoucherJdbcRepository.update(instrumentVoucher); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_instrumentVoucher", - new InstrumentVoucherResultExtractor()); - Map row = result.get(0); - - assertThat(row.get("instrumentId")).isEqualTo(actualResult.getInstrumentId()); - assertThat(row.get("voucherHeaderId")).isEqualTo(actualResult.getVoucherHeaderId()); - assertThat(row.get("receiptHeaderId")).isEqualTo(actualResult.getReceiptHeaderId()); - - } - - @Test - @Sql(scripts = { "/sql/instrumentvoucher/clearInstrumentVoucher.sql", - "/sql/instrumentvoucher/insertInstrumentVoucherData.sql" }) - public void test_find_by_id() { - - InstrumentVoucherEntity instrumentVoucherEntity = InstrumentVoucherEntity.builder().id("1").build(); - instrumentVoucherEntity.setTenantId("default"); - InstrumentVoucherEntity result = instrumentVoucherJdbcRepository.findById(instrumentVoucherEntity); - - assertThat(result.getInstrumentId()).isEqualTo("1"); - assertThat(result.getVoucherHeaderId()).isEqualTo("1"); - assertThat(result.getReceiptHeaderId()).isEqualTo("1"); - - } - - @Test - @Sql(scripts = { "/sql/instrumentvoucher/clearInstrumentVoucher.sql", - "/sql/instrumentvoucher/insertInstrumentVoucherData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - InstrumentVoucherEntity instrumentVoucherEntity = InstrumentVoucherEntity.builder().id("5").build(); - instrumentVoucherEntity.setTenantId("default"); - InstrumentVoucherEntity result = instrumentVoucherJdbcRepository.findById(instrumentVoucherEntity); - assertNull(result); - - } - - @Test - @Sql(scripts = { "/sql/instrumentvoucher/clearInstrumentVoucher.sql", - "/sql/instrumentvoucher/insertInstrumentVoucherData.sql" }) - public void test_search() { - Pagination page = (Pagination) instrumentVoucherJdbcRepository - .search(getInstrumentVoucherSearch()); - assertThat(page.getPagedData().get(0).getReceiptHeaderId()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getVoucherHeaderId()).isEqualTo("1"); - } - - @Test - @Sql(scripts = { "/sql/instrumentvoucher/clearInstrumentVoucher.sql", - "/sql/instrumentvoucher/insertInstrumentVoucherData.sql" }) - public void test_invalid_search() { - Pagination page = (Pagination) instrumentVoucherJdbcRepository - .search(getInstrumentVoucherSearch1()); - assertThat(page.getPagedData().size()).isEqualTo(0); - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/instrumentvoucher/clearInstrumentVoucher.sql", - "/sql/instrumentvoucher/insertInstrumentVoucherData.sql" }) - public void test_search_invalid_sort_option() { - InstrumentVoucherSearch search = getInstrumentVoucherSearch(); - search.setSortBy("desc"); - instrumentVoucherJdbcRepository.search(search); - } - - @Test - @Sql(scripts = { "/sql/instrumentvoucher/clearInstrumentVoucher.sql", - "/sql/instrumentvoucher/insertInstrumentVoucherData.sql" }) - public void test_search_without_pagesize_offset_sortby() { - InstrumentVoucherSearch search = getInstrumentVoucherSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) instrumentVoucherJdbcRepository - .search(getInstrumentVoucherSearch()); - assertThat(page.getPagedData().get(0).getInstrument().getId()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getReceiptHeaderId()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getVoucherHeaderId()).isEqualTo("1"); - } - - class InstrumentVoucherResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("instrumentId", resultSet.getString("instrumentId")); - put("voucherHeaderId", resultSet.getString("voucherHeaderId")); - put("receiptHeaderId", resultSet.getString("receiptHeaderId")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private InstrumentVoucherSearch getInstrumentVoucherSearch1() { - InstrumentVoucherSearch instrumentVoucherSearch = new InstrumentVoucherSearch(); - instrumentVoucherSearch.setInstrument(Instrument.builder().id("id").build()); - instrumentVoucherSearch.setReceiptHeaderId("receiptHeaderId"); - instrumentVoucherSearch.setVoucherHeaderId("voucherHeaderId"); - instrumentVoucherSearch.setTenantId("tenantId"); - instrumentVoucherSearch.setPageSize(500); - instrumentVoucherSearch.setOffset(0); - instrumentVoucherSearch.setSortBy("id desc"); - return instrumentVoucherSearch; - } - - private InstrumentVoucherSearch getInstrumentVoucherSearch() { - InstrumentVoucherSearch instrumentVoucherSearch = new InstrumentVoucherSearch(); - instrumentVoucherSearch.setReceiptHeaderId("1"); - instrumentVoucherSearch.setVoucherHeaderId("1"); - instrumentVoucherSearch.setInstruments("1"); - instrumentVoucherSearch.setReceiptIds("1"); - instrumentVoucherSearch.setPageSize(500); - instrumentVoucherSearch.setOffset(0); - instrumentVoucherSearch.setSortBy("id desc"); - return instrumentVoucherSearch; - } -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/SurrenderReasonJdbcRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/SurrenderReasonJdbcRepositoryTest.java deleted file mode 100644 index 082cc2d9847..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/persistence/repository/SurrenderReasonJdbcRepositoryTest.java +++ /dev/null @@ -1,222 +0,0 @@ -package org.egov.egf.instrument.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.persistence.entity.SurrenderReasonEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class SurrenderReasonJdbcRepositoryTest { - - private SurrenderReasonJdbcRepository surrenderReasonJdbcRepository; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Before - public void setUp() throws Exception { - surrenderReasonJdbcRepository = new SurrenderReasonJdbcRepository(namedParameterJdbcTemplate, jdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql" }) - public void test_create() { - - SurrenderReasonEntity surrenderReason = SurrenderReasonEntity.builder().id("1").name("name") - .description("description").build(); - surrenderReason.setTenantId("default"); - SurrenderReasonEntity actualResult = surrenderReasonJdbcRepository.create(surrenderReason); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_surrenderReason", - new SurrenderReasonResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("description")).isEqualTo(actualResult.getDescription()); - - } - - @Test - @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql", - "/sql/surrenderreason/insertSurrenderReasonData.sql" }) - public void test_update() { - - SurrenderReasonEntity surrenderReason = SurrenderReasonEntity.builder().id("1").name("name") - .description("description").build(); - surrenderReason.setTenantId("default"); - SurrenderReasonEntity actualResult = surrenderReasonJdbcRepository.update(surrenderReason); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_surrenderReason", - new SurrenderReasonResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("description")).isEqualTo(actualResult.getDescription()); - - } - - @Test - @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql", - "/sql/surrenderreason/insertSurrenderReasonData.sql" }) - public void test_delete() { - - SurrenderReasonEntity surrenderReason = SurrenderReasonEntity.builder().id("1").name("name") - .description("description").build(); - surrenderReason.setTenantId("default"); - SurrenderReasonEntity actualResult = surrenderReasonJdbcRepository.delete(surrenderReason); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_surrenderReason", - new SurrenderReasonResultExtractor()); - assertTrue("Result set length is zero", result.size() == 0); - } - - @Test - @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql", - "/sql/surrenderreason/insertSurrenderReasonData.sql" }) - public void test_search() { - - Pagination page = (Pagination) surrenderReasonJdbcRepository - .search(getSurrenderReasonSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getDescription()).isEqualTo("description"); - - } - - @Test - @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql", - "/sql/surrenderreason/insertSurrenderReasonData.sql" }) - public void test_invalid_search() { - - Pagination page = (Pagination) surrenderReasonJdbcRepository - .search(getSurrenderReasonSearch1()); - assertThat(page.getPagedData().size()).isEqualTo(0); - - } - - @Test - @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql", - "/sql/surrenderreason/insertSurrenderReasonData.sql" }) - public void test_find_by_id() { - - SurrenderReasonEntity surrenderReasonEntity = SurrenderReasonEntity.builder().id("1").build(); - surrenderReasonEntity.setTenantId("default"); - SurrenderReasonEntity result = surrenderReasonJdbcRepository.findById(surrenderReasonEntity); - assertThat(result.getName()).isEqualTo("name"); - assertThat(result.getDescription()).isEqualTo("description"); - - } - - @Test - @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql", - "/sql/surrenderreason/insertSurrenderReasonData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - SurrenderReasonEntity surrenderReasonEntity = SurrenderReasonEntity.builder().id("5").build(); - surrenderReasonEntity.setTenantId("default"); - SurrenderReasonEntity result = surrenderReasonJdbcRepository.findById(surrenderReasonEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql", - "/sql/surrenderreason/insertSurrenderReasonData.sql" }) - public void test_search_invalid_sort_option() { - - SurrenderReasonSearch search = getSurrenderReasonSearch(); - search.setSortBy("desc"); - surrenderReasonJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/surrenderreason/clearSurrenderReason.sql", - "/sql/surrenderreason/insertSurrenderReasonData.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - SurrenderReasonSearch search = getSurrenderReasonSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) surrenderReasonJdbcRepository - .search(getSurrenderReasonSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getDescription()).isEqualTo("description"); - - } - - class SurrenderReasonResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("name", resultSet.getString("name")); - put("description", resultSet.getString("description")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private SurrenderReasonSearch getSurrenderReasonSearch1() { - SurrenderReasonSearch surrenderReasonSearch = new SurrenderReasonSearch(); - surrenderReasonSearch.setId("id"); - surrenderReasonSearch.setName("name"); - surrenderReasonSearch.setDescription("description"); - surrenderReasonSearch.setTenantId("tenantId"); - surrenderReasonSearch.setPageSize(500); - surrenderReasonSearch.setOffset(0); - surrenderReasonSearch.setSortBy("name desc"); - return surrenderReasonSearch; - } - - private SurrenderReasonSearch getSurrenderReasonSearch() { - SurrenderReasonSearch surrenderReasonSearch = new SurrenderReasonSearch(); - surrenderReasonSearch.setId("1"); - surrenderReasonSearch.setIds("1"); - surrenderReasonSearch.setName("name"); - surrenderReasonSearch.setDescription("description"); - surrenderReasonSearch.setPageSize(500); - surrenderReasonSearch.setOffset(0); - surrenderReasonSearch.setSortBy("name desc"); - return surrenderReasonSearch; - } -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/utils/RequestJsonReader.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/utils/RequestJsonReader.java deleted file mode 100644 index 773f8a6b205..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/utils/RequestJsonReader.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.egov.egf.instrument.utils; - -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -public class RequestJsonReader { - - public String readRequest(String fileName) { - try { - String info = IOUtils.toString( - this.getClass().getClassLoader().getResourceAsStream("common/request_info.json"), "UTF-8"); - - String data = IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(fileName), "UTF-8"); - return "{\n" + info + "," + data + "}"; - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public String readResponse(String fileName) { - try { - String info = IOUtils.toString( - this.getClass().getClassLoader().getResourceAsStream("common/response_info.json"), "UTF-8"); - - String data = IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(fileName), "UTF-8"); - return "{\n" + info + "," + data + "}"; - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public String readErrorResponse(String fileName) { - try { - String info = IOUtils - .toString(this.getClass().getClassLoader().getResourceAsStream("common/error_info.json"), "UTF-8"); - - String data = IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(fileName), "UTF-8"); - return "{\n" + info + "," + data + "}"; - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public String getRequestInfo() { - try { - String info = IOUtils.toString( - this.getClass().getClassLoader().getResourceAsStream("common/request_info.json"), "UTF-8"); - - return "{\n" + info + "}"; - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public String getFileContents(String fileName) { - try { - return IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(fileName), "UTF-8"); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/InstrumentAccountCodeControllerTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/InstrumentAccountCodeControllerTest.java deleted file mode 100644 index 6db7d722cec..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/InstrumentAccountCodeControllerTest.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.egov.egf.instrument.web.controller; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.TestConfiguration; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.service.InstrumentAccountCodeService; -import org.egov.egf.instrument.utils.RequestJsonReader; -import org.egov.egf.instrument.web.requests.InstrumentAccountCodeRequest; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(InstrumentAccountCodeController.class) -@Import(TestConfiguration.class) -public class InstrumentAccountCodeControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private InstrumentAccountCodeService instrumentAccountCodeService; - - @Captor - private ArgumentCaptor captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void test_create() throws IOException, Exception { - - when(instrumentAccountCodeService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstrumentAccountCodes()); - - mockMvc.perform(post("/instrumentaccountcodes/_create") - .content(resources.readRequest("instrumentaccountcode/instrumentaccountcode_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json(resources - .readResponse("instrumentaccountcode/instrumentaccountcode_create_valid_response.json"))); - } - - @Test - public void test_create_error() throws IOException, Exception { - - when(instrumentAccountCodeService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstrumentAccountCodes()); - - mockMvc.perform(post("/instrumentaccountcodes/_create") - .content(resources - .readRequest("instrumentaccountcode/instrumentaccountcode_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_update() throws IOException, Exception { - - List instrumentAccountCodes = getInstrumentAccountCodes(); - instrumentAccountCodes.get(0).setId("1"); - - when(instrumentAccountCodeService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(instrumentAccountCodes); - - mockMvc.perform(post("/instrumentaccountcodes/_update") - .content(resources.readRequest("instrumentaccountcode/instrumentaccountcode_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json(resources - .readResponse("instrumentaccountcode/instrumentaccountcode_update_valid_response.json"))); - - } - - @Test - public void test_delete() throws IOException, Exception { - - List instrumentAccountCodes = getInstrumentAccountCodes(); - instrumentAccountCodes.get(0).setId("1"); - - when(instrumentAccountCodeService.delete(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(instrumentAccountCodes); - - mockMvc.perform(post("/instrumentaccountcodes/_delete") - .content(resources.readRequest("instrumentaccountcode/instrumentaccountcode_delete_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json(resources - .readResponse("instrumentaccountcode/instrumentaccountcode_delete_valid_response.json"))); - - } - - @Test - public void test_update_error() throws IOException, Exception { - - when(instrumentAccountCodeService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstrumentAccountCodes()); - - mockMvc.perform(post("/instrumentaccountcodes/_update") - .content(resources - .readRequest("instrumentaccountcode/instrumentaccountcode_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_delete_error() throws IOException, Exception { - - when(instrumentAccountCodeService.delete(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstrumentAccountCodes()); - - mockMvc.perform(post("/instrumentaccountcodes/_delete") - .content(resources - .readRequest("instrumentaccountcode/instrumentaccountcode_delete_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getInstrumentAccountCodes()); - page.getPagedData().get(0).setId("1"); - - when(instrumentAccountCodeService.search(any(InstrumentAccountCodeSearch.class))).thenReturn(page); - - mockMvc.perform(post("/instrumentaccountcodes/_search").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json(resources - .readResponse("instrumentaccountcode/instrumentaccountcode_search_valid_response.json"))); - - } - - private List getInstrumentAccountCodes() { - List instrumentAccountCodes = new ArrayList(); - InstrumentAccountCode instrumentAccountCode = InstrumentAccountCode.builder() - .instrumentType(InstrumentType.builder().active(true).name("instrumenttype").build()) - .accountCode(ChartOfAccountContract.builder().glcode("glcode").build()).build(); - instrumentAccountCode.setTenantId("default"); - instrumentAccountCodes.add(instrumentAccountCode); - return instrumentAccountCodes; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/InstrumentControllerTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/InstrumentControllerTest.java deleted file mode 100644 index c6e27272005..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/InstrumentControllerTest.java +++ /dev/null @@ -1,207 +0,0 @@ -package org.egov.egf.instrument.web.controller; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.TestConfiguration; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.TransactionType; -import org.egov.egf.instrument.domain.service.InstrumentService; -import org.egov.egf.instrument.utils.RequestJsonReader; -import org.egov.egf.instrument.web.requests.InstrumentRequest; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(InstrumentController.class) -@Import(TestConfiguration.class) -public class InstrumentControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private InstrumentService instrumentService; - - @Captor - private ArgumentCaptor captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void test_create() throws IOException, Exception { - - when(instrumentService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstruments()); - - mockMvc.perform(post("/instruments/_create") - .content(resources.readRequest("instrument/instrument_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("instrument/instrument_create_valid_response.json"))); - - } - - @Test - public void test_create_error() throws IOException, Exception { - - when(instrumentService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstruments()); - - mockMvc.perform(post("/instruments/_create") - .content(resources.readRequest("instrument/instrument_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_update() throws IOException, Exception { - - List instruments = getInstruments(); - instruments.get(0).setId("1"); - - when(instrumentService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(instruments); - - mockMvc.perform(post("/instruments/_update") - .content(resources.readRequest("instrument/instrument_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("instrument/instrument_update_valid_response.json"))); - - } - - @Test - public void test_delete() throws IOException, Exception { - - List instruments = getInstruments(); - instruments.get(0).setId("1"); - - when(instrumentService.delete(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(instruments); - - mockMvc.perform(post("/instruments/_delete") - .content(resources.readRequest("instrument/instrument_delete_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("instrument/instrument_delete_valid_response.json"))); - - } - - @Test - public void test_update_error() throws IOException, Exception { - - when(instrumentService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstruments()); - - mockMvc.perform(post("/instruments/_update") - .content(resources.readRequest("instrument/instrument_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_delete_error() throws IOException, Exception { - - when(instrumentService.delete(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstruments()); - - mockMvc.perform(post("/instruments/_delete") - .content(resources.readRequest("instrument/instrument_delete_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getInstruments()); - page.getPagedData().get(0).setId("1"); - - when(instrumentService.search(any(InstrumentSearch.class))).thenReturn(page); - - mockMvc.perform(post("/instruments/_search").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("instrument/instrument_search_valid_response.json"))); - - } - - @Test - public void test_deposit_instrument() throws IOException, Exception { - List instruments = getInstrumentsForDeposit(); - instruments.get(0).setId("726bb79942b24a75815fc11172cef45e"); - when(instrumentService.deposit(any(InstrumentRequest.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(instruments); - - mockMvc.perform(post("/instruments/_deposit") - .content(resources.readRequest("instrument/instrument_deposit_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("instrument/instrument_deposit_valid_response.json"))); - } - - @Test - public void test_dishonor_instrument() throws IOException, Exception { - List instruments = getInstrumentsForDeposit(); - instruments.get(0).setId("726bb79942b24a75815fc11172cef45e"); - when(instrumentService.dishonor(any(InstrumentRequest.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(instruments); - - mockMvc.perform(post("/instruments/_dishonor") - .content(resources.readRequest("instrument/instrument_dishonor_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("instrument/instrument_dishonor_valid_response.json"))); - } - - private List getInstruments() { - List instruments = new ArrayList(); - Instrument instrument = Instrument.builder().transactionNumber("transactionNumber").amount(BigDecimal.ONE) - .transactionType(TransactionType.Credit).serialNo("serialNo") - .instrumentType(InstrumentType.builder().active(true).name("instrumenttype").build()).build(); - instrument.setTenantId("default"); - instruments.add(instrument); - return instruments; - } - - private List getInstrumentsForDeposit() { - List instruments = new ArrayList(); - Instrument instrument = Instrument.builder().transactionNumber("transactionNumber").amount(BigDecimal.ONE) - .transactionType(TransactionType.Debit).serialNo("serialNo") - .financialStatus(FinancialStatusContract.builder().id("a167095b-5a73-4e61-b489-af31f053c4e1") - .moduleType("Instrument").code("Deposited").build()) - .build(); - instrument.setTenantId("default"); - instruments.add(instrument); - return instruments; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/InstrumentTypeControllerTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/InstrumentTypeControllerTest.java deleted file mode 100644 index ba982bc2e9a..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/InstrumentTypeControllerTest.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.egov.egf.instrument.web.controller; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.TestConfiguration; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentTypeSearch; -import org.egov.egf.instrument.domain.service.InstrumentTypeService; -import org.egov.egf.instrument.utils.RequestJsonReader; -import org.egov.egf.instrument.web.requests.InstrumentTypeRequest; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(InstrumentTypeController.class) -@Import(TestConfiguration.class) -public class InstrumentTypeControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private InstrumentTypeService instrumentTypeService; - - @Captor - private ArgumentCaptor captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void test_create() throws IOException, Exception { - - when(instrumentTypeService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstrumentTypes()); - - mockMvc.perform(post("/instrumenttypes/_create") - .content(resources.readRequest("instrumenttype/instrumenttype_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("instrumenttype/instrumenttype_create_valid_response.json"))); - } - - @Test - public void test_create_error() throws IOException, Exception { - - when(instrumentTypeService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstrumentTypes()); - - mockMvc.perform(post("/instrumenttypes/_create") - .content(resources.readRequest("instrumenttype/instrumenttype_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_update() throws IOException, Exception { - - List instrumentTypes = getInstrumentTypes(); - instrumentTypes.get(0).setId("1"); - - when(instrumentTypeService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(instrumentTypes); - - mockMvc.perform(post("/instrumenttypes/_update") - .content(resources.readRequest("instrumenttype/instrumenttype_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("instrumenttype/instrumenttype_update_valid_response.json"))); - - } - - @Test - public void test_delete() throws IOException, Exception { - - List instrumentTypes = getInstrumentTypes(); - instrumentTypes.get(0).setId("1"); - - when(instrumentTypeService.delete(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(instrumentTypes); - - mockMvc.perform(post("/instrumenttypes/_delete") - .content(resources.readRequest("instrumenttype/instrumenttype_delete_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("instrumenttype/instrumenttype_delete_valid_response.json"))); - - } - - @Test - public void test_update_error() throws IOException, Exception { - - when(instrumentTypeService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstrumentTypes()); - - mockMvc.perform(post("/instrumenttypes/_update") - .content(resources.readRequest("instrumenttype/instrumenttype_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_delete_error() throws IOException, Exception { - - when(instrumentTypeService.delete(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getInstrumentTypes()); - - mockMvc.perform(post("/instrumenttypes/_delete") - .content(resources.readRequest("instrumenttype/instrumenttype_delete_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getInstrumentTypes()); - page.getPagedData().get(0).setId("1"); - - when(instrumentTypeService.search(any(InstrumentTypeSearch.class))).thenReturn(page); - - mockMvc.perform(post("/instrumenttypes/_search").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("instrumenttype/instrumenttype_search_valid_response.json"))); - - } - - private List getInstrumentTypes() { - List instrumentTypes = new ArrayList(); - InstrumentType instrumentType = InstrumentType.builder().name("name").description("description").active(true) - .build(); - instrumentType.setTenantId("default"); - instrumentTypes.add(instrumentType); - return instrumentTypes; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/SurrenderReasonControllerTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/SurrenderReasonControllerTest.java deleted file mode 100644 index b3f14f0c806..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/controller/SurrenderReasonControllerTest.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.egov.egf.instrument.web.controller; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.instrument.TestConfiguration; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.domain.service.SurrenderReasonService; -import org.egov.egf.instrument.utils.RequestJsonReader; -import org.egov.egf.instrument.web.requests.SurrenderReasonRequest; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(SurrenderReasonController.class) -@Import(TestConfiguration.class) -public class SurrenderReasonControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private SurrenderReasonService surrenderReasonService; - - @Captor - private ArgumentCaptor captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void test_create() throws IOException, Exception { - - when(surrenderReasonService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getSurrenderReasons()); - - mockMvc.perform(post("/surrenderreasons/_create") - .content(resources.readRequest("surrenderreason/surrenderreason_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("surrenderreason/surrenderreason_create_valid_response.json"))); - - } - - @Test - public void test_create_error() throws IOException, Exception { - - when(surrenderReasonService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getSurrenderReasons()); - - mockMvc.perform(post("/surrenderreasons/_create") - .content(resources.readRequest("surrenderreason/surrenderreason_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_update() throws IOException, Exception { - - List surrenderReasons = getSurrenderReasons(); - surrenderReasons.get(0).setId("1"); - - when(surrenderReasonService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(surrenderReasons); - - mockMvc.perform(post("/surrenderreasons/_update") - .content(resources.readRequest("surrenderreason/surrenderreason_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("surrenderreason/surrenderreason_update_valid_response.json"))); - - } - - @Test - public void test_delete() throws IOException, Exception { - - List surrenderReasons = getSurrenderReasons(); - surrenderReasons.get(0).setId("1"); - - when(surrenderReasonService.delete(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(surrenderReasons); - - mockMvc.perform(post("/surrenderreasons/_delete") - .content(resources.readRequest("surrenderreason/surrenderreason_delete_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("surrenderreason/surrenderreason_delete_valid_response.json"))); - - } - - @Test - public void test_update_error() throws IOException, Exception { - - when(surrenderReasonService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getSurrenderReasons()); - - mockMvc.perform(post("/surrenderreasons/_update") - .content(resources.readRequest("surrenderreason/surrenderreason_delete_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_delete_error() throws IOException, Exception { - - when(surrenderReasonService.delete(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getSurrenderReasons()); - - mockMvc.perform(post("/surrenderreasons/_delete") - .content(resources.readRequest("surrenderreason/surrenderreason_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getSurrenderReasons()); - page.getPagedData().get(0).setId("1"); - - when(surrenderReasonService.search(any(SurrenderReasonSearch.class))).thenReturn(page); - - mockMvc.perform(post("/surrenderreasons/_search").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("surrenderreason/surrenderreason_search_valid_response.json"))); - - } - - private List getSurrenderReasons() { - List surrenderReasons = new ArrayList(); - SurrenderReason surrenderReason = SurrenderReason.builder().name("name").description("description").build(); - surrenderReason.setTenantId("default"); - surrenderReasons.add(surrenderReason); - return surrenderReasons; - } - -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/InstrumentAccountCodeMapperTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/InstrumentAccountCodeMapperTest.java deleted file mode 100644 index 8c8fcf065cd..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/InstrumentAccountCodeMapperTest.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.egov.egf.instrument.web.mapper; - -import static org.junit.Assert.assertEquals; - -import org.egov.common.contract.request.User; -import org.egov.egf.instrument.domain.model.InstrumentAccountCode; -import org.egov.egf.instrument.domain.model.InstrumentAccountCodeSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeContract; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeSearchContract; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentAccountCodeMapperTest { - - @InjectMocks - private InstrumentAccountCodeMapper instrumentAccountCodeMapper; - - @Before - public void setup() { - instrumentAccountCodeMapper = new InstrumentAccountCodeMapper(); - } - - @Test - public void test_to_domain() { - - InstrumentAccountCode expectedDomain = instrumentAccountCodeMapper.toDomain(contract()); - - assertEquals(expectedDomain.getId(), domain().getId()); - assertEquals(expectedDomain.getInstrumentType().getId(), domain().getInstrumentType().getId()); - assertEquals(expectedDomain.getAccountCode().getId(), domain().getAccountCode().getId()); - assertEquals(expectedDomain.getCreatedBy().getId(), domain().getCreatedBy().getId()); - assertEquals(expectedDomain.getLastModifiedBy().getId(), domain().getLastModifiedBy().getId()); - assertEquals(expectedDomain.getTenantId(), domain().getTenantId()); - - } - - @Test - public void test_to_contract() { - - InstrumentAccountCodeContract expectedContract = instrumentAccountCodeMapper.toContract(domain()); - - assertEquals(expectedContract.getId(), contract().getId()); - assertEquals(expectedContract.getInstrumentType().getId(), contract().getInstrumentType().getId()); - assertEquals(expectedContract.getAccountCode().getId(), contract().getAccountCode().getId()); - assertEquals(expectedContract.getCreatedBy().getId(), contract().getCreatedBy().getId()); - assertEquals(expectedContract.getLastModifiedBy().getId(), contract().getLastModifiedBy().getId()); - assertEquals(expectedContract.getTenantId(), contract().getTenantId()); - - } - - @Test - public void test_to_search_domain() { - - InstrumentAccountCodeSearch expectedSearchDomain = instrumentAccountCodeMapper.toSearchDomain(searchContract()); - - assertEquals(expectedSearchDomain.getId(), searchDomain().getId()); - assertEquals(expectedSearchDomain.getInstrumentType().getId(), searchDomain().getInstrumentType().getId()); - assertEquals(expectedSearchDomain.getAccountCode().getId(), searchDomain().getAccountCode().getId()); - assertEquals(expectedSearchDomain.getCreatedBy().getId(), searchDomain().getCreatedBy().getId()); - assertEquals(expectedSearchDomain.getLastModifiedBy().getId(), searchDomain().getLastModifiedBy().getId()); - assertEquals(expectedSearchDomain.getTenantId(), searchDomain().getTenantId()); - assertEquals(expectedSearchDomain.getPageSize(), searchDomain().getPageSize()); - assertEquals(expectedSearchDomain.getOffset(), searchDomain().getOffset()); - } - - @Test - public void test_to_search_contract() { - - InstrumentAccountCodeSearchContract expectedSearchContract = instrumentAccountCodeMapper - .toSearchContract(searchDomain()); - - assertEquals(expectedSearchContract.getId(), searchContract().getId()); - assertEquals(expectedSearchContract.getInstrumentType().getId(), searchContract().getInstrumentType().getId()); - assertEquals(expectedSearchContract.getAccountCode().getId(), searchContract().getAccountCode().getId()); - assertEquals(expectedSearchContract.getCreatedBy().getId(), searchContract().getCreatedBy().getId()); - assertEquals(expectedSearchContract.getLastModifiedBy().getId(), searchContract().getLastModifiedBy().getId()); - assertEquals(expectedSearchContract.getTenantId(), searchContract().getTenantId()); - assertEquals(expectedSearchContract.getPageSize(), searchContract().getPageSize()); - assertEquals(expectedSearchContract.getOffset(), searchContract().getOffset()); - - } - - public InstrumentAccountCode domain() { - - InstrumentAccountCode instrumentAccountCode = new InstrumentAccountCode(); - - instrumentAccountCode.setId("id"); - instrumentAccountCode.setInstrumentType(InstrumentType.builder().id("id").build()); - instrumentAccountCode.setAccountCode(ChartOfAccountContract.builder().id("id").build()); - instrumentAccountCode.setCreatedBy(User.builder().id(1l).build()); - instrumentAccountCode.setLastModifiedBy(User.builder().id(1l).build()); - instrumentAccountCode.setTenantId("tenantId"); - - return instrumentAccountCode; - } - - public InstrumentAccountCodeContract contract() { - - InstrumentAccountCodeContract contract = new InstrumentAccountCodeContract(); - - contract.setId("id"); - contract.setInstrumentType(InstrumentTypeContract.builder().id("id").build()); - contract.setAccountCode(ChartOfAccountContract.builder().id("id").build()); - contract.setCreatedBy(User.builder().id(1l).build()); - contract.setLastModifiedBy(User.builder().id(1l).build()); - contract.setTenantId("tenantId"); - - return contract; - } - - public InstrumentAccountCodeSearch searchDomain() { - - InstrumentAccountCodeSearch instrumentAccountCodeSearch = new InstrumentAccountCodeSearch(); - - instrumentAccountCodeSearch.setId("id"); - instrumentAccountCodeSearch.setInstrumentType(InstrumentType.builder().id("id").build()); - instrumentAccountCodeSearch.setAccountCode(ChartOfAccountContract.builder().id("id").build()); - instrumentAccountCodeSearch.setCreatedBy(User.builder().id(1l).build()); - instrumentAccountCodeSearch.setLastModifiedBy(User.builder().id(1l).build()); - instrumentAccountCodeSearch.setTenantId("tenantId"); - instrumentAccountCodeSearch.setPageSize(1); - instrumentAccountCodeSearch.setOffset(1); - - return instrumentAccountCodeSearch; - } - - public InstrumentAccountCodeSearchContract searchContract() { - - InstrumentAccountCodeSearchContract contract = new InstrumentAccountCodeSearchContract(); - - contract.setId("id"); - contract.setInstrumentType(InstrumentTypeContract.builder().id("id").build()); - contract.setAccountCode(ChartOfAccountContract.builder().id("id").build()); - contract.setCreatedBy(User.builder().id(1l).build()); - contract.setLastModifiedBy(User.builder().id(1l).build()); - contract.setTenantId("tenantId"); - contract.setPageSize(1); - contract.setOffset(1); - - return contract; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/InstrumentMapperTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/InstrumentMapperTest.java deleted file mode 100644 index adce021e1c0..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/InstrumentMapperTest.java +++ /dev/null @@ -1,294 +0,0 @@ -package org.egov.egf.instrument.web.mapper; - -import static org.junit.Assert.assertEquals; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.User; -import org.egov.egf.instrument.domain.model.Instrument; -import org.egov.egf.instrument.domain.model.InstrumentSearch; -import org.egov.egf.instrument.domain.model.InstrumentType; -import org.egov.egf.instrument.domain.model.InstrumentVoucher; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.TransactionType; -import org.egov.egf.instrument.web.contract.InstrumentContract; -import org.egov.egf.instrument.web.contract.InstrumentSearchContract; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.egov.egf.instrument.web.contract.InstrumentVoucherContract; -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; -import org.egov.egf.instrument.web.contract.TransactionTypeContract; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentMapperTest { - - @InjectMocks - private InstrumentMapper instrumentMapper; - - @Before - public void setup() { - instrumentMapper = new InstrumentMapper(); - } - - @Test - public void test_to_domain() { - - Instrument expectedDomain = instrumentMapper.toDomain(contract()); - - assertEquals(expectedDomain.getId(), domain().getId()); - assertEquals(expectedDomain.getAmount(), domain().getAmount()); - assertEquals(expectedDomain.getBank().getId(), domain().getBank().getId()); - assertEquals(expectedDomain.getBankAccount().getId(), domain().getBankAccount().getId()); - assertEquals(expectedDomain.getBranchName(), domain().getBranchName()); - assertEquals(expectedDomain.getDrawer(), domain().getDrawer()); - assertEquals(expectedDomain.getFinancialStatus().getCode(), domain().getFinancialStatus().getCode()); - assertEquals(expectedDomain.getInstrumentType().getId(), domain().getInstrumentType().getId()); - assertEquals(expectedDomain.getSurrenderReason().getId(), domain().getSurrenderReason().getId()); - assertEquals(expectedDomain.getInstrumentVouchers().iterator().next().getInstrument().getId(), - domain().getInstrumentVouchers().iterator().next().getInstrument().getId()); - - assertEquals(expectedDomain.getInstrumentVouchers().iterator().next().getVoucherHeaderId(), - domain().getInstrumentVouchers().iterator().next().getVoucherHeaderId()); - assertEquals(expectedDomain.getPayee(), domain().getPayee()); - assertEquals(expectedDomain.getSerialNo(), domain().getSerialNo()); - assertEquals(expectedDomain.getTransactionNumber(), domain().getTransactionNumber()); - assertEquals(expectedDomain.getTransactionType(), domain().getTransactionType()); - assertEquals(expectedDomain.getCreatedBy().getId(), domain().getCreatedBy().getId()); - assertEquals(expectedDomain.getLastModifiedBy().getId(), domain().getLastModifiedBy().getId()); - assertEquals(expectedDomain.getTenantId(), domain().getTenantId()); - - } - - @Test - public void test_to_contract() { - - InstrumentContract expectedContract = instrumentMapper.toContract(domain()); - - assertEquals(expectedContract.getId(), contract().getId()); - assertEquals(expectedContract.getAmount(), contract().getAmount()); - assertEquals(expectedContract.getBank().getId(), contract().getBank().getId()); - assertEquals(expectedContract.getBankAccount().getId(), contract().getBankAccount().getId()); - assertEquals(expectedContract.getBranchName(), contract().getBranchName()); - assertEquals(expectedContract.getDrawer(), contract().getDrawer()); - assertEquals(expectedContract.getFinancialStatus().getCode(), contract().getFinancialStatus().getCode()); - assertEquals(expectedContract.getInstrumentType().getId(), contract().getInstrumentType().getId()); - assertEquals(expectedContract.getSurrenderReason().getId(), contract().getSurrenderReason().getId()); - assertEquals(expectedContract.getInstrumentVouchers().iterator().next().getInstrument(), - contract().getInstrumentVouchers().iterator().next().getInstrument()); - - assertEquals(expectedContract.getInstrumentVouchers().iterator().next().getVoucherHeaderId(), - contract().getInstrumentVouchers().iterator().next().getVoucherHeaderId()); - assertEquals(expectedContract.getPayee(), contract().getPayee()); - assertEquals(expectedContract.getSerialNo(), contract().getSerialNo()); - assertEquals(expectedContract.getTransactionNumber(), contract().getTransactionNumber()); - assertEquals(expectedContract.getTransactionType(), contract().getTransactionType()); - assertEquals(expectedContract.getCreatedBy().getId(), contract().getCreatedBy().getId()); - assertEquals(expectedContract.getLastModifiedBy().getId(), contract().getLastModifiedBy().getId()); - assertEquals(expectedContract.getTenantId(), contract().getTenantId()); - - } - - @Test - public void test_to_search_domain() { - - InstrumentSearch expectedSearchDomain = instrumentMapper.toSearchDomain(searchContract()); - - assertEquals(expectedSearchDomain.getId(), searchDomain().getId()); - assertEquals(expectedSearchDomain.getAmount(), searchDomain().getAmount()); - assertEquals(expectedSearchDomain.getBank().getId(), searchDomain().getBank().getId()); - assertEquals(expectedSearchDomain.getBankAccount().getId(), searchDomain().getBankAccount().getId()); - assertEquals(expectedSearchDomain.getBranchName(), searchDomain().getBranchName()); - assertEquals(expectedSearchDomain.getDrawer(), searchDomain().getDrawer()); - assertEquals(expectedSearchDomain.getFinancialStatus().getCode(), - searchDomain().getFinancialStatus().getCode()); - assertEquals(expectedSearchDomain.getInstrumentType().getId(), searchDomain().getInstrumentType().getId()); - assertEquals(expectedSearchDomain.getSurrenderReason().getId(), searchDomain().getSurrenderReason().getId()); - - assertEquals(expectedSearchDomain.getInstrumentVouchers().iterator().next().getVoucherHeaderId(), - searchDomain().getInstrumentVouchers().iterator().next().getVoucherHeaderId()); - assertEquals(expectedSearchDomain.getPayee(), searchDomain().getPayee()); - assertEquals(expectedSearchDomain.getSerialNo(), searchDomain().getSerialNo()); - assertEquals(expectedSearchDomain.getTransactionNumber(), searchDomain().getTransactionNumber()); - assertEquals(expectedSearchDomain.getTransactionType(), searchDomain().getTransactionType()); - assertEquals(expectedSearchDomain.getCreatedBy().getId(), searchDomain().getCreatedBy().getId()); - assertEquals(expectedSearchDomain.getLastModifiedBy().getId(), searchDomain().getLastModifiedBy().getId()); - assertEquals(expectedSearchDomain.getTenantId(), searchDomain().getTenantId()); - assertEquals(expectedSearchDomain.getPageSize(), searchDomain().getPageSize()); - assertEquals(expectedSearchDomain.getOffset(), searchDomain().getOffset()); - } - - @Test - public void test_to_search_contract() { - - InstrumentSearchContract expectedSearchContract = instrumentMapper.toSearchContract(searchDomain()); - - assertEquals(expectedSearchContract.getId(), searchContract().getId()); - assertEquals(expectedSearchContract.getAmount(), searchContract().getAmount()); - assertEquals(expectedSearchContract.getBank().getId(), searchContract().getBank().getId()); - assertEquals(expectedSearchContract.getBankAccount().getId(), searchContract().getBankAccount().getId()); - assertEquals(expectedSearchContract.getBranchName(), searchContract().getBranchName()); - assertEquals(expectedSearchContract.getDrawer(), searchContract().getDrawer()); - assertEquals(expectedSearchContract.getFinancialStatus().getCode(), - searchContract().getFinancialStatus().getCode()); - assertEquals(expectedSearchContract.getInstrumentType().getId(), searchContract().getInstrumentType().getId()); - assertEquals(expectedSearchContract.getSurrenderReason().getId(), - searchContract().getSurrenderReason().getId()); - assertEquals(expectedSearchContract.getInstrumentVouchers().iterator().next().getInstrument(), - searchContract().getInstrumentVouchers().iterator().next().getInstrument()); - - assertEquals(expectedSearchContract.getInstrumentVouchers().iterator().next().getVoucherHeaderId(), - searchContract().getInstrumentVouchers().iterator().next().getVoucherHeaderId()); - assertEquals(expectedSearchContract.getPayee(), searchContract().getPayee()); - assertEquals(expectedSearchContract.getSerialNo(), searchContract().getSerialNo()); - assertEquals(expectedSearchContract.getTransactionNumber(), searchContract().getTransactionNumber()); - assertEquals(expectedSearchContract.getTransactionType(), searchContract().getTransactionType()); - assertEquals(expectedSearchContract.getCreatedBy().getId(), searchContract().getCreatedBy().getId()); - assertEquals(expectedSearchContract.getLastModifiedBy().getId(), searchContract().getLastModifiedBy().getId()); - assertEquals(expectedSearchContract.getTenantId(), searchContract().getTenantId()); - assertEquals(expectedSearchContract.getPageSize(), searchContract().getPageSize()); - assertEquals(expectedSearchContract.getOffset(), searchContract().getOffset()); - - } - - public Instrument domain() { - - Instrument instrument = new Instrument(); - - instrument.setId("id"); - instrument.setAmount(BigDecimal.ONE); - instrument.setBank(BankContract.builder().id("id").build()); - instrument.setBankAccount(BankAccountContract.builder().id("id").build()); - instrument.setBranchName("branchName"); - instrument.setDrawer("drawer"); - instrument.setFinancialStatus(FinancialStatusContract.builder().code("code").build()); - instrument.setInstrumentType(InstrumentType.builder().id("id").build()); - instrument.setSurrenderReason(SurrenderReason.builder().id("id").build()); - - List instrumentVouchers = new ArrayList<>(); - - instrumentVouchers.add(InstrumentVoucher.builder().instrument(Instrument.builder().id("id").build()) - .voucherHeaderId("voucherHeaderId").build()); - - instrument.setInstrumentVouchers(instrumentVouchers); - - instrument.setPayee("payee"); - instrument.setSerialNo("serialNo"); - instrument.setTransactionNumber("transactionNumber"); - instrument.setTransactionType(TransactionType.Credit); - instrument.setCreatedBy(User.builder().id(1l).build()); - instrument.setLastModifiedBy(User.builder().id(1l).build()); - instrument.setTenantId("tenantId"); - - return instrument; - } - - public InstrumentContract contract() { - - InstrumentContract contract = new InstrumentContract(); - - contract.setId("id"); - contract.setAmount(BigDecimal.ONE); - contract.setBank(BankContract.builder().id("id").build()); - contract.setBankAccount(BankAccountContract.builder().id("id").build()); - contract.setBranchName("branchName"); - contract.setDrawer("drawer"); - contract.setFinancialStatus(FinancialStatusContract.builder().code("code").build()); - contract.setInstrumentType(InstrumentTypeContract.builder().id("id").build()); - contract.setSurrenderReason(SurrenderReasonContract.builder().id("id").build()); - - List instrumentVouchers = new ArrayList<>(); - - instrumentVouchers.add(InstrumentVoucherContract.builder() - .instrument("id").voucherHeaderId("voucherHeaderId").build()); - - contract.setInstrumentVouchers(instrumentVouchers); - - contract.setPayee("payee"); - contract.setSerialNo("serialNo"); - contract.setTransactionNumber("transactionNumber"); - contract.setTransactionType(TransactionTypeContract.Credit); - contract.setCreatedBy(User.builder().id(1l).build()); - contract.setLastModifiedBy(User.builder().id(1l).build()); - contract.setTenantId("tenantId"); - - return contract; - } - - public InstrumentSearch searchDomain() { - - InstrumentSearch instrumentSearch = new InstrumentSearch(); - - instrumentSearch.setId("id"); - instrumentSearch.setAmount(BigDecimal.ONE); - instrumentSearch.setBank(BankContract.builder().id("id").build()); - instrumentSearch.setBankAccount(BankAccountContract.builder().id("id").build()); - instrumentSearch.setBranchName("branchName"); - instrumentSearch.setDrawer("drawer"); - instrumentSearch.setFinancialStatus(FinancialStatusContract.builder().code("code").build()); - instrumentSearch.setInstrumentType(InstrumentType.builder().id("id").build()); - instrumentSearch.setSurrenderReason(SurrenderReason.builder().id("id").build()); - - List instrumentVouchers = new ArrayList<>(); - - instrumentVouchers.add(InstrumentVoucher.builder().instrument(Instrument.builder().id("id").build()) - .voucherHeaderId("voucherHeaderId").build()); - - instrumentSearch.setInstrumentVouchers(instrumentVouchers); - - instrumentSearch.setPayee("payee"); - instrumentSearch.setSerialNo("serialNo"); - instrumentSearch.setTransactionNumber("transactionNumber"); - instrumentSearch.setTransactionType(TransactionType.Credit); - instrumentSearch.setCreatedBy(User.builder().id(1l).build()); - instrumentSearch.setLastModifiedBy(User.builder().id(1l).build()); - instrumentSearch.setTenantId("tenantId"); - instrumentSearch.setPageSize(1); - instrumentSearch.setOffset(1); - - return instrumentSearch; - } - - public InstrumentSearchContract searchContract() { - - InstrumentSearchContract contract = new InstrumentSearchContract(); - - contract.setId("id"); - contract.setAmount(BigDecimal.ONE); - contract.setBank(BankContract.builder().id("id").build()); - contract.setBankAccount(BankAccountContract.builder().id("id").build()); - contract.setBranchName("branchName"); - contract.setDrawer("drawer"); - contract.setFinancialStatus(FinancialStatusContract.builder().code("code").build()); - contract.setInstrumentType(InstrumentTypeContract.builder().id("id").build()); - contract.setSurrenderReason(SurrenderReasonContract.builder().id("id").build()); - - List instrumentVouchers = new ArrayList<>(); - - instrumentVouchers.add(InstrumentVoucherContract.builder() - .instrument("id").voucherHeaderId("voucherHeaderId").build()); - - contract.setInstrumentVouchers(instrumentVouchers); - - contract.setPayee("payee"); - contract.setSerialNo("serialNo"); - contract.setTransactionNumber("transactionNumber"); - contract.setTransactionType(TransactionTypeContract.Credit); - contract.setCreatedBy(User.builder().id(1l).build()); - contract.setLastModifiedBy(User.builder().id(1l).build()); - contract.setTenantId("tenantId"); - contract.setPageSize(1); - contract.setOffset(1); - - return contract; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/InstrumentTypeMapperTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/InstrumentTypeMapperTest.java deleted file mode 100644 index b0dfd3782d1..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/InstrumentTypeMapperTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * package org.egov.egf.instrument.web.mapper; import static org.junit.Assert.assertEquals; import java.util.ArrayList; import - * java.util.List; import org.egov.common.contract.request.User; import org.egov.egf.instrument.domain.model.InstrumentType; - * import org.egov.egf.instrument.domain.model.InstrumentTypeProperty; import - * org.egov.egf.instrument.domain.model.InstrumentTypeSearch; import org.egov.egf.instrument.domain.model.TransactionType; import - * org.egov.egf.instrument.web.contract.InstrumentTypeContract; import - * org.egov.egf.instrument.web.contract.InstrumentTypePropertyContract; import - * org.egov.egf.instrument.web.contract.InstrumentTypeSearchContract; import - * org.egov.egf.instrument.web.contract.TransactionTypeContract; import org.egov.egf.master.web.contract.FinancialStatusContract; - * import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import - * org.mockito.runners.MockitoJUnitRunner; - * @RunWith(MockitoJUnitRunner.class) public class InstrumentTypeMapperTest { - * @InjectMocks private InstrumentTypeMapper instrumentTypeMapper; - * @Before public void setup() { instrumentTypeMapper = new InstrumentTypeMapper(); } - * @Test public void test_to_domain() { InstrumentType expectedDomain = instrumentTypeMapper.toDomain(contract()); - * assertEquals(expectedDomain.getId(), domain().getId()); assertEquals(expectedDomain.getActive(), domain().getActive()); - * assertEquals(expectedDomain.getDescription(), domain().getDescription()); assertEquals(expectedDomain.getName(), - * domain().getName()); assertEquals(expectedDomain.getInstrumentTypeProperties().get(0).getId(), - * domain().getInstrumentTypeProperties().get(0).getId()); - * assertEquals(expectedDomain.getInstrumentTypeProperties().get(0).getReconciledOncreate(), - * domain().getInstrumentTypeProperties().get(0).getReconciledOncreate()); - * assertEquals(expectedDomain.getInstrumentTypeProperties().get(0).getStatusOnCreate().getCode(), - * domain().getInstrumentTypeProperties().get(0).getStatusOnCreate().getCode()); - * assertEquals(expectedDomain.getInstrumentTypeProperties().get(0).getStatusOnReconcile().getCode(), - * domain().getInstrumentTypeProperties().get(0).getStatusOnReconcile().getCode()); - * assertEquals(expectedDomain.getInstrumentTypeProperties().get(0).getStatusOnUpdate().getCode(), - * domain().getInstrumentTypeProperties().get(0).getStatusOnUpdate().getCode()); - * assertEquals(expectedDomain.getInstrumentTypeProperties().get(0).getTransactionType(), - * domain().getInstrumentTypeProperties().get(0).getTransactionType()); assertEquals(expectedDomain.getCreatedBy().getId(), - * domain().getCreatedBy().getId()); assertEquals(expectedDomain.getLastModifiedBy().getId(), - * domain().getLastModifiedBy().getId()); assertEquals(expectedDomain.getTenantId(), domain().getTenantId()); } - * @Test public void test_to_contract() { InstrumentTypeContract expectedContract = instrumentTypeMapper.toContract(domain()); - * assertEquals(expectedContract.getId(), contract().getId()); assertEquals(expectedContract.getActive(), contract().getActive()); - * assertEquals(expectedContract.getDescription(), contract().getDescription()); assertEquals(expectedContract.getName(), - * contract().getName()); assertEquals(expectedContract.getInstrumentTypeProperties().get(0).getId(), - * contract().getInstrumentTypeProperties().get(0).getId()); - * assertEquals(expectedContract.getInstrumentTypeProperties().get(0).getReconciledOncreate(), - * contract().getInstrumentTypeProperties().get(0).getReconciledOncreate()); - * assertEquals(expectedContract.getInstrumentTypeProperties().get(0).getStatusOnCreate().getCode(), - * contract().getInstrumentTypeProperties().get(0).getStatusOnCreate().getCode()); - * assertEquals(expectedContract.getInstrumentTypeProperties().get(0).getStatusOnReconcile().getCode(), - * contract().getInstrumentTypeProperties().get(0).getStatusOnReconcile().getCode()); - * assertEquals(expectedContract.getInstrumentTypeProperties().get(0).getStatusOnUpdate().getCode(), - * contract().getInstrumentTypeProperties().get(0).getStatusOnUpdate().getCode()); - * assertEquals(expectedContract.getInstrumentTypeProperties().get(0).getTransactionType(), - * contract().getInstrumentTypeProperties().get(0).getTransactionType()); assertEquals(expectedContract.getCreatedBy().getId(), - * contract().getCreatedBy().getId()); assertEquals(expectedContract.getLastModifiedBy().getId(), - * contract().getLastModifiedBy().getId()); assertEquals(expectedContract.getTenantId(), contract().getTenantId()); } - * @Test public void test_to_search_domain() { InstrumentTypeSearch expectedSearchDomain = - * instrumentTypeMapper.toSearchDomain(searchContract()); assertEquals(expectedSearchDomain.getId(), searchDomain().getId()); - * assertEquals(expectedSearchDomain.getActive(), searchDomain().getActive()); assertEquals(expectedSearchDomain.getDescription(), - * searchDomain().getDescription()); assertEquals(expectedSearchDomain.getName(), searchDomain().getName()); - * assertEquals(expectedSearchDomain.getInstrumentTypeProperties().get(0).getId(), - * searchDomain().getInstrumentTypeProperties().get(0).getId()); - * assertEquals(expectedSearchDomain.getInstrumentTypeProperties().get(0).getReconciledOncreate(), - * searchDomain().getInstrumentTypeProperties().get(0).getReconciledOncreate()); - * assertEquals(expectedSearchDomain.getInstrumentTypeProperties().get(0).getStatusOnCreate().getCode(), - * searchDomain().getInstrumentTypeProperties().get(0).getStatusOnCreate().getCode()); - * assertEquals(expectedSearchDomain.getInstrumentTypeProperties().get(0).getStatusOnReconcile().getCode(), - * searchDomain().getInstrumentTypeProperties().get(0).getStatusOnReconcile().getCode()); - * assertEquals(expectedSearchDomain.getInstrumentTypeProperties().get(0).getStatusOnUpdate().getCode(), - * searchDomain().getInstrumentTypeProperties().get(0).getStatusOnUpdate().getCode()); - * assertEquals(expectedSearchDomain.getInstrumentTypeProperties().get(0).getTransactionType(), - * searchDomain().getInstrumentTypeProperties().get(0).getTransactionType()); - * assertEquals(expectedSearchDomain.getCreatedBy().getId(), searchDomain().getCreatedBy().getId()); - * assertEquals(expectedSearchDomain.getLastModifiedBy().getId(), searchDomain().getLastModifiedBy().getId()); - * assertEquals(expectedSearchDomain.getTenantId(), searchDomain().getTenantId()); - * assertEquals(expectedSearchDomain.getPageSize(), searchDomain().getPageSize()); assertEquals(expectedSearchDomain.getOffset(), - * searchDomain().getOffset()); } - * @Test public void test_to_search_contract() { InstrumentTypeSearchContract expectedSearchContract = - * instrumentTypeMapper.toSearchContract(searchDomain()); assertEquals(expectedSearchContract.getId(), searchContract().getId()); - * assertEquals(expectedSearchContract.getActive(), searchContract().getActive()); - * assertEquals(expectedSearchContract.getDescription(), searchContract().getDescription()); - * assertEquals(expectedSearchContract.getName(), searchContract().getName()); - * assertEquals(expectedSearchContract.getInstrumentTypeProperties().get(0).getId(), - * searchContract().getInstrumentTypeProperties().get(0).getId()); - * assertEquals(expectedSearchContract.getInstrumentTypeProperties().get(0).getReconciledOncreate(), - * searchContract().getInstrumentTypeProperties().get(0).getReconciledOncreate()); - * assertEquals(expectedSearchContract.getInstrumentTypeProperties().get(0).getStatusOnCreate().getCode(), - * searchContract().getInstrumentTypeProperties().get(0).getStatusOnCreate().getCode()); - * assertEquals(expectedSearchContract.getInstrumentTypeProperties().get(0).getStatusOnReconcile().getCode(), - * searchContract().getInstrumentTypeProperties().get(0).getStatusOnReconcile().getCode()); - * assertEquals(expectedSearchContract.getInstrumentTypeProperties().get(0).getStatusOnUpdate().getCode(), - * searchContract().getInstrumentTypeProperties().get(0).getStatusOnUpdate().getCode()); - * assertEquals(expectedSearchContract.getInstrumentTypeProperties().get(0).getTransactionType(), - * searchContract().getInstrumentTypeProperties().get(0).getTransactionType()); - * assertEquals(expectedSearchContract.getCreatedBy().getId(), searchContract().getCreatedBy().getId()); - * assertEquals(expectedSearchContract.getLastModifiedBy().getId(), searchContract().getLastModifiedBy().getId()); - * assertEquals(expectedSearchContract.getTenantId(), searchContract().getTenantId()); - * assertEquals(expectedSearchContract.getPageSize(), searchContract().getPageSize()); - * assertEquals(expectedSearchContract.getOffset(), searchContract().getOffset()); } public InstrumentType domain() { - * InstrumentType instrumentType = new InstrumentType(); instrumentType.setId("id"); instrumentType.setActive(true); - * instrumentType.setDescription("description"); instrumentType.setName("name"); List - * instrumentTypeProperties = new ArrayList<>(); - * instrumentTypeProperties.add(InstrumentTypeProperty.builder().id("id").reconciledOncreate(true) - * .statusOnCreate(FinancialStatusContract.builder().code("Create").build()) - * .statusOnReconcile(FinancialStatusContract.builder().code("Reconcile").build()) - * .statusOnUpdate(FinancialStatusContract.builder().code("Update").build()) .transactionType(TransactionType.Credit).build()); - * instrumentType.setInstrumentTypeProperties(instrumentTypeProperties); - * instrumentType.setCreatedBy(User.builder().id(1l).build()); instrumentType.setLastModifiedBy(User.builder().id(1l).build()); - * instrumentType.setTenantId("tenantId"); return instrumentType; } public InstrumentTypeContract contract() { - * InstrumentTypeContract contract = new InstrumentTypeContract(); contract.setId("id"); contract.setActive(true); - * contract.setDescription("description"); contract.setName("name"); List instrumentTypeProperties - * = new ArrayList<>(); instrumentTypeProperties.add(InstrumentTypePropertyContract.builder().id("id").reconciledOncreate(true) - * .statusOnCreate(FinancialStatusContract.builder().code("Create").build()) - * .statusOnReconcile(FinancialStatusContract.builder().code("Reconcile").build()) - * .statusOnUpdate(FinancialStatusContract.builder().code("Update").build()) - * .transactionType(TransactionTypeContract.Credit).build()); contract.setInstrumentTypeProperties(instrumentTypeProperties); - * contract.setCreatedBy(User.builder().id(1l).build()); contract.setLastModifiedBy(User.builder().id(1l).build()); - * contract.setTenantId("tenantId"); return contract; } public InstrumentTypeSearch searchDomain() { InstrumentTypeSearch - * instrumentTypeSearch = new InstrumentTypeSearch(); instrumentTypeSearch.setId("id"); instrumentTypeSearch.setActive(true); - * instrumentTypeSearch.setDescription("description"); instrumentTypeSearch.setName("name"); List - * instrumentTypeProperties = new ArrayList<>(); - * instrumentTypeProperties.add(InstrumentTypeProperty.builder().id("id").reconciledOncreate(true) - * .statusOnCreate(FinancialStatusContract.builder().code("Create").build()) - * .statusOnReconcile(FinancialStatusContract.builder().code("Reconcile").build()) - * .statusOnUpdate(FinancialStatusContract.builder().code("Update").build()) .transactionType(TransactionType.Credit).build()); - * instrumentTypeSearch.setInstrumentTypeProperties(instrumentTypeProperties); - * instrumentTypeSearch.setCreatedBy(User.builder().id(1l).build()); - * instrumentTypeSearch.setLastModifiedBy(User.builder().id(1l).build()); instrumentTypeSearch.setTenantId("tenantId"); - * instrumentTypeSearch.setPageSize(1); instrumentTypeSearch.setOffset(1); return instrumentTypeSearch; } public - * InstrumentTypeSearchContract searchContract() { InstrumentTypeSearchContract contract = new InstrumentTypeSearchContract(); - * contract.setId("id"); contract.setActive(true); contract.setDescription("description"); contract.setName("name"); - * List instrumentTypeProperties = new ArrayList<>(); - * instrumentTypeProperties.add(InstrumentTypePropertyContract.builder().id("id").reconciledOncreate(true) - * .statusOnCreate(FinancialStatusContract.builder().code("Create").build()) - * .statusOnReconcile(FinancialStatusContract.builder().code("Reconcile").build()) - * .statusOnUpdate(FinancialStatusContract.builder().code("Update").build()) - * .transactionType(TransactionTypeContract.Credit).build()); contract.setInstrumentTypeProperties(instrumentTypeProperties); - * contract.setCreatedBy(User.builder().id(1l).build()); contract.setLastModifiedBy(User.builder().id(1l).build()); - * contract.setTenantId("tenantId"); contract.setPageSize(1); contract.setOffset(1); return contract; } } - */ \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/SurrenderReasonMapperTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/SurrenderReasonMapperTest.java deleted file mode 100644 index 16ca711f825..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/mapper/SurrenderReasonMapperTest.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.egov.egf.instrument.web.mapper; - -import static org.junit.Assert.assertEquals; - -import org.egov.common.contract.request.User; -import org.egov.egf.instrument.domain.model.SurrenderReason; -import org.egov.egf.instrument.domain.model.SurrenderReasonSearch; -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; -import org.egov.egf.instrument.web.contract.SurrenderReasonSearchContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class SurrenderReasonMapperTest { - - @InjectMocks - private SurrenderReasonMapper surrenderReasonMapper; - - @Before - public void setup() { - surrenderReasonMapper = new SurrenderReasonMapper(); - } - - @Test - public void test_to_domain() { - - SurrenderReason expectedDomain = surrenderReasonMapper.toDomain(contract()); - - assertEquals(expectedDomain.getId(), domain().getId()); - assertEquals(expectedDomain.getDescription(), domain().getDescription()); - assertEquals(expectedDomain.getName(), domain().getName()); - assertEquals(expectedDomain.getCreatedBy().getId(), domain().getCreatedBy().getId()); - assertEquals(expectedDomain.getLastModifiedBy().getId(), domain().getLastModifiedBy().getId()); - assertEquals(expectedDomain.getTenantId(), domain().getTenantId()); - - } - - @Test - public void test_to_contract() { - - SurrenderReasonContract expectedContract = surrenderReasonMapper.toContract(domain()); - - assertEquals(expectedContract.getId(), contract().getId()); - assertEquals(expectedContract.getDescription(), contract().getDescription()); - assertEquals(expectedContract.getName(), contract().getName()); - assertEquals(expectedContract.getCreatedBy().getId(), contract().getCreatedBy().getId()); - assertEquals(expectedContract.getLastModifiedBy().getId(), contract().getLastModifiedBy().getId()); - assertEquals(expectedContract.getTenantId(), contract().getTenantId()); - - } - - @Test - public void test_to_search_domain() { - - SurrenderReasonSearch expectedSearchDomain = surrenderReasonMapper.toSearchDomain(searchContract()); - - assertEquals(expectedSearchDomain.getId(), searchDomain().getId()); - assertEquals(expectedSearchDomain.getDescription(), searchDomain().getDescription()); - assertEquals(expectedSearchDomain.getName(), searchDomain().getName()); - assertEquals(expectedSearchDomain.getCreatedBy().getId(), searchDomain().getCreatedBy().getId()); - assertEquals(expectedSearchDomain.getLastModifiedBy().getId(), searchDomain().getLastModifiedBy().getId()); - assertEquals(expectedSearchDomain.getTenantId(), searchDomain().getTenantId()); - assertEquals(expectedSearchDomain.getPageSize(), searchDomain().getPageSize()); - assertEquals(expectedSearchDomain.getOffset(), searchDomain().getOffset()); - } - - @Test - public void test_to_search_contract() { - - SurrenderReasonSearchContract expectedSearchContract = surrenderReasonMapper.toSearchContract(searchDomain()); - - assertEquals(expectedSearchContract.getId(), searchContract().getId()); - assertEquals(expectedSearchContract.getDescription(), searchContract().getDescription()); - assertEquals(expectedSearchContract.getName(), searchContract().getName()); - assertEquals(expectedSearchContract.getCreatedBy().getId(), searchContract().getCreatedBy().getId()); - assertEquals(expectedSearchContract.getLastModifiedBy().getId(), searchContract().getLastModifiedBy().getId()); - assertEquals(expectedSearchContract.getTenantId(), searchContract().getTenantId()); - assertEquals(expectedSearchContract.getPageSize(), searchContract().getPageSize()); - assertEquals(expectedSearchContract.getOffset(), searchContract().getOffset()); - - } - - public SurrenderReason domain() { - - SurrenderReason surrenderReason = new SurrenderReason(); - - surrenderReason.setId("id"); - surrenderReason.setDescription("description"); - surrenderReason.setName("name"); - surrenderReason.setCreatedBy(User.builder().id(1l).build()); - surrenderReason.setLastModifiedBy(User.builder().id(1l).build()); - surrenderReason.setTenantId("tenantId"); - - return surrenderReason; - } - - public SurrenderReasonContract contract() { - - SurrenderReasonContract contract = new SurrenderReasonContract(); - - contract.setId("id"); - contract.setDescription("description"); - contract.setName("name"); - contract.setCreatedBy(User.builder().id(1l).build()); - contract.setLastModifiedBy(User.builder().id(1l).build()); - contract.setTenantId("tenantId"); - - return contract; - } - - public SurrenderReasonSearch searchDomain() { - - SurrenderReasonSearch surrenderReasonSearch = new SurrenderReasonSearch(); - - surrenderReasonSearch.setId("id"); - surrenderReasonSearch.setDescription("description"); - surrenderReasonSearch.setName("name"); - surrenderReasonSearch.setCreatedBy(User.builder().id(1l).build()); - surrenderReasonSearch.setLastModifiedBy(User.builder().id(1l).build()); - surrenderReasonSearch.setTenantId("tenantId"); - surrenderReasonSearch.setPageSize(1); - surrenderReasonSearch.setOffset(1); - - return surrenderReasonSearch; - } - - public SurrenderReasonSearchContract searchContract() { - - SurrenderReasonSearchContract contract = new SurrenderReasonSearchContract(); - - contract.setId("id"); - contract.setDescription("description"); - contract.setName("name"); - contract.setCreatedBy(User.builder().id(1l).build()); - contract.setLastModifiedBy(User.builder().id(1l).build()); - contract.setTenantId("tenantId"); - contract.setPageSize(1); - contract.setOffset(1); - - return contract; - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/InstrumentAccountCodeContractRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/InstrumentAccountCodeContractRepositoryTest.java deleted file mode 100644 index 386c3db6a7a..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/InstrumentAccountCodeContractRepositoryTest.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.egov.egf.instrument.web.repository; - -import static org.junit.Assert.assertEquals; -import static org.springframework.test.web.client.ExpectedCount.once; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; - -import org.egov.egf.instrument.utils.RequestJsonReader; -import org.egov.egf.instrument.web.contract.InstrumentAccountCodeContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.test.web.client.MockRestServiceServer; -import org.springframework.web.client.RestTemplate; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentAccountCodeContractRepositoryTest { - - private InstrumentAccountCodeContractRepository instrumentAccountCodeContractRepository; - - private static final String HOST = "http://host"; - - private MockRestServiceServer server; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Before - public void setup() { - final RestTemplate restTemplate = new RestTemplate(); - instrumentAccountCodeContractRepository = new InstrumentAccountCodeContractRepository(HOST, restTemplate); - server = MockRestServiceServer.bindTo(restTemplate).build(); - } - - @Test - public void test_find_by_id() throws Exception { - - server.expect(once(), - requestTo("http://host/egf-instrument/instrumentaccountcodes/_search?id=1&tenantId=default")) - .andExpect(method(HttpMethod.POST)) - .andRespond(withSuccess(resources.getFileContents("instrumentaccountcode/search_by_id_response.json"), - MediaType.APPLICATION_JSON_UTF8)); - - InstrumentAccountCodeContract instrumentAccountCodeContract = new InstrumentAccountCodeContract(); - - instrumentAccountCodeContract.setId("1"); - instrumentAccountCodeContract.setTenantId("default"); - - final InstrumentAccountCodeContract response = instrumentAccountCodeContractRepository - .findById(instrumentAccountCodeContract); - - server.verify(); - - assertEquals("1", response.getId()); - assertEquals("default", response.getTenantId()); - - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/InstrumentContractRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/InstrumentContractRepositoryTest.java deleted file mode 100644 index ad92c09e027..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/InstrumentContractRepositoryTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.egov.egf.instrument.web.repository; - -import static org.junit.Assert.assertEquals; -import static org.springframework.test.web.client.ExpectedCount.once; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; - -import org.egov.egf.instrument.utils.RequestJsonReader; -import org.egov.egf.instrument.web.contract.InstrumentContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.test.web.client.MockRestServiceServer; -import org.springframework.web.client.RestTemplate; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentContractRepositoryTest { - - private InstrumentContractRepository instrumentContractRepository; - - private static final String HOST = "http://host"; - - private MockRestServiceServer server; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Before - public void setup() { - final RestTemplate restTemplate = new RestTemplate(); - instrumentContractRepository = new InstrumentContractRepository(HOST, restTemplate); - server = MockRestServiceServer.bindTo(restTemplate).build(); - } - - @Test - public void test_find_by_id() throws Exception { - - server.expect(once(), requestTo("http://host/egf-instrument/instruments/_search?id=1&tenantId=default")) - .andExpect(method(HttpMethod.POST)) - .andRespond(withSuccess(resources.getFileContents("instrument/search_by_id_response.json"), - MediaType.APPLICATION_JSON_UTF8)); - - InstrumentContract instrumentContract = new InstrumentContract(); - - instrumentContract.setId("1"); - instrumentContract.setTenantId("default"); - - final InstrumentContract response = instrumentContractRepository.findById(instrumentContract); - - server.verify(); - - assertEquals("1", response.getId()); - assertEquals("default", response.getTenantId()); - - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/InstrumentTypeContractRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/InstrumentTypeContractRepositoryTest.java deleted file mode 100644 index bb3786ed078..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/InstrumentTypeContractRepositoryTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.egov.egf.instrument.web.repository; - -import static org.junit.Assert.assertEquals; -import static org.springframework.test.web.client.ExpectedCount.once; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; - -import org.egov.egf.instrument.utils.RequestJsonReader; -import org.egov.egf.instrument.web.contract.InstrumentTypeContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.test.web.client.MockRestServiceServer; -import org.springframework.web.client.RestTemplate; - -@RunWith(MockitoJUnitRunner.class) -public class InstrumentTypeContractRepositoryTest { - - private InstrumentTypeContractRepository instrumentTypeContractRepository; - - private static final String HOST = "http://host"; - - private MockRestServiceServer server; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Before - public void setup() { - final RestTemplate restTemplate = new RestTemplate(); - instrumentTypeContractRepository = new InstrumentTypeContractRepository(HOST, restTemplate); - server = MockRestServiceServer.bindTo(restTemplate).build(); - } - - @Test - public void test_find_by_id() throws Exception { - - server.expect(once(), requestTo("http://host/egf-instrument/instrumenttypes/_search?id=1&tenantId=default")) - .andExpect(method(HttpMethod.POST)) - .andRespond(withSuccess(resources.getFileContents("instrumenttype/search_by_id_response.json"), - MediaType.APPLICATION_JSON_UTF8)); - - InstrumentTypeContract instrumentTypeContract = new InstrumentTypeContract(); - - instrumentTypeContract.setId("1"); - instrumentTypeContract.setTenantId("default"); - - final InstrumentTypeContract response = instrumentTypeContractRepository.findById(instrumentTypeContract); - - server.verify(); - - assertEquals("1", response.getId()); - assertEquals("default", response.getTenantId()); - - } - -} diff --git a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/SurrenderReasonContractRepositoryTest.java b/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/SurrenderReasonContractRepositoryTest.java deleted file mode 100644 index 68af73b98b7..00000000000 --- a/business-services/egf-instrument/src/test/java/org/egov/egf/instrument/web/repository/SurrenderReasonContractRepositoryTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.egov.egf.instrument.web.repository; - -import static org.junit.Assert.assertEquals; -import static org.springframework.test.web.client.ExpectedCount.once; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.method; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; - -import org.egov.egf.instrument.utils.RequestJsonReader; -import org.egov.egf.instrument.web.contract.SurrenderReasonContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.test.web.client.MockRestServiceServer; -import org.springframework.web.client.RestTemplate; - -@RunWith(MockitoJUnitRunner.class) -public class SurrenderReasonContractRepositoryTest { - - private SurrenderReasonContractRepository surrenderReasonContractRepository; - - private static final String HOST = "http://host"; - - private MockRestServiceServer server; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Before - public void setup() { - final RestTemplate restTemplate = new RestTemplate(); - surrenderReasonContractRepository = new SurrenderReasonContractRepository(HOST, restTemplate); - server = MockRestServiceServer.bindTo(restTemplate).build(); - } - - @Test - public void test_find_by_id() throws Exception { - - server.expect(once(), requestTo("http://host/egf-instrument/surrenderreasons/_search?id=1&tenantId=default")) - .andExpect(method(HttpMethod.POST)) - .andRespond(withSuccess(resources.getFileContents("surrenderreason/search_by_id_response.json"), - MediaType.APPLICATION_JSON_UTF8)); - - SurrenderReasonContract surrenderReasonContract = new SurrenderReasonContract(); - - surrenderReasonContract.setId("1"); - surrenderReasonContract.setTenantId("default"); - - final SurrenderReasonContract response = surrenderReasonContractRepository.findById(surrenderReasonContract); - - server.verify(); - - assertEquals("1", response.getId()); - assertEquals("default", response.getTenantId()); - - } - -} diff --git a/business-services/egf-instrument/src/test/resources/application.properties b/business-services/egf-instrument/src/test/resources/application.properties deleted file mode 100644 index e8c1136c21b..00000000000 --- a/business-services/egf-instrument/src/test/resources/application.properties +++ /dev/null @@ -1,67 +0,0 @@ -persist.through.kafka=yes - -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/postgres -spring.datasource.username=postgres -spring.datasource.password=postgres - -flyway.enabled=true -flyway.user=postgres -flyway.password=postgres -flyway.outOfOrder=true -flyway.table=egf_instrument_schema_version -flyway.baseline-on-migrate=true -flyway.url=jdbc:postgresql://localhost:5432/postgres -#flyway.locations=db/migration/main,db/migration/seed - -spring.jpa.showSql=true -spring.jpa.database=POSTGRESQL -spring.data.jpa.repositories.enabled=true -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl -spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl -spring.jpa.open-in-view=true - -app.timezone=UTC - -fetch_data_from=db - -es.host=localhost -es.transport.port=9300 -es.cluster.name=docker-cluster -es.fund.index.name=fund -es.fund.document.type=fund - -#Kafka Topic config - -#Kafka Topic config - -kafka.topics.egf.instrument.validated.topic=egov.egf.instrument.validated.topic -kafka.topics.egf.instrument.validated.group=egov.egf.instrument.validated.group -kafka.topics.egf.instrument.validated.id=egov.egf.instrument.validated.id - -kafka.topics.egf.instrument.completed.topic=egov.egf.instrument.completed -kafka.topics.egf.instrument.completed.group=egov.egf.instrument.completed.group - -kafka.topics.egf.instrument.instrument.accountcode.validated.key=egov.egf.instrument.instrument.accountcode.validated.key -kafka.topics.egf.instrument.instrument.validated.key=egov.egf.instrument.budgetdetail.validated.key -kafka.topics.egf.instrument.instrument.type.validated.key=egov.egf.instrument.budgetreapp.validated.key -kafka.topics.egf.instrument.surrender.reason.validated.key=egov.egf.instrument.surrender.reason.validated.key - -kafka.topics.egf.instrument.instrument.accountcode.completed.key=egov.egf.instrument.instrument.accountcode.completed.key -kafka.topics.egf.instrument.instrument.completed.key=egov.egf.instrument.instrument.completed.key -kafka.topics.egf.instrument.instrument.type.completed.key=egov.egf.instrument.instrument.type.completed.key -kafka.topics.egf.instrument.surrender.reason.completed.key=egov.egf.instrument.surrender.reason.completed.key - - -egf.instrument.host.url=http://localhost:8480 - -egf.master.host.url=http://localhost:8280 - -logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} - - -spring.kafka.consumer.value-deserializer=org.egov.common.queue.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=egf-instrument -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/common/error_info.json b/business-services/egf-instrument/src/test/resources/common/error_info.json deleted file mode 100644 index 4fb97d8c4f3..00000000000 --- a/business-services/egf-instrument/src/test/resources/common/error_info.json +++ /dev/null @@ -1,8 +0,0 @@ -"responseInfo": { - "resMsgId": null, - "status": 400, - "apiId": null, - "ver": null, - "key": null, - "tenantId": null - } \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/common/error_response.json b/business-services/egf-instrument/src/test/resources/common/error_response.json deleted file mode 100644 index d7f6995f428..00000000000 --- a/business-services/egf-instrument/src/test/resources/common/error_response.json +++ /dev/null @@ -1,7 +0,0 @@ -"error": - { - "code":null, - "message":"sample", - "description":"sample", - "filelds":[] - } \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/common/request_info.json b/business-services/egf-instrument/src/test/resources/common/request_info.json deleted file mode 100644 index f01cf8c2d0d..00000000000 --- a/business-services/egf-instrument/src/test/resources/common/request_info.json +++ /dev/null @@ -1,8 +0,0 @@ -"requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - } \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/common/response_info.json b/business-services/egf-instrument/src/test/resources/common/response_info.json deleted file mode 100644 index 04cae36133a..00000000000 --- a/business-services/egf-instrument/src/test/resources/common/response_info.json +++ /dev/null @@ -1,6 +0,0 @@ -"responseInfo": { - "resMsgId": "placeholder", - "status": "placeholder", - "apiId": null, - "ver": null - } \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_create_invalid_field_value.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_create_invalid_field_value.json deleted file mode 100644 index dfd58573342..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_create_invalid_field_value.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "instruments": [ - { - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType":"Credit", - "instrumentType": - { - "name":"instrumenttype" - } - , - "serialNo":"serialNo", - "tenantId": "default" - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_create_valid_request.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_create_valid_request.json deleted file mode 100644 index 0be77194021..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_create_valid_request.json +++ /dev/null @@ -1,15 +0,0 @@ -"instruments": [ - { - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType":"Credit", - "instrumentType": - { - "name":"instrumenttype" - } - , - "serialNo":"serialNo", - "tenantId": "default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_create_valid_response.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_create_valid_response.json deleted file mode 100644 index caf4a37474f..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_create_valid_response.json +++ /dev/null @@ -1,16 +0,0 @@ -"instruments": [ - { - "id": null, - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType":"Credit", - "instrumentType": - { - "name":"instrumenttype" - } - , - "serialNo":"serialNo", - "tenantId": "default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_delete_invalid_field_value.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_delete_invalid_field_value.json deleted file mode 100644 index dfd58573342..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_delete_invalid_field_value.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "instruments": [ - { - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType":"Credit", - "instrumentType": - { - "name":"instrumenttype" - } - , - "serialNo":"serialNo", - "tenantId": "default" - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_delete_valid_request.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_delete_valid_request.json deleted file mode 100644 index b9ba4ace559..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_delete_valid_request.json +++ /dev/null @@ -1,16 +0,0 @@ -"instruments": [ - { - "id":"1", - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType":"Credit", - "instrumentType": - { - "name":"instrumenttype" - } - , - "serialNo":"serialNo", - "tenantId": "default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_delete_valid_response.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_delete_valid_response.json deleted file mode 100644 index b9ba4ace559..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_delete_valid_response.json +++ /dev/null @@ -1,16 +0,0 @@ -"instruments": [ - { - "id":"1", - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType":"Credit", - "instrumentType": - { - "name":"instrumenttype" - } - , - "serialNo":"serialNo", - "tenantId": "default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_deposit_valid_request.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_deposit_valid_request.json deleted file mode 100644 index 17bfe00e94c..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_deposit_valid_request.json +++ /dev/null @@ -1,8 +0,0 @@ -"instruments": [ - { - "id": "726bb79942b24a75815fc11172cef45e", - "remittanceVoucherId":"anonymousbarath", - "tenantId": "default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_deposit_valid_response.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_deposit_valid_response.json deleted file mode 100644 index 9ef52065f08..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_deposit_valid_response.json +++ /dev/null @@ -1,15 +0,0 @@ - "instruments": [ - { - "id": "726bb79942b24a75815fc11172cef45e", - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType": "Debit", - "financialStatus": { - "id": "a167095b-5a73-4e61-b489-af31f053c4e1", - "moduleType": "Instrument", - "code": "Deposited" - }, - "serialNo":"serialNo", - "tenantId": "default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_dishonor_valid_request.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_dishonor_valid_request.json deleted file mode 100644 index 17bfe00e94c..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_dishonor_valid_request.json +++ /dev/null @@ -1,8 +0,0 @@ -"instruments": [ - { - "id": "726bb79942b24a75815fc11172cef45e", - "remittanceVoucherId":"anonymousbarath", - "tenantId": "default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_dishonor_valid_response.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_dishonor_valid_response.json deleted file mode 100644 index 9ef52065f08..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_dishonor_valid_response.json +++ /dev/null @@ -1,15 +0,0 @@ - "instruments": [ - { - "id": "726bb79942b24a75815fc11172cef45e", - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType": "Debit", - "financialStatus": { - "id": "a167095b-5a73-4e61-b489-af31f053c4e1", - "moduleType": "Instrument", - "code": "Deposited" - }, - "serialNo":"serialNo", - "tenantId": "default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_search_valid_response.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_search_valid_response.json deleted file mode 100644 index 4e281be9e83..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_search_valid_response.json +++ /dev/null @@ -1,25 +0,0 @@ -"instruments": [ - { - "id":"1", - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType":"Credit", - "instrumentType": - { - "name":"instrumenttype" - } - , - "serialNo":"serialNo", - "tenantId": "default" - } - - ], - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } - \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_update_valid_request.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_update_valid_request.json deleted file mode 100644 index b9ba4ace559..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_update_valid_request.json +++ /dev/null @@ -1,16 +0,0 @@ -"instruments": [ - { - "id":"1", - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType":"Credit", - "instrumentType": - { - "name":"instrumenttype" - } - , - "serialNo":"serialNo", - "tenantId": "default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/instrument_update_valid_response.json b/business-services/egf-instrument/src/test/resources/instrument/instrument_update_valid_response.json deleted file mode 100644 index b9ba4ace559..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/instrument_update_valid_response.json +++ /dev/null @@ -1,16 +0,0 @@ -"instruments": [ - { - "id":"1", - "transactionNumber": "transactionNumber", - "amount": 1, - "transactionType":"Credit", - "instrumentType": - { - "name":"instrumenttype" - } - , - "serialNo":"serialNo", - "tenantId": "default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrument/search_by_id_response.json b/business-services/egf-instrument/src/test/resources/instrument/search_by_id_response.json deleted file mode 100644 index fdb245febbd..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrument/search_by_id_response.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "responseInfo": { - "resMsgId": "placeholder", - "status": "placeholder", - "apiId": null, - "ver": null, - "key": null, - "tenantId": null - }, - "instruments": - [ - { - "id": "1", - "tenantId": "default" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_create_invalid_field_value.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_create_invalid_field_value.json deleted file mode 100644 index 8f1d877025d..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_create_invalid_field_value.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "instrumentAccountCodes": [ - { - "instrumentType":{ - "name":"instrumenttype" - }, - "accountCode":{ - "glcode":"glcode" - }, - "tenantId":"default" - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_create_valid_request.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_create_valid_request.json deleted file mode 100644 index ee1743533bb..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_create_valid_request.json +++ /dev/null @@ -1,12 +0,0 @@ -"instrumentAccountCodes": [ - { - "instrumentType":{ - "name":"instrumenttype" - }, - "accountCode":{ - "glcode":"glcode" - }, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_create_valid_response.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_create_valid_response.json deleted file mode 100644 index ce48cbca30a..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_create_valid_response.json +++ /dev/null @@ -1,12 +0,0 @@ -"instrumentAccountCodes": [ - { - "id": null, - "instrumentType": { - "name": "instrumenttype" - }, - "accountCode": { - "glcode":"glcode" - }, - "tenantId": "default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_delete_invalid_field_value.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_delete_invalid_field_value.json deleted file mode 100644 index 8f1d877025d..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_delete_invalid_field_value.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "instrumentAccountCodes": [ - { - "instrumentType":{ - "name":"instrumenttype" - }, - "accountCode":{ - "glcode":"glcode" - }, - "tenantId":"default" - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_delete_valid_request.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_delete_valid_request.json deleted file mode 100644 index 5926c40d252..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_delete_valid_request.json +++ /dev/null @@ -1,13 +0,0 @@ -"instrumentAccountCodes": [ - { - "id":"1", - "instrumentType":{ - "name":"instrumenttype" - }, - "accountCode":{ - "glcode":"glcode" - }, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_delete_valid_response.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_delete_valid_response.json deleted file mode 100644 index a076804cab1..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_delete_valid_response.json +++ /dev/null @@ -1,12 +0,0 @@ -"instrumentAccountCodes": [ - { - "id":"1", - "instrumentType": { - "name": "instrumenttype" - }, - "accountCode": { - "glcode":"glcode" - }, - "tenantId": "default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_search_valid_response.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_search_valid_response.json deleted file mode 100644 index 58481763a55..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_search_valid_response.json +++ /dev/null @@ -1,21 +0,0 @@ -"instrumentAccountCodes": [ - { - "instrumentType":{ - "name":"instrumenttype" - }, - "accountCode":{ - "glcode":"glcode" - }, - "tenantId":"default" - } - - ], - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } - \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_update_valid_request.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_update_valid_request.json deleted file mode 100644 index 5926c40d252..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_update_valid_request.json +++ /dev/null @@ -1,13 +0,0 @@ -"instrumentAccountCodes": [ - { - "id":"1", - "instrumentType":{ - "name":"instrumenttype" - }, - "accountCode":{ - "glcode":"glcode" - }, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_update_valid_response.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_update_valid_response.json deleted file mode 100644 index a076804cab1..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/instrumentaccountcode_update_valid_response.json +++ /dev/null @@ -1,12 +0,0 @@ -"instrumentAccountCodes": [ - { - "id":"1", - "instrumentType": { - "name": "instrumenttype" - }, - "accountCode": { - "glcode":"glcode" - }, - "tenantId": "default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/search_by_id_response.json b/business-services/egf-instrument/src/test/resources/instrumentaccountcode/search_by_id_response.json deleted file mode 100644 index f7266c05646..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumentaccountcode/search_by_id_response.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "responseInfo": { - "resMsgId": "placeholder", - "status": "placeholder", - "apiId": null, - "ver": null, - "key": null, - "tenantId": null - }, - "instrumentAccountCodes": - [ - { - "id": "1", - "tenantId": "default" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_create_invalid_field_value.json b/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_create_invalid_field_value.json deleted file mode 100644 index 8cf8f6dc9fb..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_create_invalid_field_value.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "instrumentTypes": [ - { - "name":"name", - "description":"description", - "active":true, - "tenantId":"default" - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_create_valid_request.json b/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_create_valid_request.json deleted file mode 100644 index b21bbe2f452..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_create_valid_request.json +++ /dev/null @@ -1,9 +0,0 @@ -"instrumentTypes": [ - { - "name":"name", - "description":"description", - "active":true, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_create_valid_response.json b/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_create_valid_response.json deleted file mode 100644 index 351e2ce8600..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_create_valid_response.json +++ /dev/null @@ -1,10 +0,0 @@ -"instrumentTypes": [ - { - "id": null, - "name":"name", - "description":"description", - "active":true, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_delete_invalid_field_value.json b/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_delete_invalid_field_value.json deleted file mode 100644 index 8cf8f6dc9fb..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_delete_invalid_field_value.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "instrumentTypes": [ - { - "name":"name", - "description":"description", - "active":true, - "tenantId":"default" - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_delete_valid_request.json b/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_delete_valid_request.json deleted file mode 100644 index 6adf60383e1..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_delete_valid_request.json +++ /dev/null @@ -1,10 +0,0 @@ -"instrumentTypes": [ - { - "id":"1", - "name":"name", - "description":"description", - "active":true, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_delete_valid_response.json b/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_delete_valid_response.json deleted file mode 100644 index 6adf60383e1..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_delete_valid_response.json +++ /dev/null @@ -1,10 +0,0 @@ -"instrumentTypes": [ - { - "id":"1", - "name":"name", - "description":"description", - "active":true, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_search_valid_response.json b/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_search_valid_response.json deleted file mode 100644 index abf060354fb..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_search_valid_response.json +++ /dev/null @@ -1,18 +0,0 @@ -"instrumentTypes": [ - { - "name":"name", - "description":"description", - "active":true, - "tenantId":"default" - } - - ], - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } - \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_update_valid_request.json b/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_update_valid_request.json deleted file mode 100644 index 6adf60383e1..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_update_valid_request.json +++ /dev/null @@ -1,10 +0,0 @@ -"instrumentTypes": [ - { - "id":"1", - "name":"name", - "description":"description", - "active":true, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_update_valid_response.json b/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_update_valid_response.json deleted file mode 100644 index 6adf60383e1..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/instrumenttype_update_valid_response.json +++ /dev/null @@ -1,10 +0,0 @@ -"instrumentTypes": [ - { - "id":"1", - "name":"name", - "description":"description", - "active":true, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/instrumenttype/search_by_id_response.json b/business-services/egf-instrument/src/test/resources/instrumenttype/search_by_id_response.json deleted file mode 100644 index 184fcc4ec7b..00000000000 --- a/business-services/egf-instrument/src/test/resources/instrumenttype/search_by_id_response.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "responseInfo": { - "resMsgId": "placeholder", - "status": "placeholder", - "apiId": null, - "ver": null, - "key": null, - "tenantId": null - }, - "instrumentTypes": - [ - { - "id": "1", - "tenantId": "default" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrument/clearInstrument.sql b/business-services/egf-instrument/src/test/resources/sql/instrument/clearInstrument.sql deleted file mode 100644 index a86d6b48ca1..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrument/clearInstrument.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_instrument; \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrument/insertInstrumentData.sql b/business-services/egf-instrument/src/test/resources/sql/instrument/insertInstrumentData.sql deleted file mode 100644 index c09ac5398e3..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrument/insertInstrumentData.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_instrument (id,transactionDate,transactionNumber,amount,instrumentTypeId,bankId,branchName,bankAccountId,financialStatusId,remittanceVoucherId,transactionType,payee,drawer,surrenderReasonId,serialNo,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantid) -values('1','07-27-2017','transactionNumber',1,'name','code','branchName','accountNumber','1','1','Credit','payee','drawer','1','serialNo',1,now(),1,now(),'default'); \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrumentaccountcode/clearInstrumentAccountCode.sql b/business-services/egf-instrument/src/test/resources/sql/instrumentaccountcode/clearInstrumentAccountCode.sql deleted file mode 100644 index 51048ac501c..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrumentaccountcode/clearInstrumentAccountCode.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_instrumentaccountcode; \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql b/business-services/egf-instrument/src/test/resources/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql deleted file mode 100644 index 96834537929..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrumentaccountcode/insertInstrumentAccountCodeData.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_instrumentaccountcode (id,instrumentTypeId,accountCodeId,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantid) -values('1','name','glcode',1,now(),1,now(),'default'); \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrumenttype/clearInstrumentType.sql b/business-services/egf-instrument/src/test/resources/sql/instrumenttype/clearInstrumentType.sql deleted file mode 100644 index 106c0d8573f..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrumenttype/clearInstrumentType.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_instrumenttype; \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrumenttype/insertInstrumentTypeData.sql b/business-services/egf-instrument/src/test/resources/sql/instrumenttype/insertInstrumentTypeData.sql deleted file mode 100644 index a7cd50cb1d9..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrumenttype/insertInstrumentTypeData.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_instrumenttype (id,name,description,active,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantid) -values('1','name','description',true,1,now(),1,now(),'default'); \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql b/business-services/egf-instrument/src/test/resources/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql deleted file mode 100644 index 47b8ec06e7c..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrumenttypeproperty/clearInstrumentTypeProperty.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_instrumenttypeproperty; \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql b/business-services/egf-instrument/src/test/resources/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql deleted file mode 100644 index 2914cd856d1..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrumenttypeproperty/insertInstrumentTypePropertyData.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_instrumenttypeproperty (id,transactionType,reconciledOncreate,statusOnCreateId,statusOnUpdateId,statusOnReconcileId,instrumentTypeId,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantid) -values('1','Credit',true,'created','updated','reconciled','1',1,now(),1,now(),'default'); \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrumentvoucher/clearInstrumentVoucher.sql b/business-services/egf-instrument/src/test/resources/sql/instrumentvoucher/clearInstrumentVoucher.sql deleted file mode 100644 index 89896c95f90..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrumentvoucher/clearInstrumentVoucher.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_instrumentvoucher; \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/instrumentvoucher/insertInstrumentVoucherData.sql b/business-services/egf-instrument/src/test/resources/sql/instrumentvoucher/insertInstrumentVoucherData.sql deleted file mode 100644 index b0d3a6ad5a4..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/instrumentvoucher/insertInstrumentVoucherData.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_instrumentvoucher (id,instrumentId,voucherHeaderId,receiptHeaderId,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantid) -values('1','1','1','1',1,now(),1,now(),'default'); \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/surrenderreason/clearSurrenderReason.sql b/business-services/egf-instrument/src/test/resources/sql/surrenderreason/clearSurrenderReason.sql deleted file mode 100644 index 16f782ce1f2..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/surrenderreason/clearSurrenderReason.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_surrenderreason; \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/sql/surrenderreason/insertSurrenderReasonData.sql b/business-services/egf-instrument/src/test/resources/sql/surrenderreason/insertSurrenderReasonData.sql deleted file mode 100644 index 5bfe19f44fb..00000000000 --- a/business-services/egf-instrument/src/test/resources/sql/surrenderreason/insertSurrenderReasonData.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_surrenderreason (id,name,description,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantid) -values('1','name','description',1,now(),1,now(),'default'); \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/search_by_id_response.json b/business-services/egf-instrument/src/test/resources/surrenderreason/search_by_id_response.json deleted file mode 100644 index 86a79305c4e..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/search_by_id_response.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "responseInfo": { - "resMsgId": "placeholder", - "status": "placeholder", - "apiId": null, - "ver": null, - "key": null, - "tenantId": null - }, - "surrenderReasons": - [ - { - "id": "1", - "tenantId": "default" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_create_invalid_field_value.json b/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_create_invalid_field_value.json deleted file mode 100644 index 81d6c65803a..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_create_invalid_field_value.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "surrenderReasons": [ - { - "name":"name", - "description":"description", - "tenantId":"default" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_create_valid_request.json b/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_create_valid_request.json deleted file mode 100644 index 8712ac8adcc..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_create_valid_request.json +++ /dev/null @@ -1,7 +0,0 @@ -"surrenderReasons": [ - { - "name":"name", - "description":"description", - "tenantId":"default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_create_valid_response.json b/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_create_valid_response.json deleted file mode 100644 index dfab647b173..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_create_valid_response.json +++ /dev/null @@ -1,8 +0,0 @@ -"surrenderReasons": [ - { - "id": null, - "name":"name", - "description":"description", - "tenantId":"default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_delete_invalid_field_value.json b/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_delete_invalid_field_value.json deleted file mode 100644 index 81d6c65803a..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_delete_invalid_field_value.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "surrenderReasons": [ - { - "name":"name", - "description":"description", - "tenantId":"default" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_delete_valid_request.json b/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_delete_valid_request.json deleted file mode 100644 index 9681ed15d5f..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_delete_valid_request.json +++ /dev/null @@ -1,8 +0,0 @@ -"surrenderReasons": [ - { - "id":"1", - "name":"name", - "description":"description", - "tenantId":"default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_delete_valid_response.json b/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_delete_valid_response.json deleted file mode 100644 index 9681ed15d5f..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_delete_valid_response.json +++ /dev/null @@ -1,8 +0,0 @@ -"surrenderReasons": [ - { - "id":"1", - "name":"name", - "description":"description", - "tenantId":"default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_search_valid_response.json b/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_search_valid_response.json deleted file mode 100644 index 9023cae1563..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_search_valid_response.json +++ /dev/null @@ -1,17 +0,0 @@ -"surrenderReasons": [ - { - "id":"1", - "name":"name", - "description":"description", - "tenantId":"default" - } - ], - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } - \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_update_valid_request.json b/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_update_valid_request.json deleted file mode 100644 index 9681ed15d5f..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_update_valid_request.json +++ /dev/null @@ -1,8 +0,0 @@ -"surrenderReasons": [ - { - "id":"1", - "name":"name", - "description":"description", - "tenantId":"default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_update_valid_response.json b/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_update_valid_response.json deleted file mode 100644 index 9681ed15d5f..00000000000 --- a/business-services/egf-instrument/src/test/resources/surrenderreason/surrenderreason_update_valid_response.json +++ /dev/null @@ -1,8 +0,0 @@ -"surrenderReasons": [ - { - "id":"1", - "name":"name", - "description":"description", - "tenantId":"default" - } - ] \ No newline at end of file diff --git a/business-services/egf-instrument/start.sh b/business-services/egf-instrument/start.sh deleted file mode 100644 index 3dee95b3cad..00000000000 --- a/business-services/egf-instrument/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -if [[ -z "${JAVA_OPTS}" ]];then - export JAVA_OPTS="-Xmx64m -Xms64m" -fi - -java ${JAVA_OPTS} -jar /opt/egov/egf-instrument.jar diff --git a/business-services/egf-master/.gitignore b/business-services/egf-master/.gitignore deleted file mode 100644 index 2af7cefb0a3..00000000000 --- a/business-services/egf-master/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ \ No newline at end of file diff --git a/business-services/egf-master/CHANGELOG.md b/business-services/egf-master/CHANGELOG.md deleted file mode 100644 index fd8cb4fe6da..00000000000 --- a/business-services/egf-master/CHANGELOG.md +++ /dev/null @@ -1,17 +0,0 @@ -# Changelog -All notable changes to this module will be documented in this file. -## 1.1.3 - 2022-01-13 -- Updated to log4j2 version 2.17.1 - -## 1.1.1 - 2021-02-26 - -- Removed unused code throwing exception - -## 1.1.0 - 2020-06-22 - -- Upgraded to `tracer:2.0.0-SNAPSHOT` -- Upgraded to `Spring boot 2.2.6` - -## 1.0.0 - -- Base version diff --git a/business-services/egf-master/LOCALSETUP.md b/business-services/egf-master/LOCALSETUP.md deleted file mode 100644 index 60e06ee809b..00000000000 --- a/business-services/egf-master/LOCALSETUP.md +++ /dev/null @@ -1,18 +0,0 @@ -# Local Setup - -To setup the egf-master service in your local system, clone the [Business services repository](https://github.com/egovernments/business-services). - -## Dependencies - -### Infra Dependency - -- [X] Postgres DB -- [ ] Redis -- [X] Elasticsearch -- [ ] Kafka - - [ ] Consumer - - [ ] Producer - -## Running Locally - -To run the egf-master service locally, no changes required. Service can be started locally without making any changes. diff --git a/business-services/egf-master/README.md b/business-services/egf-master/README.md deleted file mode 100644 index 4c5b7fdf664..00000000000 --- a/business-services/egf-master/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# egf-master service - -egf master service is used to search finance masters. - -### DB UML Diagram - -NA - -### Service Dependencies - -NA - -### Swagger API Contract - -http://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/egov-services/master/docs/financials/contracts/egf-master/v1-0-0.yml#!/ - -## Service Details - -egf master service is used to search finance masters. - -### API Details - -`/chartofaccounts/_search` : API to search chart of accounts -`/financialstatuses/_search` : API to search the instrument status -`/bankaccounts/_search` : API to search bank accounts - -### Kafka Consumers - -NA - -### Kafka Producers - -NA diff --git a/business-services/egf-master/build.wkflo b/business-services/egf-master/build.wkflo deleted file mode 100644 index 9658ce33838..00000000000 --- a/business-services/egf-master/build.wkflo +++ /dev/null @@ -1,9 +0,0 @@ -def build(path, ci_image) { - stage("Build"){ - docker.image("${ci_image}").inside { - sh "cd ${path}; mvn clean test verify deploy -s settings.xml -Dnexus.user=${env.NEXUS_USER} -Dnexus.password=${env.NEXUS_PASSWORD}"; - } - } - } - - return this; \ No newline at end of file diff --git a/business-services/egf-master/mvnw b/business-services/egf-master/mvnw deleted file mode 100644 index 5bf251c0774..00000000000 --- a/business-services/egf-master/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/business-services/egf-master/mvnw.cmd b/business-services/egf-master/mvnw.cmd deleted file mode 100644 index 019bd74d766..00000000000 --- a/business-services/egf-master/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/business-services/egf-master/pom.xml b/business-services/egf-master/pom.xml deleted file mode 100644 index 848fd49a8d9..00000000000 --- a/business-services/egf-master/pom.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - - org.egov - egf-master - 1.1.3-SNAPSHOT - egf-master - egf masters project for egov services - - 2.17.1 - UTF-8 - 1.8 - UTF-8 - 1.18.8 - - - - org.flywaydb - flyway-core - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework.kafka - spring-kafka - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - org.modelmapper - modelmapper - 0.7.5 - - - org.postgresql - postgresql - runtime - - - org.projectlombok - lombok - true - - - io.springfox - springfox-swagger2 - 2.4.0 - - - org.elasticsearch.client - transport - - - org.elasticsearch - elasticsearch - - - org.apache.logging.log4j - log4j-to-slf4j - 2.8.2 - - - org.apache.commons - commons-lang3 - 3.0 - - - commons-io - commons-io - 2.5 - - - org.springframework.boot - spring-boot-starter-test - test - - - org.egov.services - tracer - 2.1.0-SNAPSHOT - - - org.egov.services - services-common - 0.11.1 - - - - - repo.egovernments.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - repo.egovernments.org - eGov ERP Snapshots Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - - maven-deploy-plugin - 2.8.2 - - - default-deploy - deploy - - deploy - - - - - - - diff --git a/business-services/egf-master/settings.xml b/business-services/egf-master/settings.xml deleted file mode 100644 index 092c5ee4b49..00000000000 --- a/business-services/egf-master/settings.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - nexus - central - https://nexus-repo.egovernments.org/nexus/content/groups/public/ - - - - - repo.egovernments.org - ${nexus.user} - ${nexus.password} - - - - com.versioneye - - diff --git a/business-services/egf-master/src/main/java/org/egov/EgfMasterApplication.java b/business-services/egf-master/src/main/java/org/egov/EgfMasterApplication.java deleted file mode 100644 index 174bb3489dc..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/EgfMasterApplication.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.egov; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import org.egov.tracer.config.TracerConfiguration; -import org.egov.tracer.kafka.LogAwareKafkaTemplate; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.transport.client.PreBuiltTransportClient; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -import javax.annotation.PostConstruct; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.TimeZone; - -@Import({ TracerConfiguration.class }) -@SpringBootApplication -public class EgfMasterApplication { - - public static void main(String[] args) { - SpringApplication.run(EgfMasterApplication.class, args); - } - - private static final String CLUSTER_NAME = "cluster.name"; - - @Value("${app.timezone}") - private String timeZone; - - @Value("${es.host}") - private String elasticSearchHost; - - @Value("${es.transport.port}") - private Integer elasticSearchTransportPort; - - @Value("${es.cluster.name}") - private String elasticSearchClusterName; - - private TransportClient client; - - @Autowired - private LogAwareKafkaTemplate logAwareKafkaTemplate; - - @PostConstruct - public void init() throws UnknownHostException { - TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); - Settings settings = Settings.builder().put(CLUSTER_NAME, elasticSearchClusterName).build(); - final InetAddress esAddress = InetAddress.getByName(elasticSearchHost); - final TransportAddress transportAddress = new TransportAddress(esAddress, elasticSearchTransportPort); - client = new PreBuiltTransportClient(settings).addTransportAddress(transportAddress); - } - - @Bean - public MappingJackson2HttpMessageConverter jacksonConverter() { - // DateFormat std=DateFormat.getInstance().f - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - ObjectMapper mapper = new ObjectMapper(); - mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); - mapper.setTimeZone(TimeZone.getTimeZone(timeZone)); - converter.setObjectMapper(mapper); - return converter; - } - - @Bean - public WebMvcConfigurerAdapter webMvcConfigurerAdapter() { - return new WebMvcConfigurerAdapter() { - - @Override - public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { - configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8); - } - - }; - } - - @Bean - public RestTemplate restTemplate() { - return new RestTemplate(); - } - - @Bean - public TransportClient getTransportClient() { - return client; - } - - @Bean - public FlywayMigrationStrategy cleanMigrateStrategy() { - return flyway -> { - flyway.repair(); - flyway.migrate(); - }; - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/EgfMasterAspectj.java b/business-services/egf-master/src/main/java/org/egov/EgfMasterAspectj.java deleted file mode 100644 index 11a3e3792d6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/EgfMasterAspectj.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.egov; - -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import java.util.Arrays; - -@Aspect -@Component -public class EgfMasterAspectj { - - private static final Logger logger = LoggerFactory.getLogger(EgfMasterAspectj.class); - - /* - * This pointcut will execute for all methods - */ - @Pointcut("within(org.egov..*)") - protected void allMethod() { - } - - /* before -> Any resource annotated with @Controller annotation */ - - @Before("allMethod()") - public void logBefore(JoinPoint joinPoint) { - - logger.debug("Entering in Method : " + joinPoint.getSignature().getName()); - logger.debug("Class Name : " + joinPoint.getSignature().getDeclaringTypeName()); - logger.debug("Arguments : " + Arrays.toString(joinPoint.getArgs())); - logger.debug("Target class : " + joinPoint.getTarget().getClass().getName()); - - } - - - /* - * After -> All method within resource annotated with @Controller annotation - * and return a value - */ - - @AfterReturning(pointcut = "allMethod()", returning = "result") - public void logAfter(JoinPoint joinPoint, Object result) { - - - String returnValue = null; - - if (null != result) { - returnValue = result.toString(); - } - - logger.debug("LEAVING: " + joinPoint.getSignature().getName() + " WITH: " + returnValue); - } - - /* - * After -> Any method within resource annotated with @Controller annotation - * throws an exception ...Log it - */ - - @AfterThrowing(pointcut = "allMethod()", throwing = "exception") - public void logAfterThrowing(JoinPoint joinPoint, Throwable exception) { - logger.error("An exception has been thrown in " + joinPoint.getSignature().getName() + " ()"); - logger.error("Cause : " + exception.getCause()); - } - - /* - * Around -> Any method within resource annotated with @Controller - * annotation - */ - - @Around("allMethod()") - public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { - - long start = System.currentTimeMillis(); - try { - String className = joinPoint.getSignature().getDeclaringTypeName(); - String methodName = joinPoint.getSignature().getName(); - Object result = joinPoint.proceed(); - long elapsedTime = System.currentTimeMillis() - start; - logger.debug("Method " + className + "." + methodName + " ()" + " execution time : " + elapsedTime + " ms"); - - return result; - } catch (IllegalArgumentException e) { - logger.error("Illegal argument " + Arrays.toString(joinPoint.getArgs()) + " in " - + joinPoint.getSignature().getName() + "()"); - throw e; - } - } - - - -} diff --git a/business-services/egf-master/src/main/java/org/egov/SetThreadLocals.java b/business-services/egf-master/src/main/java/org/egov/SetThreadLocals.java deleted file mode 100644 index f272e3246b4..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/SetThreadLocals.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.egov; - -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.annotation.*; -import org.aspectj.lang.reflect.CodeSignature; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.repository.AccountCodePurposeESRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import java.lang.reflect.Field; -import java.util.Arrays; - -@Aspect -@Component -public class SetThreadLocals { - public static final Logger LOGGER = LoggerFactory.getLogger(SetThreadLocals.class); - - /** - * A join point is in the web layer if the method is defined - * in a type in the com.xyz.someapp.web package or any sub-package - * under that. - */ - - @Pointcut("within(@org.springframework.web.bind.annotation.RestController *)") - public void inWebLayer() { - System.out.print("---Before Method Execution---inWebLayer()"); - } - - @Before(value = "inWebLayer() ") - public void logMethodAcceptionEntityAnnotatedBean(JoinPoint jp) { - String tenantId = ""; - - String[] paramNames = ((CodeSignature) jp.getSignature()).getParameterNames(); - int i = 0; - int index = Arrays.asList(paramNames).indexOf("tenantId"); - if (index != -1) { - tenantId = (String) jp.getArgs()[index]; - ApplicationThreadLocals.setTenantId(tenantId); - } - - for (Object obj : jp.getArgs()) { - if (obj.getClass().equals(RequestInfo.class)) { - ApplicationThreadLocals.setRequestInfo((RequestInfo) obj); - break; - } - if (obj.toString().contains("requestInfo")) { - try { - Field f = obj.getClass().getDeclaredField("requestInfo"); - if (f != null) { - f.setAccessible(true); - RequestInfo info = (RequestInfo) f.get(obj); - ApplicationThreadLocals.setRequestInfo(info); - break; - } - - } catch (Exception e) { - LOGGER.error("Exception occurred: " + e.getMessage()); - } - } - - - } - } - - @AfterReturning(value = "inWebLayer()") - public void logMethodAcceptionEntityAnnotatedBeanAfter(JoinPoint jp) { - System.out.print("---After Method Execution---inWebLayer()"); - ApplicationThreadLocals.clearValues(); - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/SwaggerConfig.java b/business-services/egf-master/src/main/java/org/egov/SwaggerConfig.java deleted file mode 100644 index 700a50bfaf9..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/SwaggerConfig.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov; - -import org.springframework.context.annotation.Bean; - -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -@EnableSwagger2 -public class SwaggerConfig { - @Bean - public Docket api() { - return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.any()).build(); - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/constants/Constants.java b/business-services/egf-master/src/main/java/org/egov/common/constants/Constants.java deleted file mode 100644 index 853987acd81..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/constants/Constants.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.egov.common.constants; - -public class Constants { - - private Constants() { - - } - - public static final String ACTION_CREATE = "create"; - public static final String ACTION_UPDATE = "update"; - public static final String ACTION_VIEW = "view"; - public static final String ACTION_EDIT = "edit"; - public static final String ACTION_SEARCH = "search"; -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/annotation/Unique.java b/business-services/egf-master/src/main/java/org/egov/common/domain/annotation/Unique.java deleted file mode 100644 index 10ec59b4e7e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/annotation/Unique.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.common.domain.annotation; - -import static java.lang.annotation.ElementType.ANNOTATION_TYPE; -import static java.lang.annotation.ElementType.CONSTRUCTOR; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) -@Retention(RUNTIME) -public @interface Unique { - String[] fields() default { }; -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/CustomBindException.java b/business-services/egf-master/src/main/java/org/egov/common/domain/exception/CustomBindException.java deleted file mode 100644 index d4d69dba400..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/CustomBindException.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.common.domain.exception; - -import org.springframework.validation.BindingResult; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class CustomBindException extends RuntimeException { - - private static final long serialVersionUID = 8861914629969408745L; - - private BindingResult errors; - - public CustomBindException(BindingResult errors) { - this.errors = errors; - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/ErrorCode.java b/business-services/egf-master/src/main/java/org/egov/common/domain/exception/ErrorCode.java deleted file mode 100644 index a4cdd64af55..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/ErrorCode.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.egov.common.domain.exception; - -import java.util.HashMap; -import java.util.Map; -/** - * - * @author mani - * List of Domain Error codes with message and detailed description - * Donot auto format this file - */ -public enum ErrorCode { - - KAFKA_TIMEOUT_ERROR( - "org.egov.service.kafka.timeout", - "time out while waiting for kafka", - "Some required service is down. Please contact Administrator"), - NON_UNIQUE_VALUE( - "non.unique.value", - "the field {0} must be unique in the system", - "The value {1} for the field {0} already exists in the system. Please provide different value"), - NULL_VALUE("null.value", - "the field {0} must be not be null", - "The value {1} for the field {0} not allowed in the system. Please provide correct value"), - MANDATORY_VALUE_MISSING("mandatory.value.missing", - "the field {0} must be not be null or empty", - "the field {0} is Mandatory .It cannot be not be null or empty.Please provide correct value"), - NOT_NULL("NotNull", - "the field {0} must be not be null", - "The value {1} for the field {0} not allowed in the system. Please provide correct value"), - INVALID_REF_VALUE("invalid.ref.value", - "the field {0} should have a valid value which exists in the system. ", - "The value {1} for the field {0} does exist in system. Please provide correct value"); - - - private final String code; - private final String message; - private final String description; - private static final Map errorMap = new HashMap(); - - static { - for (ErrorCode error : ErrorCode.values()) { - errorMap.put(error.code, error); - } - } - - ErrorCode(final String code, final String message, final String description) { - this.code = code; - this.message = message; - this.description = description; - } - - public static ErrorCode getError(String code) { - return errorMap.get(code); - } - - // add getters and setters here: - public String getCode() { - return this.code; - } - - public String getMessage() { - return this.message; - } - - public String getDescription() { - return this.description; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/InvalidDataException.java b/business-services/egf-master/src/main/java/org/egov/common/domain/exception/InvalidDataException.java deleted file mode 100644 index d47138845ea..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/InvalidDataException.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.common.domain.exception; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -public class InvalidDataException extends RuntimeException { - private static final long serialVersionUID = -1509069993620266971L; - public static final String code = "001"; - private String fieldName; - private String messageKey; - private String fieldValue; - - - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/UnauthorizedAccessException.java b/business-services/egf-master/src/main/java/org/egov/common/domain/exception/UnauthorizedAccessException.java deleted file mode 100644 index 8037baa8169..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/UnauthorizedAccessException.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.egov.common.domain.exception; - -public class UnauthorizedAccessException extends RuntimeException { - - private static final long serialVersionUID = -7621995485789137725L; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/ValidationException.java b/business-services/egf-master/src/main/java/org/egov/common/domain/exception/ValidationException.java deleted file mode 100644 index 6f63e84f99f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/exception/ValidationException.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.common.domain.exception; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -public class ValidationException extends RuntimeException { - private static final long serialVersionUID = -1509069993620266971L; - private String fieldName; - private String messageKey; - private String fieldValue; - - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Attribute.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/Attribute.java deleted file mode 100644 index 8f69e85569a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Attribute.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.common.domain.model; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@AllArgsConstructor -@NoArgsConstructor -@Getter -public class Attribute { - - public static final String DATATYPE = "String"; - @JsonProperty("variable") - private Boolean variable; - - @JsonProperty("code") - private String code; - - @JsonProperty("datatype") - private String datatype; - - @JsonProperty("required") - private Boolean required; - - @JsonProperty("datatypeDescription") - private String datatypeDescription; - - @JsonProperty("values") - private List values; - - public static Attribute asStringAttr(String code, String value) { - List valueList = new ArrayList<>(); - valueList.add(new Value(code, value)); - return new Attribute(Boolean.TRUE, code, DATATYPE, Boolean.FALSE, StringUtils.EMPTY, valueList); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Auditable.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/Auditable.java deleted file mode 100644 index 0fe45076f02..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Auditable.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.egov.common.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.egov.common.contract.request.User; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotNull; -import java.util.Date; - -@Setter -@Getter -@AllArgsConstructor -@NoArgsConstructor -public class Auditable { - - /** - * tenantId Unique Identifier of the tenant, Like AP, AP.Kurnool etc. - * represents the client for which the transaction is created. - */ - - @NotNull - @Length(max = 50, min = 5) - protected String tenantId; - /** - * createdBy is the logged in use who is conducting transaction - */ - protected User createdBy; - /** - * lastModifiedBy is the logged in use who is updating transaction - */ - protected User lastModifiedBy; - /** - * createDate date on which trnasaction is created - */ - protected Date createdDate; - /** - * lastModifiedDate date is on which trnasaction is updated lastly - */ - protected Date lastModifiedDate; - - protected String deleteReason; -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/DeletedTransaction.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/DeletedTransaction.java deleted file mode 100644 index 26bcf3174d7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/DeletedTransaction.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.egov.common.domain.model; - - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotNull; -import java.util.Date; - -@Setter -@Getter -@AllArgsConstructor -@NoArgsConstructor -public class DeletedTransaction { - - - protected String id; - - protected String tableName; - - protected String identifier; - - @Length(max = 250) - protected String deleteReason; - - protected Date updatedDate; - - protected String data; - - @NotNull - @Length(max = 50, min = 5) - protected String tenantId; -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/DepartmentDesignation.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/DepartmentDesignation.java deleted file mode 100644 index f0121c69df7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/DepartmentDesignation.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.common.domain.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Data; - -@Data -public class DepartmentDesignation { - - private Long id; - - @JsonProperty("department") - private Long departmentId; - - private Designation designation; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Designation.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/Designation.java deleted file mode 100644 index 2aa89e7b1c0..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Designation.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.egov.common.domain.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import lombok.Data; - -@Data -public class Designation { - - @NotNull - private Long id; - - @NotNull - @Size(min = 3, max = 100) - private String name; - - @NotNull - @Size(min = 3, max = 20) - private String code; - - @Size(max = 250) - private String description; - - private String chartOfAccounts; - - @NotNull - private Boolean active; - - @NotNull - private String tenantId; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Pagination.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/Pagination.java deleted file mode 100644 index 7d23a9f4c58..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Pagination.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.common.domain.model; - -import java.util.List; - -import javax.validation.constraints.Max; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonProperty.Access; - -import lombok.Data; - -@Data -public class Pagination { - - public static int DEFAULT_PAGE_SIZE = 500; - public static int DEFAULT_PAGE_OFFSET = 0; - - private Integer totalResults; - - private Integer totalPages; - - @Max(500l) - private Integer pageSize = DEFAULT_PAGE_SIZE; - - private Integer currentPage; - - private Integer offset = DEFAULT_PAGE_OFFSET; - - @JsonProperty(access = Access.WRITE_ONLY) - List pagedData; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Position.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/Position.java deleted file mode 100644 index 190713f327f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Position.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.common.domain.model; - -import lombok.Data; - -@Data -public class Position { - - private Long id; - - private String name; - - private DepartmentDesignation deptdesig; - - private Boolean isPostOutsourced; - - private Boolean active; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Task.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/Task.java deleted file mode 100644 index cd49c7aede9..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Task.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.egov.common.domain.model; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.NotBlank; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class Task { - - /** - * Id of the task getting updated. This field Maps to Id of the Task or - * ProcessInstance in case of eGov internal Work flow or the Work flow - * Matrix based implementation . - */ - @NotNull - private String id = null; - - /** - * businessKey is the name representing the process flow of the a particular - * Item For example For Financial vouchers work flow process may be defined - * with a businessKey of "voucher_workflow" . For eGov internal work flow - * Implementation it is same as the class name of the java object under - * going work flow. example businessKey "Voucher" - */ - @Length(max = 128, min = 1) - @NotNull - private String businessKey = null; - /** - * type field can be used to further divide the work flow processes. For - * example Voucher might have 4 different flows 1. Expense Work flow 2. - * Contractor Journal Work flow 3. Supplier Journal Work flow 4. General JV - * Work flow Each process is different .Another example is Property might - * have different flows like 1.Create,Transfer,Bifurcation,Update etc. - */ - @Length(max = 128, min = 1) - private String type = null; - /** - * assignee is the position of the user to be set while creating a - * instantiating of Process. For Automatic work flow this comes from the - * process definition for manual work flow it is the position selected from - * the UI. - */ - @NotNull - private Position assignee = null; - - /** - * comments is the comment provided by the user while he is initiating a - * process - */ - @Length(max = 1024, min = 1) - private String comments = null; - /** - * createDate is the date on which the process is instantiated. This is set - * internally by the system . For clients it is read only data - */ - @JsonFormat(pattern = "dd/MM/yyyy") - private Date createdDate = null; - - /** - * lastupdatedSince is the date on which the process is updated last time. - * This is set internally by the system . For clients it is read only data - */ - @JsonFormat(pattern = "dd/MM/yyyy") - private Date lastupdatedSince = null; - - /** - * owner gives the Position current owner of the process. This data is only - * for the display purpose. So it will not be considered in the request . - */ - private Position owner = null; - - /** - * state gives the current state of the process. - */ - - @Length(max = 128, min = 1) - private String state = null; - - /** - * status also another representation of the status of the process - */ - @Length(max = 128, min = 1) - private String status = null; - /** - * url provides the complete url of the work flow item. This link takes you - * to the view of the item along with provision to select the next assignee. - * This data is also configured in work flow type object. This data is also - * read only . UI Can consider this field to redirect to the page or UI can - * be build without consuming this. - */ - @Length(max = 256, min = 1) - private String url = null; - /** - * action represents the action performed by the end user . it can be - * forward,approve,reject,cancel etc For eGov internal work flow these four - * values are confirmed and will do the tasks of - * forwarding,approving,rejecting,cancelling accordingly. This is mandatory - * data in case of manual work flow - */ - @NotBlank - @Length(max = 128, min = 1) - private String action = null; - - /** - * senderName represents who initiated the work flow process. This is the - * logged in users primary position . Also this is set by system by taking - * the logged in users primary position. - */ - - @Length(max = 128, min = 1) - private String senderName; - - /** - * details provides more information on the processs/Task instance. Example - * : In voucher work flow it is VoucherNumber, Property it is the propertyId - * ,Grievance it is the complaint or request number This data is set - * internally by the system which is configured in work flow type - */ - - @Length(max = 128, min = 1) - private String details; - /** - * natureOfTask Detaild Description of the task or process . For example in - * case of voucher it can be set as "Finaicial Voucher Workflow " . This - * data is also configured by the display name of the workflowtype object. - * This data is read only. . - * - */ - @Length(max = 128, min = 1) - private String natureOfTask; - /** - * entity Maps to the json representation of the item under workflow. This - * will be used when work flow considers rule engine. like amount based flow - * etc - */ - private String entity; - - private String tenantId; - - private Map attributes = new HashMap(); - - // To be used to fetch single value attributes - public String getValueForKey(final String key) { - if (Objects.nonNull(attributes) && Objects.nonNull(attributes.get(key))) - return attributes.get(key).getValues().get(0).getName(); - - return ""; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/User.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/User.java deleted file mode 100644 index caa76b40576..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/User.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.common.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -public class User { - private String id; -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Value.java b/business-services/egf-master/src/main/java/org/egov/common/domain/model/Value.java deleted file mode 100644 index aa380100c40..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/domain/model/Value.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.common.domain.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class Value { - - @JsonProperty("key") - private String key = null; - - @JsonProperty("name") - private String name = null; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/persistence/entity/AuditableEntity.java b/business-services/egf-master/src/main/java/org/egov/common/persistence/entity/AuditableEntity.java deleted file mode 100644 index 462b869757c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/persistence/entity/AuditableEntity.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.common.persistence.entity; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Auditable; - -import java.util.Date; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class AuditableEntity { - protected String tenantId; - protected String createdBy; - protected String lastModifiedBy; - protected Date createdDate; - protected Date lastModifiedDate; - protected String deleteReason; - - protected void toDomain(Auditable domain) { - if (createdBy != null) { - if (!createdBy.isEmpty()) - domain.setCreatedBy(User.builder().id(Long.parseLong(this.getCreatedBy())).build()); - } - if (lastModifiedBy != null) { - if (!lastModifiedBy.isEmpty()) - domain.setLastModifiedBy(User.builder().id(Long.parseLong(this.getLastModifiedBy())).build()); - } - domain.setCreatedDate(this.getCreatedDate()); - domain.setLastModifiedDate(this.getLastModifiedDate()); - domain.setTenantId(this.getTenantId()); - domain.setDeleteReason(this.getDeleteReason()); - } - - protected void toEntity(Auditable domain) { - this.setCreatedBy(domain.getCreatedBy() != null ? domain.getCreatedBy().getId().toString() : null); - this.setLastModifiedBy(domain.getLastModifiedBy() != null ? domain.getLastModifiedBy().getId().toString() : null); - this.setCreatedDate(domain.getCreatedDate()); - this.setLastModifiedDate(domain.getLastModifiedDate()); - this.setTenantId(domain.getTenantId()); - this.setDeleteReason(domain.getDeleteReason()); - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/persistence/entity/BaseEntity.java b/business-services/egf-master/src/main/java/org/egov/common/persistence/entity/BaseEntity.java deleted file mode 100644 index b3ce6af1234..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/persistence/entity/BaseEntity.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.egov.common.persistence.entity; - -public class BaseEntity { - private String tennatId; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/persistence/entity/DeletedTransactionEntity.java b/business-services/egf-master/src/main/java/org/egov/common/persistence/entity/DeletedTransactionEntity.java deleted file mode 100644 index 4623154e07d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/persistence/entity/DeletedTransactionEntity.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.egov.common.persistence.entity; - - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotNull; -import java.util.Date; - -@Setter -@Getter -@AllArgsConstructor -@NoArgsConstructor -public class DeletedTransactionEntity { - - - protected String id; - - protected String tableName; - - protected String identifier; - - protected String deleteReason; - - protected Date updatedDate; - - protected String data; - - protected String tenantId; -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/persistence/repository/ESRepository.java b/business-services/egf-master/src/main/java/org/egov/common/persistence/repository/ESRepository.java deleted file mode 100644 index a50eb9128e5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/persistence/repository/ESRepository.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.egov.common.persistence.repository; - -import static org.elasticsearch.index.query.QueryBuilders.termsQuery; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.egov.common.domain.exception.InvalidDataException; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.springframework.stereotype.Repository; - -@Repository -public abstract class ESRepository { - - protected TransportClient esClient; - - public void validateSortByOrder(final String sortBy) { - List sortByList = new ArrayList(); - InvalidDataException invalidDataException = new InvalidDataException(); - if (sortBy.contains(",")) { - sortByList = Arrays.asList(sortBy.split(",")); - } else { - sortByList = Arrays.asList(sortBy); - } - for (String s : sortByList) { - if (s.contains(" ") - && (!s.toLowerCase().trim().endsWith("asc") && !s.toLowerCase().trim().endsWith("desc"))) { - invalidDataException.setFieldName(s.split(" ")[0]); - invalidDataException - .setMessageKey("Please send the proper sortBy order for the field " + s.split(" ")[0]); - throw invalidDataException; - } - } - - } - - public void validateEntityFieldName(String sortBy, final Class object) { - InvalidDataException invalidDataException = new InvalidDataException(); - List sortByList = new ArrayList(); - if (sortBy.contains(",")) { - sortByList = Arrays.asList(sortBy.split(",")); - } else { - sortByList = Arrays.asList(sortBy); - } - Boolean isFieldExist = Boolean.FALSE; - for (String s : sortByList) { - for (int i = 0; i < object.getDeclaredFields().length; i++) { - if (object.getDeclaredFields()[i].getName().equals(s.contains(" ") ? s.split(" ")[0] : s)) { - isFieldExist = Boolean.TRUE; - break; - } else { - isFieldExist = Boolean.FALSE; - } - } - if (!isFieldExist) { - invalidDataException.setFieldName(s.contains(" ") ? s.split(" ")[0] : s); - invalidDataException.setMessageKey("Please send the proper Field Names "); - throw invalidDataException; - } - } - - } - - public List prepareOrderBys(String sortBy) { - List orderByList = new ArrayList(); - List sortByList = new ArrayList(); - if (sortBy.contains(",")) { - sortByList = Arrays.asList(sortBy.split(",")); - } else { - sortByList = Arrays.asList(sortBy); - } - for (String s : sortByList) { - if (s.contains(" ") - && (s.toLowerCase().trim().endsWith("asc") || s.toLowerCase().trim().endsWith("desc"))) { - orderByList.add(s.trim()); - } else { - orderByList.add(s.trim() + " asc"); - } - } - - return orderByList; - } - - public void add(Object fieldValue, String field, BoolQueryBuilder boolQueryBuilder) { - if (fieldValue != null) { - boolQueryBuilder = boolQueryBuilder.filter(termsQuery(field, fieldValue)); - } - - } - - public void in(List fieldValue, String field, BoolQueryBuilder boolQueryBuilder) { - if (fieldValue != null) { - boolQueryBuilder.filter(QueryBuilders.termsQuery(field, fieldValue)); - } - - } - - public void gte(Object fieldValue, String field, BoolQueryBuilder boolQueryBuilder) { - if (fieldValue != null) { - boolQueryBuilder = boolQueryBuilder.filter(QueryBuilders.rangeQuery(field).from(fieldValue)); - } - - } - - public void lte(Object fieldValue, String field, BoolQueryBuilder boolQueryBuilder) { - if (fieldValue != null) { - boolQueryBuilder = boolQueryBuilder.filter(QueryBuilders.rangeQuery(field).to(fieldValue)); - } - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/persistence/repository/JdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/common/persistence/repository/JdbcRepository.java deleted file mode 100644 index dd5731931b0..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/persistence/repository/JdbcRepository.java +++ /dev/null @@ -1,515 +0,0 @@ -package org.egov.common.persistence.repository; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.reflect.FieldUtils; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.entity.AuditableEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -public abstract class JdbcRepository { - public static final Map> allInsertFields = new HashMap>(); - public static final Map> allUpdateFields = new HashMap>(); - public static final Map> allIdentitiferFields = new HashMap>(); - public static final Map allInsertQuery = new HashMap<>(); - public static final Map allUpdateQuery = new HashMap<>(); - public static final Map allSearchQuery = new HashMap<>(); - public static final Map getByIdQuery = new HashMap<>(); - private static final Logger LOG = LoggerFactory.getLogger(JdbcRepository.class); - @Autowired - public JdbcTemplate jdbcTemplate; - @Autowired - public NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - public static synchronized void init(Class T) { - String TABLE_NAME = ""; - - List insertFields = new ArrayList<>(); - List updateFields = new ArrayList<>(); - List uniqueFields = new ArrayList<>(); - - String insertQuery = ""; - String updateQuery = ""; - String searchQuery = ""; - - try { - - TABLE_NAME = (String) T.getDeclaredField("TABLE_NAME").get(null); - } catch (Exception e) { - - } - insertFields.addAll(fetchFields(T)); - uniqueFields.add("id"); - uniqueFields.add("tenantId"); - insertFields.removeAll(uniqueFields); - allInsertQuery.put(T.getSimpleName(), insertQuery(insertFields, TABLE_NAME, uniqueFields)); - updateFields.addAll(insertFields); - updateFields.remove("createdBy"); - updateQuery = updateQuery(updateFields, TABLE_NAME, uniqueFields); - System.out.println(T.getSimpleName() + "--------" + insertFields); - allInsertFields.put(T.getSimpleName(), insertFields); - allUpdateFields.put(T.getSimpleName(), updateFields); - allIdentitiferFields.put(T.getSimpleName(), uniqueFields); - // allInsertQuery.put(T.getSimpleName(), insertQuery); - allUpdateQuery.put(T.getSimpleName(), updateQuery); - getByIdQuery.put(T.getSimpleName(), getByIdQuery(TABLE_NAME, uniqueFields)); - System.out.println(allInsertQuery); - } - - public static String insertQuery(List fields, String tableName, List uniqueFields) { - String iQuery = "insert into :tableName (:fields) values (:params) "; - StringBuilder fieldNames = new StringBuilder(); - StringBuilder paramNames = new StringBuilder(); - int i = 0; - for (String s : fields) { - if (i > 0) { - fieldNames.append(", "); - paramNames.append(", "); - } - fieldNames.append(s); - paramNames.append(":").append(s); - i++; - } - - for (String s : uniqueFields) { - if (i > 0) { - fieldNames.append(", "); - paramNames.append(", "); - } - fieldNames.append(s); - paramNames.append(":").append(s); - i++; - } - - System.out.println(fields); - System.out.println(uniqueFields); - iQuery = iQuery.replace(":fields", fieldNames.toString()).replace(":params", paramNames.toString()) - .replace(":tableName", tableName).toString(); - System.out.println(tableName + "----" + iQuery); - return iQuery; - } - - public static List fetchFields(Class ob) { - List fields = new ArrayList<>(); - for (Field f : ob.getDeclaredFields()) { - if (java.lang.reflect.Modifier.isStatic(f.getModifiers())) { - continue; - } - - fields.add(f.getName()); - } - - for (Field f : AuditableEntity.class.getDeclaredFields()) { - - if (java.lang.reflect.Modifier.isStatic(f.getModifiers())) { - continue; - } - if (f.getName().equalsIgnoreCase("deleteReason")) { - continue; - } - fields.add(f.getName()); - } - return fields; - } - - public static String updateQuery(List fields, String tableName, List uniqueFields) { - String uQuery = "update :tableName set :fields where :uniqueField "; - StringBuilder fieldNameAndParams = new StringBuilder(); - StringBuilder uniqueFieldNameAndParams = new StringBuilder(); - - int i = 0; - for (String s : fields) { - if (i > 0) { - fieldNameAndParams.append(", "); - - } - fieldNameAndParams.append(s).append("=").append(":").append(s); - i++; - } - i = 0; - for (String s : uniqueFields) { - if (i > 0) { - uniqueFieldNameAndParams.append(" and "); - - } - uniqueFieldNameAndParams.append(s).append("=").append(":").append(s); - i++; - } - - uQuery = uQuery.replace(":fields", fieldNameAndParams.toString()) - .replace(":uniqueField", uniqueFieldNameAndParams.toString()).replace(":tableName", tableName) - .toString(); - return uQuery; - } - - public static String getByIdQuery(String tableName, List uniqueFields) { - String uQuery = "select * from :tableName where :uniqueField "; - // StringBuilder fieldNameAndParams = new StringBuilder(); - StringBuilder uniqueFieldNameAndParams = new StringBuilder(); - int i = 0; - - for (String s : uniqueFields) { - if (i > 0) { - uniqueFieldNameAndParams.append(" and "); - - } - uniqueFieldNameAndParams.append(s).append("=").append(":").append(s); - i++; - } - - uQuery = uQuery.replace(":uniqueField", uniqueFieldNameAndParams.toString()).replace(":tableName", tableName) - .toString(); - return uQuery; - } - - - public static Object getValue(Field declaredField, Object obj) { - - Object ob1 = obj; - Object val = null; - while (ob1 != null) { - try { - val = declaredField.get(obj); - break; - } catch (Exception e) { - if (ob1.getClass().getSuperclass() != null) { - ob1 = ob1.getClass().getSuperclass(); - } else { - break; - } - - } - - } - return val; - - } - - public static Field getField(Object obj, String s) { - System.out.println(s); - Field declaredField = null; - Object ob1 = obj; - while (declaredField == null) { - try { - declaredField = ob1.getClass().getDeclaredField(s); - } catch (Exception e) { - try { - declaredField = ob1.getClass().getSuperclass().getDeclaredField(s); - } catch (Exception e1) { - break; - } - } - - } - if (declaredField != null) { - declaredField.setAccessible(true); - } - return declaredField; - } - - public Map paramValues(Object ob, List fields) { - Map paramValues = new LinkedHashMap<>(); - - for (String s : fields) { - Field f = null; - - try { - f = getField(ob, s); - } catch (Exception e) { - } - /* - * try { f = ob.getClass().getSuperclass().getDeclaredField(s); } catch (NoSuchFieldException e1) { - * System.out.println( "Unable to find the field in this class and its super class for field" + s); } } - */ - try { - f.setAccessible(true); - paramValues.put(s, f.get(ob)); - } catch (IllegalArgumentException e1) { - // TODO Auto-generated catch block - LOG.error("Illegal Argument exception occurred: " + e1.getMessage()); - } catch (IllegalAccessException e1) { - // TODO Auto-generated catch block - LOG.error("Illegal access exception occurred: " + e1.getMessage()); - } - } - - return paramValues; - - } - - @Transactional - public Object create(Object ob) { - // System.out.println(allInsertQuery); - ((AuditableEntity) ob).setCreatedDate(new Date()); - ((AuditableEntity) ob).setLastModifiedDate(new Date()); - - String obName = ob.getClass().getSimpleName(); - List> batchValues = new ArrayList<>(); - batchValues.add(paramValues(ob, allInsertFields.get(obName))); - batchValues.get(0).putAll(paramValues(ob, allIdentitiferFields.get(obName))); - System.out.println(obName + "----" + allInsertQuery.get(obName)); - System.out.println(namedParameterJdbcTemplate); - namedParameterJdbcTemplate.batchUpdate(allInsertQuery.get(obName), - batchValues.toArray(new Map[batchValues.size()])); - return ob; - } - - @Transactional - public Object update(Object ob) { - System.out.println(allUpdateQuery); - ((AuditableEntity) ob).setCreatedDate(new Date()); - ((AuditableEntity) ob).setLastModifiedDate(new Date()); - - String obName = ob.getClass().getSimpleName(); - List> batchValues = new ArrayList<>(); - batchValues.add(paramValues(ob, allUpdateFields.get(obName))); - batchValues.get(0).putAll(paramValues(ob, allIdentitiferFields.get(obName))); - System.out.println(obName + "----" + allUpdateQuery.get(obName)); - namedParameterJdbcTemplate.batchUpdate(allUpdateQuery.get(obName), - batchValues.toArray(new Map[batchValues.size()])); - return ob; - } - - @Transactional - public void delete(String tableName, String id) { - String delQuery = "delete from " + tableName + " where id = '" + id + "'"; - jdbcTemplate.execute(delQuery); - } - - @Transactional - public void delete(final String tableName, final String tenantId, final String fieldName, final String fieldValue) { - - final String delQuery = "delete from " + tableName + " where tenantId = '" + tenantId + "' and " + fieldName + " = '" - + fieldValue + "'"; - System.out.println("Delete query" + "----" + delQuery); - jdbcTemplate.execute(delQuery); - } - - public String getSequence(String seqName) { - String seqQuery = "select nextval('" + seqName + "')"; - return String.valueOf(jdbcTemplate.queryForObject(seqQuery, Long.class) + 1); - } - - @Transactional - public void createSequence(String seqName) { - String seqQuery = "create sequence " + seqName + ""; - jdbcTemplate.execute(seqQuery); - } - - public Pagination getPagination(String searchQuery, Pagination page, Map paramValues) { - String countQuery = "select count(*) from (" + searchQuery + ") as x"; - Long count = namedParameterJdbcTemplate.queryForObject(countQuery.toString(), paramValues, Long.class); - Integer totalpages = (int) Math.ceil((double) count / page.getPageSize()); - page.setTotalPages(totalpages); - page.setCurrentPage(page.getOffset()); - return page; - } - - public void validateSortByOrder(final String sortBy) { - List sortByList = new ArrayList(); - InvalidDataException invalidDataException = new InvalidDataException(); - if (sortBy.contains(",")) { - sortByList = Arrays.asList(sortBy.split(",")); - } else { - sortByList = Arrays.asList(sortBy); - } - for (String s : sortByList) { - if (s.contains(" ") - && (!s.toLowerCase().trim().endsWith("asc") && !s.toLowerCase().trim().endsWith("desc"))) { - invalidDataException.setFieldName(s.split(" ")[0]); - invalidDataException - .setMessageKey("Please send the proper sortBy order for the field " + s.split(" ")[0]); - throw invalidDataException; - } - } - - } - - public void validateEntityFieldName(String sortBy, final Class object) { - InvalidDataException invalidDataException = new InvalidDataException(); - List sortByList = new ArrayList(); - if (sortBy.contains(",")) { - sortByList = Arrays.asList(sortBy.split(",")); - } else { - sortByList = Arrays.asList(sortBy); - } - Boolean isFieldExist = Boolean.FALSE; - for (String s : sortByList) { - for (int i = 0; i < object.getDeclaredFields().length; i++) { - if (object.getDeclaredFields()[i].getName().equals(s.contains(" ") ? s.split(" ")[0] : s)) { - isFieldExist = Boolean.TRUE; - break; - } else { - isFieldExist = Boolean.FALSE; - } - } - if (!isFieldExist) { - invalidDataException.setFieldName(s.contains(" ") ? s.split(" ")[0] : s); - invalidDataException.setMessageKey("Please send the proper Field Names "); - throw invalidDataException; - } - } - - } - - public Boolean uniqueCheck(String fieldName, Object ob) { - LOG.info("Unique Checking for field " + fieldName); - - String obName = ob.getClass().getSimpleName(); - List identifierFields = allIdentitiferFields.get(obName); - List> batchValues = new ArrayList<>(); - - // batchValues.get(0).putAll(paramValues(ob, allIdentitiferFields.get(obName))); - Map paramValues = new HashMap<>(); - String table = ""; - try { - table = FieldUtils.readDeclaredField(ob, "TABLE_NAME").toString(); - } catch (IllegalAccessException e) { - throw new RuntimeException("Not able to get Table_name from entity" + obName); - } - StringBuffer uniqueQuery = new StringBuffer( - "select count(*) as count from " + table + " where " + fieldName + "=:fieldValue"); - paramValues.put("fieldValue", getValue(getField(ob, fieldName), ob)); - int i = 0; - for (String s : identifierFields) { - - if (s.equalsIgnoreCase("tenantId")) { - uniqueQuery.append(" and "); - uniqueQuery.append(s).append("=").append(":").append(s); - // implement fallback here - paramValues.put(s, getValue(getField(ob, s), ob)); - continue; - } - if (getValue(getField(ob, s), ob) != null) { - uniqueQuery.append(" and "); - uniqueQuery.append(s).append("!=").append(":").append(s); - paramValues.put(s, getValue(getField(ob, s), ob)); - } - } - - Long count = namedParameterJdbcTemplate.queryForObject(uniqueQuery.toString(), paramValues, Long.class); - LOG.info("Record Count for field " + count); - return count >= 1 ? false : true; - - } - - public Boolean uniqueCheck(String firstFieldName, String secondFieldName, Object ob) { - LOG.info("Unique Checking for combination of fields " + firstFieldName + " & " + secondFieldName); - - String obName = ob.getClass().getSimpleName(); - List identifierFields = allIdentitiferFields.get(obName); - List> batchValues = new ArrayList<>(); - - // batchValues.get(0).putAll(paramValues(ob, allIdentitiferFields.get(obName))); - Map paramValues = new HashMap<>(); - String table = ""; - try { - table = FieldUtils.readDeclaredField(ob, "TABLE_NAME").toString(); - } catch (IllegalAccessException e) { - throw new RuntimeException("Not able to get Table_name from entity" + obName); - } - StringBuffer uniqueQuery = new StringBuffer("select count(*) as count from " + table + " where " + firstFieldName - + "=:firstFieldValue" + " and " + secondFieldName + "=:secondFieldValue"); - paramValues.put("firstFieldValue", getValue(getField(ob, firstFieldName), ob)); - paramValues.put("secondFieldValue", getValue(getField(ob, secondFieldName), ob)); - int i = 0; - for (String s : identifierFields) { - - if (s.equalsIgnoreCase("tenantId")) { - uniqueQuery.append(" and "); - uniqueQuery.append(s).append("=").append(":").append(s); - // implement fallback here - paramValues.put(s, getValue(getField(ob, s), ob)); - continue; - } - if (getValue(getField(ob, s), ob) != null) { - uniqueQuery.append(" and "); - uniqueQuery.append(s).append("!=").append(":").append(s); - paramValues.put(s, getValue(getField(ob, s), ob)); - } - } - - Long count = namedParameterJdbcTemplate.queryForObject(uniqueQuery.toString(), paramValues, Long.class); - LOG.info("Record Count for combination of fields " + count); - return count >= 1 ? false : true; - - } - - public void delete(Object entity, String reason) { - - String backupTable = "egf_deletedtxn"; - - String obName = entity.getClass().getSimpleName(); - List identifierFields = allIdentitiferFields.get(obName); - List> batchValues = new ArrayList<>(); - - batchValues.add(paramValues(entity, allIdentitiferFields.get(obName))); - Map paramValues = new LinkedHashMap<>(); - Collection values = batchValues.get(0).values(); - for (Object value : values) { - if (value == null) - throw new RuntimeException("id field is null . Delete cannot be performed"); - } - - String table = ""; - try { - table = FieldUtils.readDeclaredField(entity, "TABLE_NAME").toString(); - } catch (IllegalAccessException e) { - throw new RuntimeException("Not able to get Table_name from entity" + obName); - } - paramValues.put("tablename", table); - paramValues.put("reason", reason); - - batchValues.get(0).putAll(paramValues); - StringBuffer backupQuery = new StringBuffer(); - StringBuffer deleteQuery = new StringBuffer(); - backupQuery.append( - "insert into " + backupTable + " select '1',:tablename,id,tenantid,:reason,row_to_json(" + table + "),now() " - + " from " + table + " where tenantid=:tenantId and id=:id "); - System.out.println("query.............." + backupQuery); - namedParameterJdbcTemplate.batchUpdate(backupQuery.toString(), batchValues.toArray(new Map[batchValues.size()])); - deleteQuery.append("delete from " + table + " where "); - int i = 0; - for (String s : identifierFields) { - if (i != 0) - deleteQuery.append(" and "); - if (s.equalsIgnoreCase("tenantId")) { - - deleteQuery.append(s).append("=").append(":").append(s); - // implement fallback here - paramValues.put(s, getValue(getField(entity, s), entity)); - continue; - } - if (getValue(getField(entity, s), entity) != null) { - - deleteQuery.append(s).append("=").append(":").append(s); - paramValues.put(s, getValue(getField(entity, s), entity)); - } - i++; - } - - batchValues.get(0).putAll(paramValues); - - namedParameterJdbcTemplate.batchUpdate(deleteQuery.toString(), batchValues.toArray(new Map[batchValues.size()])); - - // paramValues.put("fieldValue", getValue(getField(ob,fieldName ), ob)); - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/queue/HashMapDeserializer.java b/business-services/egf-master/src/main/java/org/egov/common/queue/HashMapDeserializer.java deleted file mode 100644 index f2553917830..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/queue/HashMapDeserializer.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.egov.common.queue; - -import java.util.HashMap; - -import org.springframework.kafka.support.serializer.JsonDeserializer; -import org.springframework.stereotype.Service; - -@Service -public class HashMapDeserializer extends JsonDeserializer { - - public HashMapDeserializer() { - super(HashMap.class); - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/util/ApplicationThreadLocals.java b/business-services/egf-master/src/main/java/org/egov/common/util/ApplicationThreadLocals.java deleted file mode 100644 index 8e4bfd4ecd0..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/util/ApplicationThreadLocals.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.egov.common.util; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.User; -import org.egov.egf.master.web.contract.RequestInfoWrapper; - -import java.util.ArrayList; -import java.util.List; - - -public class ApplicationThreadLocals { - - private static ThreadLocal tenantId = new ThreadLocal<>(); - private static ThreadLocal fallBackTenantId = new ThreadLocal<>(); - private static ThreadLocal user = new ThreadLocal<>(); - private static ThreadLocal requestInfo = new ThreadLocal<>(); - private static ThreadLocal requestInfoWrapper = new ThreadLocal<>(); - - public static ThreadLocal getTenantId() { - return tenantId; - } - - public static void setTenantId(String tenantId) { - ThreadLocal threadLocal = new ThreadLocal(); - threadLocal.set(tenantId); - ApplicationThreadLocals.tenantId = threadLocal; - threadLocal = new ThreadLocal(); - String str = tenantId; - /* in.ap.kurnool should result in - in,in.ap,in.ap.kurnool*/ - List tenants = new ArrayList<>(); - while (str != null && str.lastIndexOf(".") != -1) { - tenants.add(str); - str = str.substring(0, str.lastIndexOf(".")); - } - if (str != null) - tenants.add(str); - if (!tenants.contains("default")) - tenants.add("default"); - threadLocal.set(tenantId); - System.out.print(tenants); - ApplicationThreadLocals.fallBackTenantId = threadLocal; - } - - public static ThreadLocal getUser() { - return user; - } - - public static void setUser(ThreadLocal user) { - ApplicationThreadLocals.user = user; - } - - public static ThreadLocal getRequestInfo() { - return requestInfo; - } - - public static void setRequestInfo(final RequestInfo requestInfo) { - ThreadLocal threadLocal = new ThreadLocal(); - threadLocal.set(requestInfo); - ApplicationThreadLocals.requestInfo = threadLocal; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - threadLocal = new ThreadLocal(); - threadLocal.set(requestInfoWrapper); - ApplicationThreadLocals.requestInfoWrapper = threadLocal; - } - - public static void clearValues() { - tenantId.remove(); - fallBackTenantId.remove(); - requestInfo.remove(); - requestInfoWrapper.remove(); - user.remove(); - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/util/ElasticSearchUtils.java b/business-services/egf-master/src/main/java/org/egov/common/util/ElasticSearchUtils.java deleted file mode 100644 index e4d531461ea..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/util/ElasticSearchUtils.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.egov.common.util; - -import static org.elasticsearch.index.query.QueryBuilders.termsQuery; - -import java.util.List; - -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.springframework.stereotype.Service; - -@Service -public class ElasticSearchUtils { - - public void add(Object fieldValue, String field, BoolQueryBuilder boolQueryBuilder) { - if (fieldValue != null) { - boolQueryBuilder = boolQueryBuilder.filter(termsQuery(field, fieldValue)); - } - - } - - public void in(List fieldValue, String field, BoolQueryBuilder boolQueryBuilder) { - if (fieldValue != null) { - boolQueryBuilder.filter(QueryBuilders.termsQuery(field, fieldValue)); - } - - } - - public void gte(Object fieldValue, String field, BoolQueryBuilder boolQueryBuilder) { - if (fieldValue != null) { - boolQueryBuilder = boolQueryBuilder.filter(QueryBuilders.rangeQuery(field).from(fieldValue)); - } - - } - - public void lte(Object fieldValue, String field, BoolQueryBuilder boolQueryBuilder) { - if (fieldValue != null) { - boolQueryBuilder = boolQueryBuilder.filter(QueryBuilders.rangeQuery(field).to(fieldValue)); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/AttributeContract.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/AttributeContract.java deleted file mode 100644 index 0a9ff9eca49..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/AttributeContract.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.common.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@AllArgsConstructor -@NoArgsConstructor -@Getter -public class AttributeContract { - - public static final String DATATYPE = "String"; - @JsonProperty("variable") - private Boolean variable; - - @JsonProperty("code") - private String code; - - @JsonProperty("datatype") - private String datatype; - - @JsonProperty("required") - private Boolean required; - - @JsonProperty("datatypeDescription") - private String datatypeDescription; - - @JsonProperty("values") - private List values; - - public static AttributeContract asStringAttr(String code, String value) { - List valueList = new ArrayList<>(); - valueList.add(new ValueContract(code, value)); - return new AttributeContract(Boolean.TRUE, code, DATATYPE, Boolean.FALSE, StringUtils.EMPTY, valueList); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/AuditableContract.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/AuditableContract.java deleted file mode 100644 index c3ea989964a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/AuditableContract.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.egov.common.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.egov.common.contract.request.User; - -import java.util.Date; - -@Setter -@Getter -@AllArgsConstructor -@NoArgsConstructor -public class AuditableContract { - protected String tenantId; - protected User createdBy; - protected User lastModifiedBy; - protected Date createdDate; - protected Date lastModifiedDate; - protected String deleteReason; - - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/DeletedTransactionContract.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/DeletedTransactionContract.java deleted file mode 100644 index 6578b1df310..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/DeletedTransactionContract.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.common.web.contract; - - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.Date; - -@Setter -@Getter -@AllArgsConstructor -@NoArgsConstructor -public class DeletedTransactionContract { - - - protected String id; - - protected String tableName; - - protected String identifier; - - protected String deleteReason; - - protected Date updatedDate; - - protected String data; - - protected String tenantId; -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/DepartmentDesignationContract.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/DepartmentDesignationContract.java deleted file mode 100644 index 36810034867..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/DepartmentDesignationContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.common.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Data; - -@Data -public class DepartmentDesignationContract { - - private Long id; - - @JsonProperty("department") - private Long departmentId; - - private DesignationContract designation; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/DesignationContract.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/DesignationContract.java deleted file mode 100644 index 59fe679544b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/DesignationContract.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.egov.common.web.contract; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import lombok.Data; - -@Data -public class DesignationContract { - - @NotNull - private Long id; - - @NotNull - @Size(min = 3, max = 100) - private String name; - - @NotNull - @Size(min = 3, max = 20) - private String code; - - @Size(max = 250) - private String description; - - private String chartOfAccounts; - - @NotNull - private Boolean active; - - @NotNull - private String tenantId; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/Error.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/Error.java deleted file mode 100644 index 3b4c150501a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/Error.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.common.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.validation.FieldError; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.Data; - -@JsonPropertyOrder({ "code", "message", "description" ,"params"}) -public @Data class Error { - - private String code ; - - private String message ; - - private String description ; - - private List params=new ArrayList<>(); - - public Error(String code, String message, String description) { - super(); - this.code = code; - this.message = message; - this.description = description; - } - - public Error() { - // TODO Auto-generated constructor stub - } - - public Error(String code, String message, String description, List params) { - super(); - this.code = code; - this.message = message; - this.description = description; - this.params = params; - } - - - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ErrorResponse.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/ErrorResponse.java deleted file mode 100644 index b078be37c23..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ErrorResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.common.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@Builder -@EqualsAndHashCode -public class ErrorResponse { - private ResponseInfo responseInfo; - private List errors=new ArrayList<>(); -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/PaginationContract.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/PaginationContract.java deleted file mode 100644 index acc54db6779..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/PaginationContract.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.common.web.contract; - -import javax.validation.constraints.Max; - -import org.egov.common.domain.model.Pagination; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@AllArgsConstructor -@NoArgsConstructor -@Data -public class PaginationContract { - - public static int DEFAULT_PAGE_SIZE = 500; - public static int DEFAULT_PAGE_OFFSET = 0; - - private Integer totalResults; - - private Integer totalPages; - - @Max(500l) - private Integer pageSize; - - private Integer currentPage; - - private Integer offset; - - public PaginationContract(Pagination page) { - this.pageSize = page.getPageSize(); - this.currentPage = page.getCurrentPage(); - this.offset = page.getOffset(); - this.totalPages = page.getTotalPages(); - this.totalResults = page.getTotalResults(); - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/PositionContract.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/PositionContract.java deleted file mode 100644 index c074a798d2f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/PositionContract.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.common.web.contract; - -import lombok.Data; - -@Data -public class PositionContract { - - private Long id; - - private String name; - - private DepartmentDesignationContract deptdesig; - - private Boolean isPostOutsourced; - - private Boolean active; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ProcessInstance.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/ProcessInstance.java deleted file mode 100644 index 00b2e8575a6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ProcessInstance.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.egov.common.web.contract; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AttributeContract; -import org.egov.common.web.contract.PositionContract; -import org.egov.common.web.contract.TaskContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonFormat; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Setter -@Getter -@AllArgsConstructor -@Builder -@NoArgsConstructor -public class ProcessInstance { - - /** - * Id of the ProcessInstance gets created. This field Maps to Id of the Task in case of eGov internal Work flow or the Work - * flow Matrix based Implementation. - */ - - private String id = null; - - /** - * businessKey is the name representing the process flow of the a particular Item For example For Financial vouchers work flow - * process may be defined with a businessKey of "voucher_workflow" . For eGov internal work flow Implementation it is same as - * the class name of the java object under going work flow. example businessKey "Voucher" - */ - @Length(max = 128, min = 1) - @NotNull - private String businessKey = null; - /** - * type field can be used to further divide the work flow processes. For example Voucher might have 4 different flows 1. - * Expense Work flow 2. Contractor Journal Work flow 3. Supplier Journal Work flow 4. General JV Work flow Each process is - * different .Another example is Property might have different flows like 1.Create,Transfer,Bifurcation,Update etc. - */ - @Length(max = 128, min = 1) - private String type = null; - /** - * assignee is the position of the user to be set while creating a instantiating of Process. For Automatic work flow this - * comes from the process definition for manual work flow it is the position selected from the UI. - */ - @NotNull - private PositionContract assignee = null; - - /** - * comments is the comment provided by the user while he is initiating a process - */ - @Length(max = 1024, min = 1) - private String comments = null; - /** - * createDate is the date on which the process is instantiated. This is set internally by the system . For clients it is read - * only data - */ - @JsonFormat(pattern = "dd/MM/yyyy") - private Date createdDate = null; - - /** - * lastupdatedSince is the date on which the process is updated last time. This is set internally by the system . For clients - * it is read only data - */ - @JsonFormat(pattern = "dd/MM/yyyy") - private Date lastupdatedSince = null; - - /** - * owner gives the Position current owner of the process. This data is only for the display purpose. So it will not be - * considered in the request . - */ - private PositionContract owner = null; - - /** - * state gives the current state of the process. - */ - - @Length(max = 128, min = 1) - private String state = null; - - /** - * status also another representation of the status of the process - */ - @Length(max = 128, min = 1) - private String status = null; - - /** - * senderName represents who initiated the work flow process. This is the logged in users primary position . Also this is set - * by system by taking the logged in users primary position. - */ - @Length(max = 128, min = 1) - private String senderName; - - /** - * details provides more information on the processs/Task instance. Example : In voucher work flow it is VoucherNumber, - * Property it is the propertyId ,Grievance it is the complaint or request number This data is set internally by the system - * which is configured in work flow type - */ - - @Length(max = 128, min = 1) - private String details; - - /** - * tasks gives the list of tasks owned by the process. For eGov internal work flow this value will be empty. - * - */ - - List tasks = new ArrayList(); - - private String tenantId; - /** - * attributes used to pass any additional properties which is not defined in here . - */ - private Map attributes = new HashMap(); - - private Long initiatorPosition; - - /* - * @JsonIgnore public String getComments() { return getValueForKey("approvalComments"); } - * @JsonIgnore public boolean isGrievanceOfficer() { return getValueForKey("userRole").equals("Grievance Officer"); } - */ - /* - * public void setStateId(Long stateId) { Value value = new Value("stateId", String.valueOf(stateId)); List - * attributeValues = Collections.singletonList(value); Attribute attribute = new Attribute(true, "stateId", "String", true, - * "This is the id of state", attributeValues,null); attributeValues.put("stateId", attribute); } - */ - // To be used to fetch single value attributes - public String getValueForKey(final String key) { - if (Objects.nonNull(attributes) && Objects.nonNull(attributes.get(key))) - return attributes.get(key).getValues().get(0).getName(); - - return ""; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ProcessInstanceRequest.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/ProcessInstanceRequest.java deleted file mode 100644 index d95c787fdf2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ProcessInstanceRequest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.common.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; - -import lombok.Data; - -public @Data class ProcessInstanceRequest { - - private RequestInfo requestInfo = new RequestInfo(); - - private List processInstances = new ArrayList(); - - private ProcessInstance processInstance = new ProcessInstance(); - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ProcessInstanceResponse.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/ProcessInstanceResponse.java deleted file mode 100644 index ff7e4e68f78..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ProcessInstanceResponse.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.common.web.contract; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class ProcessInstanceResponse { - - private ResponseInfo responseInfo; - - private List processInstances; - - private ProcessInstance processInstance; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/RequestContext.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/RequestContext.java deleted file mode 100644 index 86e784582cd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/RequestContext.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.common.web.contract; - -public class RequestContext { - - public static String CORRELATION_ID = "X-CORRELATION-ID"; - - private static final ThreadLocal id = new ThreadLocal<>(); - - public static String getId() { - return id.get(); - } - - public static void setId(String correlationId) { - id.set(correlationId); - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/TaskContract.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/TaskContract.java deleted file mode 100644 index 44339af6da6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/TaskContract.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.egov.common.web.contract; - -import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.*; -import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.NotBlank; - -import javax.validation.constraints.NotNull; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class TaskContract { - - /** - * Id of the task getting updated. This field Maps to Id of the Task or - * ProcessInstance in case of eGov internal Work flow or the Work flow - * Matrix based implementation . - */ - @NotNull - private String id = null; - - /** - * businessKey is the name representing the process flow of the a particular - * Item For example For Financial vouchers work flow process may be defined - * with a businessKey of "voucher_workflow" . For eGov internal work flow - * Implementation it is same as the class name of the java object under - * going work flow. example businessKey "Voucher" - */ - @Length(max = 128, min = 1) - @NotNull - private String businessKey = null; - /** - * type field can be used to further divide the work flow processes. For - * example Voucher might have 4 different flows 1. Expense Work flow 2. - * Contractor Journal Work flow 3. Supplier Journal Work flow 4. General JV - * Work flow Each process is different .Another example is Property might - * have different flows like 1.Create,Transfer,Bifurcation,Update etc. - */ - @Length(max = 128, min = 1) - private String type = null; - /** - * assignee is the position of the user to be set while creating a - * instantiating of Process. For Automatic work flow this comes from the - * process definition for manual work flow it is the position selected from - * the UI. - */ - @NotNull - private PositionContract assignee = null; - - /** - * comments is the comment provided by the user while he is initiating a - * process - */ - @Length(max = 1024, min = 1) - private String comments = null; - /** - * createDate is the date on which the process is instantiated. This is set - * internally by the system . For clients it is read only data - */ - @JsonFormat(pattern = "dd/MM/yyyy") - private Date createdDate = null; - - /** - * lastupdatedSince is the date on which the process is updated last time. - * This is set internally by the system . For clients it is read only data - */ - @JsonFormat(pattern = "dd/MM/yyyy") - private Date lastupdatedSince = null; - - /** - * owner gives the Position current owner of the process. This data is only - * for the display purpose. So it will not be considered in the request . - */ - private PositionContract owner = null; - - /** - * state gives the current state of the process. - */ - - @Length(max = 128, min = 1) - private String state = null; - - /** - * status also another representation of the status of the process - */ - @Length(max = 128, min = 1) - private String status = null; - /** - * url provides the complete url of the work flow item. This link takes you - * to the view of the item along with provision to select the next assignee. - * This data is also configured in work flow type object. This data is also - * read only . UI Can consider this field to redirect to the page or UI can - * be build without consuming this. - */ - @Length(max = 256, min = 1) - private String url = null; - /** - * action represents the action performed by the end user . it can be - * forward,approve,reject,cancel etc For eGov internal work flow these four - * values are confirmed and will do the tasks of - * forwarding,approving,rejecting,cancelling accordingly. This is mandatory - * data in case of manual work flow - */ - @NotBlank - @Length(max = 128, min = 1) - private String action = null; - - /** - * senderName represents who initiated the work flow process. This is the - * logged in users primary position . Also this is set by system by taking - * the logged in users primary position. - */ - - @Length(max = 128, min = 1) - private String senderName; - - /** - * details provides more information on the processs/Task instance. Example - * : In voucher work flow it is VoucherNumber, Property it is the propertyId - * ,Grievance it is the complaint or request number This data is set - * internally by the system which is configured in work flow type - */ - - @Length(max = 128, min = 1) - private String details; - /** - * natureOfTask Detaild Description of the task or process . For example in - * case of voucher it can be set as "Finaicial Voucher Workflow " . This - * data is also configured by the display name of the workflowtype object. - * This data is read only. . - */ - @Length(max = 128, min = 1) - private String natureOfTask; - /** - * entity Maps to the json representation of the item under workflow. This - * will be used when work flow considers rule engine. like amount based flow - * etc - */ - private String entity; - - private String tenantId; - - private Map attributes = new HashMap(); - - // To be used to fetch single value attributes - public String getValueForKey(final String key) { - if (Objects.nonNull(attributes) && Objects.nonNull(attributes.get(key))) - return attributes.get(key).getValues().get(0).getName(); - - return ""; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/TaskRequest.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/TaskRequest.java deleted file mode 100644 index dc3e088ec51..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/TaskRequest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.common.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.web.contract.TaskContract; - -import lombok.Data; - -public @Data class TaskRequest { - - private RequestInfo requestInfo = new RequestInfo(); - - private List tasks = new ArrayList(); - - private TaskContract task = new TaskContract(); - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/TaskResponse.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/TaskResponse.java deleted file mode 100644 index 2ee7a118f1c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/TaskResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.egov.common.web.contract; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.web.contract.TaskContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class TaskResponse { - - private ResponseInfo responseInfo; - - private List tasks; - - private TaskContract task; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ValueContract.java b/business-services/egf-master/src/main/java/org/egov/common/web/contract/ValueContract.java deleted file mode 100644 index 83539ced044..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/contract/ValueContract.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.common.web.contract; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class ValueContract { - - @JsonProperty("key") - private String key = null; - - @JsonProperty("name") - private String name = null; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/interceptor/CorrelationIdAwareRestTemplate.java b/business-services/egf-master/src/main/java/org/egov/common/web/interceptor/CorrelationIdAwareRestTemplate.java deleted file mode 100644 index 1fe9684301e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/interceptor/CorrelationIdAwareRestTemplate.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.common.web.interceptor; - -import java.util.Collections; -import java.util.List; - -import org.egov.common.web.contract.RequestContext; -import org.springframework.http.HttpHeaders; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.web.client.RestTemplate; - -public class CorrelationIdAwareRestTemplate extends RestTemplate { - - public CorrelationIdAwareRestTemplate() { - this.setInterceptors(customInterceptors()); - } - - private List customInterceptors() { - return Collections.singletonList(correlationIdInterceptor()); - } - - private ClientHttpRequestInterceptor correlationIdInterceptor() { - return (httpRequest, bytes, clientHttpRequestExecution) -> { - final HttpHeaders headers = httpRequest.getHeaders(); - headers.put(RequestContext.CORRELATION_ID, Collections.singletonList(RequestContext.getId())); - - return clientHttpRequestExecution.execute(httpRequest, bytes); - }; - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/common/web/interceptor/CorrelationIdInterceptor.java b/business-services/egf-master/src/main/java/org/egov/common/web/interceptor/CorrelationIdInterceptor.java deleted file mode 100644 index 5e3b520d894..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/common/web/interceptor/CorrelationIdInterceptor.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.egov.common.web.interceptor; - -import java.util.UUID; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.egov.common.web.contract.RequestContext; -import org.slf4j.MDC; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; - -public class CorrelationIdInterceptor extends HandlerInterceptorAdapter { - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) - throws Exception { - - final String correlationId = getCorrelationId(request); - MDC.put(RequestContext.CORRELATION_ID, correlationId); - RequestContext.setId(correlationId); - return super.preHandle(request, response, handler); - } - - private String getCorrelationId(HttpServletRequest request) { - final String incomingCorrelationId = request.getHeader(RequestContext.CORRELATION_ID); - return incomingCorrelationId == null ? UUID.randomUUID().toString() : incomingCorrelationId; - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/enums/BankAccountType.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/enums/BankAccountType.java deleted file mode 100644 index 4187dfac00f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/enums/BankAccountType.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.enums; - -public enum BankAccountType { - RECEIPTS, PAYMENTS, RECEIPTS_PAYMENTS -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/enums/BudgetAccountType.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/enums/BudgetAccountType.java deleted file mode 100644 index 3a3177124ce..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/enums/BudgetAccountType.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.enums; - -public enum BudgetAccountType { - REVENUE_RECEIPTS, REVENUE_EXPENDITURE, CAPITAL_RECEIPTS, CAPITAL_EXPENDITURE -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/enums/BudgetingType.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/enums/BudgetingType.java deleted file mode 100644 index 9ad9c8b2f02..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/enums/BudgetingType.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.egov.egf.master.domain.enums; - -public enum BudgetingType { - ALL, DEBIT, CREDIT -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountCodePurpose.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountCodePurpose.java deleted file mode 100644 index fcd7b355c70..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountCodePurpose.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.annotation.Unique; -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -@Builder -public class AccountCodePurpose extends Auditable { - - private String id; - - @Unique - @NotNull - @Length(max = 256, min = 3) - private String name; -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountCodePurposeSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountCodePurposeSearch.java deleted file mode 100644 index 1d300ae474f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountCodePurposeSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountCodePurposeSearch extends AccountCodePurpose{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailKey.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailKey.java deleted file mode 100644 index 8e26c6b8448..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailKey.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "accountDetailType" }, callSuper = false) - -public class AccountDetailKey extends Auditable { - - private String id; - - @NotNull - private String key; - - @NotNull - private AccountDetailType accountDetailType; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailKeySearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailKeySearch.java deleted file mode 100644 index e99113ec14f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailKeySearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountDetailKeySearch extends AccountDetailKey{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailType.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailType.java deleted file mode 100644 index a3308aabe83..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailType.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder - -public class AccountDetailType extends Auditable { - - private String id; - - @NotNull - @Length(max = 50, min = 1) - private String name; - - @NotNull - @Length(max = 50, min = 1) - private String description; - - @Length(max = 25) - private String tableName; - - @NotNull - private Boolean active; - - @Length(max = 250, min = 1) - private String fullyQualifiedName; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailTypeSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailTypeSearch.java deleted file mode 100644 index 2d947df6170..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountDetailTypeSearch.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.master.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountDetailTypeSearch extends AccountDetailType { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountEntity.java deleted file mode 100644 index 1f7b4ae1bd2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountEntity.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "accountDetailType" }, callSuper = false) - -public class AccountEntity extends Auditable { - - private String id; - - @NotNull - private AccountDetailType accountDetailType; - - @NotNull - @Length(max = 25, min = 1) - private String code; - - @NotNull - @Length(max = 350, min = 1) - private String name; - - @NotNull - private Boolean active; - - @Length(max = 256) - private String description; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountEntitySearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountEntitySearch.java deleted file mode 100644 index 7976cfcb1d8..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/AccountEntitySearch.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.master.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountEntitySearch extends AccountEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Bank.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Bank.java deleted file mode 100644 index 68419ab971b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Bank.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.domain.model.Auditable; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * - * @author mani - * - */ - -/* - * Every ULB need to maintain bank accounts information . May be it is collection information - * or the payment. This is the master list of banks operated by ULB - * - */ -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class Bank extends Auditable { - - /** - * id is unique identifier . It is generated internally - */ - private String id; - - /** - * code is the code of the bank - */ - @NotNull - @Size(max = 50, min = 1) - private String code; - - /** - * name is the Bank Name . - */ - @NotNull - @Size(max = 100, min = 2) - private String name; - - /** - * description more detailed description of the bank - */ - - @Size(max = 250) - private String description; - /** - * active states whether the bank is active in the system or not . - */ - @NotNull - private Boolean active; - - @NotNull - @Size(max = 50) - private String type; - - - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankAccount.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankAccount.java deleted file mode 100644 index 55fa04e9a6f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankAccount.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.egov.egf.master.domain.enums.BankAccountType; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "bankBranch", "chartOfAccount", "fund", "type" }, callSuper = false) - -public class BankAccount extends Auditable { - - private String id; - - @NotNull - private BankBranch bankBranch; - - @NotNull - private ChartOfAccount chartOfAccount; - - @NotNull - private Fund fund; - - @NotNull - @Length(max = 25) - private String accountNumber; - - // is this required ? - private String accountType; - - @Length(max = 256) - private String description; - - @NotNull - private Boolean active; - - @Length(max = 100) - private String payTo; - - @NotNull - private BankAccountType type; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankAccountSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankAccountSearch.java deleted file mode 100644 index 42a7260aed4..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankAccountSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BankAccountSearch extends BankAccount{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankBranch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankBranch.java deleted file mode 100644 index d8b75d4380c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankBranch.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -/** - * - * @author mani - * - */ -/* - * - * - *This is the master list of bankbranches operated by ULB - */ -@ToString -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "bank" }, callSuper = false) - -public class BankBranch extends Auditable { - - /** - * id is the unique identifier - */ - private String id; - /** - * bank is the bank of the branch - */ - @NotNull - private Bank bank; - - /** - * code is the branch code - */ - @NotNull - @Length(max = 50, min = 1) - private String code; - /** - * name is the branch name - */ - @NotNull - @Length(max = 50, min = 1) - @Pattern(regexp = "^[a-zA-Z0-9_]*$") - private String name; - - /** - * address is the address of the branch - */ - @NotNull - @Length(max = 50, min = 1) - private String address; - - /** - * address2 is the secondary address of the branch - */ - @Length(max = 50) - private String address2; - - /** - * city is the name of the bank branches city - */ - - @Length(max = 50) - private String city; - - /** - * state is the name of the state - */ - - @Length(max = 50) - private String state; - - /** - * pincode is the pincode of the branch - */ - @Length(max = 50) - private String pincode; - - /** - * phone is the phone number of the branch - */ - @Length(max = 15) - private String phone; - - /** - * fax is the fax number of the branch - */ - @Length(max = 15) - private String fax; - - /** - * contactPerson is the name of the person in contact - */ - @Length(max = 50) - private String contactPerson; - - /** - * active states whether branch is active. i.e is usable by the system or not - * if not active it cannot be used - */ - @NotNull - private Boolean active; - - /** - * description is the more detailed description of the branch - */ - @Length(max = 256) - private String description; - - /** - * micr is the micr code of the bank branch - */ - @Length(max = 50) - private String micr; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankBranchSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankBranchSearch.java deleted file mode 100644 index 4b62d09cb51..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankBranchSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BankBranchSearch extends BankBranch{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankReconciliation.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankReconciliation.java deleted file mode 100644 index 3a48261749d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankReconciliation.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import java.math.BigDecimal; - -import org.egov.common.domain.model.Auditable; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "bankAccount" }, callSuper = false) - -public class BankReconciliation extends Auditable { - - private String id; - - private BankAccount bankAccount; - - private BigDecimal amount; - - private String transactionType; - - private String instrumentHeaderId; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankSearch.java deleted file mode 100644 index 7a6bb341ad4..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BankSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BankSearch extends Bank{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BudgetGroup.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BudgetGroup.java deleted file mode 100644 index d63e0457c19..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BudgetGroup.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import org.egov.common.domain.model.Auditable; -import org.egov.egf.master.domain.enums.BudgetAccountType; -import org.egov.egf.master.domain.enums.BudgetingType; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "majorCode", "maxCode", "minCode", "accountType", "budgetingType" }, callSuper = false) - -public class BudgetGroup extends Auditable { - - private String id; - - @Length(max = 250, min = 1) - private String name; - - @Length(max = 250, message = "Max 250 characters are allowed for description") - private String description; - - private ChartOfAccount majorCode; - - private ChartOfAccount maxCode; - - private ChartOfAccount minCode; - - private BudgetAccountType accountType; - - private BudgetingType budgetingType; - - private Boolean active; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BudgetGroupSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BudgetGroupSearch.java deleted file mode 100644 index a18dfcb1a17..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/BudgetGroupSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BudgetGroupSearch extends BudgetGroup{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccount.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccount.java deleted file mode 100644 index b7d0eaa46cf..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccount.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * - * @author mani - * - */ - -/* - * Account head is mandatory for every financial transaction for appropriate - * classification, balancing as well as reporting. Chart of accounts classified - * in to 3 categories, i.e Major Head, Minor Head and Detailed Head . The same - * structure created for storing of Chart of Accounts in Finance Module.The - * Chart of Accounts are maintained centrally for better control and pass on the - * best practices evenly to all ULBs across the State. - */ -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "accountCodePurpose", "parentId" }, callSuper = false) -public class ChartOfAccount extends Auditable { - - /** - * id is the Unique Identifier . This data is generated internally - */ - private String id; - - /** - * glcode is the Account Code or Account Head in Accounting terms.It may be - * Major head,Minor head or Detailed head.It is numeric examples are - * 1,110,1101,1101001,2,210,21000,210010 - * - * - */ - @NotNull - @Length(max = 16, min = 1) - private String glcode; - /** - * name is the name of the account code . for example 110 glcode has the - * name "Tax Revenue" - */ - @NotNull - @Length(max = 128, min = 5) - private String name; - /** - * accountCodePurpose is the mapped AccountCodePurpose . This mapping can - * happen at any level say Major,minor or detailed. When Account code is - * searched 1. If mapped at major code then it lists major and all other - * codes under that major code 2. If mapped at minor code then it list minor - * code and all other codes under that minor code 3. If mapped at detailed - * code then it lists only that code - */ - - private AccountCodePurpose accountCodePurpose; - - /** - * description is the more detailed description about the account code - */ - @Length(max = 256) - private String description; - - /** - * isActiveForPosting true will be considered for transactions. All - * major,minor codes will be false and only detailed code will be true . - * Further any account code can be disabled for transaction by making this - * field false - */ - @NotNull - private Boolean isActiveForPosting; - - /** - * parentId is the id of other account code in the chart of account .Chart - * of account is created in tree structure. Any code can have other code as - * parent . All minor code will have manjor code as parent . All detailed - * code will have minor code as parent only leaf account code that is which - * is not parent for any account code will used for transactions. - */ - private ChartOfAccount parentId; - - /** - * type is a single character representation of account code type I: Income - * E: Expenditure L: Liability A: Asset Account code for all I start with 1 - * Account code for all E start with 2 Account code for all L start with 3 - * Account code for all A start with 4 - * - * - */ - @NotNull - private Character type; - /** - * classification is internal to the system. This tells whether the code is - * Major ,Minor,Subminor or detailed. Major code classification value is 1 - * Minor code is 2 Subminor code is 3 Detailed code is 4. Only - * classification 4 and is activeforposting=true will be used in - * transactions. Reports can be generated at any level. - */ - @NotNull - private Long classification; - /** - * functionRequired field specifies while transacting with this accountcode - * is the function is mandatory or not . For any account code this field is - * set to true then all transactions expect a fun=ction code to be passed - * along with account code - */ - @NotNull - private Boolean functionRequired; - /** - * budgetCheckRequired field specifies whether budgeting check required for - * this account code. Apart from global Budgetcheck configuration this is - * where glcode wise budget check decision is made. - * - */ - @NotNull - private Boolean budgetCheckRequired; - - /** - * major code is interanlly maintained for faster reporting purpose. if the - * glcode is major code then this value is true . all minor,subminor - * detailed code will have this property as false - */ - @Length(max = 16) - private String majorCode; - - /** - * isSubledger denotes is the account code is control account / Secondary - * account or not . This is created and maintained internal to the system. - * When ever a account code made control account (subledger) this field is - * set to true. This field is ignore even if it is provided. - */ - - private Boolean isSubLedger; - - private List chartOfAccountDetails; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccountDetail.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccountDetail.java deleted file mode 100644 index 786df660681..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccountDetail.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "chartOfAccount", "accountDetailType" }, callSuper = false) - -public class ChartOfAccountDetail extends Auditable { - - private String id; - - @NotNull - private ChartOfAccount chartOfAccount; - - @NotNull - private AccountDetailType accountDetailType; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccountDetailSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccountDetailSearch.java deleted file mode 100644 index 4c853900d6f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccountDetailSearch.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.egf.master.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class ChartOfAccountDetailSearch extends ChartOfAccountDetail { - private String ids; - private String chartOfAccountIds; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccountSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccountSearch.java deleted file mode 100644 index 0680627cf1a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/ChartOfAccountSearch.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.egf.master.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class ChartOfAccountSearch extends ChartOfAccount { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private String glcodes; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/EntityType.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/EntityType.java deleted file mode 100644 index 2c571fd4ffa..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/EntityType.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -/** - * This interface is used to get the subledger(entity) information for the - * implementing classes. - * - * @author eGov - */ -public interface EntityType { - - /** - * To get the bank name for the entity. it's required to generate the bank - * advice for Contractor/supplier/employee - * - * @return - */ - public String getBankname(); - - /** - * To get the bank account no. for the entity. it's required to generate the - * bank advice for Contractor/supplier/employee. - * - * @return - */ - public String getBankaccount(); - - /** - * To get the Pan no. for the entity. it's required to generate the bank - * advice for Contractor/supplier/employee. - * - * @return - */ - public String getPanno(); - - /** - * To get the Tin no. for the entity. it's required to generate the bank - * advice - * - * @return - */ - public String getTinno(); - - /** - * To get the IFSC code for the entity. it's required to generate the bank - * advice - * - * @return - */ - public String getIfsccode(); - - /** - * To get the subledger party name. - * - * @return - */ - public String getName(); - - /** - * To get the mode of payment, to make a payment for the entity possible - * value, Cheque, Cash or RTGS - * - * @return - */ - public String getModeofpay(); - - /** - * To get the code for the entity - * - * @return - */ - public String getCode(); - - /** - * To get The id/detailKeyd for the entity - * - * @return - */ - public Integer getEntityId(); - - /** - * - * @return data to be displayed in reports - */ - public String getEntityDescription(); - - /** - * - * @return status of Entity^M - */ - public FinancialStatus getFinancialStatus(); - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfiguration.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfiguration.java deleted file mode 100644 index f14c007e322..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfiguration.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import java.util.List; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.domain.model.Auditable; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@ToString -public class FinancialConfiguration extends Auditable { - - @NotNull - private String id; - - @Size(min = 3, max = 50) - private String name; - - @NotNull - @Size(min = 3, max = 250) - private String description; - - @NotNull - @Size(min = 3, max = 50) - private String module; - - @NotNull - private List values; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfigurationSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfigurationSearch.java deleted file mode 100644 index e2616920bdb..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfigurationSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialConfigurationSearch extends FinancialConfiguration{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfigurationValue.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfigurationValue.java deleted file mode 100644 index 922a1cf5662..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfigurationValue.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import java.util.Date; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.domain.model.Auditable; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@ToString -@Builder -public class FinancialConfigurationValue extends Auditable { - - @NotNull - private String id; - - @NotNull - private FinancialConfiguration financialConfiguration; - - @NotNull - @Size(min = 1, max = 1000) - private String value; - - @NotNull - private Date effectiveFrom; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfigurationValueSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfigurationValueSearch.java deleted file mode 100644 index 81b3aa0a13a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialConfigurationValueSearch.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.egf.master.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class FinancialConfigurationValueSearch extends FinancialConfigurationValue { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialStatus.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialStatus.java deleted file mode 100644 index 9306ab7168e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialStatus.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.domain.model.Auditable; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@ToString -@Builder -public class FinancialStatus extends Auditable { - - private String id; - - @NotNull - @Size(min = 3, max = 50) - private String moduleType; - - @NotNull - @Size(min = 3, max = 20) - private String code; - - @NotNull - @Size(min = 3, max = 20) - private String name; - - @NotNull - @Size(min = 3, max = 250) - private String description; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialStatusSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialStatusSearch.java deleted file mode 100644 index d614a69c31e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialStatusSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialStatusSearch extends FinancialStatus{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialYear.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialYear.java deleted file mode 100644 index c4d76c43972..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialYear.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import java.util.Date; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.NotBlank; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * - * @author mani - * - */ -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -/** - * - * Financial Year is the Accounting year and is a key master setup that defines - * the dates for which the vouchers can be posted. All government bodies in - * India follow a Financial Year cycle of April 1st to March-31st. A financial - * year can have any number of fiscal periods. Each fiscal period must have a - * start and end date. The start date of the first period and end date of the - * last period will be the period of the financial year Dates cannot overlap - * across periods – i.e. any given date cannot be in more than on fiscal period. - * A Financial Year must be Active for posting for vouchers to be posted in that - * financial year. - * - */ -public class FinancialYear extends Auditable { - - /** - * id is the unique identifier. it is generated internally - */ - private String id; - /** - * finYearRange is the name of the Financial Year . for example for - * accounting year 2017 and 2018 it may be named 2017-18 - * - */ - @NotNull - @Length(min = 1, max = 25) - private String finYearRange; - - /** - * startingDate is the date on which Accounting Year starts. Usually it is - * 1st April of that year. - */ - @NotNull - private Date startingDate; - - /** - * endingDate is the date on which Financial Year ends. Usually it is 31st - * march of next year - * - */ - @NotNull - private Date endingDate; - /** - * active says whether Financial Year is active or not . Over a period - * system will have number of Financial years. Reports - * ,searches,transactions will need to display this.If the active value is - * true then Financial Year is listed, if value is false it wont be listed - */ - @NotNull - private Boolean active; - /** - * isActiveForPosting refers whether posting allowed for the Financial Year - * or not . This value will be true for current year and few previous year - * for which data entry will be happening. Once the account is closed this - * value is set to false . All transactions will happen if and only if - * isActiveForPosting is true - */ - - @NotNull - private Boolean isActiveForPosting; - /** - * isClosed refers whether the account is closed or not . Once the account - * is closed and balance is transferred this value is set to false if the - * account is closed no transaction can happen on that financial year. - */ - private Boolean isClosed; - /** - * transferClosingBalance informs whether While closing account balance is - * transferred or not . - */ - private Boolean transferClosingBalance; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialYearSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialYearSearch.java deleted file mode 100644 index 07e4a97714d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FinancialYearSearch.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.egov.egf.master.domain.model; - -import java.util.Date; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialYearSearch extends FinancialYear { - private Integer pageSize; - private Integer offset; - private String sortBy; - private Date asOnDate; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FiscalPeriod.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FiscalPeriod.java deleted file mode 100644 index a8f2668fd0b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FiscalPeriod.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import java.util.Date; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -/** - * - * @author mani - * - */ - -/** - * A financial year can have any number of fiscal periods. Each fiscal period - * must have a start and end date. The start date of the first period and end - * date of the last period will be the period of the financial year Dates cannot - * overlap across periods – i.e. any given date cannot be in more than on fiscal - * period. - */ -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "financialYear" }, callSuper = false) -public class FiscalPeriod extends Auditable { - - /** - * id is the unique identifier. it is generated internally - */ - private String id; - - @Length(min = 1, max = 25) - @NotNull - private String name = ""; - - @NotNull - private FinancialYear financialYear; - - /** - * startingDate is the date on which period starts. - */ - @NotNull - private Date startingDate; - - /** - * endingDate is the date on which period ends. - */ - @NotNull - private Date endingDate; - - /** - * active says whether fiscal period is active or not . Over a period system - * will have number of fiscal period. Reports ,searches,transactions will - * need to display this.If the active value is true then fiscal period is - * listed, if value is false it wont be listed - */ - - @NotNull - private Boolean active; - - /** - * isActiveForPosting refers whether posting allowed for the fiscal period - * or not . This value will be true for current year and few previous year - * for which data entry will be happening. Once the account is closed this - * value is set to false . All transactions will happen if and only if - * isActiveForPosting is true - */ - @NotNull - private Boolean isActiveForPosting; - - /** - * isClosed refers whether the account is closed or not . Once the account - * is closed and balance is transferred this value is set to false if the - * account is closed no transaction can happen on that fiscal period. - */ - - private Boolean isClosed; -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FiscalPeriodSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FiscalPeriodSearch.java deleted file mode 100644 index 9f75c82b491..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FiscalPeriodSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FiscalPeriodSearch extends FiscalPeriod{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Function.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Function.java deleted file mode 100644 index ac72eb6e903..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Function.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -/** - * @author mani - */ -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.annotation.Unique; -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "parentId" }, callSuper = false) -/** - * - * ULB activates are carried out by the concerned Departments . In each - * department again multiple activities are carried out and these activities are - * grouped as functions .Common functions enabled across all ULBs shall be - * managed in Central Monitoring Cell based on the requirements for addition, - * deletion and modification of functions from the ULBs. - * - */ - -public class Function extends Auditable { - - /** - * id is the unique identifier . - */ - private String id; - - /** - * name is the name of the function . - */ - @Length(max = 128, min = 2) - @NotNull - @Unique - private String name; - - /** - * code is a unique number given to each function . ULBs may refer this for - * the short name. - */ - @Length(max = 16, min = 2) - @NotNull - private String code; - /** - * level identifies what is the level of the function in the tree structure. - * Top most parent will have level 0 and its child will have level as 1 - * - */ - @NotNull - private Integer level; - - /** - * active is a boolean value which says whether function is in use or not . - * If Function is active, then accounting of transactions under the Function - * is enabled. If Function becomes inactive, and no transactions can be - * accounted under the Function. Only leaf function can be used in - * transaction ie function which is not parent to any other function - */ - @NotNull - private Boolean active; - - private Function parentId; - - public void add() { - if (parentId == null) { - level = 0; - - } else { - level = parentId.getLevel() + 1; - } - } - - public void update() { - if (parentId == null) { - level = 0; - - } else { - level = parentId.getLevel() + 1; - } - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FunctionSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FunctionSearch.java deleted file mode 100644 index 42c47903833..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FunctionSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FunctionSearch extends Function{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Functionary.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Functionary.java deleted file mode 100644 index 922dce161b5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Functionary.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * - * @author mani - * - */ -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -/* - * Functionary is considered as another cost center. In the government set-up, - * demands for expenditure are drawn by the department discharging the functions - * and become the responsibility center for the assigned functions. Functionary - * group represents this. Each sub-level within this group typically can - * represent the organisational structure within the ULB. This level is used - * only for the internal control of the ULB. - */ -public class Functionary extends Auditable { - - /** - * id is the unique identifier and it is generated internally - */ - private String id; - - /** - * code is uniue identifier and ULB may refer this for short name. - */ - @NotNull - @Length(max = 16, min = 1) - private String code; - - /** - * name is the name of the functionary - */ - @NotNull - @Length(max = 256, min = 1) - private String name; - - /** - * active states whether the functionary is active or not . Only active - * functionaries will be used in transaction - */ - @NotNull - private Boolean active; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FunctionarySearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FunctionarySearch.java deleted file mode 100644 index 4f3cdd93d50..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FunctionarySearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FunctionarySearch extends Functionary{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Fund.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Fund.java deleted file mode 100644 index 0cdac81428c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Fund.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; -import org.springframework.stereotype.Service; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * @author mani - */ -@AllArgsConstructor -@NoArgsConstructor -@Service -@Builder -@Getter -@Setter -@EqualsAndHashCode(exclude = { "parent" }, callSuper = false) - -/** - * - * Fund is a defining concept in municipal accounting – where it is required to - * segregate all accounting transactions into designated funds. Each fund needs - * to be treated as an independent accounting entity – in other words, all - * vouchers within a fund must be self-balancing and balance sheets and - * Income/Expenditure reports must be generated for each fund. A hierarchy of - * funds may be defined – i.e. each fund can have multiple sub-funds and so on. - */ - -public class Fund extends Auditable { - - /** - * id is the unique field . - */ - protected String id; - - /** - * name is the name of the fund . Example :Municipal Fund,Capital Fund. Also - * name is unique. - */ - @Length(max = 50, min = 2) - @NotNull - protected String name; - - /** - * code is a unique number given to each fund . ULB may refer this for the - * short name - */ - @Length(max = 50, min = 2) - @NotNull - protected String code; - /** - * identifier appears as prefix in all the vouchers accounted in the books - * of the Fund. Each fund must have an identifier – each voucher belonging - * to a fund must have the identifier embedded in the voucher number for - * easy identification. Fund is taken at a voucher head level for each - * voucher transaction. - */ - @NotNull - protected Character identifier; - - /** - * parent adding a parent will create the fund as a sub-fund (child) of a - * fund already created (parent fund). - * - */ - protected Fund parent; - /** - * active is a boolean value which says whether fund is in use or not . If - * Fund is active, then accounting of transactions under the fund is - * enabled. If Fund becomes inactive, and no transactions can be accounted - * under the Fund. - */ - @NotNull - protected Boolean active; - - /** - * isParent is updated internally so that system can identify whether the - * fund is parent or child. Only child which is not parent for any other - * fund can only participate in transaction . - */ - - protected Boolean isParent; - - /** - * level identifies what is the level of the fund in the tree structure. Top - * most parent will have level 0 and its child will have level as 1 - * - */ - - @NotNull - protected Long level; - - public void add() { - if (parent == null) { - level = 0l; - - } else { - level = parent.getLevel() + 1; - } - } - - public void update() { - if (parent == null) { - level = 0l; - - } else { - level = parent.getLevel() + 1; - } - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FundSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FundSearch.java deleted file mode 100644 index a18e20cccdd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FundSearch.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.egf.master.domain.model; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class FundSearch extends Fund { - - private Date fromDate; - - private Integer pageSize; - - private Integer offset; - - private String sortBy; - - private List ids = new ArrayList(); - - private Integer fromIndex; - - public boolean isPaginationCriteriaPresent() { - return fromIndex != null && pageSize != null; - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Fundsource.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Fundsource.java deleted file mode 100644 index b776c23ca6c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Fundsource.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import java.math.BigDecimal; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "fundSource" }, callSuper = false) - -public class Fundsource extends Auditable { - - private String id; - - @Length(min = 1, max = 25) - @NotNull - private String code; - - @Length(min = 1, max = 25) - @NotNull - private String name; - - @Length(min = 1, max = 25) - private String type; - - private Fundsource parent; - - private BigDecimal llevel; - - @NotNull - private Boolean active; - - // is this required - private Boolean isParent; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FundsourceSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FundsourceSearch.java deleted file mode 100644 index 686f7704748..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/FundsourceSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FundsourceSearch extends Fundsource{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Recovery.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Recovery.java deleted file mode 100644 index 9d7ef038b91..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Recovery.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.domain.model; - -import lombok.*; -import org.egov.common.domain.model.Auditable; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.hibernate.validator.constraints.Length; -import org.springframework.stereotype.Service; - -import javax.validation.constraints.NotNull; - -@AllArgsConstructor -@NoArgsConstructor -@Service -@Builder -@Getter -@Setter -public class Recovery extends Auditable { - - protected String id; - - @Length(max = 50, min = 2) - @NotNull - protected String name; - - @Length(max = 50, min = 2) - @NotNull - protected String code; - - @NotNull - protected ChartOfAccount chartOfAccount; - - protected String type; - - protected Double flat; - - protected Double percentage; - - @NotNull - protected Boolean active; - - @Length(max = 100) - protected String remitted; - - @Length(max = 16) - protected String ifscCode; - - protected Character mode; - - protected Character remittanceMode; - - @Length(max = 32) - protected String accountNumber; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/RecoverySearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/RecoverySearch.java deleted file mode 100644 index 424032795a1..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/RecoverySearch.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.egov.egf.master.domain.model; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class RecoverySearch extends Recovery { - - private Integer pageSize; - - private Integer offset; - - private String sortBy; - - private List ids = new ArrayList(); - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Scheme.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Scheme.java deleted file mode 100644 index 81913ff45ce..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Scheme.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import java.util.Date; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "fund" }, callSuper = false) -public class Scheme extends Auditable { - - private String id; - - private Fund fund; - - @Length(max = 25, min = 1) - private String code; - - @Length(max = 25, min = 1) - private String name; - - @NotNull - private Date validFrom; - - @NotNull - private Date validTo; - - @NotNull - private Boolean active; - - @Length(max = 256) - private String description; - - private String boundary; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SchemeSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SchemeSearch.java deleted file mode 100644 index f9e3b92569f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SchemeSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SchemeSearch extends Scheme{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SubScheme.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SubScheme.java deleted file mode 100644 index a86a6acf3b5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SubScheme.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import java.util.Date; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "scheme" }, callSuper = false) - -public class SubScheme extends Auditable { - - private String id; - - @NotNull - private Scheme scheme; - - @NotNull - @Length(max = 50, min = 1) - private String code; - - @NotNull - @Length(max = 50, min = 1) - private String name; - - @NotNull - private Date validFrom; - - @NotNull - private Date validTo; - - @NotNull - private Boolean active; - - private String departmentId; - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SubSchemeSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SubSchemeSearch.java deleted file mode 100644 index b0a1e6bbc2b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SubSchemeSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SubSchemeSearch extends SubScheme{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Supplier.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Supplier.java deleted file mode 100644 index ba574865434..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/Supplier.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.domain.model; - -import javax.validation.constraints.NotNull; - -import org.egov.common.domain.model.Auditable; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@EqualsAndHashCode(exclude = { "bank", "bankAccount" }, callSuper = false) -public class Supplier extends Auditable { - - private String id; - - @NotNull - @Length(max = 50, min = 1) - private String code; - - @NotNull - @Length(max = 50, min = 1) - private String name; - - @Length(max = 300) - private String address; - - @Length(max = 10) - private String mobile; - - @Length(max = 25) - private String email; - - @Length(max = 250) - private String description; - @NotNull - private Boolean active; - - @Length(max = 10) - private String panNo; - - @Length(max = 20) - private String tinNo; - - @Length(max = 25) - private String registationNo; - - private BankAccount bankAccount; - - @Length(max = 12) - private String ifscCode; - - private Bank bank; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SupplierSearch.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SupplierSearch.java deleted file mode 100644 index 08446b36b56..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/model/SupplierSearch.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.domain.model ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SupplierSearch extends Supplier{ private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountCodePurposeESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountCodePurposeESRepository.java deleted file mode 100644 index dc29f788068..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountCodePurposeESRepository.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.persistence.entity.AccountCodePurposeEntity; -import org.egov.egf.master.web.contract.AccountCodePurposeSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class AccountCodePurposeESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(AccountCodePurposeESRepository.class); - - public AccountCodePurposeESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(AccountCodePurposeSearchContract accountCodePurposeSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(accountCodePurposeSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToAccountCodePurposeList(searchResponse, accountCodePurposeSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToAccountCodePurposeList(SearchResponse searchResponse, - AccountCodePurposeSearchContract accountCodePurposeSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List accountCodePurposes = new ArrayList(); - AccountCodePurpose accountCodePurpose = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - accountCodePurpose = mapper.readValue(hit.getSourceAsString(), AccountCodePurpose.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Exception occurred while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON Mapping Exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO Exception occurred: " + e1.getMessage()); - } - - accountCodePurposes.add(accountCodePurpose); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(accountCodePurposes); - - return page; - } - - private SearchRequestBuilder getSearchRequest(AccountCodePurposeSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), AccountCodePurposeEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchAccountCodePurpose(criteria); - SearchRequestBuilder searchRequestBuilder = esClient - .prepareSearch(AccountCodePurpose.class.getSimpleName().toLowerCase()) - .setTypes(AccountCodePurpose.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountCodePurposeRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountCodePurposeRepository.java deleted file mode 100644 index 55f340654c2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountCodePurposeRepository.java +++ /dev/null @@ -1,243 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.annotation.Unique; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.AccountCodePurposeSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.AccountCodePurposeEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.AccountCodePurposeJdbcRepository; -import org.egov.egf.master.web.contract.AccountCodePurposeContract; -import org.egov.egf.master.web.contract.AccountCodePurposeSearchContract; -import org.egov.egf.master.web.requests.AccountCodePurposeRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class AccountCodePurposeRepository { - - @Autowired - private AccountCodePurposeJdbcRepository accountCodePurposeJdbcRepository; - @Autowired - private MastersQueueRepository accountCodePurposeQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private AccountCodePurposeESRepository accountCodePurposeESRepository; - - private String persistThroughKafka; - - @Autowired - public AccountCodePurposeRepository(AccountCodePurposeJdbcRepository accountCodePurposeJdbcRepository, - MastersQueueRepository accountCodePurposeQueueRepository, - FinancialConfigurationService financialConfigurationService, - AccountCodePurposeESRepository accountCodePurposeESRepository, - @Value("${persist.through.kafka}") String persistThroughKafka) { - this.accountCodePurposeJdbcRepository = accountCodePurposeJdbcRepository; - this.accountCodePurposeQueueRepository = accountCodePurposeQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.accountCodePurposeESRepository = accountCodePurposeESRepository; - this.persistThroughKafka = persistThroughKafka; - - } - - public AccountCodePurpose findById(AccountCodePurpose accountCodePurpose) { - AccountCodePurposeEntity entity = accountCodePurposeJdbcRepository - .findById(new AccountCodePurposeEntity().toEntity(accountCodePurpose)); - return entity.toDomain(); - - } - - public String getNextSequence() { - return accountCodePurposeJdbcRepository.getSequence(AccountCodePurposeEntity.SEQUENCE_NAME); - } - - @Transactional - public AccountCodePurpose save(AccountCodePurpose accountCodePurpose) { - AccountCodePurposeEntity entity = accountCodePurposeJdbcRepository - .create(new AccountCodePurposeEntity().toEntity(accountCodePurpose)); - return entity.toDomain(); - } - - @Transactional - public AccountCodePurpose update(AccountCodePurpose accountCodePurpose) { - AccountCodePurposeEntity entity = accountCodePurposeJdbcRepository - .update(new AccountCodePurposeEntity().toEntity(accountCodePurpose)); - return entity.toDomain(); - } - - @Transactional - public List save(List accountCodePurposes, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - AccountCodePurposeContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - AccountCodePurposeRequest request = new AccountCodePurposeRequest(); - request.setRequestInfo(requestInfo); - request.setAccountCodePurposes(new ArrayList<>()); - - for (AccountCodePurpose account : accountCodePurposes) { - - contract = new AccountCodePurposeContract(); - contract.setCreatedDate(new Date()); - mapper.map(account, contract); - request.getAccountCodePurposes().add(contract); - - } - - addToQue(request); - - return accountCodePurposes; - } else { - - List resultList = new ArrayList<>(); - - for (AccountCodePurpose account : accountCodePurposes) { - - resultList.add(save(account)); - } - - AccountCodePurposeRequest request = new AccountCodePurposeRequest(); - request.setRequestInfo(requestInfo); - request.setAccountCodePurposes(new ArrayList<>()); - - for (AccountCodePurpose account : resultList) { - - contract = new AccountCodePurposeContract(); - contract.setCreatedDate(new Date()); - mapper.map(account, contract); - request.getAccountCodePurposes().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public List update(List accountCodePurposes, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - AccountCodePurposeContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - AccountCodePurposeRequest request = new AccountCodePurposeRequest(); - request.setRequestInfo(requestInfo); - request.setAccountCodePurposes(new ArrayList<>()); - - for (AccountCodePurpose account : accountCodePurposes) { - - contract = new AccountCodePurposeContract(); - contract.setCreatedDate(new Date()); - mapper.map(account, contract); - request.getAccountCodePurposes().add(contract); - - } - - addToQue(request); - - return accountCodePurposes; - } else { - - List resultList = new ArrayList(); - - for (AccountCodePurpose account : accountCodePurposes) { - - resultList.add(update(account)); - } - - AccountCodePurposeRequest request = new AccountCodePurposeRequest(); - request.setRequestInfo(requestInfo); - request.setAccountCodePurposes(new ArrayList<>()); - - for (AccountCodePurpose account : resultList) { - - contract = new AccountCodePurposeContract(); - contract.setCreatedDate(new Date()); - mapper.map(account, contract); - request.getAccountCodePurposes().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - public void add(AccountCodePurposeRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("accountcodepurpose_create", request); - } else { - message.put("accountcodepurpose_update", request); - } - accountCodePurposeQueueRepository.add(message); - } - - public Pagination search(AccountCodePurposeSearch domain) { - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - AccountCodePurposeSearchContract accountCodePurposeSearchContract = new AccountCodePurposeSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, accountCodePurposeSearchContract); - return accountCodePurposeESRepository.search(accountCodePurposeSearchContract); - } else { - return accountCodePurposeJdbcRepository.search(domain); - } - - } - - public void uniqueCheck(AccountCodePurpose accountCodePurpose) { - if (accountCodePurpose.getClass().isAnnotationPresent(Unique.class) == true) { - } - } - - public Boolean uniqueCheck(String fieldName, AccountCodePurpose accountCodePurpose) { - return accountCodePurposeJdbcRepository.uniqueCheck(fieldName, - new AccountCodePurposeEntity().toEntity(accountCodePurpose)); - } - - public void addToQue(AccountCodePurposeRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("accountcodepurpose_create", request); - } else { - message.put("accountcodepurpose_update", request); - } - accountCodePurposeQueueRepository.add(message); - } - - public void addToSearchQueue(AccountCodePurposeRequest request) { - Map message = new HashMap<>(); - - message.put("accountcodepurpose_persisted", request); - - accountCodePurposeQueueRepository.addToSearch(message); - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailKeyESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailKeyESRepository.java deleted file mode 100644 index 5308c055770..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailKeyESRepository.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.persistence.entity.AccountDetailKeyEntity; -import org.egov.egf.master.web.contract.AccountDetailKeySearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class AccountDetailKeyESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(AccountDetailKeyESRepository.class); - - public AccountDetailKeyESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(AccountDetailKeySearchContract accountCodeKeySearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(accountCodeKeySearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToAccountDetailKeyList(searchResponse, accountCodeKeySearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToAccountDetailKeyList(SearchResponse searchResponse, - AccountDetailKeySearchContract accountCodePurposeSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List accountDetailkeys = new ArrayList(); - AccountDetailKey accountDetailKey = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - accountDetailKey = mapper.readValue(hit.getSourceAsString(), AccountDetailKey.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO Exception occurred: " + e1.getMessage()); - } - - accountDetailkeys.add(accountDetailKey); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(accountDetailkeys); - - return page; - } - - private SearchRequestBuilder getSearchRequest(AccountDetailKeySearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), AccountDetailKeyEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchAccountDetailKey(criteria); - SearchRequestBuilder searchRequestBuilder = esClient - .prepareSearch(AccountDetailKey.class.getSimpleName().toLowerCase()) - .setTypes(AccountDetailKey.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailKeyRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailKeyRepository.java deleted file mode 100644 index 3b8ee1ec7cf..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailKeyRepository.java +++ /dev/null @@ -1,238 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailKeySearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.AccountDetailKeyEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.AccountDetailKeyJdbcRepository; -import org.egov.egf.master.web.contract.AccountDetailKeyContract; -import org.egov.egf.master.web.contract.AccountDetailKeySearchContract; -import org.egov.egf.master.web.requests.AccountDetailKeyRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class AccountDetailKeyRepository { - - @Autowired - private AccountDetailKeyJdbcRepository accountDetailKeyJdbcRepository; - @Autowired - private MastersQueueRepository accountDetailKeyQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private AccountDetailKeyESRepository accountDetailKeyESRepository; - - private String persistThroughKafka; - - @Autowired - public AccountDetailKeyRepository(AccountDetailKeyJdbcRepository accountDetailKeyJdbcRepository, - MastersQueueRepository accountDetailKeyQueueRepository, - FinancialConfigurationService financialConfigurationService, - AccountDetailKeyESRepository accountDetailKeyESRepository, - @Value("${persist.through.kafka}") String persistThroughKafka) { - this.accountDetailKeyJdbcRepository = accountDetailKeyJdbcRepository; - this.accountDetailKeyQueueRepository = accountDetailKeyQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.accountDetailKeyESRepository = accountDetailKeyESRepository; - this.persistThroughKafka = persistThroughKafka; - - } - - @Transactional - public List save(List accountDetailKies, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - AccountDetailKeyContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - AccountDetailKeyRequest request = new AccountDetailKeyRequest(); - request.setRequestInfo(requestInfo); - request.setAccountDetailKeys(new ArrayList<>()); - - for (AccountDetailKey f : accountDetailKies) { - - contract = new AccountDetailKeyContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountDetailKeys().add(contract); - - } - - addToQue(request); - - return accountDetailKies; - } else { - - List resultList = new ArrayList<>(); - - for (AccountDetailKey f : accountDetailKies) { - - resultList.add(save(f)); - } - - AccountDetailKeyRequest request = new AccountDetailKeyRequest(); - request.setRequestInfo(requestInfo); - request.setAccountDetailKeys(new ArrayList<>()); - - for (AccountDetailKey f : resultList) { - - contract = new AccountDetailKeyContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountDetailKeys().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public List update(List accountDetailKies, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - AccountDetailKeyContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - AccountDetailKeyRequest request = new AccountDetailKeyRequest(); - request.setRequestInfo(requestInfo); - request.setAccountDetailKeys(new ArrayList<>()); - - for (AccountDetailKey f : accountDetailKies) { - - contract = new AccountDetailKeyContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountDetailKeys().add(contract); - - } - - addToQue(request); - - return accountDetailKies; - } else { - - List resultList = new ArrayList<>(); - - for (AccountDetailKey f : accountDetailKies) { - - resultList.add(update(f)); - } - - AccountDetailKeyRequest request = new AccountDetailKeyRequest(); - request.setRequestInfo(requestInfo); - request.setAccountDetailKeys(new ArrayList<>()); - - for (AccountDetailKey f : resultList) { - - contract = new AccountDetailKeyContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountDetailKeys().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - public void addToQue(AccountDetailKeyRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("accountdetailkey_create", request); - } else { - message.put("accountdetailkey_update", request); - } - accountDetailKeyQueueRepository.add(message); - } - - public void addToSearchQueue(AccountDetailKeyRequest request) { - Map message = new HashMap<>(); - - message.put("accountdetailkey_persisted", request); - - accountDetailKeyQueueRepository.addToSearch(message); - } - - public AccountDetailKey findById(AccountDetailKey accountDetailKey) { - AccountDetailKeyEntity entity = accountDetailKeyJdbcRepository - .findById(new AccountDetailKeyEntity().toEntity(accountDetailKey)); - return entity.toDomain(); - - } - - public String getNextSequence() { - return accountDetailKeyJdbcRepository.getSequence(AccountDetailKeyEntity.SEQUENCE_NAME); - } - - @Transactional - public AccountDetailKey save(AccountDetailKey accountDetailKey) { - AccountDetailKeyEntity entity = accountDetailKeyJdbcRepository - .create(new AccountDetailKeyEntity().toEntity(accountDetailKey)); - return entity.toDomain(); - } - - @Transactional - public AccountDetailKey update(AccountDetailKey accountDetailKey) { - AccountDetailKeyEntity entity = accountDetailKeyJdbcRepository - .update(new AccountDetailKeyEntity().toEntity(accountDetailKey)); - return entity.toDomain(); - } - - public void add(AccountDetailKeyRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("accountdetailkey_create", request); - } else { - message.put("accountdetailkey_update", request); - } - accountDetailKeyQueueRepository.add(message); - } - - public Pagination search(final AccountDetailKeySearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - final AccountDetailKeySearchContract accountDetailKeySearchContract = new AccountDetailKeySearchContract(); - final ModelMapper mapper = new ModelMapper(); - mapper.map(domain, accountDetailKeySearchContract); - return accountDetailKeyESRepository.search(accountDetailKeySearchContract); - } else - return accountDetailKeyJdbcRepository.search(domain); - - } - - public boolean uniqueCheck(String fieldName, AccountDetailKey accountDetailKey) { - return accountDetailKeyJdbcRepository.uniqueCheck(fieldName, - new AccountDetailKeyEntity().toEntity(accountDetailKey)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailTypeESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailTypeESRepository.java deleted file mode 100644 index e1fdc8ad590..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailTypeESRepository.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.persistence.entity.AccountDetailTypeEntity; -import org.egov.egf.master.web.contract.AccountDetailTypeSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class AccountDetailTypeESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(AccountDetailTypeESRepository.class); - - public AccountDetailTypeESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(AccountDetailTypeSearchContract accountCodeTypeSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(accountCodeTypeSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToAccountDetailTypeList(searchResponse, accountCodeTypeSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToAccountDetailTypeList(SearchResponse searchResponse, - AccountDetailTypeSearchContract accountCodeTypeSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List accountDetailkeys = new ArrayList(); - AccountDetailType accountDetailKey = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - accountDetailKey = mapper.readValue(hit.getSourceAsString(), AccountDetailType.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Exception occurred while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("Json mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - accountDetailkeys.add(accountDetailKey); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(accountDetailkeys); - - return page; - } - - private SearchRequestBuilder getSearchRequest(AccountDetailTypeSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), AccountDetailTypeEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchAccountDetailType(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(AccountDetailType.class.getSimpleName().toLowerCase()) - .setTypes(AccountDetailType.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailTypeRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailTypeRepository.java deleted file mode 100644 index 0580d4a4774..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountDetailTypeRepository.java +++ /dev/null @@ -1,237 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.AccountDetailTypeEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.AccountDetailTypeJdbcRepository; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; -import org.egov.egf.master.web.contract.AccountDetailTypeSearchContract; -import org.egov.egf.master.web.requests.AccountDetailTypeRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class AccountDetailTypeRepository { - - @Autowired - private AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository; - @Autowired - private MastersQueueRepository accountDetailTypeQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private AccountDetailTypeESRepository accountDetailTypeESRepository; - private String persistThroughKafka; - - @Autowired - public AccountDetailTypeRepository(AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository, - MastersQueueRepository accountDetailTypeQueueRepository, - FinancialConfigurationService financialConfigurationService, - AccountDetailTypeESRepository accountDetailTypeESRepository, - @Value("${persist.through.kafka}") String persistThroughKafka) { - this.accountDetailTypeJdbcRepository = accountDetailTypeJdbcRepository; - this.accountDetailTypeQueueRepository = accountDetailTypeQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.accountDetailTypeESRepository = accountDetailTypeESRepository; - this.persistThroughKafka = persistThroughKafka; - - } - - @Transactional - public List save(List accountDetailTypes, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - AccountDetailTypeContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - AccountDetailTypeRequest request = new AccountDetailTypeRequest(); - request.setRequestInfo(requestInfo); - request.setAccountDetailTypes(new ArrayList<>()); - - for (AccountDetailType f : accountDetailTypes) { - - contract = new AccountDetailTypeContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountDetailTypes().add(contract); - - } - - addToQue(request); - - return accountDetailTypes; - } else { - - List resultList = new ArrayList<>(); - - for (AccountDetailType f : accountDetailTypes) { - - resultList.add(save(f)); - } - - AccountDetailTypeRequest request = new AccountDetailTypeRequest(); - request.setRequestInfo(requestInfo); - request.setAccountDetailTypes(new ArrayList<>()); - - for (AccountDetailType f : resultList) { - - contract = new AccountDetailTypeContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountDetailTypes().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public List update(List accountDetailTypes, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - AccountDetailTypeContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - AccountDetailTypeRequest request = new AccountDetailTypeRequest(); - request.setRequestInfo(requestInfo); - request.setAccountDetailTypes(new ArrayList<>()); - - for (AccountDetailType f : accountDetailTypes) { - - contract = new AccountDetailTypeContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountDetailTypes().add(contract); - - } - - addToQue(request); - - return accountDetailTypes; - } else { - - List resultList = new ArrayList(); - - for (AccountDetailType f : accountDetailTypes) { - - resultList.add(update(f)); - } - - AccountDetailTypeRequest request = new AccountDetailTypeRequest(); - request.setRequestInfo(requestInfo); - request.setAccountDetailTypes(new ArrayList<>()); - - for (AccountDetailType f : resultList) { - - contract = new AccountDetailTypeContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountDetailTypes().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - public AccountDetailType findById(AccountDetailType accountDetailType) { - AccountDetailTypeEntity entity = accountDetailTypeJdbcRepository - .findById(new AccountDetailTypeEntity().toEntity(accountDetailType)); - return entity.toDomain(); - - } - - public String getNextSequence() { - return accountDetailTypeJdbcRepository.getSequence(AccountDetailTypeEntity.SEQUENCE_NAME); - } - - @Transactional - public AccountDetailType save(AccountDetailType accountDetailType) { - AccountDetailTypeEntity entity = accountDetailTypeJdbcRepository - .create(new AccountDetailTypeEntity().toEntity(accountDetailType)); - return entity.toDomain(); - } - - @Transactional - public AccountDetailType update(AccountDetailType accountDetailType) { - AccountDetailTypeEntity entity = accountDetailTypeJdbcRepository - .update(new AccountDetailTypeEntity().toEntity(accountDetailType)); - return entity.toDomain(); - } - - public void add(AccountDetailTypeRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("accountdetailtype_create", request); - } else { - message.put("accountdetailtype_update", request); - } - accountDetailTypeQueueRepository.add(message); - } - - public Pagination search(AccountDetailTypeSearch domain) { - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - AccountDetailTypeSearchContract accountCodeTypeSearchContract = new AccountDetailTypeSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, accountCodeTypeSearchContract); - return accountDetailTypeESRepository.search(accountCodeTypeSearchContract); - } else { - return accountDetailTypeJdbcRepository.search(domain); - } - - } - - public void addToQue(AccountDetailTypeRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("accountdetailtype_create", request); - } else { - message.put("accountdetailtype_update", request); - } - accountDetailTypeQueueRepository.add(message); - } - - public void addToSearchQueue(AccountDetailTypeRequest request) { - Map message = new HashMap<>(); - - message.put("accountdetailtype_persisted", request); - - accountDetailTypeQueueRepository.addToSearch(message); - } - - public boolean uniqueCheck(String fieldName, AccountDetailType accountDetailType) { - return accountDetailTypeJdbcRepository.uniqueCheck(fieldName, - new AccountDetailTypeEntity().toEntity(accountDetailType)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountEntityESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountEntityESRepository.java deleted file mode 100644 index e85009f5d96..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountEntityESRepository.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.persistence.entity.AccountEntityEntity; -import org.egov.egf.master.web.contract.AccountEntitySearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class AccountEntityESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(AccountEntityESRepository.class); - - public AccountEntityESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(AccountEntitySearchContract accountEntitySearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(accountEntitySearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToAccountEntityList(searchResponse,accountEntitySearchContract); - } - - - @SuppressWarnings("deprecation") - private Pagination mapToAccountEntityList(SearchResponse searchResponse,AccountEntitySearchContract accountEntitySearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List accountDetailkeys = new ArrayList(); - AccountEntity accountDetailKey=null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - //JSON from file to Object - try { - accountDetailKey = mapper.readValue(hit.getSourceAsString(), AccountEntity.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Exception occurred while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("Json mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - accountDetailkeys.add(accountDetailKey); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(accountDetailkeys); - - return page; - } - - private SearchRequestBuilder getSearchRequest(AccountEntitySearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), AccountEntityEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchAccountEntity(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(AccountEntity.class.getSimpleName().toLowerCase()).setTypes(AccountEntity.class.getSimpleName().toLowerCase()) - ; - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountEntityRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountEntityRepository.java deleted file mode 100644 index 0c4acdf8e71..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/AccountEntityRepository.java +++ /dev/null @@ -1,234 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.domain.model.AccountEntitySearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.AccountEntityEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.AccountEntityJdbcRepository; -import org.egov.egf.master.web.contract.AccountEntityContract; -import org.egov.egf.master.web.contract.AccountEntitySearchContract; -import org.egov.egf.master.web.requests.AccountEntityRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; - -@Service -public class AccountEntityRepository { - - @Autowired - private AccountEntityJdbcRepository accountEntityJdbcRepository; - - @Autowired - private MastersQueueRepository accountEntityQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private AccountEntityESRepository accountEntityESRepository; - - private String persistThroughKafka; - - @Autowired - public AccountEntityRepository(AccountEntityJdbcRepository accountEntityJdbcRepository, - MastersQueueRepository accountEntityQueueRepository, FinancialConfigurationService financialConfigurationService, - AccountEntityESRepository accountEntityESRepository, @Value("${persist.through.kafka}") String persistThroughKafka) { - this.accountEntityJdbcRepository = accountEntityJdbcRepository; - this.accountEntityQueueRepository = accountEntityQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.accountEntityESRepository = accountEntityESRepository; - this.persistThroughKafka = persistThroughKafka; - - } - - @Transactional - public List save(List accountEntities, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - AccountEntityContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - AccountEntityRequest request = new AccountEntityRequest(); - request.setRequestInfo(requestInfo); - request.setAccountEntities(new ArrayList<>()); - - for (AccountEntity f : accountEntities) { - - contract = new AccountEntityContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountEntities().add(contract); - - } - - addToQue(request); - - return accountEntities; - } else { - - List resultList = new ArrayList(); - - for (AccountEntity f : accountEntities) { - - resultList.add(save(f)); - } - - AccountEntityRequest request = new AccountEntityRequest(); - request.setRequestInfo(requestInfo); - request.setAccountEntities(new ArrayList<>()); - - for (AccountEntity f : resultList) { - - contract = new AccountEntityContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountEntities().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public List update(List accountEntities, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - AccountEntityContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - AccountEntityRequest request = new AccountEntityRequest(); - request.setRequestInfo(requestInfo); - request.setAccountEntities(new ArrayList<>()); - - for (AccountEntity f : accountEntities) { - - contract = new AccountEntityContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountEntities().add(contract); - - } - - addToQue(request); - - return accountEntities; - } else { - - List resultList = new ArrayList(); - - for (AccountEntity f : accountEntities) { - - resultList.add(update(f)); - } - - AccountEntityRequest request = new AccountEntityRequest(); - request.setRequestInfo(requestInfo); - request.setAccountEntities(new ArrayList<>()); - - for (AccountEntity f : resultList) { - - contract = new AccountEntityContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getAccountEntities().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - - public void addToQue(AccountEntityRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("accountentity_create", request); - } else { - message.put("accountentity_update", request); - } - accountEntityQueueRepository.add(message); - } - - public void addToSearchQueue(AccountEntityRequest request) { - Map message = new HashMap<>(); - - message.put("accountentity_persisted", request); - - accountEntityQueueRepository.addToSearch(message); - } - - public AccountEntity findById(AccountEntity accountEntity) { - AccountEntityEntity entity = accountEntityJdbcRepository - .findById(new AccountEntityEntity().toEntity(accountEntity)); - return entity.toDomain(); - - } - - public String getNextSequence() { - return accountEntityJdbcRepository.getSequence(AccountEntityEntity.SEQUENCE_NAME); - } - - @Transactional - public AccountEntity save(AccountEntity accountEntity) { - AccountEntityEntity entity = accountEntityJdbcRepository - .create(new AccountEntityEntity().toEntity(accountEntity)); - return entity.toDomain(); - } - - @Transactional - public AccountEntity update(AccountEntity accountEntity) { - AccountEntityEntity entity = accountEntityJdbcRepository - .update(new AccountEntityEntity().toEntity(accountEntity)); - return entity.toDomain(); - } - - public void add(AccountEntityRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("accountentity_create", request); - } else { - message.put("accountentity_update", request); - } - accountEntityQueueRepository.add(message); - } - - public Pagination search(AccountEntitySearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - AccountEntitySearchContract accountEntitySearchContract = new AccountEntitySearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, accountEntitySearchContract); - return accountEntityESRepository.search(accountEntitySearchContract); - } else { - return accountEntityJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, AccountEntity accountEntity) { - return accountEntityJdbcRepository.uniqueCheck(fieldName, new AccountEntityEntity().toEntity(accountEntity)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankAccountESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankAccountESRepository.java deleted file mode 100644 index f9f9401226f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankAccountESRepository.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.persistence.entity.BankAccountEntity; -import org.egov.egf.master.web.contract.BankAccountSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class BankAccountESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(BankAccountESRepository.class); - - public BankAccountESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(BankAccountSearchContract bankAccountSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(bankAccountSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToBankAccountList(searchResponse, bankAccountSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToBankAccountList(SearchResponse searchResponse, - BankAccountSearchContract bankAccountSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List bankAccounts = new ArrayList(); - BankAccount bankAccount = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - bankAccount = mapper.readValue(hit.getSourceAsString(), BankAccount.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - bankAccounts.add(bankAccount); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(bankAccounts); - - return page; - } - - private SearchRequestBuilder getSearchRequest(BankAccountSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), BankAccountEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchBankAccount(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(BankAccount.class.getSimpleName().toLowerCase()) - .setTypes(BankAccount.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankAccountRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankAccountRepository.java deleted file mode 100644 index 43565a104bd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankAccountRepository.java +++ /dev/null @@ -1,234 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankAccountSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.BankAccountEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.BankAccountJdbcRepository; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.BankAccountSearchContract; -import org.egov.egf.master.web.requests.BankAccountRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class BankAccountRepository { - - @Autowired - private BankAccountJdbcRepository bankAccountJdbcRepository; - - @Autowired - private MastersQueueRepository bankAccountQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private BankAccountESRepository bankAccountESRepository; - - private String persistThroughKafka; - - @Autowired - public BankAccountRepository(BankAccountJdbcRepository bankAccountJdbcRepository, - MastersQueueRepository bankAccountQueueRepository, - FinancialConfigurationService financialConfigurationService, - BankAccountESRepository bankAccountESRepository, - @Value("${persist.through.kafka}") String persistThroughKafka) { - this.bankAccountJdbcRepository = bankAccountJdbcRepository; - this.bankAccountQueueRepository = bankAccountQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.bankAccountESRepository = bankAccountESRepository; - this.persistThroughKafka = persistThroughKafka; - - } - - public BankAccount findById(BankAccount bankAccount) { - BankAccountEntity entity = bankAccountJdbcRepository.findById(new BankAccountEntity().toEntity(bankAccount)); - return entity.toDomain(); - - } - - public String getNextSequence() { - return bankAccountJdbcRepository.getSequence(BankAccountEntity.SEQUENCE_NAME); - } - - @Transactional - public BankAccount save(BankAccount bankAccount) { - BankAccountEntity entity = bankAccountJdbcRepository.create(new BankAccountEntity().toEntity(bankAccount)); - return entity.toDomain(); - } - - @Transactional - public BankAccount update(BankAccount bankAccount) { - BankAccountEntity entity = bankAccountJdbcRepository.update(new BankAccountEntity().toEntity(bankAccount)); - return entity.toDomain(); - } - - public boolean uniqueCheck(String fieldName, BankAccount bankAccount) { - return bankAccountJdbcRepository.uniqueCheck(fieldName, new BankAccountEntity().toEntity(bankAccount)); - } - - public void add(BankAccountRequest request) { - Map message = new HashMap<>(); - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("bankaccount_create", request); - } else { - message.put("bankaccount_update", request); - } - bankAccountQueueRepository.add(message); - } - - public Pagination search(BankAccountSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - BankAccountSearchContract bankAccountSearchContract = new BankAccountSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, bankAccountSearchContract); - return bankAccountESRepository.search(bankAccountSearchContract); - } else { - return bankAccountJdbcRepository.search(domain); - } - - } - - @Transactional - public List save(List bankAccounts, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - BankAccountContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && "yes".equalsIgnoreCase(persistThroughKafka)) { - - BankAccountRequest request = new BankAccountRequest(); - request.setRequestInfo(requestInfo); - request.setBankAccounts(new ArrayList<>()); - - for (BankAccount b : bankAccounts) { - - contract = new BankAccountContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBankAccounts().add(contract); - - } - - addToQue(request); - - return bankAccounts; - } else { - - List resultList = new ArrayList<>(); - - for (BankAccount b : bankAccounts) { - - resultList.add(save(b)); - } - - BankAccountRequest request = new BankAccountRequest(); - request.setRequestInfo(requestInfo); - request.setBankAccounts(new ArrayList<>()); - - for (BankAccount b : resultList) { - - contract = new BankAccountContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBankAccounts().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public List update(List bankAccounts, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - BankAccountContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && "yes".equalsIgnoreCase(persistThroughKafka)) { - - BankAccountRequest request = new BankAccountRequest(); - request.setRequestInfo(requestInfo); - request.setBankAccounts(new ArrayList<>()); - - for (BankAccount b : bankAccounts) { - - contract = new BankAccountContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBankAccounts().add(contract); - - } - - addToQue(request); - - return bankAccounts; - } else { - - List resultList = new ArrayList<>(); - - for (BankAccount b : bankAccounts) { - - resultList.add(update(b)); - } - - BankAccountRequest request = new BankAccountRequest(); - request.setRequestInfo(requestInfo); - request.setBankAccounts(new ArrayList<>()); - - for (BankAccount b : resultList) { - - contract = new BankAccountContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBankAccounts().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - public void addToQue(BankAccountRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("bankaccount_create", request); - } else { - message.put("bankaccount_update", request); - } - bankAccountQueueRepository.add(message); - } - - public void addToSearchQueue(BankAccountRequest request) { - Map message = new HashMap<>(); - - message.put("bankaccount_persisted", request); - - bankAccountQueueRepository.addToSearch(message); - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankBranchESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankBranchESRepository.java deleted file mode 100644 index 2818893b761..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankBranchESRepository.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.persistence.entity.BankBranchEntity; -import org.egov.egf.master.web.contract.BankBranchSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class BankBranchESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(BankBranchESRepository.class); - - public BankBranchESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(BankBranchSearchContract bankBranchSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(bankBranchSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToBankBranchList(searchResponse, bankBranchSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToBankBranchList(SearchResponse searchResponse, - BankBranchSearchContract bankBranchSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List bankBranchs = new ArrayList(); - BankBranch bankBranch = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - bankBranch = mapper.readValue(hit.getSourceAsString(), BankBranch.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - bankBranchs.add(bankBranch); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(bankBranchs); - - return page; - } - - private SearchRequestBuilder getSearchRequest(BankBranchSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), BankBranchEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchBankBranch(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(BankBranch.class.getSimpleName().toLowerCase()) - .setTypes(BankBranch.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankBranchRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankBranchRepository.java deleted file mode 100644 index b841ecec0b8..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankBranchRepository.java +++ /dev/null @@ -1,235 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.BankBranchSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.BankBranchEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.BankBranchJdbcRepository; -import org.egov.egf.master.web.contract.BankBranchContract; -import org.egov.egf.master.web.contract.BankBranchSearchContract; -import org.egov.egf.master.web.requests.BankBranchRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class BankBranchRepository { - - @Autowired - private BankBranchJdbcRepository bankBranchJdbcRepository; - - @Autowired - private MastersQueueRepository bankBranchQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private BankBranchESRepository bankBranchESRepository; - - @Autowired - public BankBranchRepository(BankBranchJdbcRepository bankBranchJdbcRepository, - MastersQueueRepository bankBranchQueueRepository, - FinancialConfigurationService financialConfigurationService, BankBranchESRepository bankBranchESRepository, - @Value("${persist.through.kafka}") String persistThroughKafka) { - this.bankBranchJdbcRepository = bankBranchJdbcRepository; - this.bankBranchQueueRepository = bankBranchQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.bankBranchESRepository = bankBranchESRepository; - this.persistThroughKafka = persistThroughKafka; - - } - - private String persistThroughKafka; - - public BankBranch findById(BankBranch bankBranch) { - BankBranchEntity entity = bankBranchJdbcRepository.findById(new BankBranchEntity().toEntity(bankBranch)); - return entity.toDomain(); - - } - - public String getNextSequence() { - return bankBranchJdbcRepository.getSequence(BankBranchEntity.SEQUENCE_NAME); - } - - @Transactional - public List save(List bankBranches, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - BankBranchContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && "yes".equalsIgnoreCase(persistThroughKafka)) { - - BankBranchRequest request = new BankBranchRequest(); - request.setRequestInfo(requestInfo); - request.setBankBranches(new ArrayList<>()); - - for (BankBranch b : bankBranches) { - - contract = new BankBranchContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBankBranches().add(contract); - - } - - addToQue(request); - - return bankBranches; - } else { - - List resultList = new ArrayList<>(); - - for (BankBranch b : bankBranches) { - - resultList.add(save(b)); - } - - BankBranchRequest request = new BankBranchRequest(); - request.setRequestInfo(requestInfo); - request.setBankBranches(new ArrayList<>()); - - for (BankBranch b : resultList) { - - contract = new BankBranchContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBankBranches().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public List update(List bankBranches, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - BankBranchContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && "yes".equalsIgnoreCase(persistThroughKafka)) { - - BankBranchRequest request = new BankBranchRequest(); - request.setRequestInfo(requestInfo); - request.setBankBranches(new ArrayList<>()); - - for (BankBranch b : bankBranches) { - - contract = new BankBranchContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBankBranches().add(contract); - - } - - addToQue(request); - - return bankBranches; - } else { - - List resultList = new ArrayList<>(); - - for (BankBranch b : bankBranches) { - - resultList.add(update(b)); - } - - BankBranchRequest request = new BankBranchRequest(); - request.setRequestInfo(requestInfo); - request.setBankBranches(new ArrayList<>()); - - for (BankBranch b : resultList) { - - contract = new BankBranchContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBankBranches().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public BankBranch save(BankBranch bankBranch) { - BankBranchEntity entity = bankBranchJdbcRepository.create(new BankBranchEntity().toEntity(bankBranch)); - return entity.toDomain(); - } - - @Transactional - public BankBranch update(BankBranch bankBranch) { - BankBranchEntity entity = bankBranchJdbcRepository.update(new BankBranchEntity().toEntity(bankBranch)); - return entity.toDomain(); - } - - public void add(BankBranchRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("bankbranch_create", request); - } else { - message.put("bankbranch_update", request); - } - bankBranchQueueRepository.add(message); - } - - public Pagination search(BankBranchSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - BankBranchSearchContract bankBranchSearchContract = new BankBranchSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, bankBranchSearchContract); - return bankBranchESRepository.search(bankBranchSearchContract); - } else { - return bankBranchJdbcRepository.search(domain); - } - - } - - public void addToQue(BankBranchRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("bankbranch_create", request); - } else { - message.put("bankbranch_update", request); - } - bankBranchQueueRepository.add(message); - } - - public void addToSearchQueue(BankBranchRequest request) { - Map message = new HashMap<>(); - - message.put("bankbranch_persisted", request); - - bankBranchQueueRepository.addToSearch(message); - } - - public boolean uniqueCheck(String fieldName, BankBranch bankBranch) { - return bankBranchJdbcRepository.uniqueCheck(fieldName, new BankBranchEntity().toEntity(bankBranch)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankESRepository.java deleted file mode 100644 index f8a8c7895f1..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankESRepository.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.persistence.entity.BankEntity; -import org.egov.egf.master.web.contract.BankSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class BankESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(BankESRepository.class); - - public BankESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(BankSearchContract bankSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(bankSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToBankList(searchResponse, bankSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToBankList(SearchResponse searchResponse, BankSearchContract bankSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List banks = new ArrayList(); - Bank bank = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - bank = mapper.readValue(hit.getSourceAsString(), Bank.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - banks.add(bank); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(banks); - - return page; - } - - private SearchRequestBuilder getSearchRequest(BankSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), BankEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchBank(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(Bank.class.getSimpleName().toLowerCase()) - .setTypes(Bank.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankRepository.java deleted file mode 100644 index bb98514fb74..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BankRepository.java +++ /dev/null @@ -1,232 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.BankEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.BankJdbcRepository; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.BankSearchContract; -import org.egov.egf.master.web.requests.BankRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class BankRepository { - - @Autowired - private BankJdbcRepository bankJdbcRepository; - @Autowired - private MastersQueueRepository bankQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private BankESRepository bankESRepository; - - private String persistThroughKafka; - - @Autowired - public BankRepository(BankJdbcRepository bankJdbcRepository, MastersQueueRepository bankQueueRepository, - FinancialConfigurationService financialConfigurationService, BankESRepository bankESRepository, - @Value("${persist.through.kafka}") String persistThroughKafka) { - this.bankJdbcRepository = bankJdbcRepository; - this.bankQueueRepository = bankQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.bankESRepository = bankESRepository; - this.persistThroughKafka = persistThroughKafka; - - } - - public Bank findById(Bank bank) { - BankEntity entity = bankJdbcRepository.findById(new BankEntity().toEntity(bank)); - return entity.toDomain(); - - } - - public String getNextSequence() { - return bankJdbcRepository.getSequence(BankEntity.SEQUENCE_NAME); - } - - @Transactional - public Bank save(Bank bank) { - BankEntity entity = bankJdbcRepository.create(new BankEntity().toEntity(bank)); - return entity.toDomain(); - } - - @Transactional - public Bank update(Bank bank) { - BankEntity entity = bankJdbcRepository.update(new BankEntity().toEntity(bank)); - return entity.toDomain(); - } - - public void add(BankRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("bank_create", request); - } else { - message.put("bank_update", request); - } - bankQueueRepository.add(message); - } - - public Pagination search(BankSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - BankSearchContract bankSearchContract = new BankSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, bankSearchContract); - return bankESRepository.search(bankSearchContract); - } else { - return bankJdbcRepository.search(domain); - } - } - - @Transactional - public List save(List banks, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - BankContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && "yes".equalsIgnoreCase(persistThroughKafka)) { - - BankRequest request = new BankRequest(); - request.setRequestInfo(requestInfo); - request.setBanks(new ArrayList<>()); - - for (Bank b : banks) { - - contract = new BankContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBanks().add(contract); - - } - - addToQue(request); - - return banks; - } else { - - List resultList = new ArrayList<>(); - - for (Bank b : banks) { - - resultList.add(save(b)); - } - - BankRequest request = new BankRequest(); - request.setRequestInfo(requestInfo); - request.setBanks(new ArrayList<>()); - - for (Bank b : resultList) { - - contract = new BankContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBanks().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public List update(List banks, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - BankContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && "yes".equalsIgnoreCase(persistThroughKafka)) { - - BankRequest request = new BankRequest(); - request.setRequestInfo(requestInfo); - request.setBanks(new ArrayList<>()); - - for (Bank b : banks) { - - contract = new BankContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBanks().add(contract); - - } - - addToQue(request); - - return banks; - } else { - - List resultList = new ArrayList<>(); - - for (Bank b : banks) { - - resultList.add(update(b)); - } - - BankRequest request = new BankRequest(); - request.setRequestInfo(requestInfo); - request.setBanks(new ArrayList<>()); - - for (Bank b : resultList) { - - contract = new BankContract(); - contract.setCreatedDate(new Date()); - mapper.map(b, contract); - request.getBanks().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - public void addToQue(BankRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("bank_create", request); - } else { - message.put("bank_update", request); - } - bankQueueRepository.add(message); - } - - public void addToSearchQueue(BankRequest request) { - Map message = new HashMap<>(); - - message.put("bank_persisted", request); - - bankQueueRepository.addToSearch(message); - } - - public boolean uniqueCheck(String fieldName, Bank bank) { - return bankJdbcRepository.uniqueCheck(fieldName, new BankEntity().toEntity(bank)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BudgetGroupESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BudgetGroupESRepository.java deleted file mode 100644 index aa2ccfef719..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BudgetGroupESRepository.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.BudgetGroup; -import org.egov.egf.master.persistence.entity.BudgetGroupEntity; -import org.egov.egf.master.web.contract.BudgetGroupSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class BudgetGroupESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(BudgetGroupESRepository.class); - - public BudgetGroupESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(BudgetGroupSearchContract budgetGroupSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(budgetGroupSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToBudgetGroupList(searchResponse, budgetGroupSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToBudgetGroupList(SearchResponse searchResponse, - BudgetGroupSearchContract budgetGroupSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List budgetGroups = new ArrayList(); - BudgetGroup budgetGroup = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - budgetGroup = mapper.readValue(hit.getSourceAsString(), BudgetGroup.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - budgetGroups.add(budgetGroup); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(budgetGroups); - - return page; - } - - private SearchRequestBuilder getSearchRequest(BudgetGroupSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), BudgetGroupEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchBudgetGroup(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(BudgetGroup.class.getSimpleName().toLowerCase()) - .setTypes(BudgetGroup.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BudgetGroupRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BudgetGroupRepository.java deleted file mode 100644 index fe875156bca..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/BudgetGroupRepository.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.BudgetGroup; -import org.egov.egf.master.domain.model.BudgetGroupSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.BudgetGroupEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.BudgetGroupJdbcRepository; -import org.egov.egf.master.web.contract.BudgetGroupSearchContract; -import org.egov.egf.master.web.requests.BudgetGroupRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class BudgetGroupRepository { - - @Autowired - private BudgetGroupJdbcRepository budgetGroupJdbcRepository; - - @Autowired - private MastersQueueRepository budgetGroupQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private BudgetGroupESRepository budgetGroupESRepository; - - public BudgetGroup findById(BudgetGroup budgetGroup) { - BudgetGroupEntity entity = budgetGroupJdbcRepository.findById(new BudgetGroupEntity().toEntity(budgetGroup)); - return entity.toDomain(); - - } - - public String getNextSequence(){ - return budgetGroupJdbcRepository.getSequence(BudgetGroupEntity.SEQUENCE_NAME); - } - - @Transactional - public BudgetGroup save(BudgetGroup budgetGroup) { - BudgetGroupEntity entity = budgetGroupJdbcRepository.create(new BudgetGroupEntity().toEntity(budgetGroup)); - return entity.toDomain(); - } - - @Transactional - public BudgetGroup update(BudgetGroup budgetGroup) { - BudgetGroupEntity entity = budgetGroupJdbcRepository.update(new BudgetGroupEntity().toEntity(budgetGroup)); - return entity.toDomain(); - } - - public void add(BudgetGroupRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("budgetgroup_create", request); - } else { - message.put("budgetgroup_update", request); - } - budgetGroupQueueRepository.add(message); - } - - public Pagination search(BudgetGroupSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - BudgetGroupSearchContract budgetGroupSearchContract = new BudgetGroupSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, budgetGroupSearchContract); - return budgetGroupESRepository.search(budgetGroupSearchContract); - } else { - return budgetGroupJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, BudgetGroup budgetGroup) { - return budgetGroupJdbcRepository.uniqueCheck(fieldName, new BudgetGroupEntity().toEntity(budgetGroup)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountDetailESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountDetailESRepository.java deleted file mode 100644 index acdaa44fddd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountDetailESRepository.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.persistence.entity.ChartOfAccountDetailEntity; -import org.egov.egf.master.web.contract.ChartOfAccountDetailSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class ChartOfAccountDetailESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(ChartOfAccountDetailESRepository.class); - - public ChartOfAccountDetailESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(chartOfAccountDetailSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToChartOfAccountDetailList(searchResponse, chartOfAccountDetailSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToChartOfAccountDetailList(SearchResponse searchResponse, - ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List chartOfAccountDetails = new ArrayList(); - ChartOfAccountDetail chartOfAccountDetail = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - chartOfAccountDetail = mapper.readValue(hit.getSourceAsString(), ChartOfAccountDetail.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - chartOfAccountDetails.add(chartOfAccountDetail); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(chartOfAccountDetails); - - return page; - } - - private SearchRequestBuilder getSearchRequest(ChartOfAccountDetailSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), ChartOfAccountDetailEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchChartOfAccountDetail(criteria); - SearchRequestBuilder searchRequestBuilder = esClient - .prepareSearch(ChartOfAccountDetail.class.getSimpleName().toLowerCase()) - .setTypes(ChartOfAccountDetail.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountDetailRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountDetailRepository.java deleted file mode 100644 index cf689f93335..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountDetailRepository.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.ChartOfAccountDetailEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.ChartOfAccountDetailJdbcRepository; -import org.egov.egf.master.web.contract.ChartOfAccountDetailSearchContract; -import org.egov.egf.master.web.requests.ChartOfAccountDetailRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class ChartOfAccountDetailRepository { - - @Autowired - private ChartOfAccountDetailJdbcRepository chartOfAccountDetailJdbcRepository; - - @Autowired - private MastersQueueRepository chartOfAccountDetailQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private ChartOfAccountDetailESRepository chartOfAccountDetailESRepository; - - public ChartOfAccountDetail findById(ChartOfAccountDetail chartOfAccountDetail) { - ChartOfAccountDetailEntity entity = chartOfAccountDetailJdbcRepository - .findById(new ChartOfAccountDetailEntity().toEntity(chartOfAccountDetail)); - return entity.toDomain(); - - } - - public String getNextSequence(){ - return chartOfAccountDetailJdbcRepository.getSequence(ChartOfAccountDetailEntity.SEQUENCE_NAME); - } - - @Transactional - public ChartOfAccountDetail save(ChartOfAccountDetail chartOfAccountDetail) { - ChartOfAccountDetailEntity entity = chartOfAccountDetailJdbcRepository - .create(new ChartOfAccountDetailEntity().toEntity(chartOfAccountDetail)); - return entity.toDomain(); - } - - @Transactional - public ChartOfAccountDetail update(ChartOfAccountDetail chartOfAccountDetail) { - ChartOfAccountDetailEntity entity = chartOfAccountDetailJdbcRepository - .update(new ChartOfAccountDetailEntity().toEntity(chartOfAccountDetail)); - return entity.toDomain(); - } - - public void add(ChartOfAccountDetailRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("chartofaccountdetail_create", request); - } else { - message.put("chartofaccountdetail_update", request); - } - chartOfAccountDetailQueueRepository.add(message); - } - - public Pagination search(ChartOfAccountDetailSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract = new ChartOfAccountDetailSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, chartOfAccountDetailSearchContract); - return chartOfAccountDetailESRepository.search(chartOfAccountDetailSearchContract); - } else { - return chartOfAccountDetailJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, ChartOfAccountDetail chartOfAccountDetail) { - return chartOfAccountDetailJdbcRepository.uniqueCheck(fieldName, new ChartOfAccountDetailEntity().toEntity(chartOfAccountDetail)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountESRepository.java deleted file mode 100644 index 4cdef8ce2e3..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountESRepository.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.persistence.entity.ChartOfAccountEntity; -import org.egov.egf.master.web.contract.ChartOfAccountSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class ChartOfAccountESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(ChartOfAccountESRepository.class); - - public ChartOfAccountESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(ChartOfAccountSearchContract chartOfAccountSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(chartOfAccountSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToChartOfAccountList(searchResponse, chartOfAccountSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToChartOfAccountList(SearchResponse searchResponse, - ChartOfAccountSearchContract chartOfAccountSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List chartOfAccounts = new ArrayList(); - ChartOfAccount chartOfAccount = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - chartOfAccount = mapper.readValue(hit.getSourceAsString(), ChartOfAccount.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - chartOfAccounts.add(chartOfAccount); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(chartOfAccounts); - - return page; - } - - private SearchRequestBuilder getSearchRequest(ChartOfAccountSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), ChartOfAccountEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchChartOfAccount(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(ChartOfAccount.class.getSimpleName().toLowerCase()) - .setTypes(ChartOfAccount.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountRepository.java deleted file mode 100644 index 428ee306eb9..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ChartOfAccountRepository.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.ChartOfAccountEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.ChartOfAccountJdbcRepository; -import org.egov.egf.master.web.contract.ChartOfAccountSearchContract; -import org.egov.egf.master.web.requests.ChartOfAccountRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class ChartOfAccountRepository { - - @Autowired - private ChartOfAccountJdbcRepository chartOfAccountJdbcRepository; - - @Autowired - private MastersQueueRepository chartOfAccountQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private ChartOfAccountESRepository chartOfAccountESRepository; - - public ChartOfAccount findById(ChartOfAccount chartOfAccount) { - ChartOfAccountEntity entity = chartOfAccountJdbcRepository - .findById(new ChartOfAccountEntity().toEntity(chartOfAccount)); - return entity.toDomain(); - - } - - public String getNextSequence(){ - return chartOfAccountJdbcRepository.getSequence(ChartOfAccountEntity.SEQUENCE_NAME); - } - - @Transactional - public ChartOfAccount save(ChartOfAccount chartOfAccount) { - ChartOfAccountEntity entity = chartOfAccountJdbcRepository - .create(new ChartOfAccountEntity().toEntity(chartOfAccount)); - return entity.toDomain(); - } - - @Transactional - public ChartOfAccount update(ChartOfAccount chartOfAccount) { - ChartOfAccountEntity entity = chartOfAccountJdbcRepository - .update(new ChartOfAccountEntity().toEntity(chartOfAccount)); - return entity.toDomain(); - } - - public void add(ChartOfAccountRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("chartofaccount_create", request); - } else { - message.put("chartofaccount_update", request); - } - chartOfAccountQueueRepository.add(message); - } - - public Pagination search(ChartOfAccountSearch domain) { - - Set chartOfAccountSet = new HashSet(); - Pagination finalResult = new Pagination<>(); - Pagination result = new Pagination<>(); - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - ChartOfAccountSearchContract chartOfAccountSearchContract = new ChartOfAccountSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, chartOfAccountSearchContract); - result = chartOfAccountESRepository.search(chartOfAccountSearchContract); - } else { - - result = chartOfAccountJdbcRepository.search(domain); - } - - if (domain != null && domain.getAccountCodePurpose() != null - && domain.getAccountCodePurpose().getId() != null) { - - domain.setAccountCodePurpose(null); - - for (ChartOfAccount coa : result.getPagedData()) { - chartOfAccountSet.add(coa); - domain.setGlcode(coa.getGlcode() + "%"); - Pagination result1 = chartOfAccountJdbcRepository.search(domain); - for (ChartOfAccount temp : result1.getPagedData()) { - chartOfAccountSet.add(temp); - } - finalResult = result1; - } - finalResult.setTotalResults(chartOfAccountSet.size()); - finalResult.setPagedData(new ArrayList<>(chartOfAccountSet)); - - return finalResult; - - } else - - return result; - - } - - public boolean uniqueCheck(String fieldName, ChartOfAccount chartOfAccount) { - return chartOfAccountJdbcRepository.uniqueCheck(fieldName, new ChartOfAccountEntity().toEntity(chartOfAccount)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/CommonDbRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/CommonDbRepository.java deleted file mode 100644 index 6be3098758d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/CommonDbRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.egov.egf.master.domain.repository; - -public interface CommonDbRepository { - - T save(T entity); - - T update(T entity); - - T findById(T entity); - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ElasticSearchQueryFactory.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ElasticSearchQueryFactory.java deleted file mode 100644 index eb3f60821d3..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/ElasticSearchQueryFactory.java +++ /dev/null @@ -1,385 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.elasticsearch.index.query.QueryBuilders.boolQuery; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.egov.common.util.ElasticSearchUtils; -import org.egov.egf.master.web.contract.AccountCodePurposeSearchContract; -import org.egov.egf.master.web.contract.AccountDetailKeySearchContract; -import org.egov.egf.master.web.contract.AccountDetailTypeSearchContract; -import org.egov.egf.master.web.contract.AccountEntitySearchContract; -import org.egov.egf.master.web.contract.BankAccountSearchContract; -import org.egov.egf.master.web.contract.BankBranchSearchContract; -import org.egov.egf.master.web.contract.BankSearchContract; -import org.egov.egf.master.web.contract.BudgetGroupSearchContract; -import org.egov.egf.master.web.contract.ChartOfAccountDetailSearchContract; -import org.egov.egf.master.web.contract.ChartOfAccountSearchContract; -import org.egov.egf.master.web.contract.FinancialYearSearchContract; -import org.egov.egf.master.web.contract.FiscalPeriodSearchContract; -import org.egov.egf.master.web.contract.FunctionSearchContract; -import org.egov.egf.master.web.contract.FunctionarySearchContract; -import org.egov.egf.master.web.contract.FundSearchContract; -import org.egov.egf.master.web.contract.FundsourceSearchContract; -import org.egov.egf.master.web.contract.RecoverySearchContract; -import org.egov.egf.master.web.contract.SchemeSearchContract; -import org.egov.egf.master.web.contract.SubSchemeSearchContract; -import org.egov.egf.master.web.contract.SupplierSearchContract; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ElasticSearchQueryFactory { - - @Autowired - private ElasticSearchUtils elasticSearchUtils; - - public BoolQueryBuilder searchFund(FundSearchContract fundSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (fundSearchContract.getIds() != null && !fundSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(fundSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(fundSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(fundSearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(fundSearchContract.getIdentifier(), "identifier", boolQueryBuilder); - elasticSearchUtils.add(fundSearchContract.getLevel(), "level", boolQueryBuilder); - elasticSearchUtils.add(fundSearchContract.getParent(), "parent", boolQueryBuilder); - elasticSearchUtils.add(fundSearchContract.getActive(), "active", boolQueryBuilder); - - return boolQueryBuilder; - } - - public BoolQueryBuilder searchAccountCodePurpose( - AccountCodePurposeSearchContract accountCodePurposeSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (accountCodePurposeSearchContract.getIds() != null && !accountCodePurposeSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(accountCodePurposeSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(accountCodePurposeSearchContract.getName(), "name", boolQueryBuilder); - - return boolQueryBuilder; - } - - public BoolQueryBuilder searchAccountDetailKey(AccountDetailKeySearchContract accountDetailKeySearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (accountDetailKeySearchContract.getIds() != null && !accountDetailKeySearchContract.getIds().isEmpty()) - elasticSearchUtils.add(accountDetailKeySearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(accountDetailKeySearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(accountDetailKeySearchContract.getKey(), "key", boolQueryBuilder); - elasticSearchUtils.add(accountDetailKeySearchContract.getAccountDetailType(), "accountDetailType", - boolQueryBuilder); - return boolQueryBuilder; - } - - public BoolQueryBuilder searchAccountDetailType(AccountDetailTypeSearchContract accountDetailTypeSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (accountDetailTypeSearchContract.getIds() != null && !accountDetailTypeSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(accountDetailTypeSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(accountDetailTypeSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(accountDetailTypeSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(accountDetailTypeSearchContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(accountDetailTypeSearchContract.getTableName(), "tableName", boolQueryBuilder); - elasticSearchUtils.add(accountDetailTypeSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(accountDetailTypeSearchContract.getFullyQualifiedName(), "fullyQualifiedName", - boolQueryBuilder); - return boolQueryBuilder; - } - - public BoolQueryBuilder searchAccountEntity(AccountEntitySearchContract accountEntitySearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (accountEntitySearchContract.getIds() != null && !accountEntitySearchContract.getIds().isEmpty()) - elasticSearchUtils.add(accountEntitySearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(accountEntitySearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(accountEntitySearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(accountEntitySearchContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(accountEntitySearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(accountEntitySearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(accountEntitySearchContract.getAccountDetailType(), "accountDetailType", - boolQueryBuilder); - return boolQueryBuilder; - - } - - public BoolQueryBuilder searchBankAccount(BankAccountSearchContract bankAccountSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (bankAccountSearchContract.getIds() != null && !bankAccountSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(bankAccountSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(bankAccountSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(bankAccountSearchContract.getChartOfAccount(), "chartOfAccount", boolQueryBuilder); - elasticSearchUtils.add(bankAccountSearchContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(bankAccountSearchContract.getFund(), "fund", boolQueryBuilder); - elasticSearchUtils.add(bankAccountSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(bankAccountSearchContract.getAccountNumber(), "accountNumber", boolQueryBuilder); - elasticSearchUtils.add(bankAccountSearchContract.getAccountType(), "accountType", boolQueryBuilder); - elasticSearchUtils.add(bankAccountSearchContract.getPayTo(), "payTo", boolQueryBuilder); - elasticSearchUtils.add(bankAccountSearchContract.getType(), "type", boolQueryBuilder); - - return boolQueryBuilder; - - } - - public BoolQueryBuilder searchBankBranch(BankBranchSearchContract bankBranchSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (bankBranchSearchContract.getIds() != null && !bankBranchSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(bankBranchSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getBank(), "bank", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getAddress(), "address", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getAddress2(), "address2", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getBank(), "city", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getActive(), "state", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getAddress(), "pincode", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getPhone(), "phone", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getFax(), "fax", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getContactPerson(), "contactPerson", boolQueryBuilder); - elasticSearchUtils.add(bankBranchSearchContract.getMicr(), "micr", boolQueryBuilder); - - return boolQueryBuilder; - - } - - public BoolQueryBuilder searchBank(BankSearchContract bankSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (bankSearchContract.getIds() != null && !bankSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(bankSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(bankSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(bankSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(bankSearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(bankSearchContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(bankSearchContract.getType(), "type", boolQueryBuilder); - elasticSearchUtils.add(bankSearchContract.getActive(), "active", boolQueryBuilder); - return boolQueryBuilder; - - } - - public BoolQueryBuilder searchBudgetGroup(BudgetGroupSearchContract budgetGroupSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (budgetGroupSearchContract.getIds() != null && !budgetGroupSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(budgetGroupSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(budgetGroupSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(budgetGroupSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(budgetGroupSearchContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(budgetGroupSearchContract.getMajorCode(), "majorCode", boolQueryBuilder); - elasticSearchUtils.add(budgetGroupSearchContract.getMaxCode(), "maxCode", boolQueryBuilder); - elasticSearchUtils.add(budgetGroupSearchContract.getMinCode(), "minCode", boolQueryBuilder); - elasticSearchUtils.add(budgetGroupSearchContract.getAccountType(), "accountType", boolQueryBuilder); - elasticSearchUtils.add(budgetGroupSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(budgetGroupSearchContract.getBudgetingType(), "budgetingType", boolQueryBuilder); - return boolQueryBuilder; - - } - - public BoolQueryBuilder searchChartOfAccount(ChartOfAccountSearchContract chartOfAccountContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (chartOfAccountContract.getIds() != null && !chartOfAccountContract.getIds().isEmpty()) - elasticSearchUtils.add(chartOfAccountContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getMajorCode(), "majorCode", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getGlcode(), "glcode", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getAccountCodePurpose(), "accountCodePurpose", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getIsActiveForPosting(), "isActiveForPosting", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getParentId(), "parentId", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getType(), "type", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getClassification(), "classification", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getFunctionRequired(), "functionRequired", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getBudgetCheckRequired(), "budgetCheckRequired", - boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountContract.getIsSubLedger(), "isSubLedger", boolQueryBuilder); - return boolQueryBuilder; - - } - - public BoolQueryBuilder searchChartOfAccountDetail( - ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (chartOfAccountDetailSearchContract.getIds() != null - && !chartOfAccountDetailSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(chartOfAccountDetailSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountDetailSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountDetailSearchContract.getChartOfAccount(), "chartOfAccount", - boolQueryBuilder); - elasticSearchUtils.add(chartOfAccountDetailSearchContract.getAccountDetailType(), "accountDetailType", - boolQueryBuilder); - return boolQueryBuilder; - - } - - public BoolQueryBuilder searchFinancialYear(FinancialYearSearchContract financialYearSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (financialYearSearchContract.getIds() != null && !financialYearSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(financialYearSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(financialYearSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(financialYearSearchContract.getFinYearRange(), "finYearRange", boolQueryBuilder); - elasticSearchUtils.add(financialYearSearchContract.getStartingDate(), "startingDate", boolQueryBuilder); - elasticSearchUtils.add(financialYearSearchContract.getEndingDate(), "endingDate", boolQueryBuilder); - elasticSearchUtils.add(financialYearSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(financialYearSearchContract.getIsActiveForPosting(), "isActiveForPosting", - boolQueryBuilder); - elasticSearchUtils.add(financialYearSearchContract.getIsClosed(), "isClosed", boolQueryBuilder); - elasticSearchUtils.add(financialYearSearchContract.getTransferClosingBalance(), "transferClosingBalance", - boolQueryBuilder); - return boolQueryBuilder; - - } - - public BoolQueryBuilder searchFunction(FunctionSearchContract functionSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (functionSearchContract.getIds() != null && !functionSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(functionSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(functionSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(functionSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(functionSearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(functionSearchContract.getLevel(), "level", boolQueryBuilder); - elasticSearchUtils.add(functionSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(functionSearchContract.getParentId(), "parentId", boolQueryBuilder); - return boolQueryBuilder; - - } - - public BoolQueryBuilder searchFunctionary(FunctionarySearchContract functionarySearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (functionarySearchContract.getIds() != null && !functionarySearchContract.getIds().isEmpty()) - elasticSearchUtils.add(functionarySearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(functionarySearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(functionarySearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(functionarySearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(functionarySearchContract.getActive(), "active", boolQueryBuilder); - return boolQueryBuilder; - } - - public BoolQueryBuilder searchScheme(SchemeSearchContract schemeSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (schemeSearchContract.getIds() != null && !schemeSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(schemeSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(schemeSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(schemeSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(schemeSearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(schemeSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(schemeSearchContract.getValidFrom(), "validFrom", boolQueryBuilder); - elasticSearchUtils.add(schemeSearchContract.getValidTo(), "validTo", boolQueryBuilder); - elasticSearchUtils.add(schemeSearchContract.getFund(), "fund", boolQueryBuilder); - elasticSearchUtils.add(schemeSearchContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(schemeSearchContract.getBoundary(), "boundary", boolQueryBuilder); - - return boolQueryBuilder; - } - - public BoolQueryBuilder searchSubScheme(SubSchemeSearchContract subSchemeSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (subSchemeSearchContract.getIds() != null && !subSchemeSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(subSchemeSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(subSchemeSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(subSchemeSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(subSchemeSearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(subSchemeSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(subSchemeSearchContract.getValidFrom(), "validFrom", boolQueryBuilder); - elasticSearchUtils.add(subSchemeSearchContract.getValidTo(), "validTo", boolQueryBuilder); - elasticSearchUtils.add(subSchemeSearchContract.getScheme(), "scheme", boolQueryBuilder); - elasticSearchUtils.add(subSchemeSearchContract.getDepartmentId(), "departmentId", boolQueryBuilder); - - return boolQueryBuilder; - } - - public BoolQueryBuilder searchSupplier(SupplierSearchContract supplierSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (supplierSearchContract.getIds() != null && !supplierSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(supplierSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getAddress(), "address", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getMobile(), "mobile", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getEmail(), "email", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getDescription(), "description", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getPanNo(), "panNo", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getTinNo(), "tinNo", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getRegistationNo(), "registationNo", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getBankAccount(), "bankAccount", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getIfscCode(), "ifscCode", boolQueryBuilder); - elasticSearchUtils.add(supplierSearchContract.getBank(), "bank", boolQueryBuilder); - - return boolQueryBuilder; - } - - public BoolQueryBuilder searchFiscalPeriod(FiscalPeriodSearchContract fiscalPeriodSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (fiscalPeriodSearchContract.getIds() != null && !fiscalPeriodSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(fiscalPeriodSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(fiscalPeriodSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(fiscalPeriodSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(fiscalPeriodSearchContract.getFinancialYear(), "financialYear", boolQueryBuilder); - elasticSearchUtils.add(fiscalPeriodSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(fiscalPeriodSearchContract.getStartingDate(), "startingDate", boolQueryBuilder); - elasticSearchUtils.add(fiscalPeriodSearchContract.getEndingDate(), "endingDate", boolQueryBuilder); - elasticSearchUtils.add(fiscalPeriodSearchContract.getIsActiveForPosting(), "isActiveForPosting", - boolQueryBuilder); - elasticSearchUtils.add(fiscalPeriodSearchContract.getIsClosed(), "isClosed", boolQueryBuilder); - - return boolQueryBuilder; - } - - public BoolQueryBuilder searchFundsource(FundsourceSearchContract fundsourceSearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (fundsourceSearchContract.getIds() != null && !fundsourceSearchContract.getIds().isEmpty()) - elasticSearchUtils.add(fundsourceSearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(fundsourceSearchContract.getId(), "id", boolQueryBuilder); - elasticSearchUtils.add(fundsourceSearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(fundsourceSearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(fundsourceSearchContract.getActive(), "active", boolQueryBuilder); - elasticSearchUtils.add(fundsourceSearchContract.getParent(), "parent", boolQueryBuilder); - elasticSearchUtils.add(fundsourceSearchContract.getIsParent(), "isParent", boolQueryBuilder); - elasticSearchUtils.add(fundsourceSearchContract.getLlevel(), "llevel", boolQueryBuilder); - elasticSearchUtils.add(fundsourceSearchContract.getType(), "type", boolQueryBuilder); - - return boolQueryBuilder; - } - - public BoolQueryBuilder searchRecovery(RecoverySearchContract recoverySearchContract) { - BoolQueryBuilder boolQueryBuilder = boolQuery(); - if (recoverySearchContract.getIds() != null && !recoverySearchContract.getIds().isEmpty()) - elasticSearchUtils.add(recoverySearchContract.getIds(), "id", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getName(), "name", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getCode(), "code", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getActive(), "active", boolQueryBuilder); - if (recoverySearchContract.getChartOfAccount() != null) - elasticSearchUtils.add(recoverySearchContract.getChartOfAccount(), "chartOfAccount", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getType(), "type", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getFlat(), "flat", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getPercentage(), "percentage", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getRemitted(), "remitted", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getIfscCode(), "ifscCode", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getMode(), "mode", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getRemittanceMode(), "remittanceMode", boolQueryBuilder); - elasticSearchUtils.add(recoverySearchContract.getAccountNumber(), "accountNumber", boolQueryBuilder); - - return boolQueryBuilder; - } - - public List prepareOrderBys(String sortBy) { - List orderByList = new ArrayList(); - List sortByList = new ArrayList(); - if (sortBy.contains(",")) { - sortByList = Arrays.asList(sortBy.split(",")); - } else { - sortByList = Arrays.asList(sortBy); - } - for (String s : sortByList) { - if (s.contains(" ") - && (s.toLowerCase().trim().endsWith("asc") || s.toLowerCase().trim().endsWith("desc"))) { - orderByList.add(s.trim()); - } else { - orderByList.add(s.trim() + " asc"); - } - } - - return orderByList; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialConfigurationRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialConfigurationRepository.java deleted file mode 100644 index 8e05ddcc104..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialConfigurationRepository.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.FinancialConfiguration; -import org.egov.egf.master.domain.model.FinancialConfigurationSearch; -import org.egov.egf.master.domain.model.FinancialConfigurationValue; -import org.egov.egf.master.domain.model.FinancialConfigurationValueSearch; -import org.egov.egf.master.persistence.entity.FinancialConfigurationEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FinancialConfigurationJdbcRepository; -import org.egov.egf.master.web.requests.FinancialConfigurationRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class FinancialConfigurationRepository { - - @Autowired - private FinancialConfigurationJdbcRepository financialConfigurationJdbcRepository; - - @Autowired - private FinancialConfigurationValueRepository financialConfigurationValueRepository; - - @Autowired - private MastersQueueRepository financialConfigurationQueueRepository; - - public FinancialConfiguration findById(FinancialConfiguration financialConfiguration) { - FinancialConfigurationEntity entity = financialConfigurationJdbcRepository - .findById(new FinancialConfigurationEntity().toEntity(financialConfiguration)); - return entity.toDomain(); - - } - - @Transactional - public FinancialConfiguration save(FinancialConfiguration financialConfiguration) { - FinancialConfigurationEntity entity = financialConfigurationJdbcRepository - .create(new FinancialConfigurationEntity().toEntity(financialConfiguration)); - return entity.toDomain(); - } - - @Transactional - public FinancialConfiguration update(FinancialConfiguration financialConfiguration) { - FinancialConfigurationEntity entity = financialConfigurationJdbcRepository - .update(new FinancialConfigurationEntity().toEntity(financialConfiguration)); - return entity.toDomain(); - } - - public void add(FinancialConfigurationRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("financialconfiguration_create", request); - } else { - message.put("financialconfiguration_update", request); - } - financialConfigurationQueueRepository.add(message); - } - - public Pagination search(FinancialConfigurationSearch domain) { - - if (domain.getName() != null && domain.getModule() != null && !domain.getName().isEmpty() - && !domain.getModule().isEmpty()) { - List finalList = new ArrayList<>(); - - Pagination response = financialConfigurationJdbcRepository.search(domain); - FinancialConfigurationValueSearch valueSearchReq = new FinancialConfigurationValueSearch(); - - for (FinancialConfiguration fc : response.getPagedData()) { - - FinancialConfiguration financialConfiguration = FinancialConfiguration.builder().id(fc.getId()).build(); - financialConfiguration.setTenantId(fc.getTenantId()); - valueSearchReq.setFinancialConfiguration(financialConfiguration); - Pagination valuesRes = financialConfigurationValueRepository.search(valueSearchReq); - fc.setValues(valuesRes.getPagedData()); - finalList.add(fc); - } - - response.setPagedData(finalList); - - return response; - - } - - return financialConfigurationJdbcRepository.search(domain); - - } - - public boolean uniqueCheck(String fieldName, FinancialConfiguration financialConfiguration) { - return financialConfigurationJdbcRepository.uniqueCheck(fieldName, new FinancialConfigurationEntity().toEntity(financialConfiguration)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialConfigurationValueRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialConfigurationValueRepository.java deleted file mode 100644 index bd9d565bf23..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialConfigurationValueRepository.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.FinancialConfigurationValue; -import org.egov.egf.master.domain.model.FinancialConfigurationValueSearch; -import org.egov.egf.master.persistence.entity.FinancialConfigurationValueEntity; -import org.egov.egf.master.persistence.repository.FinancialConfigurationValueJdbcRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class FinancialConfigurationValueRepository { - - @Autowired - private FinancialConfigurationValueJdbcRepository financialConfigurationValueJdbcRepository; - - public FinancialConfigurationValue findById(FinancialConfigurationValue financialConfigurationValue) { - FinancialConfigurationValueEntity entity = financialConfigurationValueJdbcRepository - .findById(new FinancialConfigurationValueEntity().toEntity(financialConfigurationValue)); - return entity.toDomain(); - - } - - @Transactional - public FinancialConfigurationValue save(FinancialConfigurationValue financialConfigurationValue) { - FinancialConfigurationValueEntity entity = financialConfigurationValueJdbcRepository - .create(new FinancialConfigurationValueEntity().toEntity(financialConfigurationValue)); - return entity.toDomain(); - } - - @Transactional - public FinancialConfigurationValue update(FinancialConfigurationValue financialConfigurationValue) { - FinancialConfigurationValueEntity entity = financialConfigurationValueJdbcRepository - .update(new FinancialConfigurationValueEntity().toEntity(financialConfigurationValue)); - return entity.toDomain(); - } - - /* - * public void add(FinancialConfigurationValueRequest request) { Map message = new HashMap<>(); if - * (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - * message.put("financialconfigurationvalue_create", request); } else { message.put("financialconfigurationvalue_update", - * request); } financialConfigurationValueQueueRepository.add(message); } - */ - - public Pagination search(FinancialConfigurationValueSearch domain) { - - return financialConfigurationValueJdbcRepository.search(domain); - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialStatusRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialStatusRepository.java deleted file mode 100644 index cf0cdb4403d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialStatusRepository.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.FinancialStatus; -import org.egov.egf.master.domain.model.FinancialStatusSearch; -import org.egov.egf.master.persistence.entity.FinancialStatusEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FinancialStatusJdbcRepository; -import org.egov.egf.master.web.requests.FinancialStatusRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class FinancialStatusRepository { - - @Autowired - private FinancialStatusJdbcRepository financialStatusJdbcRepository; - @Autowired - private MastersQueueRepository financialStatusQueueRepository; - - public FinancialStatus findById(FinancialStatus financialStatus) { - FinancialStatusEntity entity = financialStatusJdbcRepository - .findById(new FinancialStatusEntity().toEntity(financialStatus)); - return entity.toDomain(); - - } - - @Transactional - public FinancialStatus save(FinancialStatus financialStatus) { - FinancialStatusEntity entity = financialStatusJdbcRepository - .create(new FinancialStatusEntity().toEntity(financialStatus)); - return entity.toDomain(); - } - - @Transactional - public FinancialStatus update(FinancialStatus financialStatus) { - FinancialStatusEntity entity = financialStatusJdbcRepository - .update(new FinancialStatusEntity().toEntity(financialStatus)); - return entity.toDomain(); - } - - public void add(FinancialStatusRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("financialstatus_create", request); - } else { - message.put("financialstatus_update", request); - } - financialStatusQueueRepository.add(message); - } - - public Pagination search(FinancialStatusSearch domain) { - - return financialStatusJdbcRepository.search(domain); - - } - - public boolean uniqueCheck(String fieldName, FinancialStatus financialStatus) { - return financialStatusJdbcRepository.uniqueCheck(fieldName, new FinancialStatusEntity().toEntity(financialStatus)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialYearESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialYearESRepository.java deleted file mode 100644 index b58e91dcbaa..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialYearESRepository.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.FinancialYear; -import org.egov.egf.master.persistence.entity.FinancialYearEntity; -import org.egov.egf.master.web.contract.FinancialYearSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class FinancialYearESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(FinancialYearESRepository.class); - - public FinancialYearESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(FinancialYearSearchContract financialYearSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(financialYearSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToFinancialYearList(searchResponse, financialYearSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToFinancialYearList(SearchResponse searchResponse, - FinancialYearSearchContract financialYearSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List financialYears = new ArrayList(); - FinancialYear financialYear = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - financialYear = mapper.readValue(hit.getSourceAsString(), FinancialYear.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - financialYears.add(financialYear); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(financialYears); - - return page; - } - - private SearchRequestBuilder getSearchRequest(FinancialYearSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), FinancialYearEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchFinancialYear(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(FinancialYear.class.getSimpleName().toLowerCase()) - .setTypes(FinancialYear.class.getSimpleName().toLowerCase()) - .setQuery(boolQueryBuilder); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialYearRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialYearRepository.java deleted file mode 100644 index 72106609a4d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FinancialYearRepository.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.FinancialYear; -import org.egov.egf.master.domain.model.FinancialYearSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.FinancialYearEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FinancialYearJdbcRepository; -import org.egov.egf.master.web.contract.FinancialYearSearchContract; -import org.egov.egf.master.web.requests.FinancialYearRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class FinancialYearRepository { - - @Autowired - private FinancialYearJdbcRepository financialYearJdbcRepository; - - @Autowired - private MastersQueueRepository financialYearQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private FinancialYearESRepository financialYearESRepository; - - public FinancialYear findById(FinancialYear financialYear) { - return financialYearJdbcRepository.findById(new FinancialYearEntity().toEntity(financialYear)).toDomain(); - - } - - public FinancialYear save(FinancialYear financialYear) { - return financialYearJdbcRepository.create(new FinancialYearEntity().toEntity(financialYear)).toDomain(); - } - - public FinancialYear update(FinancialYear entity) { - return financialYearJdbcRepository.update(new FinancialYearEntity().toEntity(entity)).toDomain(); - } - - public void add(FinancialYearRequest request) { - - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("financialyear_create", request); - } else { - message.put("financialyear_update", request); - } - financialYearQueueRepository.add(message); - } - - public String getNextSequence(){ - return financialYearJdbcRepository.getSequence(FinancialYearEntity.SEQUENCE_NAME); - } - - public Pagination search(FinancialYearSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - FinancialYearSearchContract financialYearSearchContract = new FinancialYearSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, financialYearSearchContract); - return financialYearESRepository.search(financialYearSearchContract); - } else { - return financialYearJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, FinancialYear financialYear) { - return financialYearJdbcRepository.uniqueCheck(fieldName, new FinancialYearEntity().toEntity(financialYear)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FiscalPeriodESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FiscalPeriodESRepository.java deleted file mode 100644 index 2c25a1c6a7f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FiscalPeriodESRepository.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.FiscalPeriod; -import org.egov.egf.master.persistence.entity.FiscalPeriodEntity; -import org.egov.egf.master.web.contract.FiscalPeriodSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class FiscalPeriodESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(FiscalPeriodESRepository.class); - - public FiscalPeriodESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(FiscalPeriodSearchContract fiscalPeriodSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(fiscalPeriodSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToFiscalPeriodList(searchResponse, fiscalPeriodSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToFiscalPeriodList(SearchResponse searchResponse, - FiscalPeriodSearchContract fiscalPeriodSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List fiscalPeriods = new ArrayList(); - FiscalPeriod fiscalPeriod = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - fiscalPeriod = mapper.readValue(hit.getSourceAsString(), FiscalPeriod.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - fiscalPeriods.add(fiscalPeriod); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(fiscalPeriods); - - return page; - } - - private SearchRequestBuilder getSearchRequest(FiscalPeriodSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), FiscalPeriodEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchFiscalPeriod(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(FiscalPeriod.class.getSimpleName().toLowerCase()) - .setTypes(FiscalPeriod.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FiscalPeriodRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FiscalPeriodRepository.java deleted file mode 100644 index 5845f583d06..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FiscalPeriodRepository.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.FiscalPeriod; -import org.egov.egf.master.domain.model.FiscalPeriodSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.FiscalPeriodEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FiscalPeriodJdbcRepository; -import org.egov.egf.master.web.contract.FiscalPeriodSearchContract; -import org.egov.egf.master.web.requests.FiscalPeriodRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class FiscalPeriodRepository { - - @Autowired - private FiscalPeriodJdbcRepository fiscalPeriodJdbcRepository; - - @Autowired - private MastersQueueRepository fiscalPeriodQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private FiscalPeriodESRepository fiscalPeriodESRepository; - - public FiscalPeriod findById(FiscalPeriod fiscalPeriod) { - FiscalPeriodEntity entity = fiscalPeriodJdbcRepository - .findById(new FiscalPeriodEntity().toEntity(fiscalPeriod)); - return entity.toDomain(); - - } - - public String getNextSequence(){ - return fiscalPeriodJdbcRepository.getSequence(FiscalPeriodEntity.SEQUENCE_NAME); - } - - @Transactional - public FiscalPeriod save(FiscalPeriod fiscalPeriod) { - FiscalPeriodEntity entity = fiscalPeriodJdbcRepository.create(new FiscalPeriodEntity().toEntity(fiscalPeriod)); - return entity.toDomain(); - } - - @Transactional - public FiscalPeriod update(FiscalPeriod fiscalPeriod) { - FiscalPeriodEntity entity = fiscalPeriodJdbcRepository.update(new FiscalPeriodEntity().toEntity(fiscalPeriod)); - return entity.toDomain(); - } - - public void add(FiscalPeriodRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("fiscalperiod_create", request); - } else { - message.put("fiscalperiod_update", request); - } - fiscalPeriodQueueRepository.add(message); - } - - public Pagination search(FiscalPeriodSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - FiscalPeriodSearchContract fiscalPeriodSearchContract = new FiscalPeriodSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, fiscalPeriodSearchContract); - return fiscalPeriodESRepository.search(fiscalPeriodSearchContract); - } else { - return fiscalPeriodJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, FiscalPeriod fiscalPeriod) { - return fiscalPeriodJdbcRepository.uniqueCheck(fieldName, new FiscalPeriodEntity().toEntity(fiscalPeriod)); - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionESRepository.java deleted file mode 100644 index b9cae096d3c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionESRepository.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.persistence.entity.FunctionEntity; -import org.egov.egf.master.web.contract.FunctionSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class FunctionESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(FunctionESRepository.class); - - public FunctionESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(FunctionSearchContract functionSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(functionSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToFunctionList(searchResponse, functionSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToFunctionList(SearchResponse searchResponse, FunctionSearchContract functionSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List functions = new ArrayList(); - Function function = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - function = mapper.readValue(hit.getSourceAsString(), Function.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - functions.add(function); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(functions); - - return page; - } - - private SearchRequestBuilder getSearchRequest(FunctionSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), FunctionEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchFunction(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(Function.class.getSimpleName().toLowerCase()) - .setTypes(Function.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionRepository.java deleted file mode 100644 index 110947046fd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionRepository.java +++ /dev/null @@ -1,218 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.domain.model.FunctionSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.FunctionEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FunctionJdbcRepository; -import org.egov.egf.master.web.contract.FunctionContract; -import org.egov.egf.master.web.contract.FunctionSearchContract; -import org.egov.egf.master.web.requests.FunctionRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class FunctionRepository { - - private FunctionJdbcRepository functionJdbcRepository; - - private MastersQueueRepository functionQueueRepository; - - private FinancialConfigurationService financialConfigurationService; - - private FunctionESRepository functionESRepository; - - private String persistThroughKafka; - - @Autowired - public FunctionRepository(FunctionJdbcRepository functionJdbcRepository, - MastersQueueRepository functionQueueRepository, FinancialConfigurationService financialConfigurationService, - FunctionESRepository functionESRepository, @Value("${persist.through.kafka}") String persistThroughKafka) { - this.functionJdbcRepository = functionJdbcRepository; - this.functionQueueRepository = functionQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.functionESRepository = functionESRepository; - this.persistThroughKafka = persistThroughKafka; - - } - - @Transactional - public List save(List functions, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - FunctionContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - FunctionRequest request = new FunctionRequest(); - request.setRequestInfo(requestInfo); - request.setFunctions(new ArrayList<>()); - - for (Function f : functions) { - - contract = new FunctionContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getFunctions().add(contract); - - } - - addToQue(request); - - return functions; - } else { - - List resultList = new ArrayList(); - - for (Function f : functions) { - - resultList.add(save(f)); - } - - FunctionRequest request = new FunctionRequest(); - request.setRequestInfo(requestInfo); - request.setFunctions(new ArrayList<>()); - - for (Function f : resultList) { - - contract = new FunctionContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getFunctions().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public List update(List functions, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - FunctionContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - FunctionRequest request = new FunctionRequest(); - request.setRequestInfo(requestInfo); - request.setFunctions(new ArrayList<>()); - - for (Function f : functions) { - - contract = new FunctionContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getFunctions().add(contract); - - } - - addToQue(request); - - return functions; - } else { - - List resultList = new ArrayList(); - - for (Function f : functions) { - - resultList.add(update(f)); - } - - FunctionRequest request = new FunctionRequest(); - request.setRequestInfo(requestInfo); - request.setFunctions(new ArrayList<>()); - - for (Function f : resultList) { - - contract = new FunctionContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getFunctions().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - public String getNextSequence() { - return functionJdbcRepository.getSequence(FunctionEntity.SEQUENCE_NAME); - } - - public Function findById(Function function) { - FunctionEntity entity = functionJdbcRepository.findById(new FunctionEntity().toEntity(function)); - return entity.toDomain(); - - } - - @Transactional - public Function save(Function function) { - FunctionEntity entity = functionJdbcRepository.create(new FunctionEntity().toEntity(function)); - return entity.toDomain(); - } - - @Transactional - public Function update(Function function) { - FunctionEntity entity = functionJdbcRepository.update(new FunctionEntity().toEntity(function)); - return entity.toDomain(); - } - - public void addToQue(FunctionRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("function_create", request); - } else { - message.put("function_update", request); - } - functionQueueRepository.add(message); - } - - public void addToSearchQueue(FunctionRequest request) { - Map message = new HashMap<>(); - - message.put("function_persisted", request); - - functionQueueRepository.addToSearch(message); - } - - public Pagination search(FunctionSearch domain) { - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - FunctionSearchContract functionSearchContract = new FunctionSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, functionSearchContract); - return functionESRepository.search(functionSearchContract); - } else { - return functionJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, Function function) { - return functionJdbcRepository.uniqueCheck(fieldName, new FunctionEntity().toEntity(function)); - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionaryESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionaryESRepository.java deleted file mode 100644 index 61acb3dd934..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionaryESRepository.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.elasticsearch.index.query.QueryBuilders.boolQuery; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.Functionary; -import org.egov.egf.master.persistence.entity.FunctionaryEntity; -import org.egov.egf.master.web.contract.FunctionarySearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class FunctionaryESRepository extends ESRepository { - - public FunctionaryESRepository(TransportClient esClient) { - this.esClient = esClient; - } - public static final Logger LOGGER = LoggerFactory.getLogger(FunctionaryESRepository.class); - - public Pagination search(FunctionarySearchContract functionarySearchContract) { - - SearchRequestBuilder searchRequestBuilder; - BoolQueryBuilder boolQueryBuilder = boolQuery(); - List orderByList = new ArrayList<>(); - - searchRequestBuilder = esClient.prepareSearch(Functionary.class.getSimpleName().toLowerCase()) - .setTypes(Functionary.class.getSimpleName().toLowerCase()); - - if (functionarySearchContract.getSortBy() != null && !functionarySearchContract.getSortBy().isEmpty()) { - validateSortByOrder(functionarySearchContract.getSortBy()); - validateEntityFieldName(functionarySearchContract.getSortBy(), FunctionaryEntity.class); - orderByList = prepareOrderBys(functionarySearchContract.getSortBy()); - } - - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - if (functionarySearchContract.getIds() != null && !functionarySearchContract.getIds().isEmpty()) - add(functionarySearchContract.getIds(), "id", boolQueryBuilder); - add(functionarySearchContract.getId(), "id", boolQueryBuilder); - - add(functionarySearchContract.getName(), "name", boolQueryBuilder); - add(functionarySearchContract.getCode(), "code", boolQueryBuilder); - add(functionarySearchContract.getActive(), "active", boolQueryBuilder); - - searchRequestBuilder.setQuery(boolQueryBuilder); - - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - return mapToFunctionarysList(searchResponse, functionarySearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToFunctionarysList(SearchResponse searchResponse, - FunctionarySearchContract functionarySearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List functionarys = new ArrayList(); - Functionary functionary = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - try { - functionary = mapper.readValue(hit.getSourceAsString(), Functionary.class); - } catch (Exception e1) { - LOGGER.error("Exception while reading functionary: " + e1.getMessage()); - } - - functionarys.add(functionary); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(functionarys); - - return page; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionaryRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionaryRepository.java deleted file mode 100644 index 7f0a215f344..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FunctionaryRepository.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Functionary; -import org.egov.egf.master.domain.model.FunctionarySearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.FunctionaryEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FunctionaryJdbcRepository; -import org.egov.egf.master.web.contract.FunctionarySearchContract; -import org.egov.egf.master.web.requests.FunctionaryRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class FunctionaryRepository { - - @Autowired - private FunctionaryJdbcRepository functionaryJdbcRepository; - - @Autowired - private MastersQueueRepository functionaryQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private FunctionaryESRepository functionaryESRepository; - - public Functionary findById(Functionary functionary) { - FunctionaryEntity entity = functionaryJdbcRepository.findById(new FunctionaryEntity().toEntity(functionary)); - return entity.toDomain(); - - } - - public String getNextSequence(){ - return functionaryJdbcRepository.getSequence(FunctionaryEntity.SEQUENCE_NAME); - } - - @Transactional - public Functionary save(Functionary functionary) { - FunctionaryEntity entity = functionaryJdbcRepository.create(new FunctionaryEntity().toEntity(functionary)); - return entity.toDomain(); - } - - @Transactional - public Functionary update(Functionary functionary) { - FunctionaryEntity entity = functionaryJdbcRepository.update(new FunctionaryEntity().toEntity(functionary)); - return entity.toDomain(); - } - - public void add(FunctionaryRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("functionary_create", request); - } else { - message.put("functionary_update", request); - } - functionaryQueueRepository.add(message); - } - - public Pagination search(FunctionarySearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - FunctionarySearchContract functionarySearchContract = new FunctionarySearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, functionarySearchContract); - return functionaryESRepository.search(functionarySearchContract); - } else { - return functionaryJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, Functionary functionary) { - return functionaryJdbcRepository.uniqueCheck(fieldName, new FunctionaryEntity().toEntity(functionary)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundESRepository.java deleted file mode 100644 index 82e587a0bb2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundESRepository.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.persistence.entity.FundEntity; -import org.egov.egf.master.web.contract.FundSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class FundESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(FundESRepository.class); - - public FundESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(FundSearchContract fundSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(fundSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToFundList(searchResponse, fundSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToFundList(SearchResponse searchResponse, FundSearchContract fundSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List funds = new ArrayList(); - Fund fund = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - fund = mapper.readValue(hit.getSourceAsString(), Fund.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - funds.add(fund); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(funds); - - return page; - } - - private SearchRequestBuilder getSearchRequest(FundSearchContract criteria) { - - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), FundEntity.class); - } - List orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchFund(criteria); - - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(Fund.class.getSimpleName().toLowerCase()) - .setTypes(Fund.class.getSimpleName().toLowerCase()); - - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundRepository.java deleted file mode 100644 index 93f4c5b70ec..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundRepository.java +++ /dev/null @@ -1,189 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.FundSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.FundEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FundJdbcRepository; -import org.egov.egf.master.web.contract.FundContract; -import org.egov.egf.master.web.contract.FundSearchContract; -import org.egov.egf.master.web.requests.FundRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class FundRepository { - - private FundJdbcRepository fundJdbcRepository; - - private MastersQueueRepository fundQueueRepository; - - private FinancialConfigurationService financialConfigurationService; - - private FundESRepository fundESRepository; - - private String persistThroughKafka; - - @Autowired - public FundRepository(FundJdbcRepository fundJdbcRepository, MastersQueueRepository fundQueueRepository, - FinancialConfigurationService financialConfigurationService, FundESRepository fundESRepository, - @Value("${persist.through.kafka}") String persistThroughKafka) { - this.fundJdbcRepository = fundJdbcRepository; - this.fundQueueRepository = fundQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.fundESRepository = fundESRepository; - this.persistThroughKafka = persistThroughKafka; - - } - - @Transactional - public List save(List funds, RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - FundContract contract; - Map message = new HashMap<>(); - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - FundRequest request = new FundRequest(); - request.setRequestInfo(requestInfo); - request.setFunds(new ArrayList<>()); - - for (Fund f : funds) { - - contract = new FundContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getFunds().add(contract); - - } - message.put("fund_create", request); - fundQueueRepository.add(message); - - return funds; - } else { - - List resultList = new ArrayList(); - - for (Fund f : funds) { - - resultList.add(save(f)); - } - - FundRequest request = new FundRequest(); - request.setRequestInfo(requestInfo); - request.setFunds(new ArrayList<>()); - - for (Fund f : resultList) { - - contract = new FundContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getFunds().add(contract); - - } - - message.put("fund_create", request); - fundQueueRepository.addToSearch(message); - - return resultList; - } - - } - - @Transactional - public List update(List funds, RequestInfo requestInfo) { - ModelMapper mapper = new ModelMapper(); - Map message = new HashMap<>(); - FundRequest request = new FundRequest(); - FundContract contract; - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - request.setRequestInfo(requestInfo); - request.setFunds(new ArrayList<>()); - for (Fund f : funds) { - contract = new FundContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getFunds().add(contract); - } - message.put("fund_update", request); - fundQueueRepository.add(message); - return funds; - } else { - List resultList = new ArrayList(); - for (Fund f : funds) { - resultList.add(update(f)); - } - request.setRequestInfo(requestInfo); - request.setFunds(new ArrayList<>()); - for (Fund f : resultList) { - contract = new FundContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getFunds().add(contract); - } - message.put("fund_persisted", request); - fundQueueRepository.addToSearch(message); - return resultList; - } - - } - - public String getNextSequence() { - return fundJdbcRepository.getSequence(FundEntity.SEQUENCE_NAME); - } - - public Fund findById(Fund fund) { - FundEntity entity = fundJdbcRepository.findById(new FundEntity().toEntity(fund)); - return entity.toDomain(); - - } - - @Transactional - public Fund save(Fund fund) { - FundEntity entity = fundJdbcRepository.create(new FundEntity().toEntity(fund)); - - return entity.toDomain(); - - } - - @Transactional - public Fund update(Fund fund) { - FundEntity entity = fundJdbcRepository.update(new FundEntity().toEntity(fund)); - return entity.toDomain(); - } - - - public Pagination search(FundSearch domain) { - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - FundSearchContract fundSearchContract = new FundSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, fundSearchContract); - return fundESRepository.search(fundSearchContract); - } else { - return fundJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, Fund fund) { - return fundJdbcRepository.uniqueCheck(fieldName, new FundEntity().toEntity(fund)); - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundsourceESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundsourceESRepository.java deleted file mode 100644 index 608dafd2520..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundsourceESRepository.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.Fundsource; -import org.egov.egf.master.persistence.entity.FundsourceEntity; -import org.egov.egf.master.web.contract.FundsourceSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class FundsourceESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(FundsourceESRepository.class); - - public FundsourceESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(FundsourceSearchContract fundsourceSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(fundsourceSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToFundsourceList(searchResponse,fundsourceSearchContract); - } - - - @SuppressWarnings("deprecation") - private Pagination mapToFundsourceList(SearchResponse searchResponse,FundsourceSearchContract fundsourceSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List Fundsources = new ArrayList(); - Fundsource fundsource=null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - //JSON from file to Object - try { - fundsource = mapper.readValue(hit.getSourceAsString(), Fundsource.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - Fundsources.add(fundsource); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(Fundsources); - - return page; - } - - private SearchRequestBuilder getSearchRequest(FundsourceSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), FundsourceEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchFundsource(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(Fundsource.class.getSimpleName().toLowerCase()).setTypes(Fundsource.class.getSimpleName().toLowerCase()) - ; - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundsourceRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundsourceRepository.java deleted file mode 100644 index b031b076bf4..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/FundsourceRepository.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Fundsource; -import org.egov.egf.master.domain.model.FundsourceSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.FundsourceEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FundsourceJdbcRepository; -import org.egov.egf.master.web.contract.FundsourceSearchContract; -import org.egov.egf.master.web.requests.FundsourceRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class FundsourceRepository { - - @Autowired - private FundsourceJdbcRepository fundsourceJdbcRepository; - @Autowired - private MastersQueueRepository fundsourceQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private FundsourceESRepository fundsourceESRepository; - - public Fundsource findById(Fundsource fundsource) { - FundsourceEntity entity = fundsourceJdbcRepository.findById(new FundsourceEntity().toEntity(fundsource)); - return entity.toDomain(); - - } - - public String getNextSequence(){ - return fundsourceJdbcRepository.getSequence(FundsourceEntity.SEQUENCE_NAME); - } - - @Transactional - public Fundsource save(Fundsource fundsource) { - FundsourceEntity entity = fundsourceJdbcRepository.create(new FundsourceEntity().toEntity(fundsource)); - return entity.toDomain(); - } - - @Transactional - public Fundsource update(Fundsource fundsource) { - FundsourceEntity entity = fundsourceJdbcRepository.update(new FundsourceEntity().toEntity(fundsource)); - return entity.toDomain(); - } - - public void add(FundsourceRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("fundsource_create", request); - } else { - message.put("fundsource_update", request); - } - fundsourceQueueRepository.add(message); - } - - public Pagination search(FundsourceSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - FundsourceSearchContract fundsourceSearchContract = new FundsourceSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, fundsourceSearchContract); - return fundsourceESRepository.search(fundsourceSearchContract); - } else { - return fundsourceJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, Fundsource fundsource) { - return fundsourceJdbcRepository.uniqueCheck(fieldName, new FundsourceEntity().toEntity(fundsource)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/RecoveryESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/RecoveryESRepository.java deleted file mode 100644 index 752c248e5e4..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/RecoveryESRepository.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.Recovery; -import org.egov.egf.master.persistence.entity.RecoveryEntity; -import org.egov.egf.master.web.contract.RecoverySearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -@Service -public class RecoveryESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(RecoveryESRepository.class); - - public RecoveryESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(RecoverySearchContract recoverySearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(recoverySearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToRecoveryList(searchResponse, recoverySearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToRecoveryList(SearchResponse searchResponse, RecoverySearchContract recoverySearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List recoverys = new ArrayList(); - Recovery recovery = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - recovery = mapper.readValue(hit.getSourceAsString(), Recovery.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - recoverys.add(recovery); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(recoverys); - - return page; - } - - private SearchRequestBuilder getSearchRequest(RecoverySearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), RecoveryEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchRecovery(criteria); - - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(Recovery.class.getSimpleName().toLowerCase()) - .setTypes(Recovery.class.getSimpleName().toLowerCase()); - - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/RecoveryRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/RecoveryRepository.java deleted file mode 100644 index dce3f89736e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/RecoveryRepository.java +++ /dev/null @@ -1,221 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Recovery; -import org.egov.egf.master.domain.model.RecoverySearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.RecoveryEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.RecoveryJdbcRepository; -import org.egov.egf.master.web.contract.RecoveryContract; -import org.egov.egf.master.web.contract.RecoverySearchContract; -import org.egov.egf.master.web.requests.RecoveryRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -public class RecoveryRepository { - - private MastersQueueRepository recoveryQueueRepository; - - private FinancialConfigurationService financialConfigurationService; - - private String persistThroughKafka; - - private RecoveryJdbcRepository recoveryJdbcRepository; - - private RecoveryESRepository recoveryESRepository; - - @Autowired - public RecoveryRepository(MastersQueueRepository recoveryQueueRepository, FinancialConfigurationService financialConfigurationService, - @Value("${persist.through.kafka}") String persistThroughKafka, - RecoveryJdbcRepository recoveryJdbcRepository, - RecoveryESRepository recoveryESRepository) { - this.recoveryQueueRepository = recoveryQueueRepository; - this.financialConfigurationService = financialConfigurationService; - this.persistThroughKafka = persistThroughKafka; - this.recoveryJdbcRepository = recoveryJdbcRepository; - this.recoveryESRepository = recoveryESRepository; - - } - - @Transactional - public List save(List recoveries, - RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - RecoveryContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - RecoveryRequest request = new RecoveryRequest(); - request.setRequestInfo(requestInfo); - request.setRecoverys(new ArrayList<>()); - - for (Recovery f : recoveries) { - - contract = new RecoveryContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getRecoverys().add(contract); - - } - - addToQue(request); - - return recoveries; - } else { - - List resultList = new ArrayList(); - - for (Recovery f : recoveries) { - - resultList.add(save(f)); - } - - RecoveryRequest request = new RecoveryRequest(); - request.setRequestInfo(requestInfo); - request.setRecoverys(new ArrayList<>()); - - for (Recovery f : resultList) { - - contract = new RecoveryContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getRecoverys().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - @Transactional - public List update(List recoveries, - RequestInfo requestInfo) { - - ModelMapper mapper = new ModelMapper(); - RecoveryContract contract; - - if (persistThroughKafka != null && !persistThroughKafka.isEmpty() - && persistThroughKafka.equalsIgnoreCase("yes")) { - - RecoveryRequest request = new RecoveryRequest(); - request.setRequestInfo(requestInfo); - request.setRecoverys(new ArrayList<>()); - - for (Recovery f : recoveries) { - - contract = new RecoveryContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getRecoverys().add(contract); - - } - - addToQue(request); - - return recoveries; - } else { - - List resultList = new ArrayList(); - - for (Recovery f : recoveries) { - - resultList.add(update(f)); - } - - RecoveryRequest request = new RecoveryRequest(); - request.setRequestInfo(requestInfo); - request.setRecoverys(new ArrayList<>()); - - for (Recovery f : resultList) { - - contract = new RecoveryContract(); - contract.setCreatedDate(new Date()); - mapper.map(f, contract); - request.getRecoverys().add(contract); - - } - - addToSearchQueue(request); - - return resultList; - } - - } - - public String getNextSequence() { - return recoveryJdbcRepository.getSequence(RecoveryEntity.SEQUENCE_NAME); - } - - public Recovery findById(Recovery recovery) { - RecoveryEntity entity = recoveryJdbcRepository.findById(new RecoveryEntity().toEntity(recovery)); - return entity.toDomain(); - - } - - @Transactional - public Recovery save(Recovery recovery) { - RecoveryEntity entity = recoveryJdbcRepository.create(new RecoveryEntity().toEntity(recovery)); - return entity.toDomain(); - } - - @Transactional - public Recovery update(Recovery recovery) { - RecoveryEntity entity = recoveryJdbcRepository.update(new RecoveryEntity().toEntity(recovery)); - return entity.toDomain(); - } - - public void addToQue(RecoveryRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("recovery_create", request); - } else { - message.put("recovery_update", request); - } - recoveryQueueRepository.add(message); - } - - public void addToSearchQueue(RecoveryRequest request) { - Map message = new HashMap<>(); - - message.put("recovery_persisted", request); - - recoveryQueueRepository.addToSearch(message); - } - - public Pagination search(RecoverySearch domain) { - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - RecoverySearchContract recoverySearchContract = new RecoverySearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, recoverySearchContract); - return recoveryESRepository.search(recoverySearchContract); - } else { - return recoveryJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, Recovery recovery) { - return recoveryJdbcRepository.uniqueCheck(fieldName, new RecoveryEntity().toEntity(recovery)); - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SchemeESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SchemeESRepository.java deleted file mode 100644 index dd387ad30f5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SchemeESRepository.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.Scheme; -import org.egov.egf.master.persistence.entity.SchemeEntity; -import org.egov.egf.master.web.contract.SchemeSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class SchemeESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(SchemeESRepository.class); - - public SchemeESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(SchemeSearchContract schemeSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(schemeSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToSchemeList(searchResponse, schemeSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToSchemeList(SearchResponse searchResponse, SchemeSearchContract schemeSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List schemes = new ArrayList(); - Scheme scheme = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - scheme = mapper.readValue(hit.getSourceAsString(), Scheme.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - schemes.add(scheme); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(schemes); - - return page; - } - - private SearchRequestBuilder getSearchRequest(SchemeSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), SchemeEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchScheme(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(Scheme.class.getSimpleName().toLowerCase()) - .setTypes(Scheme.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SchemeRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SchemeRepository.java deleted file mode 100644 index 6d2b339e929..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SchemeRepository.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Scheme; -import org.egov.egf.master.domain.model.SchemeSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.SchemeEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.SchemeJdbcRepository; -import org.egov.egf.master.web.contract.SchemeSearchContract; -import org.egov.egf.master.web.requests.SchemeRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class SchemeRepository { - - @Autowired - private SchemeJdbcRepository schemeJdbcRepository; - - @Autowired - private MastersQueueRepository schemeQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private SchemeESRepository schemeESRepository; - - public Scheme findById(Scheme scheme) { - SchemeEntity entity = schemeJdbcRepository.findById(new SchemeEntity().toEntity(scheme)); - return entity.toDomain(); - - } - - public String getNextSequence(){ - return schemeJdbcRepository.getSequence(SchemeEntity.SEQUENCE_NAME); - } - - @Transactional - public Scheme save(Scheme scheme) { - SchemeEntity entity = schemeJdbcRepository.create(new SchemeEntity().toEntity(scheme)); - return entity.toDomain(); - } - - @Transactional - public Scheme update(Scheme scheme) { - SchemeEntity entity = schemeJdbcRepository.update(new SchemeEntity().toEntity(scheme)); - return entity.toDomain(); - } - - public void add(SchemeRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("scheme_create", request); - } else { - message.put("scheme_update", request); - } - schemeQueueRepository.add(message); - } - - public Pagination search(SchemeSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - SchemeSearchContract schemeSearchContract = new SchemeSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, schemeSearchContract); - return schemeESRepository.search(schemeSearchContract); - } else { - return schemeJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, Scheme scheme) { - return schemeJdbcRepository.uniqueCheck(fieldName, new SchemeEntity().toEntity(scheme)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SubSchemeESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SubSchemeESRepository.java deleted file mode 100644 index b225d695e72..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SubSchemeESRepository.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.SubScheme; -import org.egov.egf.master.persistence.entity.SubSchemeEntity; -import org.egov.egf.master.web.contract.SubSchemeSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class SubSchemeESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(SubSchemeESRepository.class); - - public SubSchemeESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(SubSchemeSearchContract subSchemeSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(subSchemeSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToSubSchemeList(searchResponse, subSchemeSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToSubSchemeList(SearchResponse searchResponse, - SubSchemeSearchContract subSchemeSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List subSchemes = new ArrayList(); - SubScheme subScheme = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - subScheme = mapper.readValue(hit.getSourceAsString(), SubScheme.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - subSchemes.add(subScheme); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(subSchemes); - - return page; - } - - private SearchRequestBuilder getSearchRequest(SubSchemeSearchContract criteria) { - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), SubSchemeEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchSubScheme(criteria); - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(SubScheme.class.getSimpleName().toLowerCase()) - .setTypes(SubScheme.class.getSimpleName().toLowerCase()); - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SubSchemeRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SubSchemeRepository.java deleted file mode 100644 index e3d4eddc075..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SubSchemeRepository.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.SubScheme; -import org.egov.egf.master.domain.model.SubSchemeSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.SubSchemeEntity; -import org.egov.egf.master.persistence.entity.SupplierEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.SubSchemeJdbcRepository; -import org.egov.egf.master.web.contract.SubSchemeSearchContract; -import org.egov.egf.master.web.requests.SubSchemeRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class SubSchemeRepository { - - @Autowired - private SubSchemeJdbcRepository subSchemeJdbcRepository; - - @Autowired - private MastersQueueRepository subSchemeQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private SubSchemeESRepository subSchemeESRepository; - - public SubScheme findById(SubScheme subScheme) { - SubSchemeEntity entity = subSchemeJdbcRepository.findById(new SubSchemeEntity().toEntity(subScheme)); - return entity.toDomain(); - - } - - public String getNextSequence(){ - return subSchemeJdbcRepository.getSequence(SubSchemeEntity.SEQUENCE_NAME); - } - - @Transactional - public SubScheme save(SubScheme subScheme) { - SubSchemeEntity entity = subSchemeJdbcRepository.create(new SubSchemeEntity().toEntity(subScheme)); - return entity.toDomain(); - } - - @Transactional - public SubScheme update(SubScheme subScheme) { - SubSchemeEntity entity = subSchemeJdbcRepository.update(new SubSchemeEntity().toEntity(subScheme)); - return entity.toDomain(); - } - - public void add(SubSchemeRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("subscheme_create", request); - } else { - message.put("subscheme_update", request); - } - subSchemeQueueRepository.add(message); - } - - public Pagination search(SubSchemeSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - SubSchemeSearchContract subSchemeSearchContract = new SubSchemeSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, subSchemeSearchContract); - return subSchemeESRepository.search(subSchemeSearchContract); - } else { - return subSchemeJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, SubScheme subScheme) { - return subSchemeJdbcRepository.uniqueCheck(fieldName, new SubSchemeEntity().toEntity(subScheme)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SupplierESRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SupplierESRepository.java deleted file mode 100644 index 3fb52e863b7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SupplierESRepository.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.ESRepository; -import org.egov.egf.master.domain.model.Supplier; -import org.egov.egf.master.persistence.entity.SupplierEntity; -import org.egov.egf.master.web.contract.SupplierSearchContract; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.transport.TransportClient; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class SupplierESRepository extends ESRepository { - - private TransportClient esClient; - private ElasticSearchQueryFactory elasticSearchQueryFactory; - public static final Logger LOGGER = LoggerFactory.getLogger(SupplierESRepository.class); - - public SupplierESRepository(TransportClient esClient, ElasticSearchQueryFactory elasticSearchQueryFactory) { - this.esClient = esClient; - this.elasticSearchQueryFactory = elasticSearchQueryFactory; - } - - public Pagination search(SupplierSearchContract supplierSearchContract) { - final SearchRequestBuilder searchRequestBuilder = getSearchRequest(supplierSearchContract); - final SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - return mapToSupplierList(searchResponse, supplierSearchContract); - } - - @SuppressWarnings("deprecation") - private Pagination mapToSupplierList(SearchResponse searchResponse, SupplierSearchContract supplierSearchContract) { - Pagination page = new Pagination<>(); - if (searchResponse.getHits() == null || searchResponse.getHits().getTotalHits() == 0L) { - return page; - } - List suppliers = new ArrayList(); - Supplier supplier = null; - for (SearchHit hit : searchResponse.getHits()) { - - ObjectMapper mapper = new ObjectMapper(); - // JSON from file to Object - try { - supplier = mapper.readValue(hit.getSourceAsString(), Supplier.class); - } catch (JsonParseException e1) { - // TODO Auto-generated catch block - LOGGER.error("Error while parsing JSON: " + e1.getMessage()); - } catch (JsonMappingException e1) { - // TODO Auto-generated catch block - LOGGER.error("JSON mapping exception occurred: " + e1.getMessage()); - } catch (IOException e1) { - // TODO Auto-generated catch block - LOGGER.error("IO exception occurred: " + e1.getMessage()); - } - - suppliers.add(supplier); - } - - page.setTotalResults(Long.valueOf(searchResponse.getHits().getTotalHits()).intValue()); - page.setPagedData(suppliers); - - return page; - } - - private SearchRequestBuilder getSearchRequest(SupplierSearchContract criteria) { - - List orderByList = new ArrayList<>(); - if (criteria.getSortBy() != null && !criteria.getSortBy().isEmpty()) { - validateSortByOrder(criteria.getSortBy()); - validateEntityFieldName(criteria.getSortBy(), SupplierEntity.class); - orderByList = elasticSearchQueryFactory.prepareOrderBys(criteria.getSortBy()); - } - - final BoolQueryBuilder boolQueryBuilder = elasticSearchQueryFactory.searchSupplier(criteria); - - SearchRequestBuilder searchRequestBuilder = esClient.prepareSearch(Supplier.class.getSimpleName().toLowerCase()) - .setTypes(Supplier.class.getSimpleName().toLowerCase()); - - if (!orderByList.isEmpty()) { - for (String orderBy : orderByList) { - searchRequestBuilder = searchRequestBuilder.addSort(orderBy.split(" ")[0], - orderBy.split(" ")[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC); - } - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - - return searchRequestBuilder; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SupplierRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SupplierRepository.java deleted file mode 100644 index 94fd25cbe48..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/repository/SupplierRepository.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Supplier; -import org.egov.egf.master.domain.model.SupplierSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.SupplierEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.SupplierJdbcRepository; -import org.egov.egf.master.web.contract.SupplierSearchContract; -import org.egov.egf.master.web.requests.SupplierRequest; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class SupplierRepository { - - @Autowired - private SupplierJdbcRepository supplierJdbcRepository; - - @Autowired - private MastersQueueRepository supplierQueueRepository; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private SupplierESRepository supplierESRepository; - - public Supplier findById(Supplier supplier) { - SupplierEntity entity = supplierJdbcRepository.findById(new SupplierEntity().toEntity(supplier)); - return entity.toDomain(); - - } - - public String getNextSequence(){ - return supplierJdbcRepository.getSequence(SupplierEntity.SEQUENCE_NAME); - } - - @Transactional - public Supplier save(Supplier supplier) { - SupplierEntity entity = supplierJdbcRepository.create(new SupplierEntity().toEntity(supplier)); - return entity.toDomain(); - } - - @Transactional - public Supplier update(Supplier supplier) { - SupplierEntity entity = supplierJdbcRepository.update(new SupplierEntity().toEntity(supplier)); - return entity.toDomain(); - } - - public void add(SupplierRequest request) { - Map message = new HashMap<>(); - - if (request.getRequestInfo().getAction().equalsIgnoreCase(Constants.ACTION_CREATE)) { - message.put("supplier_create", request); - } else { - message.put("supplier_update", request); - } - supplierQueueRepository.add(message); - } - - public Pagination search(SupplierSearch domain) { - - if (!financialConfigurationService.fetchDataFrom().isEmpty() - && financialConfigurationService.fetchDataFrom().equalsIgnoreCase("es")) { - SupplierSearchContract supplierSearchContract = new SupplierSearchContract(); - ModelMapper mapper = new ModelMapper(); - mapper.map(domain, supplierSearchContract); - return supplierESRepository.search(supplierSearchContract); - } else { - return supplierJdbcRepository.search(domain); - } - - } - - public boolean uniqueCheck(String fieldName, Supplier supplier) { - return supplierJdbcRepository.uniqueCheck(fieldName, new SupplierEntity().toEntity(supplier)); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountCodePurposeService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountCodePurposeService.java deleted file mode 100644 index 7f27aae6839..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountCodePurposeService.java +++ /dev/null @@ -1,218 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.egov.common.constants.Constants.ACTION_CREATE; -import static org.egov.common.constants.Constants.ACTION_UPDATE; -import static org.egov.common.constants.Constants.ACTION_VIEW; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.AccountCodePurposeSearch; -import org.egov.egf.master.domain.repository.AccountCodePurposeRepository; -import org.egov.egf.master.web.requests.AccountCodePurposeRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class AccountCodePurposeService { - - @Autowired - private AccountCodePurposeRepository accountCodePurposeRepository; - - @Autowired - private SmartValidator validator; - - @Transactional - public List create(List accountCodePurposes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - accountCodePurposes = fetchRelated(accountCodePurposes); - - validate(accountCodePurposes, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (AccountCodePurpose account : accountCodePurposes) { - account.setId(accountCodePurposeRepository.getNextSequence()); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountCodePurposeRepository.save(accountCodePurposes, requestInfo); - - } - - @Transactional - public List update(List accountCodePurposes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - accountCodePurposes = fetchRelated(accountCodePurposes); - - validate(accountCodePurposes, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountCodePurposeRepository.update(accountCodePurposes, requestInfo); - - } - - private BindingResult validate(List accountcodepurposes, String method, BindingResult errors) { - - try { - switch (method) { - case ACTION_VIEW: - // validator.validate(accountCodePurposeContractRequest.getAccountCodePurpose(), - // errors); - break; - case ACTION_CREATE: - if (accountcodepurposes == null) { - throw new InvalidDataException("accountcodepurposes", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountCodePurpose accountCodePurpose : accountcodepurposes) { - validator.validate(accountCodePurpose, errors); - - if (!accountCodePurposeRepository.uniqueCheck("name", accountCodePurpose)) { - errors.addError(new FieldError("accountCodePurpose", "name", accountCodePurpose.getName(), - false, new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - - } - break; - case ACTION_UPDATE: - if (accountcodepurposes == null) { - throw new InvalidDataException("accountcodepurposes", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountCodePurpose accountCodePurpose : accountcodepurposes) { - if (accountCodePurpose.getId() == null) { - throw new InvalidDataException("id", ErrorCode.NULL_VALUE.getCode(), - accountCodePurpose.getId()); - } - validator.validate(accountCodePurpose, errors); - - if (!accountCodePurposeRepository.uniqueCheck("name", accountCodePurpose)) { - errors.addError(new FieldError("accountCodePurpose", "name", accountCodePurpose.getName(), - false, new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - - } - break; - case Constants.ACTION_SEARCH: - if (accountcodepurposes == null) { - throw new InvalidDataException("accountcodepurposes", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountCodePurpose accountcodepurpose : accountcodepurposes) { - if (accountcodepurpose.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - accountcodepurpose.getTenantId()); - } - - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List accountcodepurposes) { - for (AccountCodePurpose accountCodePurpose : accountcodepurposes) { - // fetch related items - accountCodePurpose.setTenantId(ApplicationThreadLocals.getTenantId().get()); - - } - - return accountcodepurposes; - } - - @Transactional - public List add(List accountcodepurposes, BindingResult errors) { - accountcodepurposes = fetchRelated(accountcodepurposes); - validate(accountcodepurposes, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (AccountCodePurpose b : accountcodepurposes) - b.setId(accountCodePurposeRepository.getNextSequence()); - return accountcodepurposes; - - } - - @Transactional - public List update(List accountcodepurposes, BindingResult errors) { - accountcodepurposes = fetchRelated(accountcodepurposes); - validate(accountcodepurposes, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return accountcodepurposes; - - } - - public void addToQue(AccountCodePurposeRequest request) { - accountCodePurposeRepository.add(request); - } - - public Pagination search(AccountCodePurposeSearch accountCodePurposeSearch, - BindingResult errors) { - - try { - - List accountCodePurposes = new ArrayList<>(); - accountCodePurposes.add(accountCodePurposeSearch); - validate(accountCodePurposes, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountCodePurposeRepository.search(accountCodePurposeSearch); - } - - @Transactional - public AccountCodePurpose save(AccountCodePurpose accountCodePurpose) { - return accountCodePurposeRepository.save(accountCodePurpose); - } - - @Transactional - public AccountCodePurpose update(AccountCodePurpose accountCodePurpose) { - return accountCodePurposeRepository.update(accountCodePurpose); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountDetailKeyService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountDetailKeyService.java deleted file mode 100644 index 94a25afcfc8..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountDetailKeyService.java +++ /dev/null @@ -1,213 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailKeySearch; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.repository.AccountDetailKeyRepository; -import org.egov.egf.master.domain.repository.AccountDetailTypeRepository; -import org.egov.egf.master.web.requests.AccountDetailKeyRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class AccountDetailKeyService { - - @Autowired - private AccountDetailKeyRepository accountDetailKeyRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private AccountDetailTypeRepository accountDetailTypeRepository; - - @Transactional - public List create(List accountDetailKies, BindingResult errors, - RequestInfo requestInfo) { - - try { - - accountDetailKies = fetchRelated(accountDetailKies); - - validate(accountDetailKies, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (AccountDetailKey b : accountDetailKies) { - b.setId(accountDetailKeyRepository.getNextSequence()); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountDetailKeyRepository.save(accountDetailKies, requestInfo); - - } - - @Transactional - public List update(List accountDetailKies, BindingResult errors, - RequestInfo requestInfo) { - - try { - - accountDetailKies = fetchRelated(accountDetailKies); - - validate(accountDetailKies, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountDetailKeyRepository.update(accountDetailKies, requestInfo); - - } - - private BindingResult validate(List accountdetailkeys, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(accountDetailKeyContractRequest.getAccountDetailKey(), - // errors); - break; - case Constants.ACTION_CREATE: - if (accountdetailkeys == null) { - throw new InvalidDataException("accountdetailkeys", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountDetailKey accountDetailKey : accountdetailkeys) { - validator.validate(accountDetailKey, errors); - } - break; - case Constants.ACTION_UPDATE: - if (accountdetailkeys == null) { - throw new InvalidDataException("accountdetailkeys", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountDetailKey accountDetailKey : accountdetailkeys) { - if (accountDetailKey.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - accountDetailKey.getId()); - } - validator.validate(accountDetailKey, errors); - } - break; - case Constants.ACTION_SEARCH: - if (accountdetailkeys == null) { - throw new InvalidDataException("accountdetailkeys", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountDetailKey accountdetailkey : accountdetailkeys) { - if (accountdetailkey.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - accountdetailkey.getId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - - } - - public List fetchRelated(List accountdetailkeys) { - for (AccountDetailKey accountDetailKey : accountdetailkeys) { - accountDetailKey.setTenantId(ApplicationThreadLocals.getTenantId().get()); - // fetch related items - if (accountDetailKey.getAccountDetailType() != null) { - AccountDetailType accountDetailType = accountDetailTypeRepository - .findById(accountDetailKey.getAccountDetailType()); - if (accountDetailType == null) { - throw new InvalidDataException("accountDetailType", "accountDetailType.invalid", - " Invalid accountDetailType"); - } - accountDetailKey.setAccountDetailType(accountDetailType); - } - - } - - return accountdetailkeys; - } - - @Transactional - public List add(List accountdetailkeys, BindingResult errors) { - accountdetailkeys = fetchRelated(accountdetailkeys); - validate(accountdetailkeys, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (AccountDetailKey key : accountdetailkeys) - key.setId(accountDetailKeyRepository.getNextSequence()); - return accountdetailkeys; - - } - - @Transactional - public List update(List accountdetailkeys, BindingResult errors) { - accountdetailkeys = fetchRelated(accountdetailkeys); - validate(accountdetailkeys, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return accountdetailkeys; - - } - - public void addToQue(AccountDetailKeyRequest request) { - accountDetailKeyRepository.add(request); - } - - public Pagination search(AccountDetailKeySearch accountDetailKeySearch, BindingResult errors) { - - try { - - List accountDetailKeys = new ArrayList<>(); - accountDetailKeys.add(accountDetailKeySearch); - validate(accountDetailKeys, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountDetailKeyRepository.search(accountDetailKeySearch); - } - - @Transactional - public AccountDetailKey save(AccountDetailKey accountDetailKey) { - return accountDetailKeyRepository.save(accountDetailKey); - } - - @Transactional - public AccountDetailKey update(AccountDetailKey accountDetailKey) { - return accountDetailKeyRepository.update(accountDetailKey); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountDetailTypeService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountDetailTypeService.java deleted file mode 100644 index 0ec4e1ea77f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountDetailTypeService.java +++ /dev/null @@ -1,208 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; -import org.egov.egf.master.domain.repository.AccountDetailTypeRepository; -import org.egov.egf.master.web.requests.AccountDetailTypeRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class AccountDetailTypeService { - - @Autowired - private AccountDetailTypeRepository accountDetailTypeRepository; - - @Autowired - private SmartValidator validator; - - @Transactional - public List create(List accountDetailTypes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - accountDetailTypes = fetchRelated(accountDetailTypes); - - validate(accountDetailTypes, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (AccountDetailType b : accountDetailTypes) { - b.setId(accountDetailTypeRepository.getNextSequence()); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountDetailTypeRepository.save(accountDetailTypes, requestInfo); - - } - - @Transactional - public List update(List accountDetailTypes, BindingResult errors, - RequestInfo requestInfo) { - - try { - - accountDetailTypes = fetchRelated(accountDetailTypes); - - validate(accountDetailTypes, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountDetailTypeRepository.update(accountDetailTypes, requestInfo); - - } - - private BindingResult validate(List accountdetailtypes, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(accountDetailTypeContractRequest.getAccountDetailType(), - // errors); - break; - case Constants.ACTION_CREATE: - if (accountdetailtypes == null) { - throw new InvalidDataException("accountdetailtypes", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountDetailType accountDetailType : accountdetailtypes) { - validator.validate(accountDetailType, errors); - if (!accountDetailTypeRepository.uniqueCheck("name", accountDetailType)) { - errors.addError(new FieldError("accountDetailType", "name", accountDetailType.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (accountdetailtypes == null) { - throw new InvalidDataException("accountdetailtypes", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountDetailType accountDetailType : accountdetailtypes) { - if (accountDetailType.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - accountDetailType.getId()); - } - validator.validate(accountDetailType, errors); - if (!accountDetailTypeRepository.uniqueCheck("name", accountDetailType)) { - errors.addError(new FieldError("accountDetailType", "name", accountDetailType.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (accountdetailtypes == null) { - throw new InvalidDataException("accountdetailtypes", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountDetailType accountdetailtype : accountdetailtypes) { - if (accountdetailtype.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - accountdetailtype.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List accountdetailtypes) { - for (AccountDetailType accountDetailType : accountdetailtypes) { - // fetch related items - accountDetailType.setTenantId(ApplicationThreadLocals.getTenantId().get()); - - } - - return accountdetailtypes; - } - - @Transactional - public List add(List accountdetailtypes, BindingResult errors) { - accountdetailtypes = fetchRelated(accountdetailtypes); - validate(accountdetailtypes, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (AccountDetailType b : accountdetailtypes) - b.setId(accountDetailTypeRepository.getNextSequence()); - return accountdetailtypes; - - } - - @Transactional - public List update(List accountdetailtypes, BindingResult errors) { - accountdetailtypes = fetchRelated(accountdetailtypes); - validate(accountdetailtypes, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return accountdetailtypes; - - } - - public void addToQue(AccountDetailTypeRequest request) { - accountDetailTypeRepository.add(request); - } - - public Pagination search(AccountDetailTypeSearch accountDetailTypeSearch, BindingResult errors) { - - try { - - List accountDetailTypes = new ArrayList<>(); - accountDetailTypes.add(accountDetailTypeSearch); - validate(accountDetailTypes, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountDetailTypeRepository.search(accountDetailTypeSearch); - } - - @Transactional - public AccountDetailType save(AccountDetailType accountDetailType) { - return accountDetailTypeRepository.save(accountDetailType); - } - - @Transactional - public AccountDetailType update(AccountDetailType accountDetailType) { - return accountDetailTypeRepository.update(accountDetailType); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountEntityService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountEntityService.java deleted file mode 100644 index 78f2bb04aee..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/AccountEntityService.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.egov.egf.master.domain.service; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.domain.model.AccountEntitySearch; -import org.egov.egf.master.domain.repository.AccountDetailTypeRepository; -import org.egov.egf.master.domain.repository.AccountEntityRepository; -import org.egov.egf.master.web.requests.AccountEntityRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -import java.util.ArrayList; -import java.util.List; - -@Service -@Transactional(readOnly = true) -public class AccountEntityService { - - @Autowired - private AccountEntityRepository accountEntityRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private AccountDetailTypeRepository accountDetailTypeRepository; - - @Transactional - public List create(List accountEntities, BindingResult errors, RequestInfo requestInfo) { - - try { - - accountEntities = fetchRelated(accountEntities); - - validate(accountEntities, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (AccountEntity b : accountEntities) { - b.setId(accountEntityRepository.getNextSequence()); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountEntityRepository.save(accountEntities, requestInfo); - - } - - @Transactional - public List update(List accountEntities, BindingResult errors, RequestInfo requestInfo) { - - try { - - accountEntities = fetchRelated(accountEntities); - - validate(accountEntities, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountEntityRepository.update(accountEntities, requestInfo); - - } - - private BindingResult validate(List accountentities, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(accountEntityContractRequest.getAccountEntity(), - // errors); - break; - case Constants.ACTION_CREATE: - if (accountentities == null) { - throw new InvalidDataException("accountentities", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountEntity accountEntity : accountentities) { - validator.validate(accountEntity, errors); - if (!accountEntityRepository.uniqueCheck("name", accountEntity)) { - errors.addError(new FieldError("accountEntity", "name", accountEntity.getName(), false, - new String[]{ErrorCode.NON_UNIQUE_VALUE.getCode()}, null, null)); - } - if (!accountEntityRepository.uniqueCheck("code", accountEntity)) { - errors.addError(new FieldError("accountEntity", "code", accountEntity.getCode(), false, - new String[]{ErrorCode.NON_UNIQUE_VALUE.getCode()}, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (accountentities == null) { - throw new InvalidDataException("accountentities", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountEntity accountEntity : accountentities) { - if (accountEntity.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), accountEntity.getId()); - } - validator.validate(accountEntity, errors); - if (!accountEntityRepository.uniqueCheck("name", accountEntity)) { - errors.addError(new FieldError("accountEntity", "name", accountEntity.getName(), false, - new String[]{ErrorCode.NON_UNIQUE_VALUE.getCode()}, null, null)); - } - if (!accountEntityRepository.uniqueCheck("code", accountEntity)) { - errors.addError(new FieldError("accountEntity", "code", accountEntity.getCode(), false, - new String[]{ErrorCode.NON_UNIQUE_VALUE.getCode()}, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (accountentities == null) { - throw new InvalidDataException("accountentities", ErrorCode.NOT_NULL.getCode(), null); - } - for (AccountEntity accountEntity : accountentities) { - if (accountEntity.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - accountEntity.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List accountentities) { - for (AccountEntity accountEntity : accountentities) { - // fetch related items - accountEntity.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (accountEntity.getAccountDetailType() != null) { - AccountDetailType accountDetailType = accountDetailTypeRepository - .findById(accountEntity.getAccountDetailType()); - if (accountDetailType == null) { - throw new InvalidDataException("accountDetailType", "accountDetailType.invalid", - " Invalid accountDetailType"); - } - accountEntity.setAccountDetailType(accountDetailType); - } - - } - - return accountentities; - } - - @Transactional - public List add(List accountentities, BindingResult errors) { - accountentities = fetchRelated(accountentities); - validate(accountentities, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (AccountEntity b : accountentities) b.setId(accountEntityRepository.getNextSequence()); - return accountentities; - - } - - @Transactional - public List update(List accountentities, BindingResult errors) { - accountentities = fetchRelated(accountentities); - validate(accountentities, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return accountentities; - - } - - public void addToQue(AccountEntityRequest request) { - accountEntityRepository.add(request); - } - - public Pagination search(AccountEntitySearch accountEntitySearch, BindingResult errors) { - - try { - - List accountentities = new ArrayList<>(); - accountentities.add(accountEntitySearch); - validate(accountentities, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return accountEntityRepository.search(accountEntitySearch); - } - - @Transactional - public AccountEntity save(AccountEntity accountEntity) { - return accountEntityRepository.save(accountEntity); - } - - @Transactional - public AccountEntity update(AccountEntity accountEntity) { - return accountEntityRepository.update(accountEntity); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BankAccountService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BankAccountService.java deleted file mode 100644 index 1cd0629f93a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BankAccountService.java +++ /dev/null @@ -1,228 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankAccountSearch; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.repository.BankAccountRepository; -import org.egov.egf.master.domain.repository.BankBranchRepository; -import org.egov.egf.master.domain.repository.ChartOfAccountRepository; -import org.egov.egf.master.domain.repository.FundRepository; -import org.egov.egf.master.web.requests.BankAccountRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class BankAccountService { - - @Autowired - private BankAccountRepository bankAccountRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private ChartOfAccountRepository chartOfAccountRepository; - @Autowired - private BankBranchRepository bankBranchRepository; - @Autowired - private FundRepository fundRepository; - - @Transactional - public List create(List bankAccounts, BindingResult errors, RequestInfo requestInfo) { - - try { - - bankAccounts = fetchRelated(bankAccounts); - - validate(bankAccounts, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (BankAccount b : bankAccounts) { - b.setId(bankAccountRepository.getNextSequence()); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return bankAccountRepository.save(bankAccounts, requestInfo); - - } - - @Transactional - public List update(List bankAccounts, BindingResult errors, RequestInfo requestInfo) { - - try { - - bankAccounts = fetchRelated(bankAccounts); - - validate(bankAccounts, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return bankAccountRepository.update(bankAccounts, requestInfo); - - } - - private BindingResult validate(List bankaccounts, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(bankAccountContractRequest.getBankAccount(), - // errors); - break; - case Constants.ACTION_CREATE: - if (bankaccounts == null) { - throw new InvalidDataException("bankaccounts", ErrorCode.NOT_NULL.getCode(), null); - } - for (BankAccount bankAccount : bankaccounts) { - validator.validate(bankAccount, errors); - if (!bankAccountRepository.uniqueCheck("accountNumber", bankAccount)) { - errors.addError(new FieldError("bankAccount", "name", bankAccount.getAccountNumber(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (bankaccounts == null) { - throw new InvalidDataException("bankaccounts", ErrorCode.NOT_NULL.getCode(), null); - } - for (BankAccount bankAccount : bankaccounts) { - if (bankAccount.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - bankAccount.getId()); - } - validator.validate(bankAccount, errors); - if (!bankAccountRepository.uniqueCheck("accountNumber", bankAccount)) { - errors.addError(new FieldError("bankAccount", "name", bankAccount.getAccountNumber(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (bankaccounts == null) { - throw new InvalidDataException("bankaccounts", ErrorCode.NOT_NULL.getCode(), null); - } - for (BankAccount bankaccount : bankaccounts) { - if (bankaccount.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - bankaccount.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List bankaccounts) { - for (BankAccount bankAccount : bankaccounts) { - // fetch related items - bankAccount.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (bankAccount.getBankBranch() != null) { - BankBranch bankBranch = bankBranchRepository.findById(bankAccount.getBankBranch()); - if (bankBranch == null) { - throw new InvalidDataException("bankBranch", "bankBranch.invalid", " Invalid bankBranch"); - } - bankAccount.setBankBranch(bankBranch); - } - if (bankAccount.getChartOfAccount() != null) { - ChartOfAccount chartOfAccount = chartOfAccountRepository.findById(bankAccount.getChartOfAccount()); - if (chartOfAccount == null) { - throw new InvalidDataException("chartOfAccount", "chartOfAccount.invalid", - " Invalid chartOfAccount"); - } - bankAccount.setChartOfAccount(chartOfAccount); - } - if (bankAccount.getFund() != null) { - Fund fund = fundRepository.findById(bankAccount.getFund()); - if (fund == null) { - throw new InvalidDataException("fund", "fund.invalid", " Invalid fund"); - } - bankAccount.setFund(fund); - } - - } - - return bankaccounts; - } - - @Transactional - public List update(List bankaccounts, BindingResult errors) { - bankaccounts = fetchRelated(bankaccounts); - validate(bankaccounts, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return bankaccounts; - - } - - public void addToQue(BankAccountRequest request) { - bankAccountRepository.add(request); - } - - public Pagination search(BankAccountSearch bankAccountSearch, BindingResult errors) { - - try { - - List bankAccounts = new ArrayList<>(); - bankAccounts.add(bankAccountSearch); - validate(bankAccounts, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return bankAccountRepository.search(bankAccountSearch); - } - - @Transactional - public BankAccount save(BankAccount bankAccount) { - return bankAccountRepository.save(bankAccount); - } - - @Transactional - public BankAccount update(BankAccount bankAccount) { - return bankAccountRepository.update(bankAccount); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BankBranchService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BankBranchService.java deleted file mode 100644 index 89592f16456..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BankBranchService.java +++ /dev/null @@ -1,208 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.BankBranchSearch; -import org.egov.egf.master.domain.repository.BankBranchRepository; -import org.egov.egf.master.domain.repository.BankRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class BankBranchService { - - @Autowired - private BankBranchRepository bankBranchRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private BankRepository bankRepository; - - @Transactional - public List create(List bankBranches, BindingResult errors, RequestInfo requestInfo) { - - try { - - bankBranches = fetchRelated(bankBranches); - - validate(bankBranches, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (BankBranch b : bankBranches) { - b.setId(bankBranchRepository.getNextSequence()); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return bankBranchRepository.save(bankBranches, requestInfo); - - } - - @Transactional - public List update(List bankBranches, BindingResult errors, RequestInfo requestInfo) { - - try { - - bankBranches = fetchRelated(bankBranches); - - validate(bankBranches, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return bankBranchRepository.update(bankBranches, requestInfo); - - } - - private BindingResult validate(List bankbranches, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(bankBranchContractRequest.getBankBranch(), - // errors); - break; - case Constants.ACTION_CREATE: - if (bankbranches == null) { - throw new InvalidDataException("bankbranches", ErrorCode.NOT_NULL.getCode(), null); - } - for (BankBranch bankBranch : bankbranches) { - validator.validate(bankBranch, errors); - if (!bankBranchRepository.uniqueCheck("name", bankBranch)) { - errors.addError(new FieldError("bankBranch", "name", bankBranch.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!bankBranchRepository.uniqueCheck("code", bankBranch)) { - errors.addError(new FieldError("bankBranch", "code", bankBranch.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (bankbranches == null) { - throw new InvalidDataException("bankbranches", ErrorCode.NOT_NULL.getCode(), null); - } - for (BankBranch bankBranch : bankbranches) { - if (bankBranch.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), bankBranch.getId()); - } - validator.validate(bankBranch, errors); - if (!bankBranchRepository.uniqueCheck("name", bankBranch)) { - errors.addError(new FieldError("bankBranch", "name", bankBranch.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!bankBranchRepository.uniqueCheck("code", bankBranch)) { - errors.addError(new FieldError("bankBranch", "code", bankBranch.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (bankbranches == null) { - throw new InvalidDataException("bankbranches", ErrorCode.NOT_NULL.getCode(), null); - } - for (BankBranch bankbranch : bankbranches) { - if (bankbranch.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - bankbranch.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List bankbranches) { - for (BankBranch bankBranch : bankbranches) { - // fetch related items - bankBranch.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (bankBranch.getTenantId() != null) - if (bankBranch.getBank() != null && bankBranch.getBank().getId() != null) { - bankBranch.getBank().setTenantId(bankBranch.getTenantId()); - Bank bank = bankRepository.findById(bankBranch.getBank()); - if (bank == null) { - throw new InvalidDataException("bank", "bank.invalid", " Invalid bank"); - } - bankBranch.setBank(bank); - } - - } - - return bankbranches; - } - - @Transactional - public List update(List bankbranches, BindingResult errors) { - bankbranches = fetchRelated(bankbranches); - validate(bankbranches, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return bankbranches; - - } - - public Pagination search(BankBranchSearch bankBranchSearch, BindingResult errors) { - - try { - - List bankBranches = new ArrayList<>(); - bankBranches.add(bankBranchSearch); - validate(bankBranches, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return bankBranchRepository.search(bankBranchSearch); - } - - @Transactional - public BankBranch save(BankBranch bankBranch) { - return bankBranchRepository.save(bankBranch); - } - - @Transactional - public BankBranch update(BankBranch bankBranch) { - return bankBranchRepository.update(bankBranch); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BankService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BankService.java deleted file mode 100644 index 614b3cd7f90..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BankService.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankSearch; -import org.egov.egf.master.domain.repository.BankRepository; -import org.egov.egf.master.persistence.repository.BankJdbcRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class BankService { - - @Autowired - private BankRepository bankRepository; - - @Autowired - private BankJdbcRepository bankJdbcRepository; - - @Autowired - private SmartValidator validator; - - @Transactional - public List create(List banks, BindingResult errors, RequestInfo requestInfo) { - - try { - - banks = fetchRelated(banks); - - validate(banks, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (Bank b : banks) { - b.setId(bankRepository.getNextSequence()); - b.setTenantId(ApplicationThreadLocals.getTenantId().get()); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return bankRepository.save(banks, requestInfo); - - } - - @Transactional - public List update(List banks, BindingResult errors, RequestInfo requestInfo) { - - try { - - banks = fetchRelated(banks); - - validate(banks, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return bankRepository.update(banks, requestInfo); - - } - - private BindingResult validate(List banks, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(bankContractRequest.getBank(), errors); - break; - case Constants.ACTION_CREATE: - if (banks == null) { - throw new InvalidDataException("banks", ErrorCode.NOT_NULL.getCode(), null); - } - for (Bank bank : banks) { - validator.validate(bank, errors); - if (!bankRepository.uniqueCheck("name", bank)) { - errors.addError(new FieldError("bank", "name", bank.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!bankRepository.uniqueCheck("code", bank)) { - errors.addError(new FieldError("bank", "code", bank.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (banks == null) { - throw new InvalidDataException("banks", ErrorCode.NOT_NULL.getCode(), null); - } - for (Bank bank : banks) { - if (bank.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), bank.getId()); - } - validator.validate(bank, errors); - if (!bankRepository.uniqueCheck("name", bank)) { - errors.addError(new FieldError("bank", "name", bank.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!bankRepository.uniqueCheck("code", bank)) { - errors.addError(new FieldError("bank", "code", bank.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (banks == null) { - throw new InvalidDataException("banks", ErrorCode.NOT_NULL.getCode(), null); - } - for (Bank bank : banks) { - if (bank.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - bank.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List banks) { - - return banks; - } - - @Transactional - public List update(List banks, BindingResult errors) { - banks = fetchRelated(banks); - validate(banks, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return banks; - - } - - public Pagination search(BankSearch bankSearch, BindingResult errors) { - - try { - - List banks = new ArrayList<>(); - banks.add(bankSearch); - validate(banks, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return bankRepository.search(bankSearch); - } - - @Transactional - public Bank save(Bank bank) { - return bankRepository.save(bank); - } - - @Transactional - public Bank update(Bank bank) { - return bankRepository.update(bank); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BudgetGroupService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BudgetGroupService.java deleted file mode 100644 index b9d90a95c55..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/BudgetGroupService.java +++ /dev/null @@ -1,181 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.BudgetGroup; -import org.egov.egf.master.domain.model.BudgetGroupSearch; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.repository.BudgetGroupRepository; -import org.egov.egf.master.domain.repository.ChartOfAccountRepository; -import org.egov.egf.master.web.requests.BudgetGroupRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class BudgetGroupService { - - @Autowired - private BudgetGroupRepository budgetGroupRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private ChartOfAccountRepository chartOfAccountRepository; - - private BindingResult validate(List budgetgroups, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(budgetGroupContractRequest.getBudgetGroup(), - // errors); - break; - case Constants.ACTION_CREATE: - if (budgetgroups == null) { - throw new InvalidDataException("budgetgroups", ErrorCode.NOT_NULL.getCode(), null); - } - for (BudgetGroup budgetGroup : budgetgroups) { - validator.validate(budgetGroup, errors); - if (!budgetGroupRepository.uniqueCheck("name", budgetGroup)) { - errors.addError(new FieldError("budgetGroup", "name", budgetGroup.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (budgetgroups == null) { - throw new InvalidDataException("budgetgroups", ErrorCode.NOT_NULL.getCode(), null); - } - for (BudgetGroup budgetGroup : budgetgroups) { - if (budgetGroup.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), budgetGroup.getId()); - } - validator.validate(budgetGroup, errors); - if (!budgetGroupRepository.uniqueCheck("name", budgetGroup)) { - errors.addError(new FieldError("budgetGroup", "name", budgetGroup.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (budgetgroups == null) { - throw new InvalidDataException("budgetgroups", ErrorCode.NOT_NULL.getCode(), null); - } - for (BudgetGroup budgetgroup : budgetgroups) { - if (budgetgroup.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - budgetgroup.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List budgetgroups) { - for (BudgetGroup budgetGroup : budgetgroups) { - // fetch related items - budgetGroup.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (budgetGroup.getMajorCode() != null) { - ChartOfAccount majorCode = chartOfAccountRepository.findById(budgetGroup.getMajorCode()); - if (majorCode == null) { - throw new InvalidDataException("majorCode", "majorCode.invalid", " Invalid majorCode"); - } - budgetGroup.setMajorCode(majorCode); - } - if (budgetGroup.getMaxCode() != null) { - ChartOfAccount maxCode = chartOfAccountRepository.findById(budgetGroup.getMaxCode()); - if (maxCode == null) { - throw new InvalidDataException("maxCode", "maxCode.invalid", " Invalid maxCode"); - } - budgetGroup.setMaxCode(maxCode); - } - if (budgetGroup.getMinCode() != null) { - ChartOfAccount minCode = chartOfAccountRepository.findById(budgetGroup.getMinCode()); - if (minCode == null) { - throw new InvalidDataException("minCode", "minCode.invalid", " Invalid minCode"); - } - budgetGroup.setMinCode(minCode); - } - - } - - return budgetgroups; - } - - @Transactional - public List add(List budgetgroups, BindingResult errors) { - budgetgroups = fetchRelated(budgetgroups); - validate(budgetgroups, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(BudgetGroup b:budgetgroups)b.setId(budgetGroupRepository.getNextSequence()); - return budgetgroups; - - } - - @Transactional - public List update(List budgetgroups, BindingResult errors) { - budgetgroups = fetchRelated(budgetgroups); - validate(budgetgroups, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return budgetgroups; - - } - - public void addToQue(BudgetGroupRequest request) { - budgetGroupRepository.add(request); - } - - public Pagination search(BudgetGroupSearch budgetGroupSearch, BindingResult errors) { - - try { - - List budgetGroups = new ArrayList<>(); - budgetGroups.add(budgetGroupSearch); - validate(budgetGroups, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return budgetGroupRepository.search(budgetGroupSearch); - } - - @Transactional - public BudgetGroup save(BudgetGroup budgetGroup) { - return budgetGroupRepository.save(budgetGroup); - } - - @Transactional - public BudgetGroup update(BudgetGroup budgetGroup) { - return budgetGroupRepository.update(budgetGroup); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/ChartOfAccountDetailService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/ChartOfAccountDetailService.java deleted file mode 100644 index 56c5d3a9b1f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/ChartOfAccountDetailService.java +++ /dev/null @@ -1,178 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; -import org.egov.egf.master.domain.repository.AccountDetailTypeRepository; -import org.egov.egf.master.domain.repository.ChartOfAccountDetailRepository; -import org.egov.egf.master.domain.repository.ChartOfAccountRepository; -import org.egov.egf.master.web.requests.ChartOfAccountDetailRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class ChartOfAccountDetailService { - - @Autowired - private ChartOfAccountDetailRepository chartOfAccountDetailRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private ChartOfAccountRepository chartOfAccountRepository; - @Autowired - private AccountDetailTypeRepository accountDetailTypeRepository; - - private BindingResult validate(List chartofaccountdetails, String method, - BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(chartOfAccountDetailContractRequest.getChartOfAccountDetail(), - // errors); - break; - case Constants.ACTION_CREATE: - if (chartofaccountdetails == null) { - throw new InvalidDataException("chartofaccountdetails", ErrorCode.NOT_NULL.getCode(), - null); - } - for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails) { - validator.validate(chartOfAccountDetail, errors); - } - break; - case Constants.ACTION_UPDATE: - if (chartofaccountdetails == null) { - throw new InvalidDataException("chartofaccountdetails", ErrorCode.NOT_NULL.getCode(), - null); - } - for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails) { - if (chartOfAccountDetail.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - chartOfAccountDetail.getId()); - } - validator.validate(chartOfAccountDetail, errors); - } - break; - case Constants.ACTION_SEARCH: - if (chartofaccountdetails == null) { - throw new InvalidDataException("chartofaccountdetails", ErrorCode.NOT_NULL.getCode(), - null); - } - for (ChartOfAccountDetail chartofaccountdetail : chartofaccountdetails) { - if (chartofaccountdetail.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - chartofaccountdetail.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List chartofaccountdetails) { - for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails) { - // fetch related items - chartOfAccountDetail.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (chartOfAccountDetail.getChartOfAccount() != null) { - ChartOfAccount chartOfAccount = chartOfAccountRepository - .findById(chartOfAccountDetail.getChartOfAccount()); - if (chartOfAccount == null) { - throw new InvalidDataException("chartOfAccount", "chartOfAccount.invalid", - " Invalid chartOfAccount"); - } - chartOfAccountDetail.setChartOfAccount(chartOfAccount); - } - if (chartOfAccountDetail.getAccountDetailType() != null) { - AccountDetailType accountDetailType = accountDetailTypeRepository - .findById(chartOfAccountDetail.getAccountDetailType()); - if (accountDetailType == null) { - throw new InvalidDataException("accountDetailType", "accountDetailType.invalid", - " Invalid accountDetailType"); - } - chartOfAccountDetail.setAccountDetailType(accountDetailType); - } - - } - - return chartofaccountdetails; - } - - @Transactional - public List add(List chartofaccountdetails, BindingResult errors) { - chartofaccountdetails = fetchRelated(chartofaccountdetails); - validate(chartofaccountdetails, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(ChartOfAccountDetail b:chartofaccountdetails)b.setId(chartOfAccountDetailRepository.getNextSequence()); - return chartofaccountdetails; - - } - - @Transactional - public List update(List chartofaccountdetails, BindingResult errors) { - chartofaccountdetails = fetchRelated(chartofaccountdetails); - validate(chartofaccountdetails, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return chartofaccountdetails; - - } - - public void addToQue(ChartOfAccountDetailRequest request) { - chartOfAccountDetailRepository.add(request); - } - - public Pagination search(ChartOfAccountDetailSearch chartOfAccountDetailSearch, BindingResult errors) { - - try { - - List chartOfAccountDetails = new ArrayList<>(); - chartOfAccountDetails.add(chartOfAccountDetailSearch); - validate(chartOfAccountDetails, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return chartOfAccountDetailRepository.search(chartOfAccountDetailSearch); - } - - @Transactional - public ChartOfAccountDetail save(ChartOfAccountDetail chartOfAccountDetail) { - return chartOfAccountDetailRepository.save(chartOfAccountDetail); - } - - @Transactional - public ChartOfAccountDetail update(ChartOfAccountDetail chartOfAccountDetail) { - return chartOfAccountDetailRepository.update(chartOfAccountDetail); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/ChartOfAccountService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/ChartOfAccountService.java deleted file mode 100644 index 7eb944e2bdc..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/ChartOfAccountService.java +++ /dev/null @@ -1,185 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.domain.repository.AccountCodePurposeRepository; -import org.egov.egf.master.domain.repository.ChartOfAccountRepository; -import org.egov.egf.master.web.requests.ChartOfAccountRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class ChartOfAccountService { - - @Autowired - private ChartOfAccountRepository chartOfAccountRepository; - - @Autowired - private SmartValidator validator; - - @Autowired - private AccountCodePurposeRepository accountCodePurposeRepository; - - private BindingResult validate(List chartofaccounts, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(chartOfAccountContractRequest.getChartOfAccount(), - // errors); - break; - case Constants.ACTION_CREATE: - if (chartofaccounts == null) { - throw new InvalidDataException("chartofaccounts", ErrorCode.NOT_NULL.getCode(), null); - } - for (ChartOfAccount chartOfAccount : chartofaccounts) { - validator.validate(chartOfAccount, errors); - if (!chartOfAccountRepository.uniqueCheck("name", chartOfAccount)) { - errors.addError(new FieldError("chartOfAccount", "name", chartOfAccount.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!chartOfAccountRepository.uniqueCheck("glcode", chartOfAccount)) { - errors.addError(new FieldError("chartOfAccount", "glcode", chartOfAccount.getGlcode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (chartofaccounts == null) { - throw new InvalidDataException("chartofaccounts", ErrorCode.NOT_NULL.getCode(), null); - } - for (ChartOfAccount chartOfAccount : chartofaccounts) { - if (chartOfAccount.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), chartOfAccount.getId()); - } - validator.validate(chartOfAccount, errors); - if (!chartOfAccountRepository.uniqueCheck("name", chartOfAccount)) { - errors.addError(new FieldError("chartOfAccount", "name", chartOfAccount.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!chartOfAccountRepository.uniqueCheck("glcode", chartOfAccount)) { - errors.addError(new FieldError("chartOfAccount", "glcode", chartOfAccount.getGlcode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (chartofaccounts == null) { - throw new InvalidDataException("chartofaccounts", ErrorCode.NOT_NULL.getCode(), null); - } - for (ChartOfAccount chartofaccount : chartofaccounts) { - if (chartofaccount.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - chartofaccount.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List chartofaccounts) { - for (ChartOfAccount chartOfAccount : chartofaccounts) { - // fetch related items - chartOfAccount.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (chartOfAccount.getAccountCodePurpose() != null) { - AccountCodePurpose accountCodePurpose = accountCodePurposeRepository - .findById(chartOfAccount.getAccountCodePurpose()); - if (accountCodePurpose == null) { - throw new InvalidDataException("accountCodePurpose", "accountCodePurpose.invalid", - " Invalid accountCodePurpose"); - } - chartOfAccount.setAccountCodePurpose(accountCodePurpose); - } - if (chartOfAccount.getParentId() != null) { - ChartOfAccount parentId = chartOfAccountRepository.findById(chartOfAccount.getParentId()); - if (parentId == null) { - throw new InvalidDataException("parentId", "parentId.invalid", " Invalid parentId"); - } - chartOfAccount.setParentId(parentId); - } - - } - - return chartofaccounts; - } - - @Transactional - public List add(List chartofaccounts, BindingResult errors) { - chartofaccounts = fetchRelated(chartofaccounts); - validate(chartofaccounts, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(ChartOfAccount b:chartofaccounts)b.setId(chartOfAccountRepository.getNextSequence()); - return chartofaccounts; - - } - - @Transactional - public List update(List chartofaccounts, BindingResult errors) { - chartofaccounts = fetchRelated(chartofaccounts); - validate(chartofaccounts, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return chartofaccounts; - - } - - public void addToQue(ChartOfAccountRequest request) { - chartOfAccountRepository.add(request); - } - - public Pagination search(ChartOfAccountSearch chartOfAccountSearch, BindingResult errors) { - - try { - - List chartOfAccounts = new ArrayList<>(); - chartOfAccounts.add(chartOfAccountSearch); - validate(chartOfAccounts, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return chartOfAccountRepository.search(chartOfAccountSearch); - } - - @Transactional - public ChartOfAccount save(ChartOfAccount chartOfAccount) { - return chartOfAccountRepository.save(chartOfAccount); - } - - @Transactional - public ChartOfAccount update(ChartOfAccount chartOfAccount) { - return chartOfAccountRepository.update(chartOfAccount); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FinancialConfigurationService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FinancialConfigurationService.java deleted file mode 100644 index d3306eb35aa..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FinancialConfigurationService.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.FinancialConfiguration; -import org.egov.egf.master.domain.model.FinancialConfigurationSearch; -import org.egov.egf.master.domain.repository.FinancialConfigurationRepository; -import org.egov.egf.master.web.requests.FinancialConfigurationRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class FinancialConfigurationService { - - @Autowired - private FinancialConfigurationRepository financialConfigurationRepository; - - @Autowired - private SmartValidator validator; - - @Value("${fetch_data_from}") - private String fetchDataFrom; - - private BindingResult validate(List financialconfigurations, String method, - BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(financialConfigurationContractRequest.getFinancialConfiguration(), - // errors); - break; - case Constants.ACTION_CREATE: - if (financialconfigurations == null) { - throw new InvalidDataException("financialconfigurations", ErrorCode.NOT_NULL.getCode(), - null); - } - for (FinancialConfiguration financialConfiguration : financialconfigurations) { - validator.validate(financialConfiguration, errors); - if (!financialConfigurationRepository.uniqueCheck("name", financialConfiguration)) { - errors.addError(new FieldError("financialConfiguration", "name", financialConfiguration.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (financialconfigurations == null) { - throw new InvalidDataException("financialconfigurations", ErrorCode.NOT_NULL.getCode(), - null); - } - for (FinancialConfiguration financialConfiguration : financialconfigurations) { - if (financialConfiguration.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - financialConfiguration.getId()); - } - validator.validate(financialConfiguration, errors); - if (!financialConfigurationRepository.uniqueCheck("name", financialConfiguration)) { - errors.addError(new FieldError("financialConfiguration", "name", financialConfiguration.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (financialconfigurations == null) { - throw new InvalidDataException("financialconfigurations", ErrorCode.NOT_NULL.getCode(), - null); - } - for (FinancialConfiguration financialconfiguration : financialconfigurations) { - if (financialconfiguration.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - financialconfiguration.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List financialconfigurations) { - for (FinancialConfiguration financialConfiguration : financialconfigurations) { - // fetch related items - financialConfiguration.setTenantId(ApplicationThreadLocals.getTenantId().get()); - - } - - return financialconfigurations; - } - - @Transactional - public List add(List financialconfigurations, - BindingResult errors) { - financialconfigurations = fetchRelated(financialconfigurations); - validate(financialconfigurations, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return financialconfigurations; - - } - - @Transactional - public List update(List financialconfigurations, - BindingResult errors) { - financialconfigurations = fetchRelated(financialconfigurations); - validate(financialconfigurations, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return financialconfigurations; - - } - - public void addToQue(FinancialConfigurationRequest request) { - financialConfigurationRepository.add(request); - } - - public Pagination search(FinancialConfigurationSearch financialConfigurationSearch, BindingResult errors) { - - try { - - List financialConfigurations = new ArrayList<>(); - financialConfigurations.add(financialConfigurationSearch); - validate(financialConfigurations, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return financialConfigurationRepository.search(financialConfigurationSearch); - } - - @Transactional - public FinancialConfiguration save(FinancialConfiguration financialConfiguration) { - return financialConfigurationRepository.save(financialConfiguration); - } - - @Transactional - public FinancialConfiguration update(FinancialConfiguration financialConfiguration) { - return financialConfigurationRepository.update(financialConfiguration); - } - - public String fetchDataFrom() { - return fetchDataFrom; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FinancialStatusService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FinancialStatusService.java deleted file mode 100644 index 7794a89bac3..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FinancialStatusService.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.FinancialStatus; -import org.egov.egf.master.domain.model.FinancialStatusSearch; -import org.egov.egf.master.domain.repository.FinancialStatusRepository; -import org.egov.egf.master.web.requests.FinancialStatusRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class FinancialStatusService { - - @Autowired - private FinancialStatusRepository financialStatusRepository; - - @Autowired - private SmartValidator validator; - - private BindingResult validate(List financialstatuses, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(financialStatusContractRequest.getFinancialStatus(), - // errors); - break; - case Constants.ACTION_CREATE: - if (financialstatuses == null) { - throw new InvalidDataException("financialstatuses", ErrorCode.NOT_NULL.getCode(), - null); - } - for (FinancialStatus financialStatus : financialstatuses) { - validator.validate(financialStatus, errors); - if (!financialStatusRepository.uniqueCheck("name", financialStatus)) { - errors.addError(new FieldError("financialStatus", "name", financialStatus.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!financialStatusRepository.uniqueCheck("code", financialStatus)) { - errors.addError(new FieldError("financialStatus", "code", financialStatus.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (financialstatuses == null) { - throw new InvalidDataException("financialstatuses", ErrorCode.NOT_NULL.getCode(), - null); - } - for (FinancialStatus financialStatus : financialstatuses) { - if (financialStatus.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), financialStatus.getId()); - } - validator.validate(financialStatus, errors); - if (!financialStatusRepository.uniqueCheck("name", financialStatus)) { - errors.addError(new FieldError("financialStatus", "name", financialStatus.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!financialStatusRepository.uniqueCheck("code", financialStatus)) { - errors.addError(new FieldError("financialStatus", "code", financialStatus.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (financialstatuses == null) { - throw new InvalidDataException("financialstatuses", ErrorCode.NOT_NULL.getCode(), - null); - } - for (FinancialStatus financialstatus : financialstatuses) { - if (financialstatus.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - financialstatus.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List financialstatuses) { - for (FinancialStatus financialStatus : financialstatuses) { - // fetch related items - financialStatus.setTenantId(ApplicationThreadLocals.getTenantId().get()); - - } - - return financialstatuses; - } - - @Transactional - public List add(List financialstatuses, BindingResult errors) { - financialstatuses = fetchRelated(financialstatuses); - validate(financialstatuses, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return financialstatuses; - - } - - @Transactional - public List update(List financialstatuses, BindingResult errors) { - financialstatuses = fetchRelated(financialstatuses); - validate(financialstatuses, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return financialstatuses; - - } - - public void addToQue(FinancialStatusRequest request) { - financialStatusRepository.add(request); - } - - public Pagination search(FinancialStatusSearch financialStatusSearch, BindingResult errors) { - - try { - - List financialStatuses = new ArrayList<>(); - financialStatuses.add(financialStatusSearch); - validate(financialStatuses, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return financialStatusRepository.search(financialStatusSearch); - } - - @Transactional - public FinancialStatus save(FinancialStatus financialStatus) { - return financialStatusRepository.save(financialStatus); - } - - @Transactional - public FinancialStatus update(FinancialStatus financialStatus) { - return financialStatusRepository.update(financialStatus); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FinancialYearService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FinancialYearService.java deleted file mode 100644 index aaac97b6058..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FinancialYearService.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.FinancialYear; -import org.egov.egf.master.domain.model.FinancialYearSearch; -import org.egov.egf.master.domain.repository.FinancialYearRepository; -import org.egov.egf.master.web.requests.FinancialYearRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class FinancialYearService { - - @Autowired - private FinancialYearRepository financialYearRepository; - - @Autowired - private SmartValidator validator; - - public BindingResult validate(List financialyears, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(financialYearContractRequest.getFinancialYear(), - // errors); - break; - case Constants.ACTION_CREATE: - if (financialyears == null) { - throw new InvalidDataException("financialyears", ErrorCode.NOT_NULL.getCode(), null); - } - for (FinancialYear financialYear : financialyears) { - validator.validate(financialYear, errors); - if (!financialYearRepository.uniqueCheck("finYearRange", financialYear)) { - errors.addError(new FieldError("financialYear", "finYearRange", financialYear.getFinYearRange(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!financialYearRepository.uniqueCheck("startingdate", financialYear)) { - errors.addError(new FieldError("financialYear", "startingdate", financialYear.getStartingDate(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!financialYearRepository.uniqueCheck("endingdate", financialYear)) { - errors.addError(new FieldError("financialYear", "endingdate", financialYear.getEndingDate(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (financialyears == null) { - throw new InvalidDataException("financialyears", ErrorCode.NOT_NULL.getCode(), null); - } - for (FinancialYear financialYear : financialyears) { - if (financialYear.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), financialYear.getId()); - } - validator.validate(financialYear, errors); - if (!financialYearRepository.uniqueCheck("finYearRange", financialYear)) { - errors.addError(new FieldError("financialYear", "finYearRange", financialYear.getFinYearRange(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!financialYearRepository.uniqueCheck("startingdate", financialYear)) { - errors.addError(new FieldError("financialYear", "startingdate", financialYear.getStartingDate(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!financialYearRepository.uniqueCheck("endingdate", financialYear)) { - errors.addError(new FieldError("financialYear", "endingdate", financialYear.getEndingDate(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (financialyears == null) { - throw new InvalidDataException("financialyears", ErrorCode.NOT_NULL.getCode(), null); - } - for (FinancialYear financialyear : financialyears) { - if (financialyear.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - financialyear.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List financialyears) { - for (FinancialYear financialYear : financialyears) { - // fetch related items - financialYear.setTenantId(ApplicationThreadLocals.getTenantId().get()); - - } - - return financialyears; - } - - @Transactional - public List add(List financialyears, BindingResult errors) { - financialyears = fetchRelated(financialyears); - validate(financialyears, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(FinancialYear b:financialyears)b.setId(financialYearRepository.getNextSequence()); - return financialyears; - - } - - public List update(List financialyears, BindingResult errors) { - financialyears = fetchRelated(financialyears); - validate(financialyears, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return financialyears; - - } - - public void addToQue(FinancialYearRequest request) { - financialYearRepository.add(request); - } - - public Pagination search(FinancialYearSearch financialYearSearch, BindingResult errors) { - - try { - - List financialYears = new ArrayList<>(); - financialYears.add(financialYearSearch); - validate(financialYears, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return financialYearRepository.search(financialYearSearch); - } - - @Transactional - public FinancialYear save(FinancialYear financialYear) { - return financialYearRepository.save(financialYear); - } - - @Transactional - public FinancialYear update(FinancialYear financialYear) { - return financialYearRepository.update(financialYear); - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FiscalPeriodService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FiscalPeriodService.java deleted file mode 100644 index 26ad0fa73bc..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FiscalPeriodService.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.FinancialYear; -import org.egov.egf.master.domain.model.FiscalPeriod; -import org.egov.egf.master.domain.model.FiscalPeriodSearch; -import org.egov.egf.master.domain.repository.FinancialYearRepository; -import org.egov.egf.master.domain.repository.FiscalPeriodRepository; -import org.egov.egf.master.web.requests.FiscalPeriodRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class FiscalPeriodService { - - @Autowired - private FiscalPeriodRepository fiscalPeriodRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private FinancialYearRepository financialYearRepository; - - private BindingResult validate(List fiscalperiods, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(fiscalPeriodContractRequest.getFiscalPeriod(), - // errors); - break; - case Constants.ACTION_CREATE: - if (fiscalperiods == null) { - throw new InvalidDataException("fiscalperiods", ErrorCode.NOT_NULL.getCode(), null); - } - for (FiscalPeriod fiscalPeriod : fiscalperiods) { - validator.validate(fiscalPeriod, errors); - if (!fiscalPeriodRepository.uniqueCheck("name", fiscalPeriod)) { - errors.addError(new FieldError("fiscalPeriod", "name", fiscalPeriod.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (fiscalperiods == null) { - throw new InvalidDataException("fiscalperiods", ErrorCode.NOT_NULL.getCode(), null); - } - for (FiscalPeriod fiscalPeriod : fiscalperiods) { - if (fiscalPeriod.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), fiscalPeriod.getId()); - } - validator.validate(fiscalPeriod, errors); - if (!fiscalPeriodRepository.uniqueCheck("name", fiscalPeriod)) { - errors.addError(new FieldError("fiscalPeriod", "name", fiscalPeriod.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (fiscalperiods == null) { - throw new InvalidDataException("fiscalperiods", ErrorCode.NOT_NULL.getCode(), null); - } - for (FiscalPeriod fiscalperiod : fiscalperiods) { - if (fiscalperiod.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - fiscalperiod.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List fiscalperiods) { - for (FiscalPeriod fiscalPeriod : fiscalperiods) { - // fetch related items - fiscalPeriod.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (fiscalPeriod.getFinancialYear() != null) { - FinancialYear financialYear = financialYearRepository.findById(fiscalPeriod.getFinancialYear()); - if (financialYear == null) { - throw new InvalidDataException("financialYear", "financialYear.invalid", " Invalid financialYear"); - } - fiscalPeriod.setFinancialYear(financialYear); - } - - } - - return fiscalperiods; - } - - @Transactional - public List add(List fiscalperiods, BindingResult errors) { - fiscalperiods = fetchRelated(fiscalperiods); - validate(fiscalperiods, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(FiscalPeriod b:fiscalperiods)b.setId(fiscalPeriodRepository.getNextSequence()); - return fiscalperiods; - - } - - @Transactional - public List update(List fiscalperiods, BindingResult errors) { - fiscalperiods = fetchRelated(fiscalperiods); - validate(fiscalperiods, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return fiscalperiods; - - } - - public void addToQue(FiscalPeriodRequest request) { - fiscalPeriodRepository.add(request); - } - - public Pagination search(FiscalPeriodSearch fiscalPeriodSearch, BindingResult errors) { - - try { - - List fiscalPeriods = new ArrayList<>(); - fiscalPeriods.add(fiscalPeriodSearch); - validate(fiscalPeriods, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return fiscalPeriodRepository.search(fiscalPeriodSearch); - } - - @Transactional - public FiscalPeriod save(FiscalPeriod fiscalPeriod) { - return fiscalPeriodRepository.save(fiscalPeriod); - } - - @Transactional - public FiscalPeriod update(FiscalPeriod fiscalPeriod) { - return fiscalPeriodRepository.update(fiscalPeriod); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FunctionService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FunctionService.java deleted file mode 100644 index 6601b8bde5f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FunctionService.java +++ /dev/null @@ -1,197 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.domain.model.FunctionSearch; -import org.egov.egf.master.domain.repository.FunctionRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class FunctionService { - - @Autowired - private FunctionRepository functionRepository; - - @Autowired - private SmartValidator validator; - - @Transactional - public List create(List functions, BindingResult errors, RequestInfo requestInfo) { - - try { - - functions = fetchRelated(functions); - - validate(functions, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (Function b : functions) { - b.setId(functionRepository.getNextSequence()); - b.add(); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return functionRepository.save(functions, requestInfo); - - } - - @Transactional - public List update(List functions, BindingResult errors, RequestInfo requestInfo) { - - try { - - functions = fetchRelated(functions); - - validate(functions, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (Function b : functions) { - b.update(); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return functionRepository.update(functions, requestInfo); - - } - - private BindingResult validate(List functions, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(functionContractRequest.getFunction(), - // errors); - break; - case Constants.ACTION_CREATE: - if (functions == null) { - throw new InvalidDataException("functions", ErrorCode.NOT_NULL.getCode(), null); - } - for (Function function : functions) { - validator.validate(function, errors); - if (!functionRepository.uniqueCheck("name", function)) { - errors.addError(new FieldError("function", "name", function.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!functionRepository.uniqueCheck("code", function)) { - errors.addError(new FieldError("function", "code", function.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (functions == null) { - throw new InvalidDataException("functions", ErrorCode.NOT_NULL.getCode(), null); - } - for (Function function : functions) { - if (function.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), function.getId()); - } - validator.validate(function, errors); - if (!functionRepository.uniqueCheck("name", function)) { - errors.addError(new FieldError("function", "name", function.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!functionRepository.uniqueCheck("code", function)) { - errors.addError(new FieldError("function", "code", function.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (functions == null) { - throw new InvalidDataException("functions", ErrorCode.NOT_NULL.getCode(), null); - } - for (Function function : functions) { - if (function.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - function.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List functions) { - for (Function function : functions) { - // fetch related items - function.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (function.getTenantId() != null) - if (function.getParentId() != null && function.getParentId().getId() != null) { - function.getParentId().setTenantId(function.getTenantId()); - Function parentId = functionRepository.findById(function.getParentId()); - if (parentId == null) { - throw new InvalidDataException("parentId", "parentId.invalid", " Invalid parentId"); - } - function.setParentId(parentId); - } - - } - - return functions; - } - - public Pagination search(FunctionSearch functionSearch, BindingResult errors) { - - try { - - List functions = new ArrayList<>(); - functions.add(functionSearch); - validate(functions, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return functionRepository.search(functionSearch); - } - - @Transactional - public Function save(Function function) { - return functionRepository.save(function); - } - - @Transactional - public Function update(Function function) { - return functionRepository.update(function); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FunctionaryService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FunctionaryService.java deleted file mode 100644 index bb86ec1de24..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FunctionaryService.java +++ /dev/null @@ -1,164 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.Functionary; -import org.egov.egf.master.domain.model.FunctionarySearch; -import org.egov.egf.master.domain.repository.FunctionaryRepository; -import org.egov.egf.master.web.requests.FunctionaryRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class FunctionaryService { - - @Autowired - private FunctionaryRepository functionaryRepository; - - @Autowired - private SmartValidator validator; - - private BindingResult validate(List functionaries, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(functionaryContractRequest.getFunctionary(), - // errors); - break; - case Constants.ACTION_CREATE: - if (functionaries == null) { - throw new InvalidDataException("functionaries", ErrorCode.NOT_NULL.getCode(), null); - } - for (Functionary functionary : functionaries) { - validator.validate(functionary, errors); - if (!functionaryRepository.uniqueCheck("name", functionary)) { - errors.addError(new FieldError("functionary", "name", functionary.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!functionaryRepository.uniqueCheck("code", functionary)) { - errors.addError(new FieldError("functionary", "code", functionary.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (functionaries == null) { - throw new InvalidDataException("functionaries", ErrorCode.NOT_NULL.getCode(), null); - } - for (Functionary functionary : functionaries) { - if (functionary.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), functionary.getId()); - } - validator.validate(functionary, errors); - if (!functionaryRepository.uniqueCheck("name", functionary)) { - errors.addError(new FieldError("functionary", "name", functionary.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!functionaryRepository.uniqueCheck("code", functionary)) { - errors.addError(new FieldError("functionary", "code", functionary.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (functionaries == null) { - throw new InvalidDataException("functionaries", ErrorCode.NOT_NULL.getCode(), null); - } - for (Functionary functionary : functionaries) { - if (functionary.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - functionary.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List functionaries) { - for (Functionary functionary : functionaries) { - // fetch related items - functionary.setTenantId(ApplicationThreadLocals.getTenantId().get()); - - } - - return functionaries; - } - - @Transactional - public List add(List functionaries, BindingResult errors) { - functionaries = fetchRelated(functionaries); - validate(functionaries, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(Functionary b:functionaries)b.setId(functionaryRepository.getNextSequence()); - return functionaries; - - } - - @Transactional - public List update(List functionaries, BindingResult errors) { - functionaries = fetchRelated(functionaries); - validate(functionaries, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return functionaries; - - } - - public void addToQue(FunctionaryRequest request) { - functionaryRepository.add(request); - } - - public Pagination search(FunctionarySearch functionarySearch, BindingResult errors) { - - try { - - List functionaries = new ArrayList<>(); - functionaries.add(functionarySearch); - validate(functionaries, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return functionaryRepository.search(functionarySearch); - } - - @Transactional - public Functionary save(Functionary functionary) { - return functionaryRepository.save(functionary); - } - - @Transactional - public Functionary update(Functionary functionary) { - return functionaryRepository.update(functionary); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FundService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FundService.java deleted file mode 100644 index 69e2a55f983..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FundService.java +++ /dev/null @@ -1,207 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.egov.common.constants.Constants.ACTION_VIEW; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.FundSearch; -import org.egov.egf.master.domain.repository.FundRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class FundService { - - @Autowired - private FundRepository fundRepository; - - @Autowired - private SmartValidator validator; - - @Transactional - public List create(List funds, BindingResult errors, RequestInfo requestInfo) { - - try { - - funds = fetchRelated(funds); - validate(funds, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (Fund b : funds) { - b.setId(fundRepository.getNextSequence()); - b.add(); - } - - } catch (CustomBindException e) { - throw e; - } - - return fundRepository.save(funds, requestInfo); - - } - - @Transactional - public List update(List funds, BindingResult errors, RequestInfo requestInfo) { - - try { - - funds = fetchRelated(funds); - - validate(funds, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (Fund b : funds) { - b.update(); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return fundRepository.update(funds, requestInfo); - - } - - private BindingResult validate(List funds, String method, BindingResult errors) { - - try { - switch (method) { - case ACTION_VIEW: - // validator.validate(fundContractRequest.getFund(), errors); - break; - case Constants.ACTION_CREATE: - if (funds == null) { - throw new InvalidDataException("funds", ErrorCode.NOT_NULL.getCode(), null); - } - for (Fund fund : funds) { - validator.validate(fund, errors); - if (!fundRepository.uniqueCheck("name", fund)) { - errors.addError(new FieldError("fund", "name", fund.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!fundRepository.uniqueCheck("code", fund)) { - errors.addError(new FieldError("fund", "code", fund.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!fundRepository.uniqueCheck("identifier", fund)) { - errors.addError(new FieldError("fund", "identifier", fund.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - - } - break; - case Constants.ACTION_UPDATE: - if (funds == null) { - throw new InvalidDataException("funds", ErrorCode.NOT_NULL.getCode(), null); - } - for (Fund fund : funds) { - if (fund.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), fund.getId()); - } - validator.validate(fund, errors); - if (!fundRepository.uniqueCheck("name", fund)) { - errors.addError(new FieldError("fund", "name", fund.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!fundRepository.uniqueCheck("code", fund)) { - errors.addError(new FieldError("fund", "code", fund.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!fundRepository.uniqueCheck("identifier", fund)) { - errors.addError(new FieldError("fund", "identifier", fund.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - - } - break; - case Constants.ACTION_SEARCH: - if (funds == null) { - throw new InvalidDataException("funds", ErrorCode.NOT_NULL.getCode(), null); - } - for (Fund fund : funds) { - if (fund.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - fund.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List funds) { - for (Fund fund : funds) { - // fetch related items - fund.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (fund.getTenantId() != null) - if (fund.getParent() != null && fund.getParent().getId() != null) { - fund.getParent().setTenantId(fund.getTenantId()); - Fund parentId = fundRepository.findById(fund.getParent()); - if (parentId == null) { - throw new InvalidDataException("parentId", ErrorCode.INVALID_REF_VALUE.getCode(), - fund.getParent().getId()); - } - fund.setParent(parentId); - } - - } - - return funds; - } - - public Pagination search(FundSearch fundSearch, BindingResult errors) { - - try { - - List funds = new ArrayList<>(); - funds.add(fundSearch); - validate(funds, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return fundRepository.search(fundSearch); - } - - @Transactional - public Fund save(Fund fund) { - return fundRepository.save(fund); - } - - @Transactional - public Fund update(Fund fund) { - return fundRepository.update(fund); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FundsourceService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FundsourceService.java deleted file mode 100644 index 7e0e493c3b7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/FundsourceService.java +++ /dev/null @@ -1,164 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.Fundsource; -import org.egov.egf.master.domain.model.FundsourceSearch; -import org.egov.egf.master.domain.repository.FundsourceRepository; -import org.egov.egf.master.web.requests.FundsourceRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class FundsourceService { - - @Autowired - private FundsourceRepository fundsourceRepository; - - @Autowired - private SmartValidator validator; - - - private BindingResult validate(List fundsources, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(fundsourceContractRequest.getFundsource(), - // errors); - break; - case Constants.ACTION_CREATE: - if (fundsources == null) { - throw new InvalidDataException("fundsources", ErrorCode.NOT_NULL.getCode(), null); - } - for (Fundsource fundsource : fundsources) { - validator.validate(fundsource, errors); - if (!fundsourceRepository.uniqueCheck("code", fundsource)) { - errors.addError(new FieldError("fundsource", "code", fundsource.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (fundsources == null) { - throw new InvalidDataException("fundsources", ErrorCode.NOT_NULL.getCode(), null); - } - for (Fundsource fundsource : fundsources) { - if (fundsource.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), fundsource.getId()); - } - validator.validate(fundsource, errors); - if (!fundsourceRepository.uniqueCheck("code", fundsource)) { - errors.addError(new FieldError("fundsource", "code", fundsource.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (fundsources == null) { - throw new InvalidDataException("fundsources", ErrorCode.NOT_NULL.getCode(), null); - } - for (Fundsource fundsource : fundsources) { - if (fundsource.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - fundsource.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List fundsources) { - for (Fundsource fundsource : fundsources) { - // fetch related items - fundsource.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (fundsource.getParent() != null) { - Fundsource fundSource = fundsourceRepository.findById(fundsource.getParent()); - if (fundSource == null) { - throw new InvalidDataException("fundSource", "fundSource.invalid", " Invalid fundSource"); - } - fundsource.setParent(fundSource); - } - - } - - return fundsources; - } - - @Transactional - public List add(List fundsources, BindingResult errors) { - fundsources = fetchRelated(fundsources); - validate(fundsources, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(Fundsource b:fundsources)b.setId(fundsourceRepository.getNextSequence()); - return fundsources; - - } - - @Transactional - public List update(List fundsources, BindingResult errors) { - fundsources = fetchRelated(fundsources); - validate(fundsources, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return fundsources; - - } - - public void addToQue(FundsourceRequest request) { - fundsourceRepository.add(request); - } - - public Pagination search(FundsourceSearch fundsourceSearch, BindingResult errors) { - - try { - - List fundsources = new ArrayList<>(); - fundsources.add(fundsourceSearch); - validate(fundsources, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return fundsourceRepository.search(fundsourceSearch); - } - - @Transactional - public Fundsource save(Fundsource fundsource) { - return fundsourceRepository.save(fundsource); - } - - @Transactional - public Fundsource update(Fundsource fundsource) { - return fundsourceRepository.update(fundsource); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/RecoveryService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/RecoveryService.java deleted file mode 100644 index 9cae8fcd321..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/RecoveryService.java +++ /dev/null @@ -1,201 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.domain.model.Recovery; -import org.egov.egf.master.domain.model.RecoverySearch; -import org.egov.egf.master.domain.repository.ChartOfAccountRepository; -import org.egov.egf.master.domain.repository.RecoveryRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class RecoveryService { - - @Autowired - private RecoveryRepository recoveryRepository; - - @Autowired - private SmartValidator validator; - - @Autowired - private ChartOfAccountRepository chartOfAccountRepository; - - @Transactional - public List create(List recoveries, BindingResult errors, - RequestInfo requestInfo) { - - try { - - recoveries = fetchRelated(recoveries); - - validate(recoveries, Constants.ACTION_CREATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for (Recovery b : recoveries) { - b.setId(recoveryRepository.getNextSequence()); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return recoveryRepository.save(recoveries, requestInfo); - - } - - @Transactional - public List update(List recoveries, BindingResult errors, - RequestInfo requestInfo) { - - try { - - recoveries = fetchRelated(recoveries); - - validate(recoveries, Constants.ACTION_UPDATE, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return recoveryRepository.update(recoveries, requestInfo); - - } - - private BindingResult validate(List recoveries, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(fundContractRequest.getFund(), errors); - break; - case Constants.ACTION_CREATE: - if (recoveries == null) { - throw new InvalidDataException("recoveries", ErrorCode.NOT_NULL.getCode(), null); - } - for (Recovery recovery : recoveries) { - validator.validate(recovery, errors); - if (!recoveryRepository.uniqueCheck("name", recovery)) { - errors.addError(new FieldError("recovery", "name", recovery.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!recoveryRepository.uniqueCheck("code", recovery)) { - errors.addError(new FieldError("recovery", "code", recovery.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (recoveries == null) { - throw new InvalidDataException("recoveries", ErrorCode.NOT_NULL.getCode(), null); - } - for (Recovery recovery : recoveries) { - if (recovery.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), recovery.getId()); - } - validator.validate(recovery, errors); - if (!recoveryRepository.uniqueCheck("name", recovery)) { - errors.addError(new FieldError("recovery", "name", recovery.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!recoveryRepository.uniqueCheck("code", recovery)) { - errors.addError(new FieldError("recovery", "code", recovery.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (recoveries == null) { - throw new InvalidDataException("recoveries", ErrorCode.NOT_NULL.getCode(), null); - } - for (Recovery recovery : recoveries) { - if (recovery.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - recovery.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List recoveries) { - for (Recovery recovery : recoveries) { - // fetch related items - recovery.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if(recovery.getChartOfAccount() != null) { - ChartOfAccountSearch chartOfAccountSearch = new ChartOfAccountSearch(); - chartOfAccountSearch.setGlcode(recovery.getChartOfAccount().getGlcode()); - Pagination response = chartOfAccountRepository.search(chartOfAccountSearch); - if (response == null || response.getPagedData() == null || response.getPagedData().isEmpty()) { - throw new InvalidDataException("chartOfAccount", "chartOfAccount.invalid", " Invalid chartOfAccount"); - }else{ - recovery.setChartOfAccount(response.getPagedData().get(0)); - } - } - } - - return recoveries; - - } - - public Pagination search(RecoverySearch recoverySearch, BindingResult errors) { - - try { - - List recoveries = new ArrayList<>(); - recoveries.add(recoverySearch); - validate(recoveries, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return recoveryRepository.search(recoverySearch); - } - - @Transactional - public Recovery save(Recovery recovery) { - return recoveryRepository.save(recovery); - } - - @Transactional - public Recovery update(Recovery recovery) { - return recoveryRepository.update(recovery); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/SchemeService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/SchemeService.java deleted file mode 100644 index 3c3e4f72a7d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/SchemeService.java +++ /dev/null @@ -1,175 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.Scheme; -import org.egov.egf.master.domain.model.SchemeSearch; -import org.egov.egf.master.domain.repository.FundRepository; -import org.egov.egf.master.domain.repository.SchemeRepository; -import org.egov.egf.master.web.requests.SchemeRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class SchemeService { - - @Autowired - private SchemeRepository schemeRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private FundRepository fundRepository; - - private BindingResult validate(List schemes, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(schemeContractRequest.getScheme(), - // errors); - break; - case Constants.ACTION_CREATE: - if (schemes == null) { - throw new InvalidDataException("schemes", ErrorCode.NOT_NULL.getCode(), null); - } - for (Scheme scheme : schemes) { - validator.validate(scheme, errors); - if (!schemeRepository.uniqueCheck("name", scheme)) { - errors.addError(new FieldError("scheme", "name", scheme.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!schemeRepository.uniqueCheck("code", scheme)) { - errors.addError(new FieldError("scheme", "code", scheme.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (schemes == null) { - throw new InvalidDataException("schemes", ErrorCode.NOT_NULL.getCode(), null); - } - for (Scheme scheme : schemes) { - if (scheme.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), scheme.getId()); - } - validator.validate(scheme, errors); - if (!schemeRepository.uniqueCheck("name", scheme)) { - errors.addError(new FieldError("scheme", "name", scheme.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - if (!schemeRepository.uniqueCheck("code", scheme)) { - errors.addError(new FieldError("scheme", "code", scheme.getCode(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (schemes == null) { - throw new InvalidDataException("schemes", ErrorCode.NOT_NULL.getCode(), null); - } - for (Scheme scheme : schemes) { - if (scheme.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - scheme.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List schemes) { - for (Scheme scheme : schemes) { - // fetch related items - scheme.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (scheme.getFund() != null) { - Fund fund = fundRepository.findById(scheme.getFund()); - if (fund == null) { - throw new InvalidDataException("fund", "fund.invalid", " Invalid fund"); - } - scheme.setFund(fund); - } - - } - - return schemes; - } - - @Transactional - public List add(List schemes, BindingResult errors) { - schemes = fetchRelated(schemes); - validate(schemes, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(Scheme b:schemes)b.setId(schemeRepository.getNextSequence()); - return schemes; - - } - - @Transactional - public List update(List schemes, BindingResult errors) { - schemes = fetchRelated(schemes); - validate(schemes, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return schemes; - - } - - public void addToQue(SchemeRequest request) { - schemeRepository.add(request); - } - - public Pagination search(SchemeSearch schemeSearch, BindingResult errors) { - - try { - - List schemes = new ArrayList<>(); - schemes.add(schemeSearch); - validate(schemes, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return schemeRepository.search(schemeSearch); - } - - @Transactional - public Scheme save(Scheme scheme) { - return schemeRepository.save(scheme); - } - - @Transactional - public Scheme update(Scheme scheme) { - return schemeRepository.update(scheme); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/SubSchemeService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/SubSchemeService.java deleted file mode 100644 index 7a8b3d2e7f2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/SubSchemeService.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.Scheme; -import org.egov.egf.master.domain.model.SubScheme; -import org.egov.egf.master.domain.model.SubSchemeSearch; -import org.egov.egf.master.domain.repository.SchemeRepository; -import org.egov.egf.master.domain.repository.SubSchemeRepository; -import org.egov.egf.master.web.requests.SubSchemeRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class SubSchemeService { - - @Autowired - private SubSchemeRepository subSchemeRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private SchemeRepository schemeRepository; - - private BindingResult validate(List subschemes, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(subSchemeContractRequest.getSubScheme(), - // errors); - break; - case Constants.ACTION_CREATE: - if (subschemes == null) { - throw new InvalidDataException("subschemes", ErrorCode.NOT_NULL.getCode(), null); - } - for (SubScheme subScheme : subschemes) { - validator.validate(subScheme, errors); - if (!subSchemeRepository.uniqueCheck("code", subScheme)) { - errors.addError(new FieldError("subScheme", "name", subScheme.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (subschemes == null) { - throw new InvalidDataException("subschemes", ErrorCode.NOT_NULL.getCode(), null); - } - for (SubScheme subScheme : subschemes) { - if (subScheme.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), subScheme.getId()); - } - validator.validate(subScheme, errors); - if (!subSchemeRepository.uniqueCheck("name", subScheme)) { - errors.addError(new FieldError("subScheme", "name", subScheme.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (subschemes == null) { - throw new InvalidDataException("subschemes", ErrorCode.NOT_NULL.getCode(), null); - } - for (SubScheme subscheme : subschemes) { - if (subscheme.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - subscheme.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List subschemes) { - for (SubScheme subScheme : subschemes) { - // fetch related items - subScheme.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (subScheme.getScheme() != null) { - Scheme scheme = schemeRepository.findById(subScheme.getScheme()); - if (scheme == null) { - throw new InvalidDataException("scheme", "scheme.invalid", " Invalid scheme"); - } - subScheme.setScheme(scheme); - } - - } - - return subschemes; - } - - @Transactional - public List add(List subschemes, BindingResult errors) { - subschemes = fetchRelated(subschemes); - validate(subschemes, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(SubScheme b:subschemes)b.setId(subSchemeRepository.getNextSequence()); - return subschemes; - - } - - @Transactional - public List update(List subschemes, BindingResult errors) { - subschemes = fetchRelated(subschemes); - validate(subschemes, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return subschemes; - - } - - public void addToQue(SubSchemeRequest request) { - subSchemeRepository.add(request); - } - - public Pagination search(SubSchemeSearch subSchemeSearch, BindingResult errors) { - - try { - - List subSchemes = new ArrayList<>(); - subSchemes.add(subSchemeSearch); - validate(subSchemes, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return subSchemeRepository.search(subSchemeSearch); - } - - @Transactional - public SubScheme save(SubScheme subScheme) { - return subSchemeRepository.save(subScheme); - } - - @Transactional - public SubScheme update(SubScheme subScheme) { - return subSchemeRepository.update(subScheme); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/SupplierService.java b/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/SupplierService.java deleted file mode 100644 index 3237f801298..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/domain/service/SupplierService.java +++ /dev/null @@ -1,178 +0,0 @@ -package org.egov.egf.master.domain.service; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.Supplier; -import org.egov.egf.master.domain.model.SupplierSearch; -import org.egov.egf.master.domain.repository.BankAccountRepository; -import org.egov.egf.master.domain.repository.BankRepository; -import org.egov.egf.master.domain.repository.SupplierRepository; -import org.egov.egf.master.web.requests.SupplierRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.BindingResult; -import org.springframework.validation.FieldError; -import org.springframework.validation.ObjectError; -import org.springframework.validation.SmartValidator; - -@Service -@Transactional(readOnly = true) -public class SupplierService { - - @Autowired - private SupplierRepository supplierRepository; - - @Autowired - private SmartValidator validator; - @Autowired - private BankAccountRepository bankAccountRepository; - @Autowired - private BankRepository bankRepository; - - private BindingResult validate(List suppliers, String method, BindingResult errors) { - - try { - switch (method) { - case Constants.ACTION_VIEW: - // validator.validate(supplierContractRequest.getSupplier(), - // errors); - break; - case Constants.ACTION_CREATE: - if (suppliers == null) { - throw new InvalidDataException("suppliers", ErrorCode.NOT_NULL.getCode(), null); - } - for (Supplier supplier : suppliers) { - validator.validate(supplier, errors); - if (!supplierRepository.uniqueCheck("code", supplier)) { - errors.addError(new FieldError("supplier", "name", supplier.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_UPDATE: - if (suppliers == null) { - throw new InvalidDataException("suppliers", ErrorCode.NOT_NULL.getCode(), null); - } - for (Supplier supplier : suppliers) { - if (supplier.getId() == null) { - throw new InvalidDataException("id", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), supplier.getId()); - } - validator.validate(supplier, errors); - if (!supplierRepository.uniqueCheck("name", supplier)) { - errors.addError(new FieldError("supplier", "name", supplier.getName(), false, - new String[] { ErrorCode.NON_UNIQUE_VALUE.getCode() }, null, null)); - } - } - break; - case Constants.ACTION_SEARCH: - if (suppliers == null) { - throw new InvalidDataException("suppliers", ErrorCode.NOT_NULL.getCode(), null); - } - for (Supplier supplier : suppliers) { - if (supplier.getTenantId() == null) { - throw new InvalidDataException("tenantId", ErrorCode.MANDATORY_VALUE_MISSING.getCode(), - supplier.getTenantId()); - } - } - break; - default: - - } - } catch (IllegalArgumentException e) { - errors.addError(new ObjectError("Missing data", e.getMessage())); - } - return errors; - } - - public List fetchRelated(List suppliers) { - for (Supplier supplier : suppliers) { - // fetch related items - supplier.setTenantId(ApplicationThreadLocals.getTenantId().get()); - if (supplier.getBankAccount() != null) { - BankAccount bankAccount = bankAccountRepository.findById(supplier.getBankAccount()); - if (bankAccount == null) { - throw new InvalidDataException("bankAccount", "bankAccount.invalid", " Invalid bankAccount"); - } - supplier.setBankAccount(bankAccount); - } - if (supplier.getBank() != null) { - Bank bank = bankRepository.findById(supplier.getBank()); - if (bank == null) { - throw new InvalidDataException("bank", "bank.invalid", " Invalid bank"); - } - supplier.setBank(bank); - } - - } - - return suppliers; - } - - @Transactional - public List add(List suppliers, BindingResult errors) { - suppliers = fetchRelated(suppliers); - validate(suppliers, Constants.ACTION_CREATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - for(Supplier s:suppliers)s.setId(supplierRepository.getNextSequence()); - return suppliers; - - } - - @Transactional - public List update(List suppliers, BindingResult errors) { - suppliers = fetchRelated(suppliers); - validate(suppliers, Constants.ACTION_UPDATE, errors); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - return suppliers; - - } - - public void addToQue(SupplierRequest request) { - supplierRepository.add(request); - } - - public Pagination search(SupplierSearch supplierSearch, BindingResult errors) { - - try { - - List suppliers = new ArrayList<>(); - suppliers.add(supplierSearch); - validate(suppliers, Constants.ACTION_SEARCH, errors); - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - } catch (CustomBindException e) { - - throw new CustomBindException(errors); - } - - return supplierRepository.search(supplierSearch); - } - - @Transactional - public Supplier save(Supplier supplier) { - return supplierRepository.save(supplier); - } - - @Transactional - public Supplier update(Supplier supplier) { - return supplierRepository.update(supplier); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountCodePurposeEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountCodePurposeEntity.java deleted file mode 100644 index 2545bbbb0f8..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountCodePurposeEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.AccountCodePurpose; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class AccountCodePurposeEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_accountcodepurpose"; - public static final String SEQUENCE_NAME = "seq_egf_accountcodepurpose"; - private String id; - private String name; - - public AccountCodePurpose toDomain() { - AccountCodePurpose accountCodePurpose = new AccountCodePurpose(); - super.toDomain(accountCodePurpose); - accountCodePurpose.setId(this.id); - accountCodePurpose.setName(this.name); - return accountCodePurpose; - } - - public AccountCodePurposeEntity toEntity(AccountCodePurpose accountCodePurpose) { - super.toEntity((Auditable) accountCodePurpose); - this.id = accountCodePurpose.getId(); - this.name = accountCodePurpose.getName(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountCodePurposeSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountCodePurposeSearchEntity.java deleted file mode 100644 index 4ac8680d4da..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountCodePurposeSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.AccountCodePurposeSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountCodePurposeSearchEntity extends AccountCodePurposeEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public AccountCodePurpose toDomain(){ -AccountCodePurpose accountCodePurpose = new AccountCodePurpose (); -super.toDomain( accountCodePurpose);return accountCodePurpose ;} - -public AccountCodePurposeSearchEntity toEntity( AccountCodePurposeSearch accountCodePurposeSearch){ -super.toEntity(( AccountCodePurpose)accountCodePurposeSearch); -this.pageSize=accountCodePurposeSearch.getPageSize(); this.offset=accountCodePurposeSearch.getOffset(); this.sortBy=accountCodePurposeSearch.getSortBy(); this.ids=accountCodePurposeSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailKeyEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailKeyEntity.java deleted file mode 100644 index 07f5e1c9136..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailKeyEntity.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailType; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class AccountDetailKeyEntity extends AuditableEntity -{ - public static final String TABLE_NAME = "egf_accountdetailkey"; - public static final String SEQUENCE_NAME = "seq_egf_accountdetailkey"; - private String id; - private String key; - private String accountDetailTypeId; - - public AccountDetailKey toDomain() { - AccountDetailKey accountDetailKey = new AccountDetailKey(); - super.toDomain(accountDetailKey); - accountDetailKey.setId(this.id); - accountDetailKey.setKey(this.key); - accountDetailKey.setAccountDetailType(AccountDetailType.builder().id(accountDetailTypeId).build()); - return accountDetailKey; - } - - public AccountDetailKeyEntity toEntity(AccountDetailKey accountDetailKey) { - super.toEntity((Auditable) accountDetailKey); - this.id = accountDetailKey.getId(); - this.key = accountDetailKey.getKey(); - this.accountDetailTypeId = accountDetailKey.getAccountDetailType() != null ? accountDetailKey.getAccountDetailType() - .getId() : null; - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailKeySearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailKeySearchEntity.java deleted file mode 100644 index 0e4d0e5cc86..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailKeySearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailKeySearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountDetailKeySearchEntity extends AccountDetailKeyEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public AccountDetailKey toDomain(){ -AccountDetailKey accountDetailKey = new AccountDetailKey (); -super.toDomain( accountDetailKey);return accountDetailKey ;} - -public AccountDetailKeySearchEntity toEntity( AccountDetailKeySearch accountDetailKeySearch){ -super.toEntity(( AccountDetailKey)accountDetailKeySearch); -this.pageSize=accountDetailKeySearch.getPageSize(); this.offset=accountDetailKeySearch.getOffset(); this.sortBy=accountDetailKeySearch.getSortBy(); this.ids=accountDetailKeySearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailTypeEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailTypeEntity.java deleted file mode 100644 index 172ac6edcdc..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailTypeEntity.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.AccountDetailType; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class AccountDetailTypeEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_accountdetailtype"; - public static final String SEQUENCE_NAME = "seq_egf_accountdetailtype"; - private String id; - private String name; - private String description; - private String tablename; - private Boolean active; - private String fullyQualifiedName; - - public AccountDetailType toDomain() { - AccountDetailType accountDetailType = new AccountDetailType(); - super.toDomain(accountDetailType); - accountDetailType.setId(this.id); - accountDetailType.setName(this.name); - accountDetailType.setDescription(this.description); - accountDetailType.setTableName(this.tablename); - accountDetailType.setActive(this.active); - accountDetailType.setFullyQualifiedName(this.fullyQualifiedName); - return accountDetailType; - } - - public AccountDetailTypeEntity toEntity(AccountDetailType accountDetailType) { - super.toEntity((Auditable) accountDetailType); - this.id = accountDetailType.getId(); - this.name = accountDetailType.getName(); - this.description = accountDetailType.getDescription(); - this.tablename = accountDetailType.getTableName(); - this.active = accountDetailType.getActive(); - this.fullyQualifiedName = accountDetailType.getFullyQualifiedName(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailTypeSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailTypeSearchEntity.java deleted file mode 100644 index 82acd897301..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountDetailTypeSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountDetailTypeSearchEntity extends AccountDetailTypeEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public AccountDetailType toDomain(){ -AccountDetailType accountDetailType = new AccountDetailType (); -super.toDomain( accountDetailType);return accountDetailType ;} - -public AccountDetailTypeSearchEntity toEntity( AccountDetailTypeSearch accountDetailTypeSearch){ -super.toEntity(( AccountDetailType)accountDetailTypeSearch); -this.pageSize=accountDetailTypeSearch.getPageSize(); this.offset=accountDetailTypeSearch.getOffset(); this.sortBy=accountDetailTypeSearch.getSortBy(); this.ids=accountDetailTypeSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountEntityEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountEntityEntity.java deleted file mode 100644 index 91e6d347e5b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountEntityEntity.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountEntity; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class AccountEntityEntity extends AuditableEntity -{ - public static final String TABLE_NAME = "egf_accountentity"; - public static final String SEQUENCE_NAME = "seq_egf_accountentitymaster"; - private String id; - private String accountDetailTypeId; - private String code; - private String name; - private Boolean active; - private String description; - - public AccountEntity toDomain() { - AccountEntity accountEntity = new AccountEntity(); - super.toDomain(accountEntity); - accountEntity.setId(this.id); - accountEntity.setAccountDetailType(AccountDetailType.builder().id(accountDetailTypeId).build()); - accountEntity.setCode(this.code); - accountEntity.setName(this.name); - accountEntity.setActive(this.active); - accountEntity.setDescription(this.description); - return accountEntity; - } - - public AccountEntityEntity toEntity(AccountEntity accountEntity) { - super.toEntity((Auditable) accountEntity); - this.id = accountEntity.getId(); - this.accountDetailTypeId = accountEntity.getAccountDetailType() != null ? accountEntity.getAccountDetailType().getId() - : null; - this.code = accountEntity.getCode(); - this.name = accountEntity.getName(); - this.active = accountEntity.getActive(); - this.description = accountEntity.getDescription(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountEntitySearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountEntitySearchEntity.java deleted file mode 100644 index 531193758a9..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/AccountEntitySearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.domain.model.AccountEntitySearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountEntitySearchEntity extends AccountEntityEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public AccountEntity toDomain(){ -AccountEntity accountEntity = new AccountEntity (); -super.toDomain( accountEntity);return accountEntity ;} - -public AccountEntitySearchEntity toEntity( AccountEntitySearch accountEntitySearch){ -super.toEntity(( AccountEntity)accountEntitySearch); -this.pageSize=accountEntitySearch.getPageSize(); this.offset=accountEntitySearch.getOffset(); this.sortBy=accountEntitySearch.getSortBy(); this.ids=accountEntitySearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankAccountEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankAccountEntity.java deleted file mode 100644 index 99141a74721..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankAccountEntity.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.enums.BankAccountType; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.Fund; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class BankAccountEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_bankaccount"; - public static final String SEQUENCE_NAME = "seq_egf_bankaccount"; - private String id; - private String bankBranchId; - private String chartOfAccountId; - private String fundId; - private String accountNumber; - private String accountType; - private String description; - private Boolean active; - private String payTo; - private String type; - - public BankAccount toDomain() { - BankAccount bankAccount = new BankAccount(); - super.toDomain(bankAccount); - bankAccount.setId(this.id); - bankAccount.setBankBranch(BankBranch.builder().id(bankBranchId).build()); - bankAccount.setChartOfAccount(ChartOfAccount.builder().id(chartOfAccountId).build()); - bankAccount.setFund(Fund.builder().id(fundId).build()); - bankAccount.setAccountNumber(this.accountNumber); - bankAccount.setAccountType(this.accountType); - bankAccount.setDescription(this.description); - bankAccount.setActive(this.active); - bankAccount.setPayTo(this.payTo); - bankAccount.setType(BankAccountType.valueOf(this.type)); - return bankAccount; - } - - public BankAccountEntity toEntity(BankAccount bankAccount) { - super.toEntity((Auditable) bankAccount); - this.id = bankAccount.getId(); - this.bankBranchId = bankAccount.getBankBranch() != null ? bankAccount.getBankBranch().getId() : null; - this.chartOfAccountId = bankAccount.getChartOfAccount() != null ? bankAccount.getChartOfAccount().getId() - : null; - this.fundId = bankAccount.getFund() != null ? bankAccount.getFund().getId() : null; - this.accountNumber = bankAccount.getAccountNumber(); - this.accountType = bankAccount.getAccountType(); - this.description = bankAccount.getDescription(); - this.active = bankAccount.getActive(); - this.payTo = bankAccount.getPayTo(); - this.type = bankAccount.getType() != null ? bankAccount.getType().toString() : null; - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankAccountSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankAccountSearchEntity.java deleted file mode 100644 index 6c1c4cbffff..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankAccountSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankAccountSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BankAccountSearchEntity extends BankAccountEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public BankAccount toDomain(){ -BankAccount bankAccount = new BankAccount (); -super.toDomain( bankAccount);return bankAccount ;} - -public BankAccountSearchEntity toEntity( BankAccountSearch bankAccountSearch){ -super.toEntity(( BankAccount)bankAccountSearch); -this.pageSize=bankAccountSearch.getPageSize(); this.offset=bankAccountSearch.getOffset(); this.sortBy=bankAccountSearch.getSortBy(); this.ids=bankAccountSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankBranchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankBranchEntity.java deleted file mode 100644 index 741f7d59dd1..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankBranchEntity.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankBranch; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class BankBranchEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_bankbranch"; - public static final String SEQUENCE_NAME = "seq_egf_bankbranch"; - private String id; - private String bankId; - private String code; - private String name; - private String address; - private String address2; - private String city; - private String state; - private String pincode; - private String phone; - private String fax; - private String contactPerson; - private Boolean active; - private String description; - private String micr; - - public BankBranch toDomain() { - BankBranch bankBranch = new BankBranch(); - super.toDomain(bankBranch); - bankBranch.setId(this.id); - bankBranch.setBank(Bank.builder().id(bankId).build()); - bankBranch.setCode(this.code); - bankBranch.setName(this.name); - bankBranch.setAddress(this.address); - bankBranch.setAddress2(this.address2); - bankBranch.setCity(this.city); - bankBranch.setState(this.state); - bankBranch.setPincode(this.pincode); - bankBranch.setPhone(this.phone); - bankBranch.setFax(this.fax); - bankBranch.setContactPerson(this.contactPerson); - bankBranch.setActive(this.active); - bankBranch.setDescription(this.description); - bankBranch.setMicr(this.micr); - return bankBranch; - } - - public BankBranchEntity toEntity(BankBranch bankBranch) { - super.toEntity((Auditable) bankBranch); - this.id = bankBranch.getId(); - this.bankId = bankBranch.getBank() != null ? bankBranch.getBank().getId() : null; - this.code = bankBranch.getCode(); - this.name = bankBranch.getName(); - this.address = bankBranch.getAddress(); - this.address2 = bankBranch.getAddress2(); - this.city = bankBranch.getCity(); - this.state = bankBranch.getState(); - this.pincode = bankBranch.getPincode(); - this.phone = bankBranch.getPhone(); - this.fax = bankBranch.getFax(); - this.contactPerson = bankBranch.getContactPerson(); - this.active = bankBranch.getActive(); - this.description = bankBranch.getDescription(); - this.micr = bankBranch.getMicr(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankBranchSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankBranchSearchEntity.java deleted file mode 100644 index e18125a2852..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankBranchSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.BankBranchSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BankBranchSearchEntity extends BankBranchEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public BankBranch toDomain(){ -BankBranch bankBranch = new BankBranch (); -super.toDomain( bankBranch);return bankBranch ;} - -public BankBranchSearchEntity toEntity( BankBranchSearch bankBranchSearch){ -super.toEntity(( BankBranch)bankBranchSearch); -this.pageSize=bankBranchSearch.getPageSize(); this.offset=bankBranchSearch.getOffset(); this.sortBy=bankBranchSearch.getSortBy(); this.ids=bankBranchSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankEntity.java deleted file mode 100644 index b66940f2c48..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankEntity.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.Bank; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class BankEntity extends AuditableEntity -{ - public static final String TABLE_NAME = "egf_bank"; - public static final String SEQUENCE_NAME = "seq_egf_bank"; - private String id; - private String code; - private String name; - private String description; - private Boolean active; - private String type; - - public Bank toDomain() { - Bank bank = new Bank(); - super.toDomain(bank); - bank.setId(this.id); - bank.setCode(this.code); - bank.setName(this.name); - bank.setDescription(this.description); - bank.setActive(this.active); - bank.setType(this.type); - return bank; - } - - public BankEntity toEntity(Bank bank) { - super.toEntity((Auditable) bank); - this.id = bank.getId(); - this.code = bank.getCode(); - this.name = bank.getName(); - this.description = bank.getDescription(); - this.active = bank.getActive(); - this.type = bank.getType(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankSearchEntity.java deleted file mode 100644 index 51c3f27a1af..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BankSearchEntity.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankSearch; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BankSearchEntity extends BankEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - - public Bank toDomain() { - Bank bank = new Bank(); - super.toDomain(bank); - return bank; - } - - public BankSearchEntity toEntity(BankSearch bankSearch) { - super.toEntity((Bank) bankSearch); - this.pageSize = bankSearch.getPageSize(); - this.offset = bankSearch.getOffset(); - this.sortBy = bankSearch.getSortBy(); - this.ids = bankSearch.getIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BudgetGroupEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BudgetGroupEntity.java deleted file mode 100644 index 3cd7c297cc7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BudgetGroupEntity.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.enums.BudgetAccountType; -import org.egov.egf.master.domain.enums.BudgetingType; -import org.egov.egf.master.domain.model.BudgetGroup; -import org.egov.egf.master.domain.model.ChartOfAccount; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class BudgetGroupEntity extends AuditableEntity -{ - public static final String TABLE_NAME = "egf_budgetgroup"; - public static final String SEQUENCE_NAME = "seq_egf_budgetgroup"; - private String id; - private String name; - private String description; - private String majorCodeId; - private String maxCodeId; - private String minCodeId; - private String accountType; - private String budgetingType; - private Boolean active; - - public BudgetGroup toDomain() { - BudgetGroup budgetGroup = new BudgetGroup(); - super.toDomain(budgetGroup); - budgetGroup.setId(this.id); - budgetGroup.setName(this.name); - budgetGroup.setDescription(this.description); - budgetGroup.setMajorCode(ChartOfAccount.builder().id(majorCodeId).build()); - budgetGroup.setMaxCode(ChartOfAccount.builder().id(maxCodeId).build()); - budgetGroup.setMinCode(ChartOfAccount.builder().id(minCodeId).build()); - budgetGroup.setAccountType(BudgetAccountType.valueOf(this.accountType)); - budgetGroup.setBudgetingType(BudgetingType.valueOf(this.budgetingType)); - budgetGroup.setActive(this.active); - return budgetGroup; - } - - public BudgetGroupEntity toEntity(BudgetGroup budgetGroup) { - super.toEntity((Auditable) budgetGroup); - this.id = budgetGroup.getId(); - this.name = budgetGroup.getName(); - this.description = budgetGroup.getDescription(); - this.majorCodeId = budgetGroup.getMajorCode() != null ? budgetGroup.getMajorCode().getId() : null; - this.maxCodeId = budgetGroup.getMaxCode() != null ? budgetGroup.getMaxCode().getId() : null; - this.minCodeId = budgetGroup.getMinCode() != null ? budgetGroup.getMinCode().getId() : null; - this.accountType = budgetGroup.getAccountType() != null ? budgetGroup.getAccountType().toString() : null; - this.budgetingType = budgetGroup.getBudgetingType() != null ? budgetGroup.getBudgetingType().toString() : null; - this.active = budgetGroup.getActive(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BudgetGroupSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BudgetGroupSearchEntity.java deleted file mode 100644 index 98a9f362e67..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/BudgetGroupSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.BudgetGroup; -import org.egov.egf.master.domain.model.BudgetGroupSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BudgetGroupSearchEntity extends BudgetGroupEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public BudgetGroup toDomain(){ -BudgetGroup budgetGroup = new BudgetGroup (); -super.toDomain( budgetGroup);return budgetGroup ;} - -public BudgetGroupSearchEntity toEntity( BudgetGroupSearch budgetGroupSearch){ -super.toEntity(( BudgetGroup)budgetGroupSearch); -this.pageSize=budgetGroupSearch.getPageSize(); this.offset=budgetGroupSearch.getOffset(); this.sortBy=budgetGroupSearch.getSortBy(); this.ids=budgetGroupSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountDetailEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountDetailEntity.java deleted file mode 100644 index a43eb815af8..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountDetailEntity.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class ChartOfAccountDetailEntity extends AuditableEntity -{ - public static final String TABLE_NAME = "egf_chartofaccountdetail"; - public static final String SEQUENCE_NAME = "seq_egf_chartofaccountdetail"; - private String id; - private String chartOfAccountId; - private String accountDetailTypeId; - - public ChartOfAccountDetail toDomain() { - ChartOfAccountDetail chartOfAccountDetail = new ChartOfAccountDetail(); - super.toDomain(chartOfAccountDetail); - chartOfAccountDetail.setId(this.id); - chartOfAccountDetail.setChartOfAccount(ChartOfAccount.builder().id(chartOfAccountId).build()); - chartOfAccountDetail.setAccountDetailType(AccountDetailType.builder().id(accountDetailTypeId).build()); - return chartOfAccountDetail; - } - - public ChartOfAccountDetailEntity toEntity(ChartOfAccountDetail chartOfAccountDetail) { - super.toEntity((Auditable) chartOfAccountDetail); - this.id = chartOfAccountDetail.getId(); - this.chartOfAccountId = chartOfAccountDetail.getChartOfAccount() != null ? chartOfAccountDetail.getChartOfAccount() - .getId() : null; - this.accountDetailTypeId = chartOfAccountDetail.getAccountDetailType() != null ? chartOfAccountDetail - .getAccountDetailType().getId() : null; - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountDetailSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountDetailSearchEntity.java deleted file mode 100644 index 2a12d55f163..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountDetailSearchEntity.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class ChartOfAccountDetailSearchEntity extends ChartOfAccountDetailEntity { - private String ids; - private String chartOfAccountIds; - private String sortBy; - private Integer pageSize; - private Integer offset; - - public ChartOfAccountDetail toDomain() { - ChartOfAccountDetail chartOfAccountDetail = new ChartOfAccountDetail(); - super.toDomain(chartOfAccountDetail); - return chartOfAccountDetail; - } - - public ChartOfAccountDetailSearchEntity toEntity(ChartOfAccountDetailSearch chartOfAccountDetailSearch) { - super.toEntity((ChartOfAccountDetail) chartOfAccountDetailSearch); - this.pageSize = chartOfAccountDetailSearch.getPageSize(); - this.offset = chartOfAccountDetailSearch.getOffset(); - this.sortBy = chartOfAccountDetailSearch.getSortBy(); - this.ids = chartOfAccountDetailSearch.getIds(); - this.chartOfAccountIds = chartOfAccountDetailSearch.getChartOfAccountIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountEntity.java deleted file mode 100644 index bcbf5173c1c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountEntity.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.ChartOfAccount; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class ChartOfAccountEntity extends AuditableEntity -{ - public static final String TABLE_NAME = "egf_chartofaccount"; - public static final String SEQUENCE_NAME = "seq_egf_chartofaccount"; - private String id; - private String glcode; - private String name; - private String accountCodePurposeId; - private String description; - private Boolean isActiveForPosting; - private String parentId; - private Character type; - private Long classification; - private Boolean functionRequired; - private Boolean budgetCheckRequired; - private String majorCode; - private Boolean isSubLedger; - - public ChartOfAccount toDomain() { - ChartOfAccount chartOfAccount = new ChartOfAccount(); - super.toDomain(chartOfAccount); - chartOfAccount.setId(this.id); - chartOfAccount.setGlcode(this.glcode); - chartOfAccount.setName(this.name); - chartOfAccount.setAccountCodePurpose(AccountCodePurpose.builder().id(accountCodePurposeId).build()); - chartOfAccount.setDescription(this.description); - chartOfAccount.setIsActiveForPosting(this.isActiveForPosting); - chartOfAccount.setParentId(ChartOfAccount.builder().id(parentId).build()); - chartOfAccount.setType(this.type); - chartOfAccount.setClassification(this.classification); - chartOfAccount.setFunctionRequired(this.functionRequired); - chartOfAccount.setBudgetCheckRequired(this.budgetCheckRequired); - chartOfAccount.setMajorCode(this.majorCode); - chartOfAccount.setIsSubLedger(this.isSubLedger); - return chartOfAccount; - } - - public ChartOfAccountEntity toEntity(ChartOfAccount chartOfAccount) { - super.toEntity((Auditable) chartOfAccount); - this.id = chartOfAccount.getId(); - this.glcode = chartOfAccount.getGlcode(); - this.name = chartOfAccount.getName(); - this.accountCodePurposeId = chartOfAccount.getAccountCodePurpose() != null ? chartOfAccount.getAccountCodePurpose() - .getId() : null; - this.description = chartOfAccount.getDescription(); - this.isActiveForPosting = chartOfAccount.getIsActiveForPosting(); - this.parentId = chartOfAccount.getParentId() != null ? chartOfAccount.getParentId().getId() : null; - this.type = chartOfAccount.getType(); - this.classification = chartOfAccount.getClassification(); - this.functionRequired = chartOfAccount.getFunctionRequired(); - this.budgetCheckRequired = chartOfAccount.getBudgetCheckRequired(); - this.majorCode = chartOfAccount.getMajorCode(); - this.isSubLedger = chartOfAccount.getIsSubLedger(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountSearchEntity.java deleted file mode 100644 index 5330fd3734f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/ChartOfAccountSearchEntity.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class ChartOfAccountSearchEntity extends ChartOfAccountEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private String glcodes; - - public ChartOfAccount toDomain() { - ChartOfAccount chartOfAccount = new ChartOfAccount(); - super.toDomain(chartOfAccount); - return chartOfAccount; - } - - public ChartOfAccountSearchEntity toEntity(ChartOfAccountSearch chartOfAccountSearch) { - super.toEntity((ChartOfAccount) chartOfAccountSearch); - this.pageSize = chartOfAccountSearch.getPageSize(); - this.offset = chartOfAccountSearch.getOffset(); - this.sortBy = chartOfAccountSearch.getSortBy(); - this.ids = chartOfAccountSearch.getIds(); - this.glcodes = chartOfAccountSearch.getGlcodes(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationEntity.java deleted file mode 100644 index 0deee9d7dac..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationEntity.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.FinancialConfiguration; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class FinancialConfigurationEntity extends AuditableEntity { - - public static final String TABLE_NAME = "egf_financialconfiguration"; - private String id; - private String name; - private String description; - private String module; - - public FinancialConfiguration toDomain() { - FinancialConfiguration financialConfiguration = new FinancialConfiguration(); - super.toDomain(financialConfiguration); - financialConfiguration.setId(this.id); - financialConfiguration.setName(this.name); - financialConfiguration.setDescription(this.description); - financialConfiguration.setModule(this.module); - return financialConfiguration; - } - - public FinancialConfigurationEntity toEntity(FinancialConfiguration financialConfiguration) { - super.toEntity((Auditable) financialConfiguration); - this.id = financialConfiguration.getId(); - this.name = financialConfiguration.getName(); - this.description = financialConfiguration.getDescription(); - this.module = financialConfiguration.getModule(); - return this; - } - -} - diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationSearchEntity.java deleted file mode 100644 index aff779c6598..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.FinancialConfiguration; -import org.egov.egf.master.domain.model.FinancialConfigurationSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialConfigurationSearchEntity extends FinancialConfigurationEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public FinancialConfiguration toDomain(){ -FinancialConfiguration financialConfiguration = new FinancialConfiguration (); -super.toDomain( financialConfiguration);return financialConfiguration ;} - -public FinancialConfigurationSearchEntity toEntity( FinancialConfigurationSearch financialConfigurationSearch){ -super.toEntity(( FinancialConfiguration)financialConfigurationSearch); -this.pageSize=financialConfigurationSearch.getPageSize(); this.offset=financialConfigurationSearch.getOffset(); this.sortBy=financialConfigurationSearch.getSortBy(); this.ids=financialConfigurationSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationValueEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationValueEntity.java deleted file mode 100644 index f829997942b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationValueEntity.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import java.util.Date; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.FinancialConfiguration; -import org.egov.egf.master.domain.model.FinancialConfigurationValue; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class FinancialConfigurationValueEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_financialconfigurationvalues"; - private String id; - private String financialConfigurationId; - private String value; - private Date effectiveFrom; - - public FinancialConfigurationValue toDomain() { - FinancialConfigurationValue financialConfigurationValue = new FinancialConfigurationValue(); - super.toDomain(financialConfigurationValue); - financialConfigurationValue.setId(this.id); - financialConfigurationValue - .setFinancialConfiguration(FinancialConfiguration.builder().id(financialConfigurationId).build()); - financialConfigurationValue.setValue(this.value); - financialConfigurationValue.setEffectiveFrom(this.effectiveFrom); - return financialConfigurationValue; - } - - public FinancialConfigurationValueEntity toEntity(FinancialConfigurationValue financialConfigurationValue) { - super.toEntity((Auditable) financialConfigurationValue); - this.id = financialConfigurationValue.getId(); - this.financialConfigurationId = financialConfigurationValue.getFinancialConfiguration() != null - ? financialConfigurationValue.getFinancialConfiguration().getId() : null; - this.value = financialConfigurationValue.getValue(); - this.effectiveFrom = financialConfigurationValue.getEffectiveFrom(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationValueSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationValueSearchEntity.java deleted file mode 100644 index 7e8f7ff01e5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialConfigurationValueSearchEntity.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.egf.master.domain.model.FinancialConfigurationValue; -import org.egov.egf.master.domain.model.FinancialConfigurationValueSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialConfigurationValueSearchEntity extends FinancialConfigurationValueEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - - public FinancialConfigurationValue toDomain() { - FinancialConfigurationValue financialConfigurationValue = new FinancialConfigurationValue(); - super.toDomain(financialConfigurationValue); - return financialConfigurationValue; - } - - public FinancialConfigurationValueSearchEntity toEntity(FinancialConfigurationValueSearch financialConfigurationValueSearch) { - super.toEntity((FinancialConfigurationValue) financialConfigurationValueSearch); - this.pageSize = financialConfigurationValueSearch.getPageSize(); - this.offset = financialConfigurationValueSearch.getOffset(); - this.sortBy = financialConfigurationValueSearch.getSortBy(); - this.ids = financialConfigurationValueSearch.getIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialStatusEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialStatusEntity.java deleted file mode 100644 index 7f687e5f01e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialStatusEntity.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.FinancialStatus; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class FinancialStatusEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_financialstatus"; - private String id; - private String moduleType; - private String code; - private String name; - private String description; - - public FinancialStatus toDomain() { - FinancialStatus financialStatus = new FinancialStatus(); - super.toDomain(financialStatus); - financialStatus.setId(this.id); - financialStatus.setModuleType(this.moduleType); - financialStatus.setCode(this.code); - financialStatus.setName(this.name); - financialStatus.setDescription(this.description); - return financialStatus; - } - - public FinancialStatusEntity toEntity(FinancialStatus financialStatus) { - super.toEntity((Auditable) financialStatus); - this.id = financialStatus.getId(); - this.moduleType = financialStatus.getModuleType(); - this.code = financialStatus.getCode(); - this.name = financialStatus.getName(); - this.description = financialStatus.getDescription(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialStatusSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialStatusSearchEntity.java deleted file mode 100644 index 785a69d7547..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialStatusSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.FinancialStatus; -import org.egov.egf.master.domain.model.FinancialStatusSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialStatusSearchEntity extends FinancialStatusEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public FinancialStatus toDomain(){ -FinancialStatus financialStatus = new FinancialStatus (); -super.toDomain( financialStatus);return financialStatus ;} - -public FinancialStatusSearchEntity toEntity( FinancialStatusSearch financialStatusSearch){ -super.toEntity(( FinancialStatus)financialStatusSearch); -this.pageSize=financialStatusSearch.getPageSize(); this.offset=financialStatusSearch.getOffset(); this.sortBy=financialStatusSearch.getSortBy(); this.ids=financialStatusSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialYearEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialYearEntity.java deleted file mode 100644 index 490540340fc..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialYearEntity.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import java.util.Date; - -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.FinancialYear; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class FinancialYearEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_financialyear"; - public static final String SEQUENCE_NAME = "seq_egf_financialyear"; - private String id; - private String finYearRange; - private Date startingDate; - private Date endingDate; - private Boolean active; - private Boolean isActiveForPosting; - private Boolean isClosed; - private Boolean transferClosingBalance; - - public FinancialYear toDomain() { - FinancialYear financialYear = new FinancialYear(); - super.toDomain(financialYear); - financialYear.setId(this.id); - financialYear.setFinYearRange(this.finYearRange); - financialYear.setStartingDate(this.startingDate); - financialYear.setEndingDate(this.endingDate); - financialYear.setActive(this.active); - financialYear.setIsActiveForPosting(this.isActiveForPosting); - financialYear.setIsClosed(this.isClosed); - financialYear.setTransferClosingBalance(this.transferClosingBalance); - return financialYear; - } - - public FinancialYearEntity toEntity(FinancialYear financialYear) { - super.toEntity(financialYear); - this.id = financialYear.getId(); - this.finYearRange = financialYear.getFinYearRange(); - this.startingDate = financialYear.getStartingDate(); - this.endingDate = financialYear.getEndingDate(); - this.active = financialYear.getActive(); - this.isActiveForPosting = financialYear.getIsActiveForPosting(); - this.isClosed = financialYear.getIsClosed(); - this.transferClosingBalance = financialYear.getTransferClosingBalance(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialYearSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialYearSearchEntity.java deleted file mode 100644 index 4ef5e2419c7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FinancialYearSearchEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import java.util.Date; - -import org.egov.egf.master.domain.model.FinancialYear; -import org.egov.egf.master.domain.model.FinancialYearSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialYearSearchEntity extends FinancialYearEntity { - private Integer pageSize; - private Integer offset; - private String sortBy; - private Date asOnDate; - - @Override - public FinancialYear toDomain() { - FinancialYear financialYear = new FinancialYear(); - super.toDomain(financialYear); - return financialYear; - } - - public FinancialYearSearchEntity toEntity(FinancialYearSearch financialYearSearch) { - super.toEntity(financialYearSearch); - this.pageSize = financialYearSearch.getPageSize(); - this.offset = financialYearSearch.getOffset(); - this.sortBy = financialYearSearch.getSortBy(); - this.asOnDate = financialYearSearch.getAsOnDate(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FiscalPeriodEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FiscalPeriodEntity.java deleted file mode 100644 index f47a91022ec..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FiscalPeriodEntity.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import java.util.Date; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.FinancialYear; -import org.egov.egf.master.domain.model.FiscalPeriod; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class FiscalPeriodEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_fiscalperiod"; - public static final String SEQUENCE_NAME = "seq_egf_fiscalperiod"; - private String id; - private String name; - private String financialYearId; - private Date startingDate; - private Date endingDate; - private Boolean active; - private Boolean isActiveForPosting; - private Boolean isClosed; - - public FiscalPeriod toDomain() { - FiscalPeriod fiscalPeriod = new FiscalPeriod(); - super.toDomain(fiscalPeriod); - fiscalPeriod.setId(this.id); - fiscalPeriod.setName(this.name); - fiscalPeriod.setFinancialYear(FinancialYear.builder().id(financialYearId).build()); - fiscalPeriod.setStartingDate(this.startingDate); - fiscalPeriod.setEndingDate(this.endingDate); - fiscalPeriod.setActive(this.active); - fiscalPeriod.setIsActiveForPosting(this.isActiveForPosting); - fiscalPeriod.setIsClosed(this.isClosed); - return fiscalPeriod; - } - - public FiscalPeriodEntity toEntity(FiscalPeriod fiscalPeriod) { - super.toEntity((Auditable) fiscalPeriod); - this.id = fiscalPeriod.getId(); - this.name = fiscalPeriod.getName(); - this.financialYearId = fiscalPeriod.getFinancialYear() != null ? fiscalPeriod.getFinancialYear().getId() : null; - this.startingDate = fiscalPeriod.getStartingDate(); - this.endingDate = fiscalPeriod.getEndingDate(); - this.active = fiscalPeriod.getActive(); - this.isActiveForPosting = fiscalPeriod.getIsActiveForPosting(); - this.isClosed = fiscalPeriod.getIsClosed(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FiscalPeriodSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FiscalPeriodSearchEntity.java deleted file mode 100644 index b8715eb04eb..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FiscalPeriodSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.FiscalPeriod; -import org.egov.egf.master.domain.model.FiscalPeriodSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FiscalPeriodSearchEntity extends FiscalPeriodEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public FiscalPeriod toDomain(){ -FiscalPeriod fiscalPeriod = new FiscalPeriod (); -super.toDomain( fiscalPeriod);return fiscalPeriod ;} - -public FiscalPeriodSearchEntity toEntity( FiscalPeriodSearch fiscalPeriodSearch){ -super.toEntity(( FiscalPeriod)fiscalPeriodSearch); -this.pageSize=fiscalPeriodSearch.getPageSize(); this.offset=fiscalPeriodSearch.getOffset(); this.sortBy=fiscalPeriodSearch.getSortBy(); this.ids=fiscalPeriodSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionEntity.java deleted file mode 100644 index 7bf1460e9f9..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionEntity.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.Function; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class FunctionEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_function"; - public static final String SEQUENCE_NAME = "seq_egf_function"; - private String id; - private String name; - private String code; - private Integer level; - private Boolean active; - private String parentId; - - public Function toDomain() { - Function function = new Function(); - super.toDomain(function); - function.setId(this.id); - function.setName(this.name); - function.setCode(this.code); - function.setLevel(this.level); - function.setActive(this.active); - function.setParentId(Function.builder().id(parentId).build()); - return function; - } - - public FunctionEntity toEntity(Function function) { - super.toEntity((Auditable) function); - this.id = function.getId(); - this.name = function.getName(); - this.code = function.getCode(); - this.level = function.getLevel(); - this.active = function.getActive(); - this.parentId = function.getParentId() != null ? function.getParentId().getId() : null; - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionSearchEntity.java deleted file mode 100644 index eb9a6c7fe35..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionSearchEntity.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.domain.model.FunctionSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FunctionSearchEntity extends FunctionEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - - public Function toDomain() { - Function function = new Function(); - super.toDomain(function); - return function; - } - - public FunctionSearchEntity toEntity(FunctionSearch functionSearch) { - super.toEntity((Function) functionSearch); - this.pageSize = functionSearch.getPageSize(); - this.offset = functionSearch.getOffset(); - this.sortBy = functionSearch.getSortBy(); - this.ids = functionSearch.getIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionaryEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionaryEntity.java deleted file mode 100644 index 4989fcc6b28..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionaryEntity.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.Functionary; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class FunctionaryEntity extends AuditableEntity -{ - public static final String TABLE_NAME = "egf_functionary"; - public static final String SEQUENCE_NAME = "seq_egf_functionary"; - private String id; - private String code; - private String name; - private Boolean active; - - public Functionary toDomain() { - Functionary functionary = new Functionary(); - super.toDomain(functionary); - functionary.setId(this.id); - functionary.setCode(this.code); - functionary.setName(this.name); - functionary.setActive(this.active); - return functionary; - } - - public FunctionaryEntity toEntity(Functionary functionary) { - super.toEntity((Auditable) functionary); - this.id = functionary.getId(); - this.code = functionary.getCode(); - this.name = functionary.getName(); - this.active = functionary.getActive(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionarySearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionarySearchEntity.java deleted file mode 100644 index ee5f3f29dba..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FunctionarySearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.Functionary; -import org.egov.egf.master.domain.model.FunctionarySearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FunctionarySearchEntity extends FunctionaryEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public Functionary toDomain(){ -Functionary functionary = new Functionary (); -super.toDomain( functionary);return functionary ;} - -public FunctionarySearchEntity toEntity( FunctionarySearch functionarySearch){ -super.toEntity(( Functionary)functionarySearch); -this.pageSize=functionarySearch.getPageSize(); this.offset=functionarySearch.getOffset(); this.sortBy=functionarySearch.getSortBy(); this.ids=functionarySearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundEntity.java deleted file mode 100644 index 6e353465d3d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundEntity.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.persistence.entity; - -import javax.validation.constraints.NotNull; - -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.Fund; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@AllArgsConstructor -@NoArgsConstructor -@Builder -@Getter -@Setter -public class FundEntity extends AuditableEntity { - - public static final String TABLE_NAME = "egf_fund"; - public static final String SEQUENCE_NAME = "seq_egf_fund"; - public static final String ALIAS = "fund"; - - private static final long serialVersionUID = 7977534010758407945L; - - protected String id; - - @Length(max = 50, min = 2) - @NotNull - protected String name; - - @Length(max = 50, min = 2) - @NotNull - protected String code; - @NotNull - protected Character identifier; - - @NotNull - protected Long level; - - @NotNull - protected Boolean active; - - protected String parentId; - - public Fund toDomain() { - - Fund fund = new Fund(); - Fund parent = null; - if (parentId != null) { - parent = Fund.builder().id(parentId).build(); - } - super.toDomain(fund); - fund.setId(this.id); - fund.setCode(this.code); - fund.setName(this.name); - fund.setIdentifier(this.identifier); - fund.setActive(this.active); - fund.setParent(parent); - fund.setLevel(this.level); - return fund; - - } - - public FundEntity toEntity(Fund fund) { - - super.toEntity(fund); - this.id = fund.getId(); - this.name = fund.getName(); - this.code = fund.getCode(); - this.identifier = fund.getIdentifier(); - this.level = 1l; - this.parentId = fund.getParent() != null ? fund.getParent().getId() : null; - this.active = fund.getActive(); - this.level = fund.getLevel(); - return this; - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundSearchEntity.java deleted file mode 100644 index 8381cdbec44..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import java.util.Date; - -import org.egov.egf.master.domain.model.FundSearch; - -import lombok.Data; - -@Data -public class FundSearchEntity extends FundEntity { - private Date fromDate; - private Date toDate; - private Integer pageSize; - private Integer offset = 0; - private String sortBy; - - public FundSearchEntity toEntity(FundSearch fundSearch) { - - super.toEntity(fundSearch); - this.pageSize = fundSearch.getPageSize(); - this.sortBy = fundSearch.getSortBy(); - return this; - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundsourceEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundsourceEntity.java deleted file mode 100644 index 68cb6605d9d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundsourceEntity.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import java.math.BigDecimal; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.Fundsource; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class FundsourceEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_fundsource"; - public static final String SEQUENCE_NAME = "seq_egf_fundsource"; - private String id; - private String code; - private String name; - private String type; - private String parentId; - private BigDecimal llevel; - private Boolean active; - private Boolean isParent; - - public Fundsource toDomain() { - Fundsource fundsource = new Fundsource(); - Fundsource parent = null; - - super.toDomain(fundsource); - if (parentId != null) { - parent = Fundsource.builder().id(parentId).build(); - } - fundsource.setId(this.id); - fundsource.setCode(this.code); - fundsource.setName(this.name); - fundsource.setType(this.type); - fundsource.setParent(parent); - fundsource.setLlevel(this.llevel); - fundsource.setActive(this.active); - fundsource.setIsParent(this.isParent); - return fundsource; - } - - public FundsourceEntity toEntity(Fundsource fundsource) { - super.toEntity((Auditable) fundsource); - this.id = fundsource.getId(); - this.code = fundsource.getCode(); - this.name = fundsource.getName(); - this.type = fundsource.getType(); - this.parentId = fundsource.getParent() != null ? fundsource.getParent().getId() : null; - this.llevel = fundsource.getLlevel(); - this.active = fundsource.getActive(); - this.isParent = fundsource.getIsParent(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundsourceSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundsourceSearchEntity.java deleted file mode 100644 index fc27b1bcd2a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/FundsourceSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.Fundsource; -import org.egov.egf.master.domain.model.FundsourceSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FundsourceSearchEntity extends FundsourceEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public Fundsource toDomain(){ -Fundsource fundsource = new Fundsource (); -super.toDomain( fundsource);return fundsource ;} - -public FundsourceSearchEntity toEntity( FundsourceSearch fundsourceSearch){ -super.toEntity(( Fundsource)fundsourceSearch); -this.pageSize=fundsourceSearch.getPageSize(); this.offset=fundsourceSearch.getOffset(); this.sortBy=fundsourceSearch.getSortBy(); this.ids=fundsourceSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/RecoveryEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/RecoveryEntity.java deleted file mode 100644 index 893cdbda46c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/RecoveryEntity.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.persistence.entity; - -import lombok.*; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.Recovery; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotNull; - -@AllArgsConstructor -@NoArgsConstructor -@Builder -@Getter -@Setter -public class RecoveryEntity extends AuditableEntity { - - public static final String TABLE_NAME = "egf_recovery"; - public static final String SEQUENCE_NAME = "seq_egf_recovery"; - public static final String ALIAS = "recovery"; - - private static final long serialVersionUID = 7977534010758407945L; - - protected String id; - - @Length(max = 50, min = 2) - @NotNull - protected String name; - - @Length(max = 50, min = 2) - @NotNull - protected String code; - - @NotNull - protected String chartOfAccountId; - - protected String type; - - protected Double flat; - - protected Double percentage; - - @NotNull - protected Boolean active; - - @Length(max = 100) - protected String remitted; - - @Length(max = 16) - protected String ifscCode; - - protected Character mode; - - protected Character remittanceMode; - - @Length(max = 32) - protected String accountNumber; - - - public Recovery toDomain() { - - Recovery recovery = new Recovery(); - recovery.setId(this.id); - recovery.setCode(this.code); - recovery.setName(this.name); - recovery.setAccountNumber(this.accountNumber); - recovery.setActive(this.active); - recovery.setChartOfAccount(ChartOfAccount.builder().glcode(this.chartOfAccountId).build()); - recovery.setFlat(this.flat); - recovery.setIfscCode(this.ifscCode); - recovery.setMode(this.mode); - recovery.setPercentage(this.percentage); - recovery.setRemittanceMode(this.remittanceMode); - recovery.setType(this.type); - recovery.setRemitted(this.remitted); - return recovery; - } - - public RecoveryEntity toEntity(Recovery recovery) { - - super.toEntity(recovery); - this.id = recovery.getId(); - this.code = recovery.getCode(); - this.name = recovery.getName(); - this.accountNumber = recovery.getAccountNumber(); - this.active = recovery.getActive(); - if(recovery.getChartOfAccount() != null && recovery.getChartOfAccount().getGlcode() != null) - this.chartOfAccountId = recovery.getChartOfAccount().getGlcode(); - this.flat = recovery.getFlat(); - this.ifscCode = recovery.getIfscCode(); - this.mode = recovery.getMode(); - this.percentage = recovery.getPercentage(); - this.remittanceMode = recovery.getRemittanceMode(); - this.type = recovery.getType(); - this.remitted = recovery.getRemitted(); - return this; - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/RecoverySearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/RecoverySearchEntity.java deleted file mode 100644 index d3ef73db501..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/RecoverySearchEntity.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import lombok.Data; -import org.egov.egf.master.domain.model.RecoverySearch; - -import java.util.Date; - -@Data -public class RecoverySearchEntity extends RecoveryEntity { - private Date fromDate; - private Date toDate; - private Integer pageSize; - private Integer offset = 0; - private String sortBy; - - public RecoverySearchEntity toEntity(RecoverySearch recoverySearch) { - - super.toEntity(recoverySearch); - this.pageSize = recoverySearch.getPageSize(); - this.sortBy = recoverySearch.getSortBy(); - return this; - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SchemeEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SchemeEntity.java deleted file mode 100644 index 7efe8ec357c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SchemeEntity.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import java.util.Date; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.Scheme; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class SchemeEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_scheme"; - public static final String SEQUENCE_NAME = "seq_egf_scheme"; - private String id; - private String fundId; - private String code; - private String name; - private Date validFrom; - private Date validTo; - private Boolean active; - private String description; - private String boundary; - - public Scheme toDomain() { - Scheme scheme = new Scheme(); - super.toDomain(scheme); - scheme.setId(this.id); - scheme.setFund(Fund.builder().id(fundId).build()); - scheme.setCode(this.code); - scheme.setName(this.name); - scheme.setValidFrom(this.validFrom); - scheme.setValidTo(this.validTo); - scheme.setActive(this.active); - scheme.setDescription(this.description); - scheme.setBoundary(this.boundary); - return scheme; - } - - public SchemeEntity toEntity(Scheme scheme) { - super.toEntity((Auditable) scheme); - this.id = scheme.getId(); - this.fundId = scheme.getFund() != null ? scheme.getFund().getId() : null; - this.code = scheme.getCode(); - this.name = scheme.getName(); - this.validFrom = scheme.getValidFrom(); - this.validTo = scheme.getValidTo(); - this.active = scheme.getActive(); - this.description = scheme.getDescription(); - this.boundary = scheme.getBoundary(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SchemeSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SchemeSearchEntity.java deleted file mode 100644 index 03e060c8e36..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SchemeSearchEntity.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.egf.master.domain.model.Scheme; -import org.egov.egf.master.domain.model.SchemeSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SchemeSearchEntity extends SchemeEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - - public Scheme toDomain() { - Scheme scheme = new Scheme(); - super.toDomain(scheme); - return scheme; - } - - public SchemeSearchEntity toEntity(SchemeSearch schemeSearch) { - super.toEntity((Scheme) schemeSearch); - this.pageSize = schemeSearch.getPageSize(); - this.offset = schemeSearch.getOffset(); - this.sortBy = schemeSearch.getSortBy(); - this.ids = schemeSearch.getIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SubSchemeEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SubSchemeEntity.java deleted file mode 100644 index 0614ff11a1d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SubSchemeEntity.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import java.util.Date; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.Scheme; -import org.egov.egf.master.domain.model.SubScheme; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class SubSchemeEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_subscheme"; - public static final String SEQUENCE_NAME = "seq_egf_subscheme"; - private String id; - private String schemeId; - private String code; - private String name; - private Date validFrom; - private Date validTo; - private Boolean active; - private String departmentId; - - public SubScheme toDomain() { - SubScheme subScheme = new SubScheme(); - super.toDomain(subScheme); - subScheme.setId(this.id); - subScheme.setScheme(Scheme.builder().id(schemeId).build()); - subScheme.setCode(this.code); - subScheme.setName(this.name); - subScheme.setValidFrom(this.validFrom); - subScheme.setValidTo(this.validTo); - subScheme.setActive(this.active); - subScheme.setDepartmentId(this.departmentId); - return subScheme; - } - - public SubSchemeEntity toEntity(SubScheme subScheme) { - super.toEntity((Auditable) subScheme); - this.id = subScheme.getId(); - this.schemeId = subScheme.getScheme() != null ? subScheme.getScheme().getId() : null; - this.code = subScheme.getCode(); - this.name = subScheme.getName(); - this.validFrom = subScheme.getValidFrom(); - this.validTo = subScheme.getValidTo(); - this.active = subScheme.getActive(); - this.departmentId = subScheme.getDepartmentId(); - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SubSchemeSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SubSchemeSearchEntity.java deleted file mode 100644 index 2c4ff6657dd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SubSchemeSearchEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.egf.master.persistence.entity ; -import org.egov.egf.master.domain.model.SubScheme; -import org.egov.egf.master.domain.model.SubSchemeSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SubSchemeSearchEntity extends SubSchemeEntity { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -public SubScheme toDomain(){ -SubScheme subScheme = new SubScheme (); -super.toDomain( subScheme);return subScheme ;} - -public SubSchemeSearchEntity toEntity( SubSchemeSearch subSchemeSearch){ -super.toEntity(( SubScheme)subSchemeSearch); -this.pageSize=subSchemeSearch.getPageSize(); this.offset=subSchemeSearch.getOffset(); this.sortBy=subSchemeSearch.getSortBy(); this.ids=subSchemeSearch.getIds(); return this;} - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SupplierEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SupplierEntity.java deleted file mode 100644 index afedc6156ed..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SupplierEntity.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.common.domain.model.Auditable; -import org.egov.common.persistence.entity.AuditableEntity; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.Supplier; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@Builder -public class SupplierEntity extends AuditableEntity { - public static final String TABLE_NAME = "egf_supplier"; - public static final String SEQUENCE_NAME = "seq_egf_supplier"; - private String id; - private String code; - private String name; - private String address; - private String mobile; - private String email; - private String description; - private Boolean active; - private String panNo; - private String tinNo; - private String registationNo; - private String bankAccountId; - private String ifscCode; - private String bankId; - - public Supplier toDomain() { - Supplier supplier = new Supplier(); - super.toDomain(supplier); - supplier.setId(this.id); - supplier.setCode(this.code); - supplier.setName(this.name); - supplier.setAddress(this.address); - supplier.setMobile(this.mobile); - supplier.setEmail(this.email); - supplier.setDescription(this.description); - supplier.setActive(this.active); - supplier.setPanNo(this.panNo); - supplier.setTinNo(this.tinNo); - supplier.setRegistationNo(this.registationNo); - supplier.setBankAccount(BankAccount.builder().id(bankAccountId).build()); - supplier.setIfscCode(this.ifscCode); - supplier.setBank(Bank.builder().id(bankId).build()); - return supplier; - } - - public SupplierEntity toEntity(Supplier supplier) { - super.toEntity((Auditable) supplier); - this.id = supplier.getId(); - this.code = supplier.getCode(); - this.name = supplier.getName(); - this.address = supplier.getAddress(); - this.mobile = supplier.getMobile(); - this.email = supplier.getEmail(); - this.description = supplier.getDescription(); - this.active = supplier.getActive(); - this.panNo = supplier.getPanNo(); - this.tinNo = supplier.getTinNo(); - this.registationNo = supplier.getRegistationNo(); - this.bankAccountId = supplier.getBankAccount() != null ? supplier.getBankAccount().getId() : null; - this.ifscCode = supplier.getIfscCode(); - this.bankId = supplier.getBank() != null ? supplier.getBank().getId() : null; - return this; - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SupplierSearchEntity.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SupplierSearchEntity.java deleted file mode 100644 index 6fe6a1cf55d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/entity/SupplierSearchEntity.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.egf.master.persistence.entity; - -import org.egov.egf.master.domain.model.Supplier; -import org.egov.egf.master.domain.model.SupplierSearch; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SupplierSearchEntity extends SupplierEntity { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - - public Supplier toDomain() { - Supplier supplier = new Supplier(); - super.toDomain(supplier); - return supplier; - } - - public SupplierSearchEntity toEntity(SupplierSearch supplierSearch) { - super.toEntity((Supplier) supplierSearch); - this.pageSize = supplierSearch.getPageSize(); - this.offset = supplierSearch.getOffset(); - this.sortBy = supplierSearch.getSortBy(); - this.ids = supplierSearch.getIds(); - return this; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/FinancialMastersListener.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/FinancialMastersListener.java deleted file mode 100644 index 7b6505fc29e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/FinancialMastersListener.java +++ /dev/null @@ -1,952 +0,0 @@ -package org.egov.egf.master.persistence.queue; - -import java.util.Map; - -import org.egov.egf.master.domain.model.*; -import org.egov.egf.master.domain.service.*; -import org.egov.egf.master.web.contract.*; -import org.egov.egf.master.web.requests.*; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationContext; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class FinancialMastersListener { - - @Value("${kafka.topics.egf.masters.completed.topic}") - private String completedTopic; - - @Value("${kafka.topics.egf.masters.fund.completed.key}") - private String fundCompletedKey; - - @Value("${kafka.topics.egf.masters.bank.completed.key}") - private String bankCompletedKey; - - @Value("${kafka.topics.egf.masters.bankbranch.completed.key}") - private String bankBranchCompletedKey; - - @Value("${kafka.topics.egf.masters.financialyear.completed.key}") - private String financialYearCompletedKey; - - @Value("${kafka.topics.egf.masters.fiscalperiod.completed.key}") - private String fiscalPeriodCompletedKey; - - @Value("${kafka.topics.egf.masters.function.completed.key}") - private String functionCompletedKey; - - @Value("${kafka.topics.egf.masters.functionary.completed.key}") - private String functionaryCompletedKey; - - @Value("${kafka.topics.egf.masters.fundsource.completed.key}") - private String fundsourceCompletedKey; - - @Value("${kafka.topics.egf.masters.scheme.completed.key}") - private String schemeCompletedKey; - - @Value("${kafka.topics.egf.masters.bankaccount.completed.key}") - private String bankAccountCompletedKey; - - @Value("${kafka.topics.egf.masters.subscheme.completed.key}") - private String subSchemeCompletedKey; - - @Value("${kafka.topics.egf.masters.supplier.completed.key}") - private String supplierCompletedKey; - - @Value("${kafka.topics.egf.masters.accountdetailtype.completed.key}") - private String accountDetailTypeCompletedKey; - - @Value("${kafka.topics.egf.masters.accountdetailkey.completed.key}") - private String accountDetailKeyCompletedKey; - - @Value("${kafka.topics.egf.masters.accountentity.completed.key}") - private String accountEntityCompletedKey; - - @Value("${kafka.topics.egf.masters.accountcodepurpose.completed.key}") - private String accountCodePurposeCompletedKey; - - @Value("${kafka.topics.egf.masters.chartofaccount.completed.key}") - private String chartOfAccountCompletedKey; - - @Value("${kafka.topics.egf.masters.chartofaccountdetail.completed.key}") - private String chartOfAccountDetailCompletedKey; - - @Value("${kafka.topics.egf.masters.budgetgroup.completed.key}") - private String budgetGroupCompletedKey; - - @Value("${kafka.topics.egf.masters.financialstatus.completed.key}") - private String financialStatusCompletedKey; - - @Value("${kafka.topics.egf.masters.financialconfiguration.completed.key}") - private String financialConfigurationCompletedKey; - - @Value("${kafka.topics.egf.masters.recovery.completed.key}") - private String recoveryCompletedKey; - - @Autowired - ApplicationContext applicationContext; - - @Autowired - ObjectMapper objectMapper; - - @Autowired - private FinancialProducer financialProducer; - - @Autowired - private FundService fundService; - - @Autowired - private BankService bankService; - - @Autowired - private FunctionService functionService; - - @Autowired - private BankBranchService bankBranchService; - - @Autowired - private BankAccountService bankAccountService; - - @Autowired - private AccountCodePurposeService accountCodePurposeService; - - @Autowired - private AccountDetailTypeService accountDetailTypeService; - - @Autowired - private AccountDetailKeyService accountDetailKeyService; - - @Autowired - private AccountEntityService accountEntityService; - - @Autowired - private BudgetGroupService budgetGroupService; - - @Autowired - private ChartOfAccountService chartOfAccountService; - - @Autowired - private ChartOfAccountDetailService chartOfAccountDetailService; - - @Autowired - private FinancialYearService financialYearService; - - @Autowired - private FiscalPeriodService fiscalPeriodService; - - @Autowired - private FunctionaryService functionaryService; - - @Autowired - private FundsourceService fundsourceService; - - @Autowired - private SchemeService schemeService; - - @Autowired - private SubSchemeService subSchemeService; - - @Autowired - private SupplierService supplierService; - - @Autowired - private FinancialStatusService financialStatusService; - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @Autowired - private RecoveryService recoveryService; - - @KafkaListener(id = "${kafka.topics.egf.masters.validated.id}", topics = "${kafka.topics.egf.masters.validated.topic}", groupId = "${kafka.topics.egf.masters.validated.group}") - public void process(Map mastersMap) { - // implement the details here - - if (mastersMap.get("bank_create") != null) { - BankRequest request = objectMapper.convertValue( - mastersMap.get("bank_create"), BankRequest.class); - ModelMapper mapper = new ModelMapper(); - for (BankContract bankContract : request.getBanks()) { - Bank domain = mapper.map(bankContract, Bank.class); - bankService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("bank_persisted", request); - financialProducer.sendMessage(completedTopic, bankCompletedKey, - mastersMap); - } - if (mastersMap.get("bank_update") != null) { - - BankRequest request = objectMapper.convertValue( - mastersMap.get("bank_update"), BankRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (BankContract bankContract : request.getBanks()) { - Bank domain = mapper.map(bankContract, Bank.class); - bankService.update(domain); - } - mastersMap.clear(); - mastersMap.put("bank_persisted", request); - financialProducer.sendMessage(completedTopic, bankCompletedKey, - mastersMap); - } - - if (mastersMap.get("bankbranch_create") != null) { - BankBranchRequest request = objectMapper.convertValue( - mastersMap.get("bankbranch_create"), BankBranchRequest.class); - ModelMapper mapper = new ModelMapper(); - for (BankBranchContract bankBranchContract : request.getBankBranches()) { - BankBranch domain = mapper.map(bankBranchContract, BankBranch.class); - bankBranchService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("bankbranch_persisted", request); - financialProducer.sendMessage(completedTopic, bankBranchCompletedKey, - mastersMap); - } - if (mastersMap.get("bankbranch_update") != null) { - - BankBranchRequest request = objectMapper.convertValue( - mastersMap.get("bankbranch_update"), BankBranchRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (BankBranchContract bankBranchContract : request.getBankBranches()) { - BankBranch domain = mapper.map(bankBranchContract, BankBranch.class); - bankBranchService.update(domain); - } - mastersMap.clear(); - mastersMap.put("bankbranch_persisted", request); - financialProducer.sendMessage(completedTopic, bankBranchCompletedKey, - mastersMap); - } - - if (mastersMap.get("fund_create") != null) { - FundRequest request = objectMapper.convertValue( - mastersMap.get("fund_create"), FundRequest.class); - ModelMapper mapper = new ModelMapper(); - for (FundContract fundContract : request.getFunds()) { - Fund domain = mapper.map(fundContract, Fund.class); - fundService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("fund_persisted", request); - financialProducer.sendMessage(completedTopic, fundCompletedKey, - mastersMap); - } - if (mastersMap.get("fund_update") != null) { - - FundRequest request = objectMapper.convertValue( - mastersMap.get("fund_update"), FundRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (FundContract fundContract : request.getFunds()) { - Fund domain = mapper.map(fundContract, Fund.class); - fundService.update(domain); - } - mastersMap.clear(); - mastersMap.put("fund_persisted", request); - financialProducer.sendMessage(completedTopic, fundCompletedKey, - mastersMap); - } - - if (mastersMap.get("financialyear_create") != null) { - FinancialYearRequest request = objectMapper.convertValue( - mastersMap.get("financialyear_create"), - FinancialYearRequest.class); - ModelMapper mapper = new ModelMapper(); - for (FinancialYearContract financialYearContract : request - .getFinancialYears()) { - FinancialYear domain = mapper.map(financialYearContract, - FinancialYear.class); - financialYearService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("financialyear_persisted", request); - financialProducer.sendMessage(completedTopic, - financialYearCompletedKey, mastersMap); - } - if (mastersMap.get("financialyear_update") != null) { - - FinancialYearRequest request = objectMapper.convertValue( - mastersMap.get("financialyear_update"), - FinancialYearRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (FinancialYearContract financialYearContract : request - .getFinancialYears()) { - FinancialYear domain = mapper.map(financialYearContract, - FinancialYear.class); - financialYearService.update(domain); - } - mastersMap.clear(); - mastersMap.put("financialyear_persisted", request); - financialProducer.sendMessage(completedTopic, - financialYearCompletedKey, mastersMap); - } - - if (mastersMap.get("fiscalperiod_create") != null) { - FiscalPeriodRequest request = objectMapper.convertValue( - mastersMap.get("fiscalperiod_create"), - FiscalPeriodRequest.class); - ModelMapper mapper = new ModelMapper(); - for (FiscalPeriodContract fiscalPeriodContract : request - .getFiscalPeriods()) { - FiscalPeriod domain = mapper.map(fiscalPeriodContract, - FiscalPeriod.class); - fiscalPeriodService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("fiscalperiod_persisted", request); - financialProducer.sendMessage(completedTopic, - fiscalPeriodCompletedKey, mastersMap); - } - if (mastersMap.get("fiscalperiod_update") != null) { - - FiscalPeriodRequest request = objectMapper.convertValue( - mastersMap.get("fiscalperiod_update"), - FiscalPeriodRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (FiscalPeriodContract fiscalPeriodContract : request - .getFiscalPeriods()) { - FiscalPeriod domain = mapper.map(fiscalPeriodContract, - FiscalPeriod.class); - fiscalPeriodService.update(domain); - } - mastersMap.clear(); - mastersMap.put("fiscalperiod_persisted", request); - financialProducer.sendMessage(completedTopic, - fiscalPeriodCompletedKey, mastersMap); - } - - if (mastersMap.get("function_create") != null) { - FunctionRequest request = objectMapper.convertValue( - mastersMap.get("function_create"), FunctionRequest.class); - ModelMapper mapper = new ModelMapper(); - for (FunctionContract functionContract : request.getFunctions()) { - Function domain = mapper.map(functionContract, Function.class); - functionService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("function_persisted", request); - financialProducer.sendMessage(completedTopic, functionCompletedKey, - mastersMap); - } - if (mastersMap.get("function_update") != null) { - - FunctionRequest request = objectMapper.convertValue( - mastersMap.get("function_update"), FunctionRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (FunctionContract functionContract : request.getFunctions()) { - Function domain = mapper.map(functionContract, Function.class); - functionService.update(domain); - } - mastersMap.clear(); - mastersMap.put("function_persisted", request); - financialProducer.sendMessage(completedTopic, functionCompletedKey, - mastersMap); - } - - if (mastersMap.get("functionary_create") != null) { - FunctionaryRequest request = objectMapper.convertValue( - mastersMap.get("functionary_create"), - FunctionaryRequest.class); - ModelMapper mapper = new ModelMapper(); - for (FunctionaryContract functionaryContract : request - .getFunctionaries()) { - Functionary domain = mapper.map(functionaryContract, - Functionary.class); - functionaryService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("functionary_persisted", request); - financialProducer.sendMessage(completedTopic, - functionaryCompletedKey, mastersMap); - } - if (mastersMap.get("functionary_update") != null) { - - FunctionaryRequest request = objectMapper.convertValue( - mastersMap.get("functionary_update"), - FunctionaryRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (FunctionaryContract functionaryContract : request - .getFunctionaries()) { - Functionary domain = mapper.map(functionaryContract, - Functionary.class); - functionaryService.update(domain); - } - mastersMap.clear(); - mastersMap.put("functionary_persisted", request); - financialProducer.sendMessage(completedTopic, - functionaryCompletedKey, mastersMap); - } - - if (mastersMap.get("fundsource_create") != null) { - FundsourceRequest request = objectMapper.convertValue( - mastersMap.get("fundsource_create"), - FundsourceRequest.class); - ModelMapper mapper = new ModelMapper(); - for (FundsourceContract fundsourceContract : request - .getFundsources()) { - Fundsource domain = mapper.map(fundsourceContract, - Fundsource.class); - fundsourceService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("fundsource_persisted", request); - financialProducer.sendMessage(completedTopic, - fundsourceCompletedKey, mastersMap); - } - if (mastersMap.get("fundsource_update") != null) { - - FundsourceRequest request = objectMapper.convertValue( - mastersMap.get("fundsource_update"), - FundsourceRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (FundsourceContract fundsourceContract : request - .getFundsources()) { - Fundsource domain = mapper.map(fundsourceContract, - Fundsource.class); - fundsourceService.update(domain); - } - mastersMap.clear(); - mastersMap.put("fundsource_persisted", request); - financialProducer.sendMessage(completedTopic, - fundsourceCompletedKey, mastersMap); - } - - if (mastersMap.get("scheme_create") != null) { - SchemeRequest request = objectMapper.convertValue( - mastersMap.get("scheme_create"), SchemeRequest.class); - ModelMapper mapper = new ModelMapper(); - for (SchemeContract schemeContract : request.getSchemes()) { - Scheme domain = mapper.map(schemeContract, Scheme.class); - schemeService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("scheme_persisted", request); - financialProducer.sendMessage(completedTopic, schemeCompletedKey, - mastersMap); - } - if (mastersMap.get("scheme_update") != null) { - - SchemeRequest request = objectMapper.convertValue( - mastersMap.get("scheme_update"), SchemeRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (SchemeContract schemeContract : request.getSchemes()) { - Scheme domain = mapper.map(schemeContract, Scheme.class); - schemeService.update(domain); - } - mastersMap.clear(); - mastersMap.put("scheme_persisted", request); - financialProducer.sendMessage(completedTopic, schemeCompletedKey, - mastersMap); - } - - if (mastersMap.get("bankaccount_create") != null) { - BankAccountRequest request = objectMapper.convertValue( - mastersMap.get("bankaccount_create"), - BankAccountRequest.class); - ModelMapper mapper = new ModelMapper(); - for (BankAccountContract bankAccountContract : request - .getBankAccounts()) { - BankAccount domain = mapper.map(bankAccountContract, - BankAccount.class); - bankAccountService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("bankaccount_persisted", request); - financialProducer.sendMessage(completedTopic, - bankAccountCompletedKey, mastersMap); - } - if (mastersMap.get("bankaccount_update") != null) { - - BankAccountRequest request = objectMapper.convertValue( - mastersMap.get("bankaccount_update"), - BankAccountRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (BankAccountContract bankAccountContract : request - .getBankAccounts()) { - BankAccount domain = mapper.map(bankAccountContract, - BankAccount.class); - bankAccountService.update(domain); - } - mastersMap.clear(); - mastersMap.put("bankaccount_persisted", request); - financialProducer.sendMessage(completedTopic, - bankAccountCompletedKey, mastersMap); - } - - if (mastersMap.get("subscheme_create") != null) { - SubSchemeRequest request = objectMapper.convertValue( - mastersMap.get("subscheme_create"), SubSchemeRequest.class); - ModelMapper mapper = new ModelMapper(); - for (SubSchemeContract subSchemeContract : request.getSubSchemes()) { - SubScheme domain = mapper.map(subSchemeContract, - SubScheme.class); - subSchemeService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("subscheme_persisted", request); - financialProducer.sendMessage(completedTopic, - subSchemeCompletedKey, mastersMap); - } - if (mastersMap.get("subscheme_update") != null) { - - SubSchemeRequest request = objectMapper.convertValue( - mastersMap.get("subscheme_update"), SubSchemeRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (SubSchemeContract subSchemeContract : request.getSubSchemes()) { - SubScheme domain = mapper.map(subSchemeContract, - SubScheme.class); - subSchemeService.update(domain); - } - mastersMap.clear(); - mastersMap.put("subscheme_persisted", request); - financialProducer.sendMessage(completedTopic, - subSchemeCompletedKey, mastersMap); - } - - if (mastersMap.get("supplier_create") != null) { - SupplierRequest request = objectMapper.convertValue( - mastersMap.get("supplier_create"), SupplierRequest.class); - ModelMapper mapper = new ModelMapper(); - for (SupplierContract supplierContract : request.getSuppliers()) { - Supplier domain = mapper.map(supplierContract, Supplier.class); - supplierService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("supplier_persisted", request); - financialProducer.sendMessage(completedTopic, supplierCompletedKey, - mastersMap); - } - if (mastersMap.get("supplier_update") != null) { - - SupplierRequest request = objectMapper.convertValue( - mastersMap.get("supplier_update"), SupplierRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (SupplierContract supplierContract : request.getSuppliers()) { - Supplier domain = mapper.map(supplierContract, Supplier.class); - supplierService.update(domain); - } - mastersMap.clear(); - mastersMap.put("supplier_persisted", request); - financialProducer.sendMessage(completedTopic, supplierCompletedKey, - mastersMap); - } - - if (mastersMap.get("accountdetailtype_create") != null) { - AccountDetailTypeRequest request = objectMapper.convertValue( - mastersMap.get("accountdetailtype_create"), - AccountDetailTypeRequest.class); - ModelMapper mapper = new ModelMapper(); - for (AccountDetailTypeContract accountDetailTypeContract : request - .getAccountDetailTypes()) { - AccountDetailType domain = mapper.map( - accountDetailTypeContract, AccountDetailType.class); - accountDetailTypeService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("accountdetailtype_persisted", request); - financialProducer.sendMessage(completedTopic, - accountDetailTypeCompletedKey, mastersMap); - } - if (mastersMap.get("accountdetailtype_update") != null) { - - AccountDetailTypeRequest request = objectMapper.convertValue( - mastersMap.get("accountdetailtype_update"), - AccountDetailTypeRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (AccountDetailTypeContract accountDetailTypeContract : request - .getAccountDetailTypes()) { - AccountDetailType domain = mapper.map( - accountDetailTypeContract, AccountDetailType.class); - accountDetailTypeService.update(domain); - } - mastersMap.clear(); - mastersMap.put("accountdetailtype_persisted", request); - financialProducer.sendMessage(completedTopic, - accountDetailTypeCompletedKey, mastersMap); - } - - if (mastersMap.get("accountdetailkey_create") != null) { - AccountDetailKeyRequest request = objectMapper.convertValue( - mastersMap.get("accountdetailkey_create"), - AccountDetailKeyRequest.class); - ModelMapper mapper = new ModelMapper(); - for (AccountDetailKeyContract accountDetailKeyContract : request - .getAccountDetailKeys()) { - AccountDetailKey domain = mapper.map(accountDetailKeyContract, - AccountDetailKey.class); - accountDetailKeyService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("accountdetailkey_persisted", request); - financialProducer.sendMessage(completedTopic, - accountDetailKeyCompletedKey, mastersMap); - } - if (mastersMap.get("accountdetailkey_update") != null) { - - AccountDetailKeyRequest request = objectMapper.convertValue( - mastersMap.get("accountdetailkey_update"), - AccountDetailKeyRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (AccountDetailKeyContract accountDetailKeyContract : request - .getAccountDetailKeys()) { - AccountDetailKey domain = mapper.map(accountDetailKeyContract, - AccountDetailKey.class); - accountDetailKeyService.update(domain); - } - mastersMap.clear(); - mastersMap.put("accountdetailkey_persisted", request); - financialProducer.sendMessage(completedTopic, - accountDetailKeyCompletedKey, mastersMap); - } - - if (mastersMap.get("accountentity_create") != null) { - AccountEntityRequest request = objectMapper.convertValue( - mastersMap.get("accountentity_create"), - AccountEntityRequest.class); - ModelMapper mapper = new ModelMapper(); - for (AccountEntityContract accountEntityContract : request - .getAccountEntities()) { - AccountEntity domain = mapper.map(accountEntityContract, - AccountEntity.class); - accountEntityService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("accountentity_persisted", request); - financialProducer.sendMessage(completedTopic, - accountEntityCompletedKey, mastersMap); - } - if (mastersMap.get("accountentity_update") != null) { - - AccountEntityRequest request = objectMapper.convertValue( - mastersMap.get("accountentity_update"), - AccountEntityRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (AccountEntityContract accountEntityContract : request - .getAccountEntities()) { - AccountEntity domain = mapper.map(accountEntityContract, - AccountEntity.class); - accountEntityService.update(domain); - } - mastersMap.clear(); - mastersMap.put("accountentity_persisted", request); - financialProducer.sendMessage(completedTopic, - accountEntityCompletedKey, mastersMap); - } - - if (mastersMap.get("accountcodepurpose_create") != null) { - AccountCodePurposeRequest request = objectMapper.convertValue( - mastersMap.get("accountcodepurpose_create"), - AccountCodePurposeRequest.class); - ModelMapper mapper = new ModelMapper(); - for (AccountCodePurposeContract accountCodePurposeContract : request - .getAccountCodePurposes()) { - AccountCodePurpose domain = mapper.map( - accountCodePurposeContract, AccountCodePurpose.class); - accountCodePurposeService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("accountcodepurpose_persisted", request); - financialProducer.sendMessage(completedTopic, - accountCodePurposeCompletedKey, mastersMap); - } - if (mastersMap.get("accountcodepurpose_update") != null) { - - AccountCodePurposeRequest request = objectMapper.convertValue( - mastersMap.get("accountcodepurpose_update"), - AccountCodePurposeRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (AccountCodePurposeContract accountCodePurposeContract : request - .getAccountCodePurposes()) { - AccountCodePurpose domain = mapper.map( - accountCodePurposeContract, AccountCodePurpose.class); - accountCodePurposeService.update(domain); - } - mastersMap.clear(); - mastersMap.put("accountcodepurpose_persisted", request); - financialProducer.sendMessage(completedTopic, - accountCodePurposeCompletedKey, mastersMap); - } - - if (mastersMap.get("chartofaccount_create") != null) { - ChartOfAccountRequest request = objectMapper.convertValue( - mastersMap.get("chartofaccount_create"), - ChartOfAccountRequest.class); - ModelMapper mapper = new ModelMapper(); - for (ChartOfAccountContract chartOfAccountContract : request - .getChartOfAccounts()) { - ChartOfAccount domain = mapper.map(chartOfAccountContract, - ChartOfAccount.class); - chartOfAccountService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("chartofaccount_persisted", request); - financialProducer.sendMessage(completedTopic, - chartOfAccountCompletedKey, mastersMap); - } - if (mastersMap.get("chartofaccount_update") != null) { - - ChartOfAccountRequest request = objectMapper.convertValue( - mastersMap.get("chartofaccount_update"), - ChartOfAccountRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (ChartOfAccountContract chartOfAccountContract : request - .getChartOfAccounts()) { - ChartOfAccount domain = mapper.map(chartOfAccountContract, - ChartOfAccount.class); - chartOfAccountService.update(domain); - } - mastersMap.clear(); - mastersMap.put("chartofaccount_persisted", request); - financialProducer.sendMessage(completedTopic, - chartOfAccountCompletedKey, mastersMap); - } - - if (mastersMap.get("chartofaccountdetail_create") != null) { - ChartOfAccountDetailRequest request = objectMapper.convertValue( - mastersMap.get("chartofaccountdetail_create"), - ChartOfAccountDetailRequest.class); - ModelMapper mapper = new ModelMapper(); - for (ChartOfAccountDetailContract chartOfAccountDetailContract : request - .getChartOfAccountDetails()) { - ChartOfAccountDetail domain = mapper.map( - chartOfAccountDetailContract, - ChartOfAccountDetail.class); - chartOfAccountDetailService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("chartofaccountdetail_persisted", request); - financialProducer.sendMessage(completedTopic, - chartOfAccountDetailCompletedKey, mastersMap); - } - if (mastersMap.get("chartofaccountdetail_update") != null) { - - ChartOfAccountDetailRequest request = objectMapper.convertValue( - mastersMap.get("chartofaccountdetail_update"), - ChartOfAccountDetailRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (ChartOfAccountDetailContract chartOfAccountDetailContract : request - .getChartOfAccountDetails()) { - ChartOfAccountDetail domain = mapper.map( - chartOfAccountDetailContract, - ChartOfAccountDetail.class); - chartOfAccountDetailService.update(domain); - } - mastersMap.clear(); - mastersMap.put("chartofaccountdetail_persisted", request); - financialProducer.sendMessage(completedTopic, - chartOfAccountDetailCompletedKey, mastersMap); - } - - if (mastersMap.get("budgetgroup_create") != null) { - BudgetGroupRequest request = objectMapper.convertValue( - mastersMap.get("budgetgroup_create"), - BudgetGroupRequest.class); - ModelMapper mapper = new ModelMapper(); - for (BudgetGroupContract budgetGroupContract : request - .getBudgetGroups()) { - BudgetGroup domain = mapper.map(budgetGroupContract, - BudgetGroup.class); - budgetGroupService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("budgetgroup_persisted", request); - financialProducer.sendMessage(completedTopic, - budgetGroupCompletedKey, mastersMap); - } - if (mastersMap.get("budgetgroup_update") != null) { - - BudgetGroupRequest request = objectMapper.convertValue( - mastersMap.get("budgetgroup_update"), - BudgetGroupRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (BudgetGroupContract budgetGroupContract : request - .getBudgetGroups()) { - BudgetGroup domain = mapper.map(budgetGroupContract, - BudgetGroup.class); - budgetGroupService.update(domain); - } - mastersMap.clear(); - mastersMap.put("budgetgroup_persisted", request); - financialProducer.sendMessage(completedTopic, - budgetGroupCompletedKey, mastersMap); - } - - if (mastersMap.get("financialstatus_create") != null) { - FinancialStatusRequest request = objectMapper.convertValue( - mastersMap.get("financialstatus_create"), - FinancialStatusRequest.class); - ModelMapper mapper = new ModelMapper(); - for (FinancialStatusContract financialStatusContract : request - .getFinancialStatuses()) { - FinancialStatus domain = mapper.map(financialStatusContract, - FinancialStatus.class); - financialStatusService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("financialstatus_persisted", request); - financialProducer.sendMessage(completedTopic, - financialStatusCompletedKey, mastersMap); - } - if (mastersMap.get("financialstatus_update") != null) { - - FinancialStatusRequest request = objectMapper.convertValue( - mastersMap.get("financialstatus_update"), - FinancialStatusRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (FinancialStatusContract financialStatusContract : request - .getFinancialStatuses()) { - FinancialStatus domain = mapper.map(financialStatusContract, - FinancialStatus.class); - financialStatusService.update(domain); - } - mastersMap.clear(); - mastersMap.put("financialstatus_persisted", request); - financialProducer.sendMessage(completedTopic, - financialStatusCompletedKey, mastersMap); - } - - if (mastersMap.get("financialconfiguration_create") != null) { - FinancialConfigurationRequest request = objectMapper.convertValue( - mastersMap.get("financialconfiguration_create"), - FinancialConfigurationRequest.class); - ModelMapper mapper = new ModelMapper(); - for (FinancialConfigurationContract financialConfigurationContract : request - .getFinancialConfigurations()) { - FinancialConfiguration domain = mapper.map( - financialConfigurationContract, - FinancialConfiguration.class); - financialConfigurationService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("financialconfiguration_persisted", request); - financialProducer.sendMessage(completedTopic, - financialConfigurationCompletedKey, mastersMap); - } - if (mastersMap.get("financialconfiguration_update") != null) { - - FinancialConfigurationRequest request = objectMapper.convertValue( - mastersMap.get("financialconfiguration_update"), - FinancialConfigurationRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (FinancialConfigurationContract financialConfigurationContract : request - .getFinancialConfigurations()) { - FinancialConfiguration domain = mapper.map( - financialConfigurationContract, - FinancialConfiguration.class); - financialConfigurationService.update(domain); - } - mastersMap.clear(); - mastersMap.put("financialconfiguration_persisted", request); - financialProducer.sendMessage(completedTopic, - financialConfigurationCompletedKey, mastersMap); - } - - if (mastersMap.get("bankbranch_create") != null) { - BankBranchRequest request = objectMapper.convertValue( - mastersMap.get("bankbranch_create"), BankBranchRequest.class); - ModelMapper mapper = new ModelMapper(); - for (BankBranchContract bankBranchContract : request.getBankBranches()) { - BankBranch domain = mapper.map(bankBranchContract, BankBranch.class); - bankBranchService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("bankbranch_persisted", request); - financialProducer.sendMessage(completedTopic, bankBranchCompletedKey, - mastersMap); - } - if (mastersMap.get("bankbranch_update") != null) { - - BankBranchRequest request = objectMapper.convertValue( - mastersMap.get("bankbranch_update"), BankBranchRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (BankBranchContract bankBranchContract : request.getBankBranches()) { - BankBranch domain = mapper.map(bankBranchContract, BankBranch.class); - bankBranchService.update(domain); - } - - mastersMap.clear(); - mastersMap.put("bankbranch_persisted", request); - financialProducer.sendMessage(completedTopic, bankBranchCompletedKey, - mastersMap); - } - if (mastersMap.get("recovery_create") != null) { - RecoveryRequest request = objectMapper.convertValue( - mastersMap.get("recovery_create"), RecoveryRequest.class); - ModelMapper mapper = new ModelMapper(); - for (RecoveryContract recoveryContract : request.getRecoverys()) { - Recovery domain = mapper.map(recoveryContract, Recovery.class); - recoveryService.save(domain); - } - - mastersMap.clear(); - mastersMap.put("recovery_persisted", request); - financialProducer.sendMessage(completedTopic, bankCompletedKey, - mastersMap); - } - if (mastersMap.get("recovery_update") != null) { - - RecoveryRequest request = objectMapper.convertValue( - mastersMap.get("recovery_update"), RecoveryRequest.class); - - ModelMapper mapper = new ModelMapper(); - for (RecoveryContract recoveryContract : request.getRecoverys()) { - Recovery domain = mapper.map(recoveryContract, Recovery.class); - recoveryService.update(domain); - } - mastersMap.clear(); - mastersMap.put("recovery_persisted", request); - financialProducer.sendMessage(completedTopic, bankCompletedKey, - mastersMap); - } - - - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/FinancialProducer.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/FinancialProducer.java deleted file mode 100644 index 191f75bb23e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/FinancialProducer.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.egov.egf.master.persistence.queue; - -import java.util.Map; - -import org.egov.tracer.kafka.LogAwareKafkaTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class FinancialProducer { - - private LogAwareKafkaTemplate kafkaTemplate; - - @Autowired - public FinancialProducer(LogAwareKafkaTemplate kafkaTemplate) { - this.kafkaTemplate = kafkaTemplate; - } - - public void sendMessage(String topic, String key, Map message) { - kafkaTemplate.send(topic, key, message); - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/MastersQueueRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/MastersQueueRepository.java deleted file mode 100644 index 24d0d6cc03c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/MastersQueueRepository.java +++ /dev/null @@ -1,353 +0,0 @@ -package org.egov.egf.master.persistence.queue; - -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -@Service -public class MastersQueueRepository { - - @Autowired - private FinancialProducer financialProducer; - - @Value("${kafka.topics.egf.masters.validated.topic}") - private String validatedTopic; - - @Value("${kafka.topics.egf.masters.completed.topic}") - private String completedTopic; - - @Value("${kafka.topics.egf.masters.fund.validated.key}") - private String fundValidatedKey; - - @Value("${kafka.topics.egf.masters.bank.validated.key}") - private String bankValidatedKey; - - @Value("${kafka.topics.egf.masters.bankbranch.validated.key}") - private String bankBranchValidatedKey; - - @Value("${kafka.topics.egf.masters.financialyear.validated.key}") - private String financialYearValidatedKey; - - @Value("${kafka.topics.egf.masters.fiscalperiod.validated.key}") - private String fiscalPeriodValidatedKey; - - @Value("${kafka.topics.egf.masters.function.validated.key}") - private String functionValidatedKey; - - @Value("${kafka.topics.egf.masters.functionary.validated.key}") - private String functionaryValidatedKey; - - @Value("${kafka.topics.egf.masters.fundsource.validated.key}") - private String fundsourceValidatedKey; - - @Value("${kafka.topics.egf.masters.scheme.validated.key}") - private String schemeValidatedKey; - - @Value("${kafka.topics.egf.masters.bankaccount.validated.key}") - private String bankAccountValidatedKey; - - @Value("${kafka.topics.egf.masters.subscheme.validated.key}") - private String subSchemeValidatedKey; - - @Value("${kafka.topics.egf.masters.supplier.validated.key}") - private String supplierValidatedKey; - - @Value("${kafka.topics.egf.masters.accountdetailtype.validated.key}") - private String accountDetailTypeValidatedKey; - - @Value("${kafka.topics.egf.masters.accountdetailkey.validated.key}") - private String accountDetailKeyValidatedKey; - - @Value("${kafka.topics.egf.masters.accountentity.validated.key}") - private String accountEntityValidatedKey; - - @Value("${kafka.topics.egf.masters.accountcodepurpose.validated.key}") - private String accountCodePurposeValidatedKey; - - @Value("${kafka.topics.egf.masters.chartofaccount.validated.key}") - private String chartOfAccountValidatedKey; - - @Value("${kafka.topics.egf.masters.chartofaccountdetail.validated.key}") - private String chartOfAccountDetailValidatedKey; - - @Value("${kafka.topics.egf.masters.budgetgroup.validated.key}") - private String budgetGroupValidatedKey; - - @Value("${kafka.topics.egf.masters.financialstatus.validated.key}") - private String financialStatusValidatedKey; - - @Value("${kafka.topics.egf.masters.financialconfiguration.validated.key}") - private String financialConfigurationValidatedKey; - - @Value("${kafka.topics.egf.masters.fund.completed.key}") - private String fundCompletedKey; - - @Value("${kafka.topics.egf.masters.bank.completed.key}") - private String bankCompletedKey; - - @Value("${kafka.topics.egf.masters.bankbranch.completed.key}") - private String bankBranchCompletedKey; - - @Value("${kafka.topics.egf.masters.financialyear.completed.key}") - private String financialYearCompletedKey; - - @Value("${kafka.topics.egf.masters.fiscalperiod.completed.key}") - private String fiscalPeriodCompletedKey; - - @Value("${kafka.topics.egf.masters.function.completed.key}") - private String functionCompletedKey; - - @Value("${kafka.topics.egf.masters.functionary.completed.key}") - private String functionaryCompletedKey; - - @Value("${kafka.topics.egf.masters.fundsource.completed.key}") - private String fundsourceCompletedKey; - - @Value("${kafka.topics.egf.masters.scheme.completed.key}") - private String schemeCompletedKey; - - @Value("${kafka.topics.egf.masters.bankaccount.completed.key}") - private String bankAccountCompletedKey; - - @Value("${kafka.topics.egf.masters.subscheme.completed.key}") - private String subSchemeCompletedKey; - - @Value("${kafka.topics.egf.masters.supplier.completed.key}") - private String supplierCompletedKey; - - @Value("${kafka.topics.egf.masters.accountdetailtype.completed.key}") - private String accountDetailTypeCompletedKey; - - @Value("${kafka.topics.egf.masters.accountdetailkey.completed.key}") - private String accountDetailKeyCompletedKey; - - @Value("${kafka.topics.egf.masters.accountentity.completed.key}") - private String accountEntityCompletedKey; - - @Value("${kafka.topics.egf.masters.accountcodepurpose.completed.key}") - private String accountCodePurposeCompletedKey; - - @Value("${kafka.topics.egf.masters.chartofaccount.completed.key}") - private String chartOfAccountCompletedKey; - - @Value("${kafka.topics.egf.masters.chartofaccountdetail.completed.key}") - private String chartOfAccountDetailCompletedKey; - - @Value("${kafka.topics.egf.masters.budgetgroup.completed.key}") - private String budgetGroupCompletedKey; - - @Value("${kafka.topics.egf.masters.financialstatus.completed.key}") - private String financialStatusCompletedKey; - - @Value("${kafka.topics.egf.masters.financialconfiguration.completed.key}") - private String financialConfigurationCompletedKey; - - @Value("${kafka.topics.egf.masters.recovery.validated.key}") - private String recoveryValidatedKey; - - @Value("${kafka.topics.egf.masters.recovery.completed.key}") - private String recoveryCompletedKey; - - private String key; - private String topicKey; - - public void add(Map topicMap) { - - for (Map.Entry entry : topicMap.entrySet()) { - System.out.println(entry.getKey() + "/" + entry.getValue()); - key = entry.getKey().split("_")[0]; - - if (key.equalsIgnoreCase("fund")) { - topicKey = fundValidatedKey; - break; - } - if (key.equalsIgnoreCase("bank")) { - topicKey = bankValidatedKey; - break; - } - if (key.equalsIgnoreCase("bankBranch")) { - topicKey = bankBranchValidatedKey; - break; - } - if (key.equalsIgnoreCase("financialYear")) { - topicKey = financialYearValidatedKey; - break; - } - if (key.equalsIgnoreCase("fiscalPeriod")) { - topicKey = fiscalPeriodValidatedKey; - break; - } - if (key.equalsIgnoreCase("function")) { - topicKey = functionValidatedKey; - break; - } - if (key.equalsIgnoreCase("functionary")) { - topicKey = functionaryValidatedKey; - break; - } - if (key.equalsIgnoreCase("fundsource")) { - topicKey = fundsourceValidatedKey; - break; - } - if (key.equalsIgnoreCase("scheme")) { - topicKey = schemeValidatedKey; - break; - } - if (key.equalsIgnoreCase("bankAccount")) { - topicKey = bankAccountValidatedKey; - break; - } - if (key.equalsIgnoreCase("subScheme")) { - topicKey = subSchemeValidatedKey; - break; - } - if (key.equalsIgnoreCase("supplier")) { - topicKey = supplierValidatedKey; - break; - } - if (key.equalsIgnoreCase("accountDetailType")) { - topicKey = accountDetailTypeValidatedKey; - break; - } - if (key.equalsIgnoreCase("accountDetailKey")) { - topicKey = accountDetailKeyValidatedKey; - break; - } - if (key.equalsIgnoreCase("accountEntity")) { - topicKey = accountEntityValidatedKey; - break; - } - if (key.equalsIgnoreCase("accountCodePurpose")) { - topicKey = accountCodePurposeValidatedKey; - break; - } - if (key.equalsIgnoreCase("chartOfAccount")) { - topicKey = chartOfAccountValidatedKey; - break; - } - if (key.equalsIgnoreCase("chartOfAccountDetail")) { - topicKey = chartOfAccountDetailValidatedKey; - break; - } - if (key.equalsIgnoreCase("budgetGroup")) { - topicKey = budgetGroupValidatedKey; - break; - } - if (key.equalsIgnoreCase("financialStatus")) { - topicKey = financialStatusValidatedKey; - break; - } - if (key.equalsIgnoreCase("financialConfiguration")) { - topicKey = financialConfigurationValidatedKey; - break; - } - if (key.equalsIgnoreCase("recovery")) { - topicKey = recoveryValidatedKey; - break; - } - } - - financialProducer.sendMessage(validatedTopic, topicKey, topicMap); - } - - public void addToSearch(Map topicMap) { - - for (Map.Entry entry : topicMap.entrySet()) { - System.out.println(entry.getKey() + "/" + entry.getValue()); - key = entry.getKey().split("_")[0]; - - if (key.equalsIgnoreCase("fund")) { - topicKey = fundCompletedKey; - break; - } - if (key.equalsIgnoreCase("bank")) { - topicKey = bankCompletedKey; - break; - } - if (key.equalsIgnoreCase("bankBranch")) { - topicKey = bankBranchCompletedKey; - break; - } - if (key.equalsIgnoreCase("financialYear")) { - topicKey = financialYearCompletedKey; - break; - } - if (key.equalsIgnoreCase("fiscalPeriod")) { - topicKey = fiscalPeriodCompletedKey; - break; - } - if (key.equalsIgnoreCase("function")) { - topicKey = functionCompletedKey; - break; - } - if (key.equalsIgnoreCase("functionary")) { - topicKey = functionaryCompletedKey; - break; - } - if (key.equalsIgnoreCase("fundsource")) { - topicKey = fundsourceCompletedKey; - break; - } - if (key.equalsIgnoreCase("scheme")) { - topicKey = schemeCompletedKey; - break; - } - if (key.equalsIgnoreCase("bankAccount")) { - topicKey = bankAccountCompletedKey; - break; - } - if (key.equalsIgnoreCase("subScheme")) { - topicKey = subSchemeCompletedKey; - break; - } - if (key.equalsIgnoreCase("supplier")) { - topicKey = supplierCompletedKey; - break; - } - if (key.equalsIgnoreCase("accountDetailType")) { - topicKey = accountDetailTypeCompletedKey; - break; - } - if (key.equalsIgnoreCase("accountDetailKey")) { - topicKey = accountDetailKeyCompletedKey; - break; - } - if (key.equalsIgnoreCase("accountEntity")) { - topicKey = accountEntityCompletedKey; - break; - } - if (key.equalsIgnoreCase("accountCodePurpose")) { - topicKey = accountCodePurposeCompletedKey; - break; - } - if (key.equalsIgnoreCase("chartOfAccount")) { - topicKey = chartOfAccountCompletedKey; - break; - } - if (key.equalsIgnoreCase("chartOfAccountDetail")) { - topicKey = chartOfAccountDetailCompletedKey; - break; - } - if (key.equalsIgnoreCase("budgetGroup")) { - topicKey = budgetGroupCompletedKey; - break; - } - if (key.equalsIgnoreCase("financialStatus")) { - topicKey = financialStatusCompletedKey; - break; - } - if (key.equalsIgnoreCase("financialConfiguration")) { - topicKey = financialConfigurationCompletedKey; - break; - } - if (key.equalsIgnoreCase("recovery")) { - topicKey = recoveryCompletedKey; - break; - } - } - - financialProducer.sendMessage(completedTopic, topicKey, topicMap); - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/ObjectMapperFactory.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/ObjectMapperFactory.java deleted file mode 100644 index 32e407aee2e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/queue/ObjectMapperFactory.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.egf.master.persistence.queue; - -import org.springframework.beans.factory.annotation.Autowired; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class ObjectMapperFactory { - - @Autowired - private ObjectMapper objectMapper; - - public ObjectMapper create() { - objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - return objectMapper; - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountCodePurposeJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountCodePurposeJdbcRepository.java deleted file mode 100644 index fc1bda477eb..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountCodePurposeJdbcRepository.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.AccountCodePurposeSearch; -import org.egov.egf.master.persistence.entity.AccountCodePurposeEntity; -import org.egov.egf.master.persistence.entity.AccountCodePurposeSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class AccountCodePurposeJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(AccountCodePurposeJdbcRepository.class); - - static { - LOG.debug("init accountCodePurpose"); - init(AccountCodePurposeEntity.class); - LOG.debug("end init accountCodePurpose"); - } - - public AccountCodePurposeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public AccountCodePurposeEntity create(AccountCodePurposeEntity entity) { - super.create(entity); - return entity; - } - - public AccountCodePurposeEntity update(AccountCodePurposeEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(AccountCodePurposeSearch domain) { - AccountCodePurposeSearchEntity accountCodePurposeSearchEntity = new AccountCodePurposeSearchEntity(); - accountCodePurposeSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (accountCodePurposeSearchEntity.getSortBy() != null - && !accountCodePurposeSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(accountCodePurposeSearchEntity.getSortBy()); - validateEntityFieldName(accountCodePurposeSearchEntity.getSortBy(), AccountCodePurposeEntity.class); - } - - String orderBy = "order by name"; - if (accountCodePurposeSearchEntity.getSortBy() != null - && !accountCodePurposeSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + accountCodePurposeSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", AccountCodePurposeEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (accountCodePurposeSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", accountCodePurposeSearchEntity.getTenantId()); - } - if (accountCodePurposeSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", accountCodePurposeSearchEntity.getId()); - } - if (accountCodePurposeSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(accountCodePurposeSearchEntity.getIds().split(",")))); - } - if (accountCodePurposeSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", accountCodePurposeSearchEntity.getName()); - } - Pagination page = new Pagination<>(); - if (accountCodePurposeSearchEntity.getOffset() != null) { - page.setOffset(accountCodePurposeSearchEntity.getOffset()); - } - if (accountCodePurposeSearchEntity.getPageSize() != null) { - page.setPageSize(accountCodePurposeSearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(AccountCodePurposeEntity.class); - - List accountCodePurposeEntities = namedParameterJdbcTemplate - .query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(accountCodePurposeEntities.size()); - - List accountcodepurposes = new ArrayList<>(); - for (AccountCodePurposeEntity accountCodePurposeEntity : accountCodePurposeEntities) { - - accountcodepurposes.add(accountCodePurposeEntity.toDomain()); - } - page.setPagedData(accountcodepurposes); - - return page; - } - - public AccountCodePurposeEntity findById(AccountCodePurposeEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List accountcodepurposes = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(AccountCodePurposeEntity.class)); - if (accountcodepurposes.isEmpty()) { - return null; - } else { - return accountcodepurposes.get(0); - } - - } - - public Boolean uniqueCheck(String fieldName, AccountCodePurposeEntity accountCodePurpose) { - return super.uniqueCheck(fieldName,accountCodePurpose); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountDetailKeyJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountDetailKeyJdbcRepository.java deleted file mode 100644 index a41dd174be8..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountDetailKeyJdbcRepository.java +++ /dev/null @@ -1,169 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailKeySearch; -import org.egov.egf.master.persistence.entity.AccountDetailKeyEntity; -import org.egov.egf.master.persistence.entity.AccountDetailKeySearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class AccountDetailKeyJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(AccountDetailKeyJdbcRepository.class); - - static { - LOG.debug("init accountDetailKey"); - init(AccountDetailKeyEntity.class); - LOG.debug("end init accountDetailKey"); - } - - public AccountDetailKeyJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public AccountDetailKeyEntity create(AccountDetailKeyEntity entity) { - super.create(entity); - return entity; - } - - public AccountDetailKeyEntity update(AccountDetailKeyEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(AccountDetailKeySearch domain) { - AccountDetailKeySearchEntity accountDetailKeySearchEntity = new AccountDetailKeySearchEntity(); - accountDetailKeySearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (accountDetailKeySearchEntity.getSortBy() != null && !accountDetailKeySearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(accountDetailKeySearchEntity.getSortBy()); - validateEntityFieldName(accountDetailKeySearchEntity.getSortBy(), AccountDetailKeyEntity.class); - } - - String orderBy = "order by key"; - if (accountDetailKeySearchEntity.getSortBy() != null && !accountDetailKeySearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + accountDetailKeySearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", AccountDetailKeyEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (accountDetailKeySearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", accountDetailKeySearchEntity.getTenantId()); - } - if (accountDetailKeySearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", accountDetailKeySearchEntity.getId()); - } - if (accountDetailKeySearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(accountDetailKeySearchEntity.getIds().split(",")))); - } - if (accountDetailKeySearchEntity.getKey() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("key =:key"); - paramValues.put("key", accountDetailKeySearchEntity.getKey()); - } - if (accountDetailKeySearchEntity.getAccountDetailTypeId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("accountDetailTypeId =:accountDetailType"); - paramValues.put("accountDetailType", accountDetailKeySearchEntity.getAccountDetailTypeId()); - } - - Pagination page = new Pagination<>(); - if (accountDetailKeySearchEntity.getOffset() != null) { - page.setOffset(accountDetailKeySearchEntity.getOffset()); - } - if (accountDetailKeySearchEntity.getPageSize() != null) { - page.setPageSize(accountDetailKeySearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(AccountDetailKeyEntity.class); - - List accountDetailKeyEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(accountDetailKeyEntities.size()); - - List accountdetailkeys = new ArrayList<>(); - for (AccountDetailKeyEntity accountDetailKeyEntity : accountDetailKeyEntities) { - - accountdetailkeys.add(accountDetailKeyEntity.toDomain()); - } - page.setPagedData(accountdetailkeys); - - return page; - } - - public AccountDetailKeyEntity findById(AccountDetailKeyEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List accountdetailkeys = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(AccountDetailKeyEntity.class)); - if (accountdetailkeys.isEmpty()) { - return null; - } else { - return accountdetailkeys.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountDetailTypeJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountDetailTypeJdbcRepository.java deleted file mode 100644 index ad40d5dc999..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountDetailTypeJdbcRepository.java +++ /dev/null @@ -1,189 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; -import org.egov.egf.master.persistence.entity.AccountDetailTypeEntity; -import org.egov.egf.master.persistence.entity.AccountDetailTypeSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class AccountDetailTypeJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(AccountDetailTypeJdbcRepository.class); - - static { - LOG.debug("init accountDetailType"); - init(AccountDetailTypeEntity.class); - LOG.debug("end init accountDetailType"); - } - - public AccountDetailTypeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public AccountDetailTypeEntity create(AccountDetailTypeEntity entity) { - super.create(entity); - return entity; - } - - public AccountDetailTypeEntity update(AccountDetailTypeEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(AccountDetailTypeSearch domain) { - AccountDetailTypeSearchEntity accountDetailTypeSearchEntity = new AccountDetailTypeSearchEntity(); - accountDetailTypeSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (accountDetailTypeSearchEntity.getSortBy() != null && !accountDetailTypeSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(accountDetailTypeSearchEntity.getSortBy()); - validateEntityFieldName(accountDetailTypeSearchEntity.getSortBy(), AccountDetailTypeEntity.class); - } - - String orderBy = "order by name"; - if (accountDetailTypeSearchEntity.getSortBy() != null && !accountDetailTypeSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + accountDetailTypeSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", AccountDetailTypeEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (accountDetailTypeSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", accountDetailTypeSearchEntity.getTenantId()); - } - if (accountDetailTypeSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", accountDetailTypeSearchEntity.getId()); - } - if (accountDetailTypeSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", - new ArrayList(Arrays.asList(accountDetailTypeSearchEntity.getIds().split(",")))); - } - if (accountDetailTypeSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", accountDetailTypeSearchEntity.getName()); - } - if (accountDetailTypeSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", accountDetailTypeSearchEntity.getDescription()); - } - if (accountDetailTypeSearchEntity.getTablename() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tableName =:tableName"); - paramValues.put("tableName", accountDetailTypeSearchEntity.getTablename()); - } - if (accountDetailTypeSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", accountDetailTypeSearchEntity.getActive()); - } - if (accountDetailTypeSearchEntity.getFullyQualifiedName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("fullyQualifiedName =:fullyQualifiedName"); - paramValues.put("fullyQualifiedName", accountDetailTypeSearchEntity.getFullyQualifiedName()); - } - - Pagination page = new Pagination<>(); - if (accountDetailTypeSearchEntity.getOffset() != null) { - page.setOffset(accountDetailTypeSearchEntity.getOffset()); - } - if (accountDetailTypeSearchEntity.getPageSize() != null) { - page.setPageSize(accountDetailTypeSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(AccountDetailTypeEntity.class); - - List accountDetailTypeEntities = namedParameterJdbcTemplate - .query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(accountDetailTypeEntities.size()); - - List accountdetailtypes = new ArrayList<>(); - for (AccountDetailTypeEntity accountDetailTypeEntity : accountDetailTypeEntities) { - - accountdetailtypes.add(accountDetailTypeEntity.toDomain()); - } - page.setPagedData(accountdetailtypes); - - return page; - } - - public AccountDetailTypeEntity findById(AccountDetailTypeEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List accountdetailtypes = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(AccountDetailTypeEntity.class)); - if (accountdetailtypes.isEmpty()) { - return null; - } else { - return accountdetailtypes.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountEntityJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountEntityJdbcRepository.java deleted file mode 100644 index 9fb7fe733e6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/AccountEntityJdbcRepository.java +++ /dev/null @@ -1,190 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.domain.model.AccountEntitySearch; -import org.egov.egf.master.persistence.entity.AccountEntityEntity; -import org.egov.egf.master.persistence.entity.AccountEntitySearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class AccountEntityJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(AccountEntityJdbcRepository.class); - - static { - LOG.debug("init accountEntity"); - init(AccountEntityEntity.class); - LOG.debug("end init accountEntity"); - } - - public AccountEntityJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public AccountEntityEntity create(AccountEntityEntity entity) { - super.create(entity); - return entity; - } - - public AccountEntityEntity update(AccountEntityEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(AccountEntitySearch domain) { - AccountEntitySearchEntity accountEntitySearchEntity = new AccountEntitySearchEntity(); - accountEntitySearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (accountEntitySearchEntity.getSortBy() != null && !accountEntitySearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(accountEntitySearchEntity.getSortBy()); - validateEntityFieldName(accountEntitySearchEntity.getSortBy(), AccountEntityEntity.class); - } - - String orderBy = "order by name"; - if (accountEntitySearchEntity.getSortBy() != null && !accountEntitySearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + accountEntitySearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", AccountEntityEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (accountEntitySearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", accountEntitySearchEntity.getTenantId()); - } - if (accountEntitySearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", accountEntitySearchEntity.getId()); - } - if (accountEntitySearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(accountEntitySearchEntity.getIds().split(",")))); - } - if (accountEntitySearchEntity.getAccountDetailTypeId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("accountDetailTypeId =:accountDetailType"); - paramValues.put("accountDetailType", accountEntitySearchEntity.getAccountDetailTypeId()); - } - if (accountEntitySearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", accountEntitySearchEntity.getCode()); - } - if (accountEntitySearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", accountEntitySearchEntity.getName()); - } - if (accountEntitySearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", accountEntitySearchEntity.getActive()); - } - if (accountEntitySearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", accountEntitySearchEntity.getDescription()); - } - - Pagination page = new Pagination<>(); - if (accountEntitySearchEntity.getOffset() != null) { - page.setOffset(accountEntitySearchEntity.getOffset()); - } - if (accountEntitySearchEntity.getPageSize() != null) { - page.setPageSize(accountEntitySearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(AccountEntityEntity.class); - - List accountEntityEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(accountEntityEntities.size()); - - List accountentities = new ArrayList<>(); - for (AccountEntityEntity accountEntityEntity : accountEntityEntities) { - - accountentities.add(accountEntityEntity.toDomain()); - } - page.setPagedData(accountentities); - - return page; - } - - public AccountEntityEntity findById(AccountEntityEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List accountentities = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(AccountEntityEntity.class)); - if (accountentities.isEmpty()) { - return null; - } else { - return accountentities.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BankAccountJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BankAccountJdbcRepository.java deleted file mode 100644 index 31eb795432a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BankAccountJdbcRepository.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankAccountSearch; -import org.egov.egf.master.persistence.entity.BankAccountEntity; -import org.egov.egf.master.persistence.entity.BankAccountSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class BankAccountJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(BankAccountJdbcRepository.class); - - static { - LOG.debug("init bankAccount"); - init(BankAccountEntity.class); - LOG.debug("end init bankAccount"); - } - - public BankAccountJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public BankAccountEntity create(BankAccountEntity entity) { - super.create(entity); - return entity; - } - - public BankAccountEntity update(BankAccountEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(BankAccountSearch domain) { - BankAccountSearchEntity bankAccountSearchEntity = new BankAccountSearchEntity(); - bankAccountSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (bankAccountSearchEntity.getSortBy() != null && !bankAccountSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(bankAccountSearchEntity.getSortBy()); - validateEntityFieldName(bankAccountSearchEntity.getSortBy(), BankAccountEntity.class); - } - - String orderBy = "order by accountNumber"; - if (bankAccountSearchEntity.getSortBy() != null && !bankAccountSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + bankAccountSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", BankAccountEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (bankAccountSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", bankAccountSearchEntity.getTenantId()); - } - if (bankAccountSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", bankAccountSearchEntity.getId()); - } - if (bankAccountSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(bankAccountSearchEntity.getIds().split(",")))); - } - if (bankAccountSearchEntity.getBankBranchId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("bankBranchId =:bankBranch"); - paramValues.put("bankBranch", bankAccountSearchEntity.getBankBranchId()); - } - if (bankAccountSearchEntity.getChartOfAccountId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("chartOfAccountId =:chartOfAccount"); - paramValues.put("chartOfAccount", bankAccountSearchEntity.getChartOfAccountId()); - } - if (bankAccountSearchEntity.getFundId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("fundId =:fund"); - paramValues.put("fund", bankAccountSearchEntity.getFundId()); - } - if (bankAccountSearchEntity.getAccountNumber() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("accountNumber =:accountNumber"); - paramValues.put("accountNumber", bankAccountSearchEntity.getAccountNumber()); - } - if (bankAccountSearchEntity.getAccountType() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("accountType =:accountType"); - paramValues.put("accountType", bankAccountSearchEntity.getAccountType()); - } - if (bankAccountSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", bankAccountSearchEntity.getDescription()); - } - if (bankAccountSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", bankAccountSearchEntity.getActive()); - } - if (bankAccountSearchEntity.getPayTo() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("payTo =:payTo"); - paramValues.put("payTo", bankAccountSearchEntity.getPayTo()); - } - if (bankAccountSearchEntity.getType() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("type =:type"); - paramValues.put("type", bankAccountSearchEntity.getType().toString()); - } - - Pagination page = new Pagination<>(); - if (bankAccountSearchEntity.getOffset() != null) { - page.setOffset(bankAccountSearchEntity.getOffset()); - } - if (bankAccountSearchEntity.getPageSize() != null) { - page.setPageSize(bankAccountSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(BankAccountEntity.class); - - List bankAccountEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(bankAccountEntities.size()); - - List bankaccounts = new ArrayList<>(); - for (BankAccountEntity bankAccountEntity : bankAccountEntities) { - - bankaccounts.add(bankAccountEntity.toDomain()); - } - page.setPagedData(bankaccounts); - - return page; - } - - public BankAccountEntity findById(BankAccountEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List bankaccounts = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(BankAccountEntity.class)); - if (bankaccounts.isEmpty()) { - return null; - } else { - return bankaccounts.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BankBranchJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BankBranchJdbcRepository.java deleted file mode 100644 index 1e63a0df724..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BankBranchJdbcRepository.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.BankBranchSearch; -import org.egov.egf.master.persistence.entity.BankBranchEntity; -import org.egov.egf.master.persistence.entity.BankBranchSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class BankBranchJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(BankBranchJdbcRepository.class); - - static { - LOG.debug("init bankBranch"); - init(BankBranchEntity.class); - LOG.debug("end init bankBranch"); - } - - public BankBranchJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public BankBranchEntity create(BankBranchEntity entity) { - super.create(entity); - return entity; - } - - public BankBranchEntity update(BankBranchEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(BankBranchSearch domain) { - BankBranchSearchEntity bankBranchSearchEntity = new BankBranchSearchEntity(); - bankBranchSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (bankBranchSearchEntity.getSortBy() != null && !bankBranchSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(bankBranchSearchEntity.getSortBy()); - validateEntityFieldName(bankBranchSearchEntity.getSortBy(), BankBranchEntity.class); - } - - String orderBy = "order by name"; - if (bankBranchSearchEntity.getSortBy() != null && !bankBranchSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + bankBranchSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", BankBranchEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (bankBranchSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", bankBranchSearchEntity.getTenantId()); - } - if (bankBranchSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", bankBranchSearchEntity.getId()); - } - if (bankBranchSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(bankBranchSearchEntity.getIds().split(",")))); - } - if (bankBranchSearchEntity.getBankId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("bankId =:bank"); - paramValues.put("bank", bankBranchSearchEntity.getBankId()); - } - if (bankBranchSearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", bankBranchSearchEntity.getCode()); - } - if (bankBranchSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", bankBranchSearchEntity.getName()); - } - if (bankBranchSearchEntity.getAddress() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("address =:address"); - paramValues.put("address", bankBranchSearchEntity.getAddress()); - } - if (bankBranchSearchEntity.getAddress2() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("address2 =:address2"); - paramValues.put("address2", bankBranchSearchEntity.getAddress2()); - } - if (bankBranchSearchEntity.getCity() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("city =:city"); - paramValues.put("city", bankBranchSearchEntity.getCity()); - } - if (bankBranchSearchEntity.getState() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("state =:state"); - paramValues.put("state", bankBranchSearchEntity.getState()); - } - if (bankBranchSearchEntity.getPincode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("pincode =:pincode"); - paramValues.put("pincode", bankBranchSearchEntity.getPincode()); - } - if (bankBranchSearchEntity.getPhone() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("phone =:phone"); - paramValues.put("phone", bankBranchSearchEntity.getPhone()); - } - if (bankBranchSearchEntity.getFax() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("fax =:fax"); - paramValues.put("fax", bankBranchSearchEntity.getFax()); - } - if (bankBranchSearchEntity.getContactPerson() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("contactPerson =:contactPerson"); - paramValues.put("contactPerson", bankBranchSearchEntity.getContactPerson()); - } - if (bankBranchSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", bankBranchSearchEntity.getActive()); - } - if (bankBranchSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", bankBranchSearchEntity.getDescription()); - } - if (bankBranchSearchEntity.getMicr() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("micr =:micr"); - paramValues.put("micr", bankBranchSearchEntity.getMicr()); - } - - Pagination page = new Pagination<>(); - if (bankBranchSearchEntity.getOffset() != null) { - page.setOffset(bankBranchSearchEntity.getOffset()); - } - if (bankBranchSearchEntity.getPageSize() != null) { - page.setPageSize(bankBranchSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(BankBranchEntity.class); - - List bankBranchEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(bankBranchEntities.size()); - - List bankbranches = new ArrayList<>(); - for (BankBranchEntity bankBranchEntity : bankBranchEntities) { - - bankbranches.add(bankBranchEntity.toDomain()); - } - page.setPagedData(bankbranches); - - return page; - } - - public BankBranchEntity findById(BankBranchEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List bankbranches = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(BankBranchEntity.class)); - if (bankbranches.isEmpty()) { - return null; - } else { - return bankbranches.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BankJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BankJdbcRepository.java deleted file mode 100644 index e21611e2824..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BankJdbcRepository.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankSearch; -import org.egov.egf.master.persistence.entity.BankEntity; -import org.egov.egf.master.persistence.entity.BankSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class BankJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(BankJdbcRepository.class); - - static { - LOG.debug("init bank"); - init(BankEntity.class); - LOG.debug("end init bank"); - } - - public BankJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public BankEntity create(BankEntity entity) { - super.create(entity); - return entity; - } - - public BankEntity update(BankEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(BankSearch domain) { - BankSearchEntity bankSearchEntity = new BankSearchEntity(); - bankSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (bankSearchEntity.getSortBy() != null && !bankSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(bankSearchEntity.getSortBy()); - validateEntityFieldName(bankSearchEntity.getSortBy(), BankEntity.class); - } - - String orderBy = "order by name"; - if (bankSearchEntity.getSortBy() != null && !bankSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + bankSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", BankEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (bankSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", bankSearchEntity.getTenantId()); - } - if (bankSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", bankSearchEntity.getId()); - } - if (bankSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(bankSearchEntity.getIds().split(",")))); - } - if (bankSearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", bankSearchEntity.getCode()); - } - if (bankSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", bankSearchEntity.getName()); - } - if (bankSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", bankSearchEntity.getDescription()); - } - if (bankSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", bankSearchEntity.getActive()); - } - if (bankSearchEntity.getType() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("type =:type"); - paramValues.put("type", bankSearchEntity.getType()); - } - - Pagination page = new Pagination<>(); - if (bankSearchEntity.getOffset() != null) { - page.setOffset(bankSearchEntity.getOffset()); - } - if (bankSearchEntity.getPageSize() != null) { - page.setPageSize(bankSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(BankEntity.class); - - List bankEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(bankEntities.size()); - - List banks = new ArrayList<>(); - for (BankEntity bankEntity : bankEntities) { - - banks.add(bankEntity.toDomain()); - } - page.setPagedData(banks); - - return page; - } - - public BankEntity findById(BankEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List banks = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(BankEntity.class)); - if (banks.isEmpty()) { - return null; - } else { - return banks.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BudgetGroupJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BudgetGroupJdbcRepository.java deleted file mode 100644 index e8029bb9296..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/BudgetGroupJdbcRepository.java +++ /dev/null @@ -1,211 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.BudgetGroup; -import org.egov.egf.master.domain.model.BudgetGroupSearch; -import org.egov.egf.master.persistence.entity.BudgetGroupEntity; -import org.egov.egf.master.persistence.entity.BudgetGroupSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class BudgetGroupJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(BudgetGroupJdbcRepository.class); - - static { - LOG.debug("init budgetGroup"); - init(BudgetGroupEntity.class); - LOG.debug("end init budgetGroup"); - } - - public BudgetGroupJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public BudgetGroupEntity create(BudgetGroupEntity entity) { - super.create(entity); - return entity; - } - - public BudgetGroupEntity update(BudgetGroupEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(BudgetGroupSearch domain) { - BudgetGroupSearchEntity budgetGroupSearchEntity = new BudgetGroupSearchEntity(); - budgetGroupSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (budgetGroupSearchEntity.getSortBy() != null && !budgetGroupSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(budgetGroupSearchEntity.getSortBy()); - validateEntityFieldName(budgetGroupSearchEntity.getSortBy(), BudgetGroupEntity.class); - } - - String orderBy = "order by name"; - if (budgetGroupSearchEntity.getSortBy() != null && !budgetGroupSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + budgetGroupSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", BudgetGroupEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (budgetGroupSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", budgetGroupSearchEntity.getTenantId()); - } - if (budgetGroupSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", budgetGroupSearchEntity.getId()); - } - if (budgetGroupSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(budgetGroupSearchEntity.getIds().split(",")))); - } - if (budgetGroupSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", budgetGroupSearchEntity.getName()); - } - if (budgetGroupSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", budgetGroupSearchEntity.getDescription()); - } - if (budgetGroupSearchEntity.getMajorCodeId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("majorCode =:majorCode"); - paramValues.put("majorCode", budgetGroupSearchEntity.getMajorCodeId()); - } - if (budgetGroupSearchEntity.getMaxCodeId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("maxCode =:maxCode"); - paramValues.put("maxCode", budgetGroupSearchEntity.getMaxCodeId()); - } - if (budgetGroupSearchEntity.getMinCodeId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("minCode =:minCode"); - paramValues.put("minCode", budgetGroupSearchEntity.getMinCodeId()); - } - if (budgetGroupSearchEntity.getAccountType() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("accountType =:accountType"); - paramValues.put("accountType", budgetGroupSearchEntity.getAccountType().toString()); - } - if (budgetGroupSearchEntity.getBudgetingType() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("budgetingType =:budgetingType"); - paramValues.put("budgetingType", budgetGroupSearchEntity.getBudgetingType().toString()); - } - if (budgetGroupSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", budgetGroupSearchEntity.getActive()); - } - - Pagination page = new Pagination<>(); - if (budgetGroupSearchEntity.getOffset() != null) { - page.setOffset(budgetGroupSearchEntity.getOffset()); - } - if (budgetGroupSearchEntity.getPageSize() != null) { - page.setPageSize(budgetGroupSearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(BudgetGroupEntity.class); - - List budgetGroupEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(budgetGroupEntities.size()); - - List budgetgroups = new ArrayList<>(); - for (BudgetGroupEntity budgetGroupEntity : budgetGroupEntities) { - - budgetgroups.add(budgetGroupEntity.toDomain()); - } - page.setPagedData(budgetgroups); - - return page; - } - - public BudgetGroupEntity findById(BudgetGroupEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List budgetgroups = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(BudgetGroupEntity.class)); - if (budgetgroups.isEmpty()) { - return null; - } else { - return budgetgroups.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/ChartOfAccountDetailJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/ChartOfAccountDetailJdbcRepository.java deleted file mode 100644 index 2310cc8e91f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/ChartOfAccountDetailJdbcRepository.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; -import org.egov.egf.master.persistence.entity.ChartOfAccountDetailEntity; -import org.egov.egf.master.persistence.entity.ChartOfAccountDetailSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class ChartOfAccountDetailJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(ChartOfAccountDetailJdbcRepository.class); - - private final AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository; - - static { - LOG.debug("init chartOfAccountDetail"); - init(ChartOfAccountDetailEntity.class); - LOG.debug("end init chartOfAccountDetail"); - } - - public ChartOfAccountDetailJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, - AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - this.accountDetailTypeJdbcRepository = accountDetailTypeJdbcRepository; - } - - public ChartOfAccountDetailEntity create(ChartOfAccountDetailEntity entity) { - super.create(entity); - return entity; - } - - public ChartOfAccountDetailEntity update(ChartOfAccountDetailEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(ChartOfAccountDetailSearch domain) { - ChartOfAccountDetailSearchEntity chartOfAccountDetailSearchEntity = new ChartOfAccountDetailSearchEntity(); - chartOfAccountDetailSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (chartOfAccountDetailSearchEntity.getSortBy() != null - && !chartOfAccountDetailSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(chartOfAccountDetailSearchEntity.getSortBy()); - validateEntityFieldName(chartOfAccountDetailSearchEntity.getSortBy(), ChartOfAccountDetailEntity.class); - } - - String orderBy = "order by chartOfAccountId"; - if (chartOfAccountDetailSearchEntity.getSortBy() != null - && !chartOfAccountDetailSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + chartOfAccountDetailSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", ChartOfAccountDetailEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (chartOfAccountDetailSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", chartOfAccountDetailSearchEntity.getTenantId()); - } - if (chartOfAccountDetailSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", chartOfAccountDetailSearchEntity.getId()); - } - if (chartOfAccountDetailSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(chartOfAccountDetailSearchEntity.getIds().split(",")))); - } - - if (chartOfAccountDetailSearchEntity.getChartOfAccountIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("chartOfAccountId in(:chartOfAccountIds) "); - paramValues.put("chartOfAccountIds", - new ArrayList(Arrays.asList(chartOfAccountDetailSearchEntity.getChartOfAccountIds().split(",")))); - } - if (chartOfAccountDetailSearchEntity.getChartOfAccountId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("chartOfAccountId =:chartOfAccount"); - paramValues.put("chartOfAccount", chartOfAccountDetailSearchEntity.getChartOfAccountId()); - } - if (chartOfAccountDetailSearchEntity.getAccountDetailTypeId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("accountDetailTypeId =:accountDetailType"); - paramValues.put("accountDetailType", chartOfAccountDetailSearchEntity.getAccountDetailTypeId()); - } - - Pagination page = new Pagination<>(); - if (chartOfAccountDetailSearchEntity.getOffset() != null) { - page.setOffset(chartOfAccountDetailSearchEntity.getOffset()); - } - if (chartOfAccountDetailSearchEntity.getPageSize() != null) { - page.setPageSize(chartOfAccountDetailSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(ChartOfAccountDetailEntity.class); - StringBuffer adtIds = new StringBuffer(); - - List chartOfAccountDetailEntities = namedParameterJdbcTemplate - .query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(chartOfAccountDetailEntities.size()); - - List chartofaccountdetails = new ArrayList<>(); - for (ChartOfAccountDetailEntity chartOfAccountDetailEntity : chartOfAccountDetailEntities) { - if (adtIds.length() >= 1) - adtIds.append(","); - - adtIds.append(chartOfAccountDetailEntity.getAccountDetailTypeId()); - chartofaccountdetails.add(chartOfAccountDetailEntity.toDomain()); - } - - populateAccountDetailTypes(chartofaccountdetails, adtIds.toString()); - - page.setPagedData(chartofaccountdetails); - - return page; - } - - private void populateAccountDetailTypes(List chartOfAccountDetails, String adtIds) { - Map adtMap = new HashMap<>(); - String tenantId = null; - AccountDetailTypeSearch search; - search = new AccountDetailTypeSearch(); - - if (chartOfAccountDetails != null && !chartOfAccountDetails.isEmpty()) - tenantId = chartOfAccountDetails.get(0).getTenantId(); - - search.setIds(adtIds); - search.setTenantId(tenantId); - - Pagination adts = accountDetailTypeJdbcRepository.search(search); - - if (adts != null && adts.getPagedData() != null && !adts.getPagedData().isEmpty()) { - - for (AccountDetailType adt : adts.getPagedData()) { - - adtMap.put(adt.getId(), adt); - - } - } - - for (ChartOfAccountDetail coad : chartOfAccountDetails) { - - if (adtMap.get(coad.getId()) != null) { - coad.setAccountDetailType(adtMap.get(coad.getAccountDetailType().getId())); - } - - } - - } - - public ChartOfAccountDetailEntity findById(ChartOfAccountDetailEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List chartofaccountdetails = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(ChartOfAccountDetailEntity.class)); - if (chartofaccountdetails.isEmpty()) { - return null; - } else { - return chartofaccountdetails.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/ChartOfAccountJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/ChartOfAccountJdbcRepository.java deleted file mode 100644 index 76d0f242d95..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/ChartOfAccountJdbcRepository.java +++ /dev/null @@ -1,315 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.persistence.entity.ChartOfAccountEntity; -import org.egov.egf.master.persistence.entity.ChartOfAccountSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class ChartOfAccountJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(ChartOfAccountJdbcRepository.class); - - private final ChartOfAccountDetailJdbcRepository chartOfAccountDetailJdbcRepository; - - static { - LOG.debug("init chartOfAccount"); - init(ChartOfAccountEntity.class); - LOG.debug("end init chartOfAccount"); - } - - public ChartOfAccountJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, - ChartOfAccountDetailJdbcRepository chartOfAccountDetailJdbcRepository) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - this.chartOfAccountDetailJdbcRepository = chartOfAccountDetailJdbcRepository; - } - - public ChartOfAccountEntity create(ChartOfAccountEntity entity) { - super.create(entity); - return entity; - } - - public ChartOfAccountEntity update(ChartOfAccountEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(ChartOfAccountSearch domain) { - ChartOfAccountSearchEntity chartOfAccountSearchEntity = new ChartOfAccountSearchEntity(); - chartOfAccountSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (chartOfAccountSearchEntity.getSortBy() != null && !chartOfAccountSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(chartOfAccountSearchEntity.getSortBy()); - validateEntityFieldName(chartOfAccountSearchEntity.getSortBy(), ChartOfAccountEntity.class); - } - - String orderBy = "order by name"; - if (chartOfAccountSearchEntity.getSortBy() != null && !chartOfAccountSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + chartOfAccountSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", ChartOfAccountEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (chartOfAccountSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", chartOfAccountSearchEntity.getTenantId()); - } - if (chartOfAccountSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", chartOfAccountSearchEntity.getId()); - } - - if (chartOfAccountSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", - new ArrayList(Arrays.asList(chartOfAccountSearchEntity.getIds().split(",")))); - } - - if (chartOfAccountSearchEntity.getGlcode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("glcode like :glcode"); - paramValues.put("glcode", chartOfAccountSearchEntity.getGlcode()); - } - - if (chartOfAccountSearchEntity.getGlcodes() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("glcode in(:glcodes) "); - paramValues.put("glcodes", - new ArrayList(Arrays.asList(chartOfAccountSearchEntity.getGlcodes().split(",")))); - } - - if (chartOfAccountSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", chartOfAccountSearchEntity.getName()); - } - if (chartOfAccountSearchEntity.getAccountCodePurposeId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("accountCodePurposeId =:accountCodePurpose"); - paramValues.put("accountCodePurpose", chartOfAccountSearchEntity.getAccountCodePurposeId()); - } - if (chartOfAccountSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", chartOfAccountSearchEntity.getDescription()); - } - if (chartOfAccountSearchEntity.getIsActiveForPosting() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("isActiveForPosting =:isActiveForPosting"); - paramValues.put("isActiveForPosting", chartOfAccountSearchEntity.getIsActiveForPosting()); - } - if (chartOfAccountSearchEntity.getParentId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("parentId =:parentId"); - paramValues.put("parentId", chartOfAccountSearchEntity.getParentId()); - } - if (chartOfAccountSearchEntity.getType() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("type =:type"); - paramValues.put("type", chartOfAccountSearchEntity.getType()); - } - if (chartOfAccountSearchEntity.getClassification() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("classification =:classification"); - paramValues.put("classification", chartOfAccountSearchEntity.getClassification()); - } - if (chartOfAccountSearchEntity.getFunctionRequired() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("functionRequired =:functionRequired"); - paramValues.put("functionRequired", chartOfAccountSearchEntity.getFunctionRequired()); - } - if (chartOfAccountSearchEntity.getBudgetCheckRequired() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("budgetCheckRequired =:budgetCheckRequired"); - paramValues.put("budgetCheckRequired", chartOfAccountSearchEntity.getBudgetCheckRequired()); - } - if (chartOfAccountSearchEntity.getMajorCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("majorCode =:majorCode"); - paramValues.put("majorCode", chartOfAccountSearchEntity.getMajorCode()); - } - if (chartOfAccountSearchEntity.getIsSubLedger() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("isSubLedger =:isSubLedger"); - paramValues.put("isSubLedger", chartOfAccountSearchEntity.getIsSubLedger()); - } - - Pagination page = new Pagination<>(); - if (chartOfAccountSearchEntity.getOffset() != null) { - page.setOffset(chartOfAccountSearchEntity.getOffset()); - } - if (chartOfAccountSearchEntity.getPageSize() != null) { - page.setPageSize(chartOfAccountSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(ChartOfAccountEntity.class); - - List chartOfAccountEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(chartOfAccountEntities.size()); - - List chartofaccounts = new ArrayList<>(); - StringBuffer coaIds = new StringBuffer(); - - for (ChartOfAccountEntity chartOfAccountEntity : chartOfAccountEntities) { - - if (coaIds.length() >= 1) - coaIds.append(","); - - coaIds.append(chartOfAccountEntity.getId()); - - chartofaccounts.add(chartOfAccountEntity.toDomain()); - } - if (chartofaccounts != null && !chartofaccounts.isEmpty()) { - - populateIsSubLedger(chartofaccounts, coaIds.toString()); - } - page.setPagedData(chartofaccounts); - - return page; - } - - private void populateIsSubLedger(List chartofaccounts, String coaIds) { - Map> coaDetailsMap = new HashMap<>(); - String tenantId = null; - ChartOfAccountDetailSearch search; - search = new ChartOfAccountDetailSearch(); - - if (chartofaccounts != null && !chartofaccounts.isEmpty()) - tenantId = chartofaccounts.get(0).getTenantId(); - - search.setChartOfAccountIds(coaIds); - search.setTenantId(tenantId); - - Pagination coaDetails = chartOfAccountDetailJdbcRepository.search(search); - - if (coaDetails != null && coaDetails.getPagedData() != null && !coaDetails.getPagedData().isEmpty()) { - - for (ChartOfAccountDetail coad : coaDetails.getPagedData()) { - - if (coaDetailsMap.get(coad.getChartOfAccount().getId()) == null) { - - coaDetailsMap.put(coad.getChartOfAccount().getId(), Collections.singletonList(coad)); - - } else { - - List coadList = new ArrayList<>(coaDetailsMap.get(coad.getChartOfAccount().getId())); - - coadList.add(coad); - - coaDetailsMap.put(coad.getChartOfAccount().getId(), coadList); - - } - } - } - - for (ChartOfAccount coa : chartofaccounts) { - - if (coaDetailsMap.get(coa.getId()) != null) { - coa.setChartOfAccountDetails(coaDetailsMap.get(coa.getId())); - coa.setIsSubLedger(true); - } else { - coa.setIsSubLedger(false); - } - - } - - } - - public ChartOfAccountEntity findById(ChartOfAccountEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List chartofaccounts = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(ChartOfAccountEntity.class)); - if (chartofaccounts.isEmpty()) { - return null; - } else { - return chartofaccounts.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialConfigurationJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialConfigurationJdbcRepository.java deleted file mode 100644 index 151e6251199..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialConfigurationJdbcRepository.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.FinancialConfiguration; -import org.egov.egf.master.domain.model.FinancialConfigurationSearch; -import org.egov.egf.master.persistence.entity.FinancialConfigurationEntity; -import org.egov.egf.master.persistence.entity.FinancialConfigurationSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -import java.util.*; - -@Service -public class FinancialConfigurationJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(FinancialConfigurationJdbcRepository.class); - - static { - LOG.debug("init financialConfiguration"); - init(FinancialConfigurationEntity.class); - LOG.debug("end init financialConfiguration"); - } - - public FinancialConfigurationJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public FinancialConfigurationEntity create(FinancialConfigurationEntity entity) { - - entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public FinancialConfigurationEntity update(FinancialConfigurationEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(FinancialConfigurationSearch domain) { - FinancialConfigurationSearchEntity financialConfigurationSearchEntity = new FinancialConfigurationSearchEntity(); - financialConfigurationSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (financialConfigurationSearchEntity.getSortBy() != null - && !financialConfigurationSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(financialConfigurationSearchEntity.getSortBy()); - validateEntityFieldName(financialConfigurationSearchEntity.getSortBy(), FinancialConfigurationEntity.class); - } - - String orderBy = "order by name"; - if (financialConfigurationSearchEntity.getSortBy() != null - && !financialConfigurationSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + financialConfigurationSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", FinancialConfigurationEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (financialConfigurationSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", financialConfigurationSearchEntity.getTenantId()); - } - if (financialConfigurationSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", financialConfigurationSearchEntity.getId()); - } - if (financialConfigurationSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(financialConfigurationSearchEntity.getIds().split(",")))); - } - if (financialConfigurationSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", financialConfigurationSearchEntity.getName()); - } - if (financialConfigurationSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", financialConfigurationSearchEntity.getDescription()); - } - - if (financialConfigurationSearchEntity.getModule() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("module =:module"); - paramValues.put("module", financialConfigurationSearchEntity.getModule()); - } - - Pagination page = new Pagination<>(); - if (financialConfigurationSearchEntity.getOffset() != null) { - page.setOffset(financialConfigurationSearchEntity.getOffset()); - } - if (financialConfigurationSearchEntity.getPageSize() != null) { - page.setPageSize(financialConfigurationSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(FinancialConfigurationEntity.class); - - List financialConfigurationEntities = namedParameterJdbcTemplate - .query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(financialConfigurationEntities.size()); - - List financialconfigurations = new ArrayList<>(); - for (FinancialConfigurationEntity financialConfigurationEntity : financialConfigurationEntities) { - - financialconfigurations.add(financialConfigurationEntity.toDomain()); - } - page.setPagedData(financialconfigurations); - - return page; - } - - public FinancialConfigurationEntity findById(FinancialConfigurationEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List financialconfigurations = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(FinancialConfigurationEntity.class)); - if (financialconfigurations.isEmpty()) { - return null; - } else { - return financialconfigurations.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialConfigurationValueJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialConfigurationValueJdbcRepository.java deleted file mode 100644 index 7ef81ff117f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialConfigurationValueJdbcRepository.java +++ /dev/null @@ -1,173 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.FinancialConfigurationValue; -import org.egov.egf.master.domain.model.FinancialConfigurationValueSearch; -import org.egov.egf.master.persistence.entity.FinancialConfigurationValueEntity; -import org.egov.egf.master.persistence.entity.FinancialConfigurationValueSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class FinancialConfigurationValueJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(FinancialConfigurationValueJdbcRepository.class); - - static { - LOG.debug("init financialConfigurationValue"); - init(FinancialConfigurationValueEntity.class); - LOG.debug("end init financialConfigurationValue"); - } - - public FinancialConfigurationValueJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public FinancialConfigurationValueEntity create(FinancialConfigurationValueEntity entity) { - - entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public FinancialConfigurationValueEntity update(FinancialConfigurationValueEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(FinancialConfigurationValueSearch domain) { - FinancialConfigurationValueSearchEntity financialConfigurationValueSearchEntity = new FinancialConfigurationValueSearchEntity(); - financialConfigurationValueSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (financialConfigurationValueSearchEntity.getSortBy() != null - && !financialConfigurationValueSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(financialConfigurationValueSearchEntity.getSortBy()); - validateEntityFieldName(financialConfigurationValueSearchEntity.getSortBy(), - FinancialConfigurationValueEntity.class); - } - - String orderBy = "order by id"; - if (financialConfigurationValueSearchEntity.getSortBy() != null - && !financialConfigurationValueSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + financialConfigurationValueSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", FinancialConfigurationValueEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (financialConfigurationValueSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", financialConfigurationValueSearchEntity.getTenantId()); - } - if (financialConfigurationValueSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", financialConfigurationValueSearchEntity.getId()); - } - if (financialConfigurationValueSearchEntity.getFinancialConfigurationId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("financialConfigurationId =:financialConfiguration"); - paramValues.put("financialConfiguration", - financialConfigurationValueSearchEntity.getFinancialConfigurationId()); - } - if (financialConfigurationValueSearchEntity.getValue() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("value =:value"); - paramValues.put("value", financialConfigurationValueSearchEntity.getValue()); - } - if (financialConfigurationValueSearchEntity.getEffectiveFrom() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("effectiveFrom =:effectiveFrom"); - paramValues.put("effectiveFrom", financialConfigurationValueSearchEntity.getEffectiveFrom()); - } - - Pagination page = new Pagination<>(); - if (financialConfigurationValueSearchEntity.getOffset() != null) { - page.setOffset(financialConfigurationValueSearchEntity.getOffset()); - } - if (financialConfigurationValueSearchEntity.getPageSize() != null) { - page.setPageSize(financialConfigurationValueSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - - } else - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(FinancialConfigurationValueEntity.class); - - List financialConfigurationValueEntities = namedParameterJdbcTemplate - .query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(financialConfigurationValueEntities.size()); - - List financialconfigurationvalues = new ArrayList<>(); - for (FinancialConfigurationValueEntity financialConfigurationValueEntity : financialConfigurationValueEntities) { - - financialconfigurationvalues.add(financialConfigurationValueEntity.toDomain()); - } - page.setPagedData(financialconfigurationvalues); - - return page; - - } - - public FinancialConfigurationValueEntity findById(FinancialConfigurationValueEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List financialconfigurationvalues = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(FinancialConfigurationValueEntity.class)); - if (financialconfigurationvalues.isEmpty()) { - return null; - } else { - return financialconfigurationvalues.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialStatusJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialStatusJdbcRepository.java deleted file mode 100644 index 1d57e496524..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialStatusJdbcRepository.java +++ /dev/null @@ -1,179 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.FinancialStatus; -import org.egov.egf.master.domain.model.FinancialStatusSearch; -import org.egov.egf.master.persistence.entity.FinancialStatusEntity; -import org.egov.egf.master.persistence.entity.FinancialStatusSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class FinancialStatusJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(FinancialStatusJdbcRepository.class); - - static { - LOG.debug("init financialStatus"); - init(FinancialStatusEntity.class); - LOG.debug("end init financialStatus"); - } - - public FinancialStatusJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public FinancialStatusEntity create(FinancialStatusEntity entity) { - - entity.setId(UUID.randomUUID().toString().replace("-", "")); - super.create(entity); - return entity; - } - - public FinancialStatusEntity update(FinancialStatusEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(FinancialStatusSearch domain) { - FinancialStatusSearchEntity financialStatusSearchEntity = new FinancialStatusSearchEntity(); - financialStatusSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (financialStatusSearchEntity.getSortBy() != null && !financialStatusSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(financialStatusSearchEntity.getSortBy()); - validateEntityFieldName(financialStatusSearchEntity.getSortBy(), FinancialStatusEntity.class); - } - - String orderBy = "order by name"; - if (financialStatusSearchEntity.getSortBy() != null && !financialStatusSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + financialStatusSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", FinancialStatusEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (financialStatusSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", financialStatusSearchEntity.getTenantId()); - } - if (financialStatusSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", financialStatusSearchEntity.getId()); - } - if (financialStatusSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(financialStatusSearchEntity.getIds().split(",")))); - } - if (financialStatusSearchEntity.getModuleType() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("moduleType =:moduleType"); - paramValues.put("moduleType", financialStatusSearchEntity.getModuleType()); - } - if (financialStatusSearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", financialStatusSearchEntity.getCode()); - } - if (financialStatusSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", financialStatusSearchEntity.getDescription()); - } - - Pagination page = new Pagination<>(); - if (financialStatusSearchEntity.getOffset() != null) { - page.setOffset(financialStatusSearchEntity.getOffset()); - } - if (financialStatusSearchEntity.getPageSize() != null) { - page.setPageSize(financialStatusSearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(FinancialStatusEntity.class); - - List financialStatusEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(financialStatusEntities.size()); - - List financialstatuses = new ArrayList<>(); - for (FinancialStatusEntity financialStatusEntity : financialStatusEntities) { - - financialstatuses.add(financialStatusEntity.toDomain()); - } - page.setPagedData(financialstatuses); - - return page; - } - - public FinancialStatusEntity findById(FinancialStatusEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List financialstatuses = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(FinancialStatusEntity.class)); - if (financialstatuses.isEmpty()) { - return null; - } else { - return financialstatuses.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialYearJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialYearJdbcRepository.java deleted file mode 100644 index cd772904798..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FinancialYearJdbcRepository.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.FinancialYear; -import org.egov.egf.master.domain.model.FinancialYearSearch; -import org.egov.egf.master.persistence.entity.FinancialYearEntity; -import org.egov.egf.master.persistence.entity.FinancialYearSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.stereotype.Service; - -@Service -public class FinancialYearJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(FinancialYearJdbcRepository.class); - - static { - LOG.debug("init financialYear"); - init(FinancialYearEntity.class); - LOG.debug("end init financialYear"); - } - - public FinancialYearEntity create(FinancialYearEntity entity) { - super.create(entity); - return entity; - } - - public FinancialYearEntity update(FinancialYearEntity entity) { - super.update(entity); - return entity; - } - - public Pagination search(FinancialYearSearch domain) { - FinancialYearSearchEntity financialYearSearchEntity = new FinancialYearSearchEntity(); - financialYearSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - searchQuery = searchQuery.replace(":tablename", FinancialYearEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - if (financialYearSearchEntity.getSortBy() != null && !financialYearSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(financialYearSearchEntity.getSortBy()); - validateEntityFieldName(financialYearSearchEntity.getSortBy(), FinancialYearEntity.class); - } - - String orderBy = "order by finYearRange asc"; - if (financialYearSearchEntity.getSortBy() != null && !financialYearSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + financialYearSearchEntity.getSortBy(); - } - - // implement jdbc specfic search - if (financialYearSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", financialYearSearchEntity.getTenantId()); - } - if (financialYearSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", financialYearSearchEntity.getId()); - } - if (financialYearSearchEntity.getFinYearRange() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("finYearRange =:finYearRange"); - paramValues.put("finYearRange", financialYearSearchEntity.getFinYearRange()); - } - if (financialYearSearchEntity.getStartingDate() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("startingDate =:startingDate"); - paramValues.put("startingDate", financialYearSearchEntity.getStartingDate()); - } - if (financialYearSearchEntity.getEndingDate() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("endingDate =:endingDate"); - paramValues.put("endingDate", financialYearSearchEntity.getEndingDate()); - } - if (financialYearSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", financialYearSearchEntity.getActive()); - } - if (financialYearSearchEntity.getIsActiveForPosting() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("isActiveForPosting =:isActiveForPosting"); - paramValues.put("isActiveForPosting", financialYearSearchEntity.getIsActiveForPosting()); - } - if (financialYearSearchEntity.getIsClosed() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("isClosed =:isClosed"); - paramValues.put("isClosed", financialYearSearchEntity.getIsClosed()); - } - if (financialYearSearchEntity.getTransferClosingBalance() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("transferClosingBalance =:transferClosingBalance"); - paramValues.put("transferClosingBalance", financialYearSearchEntity.getTransferClosingBalance()); - } - if (financialYearSearchEntity.getAsOnDate() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("startingDate <=:asOnDate and endingDate >= :asOnDate"); - paramValues.put("asOnDate", financialYearSearchEntity.getAsOnDate()); - } - - Pagination page = new Pagination<>(); - if (financialYearSearchEntity.getOffset() != null) { - page.setOffset(financialYearSearchEntity.getOffset()); - } - if (financialYearSearchEntity.getPageSize() != null) { - page.setPageSize(financialYearSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - - } else { - searchQuery = searchQuery.replace(":condition", ""); - } - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(FinancialYearEntity.class); - - List financialYearEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(financialYearEntities.size()); - - List financialyears = new ArrayList<>(); - for (FinancialYearEntity financialYearEntity : financialYearEntities) { - - financialyears.add(financialYearEntity.toDomain()); - } - page.setPagedData(financialyears); - - return page; - } - - public FinancialYearEntity findById(FinancialYearEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List financialyears = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(FinancialYearEntity.class)); - if (financialyears.isEmpty()) { - return null; - } else { - return financialyears.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FiscalPeriodJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FiscalPeriodJdbcRepository.java deleted file mode 100644 index 4b0e86b2835..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FiscalPeriodJdbcRepository.java +++ /dev/null @@ -1,204 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.FiscalPeriod; -import org.egov.egf.master.domain.model.FiscalPeriodSearch; -import org.egov.egf.master.persistence.entity.FiscalPeriodEntity; -import org.egov.egf.master.persistence.entity.FiscalPeriodSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class FiscalPeriodJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(FiscalPeriodJdbcRepository.class); - - static { - LOG.debug("init fiscalPeriod"); - init(FiscalPeriodEntity.class); - LOG.debug("end init fiscalPeriod"); - } - - public FiscalPeriodJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public FiscalPeriodEntity create(FiscalPeriodEntity entity) { - super.create(entity); - return entity; - } - - public FiscalPeriodEntity update(FiscalPeriodEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(FiscalPeriodSearch domain) { - FiscalPeriodSearchEntity fiscalPeriodSearchEntity = new FiscalPeriodSearchEntity(); - fiscalPeriodSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (fiscalPeriodSearchEntity.getSortBy() != null && !fiscalPeriodSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(fiscalPeriodSearchEntity.getSortBy()); - validateEntityFieldName(fiscalPeriodSearchEntity.getSortBy(), FiscalPeriodEntity.class); - } - - String orderBy = "order by name"; - if (fiscalPeriodSearchEntity.getSortBy() != null && !fiscalPeriodSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + fiscalPeriodSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", FiscalPeriodEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (fiscalPeriodSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", fiscalPeriodSearchEntity.getTenantId()); - } - if (fiscalPeriodSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", fiscalPeriodSearchEntity.getId()); - } - if (fiscalPeriodSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(fiscalPeriodSearchEntity.getIds().split(",")))); - } - if (fiscalPeriodSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", fiscalPeriodSearchEntity.getName()); - } - if (fiscalPeriodSearchEntity.getFinancialYearId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("financialYearId =:financialYear"); - paramValues.put("financialYear", fiscalPeriodSearchEntity.getFinancialYearId()); - } - if (fiscalPeriodSearchEntity.getStartingDate() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("startingDate =:startingDate"); - paramValues.put("startingDate", fiscalPeriodSearchEntity.getStartingDate()); - } - if (fiscalPeriodSearchEntity.getEndingDate() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("endingDate =:endingDate"); - paramValues.put("endingDate", fiscalPeriodSearchEntity.getEndingDate()); - } - if (fiscalPeriodSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", fiscalPeriodSearchEntity.getActive()); - } - if (fiscalPeriodSearchEntity.getIsActiveForPosting() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("isActiveForPosting =:isActiveForPosting"); - paramValues.put("isActiveForPosting", fiscalPeriodSearchEntity.getIsActiveForPosting()); - } - if (fiscalPeriodSearchEntity.getIsClosed() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("isClosed =:isClosed"); - paramValues.put("isClosed", fiscalPeriodSearchEntity.getIsClosed()); - } - - Pagination page = new Pagination<>(); - if (fiscalPeriodSearchEntity.getOffset() != null) { - page.setOffset(fiscalPeriodSearchEntity.getOffset()); - } - if (fiscalPeriodSearchEntity.getPageSize() != null) { - page.setPageSize(fiscalPeriodSearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(FiscalPeriodEntity.class); - - List fiscalPeriodEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(fiscalPeriodEntities.size()); - - List fiscalperiods = new ArrayList<>(); - for (FiscalPeriodEntity fiscalPeriodEntity : fiscalPeriodEntities) { - - fiscalperiods.add(fiscalPeriodEntity.toDomain()); - } - page.setPagedData(fiscalperiods); - - return page; - } - - public FiscalPeriodEntity findById(FiscalPeriodEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List fiscalperiods = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(FiscalPeriodEntity.class)); - if (fiscalperiods.isEmpty()) { - return null; - } else { - return fiscalperiods.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FunctionJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FunctionJdbcRepository.java deleted file mode 100644 index 50a09db3031..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FunctionJdbcRepository.java +++ /dev/null @@ -1,188 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.domain.model.FunctionSearch; -import org.egov.egf.master.persistence.entity.FunctionEntity; -import org.egov.egf.master.persistence.entity.FunctionSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class FunctionJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(FunctionJdbcRepository.class); - - static { - LOG.debug("init function"); - init(FunctionEntity.class); - LOG.debug("end init function"); - } - - public FunctionJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public FunctionEntity create(FunctionEntity entity) { - super.create(entity); - return entity; - } - - public FunctionEntity update(FunctionEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(FunctionSearch domain) { - FunctionSearchEntity functionSearchEntity = new FunctionSearchEntity(); - functionSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (functionSearchEntity.getSortBy() != null && !functionSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(functionSearchEntity.getSortBy()); - validateEntityFieldName(functionSearchEntity.getSortBy(), FunctionEntity.class); - } - - String orderBy = "order by name"; - if (functionSearchEntity.getSortBy() != null && !functionSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + functionSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", FunctionEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (functionSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", functionSearchEntity.getTenantId()); - } - if (functionSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", functionSearchEntity.getId()); - } - if (functionSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(functionSearchEntity.getIds().split(",")))); - } - if (functionSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", functionSearchEntity.getName()); - } - if (functionSearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", functionSearchEntity.getCode()); - } - if (functionSearchEntity.getLevel() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("level =:level"); - paramValues.put("level", functionSearchEntity.getLevel()); - } - if (functionSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", functionSearchEntity.getActive()); - } - if (functionSearchEntity.getParentId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("parentId =:parentId"); - paramValues.put("parentId", functionSearchEntity.getParentId()); - } - - Pagination page = new Pagination<>(); - if (functionSearchEntity.getOffset() != null) { - page.setOffset(functionSearchEntity.getOffset()); - } - if (functionSearchEntity.getPageSize() != null) { - page.setPageSize(functionSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(FunctionEntity.class); - - List functionEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), paramValues, - row); - - page.setTotalResults(functionEntities.size()); - - List functions = new ArrayList<>(); - for (FunctionEntity functionEntity : functionEntities) { - - functions.add(functionEntity.toDomain()); - } - page.setPagedData(functions); - - return page; - } - - public FunctionEntity findById(FunctionEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List functions = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(FunctionEntity.class)); - if (functions.isEmpty()) { - return null; - } else { - return functions.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FunctionaryJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FunctionaryJdbcRepository.java deleted file mode 100644 index 93cda70839c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FunctionaryJdbcRepository.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.Functionary; -import org.egov.egf.master.domain.model.FunctionarySearch; -import org.egov.egf.master.persistence.entity.FunctionaryEntity; -import org.egov.egf.master.persistence.entity.FunctionarySearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class FunctionaryJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(FunctionaryJdbcRepository.class); - - static { - LOG.debug("init functionary"); - init(FunctionaryEntity.class); - LOG.debug("end init functionary"); - } - - public FunctionaryJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public FunctionaryEntity create(FunctionaryEntity entity) { - super.create(entity); - return entity; - } - - public FunctionaryEntity update(FunctionaryEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(FunctionarySearch domain) { - FunctionarySearchEntity functionarySearchEntity = new FunctionarySearchEntity(); - functionarySearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (functionarySearchEntity.getSortBy() != null && !functionarySearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(functionarySearchEntity.getSortBy()); - validateEntityFieldName(functionarySearchEntity.getSortBy(), FunctionaryEntity.class); - } - - String orderBy = "order by name"; - if (functionarySearchEntity.getSortBy() != null && !functionarySearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + functionarySearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", FunctionaryEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (functionarySearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", functionarySearchEntity.getTenantId()); - } - if (functionarySearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", functionarySearchEntity.getId()); - } - if (functionarySearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(functionarySearchEntity.getIds().split(",")))); - } - if (functionarySearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", functionarySearchEntity.getCode()); - } - if (functionarySearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", functionarySearchEntity.getName()); - } - if (functionarySearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", functionarySearchEntity.getActive()); - } - - Pagination page = new Pagination<>(); - if (functionarySearchEntity.getOffset() != null) { - page.setOffset(functionarySearchEntity.getOffset()); - } - if (functionarySearchEntity.getPageSize() != null) { - page.setPageSize(functionarySearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(FunctionaryEntity.class); - - List functionaryEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(functionaryEntities.size()); - - List functionaries = new ArrayList<>(); - for (FunctionaryEntity functionaryEntity : functionaryEntities) { - - functionaries.add(functionaryEntity.toDomain()); - } - page.setPagedData(functionaries); - - return page; - } - - public FunctionaryEntity findById(FunctionaryEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List functionaries = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(FunctionaryEntity.class)); - if (functionaries.isEmpty()) { - return null; - } else { - return functionaries.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FundJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FundJdbcRepository.java deleted file mode 100644 index bc1333d168d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FundJdbcRepository.java +++ /dev/null @@ -1,184 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.FundSearch; -import org.egov.egf.master.persistence.entity.FundEntity; -import org.egov.egf.master.persistence.entity.FundSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class FundJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(FundJdbcRepository.class); - - static { - LOG.debug("init fund"); - init(FundEntity.class); - LOG.debug("end init fund"); - } - - public FundJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public FundEntity create(FundEntity entity) { - super.create(entity); - return entity; - } - - public FundEntity update(FundEntity entity) { - super.update(entity); - return entity; - - } - public boolean delete(FundEntity entity,String reason) { - super.delete(entity, reason); - return true; - - } - - public Pagination search(FundSearch domain) { - FundSearchEntity fundSearchEntity = new FundSearchEntity(); - fundSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (fundSearchEntity.getSortBy() != null && !fundSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(fundSearchEntity.getSortBy()); - validateEntityFieldName(fundSearchEntity.getSortBy(), FundEntity.class); - } - - String orderBy = "order by name"; - if (fundSearchEntity.getSortBy() != null && !fundSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + fundSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", FundEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (fundSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", fundSearchEntity.getTenantId()); - } - if (fundSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", fundSearchEntity.getId()); - } - if (fundSearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", fundSearchEntity.getCode()); - } - if (fundSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", fundSearchEntity.getName()); - } - if (fundSearchEntity.getIdentifier() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", fundSearchEntity.getIdentifier()); - } - if (fundSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", fundSearchEntity.getActive()); - } - if (fundSearchEntity.getLevel() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("type =:type"); - paramValues.put("type", fundSearchEntity.getLevel()); - } - - Pagination page = new Pagination<>(); - if (fundSearchEntity.getOffset() != null) { - page.setOffset(fundSearchEntity.getOffset()); - } - if (fundSearchEntity.getPageSize() != null) { - page.setPageSize(fundSearchEntity.getPageSize()); - } - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(FundEntity.class); - - List fundEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(fundEntities.size()); - - List funds = new ArrayList<>(); - for (FundEntity fundEntity : fundEntities) { - - funds.add(fundEntity.toDomain()); - } - page.setPagedData(funds); - - return page; - } - - public FundEntity findById(FundEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List funds = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(FundEntity.class)); - if (funds.isEmpty()) { - return null; - } else { - return funds.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FundsourceJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FundsourceJdbcRepository.java deleted file mode 100644 index aceb5788bf2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/FundsourceJdbcRepository.java +++ /dev/null @@ -1,204 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.Fundsource; -import org.egov.egf.master.domain.model.FundsourceSearch; -import org.egov.egf.master.persistence.entity.FundsourceEntity; -import org.egov.egf.master.persistence.entity.FundsourceSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class FundsourceJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(FundsourceJdbcRepository.class); - - static { - LOG.debug("init fundsource"); - init(FundsourceEntity.class); - LOG.debug("end init fundsource"); - } - - public FundsourceJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public FundsourceEntity create(FundsourceEntity entity) { - super.create(entity); - return entity; - } - - public FundsourceEntity update(FundsourceEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(FundsourceSearch domain) { - FundsourceSearchEntity fundsourceSearchEntity = new FundsourceSearchEntity(); - fundsourceSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (fundsourceSearchEntity.getSortBy() != null && !fundsourceSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(fundsourceSearchEntity.getSortBy()); - validateEntityFieldName(fundsourceSearchEntity.getSortBy(), FundsourceEntity.class); - } - - String orderBy = "order by name"; - if (fundsourceSearchEntity.getSortBy() != null && !fundsourceSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + fundsourceSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", FundsourceEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (fundsourceSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", fundsourceSearchEntity.getTenantId()); - } - if (fundsourceSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", fundsourceSearchEntity.getId()); - } - if (fundsourceSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(fundsourceSearchEntity.getIds().split(",")))); - } - if (fundsourceSearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", fundsourceSearchEntity.getCode()); - } - if (fundsourceSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", fundsourceSearchEntity.getName()); - } - if (fundsourceSearchEntity.getType() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("type =:type"); - paramValues.put("type", fundsourceSearchEntity.getType()); - } - if (fundsourceSearchEntity.getParentId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("parentId =:fundSource"); - paramValues.put("fundSource", fundsourceSearchEntity.getParentId()); - } - if (fundsourceSearchEntity.getLlevel() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("llevel =:llevel"); - paramValues.put("llevel", fundsourceSearchEntity.getLlevel()); - } - if (fundsourceSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", fundsourceSearchEntity.getActive()); - } - if (fundsourceSearchEntity.getIsParent() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("isParent =:isParent"); - paramValues.put("isParent", fundsourceSearchEntity.getIsParent()); - } - - Pagination page = new Pagination<>(); - if (fundsourceSearchEntity.getOffset() != null) { - page.setOffset(fundsourceSearchEntity.getOffset()); - } - if (fundsourceSearchEntity.getPageSize() != null) { - page.setPageSize(fundsourceSearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(FundsourceEntity.class); - - List fundsourceEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), - paramValues, row); - - page.setTotalResults(fundsourceEntities.size()); - - List fundsources = new ArrayList<>(); - for (FundsourceEntity fundsourceEntity : fundsourceEntities) { - - fundsources.add(fundsourceEntity.toDomain()); - } - page.setPagedData(fundsources); - - return page; - } - - public FundsourceEntity findById(FundsourceEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List fundsources = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(FundsourceEntity.class)); - if (fundsources.isEmpty()) { - return null; - } else { - return fundsources.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/RecoveryJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/RecoveryJdbcRepository.java deleted file mode 100644 index fc04e1fe51b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/RecoveryJdbcRepository.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.Recovery; -import org.egov.egf.master.domain.model.RecoverySearch; -import org.egov.egf.master.persistence.entity.FundEntity; -import org.egov.egf.master.persistence.entity.RecoveryEntity; -import org.egov.egf.master.persistence.entity.RecoverySearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Repository -public class RecoveryJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(RecoveryJdbcRepository.class); - - static { - LOG.debug("init recovery"); - init(RecoveryEntity.class); - LOG.debug("end init recovery"); - } - - public RecoveryJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public RecoveryEntity create(RecoveryEntity entity) { - super.create(entity); - return entity; - } - - public RecoveryEntity update(RecoveryEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(RecoverySearch domain) { - RecoverySearchEntity recoverySearchEntity = new RecoverySearchEntity(); - recoverySearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (recoverySearchEntity.getSortBy() != null && !recoverySearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(recoverySearchEntity.getSortBy()); - validateEntityFieldName(recoverySearchEntity.getSortBy(), RecoveryEntity.class); - } - - String orderBy = "order by name"; - if (recoverySearchEntity.getSortBy() != null && !recoverySearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + recoverySearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", RecoveryEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (recoverySearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", recoverySearchEntity.getTenantId()); - } - if (recoverySearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", recoverySearchEntity.getId()); - } - if (recoverySearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", recoverySearchEntity.getCode()); - } - if (recoverySearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", recoverySearchEntity.getName()); - } - if (recoverySearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", recoverySearchEntity.getActive()); - } - - Pagination page = new Pagination<>(); - if (recoverySearchEntity.getOffset() != null) { - page.setOffset(recoverySearchEntity.getOffset()); - } - if (recoverySearchEntity.getPageSize() != null) { - page.setPageSize(recoverySearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(RecoveryEntity.class); - - List recoveryEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(recoveryEntities.size()); - - List recoveries = new ArrayList<>(); - for (RecoveryEntity recoveryEntity : recoveryEntities) { - - recoveries.add(recoveryEntity.toDomain()); - } - page.setPagedData(recoveries); - - return page; - } - - public RecoveryEntity findById(RecoveryEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List recovery = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(RecoveryEntity.class)); - if (recovery.isEmpty()) { - return null; - } else { - return recovery.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/SchemeJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/SchemeJdbcRepository.java deleted file mode 100644 index cd4b5f44938..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/SchemeJdbcRepository.java +++ /dev/null @@ -1,210 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.Scheme; -import org.egov.egf.master.domain.model.SchemeSearch; -import org.egov.egf.master.persistence.entity.SchemeEntity; -import org.egov.egf.master.persistence.entity.SchemeSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class SchemeJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(SchemeJdbcRepository.class); - - static { - LOG.debug("init scheme"); - init(SchemeEntity.class); - LOG.debug("end init scheme"); - } - - public SchemeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public SchemeEntity create(SchemeEntity entity) { - super.create(entity); - return entity; - } - - public SchemeEntity update(SchemeEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(SchemeSearch domain) { - SchemeSearchEntity schemeSearchEntity = new SchemeSearchEntity(); - schemeSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (schemeSearchEntity.getSortBy() != null && !schemeSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(schemeSearchEntity.getSortBy()); - validateEntityFieldName(schemeSearchEntity.getSortBy(), SchemeEntity.class); - } - - String orderBy = "order by name"; - if (schemeSearchEntity.getSortBy() != null && !schemeSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + schemeSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", SchemeEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (schemeSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", schemeSearchEntity.getTenantId()); - } - if (schemeSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", schemeSearchEntity.getId()); - } - if (schemeSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(schemeSearchEntity.getIds().split(",")))); - } - if (schemeSearchEntity.getFundId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("fundId =:fund"); - paramValues.put("fund", schemeSearchEntity.getFundId()); - } - if (schemeSearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", schemeSearchEntity.getCode()); - } - if (schemeSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", schemeSearchEntity.getName()); - } - if (schemeSearchEntity.getValidFrom() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("validFrom =:validFrom"); - paramValues.put("validFrom", schemeSearchEntity.getValidFrom()); - } - if (schemeSearchEntity.getValidTo() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("validTo =:validTo"); - paramValues.put("validTo", schemeSearchEntity.getValidTo()); - } - if (schemeSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", schemeSearchEntity.getActive()); - } - if (schemeSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", schemeSearchEntity.getDescription()); - } - if (schemeSearchEntity.getBoundary() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("boundary =:boundary"); - paramValues.put("boundary", schemeSearchEntity.getBoundary()); - } - - Pagination page = new Pagination<>(); - if (schemeSearchEntity.getOffset() != null) { - page.setOffset(schemeSearchEntity.getOffset()); - } - if (schemeSearchEntity.getPageSize() != null) { - page.setPageSize(schemeSearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(SchemeEntity.class); - - List schemeEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), paramValues, row); - - page.setTotalResults(schemeEntities.size()); - - List schemes = new ArrayList<>(); - for (SchemeEntity schemeEntity : schemeEntities) { - - schemes.add(schemeEntity.toDomain()); - } - page.setPagedData(schemes); - - return page; - } - - public SchemeEntity findById(SchemeEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List schemes = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(SchemeEntity.class)); - if (schemes.isEmpty()) { - return null; - } else { - return schemes.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/SubSchemeJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/SubSchemeJdbcRepository.java deleted file mode 100644 index a081da73889..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/SubSchemeJdbcRepository.java +++ /dev/null @@ -1,204 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.SubScheme; -import org.egov.egf.master.domain.model.SubSchemeSearch; -import org.egov.egf.master.persistence.entity.SubSchemeEntity; -import org.egov.egf.master.persistence.entity.SubSchemeSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class SubSchemeJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(SubSchemeJdbcRepository.class); - - static { - LOG.debug("init subScheme"); - init(SubSchemeEntity.class); - LOG.debug("end init subScheme"); - } - - public SubSchemeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public SubSchemeEntity create(SubSchemeEntity entity) { - super.create(entity); - return entity; - } - - public SubSchemeEntity update(SubSchemeEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(SubSchemeSearch domain) { - SubSchemeSearchEntity subSchemeSearchEntity = new SubSchemeSearchEntity(); - subSchemeSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (subSchemeSearchEntity.getSortBy() != null && !subSchemeSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(subSchemeSearchEntity.getSortBy()); - validateEntityFieldName(subSchemeSearchEntity.getSortBy(), SubSchemeEntity.class); - } - - String orderBy = "order by name"; - if (subSchemeSearchEntity.getSortBy() != null && !subSchemeSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + subSchemeSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", SubSchemeEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (subSchemeSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", subSchemeSearchEntity.getTenantId()); - } - if (subSchemeSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", subSchemeSearchEntity.getId()); - } - if (subSchemeSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(subSchemeSearchEntity.getIds().split(",")))); - } - if (subSchemeSearchEntity.getSchemeId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("schemeId =:scheme"); - paramValues.put("scheme", subSchemeSearchEntity.getSchemeId()); - } - if (subSchemeSearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", subSchemeSearchEntity.getCode()); - } - if (subSchemeSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", subSchemeSearchEntity.getName()); - } - if (subSchemeSearchEntity.getValidFrom() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("validFrom =:validFrom"); - paramValues.put("validFrom", subSchemeSearchEntity.getValidFrom()); - } - if (subSchemeSearchEntity.getValidTo() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("validTo =:validTo"); - paramValues.put("validTo", subSchemeSearchEntity.getValidTo()); - } - if (subSchemeSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", subSchemeSearchEntity.getActive()); - } - if (subSchemeSearchEntity.getDepartmentId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("departmentId =:departmentId"); - paramValues.put("departmentId", subSchemeSearchEntity.getDepartmentId()); - } - - Pagination page = new Pagination<>(); - if (subSchemeSearchEntity.getOffset() != null) { - page.setOffset(subSchemeSearchEntity.getOffset()); - } - if (subSchemeSearchEntity.getPageSize() != null) { - page.setPageSize(subSchemeSearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(SubSchemeEntity.class); - - List subSchemeEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), paramValues, - row); - - page.setTotalResults(subSchemeEntities.size()); - - List subschemes = new ArrayList<>(); - for (SubSchemeEntity subSchemeEntity : subSchemeEntities) { - - subschemes.add(subSchemeEntity.toDomain()); - } - page.setPagedData(subschemes); - - return page; - } - - public SubSchemeEntity findById(SubSchemeEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List subschemes = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(SubSchemeEntity.class)); - if (subschemes.isEmpty()) { - return null; - } else { - return subschemes.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/SupplierJdbcRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/SupplierJdbcRepository.java deleted file mode 100644 index 2daac1d2019..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/persistence/repository/SupplierJdbcRepository.java +++ /dev/null @@ -1,246 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.persistence.repository.JdbcRepository; -import org.egov.egf.master.domain.model.Supplier; -import org.egov.egf.master.domain.model.SupplierSearch; -import org.egov.egf.master.persistence.entity.SupplierEntity; -import org.egov.egf.master.persistence.entity.SupplierSearchEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Service; - -@Service -public class SupplierJdbcRepository extends JdbcRepository { - private static final Logger LOG = LoggerFactory.getLogger(SupplierJdbcRepository.class); - - static { - LOG.debug("init supplier"); - init(SupplierEntity.class); - LOG.debug("end init supplier"); - } - - public SupplierJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate) { - this.namedParameterJdbcTemplate = namedParameterJdbcTemplate; - } - - public SupplierEntity create(SupplierEntity entity) { - super.create(entity); - return entity; - } - - public SupplierEntity update(SupplierEntity entity) { - super.update(entity); - return entity; - - } - - public Pagination search(SupplierSearch domain) { - SupplierSearchEntity supplierSearchEntity = new SupplierSearchEntity(); - supplierSearchEntity.toEntity(domain); - - String searchQuery = "select :selectfields from :tablename :condition :orderby "; - - Map paramValues = new HashMap<>(); - StringBuffer params = new StringBuffer(); - - if (supplierSearchEntity.getSortBy() != null && !supplierSearchEntity.getSortBy().isEmpty()) { - validateSortByOrder(supplierSearchEntity.getSortBy()); - validateEntityFieldName(supplierSearchEntity.getSortBy(), SupplierEntity.class); - } - - String orderBy = "order by name"; - if (supplierSearchEntity.getSortBy() != null && !supplierSearchEntity.getSortBy().isEmpty()) { - orderBy = "order by " + supplierSearchEntity.getSortBy(); - } - - searchQuery = searchQuery.replace(":tablename", SupplierEntity.TABLE_NAME); - - searchQuery = searchQuery.replace(":selectfields", " * "); - - // implement jdbc specfic search - if (supplierSearchEntity.getTenantId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tenantId =:tenantId"); - paramValues.put("tenantId", supplierSearchEntity.getTenantId()); - } - if (supplierSearchEntity.getId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id =:id"); - paramValues.put("id", supplierSearchEntity.getId()); - } - if (supplierSearchEntity.getIds() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("id in(:ids) "); - paramValues.put("ids", new ArrayList(Arrays.asList(supplierSearchEntity.getIds().split(",")))); - } - if (supplierSearchEntity.getCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("code =:code"); - paramValues.put("code", supplierSearchEntity.getCode()); - } - if (supplierSearchEntity.getName() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("name =:name"); - paramValues.put("name", supplierSearchEntity.getName()); - } - if (supplierSearchEntity.getAddress() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("address =:address"); - paramValues.put("address", supplierSearchEntity.getAddress()); - } - if (supplierSearchEntity.getMobile() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("mobile =:mobile"); - paramValues.put("mobile", supplierSearchEntity.getMobile()); - } - if (supplierSearchEntity.getEmail() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("email =:email"); - paramValues.put("email", supplierSearchEntity.getEmail()); - } - if (supplierSearchEntity.getDescription() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("description =:description"); - paramValues.put("description", supplierSearchEntity.getDescription()); - } - if (supplierSearchEntity.getActive() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("active =:active"); - paramValues.put("active", supplierSearchEntity.getActive()); - } - if (supplierSearchEntity.getPanNo() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("panNo =:panNo"); - paramValues.put("panNo", supplierSearchEntity.getPanNo()); - } - if (supplierSearchEntity.getTinNo() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("tinNo =:tinNo"); - paramValues.put("tinNo", supplierSearchEntity.getTinNo()); - } - if (supplierSearchEntity.getRegistationNo() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("registationNo =:registationNo"); - paramValues.put("registationNo", supplierSearchEntity.getRegistationNo()); - } - if (supplierSearchEntity.getBankAccountId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("bankAccountId =:bankAccount"); - paramValues.put("bankAccount", supplierSearchEntity.getBankAccountId()); - } - if (supplierSearchEntity.getIfscCode() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("ifscCode =:ifscCode"); - paramValues.put("ifscCode", supplierSearchEntity.getIfscCode()); - } - if (supplierSearchEntity.getBankId() != null) { - if (params.length() > 0) { - params.append(" and "); - } - params.append("bankId =:bank"); - paramValues.put("bank", supplierSearchEntity.getBankId()); - } - - Pagination page = new Pagination<>(); - if (supplierSearchEntity.getOffset() != null) { - page.setOffset(supplierSearchEntity.getOffset()); - } - if (supplierSearchEntity.getPageSize() != null) { - page.setPageSize(supplierSearchEntity.getPageSize()); - } - - - if (params.length() > 0) { - - searchQuery = searchQuery.replace(":condition", " where " + - params.toString()); - - } else - - searchQuery = searchQuery.replace(":condition", ""); - - searchQuery = searchQuery.replace(":orderby", orderBy); - - page = (Pagination) getPagination(searchQuery, page, paramValues); - searchQuery = searchQuery + " :pagination"; - - searchQuery = searchQuery.replace(":pagination", - "limit " + page.getPageSize() + " offset " + page.getOffset() * page.getPageSize()); - - BeanPropertyRowMapper row = new BeanPropertyRowMapper(SupplierEntity.class); - - List supplierEntities = namedParameterJdbcTemplate.query(searchQuery.toString(), paramValues, - row); - - page.setTotalResults(supplierEntities.size()); - - List suppliers = new ArrayList<>(); - for (SupplierEntity supplierEntity : supplierEntities) { - - suppliers.add(supplierEntity.toDomain()); - } - page.setPagedData(suppliers); - - return page; - } - - public SupplierEntity findById(SupplierEntity entity) { - List list = allIdentitiferFields.get(entity.getClass().getSimpleName()); - - Map paramValues = new HashMap<>(); - - for (String s : list) { - paramValues.put(s, getValue(getField(entity, s), entity)); - } - - List suppliers = namedParameterJdbcTemplate.query( - getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, - new BeanPropertyRowMapper(SupplierEntity.class)); - if (suppliers.isEmpty()) { - return null; - } else { - return suppliers.get(0); - } - - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/advice/CustomControllerAdvice.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/advice/CustomControllerAdvice.java deleted file mode 100644 index a137313a1bd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/advice/CustomControllerAdvice.java +++ /dev/null @@ -1,200 +0,0 @@ -package org.egov.egf.master.web.advice; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.Error; -import org.egov.common.contract.response.ErrorField; -import org.egov.common.contract.response.ErrorResponse; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.ErrorCode; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.exception.UnauthorizedAccessException; -import org.egov.common.persistence.repository.JdbcRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.MissingServletRequestParameterException; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; - -@ControllerAdvice -@RestController -public class CustomControllerAdvice { - - private static final Logger LOG = LoggerFactory.getLogger(CustomControllerAdvice.class); - - @ResponseStatus(HttpStatus.BAD_REQUEST) - @ExceptionHandler(MissingServletRequestParameterException.class) - public String handleMissingParamsError(Exception ex) { - return ex.getMessage(); - } - - @ResponseStatus(HttpStatus.BAD_REQUEST) - @ExceptionHandler(CustomBindException.class) - public org.egov.common.web.contract.ErrorResponse handleBindingErrors(CustomBindException ex) { - org.egov.common.web.contract.ErrorResponse errRes = new org.egov.common.web.contract.ErrorResponse(); - //errRes.setErrors(new ArrayList<>()); - BindingResult errors = ex.getErrors(); - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.BAD_REQUEST.toString()); - errRes.setResponseInfo(responseInfo); - org.egov.common.web.contract.Error error = new org.egov.common.web.contract.Error(); - if (errors.getGlobalError() != null) { - if (errors.getGlobalError().getCode() != null) { - error.setCode(errors.getGlobalError().getCode()); - error.setMessage(errors.getGlobalError().getObjectName()); - error.setDescription(errors.getGlobalError().getDefaultMessage()); - } else if (ErrorCode.getError(errors.getGlobalError().getCode()) != null) { - error.setCode(ErrorCode.getError(errors.getGlobalError().getDefaultMessage()).getCode()); - String message = MessageFormat.format( - ErrorCode.getError(errors.getGlobalError().getDefaultMessage()).getMessage(), - errors.getGlobalError().getObjectName()); - error.setMessage(message); - String desc = MessageFormat.format( - ErrorCode.getError(errors.getGlobalError().getDefaultMessage()).getDescription(), - errors.getGlobalError().getObjectName()); - error.setDescription(desc); - } - errRes.getErrors().add(error); - - } - /*if (errors.getFieldErrorCount() > 0) { - error.setDescription("Validation errors"); - } - */ - - if (errors.hasFieldErrors()) { - List fieldErrors = errors.getFieldErrors(); - for (org.springframework.validation.FieldError errs : fieldErrors) { - org.egov.common.web.contract.Error err = new org.egov.common.web.contract.Error(); - if (ErrorCode.getError(errs.getCode()) != null) { - err.setCode(errs.getCode()); - String message = MessageFormat.format(ErrorCode.getError(errs.getCode()).getMessage(), - errs.getField(), errs.getRejectedValue()); - err.setMessage(message); - String desc = MessageFormat.format(ErrorCode.getError(errs.getCode()).getDescription(), - errs.getField(), errs.getRejectedValue()); - err.setDescription(desc); - err.getParams().add(errs.getField()); - err.getParams().add((String)errs.getRejectedValue()); - } else { - err.setCode(errs.getCode()); - err.setMessage(errs.getDefaultMessage()); - err.setDescription(errs.getField()); - } - errRes.getErrors().add(err); - } - - } - - return errRes; - } - - - - @ResponseStatus(HttpStatus.BAD_REQUEST) - @ExceptionHandler(InvalidDataException.class) - public org.egov.common.web.contract.ErrorResponse handleBindingErrors(InvalidDataException ex) { - org.egov.common.web.contract.ErrorResponse errRes = new org.egov.common.web.contract.ErrorResponse(); - - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.BAD_REQUEST.toString()); - errRes.setResponseInfo(responseInfo); - org.egov.common.web.contract.Error error = new org.egov.common.web.contract.Error(); - error.setCode(ex.getMessageKey()); - System.out.println(ErrorCode.getError("non.unique.value")); - if (ErrorCode.getError(ex.getMessageKey()) != null) { - String message = MessageFormat.format(ErrorCode.getError(ex.getMessageKey()).getMessage(), - ex.getFieldName(), ex.getFieldValue()); - error.setMessage(message); - String desc = MessageFormat.format(ErrorCode.getError(ex.getMessageKey()).getDescription(), - ex.getFieldName(), ex.getFieldValue()); - error.setDescription(desc); - } else { - LOG.warn("error code is not defined for " + ex.getMessageKey()); - } - List errors = new ArrayList(); - errors.add(error); - errRes.setErrors(errors); - return errRes; - } - - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - @ExceptionHandler(org.apache.kafka.common.errors.TimeoutException.class) - public org.egov.common.web.contract.ErrorResponse handleThrowable( - org.apache.kafka.common.errors.TimeoutException ex) { - org.egov.common.web.contract.ErrorResponse errRes = new org.egov.common.web.contract.ErrorResponse(); - ex.printStackTrace(); - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.toString()); - errRes.setResponseInfo(responseInfo); - org.egov.common.web.contract.Error error = new org.egov.common.web.contract.Error(); - - error.setCode(ErrorCode.KAFKA_TIMEOUT_ERROR.getCode()); - error.setMessage(ErrorCode.KAFKA_TIMEOUT_ERROR.getMessage()); - error.setDescription(ErrorCode.KAFKA_TIMEOUT_ERROR.getDescription()); - List errors = new ArrayList(); - errors.add(error); - errRes.setErrors(errors); - return errRes; - } - - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - @ExceptionHandler(Throwable.class) - public ErrorResponse handleThrowable(Exception ex) { - ErrorResponse errRes = new ErrorResponse(); - ex.printStackTrace(); - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.toString()); - errRes.setResponseInfo(responseInfo); - Error error = new Error(); - - error.setCode(500); - error.setMessage("Internal Server Error"); - error.setDescription(ex.getMessage()); - return errRes; - } - - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - @ExceptionHandler(Exception.class) - public ErrorResponse handleServerError(Exception ex) { - ex.printStackTrace(); - ErrorResponse errRes = new ErrorResponse(); - - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.toString()); - errRes.setResponseInfo(responseInfo); - Error error = new Error(); - - error.setCode(500); - error.setMessage("Internal Server Error"); - error.setDescription(ex.getMessage()); - errRes.setError(error); - return errRes; - } - - @ResponseStatus(HttpStatus.UNAUTHORIZED) - @ExceptionHandler(UnauthorizedAccessException.class) - public ErrorResponse handleAuthenticationError(UnauthorizedAccessException ex) { - ex.printStackTrace(); - ErrorResponse errRes = new ErrorResponse(); - - ResponseInfo responseInfo = new ResponseInfo(); - responseInfo.setStatus(HttpStatus.UNAUTHORIZED.toString()); - errRes.setResponseInfo(responseInfo); - Error error = new Error(); - - error.setCode(404); - error.setMessage("Un Authorized Access"); - error.setDescription(ex.getMessage()); - errRes.setError(error); - return errRes; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountCodePurposeContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountCodePurposeContract.java deleted file mode 100644 index 7c5f4441780..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountCodePurposeContract.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id","name"}) -public class AccountCodePurposeContract extends AuditableContract { - - private String id; - - @NotNull - @Length(max = 256, min = 3) - private String name; - - public AccountCodePurposeContract(String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountCodePurposeSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountCodePurposeSearchContract.java deleted file mode 100644 index 7acf81c1bca..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountCodePurposeSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountCodePurposeSearchContract extends AccountCodePurposeContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailKeyContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailKeyContract.java deleted file mode 100644 index 14df97b49ef..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailKeyContract.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "key", "accountDetailType" }) -public class AccountDetailKeyContract extends AuditableContract { - - private String id; - - @NotNull - private String key; - - @NotNull - private AccountDetailTypeContract accountDetailType; - - public AccountDetailKeyContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailKeySearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailKeySearchContract.java deleted file mode 100644 index 71ebad05991..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailKeySearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountDetailKeySearchContract extends AccountDetailKeyContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailTypeContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailTypeContract.java deleted file mode 100644 index ecf6de00abc..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailTypeContract.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "description", "tableName", "active", "fullyQualifiedName" }) -public class AccountDetailTypeContract extends AuditableContract { - - private String id; - - @NotNull - @Length(max = 50, min = 1) - private String name; - - @NotNull - @Length(max = 50, min = 1) - private String description; - - @Length(max = 25) - private String tableName; - - @NotNull - private Boolean active; - - @Length(max = 250, min = 1) - private String fullyQualifiedName; - - public AccountDetailTypeContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailTypeSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailTypeSearchContract.java deleted file mode 100644 index 0debf5ac3db..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountDetailTypeSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountDetailTypeSearchContract extends AccountDetailTypeContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountEntityContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountEntityContract.java deleted file mode 100644 index 08b6d6db779..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountEntityContract.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "accountDetailType", "code", "name", "active", "description" }) -public class AccountEntityContract extends AuditableContract { - - private String id; - - @NotNull - private AccountDetailTypeContract accountDetailType; - - @NotNull - @Length(max = 25, min = 1) - private String code; - - @NotNull - @Length(max = 350, min = 1) - private String name; - - @NotNull - private Boolean active; - - @Length(max = 256) - private String description; - - public AccountEntityContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountEntitySearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountEntitySearchContract.java deleted file mode 100644 index 43503f53cf2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/AccountEntitySearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class AccountEntitySearchContract extends AccountEntityContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankAccountContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankAccountContract.java deleted file mode 100644 index ac00f38c5a5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankAccountContract.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.egov.egf.master.web.contract.enums.BankAccountTypeContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "bankBranch", "chartOfAccount", "fund", "accountNumber", "accountType", "description", - "active", "payTo", "type" }) -public class BankAccountContract extends AuditableContract { - - private String id; - - @NotNull - private BankBranchContract bankBranch; - - @NotNull - private ChartOfAccountContract chartOfAccount; - - @NotNull - private FundContract fund; - - @NotNull - @Length(max = 25) - private String accountNumber; - - // is this required ? - private String accountType; - - @Length(max = 256) - private String description; - - @NotNull - private Boolean active; - - @Length(max = 100) - private String payTo; - - @NotNull - private BankAccountTypeContract type; - - public BankAccountContract(String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankAccountSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankAccountSearchContract.java deleted file mode 100644 index 633aab12dcd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankAccountSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BankAccountSearchContract extends BankAccountContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankBranchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankBranchContract.java deleted file mode 100644 index b82b87efeb4..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankBranchContract.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "bank", "code", "name", "address", "address2", "city", "state", "pincode", "phone", "fax", - "contactPerson", "active", "description", "micr" }) -public class BankBranchContract extends AuditableContract { - - private String id; - - @NotNull - private BankContract bank; - - @NotNull - @Length(max = 50, min = 1) - private String code; - - @NotNull - @Length(max = 50, min = 1) - @Pattern(regexp = "^[a-zA-Z0-9_]*$") - private String name; - - @NotNull - @Length(max = 50, min = 1) - private String address; - - @Length(max = 50) - private String address2; - - @Length(max = 50) - private String city; - - @Length(max = 50) - private String state; - - @Length(max = 50) - private String pincode; - - @Length(max = 15) - private String phone; - - @Length(max = 15) - private String fax; - - @Length(max = 50) - private String contactPerson; - - @NotNull - private Boolean active; - - @Length(max = 256) - private String description; - - @Length(max = 50) - private String micr; - - public BankBranchContract(final String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankBranchSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankBranchSearchContract.java deleted file mode 100644 index 94a5f9a2724..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankBranchSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BankBranchSearchContract extends BankBranchContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankContract.java deleted file mode 100644 index 77caa88a8af..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankContract.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.web.contract.AuditableContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "code", "name", "description", "active", "type", "fund" }) -public class BankContract extends AuditableContract { - - private String id; - - @NotNull - @Size(max = 50, min = 1) - private String code; - - @NotNull - @Size(max = 100, min = 2) - private String name; - - @Size(max = 250) - private String description; - - @NotNull - private Boolean active; - - @NotNull - @Size(max = 50) - private String type; - - public BankContract(final String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankSearchContract.java deleted file mode 100644 index eec9e6eed2f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BankSearchContract.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BankSearchContract extends BankContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BudgetGroupContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BudgetGroupContract.java deleted file mode 100644 index 9e37bf4a5a1..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BudgetGroupContract.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import org.egov.common.web.contract.AuditableContract; -import org.egov.egf.master.web.contract.enums.BudgetAccountTypeContract; -import org.egov.egf.master.web.contract.enums.BudgetingTypeContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "description", "majorCode", "maxCode", "minCode", "accountType", "budgetingType", - "active" }) -public class BudgetGroupContract extends AuditableContract { - - private String id; - - @Length(max = 250, min = 1) - private String name; - - @Length(max = 250, message = "Max 250 characters are allowed for description") - private String description; - - private ChartOfAccountContract majorCode; - - private ChartOfAccountContract maxCode; - - private ChartOfAccountContract minCode; - - private BudgetAccountTypeContract accountType; - - private BudgetingTypeContract budgetingType; - - private Boolean active; - - public BudgetGroupContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BudgetGroupSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BudgetGroupSearchContract.java deleted file mode 100644 index 7cb2042e54e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/BudgetGroupSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class BudgetGroupSearchContract extends BudgetGroupContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountContract.java deleted file mode 100644 index 5b2e2fc7ea7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountContract.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "glcode", "name", "accountCodePurpose", "description", "isActiveForPosting", "parentId", - "type", "classification", "functionRequired", "budgetCheckRequired", "majorCode", "isSubLedger" }) -public class ChartOfAccountContract extends AuditableContract { - - private String id; - - @NotNull - @Length(max = 16, min = 1) - private String glcode; - - @NotNull - @Length(max = 128, min = 5) - private String name; - - private AccountCodePurposeContract accountCodePurpose; - - @Length(max = 256) - private String description; - - @NotNull - private Boolean isActiveForPosting; - - private ChartOfAccountContract parentId; - - @NotNull - private Character type; - - @NotNull - private Long classification; - - @NotNull - private Boolean functionRequired; - - @NotNull - private Boolean budgetCheckRequired; - - @Length(max = 16) - private String majorCode; - - private Boolean isSubLedger; - - public ChartOfAccountContract(String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountDetailContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountDetailContract.java deleted file mode 100644 index a32e576c046..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountDetailContract.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "chartOfAccount", "accountDetailType" }) -public class ChartOfAccountDetailContract extends AuditableContract { - - private String id; - - @NotNull - private ChartOfAccountContract chartOfAccount; - - @NotNull - private AccountDetailTypeContract accountDetailType; - - public ChartOfAccountDetailContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountDetailSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountDetailSearchContract.java deleted file mode 100644 index d5b297590dd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountDetailSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class ChartOfAccountDetailSearchContract extends ChartOfAccountDetailContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountSearchContract.java deleted file mode 100644 index f193077cbac..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/ChartOfAccountSearchContract.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.egf.master.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class ChartOfAccountSearchContract extends ChartOfAccountContract { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private String glcodes; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/EgfStatusContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/EgfStatusContract.java deleted file mode 100644 index 063cf605883..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/EgfStatusContract.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.web.contract.AuditableContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "moduleType", "code", "description" }) -public class EgfStatusContract extends AuditableContract { - - @NotNull - private String id; - - @NotNull - @Size(min = 3, max = 50) - private String moduleType; - - @NotNull - @Size(min = 3, max = 20) - private String code; - - @NotNull - @Size(min = 3, max = 250) - private String description; - - public EgfStatusContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/EgfStatusSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/EgfStatusSearchContract.java deleted file mode 100644 index a5898b33ded..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/EgfStatusSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class EgfStatusSearchContract extends EgfStatusContract { - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialConfigurationContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialConfigurationContract.java deleted file mode 100644 index 83ccc43ff07..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialConfigurationContract.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import java.util.List; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.web.contract.AuditableContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "description", "values" }) -public class FinancialConfigurationContract extends AuditableContract { - - @NotNull - private String id; - - @Size(min = 3, max = 50) - private String name; - - @NotNull - @Size(min = 3, max = 250) - private String description; - - @NotNull - @Size(min = 3, max = 250) - private String module; - - @NotNull - private List values; - - public FinancialConfigurationContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialConfigurationSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialConfigurationSearchContract.java deleted file mode 100644 index 49497ec0a5f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialConfigurationSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialConfigurationSearchContract extends FinancialConfigurationContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialConfigurationValueContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialConfigurationValueContract.java deleted file mode 100644 index 7b763527960..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialConfigurationValueContract.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import java.util.Date; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.web.contract.AuditableContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "financialConfiguration", "value", "effectiveFrom" }) -public class FinancialConfigurationValueContract extends AuditableContract { - - @NotNull - private String id; - - @NotNull - private FinancialConfigurationContract financialConfiguration; - - @NotNull - @Size(min = 1, max = 1000) - private String value; - - @NotNull - private Date effectiveFrom; - - public FinancialConfigurationValueContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialStatusContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialStatusContract.java deleted file mode 100644 index 4316a716a6a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialStatusContract.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.common.web.contract.AuditableContract; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "moduleType", "code", "description" }) -public class FinancialStatusContract extends AuditableContract { - - @NotNull - private String id; - - @NotNull - - @Size(min = 3, max = 50) - private String moduleType; - - @NotNull - - @Size(min = 3, max = 20) - private String code; - - @NotNull - - @Size(min = 3, max = 20) - private String name; - - @NotNull - - @Size(min = 3, max = 250) - private String description; - - public FinancialStatusContract(String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialStatusSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialStatusSearchContract.java deleted file mode 100644 index 4c27438c557..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialStatusSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialStatusSearchContract extends FinancialStatusContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialYearContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialYearContract.java deleted file mode 100644 index a03c34982fb..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialYearContract.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import java.util.Date; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "finYearRange", "startingDate", "endingDate", "active", "isActiveForPosting", "isClosed", - "transferClosingBalance" }) -public class FinancialYearContract extends AuditableContract { - - private String id; - - @Length(min = 1, max = 25) - - private String finYearRange; - - @NotNull - private Date startingDate; - - @NotNull - private Date endingDate; - - @NotNull - private Boolean active; - - @NotNull - private Boolean isActiveForPosting; - - private Boolean isClosed; - - private Boolean transferClosingBalance; - - public FinancialYearContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialYearSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialYearSearchContract.java deleted file mode 100644 index abf408c570e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FinancialYearSearchContract.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.egf.master.web.contract; - -import java.util.Date; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FinancialYearSearchContract extends FinancialYearContract { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private Date asOnDate; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FiscalPeriodContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FiscalPeriodContract.java deleted file mode 100644 index 108f8a4ef3e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FiscalPeriodContract.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import java.util.Date; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "financialYear", "startingDate", "endingDate", "active", "isActiveForPosting", - "isClosed" }) -public class FiscalPeriodContract extends AuditableContract { - - private String id; - - @Length(min = 1, max = 25) - @NotNull - private String name = ""; - - @NotNull - private FinancialYearContract financialYear; - - @NotNull - private Date startingDate; - - @NotNull - private Date endingDate; - - @NotNull - private Boolean active; - - @NotNull - private Boolean isActiveForPosting; - - private Boolean isClosed; - - public FiscalPeriodContract(String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FiscalPeriodSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FiscalPeriodSearchContract.java deleted file mode 100644 index 260c2ac60f2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FiscalPeriodSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FiscalPeriodSearchContract extends FiscalPeriodContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionContract.java deleted file mode 100644 index 066ca8972a1..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionContract.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "code", "level", "active", "parentId" }) -public class FunctionContract extends AuditableContract { - - private String id; - - @Length(max = 128, min = 2) - @NotNull - private String name; - - @Length(max = 16, min = 2) - @NotNull - private String code; - - @NotNull - private Integer level; - - @NotNull - private Boolean active; - - private FunctionContract parentId; - - public FunctionContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionSearchContract.java deleted file mode 100644 index 383251cd011..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FunctionSearchContract extends FunctionContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionaryContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionaryContract.java deleted file mode 100644 index 600446941d7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionaryContract.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "code", "name", "active" }) -public class FunctionaryContract extends AuditableContract { - - private String id; - - @NotNull - @Length(max = 16, min = 1) - private String code; - - @NotNull - @Length(max = 256, min = 1) - private String name; - - @NotNull - private Boolean active; - - public FunctionaryContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionarySearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionarySearchContract.java deleted file mode 100644 index d59c0fe8b52..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FunctionarySearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FunctionarySearchContract extends FunctionaryContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundContract.java deleted file mode 100644 index 54f60215611..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundContract.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@EqualsAndHashCode(exclude = { "parent" }, callSuper = false) -@Builder -public class FundContract extends AuditableContract { - - private static final long serialVersionUID = 7977534010758407945L; - - protected String id; - - @Length(max = 50, min = 2) - @NotNull - protected String name; - - @Length(max = 50, min = 2) - @NotNull - protected String code; - @NotNull - protected Character identifier; - - @NotNull - protected Long level; - - protected FundContract parent; - - @NotNull - protected Boolean active; - - public FundContract(String id) { - this.id = id; - } - - /* - * public Fund toDomain() { - * - * Fund parent=null; if(this.getParent()!=null && this.parent.getId()!=null) - * parent= Fund.builder().id(this.getParent().getId()).build(); Fund fund= - * Fund.builder() .id(this.id) .name(name) .code(code) .active(active) - * .identifier(identifier) .parent(parent) .build(); super.toDomain(fund); - * return fund; - * - * } - */ - - /* - * public FundEntity toEntity() { return FundEntity.builder() .id(id) - * .name(name) .code(code) .active(active) .identifier(identifier) - * .parentId(parent.getId()) .isParent(isParent) .build(); - * - * } - */ - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundSearchContract.java deleted file mode 100644 index 20935cc244b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundSearchContract.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.egov.egf.master.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import lombok.Data; - -@Data - -public class FundSearchContract extends FundContract { - - private String sortBy; - - private Integer pageSize; - - private Integer offset; - - private List ids = new ArrayList(); - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundsourceContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundsourceContract.java deleted file mode 100644 index 11b8cbdffdb..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundsourceContract.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import java.math.BigDecimal; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "code", "name", "type", "fundSource", "llevel", "active", "isParent" }) -public class FundsourceContract extends AuditableContract { - - private String id; - - @Length(min = 1, max = 25) - @NotNull - private String code; - - @Length(min = 1, max = 25) - @NotNull - private String name; - - @Length(min = 1, max = 25) - private String type; - - private FundsourceContract parent; - - private BigDecimal llevel; - - @NotNull - private Boolean active; - - // is this required - private Boolean isParent; - - public FundsourceContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundsourceSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundsourceSearchContract.java deleted file mode 100644 index 63395c53902..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/FundsourceSearchContract.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class FundsourceSearchContract extends FundsourceContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/RecoveryContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/RecoveryContract.java deleted file mode 100644 index 10811ab4dc9..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/RecoveryContract.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.egf.master.web.contract; - -import lombok.*; -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotNull; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class RecoveryContract extends AuditableContract { - - private static final long serialVersionUID = 7977534010758407945L; - - protected String id; - - @Length(max = 50, min = 2) - @NotNull - protected String name; - - @Length(max = 50, min = 2) - @NotNull - protected String code; - - @NotNull - protected ChartOfAccountContract chartOfAccount; - - protected String type; - - protected Double flat; - - protected Double percentage; - - @NotNull - protected Boolean active; - - @Length(max = 100) - protected String remitted; - - @Length(max = 16) - protected String ifscCode; - - protected Character mode; - - protected Character remittanceMode; - - @Length(max = 32) - protected String accountNumber; - - public RecoveryContract(String id) { - this.id = id; - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/RecoverySearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/RecoverySearchContract.java deleted file mode 100644 index 61a26b43128..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/RecoverySearchContract.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.egov.egf.master.web.contract; - -import lombok.Data; - -import java.util.ArrayList; -import java.util.List; - -@Data - -public class RecoverySearchContract extends RecoveryContract { - - private String sortBy; - - private Integer pageSize; - - private Integer offset; - - private List ids = new ArrayList(); - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/RequestInfoWrapper.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/RequestInfoWrapper.java deleted file mode 100644 index e57fbeeb24f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/RequestInfoWrapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.egov.egf.master.web.contract; - - -import lombok.Getter; -import lombok.Setter; -import org.egov.common.contract.request.RequestInfo; - -@Getter -@Setter -public class RequestInfoWrapper { - private RequestInfo requestInfo; - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SchemeContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SchemeContract.java deleted file mode 100644 index 71fbcb8bd06..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SchemeContract.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import java.util.Date; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "fund", "code", "name", "validFrom", "validTo", "active", "description", "boundary" }) -public class SchemeContract extends AuditableContract { - - private String id; - - private FundContract fund; - - @Length(max = 25, min = 1) - private String code; - - @Length(max = 25, min = 1) - private String name; - - @NotNull - private Date validFrom; - - @NotNull - private Date validTo; - - @NotNull - private Boolean active; - - @Length(max = 256) - private String description; - - private String boundary; - - public SchemeContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SchemeSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SchemeSearchContract.java deleted file mode 100644 index a41873fac61..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SchemeSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SchemeSearchContract extends SchemeContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SubSchemeContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SubSchemeContract.java deleted file mode 100644 index a99994f4d06..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SubSchemeContract.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import java.util.Date; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "scheme", "code", "name", "validFrom", "validTo", "active", "departmentId" }) -public class SubSchemeContract extends AuditableContract { - - private String id; - - @NotNull - private SchemeContract scheme; - - @NotNull - @Length(max = 50, min = 1) - private String code; - - @NotNull - @Length(max = 50, min = 1) - private String name; - - @NotNull - private Date validFrom; - - @NotNull - private Date validTo; - - @NotNull - private Boolean active; - - private String departmentId; - - public SubSchemeContract(String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SubSchemeSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SubSchemeSearchContract.java deleted file mode 100644 index e022d0ac9ed..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SubSchemeSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SubSchemeSearchContract extends SubSchemeContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SupplierContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SupplierContract.java deleted file mode 100644 index 6d106fe5966..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SupplierContract.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.web.contract.AuditableContract; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "code", "name", "address", "mobile", "email", "description", "active", "panNo", "tinNo", - "registationNo", "bankAccount", "ifscCode", "bank" }) -public class SupplierContract extends AuditableContract { - - private String id; - - @NotNull - @Length(max = 50, min = 1) - private String code; - - @NotNull - @Length(max = 50, min = 1) - private String name; - - @Length(max = 300) - private String address; - - @Length(max = 10) - private String mobile; - - @Length(max = 25) - private String email; - - @Length(max = 250) - private String description; - @NotNull - private Boolean active; - - @Length(max = 10) - private String panNo; - - @Length(max = 20) - private String tinNo; - - @Length(max = 25) - private String registationNo; - - private BankAccountContract bankAccount; - - @Length(max = 12) - private String ifscCode; - - private BankContract bank; - - public SupplierContract(String id) { - this.id = id; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SupplierSearchContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SupplierSearchContract.java deleted file mode 100644 index d6f4bc64df1..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/SupplierSearchContract.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.egf.master.web.contract ; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class SupplierSearchContract extends SupplierContract { private String ids; -private String sortBy; -private Integer pageSize; -private Integer offset; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/enums/BankAccountTypeContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/enums/BankAccountTypeContract.java deleted file mode 100644 index eb4492bbdb6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/enums/BankAccountTypeContract.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract.enums; - -public enum BankAccountTypeContract { - RECEIPTS, PAYMENTS, RECEIPTS_PAYMENTS -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/enums/BudgetAccountTypeContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/enums/BudgetAccountTypeContract.java deleted file mode 100644 index 310a99997e5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/enums/BudgetAccountTypeContract.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.egf.master.web.contract.enums; - -public enum BudgetAccountTypeContract { - REVENUE_RECEIPTS, REVENUE_EXPENDITURE, CAPITAL_RECEIPTS, CAPITAL_EXPENDITURE -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/enums/BudgetingTypeContract.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/enums/BudgetingTypeContract.java deleted file mode 100644 index f3d9f5a4af2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/contract/enums/BudgetingTypeContract.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.egov.egf.master.web.contract.enums; - -public enum BudgetingTypeContract { - ALL, DEBIT, CREDIT -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountCodePurposeController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountCodePurposeController.java deleted file mode 100644 index 83b9f6a056f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountCodePurposeController.java +++ /dev/null @@ -1,152 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.AccountCodePurposeSearch; -import org.egov.egf.master.domain.service.AccountCodePurposeService; -import org.egov.egf.master.web.contract.AccountCodePurposeContract; -import org.egov.egf.master.web.contract.AccountCodePurposeSearchContract; -import org.egov.egf.master.web.requests.AccountCodePurposeRequest; -import org.egov.egf.master.web.requests.AccountCodePurposeResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/accountcodepurposes") -public class AccountCodePurposeController { - - @Autowired - private AccountCodePurposeService accountCodePurposeService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public AccountCodePurposeResponse create(@RequestBody AccountCodePurposeRequest accountCodePurposeRequest, - BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - AccountCodePurposeResponse accountCodePurposeResponse = new AccountCodePurposeResponse(); - accountCodePurposeResponse.setResponseInfo(getResponseInfo(accountCodePurposeRequest.getRequestInfo())); - List accountcodepurposes = new ArrayList<>(); - AccountCodePurpose accountCodePurpose; - List accountCodePurposeContracts = new ArrayList<>(); - AccountCodePurposeContract contract; - - accountCodePurposeRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (AccountCodePurposeContract accountCodePurposeContract : accountCodePurposeRequest - .getAccountCodePurposes()) { - accountCodePurpose = new AccountCodePurpose(); - model.map(accountCodePurposeContract, accountCodePurpose); - accountCodePurpose.setCreatedDate(new Date()); - accountCodePurpose.setCreatedBy(accountCodePurposeRequest.getRequestInfo().getUserInfo()); - accountCodePurpose.setLastModifiedBy(accountCodePurposeRequest.getRequestInfo().getUserInfo()); - accountcodepurposes.add(accountCodePurpose); - } - - accountcodepurposes = accountCodePurposeService.create(accountcodepurposes, errors, - accountCodePurposeRequest.getRequestInfo()); - - for (AccountCodePurpose f : accountcodepurposes) { - contract = new AccountCodePurposeContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - accountCodePurposeContracts.add(contract); - } - - accountCodePurposeResponse.setAccountCodePurposes(accountCodePurposeContracts); - - return accountCodePurposeResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public AccountCodePurposeResponse update(@RequestBody AccountCodePurposeRequest accountCodePurposeRequest, - BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - accountCodePurposeRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - AccountCodePurposeResponse accountCodePurposeResponse = new AccountCodePurposeResponse(); - List accountcodepurposes = new ArrayList<>(); - accountCodePurposeResponse.setResponseInfo(getResponseInfo(accountCodePurposeRequest.getRequestInfo())); - AccountCodePurpose accountCodePurpose; - AccountCodePurposeContract contract; - List accountCodePurposeContracts = new ArrayList<>(); - - for (AccountCodePurposeContract accountCodePurposeContract : accountCodePurposeRequest - .getAccountCodePurposes()) { - accountCodePurpose = new AccountCodePurpose(); - model.map(accountCodePurposeContract, accountCodePurpose); - accountCodePurpose.setLastModifiedBy(accountCodePurposeRequest.getRequestInfo().getUserInfo()); - accountCodePurpose.setLastModifiedDate(new Date()); - accountcodepurposes.add(accountCodePurpose); - } - - accountcodepurposes = accountCodePurposeService.update(accountcodepurposes, errors, - accountCodePurposeRequest.getRequestInfo()); - - for (AccountCodePurpose accountCodePurposeObj : accountcodepurposes) { - contract = new AccountCodePurposeContract(); - model.map(accountCodePurposeObj, contract); - accountCodePurposeObj.setLastModifiedDate(new Date()); - accountCodePurposeContracts.add(contract); - } - - accountCodePurposeResponse.setAccountCodePurposes(accountCodePurposeContracts); - - return accountCodePurposeResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public AccountCodePurposeResponse search( - @ModelAttribute AccountCodePurposeSearchContract accountCodePurposeSearchContract, @RequestBody RequestInfo requestInfo, - BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - AccountCodePurposeSearch domain = new AccountCodePurposeSearch(); - mapper.map(accountCodePurposeSearchContract, domain); - AccountCodePurposeContract contract; - ModelMapper model = new ModelMapper(); - List accountCodePurposeContracts = new ArrayList<>(); - Pagination accountcodepurposes = accountCodePurposeService.search(domain, errors); - - for (AccountCodePurpose accountCodePurpose : accountcodepurposes.getPagedData()) { - contract = new AccountCodePurposeContract(); - model.map(accountCodePurpose, contract); - accountCodePurposeContracts.add(contract); - } - - AccountCodePurposeResponse response = new AccountCodePurposeResponse(); - response.setAccountCodePurposes(accountCodePurposeContracts); - response.setPage(new PaginationContract(accountcodepurposes)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountDetailKeyController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountDetailKeyController.java deleted file mode 100644 index 3e26e536197..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountDetailKeyController.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailKeySearch; -import org.egov.egf.master.domain.service.AccountDetailKeyService; -import org.egov.egf.master.web.contract.AccountDetailKeyContract; -import org.egov.egf.master.web.contract.AccountDetailKeySearchContract; -import org.egov.egf.master.web.requests.AccountDetailKeyRequest; -import org.egov.egf.master.web.requests.AccountDetailKeyResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/accountdetailkeys") -public class AccountDetailKeyController { - - @Autowired - private AccountDetailKeyService accountDetailKeyService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public AccountDetailKeyResponse create(@RequestBody AccountDetailKeyRequest accountDetailKeyRequest, - BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - AccountDetailKeyResponse accountDetailKeyResponse = new AccountDetailKeyResponse(); - accountDetailKeyResponse.setResponseInfo(getResponseInfo(accountDetailKeyRequest.getRequestInfo())); - List accountdetailkeys = new ArrayList<>(); - AccountDetailKey accountDetailKey; - List accountDetailKeyContracts = new ArrayList<>(); - AccountDetailKeyContract contract; - - accountDetailKeyRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (AccountDetailKeyContract accountDetailKeyContract : accountDetailKeyRequest.getAccountDetailKeys()) { - accountDetailKey = new AccountDetailKey(); - model.map(accountDetailKeyContract, accountDetailKey); - accountDetailKey.setCreatedDate(new Date()); - accountDetailKey.setCreatedBy(accountDetailKeyRequest.getRequestInfo().getUserInfo()); - accountDetailKey.setLastModifiedBy(accountDetailKeyRequest.getRequestInfo().getUserInfo()); - accountdetailkeys.add(accountDetailKey); - } - - accountdetailkeys = accountDetailKeyService.create(accountdetailkeys, errors, - accountDetailKeyRequest.getRequestInfo()); - - for (AccountDetailKey f : accountdetailkeys) { - contract = new AccountDetailKeyContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - accountDetailKeyContracts.add(contract); - } - - accountDetailKeyResponse.setAccountDetailKeys(accountDetailKeyContracts); - - return accountDetailKeyResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public AccountDetailKeyResponse update(@RequestBody AccountDetailKeyRequest accountDetailKeyRequest, - BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - accountDetailKeyRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - AccountDetailKeyResponse accountDetailKeyResponse = new AccountDetailKeyResponse(); - List accountdetailkeys = new ArrayList<>(); - accountDetailKeyResponse.setResponseInfo(getResponseInfo(accountDetailKeyRequest.getRequestInfo())); - AccountDetailKey accountDetailKey; - AccountDetailKeyContract contract; - List accountDetailKeyContracts = new ArrayList<>(); - - for (AccountDetailKeyContract accountDetailKeyContract : accountDetailKeyRequest.getAccountDetailKeys()) { - accountDetailKey = new AccountDetailKey(); - model.map(accountDetailKeyContract, accountDetailKey); - accountDetailKey.setLastModifiedBy(accountDetailKeyRequest.getRequestInfo().getUserInfo()); - accountDetailKey.setLastModifiedDate(new Date()); - accountdetailkeys.add(accountDetailKey); - } - - accountdetailkeys = accountDetailKeyService.update(accountdetailkeys, errors, - accountDetailKeyRequest.getRequestInfo()); - - for (AccountDetailKey accountDetailKeyObj : accountdetailkeys) { - contract = new AccountDetailKeyContract(); - model.map(accountDetailKeyObj, contract); - accountDetailKeyObj.setLastModifiedDate(new Date()); - accountDetailKeyContracts.add(contract); - } - - accountDetailKeyResponse.setAccountDetailKeys(accountDetailKeyContracts); - - return accountDetailKeyResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public AccountDetailKeyResponse search( - @ModelAttribute AccountDetailKeySearchContract accountDetailKeySearchContract, @RequestBody RequestInfo requestInfo, - BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - AccountDetailKeySearch domain = new AccountDetailKeySearch(); - mapper.map(accountDetailKeySearchContract, domain); - AccountDetailKeyContract contract; - ModelMapper model = new ModelMapper(); - List accountDetailKeyContracts = new ArrayList<>(); - Pagination accountdetailkeys = accountDetailKeyService.search(domain, errors); - - for (AccountDetailKey accountDetailKey : accountdetailkeys.getPagedData()) { - contract = new AccountDetailKeyContract(); - model.map(accountDetailKey, contract); - accountDetailKeyContracts.add(contract); - } - - AccountDetailKeyResponse response = new AccountDetailKeyResponse(); - response.setAccountDetailKeys(accountDetailKeyContracts); - response.setPage(new PaginationContract(accountdetailkeys)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountDetailTypeController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountDetailTypeController.java deleted file mode 100644 index dd45fc03e62..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountDetailTypeController.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; -import org.egov.egf.master.domain.service.AccountDetailTypeService; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; -import org.egov.egf.master.web.contract.AccountDetailTypeSearchContract; -import org.egov.egf.master.web.requests.AccountDetailTypeRequest; -import org.egov.egf.master.web.requests.AccountDetailTypeResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/accountdetailtypes") -public class AccountDetailTypeController { - - @Autowired - private AccountDetailTypeService accountDetailTypeService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public AccountDetailTypeResponse create(@RequestBody AccountDetailTypeRequest accountDetailTypeRequest, - BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - AccountDetailTypeResponse accountDetailTypeResponse = new AccountDetailTypeResponse(); - accountDetailTypeResponse.setResponseInfo(getResponseInfo(accountDetailTypeRequest.getRequestInfo())); - List accountdetailtypes = new ArrayList<>(); - AccountDetailType accountDetailType; - List accountDetailTypeContracts = new ArrayList<>(); - AccountDetailTypeContract contract; - - accountDetailTypeRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (AccountDetailTypeContract accountDetailTypeContract : accountDetailTypeRequest.getAccountDetailTypes()) { - accountDetailType = new AccountDetailType(); - model.map(accountDetailTypeContract, accountDetailType); - accountDetailType.setCreatedDate(new Date()); - accountDetailType.setCreatedBy(accountDetailTypeRequest.getRequestInfo().getUserInfo()); - accountDetailType.setLastModifiedBy(accountDetailTypeRequest.getRequestInfo().getUserInfo()); - accountdetailtypes.add(accountDetailType); - } - - accountdetailtypes = accountDetailTypeService.create(accountdetailtypes, errors, - accountDetailTypeRequest.getRequestInfo()); - - for (AccountDetailType f : accountdetailtypes) { - contract = new AccountDetailTypeContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - accountDetailTypeContracts.add(contract); - } - - accountDetailTypeResponse.setAccountDetailTypes(accountDetailTypeContracts); - - return accountDetailTypeResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public AccountDetailTypeResponse update(@RequestBody AccountDetailTypeRequest accountDetailTypeRequest, - BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - accountDetailTypeRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - AccountDetailTypeResponse accountDetailTypeResponse = new AccountDetailTypeResponse(); - List accountdetailtypes = new ArrayList<>(); - accountDetailTypeResponse.setResponseInfo(getResponseInfo(accountDetailTypeRequest.getRequestInfo())); - AccountDetailType accountDetailType; - AccountDetailTypeContract contract; - List accountDetailTypeContracts = new ArrayList<>(); - - for (AccountDetailTypeContract accountDetailTypeContract : accountDetailTypeRequest.getAccountDetailTypes()) { - accountDetailType = new AccountDetailType(); - model.map(accountDetailTypeContract, accountDetailType); - accountDetailType.setLastModifiedBy(accountDetailTypeRequest.getRequestInfo().getUserInfo()); - accountDetailType.setLastModifiedDate(new Date()); - accountdetailtypes.add(accountDetailType); - } - - accountdetailtypes = accountDetailTypeService.update(accountdetailtypes, errors, - accountDetailTypeRequest.getRequestInfo()); - - for (AccountDetailType accountDetailTypeObj : accountdetailtypes) { - contract = new AccountDetailTypeContract(); - model.map(accountDetailTypeObj, contract); - accountDetailTypeObj.setLastModifiedDate(new Date()); - accountDetailTypeContracts.add(contract); - } - - accountDetailTypeResponse.setAccountDetailTypes(accountDetailTypeContracts); - - return accountDetailTypeResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public AccountDetailTypeResponse search( - @ModelAttribute AccountDetailTypeSearchContract accountDetailTypeSearchContract,@RequestBody RequestInfo requestInfo, - BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - AccountDetailTypeSearch domain = new AccountDetailTypeSearch(); - mapper.map(accountDetailTypeSearchContract, domain); - AccountDetailTypeContract contract; - ModelMapper model = new ModelMapper(); - List accountDetailTypeContracts = new ArrayList<>(); - Pagination accountdetailtypes = accountDetailTypeService.search(domain, errors); - - for (AccountDetailType accountDetailType : accountdetailtypes.getPagedData()) { - contract = new AccountDetailTypeContract(); - model.map(accountDetailType, contract); - accountDetailTypeContracts.add(contract); - } - - AccountDetailTypeResponse response = new AccountDetailTypeResponse(); - response.setAccountDetailTypes(accountDetailTypeContracts); - response.setPage(new PaginationContract(accountdetailtypes)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountEntityController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountEntityController.java deleted file mode 100644 index 3159484e910..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/AccountEntityController.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.egov.egf.master.web.controller; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.domain.model.AccountEntitySearch; -import org.egov.egf.master.domain.service.AccountEntityService; -import org.egov.egf.master.web.contract.AccountEntityContract; -import org.egov.egf.master.web.contract.AccountEntitySearchContract; -import org.egov.egf.master.web.requests.AccountEntityRequest; -import org.egov.egf.master.web.requests.AccountEntityResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -@RestController -@RequestMapping("/accountentities") -public class AccountEntityController { - - @Autowired - private AccountEntityService accountEntityService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public AccountEntityResponse create(@RequestBody AccountEntityRequest accountEntityRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - AccountEntityResponse accountEntityResponse = new AccountEntityResponse(); - accountEntityResponse.setResponseInfo(getResponseInfo(accountEntityRequest.getRequestInfo())); - List accountentities = new ArrayList<>(); - AccountEntity accountEntity; - List accountEntityContracts = new ArrayList<>(); - AccountEntityContract contract; - - accountEntityRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (AccountEntityContract accountEntityContract : accountEntityRequest.getAccountEntities()) { - accountEntity = new AccountEntity(); - model.map(accountEntityContract, accountEntity); - accountEntity.setCreatedDate(new Date()); - accountEntity.setCreatedBy(accountEntityRequest.getRequestInfo().getUserInfo()); - accountEntity.setLastModifiedBy(accountEntityRequest.getRequestInfo().getUserInfo()); - accountentities.add(accountEntity); - } - - accountentities = accountEntityService.create(accountentities, errors, accountEntityRequest.getRequestInfo()); - - for (AccountEntity f : accountentities) { - contract = new AccountEntityContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - accountEntityContracts.add(contract); - } - - accountEntityResponse.setAccountEntities(accountEntityContracts); - - return accountEntityResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public AccountEntityResponse update(@RequestBody AccountEntityRequest accountEntityRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - accountEntityRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - AccountEntityResponse accountEntityResponse = new AccountEntityResponse(); - List accountentities = new ArrayList<>(); - accountEntityResponse.setResponseInfo(getResponseInfo(accountEntityRequest.getRequestInfo())); - AccountEntity accountEntity; - AccountEntityContract contract; - List accountEntityContracts = new ArrayList<>(); - - for (AccountEntityContract accountEntityContract : accountEntityRequest.getAccountEntities()) { - accountEntity = new AccountEntity(); - model.map(accountEntityContract, accountEntity); - accountEntity.setLastModifiedBy(accountEntityRequest.getRequestInfo().getUserInfo()); - accountEntity.setLastModifiedDate(new Date()); - accountentities.add(accountEntity); - } - - accountentities = accountEntityService.update(accountentities, errors, accountEntityRequest.getRequestInfo()); - - for (AccountEntity accountEntityObj : accountentities) { - contract = new AccountEntityContract(); - model.map(accountEntityObj, contract); - accountEntityObj.setLastModifiedDate(new Date()); - accountEntityContracts.add(contract); - } - - accountEntityResponse.setAccountEntities(accountEntityContracts); - - return accountEntityResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public AccountEntityResponse search(@ModelAttribute AccountEntitySearchContract accountEntitySearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - AccountEntitySearch domain = new AccountEntitySearch(); - mapper.map(accountEntitySearchContract, domain); - AccountEntityContract contract; - ModelMapper model = new ModelMapper(); - List accountEntityContracts = new ArrayList<>(); - Pagination accountentities = accountEntityService.search(domain, errors); - - for (AccountEntity accountEntity : accountentities.getPagedData()) { - contract = new AccountEntityContract(); - model.map(accountEntity, contract); - accountEntityContracts.add(contract); - } - - AccountEntityResponse response = new AccountEntityResponse(); - response.setAccountEntities(accountEntityContracts); - response.setPage(new PaginationContract(accountentities)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BankAccountController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BankAccountController.java deleted file mode 100644 index 4af83452ea2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BankAccountController.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankAccountSearch; -import org.egov.egf.master.domain.service.BankAccountService; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.BankAccountSearchContract; -import org.egov.egf.master.web.requests.BankAccountRequest; -import org.egov.egf.master.web.requests.BankAccountResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/bankaccounts") -public class BankAccountController { - - @Autowired - private BankAccountService bankAccountService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public BankAccountResponse create(@RequestBody BankAccountRequest bankAccountRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - BankAccountResponse bankAccountResponse = new BankAccountResponse(); - bankAccountResponse.setResponseInfo(getResponseInfo(bankAccountRequest.getRequestInfo())); - List bankaccounts = new ArrayList<>(); - BankAccount bankAccount; - List bankAccountContracts = new ArrayList<>(); - BankAccountContract contract; - - bankAccountRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (BankAccountContract bankAccountContract : bankAccountRequest.getBankAccounts()) { - bankAccount = new BankAccount(); - model.map(bankAccountContract, bankAccount); - bankAccount.setCreatedDate(new Date()); - bankAccount.setCreatedBy(bankAccountRequest.getRequestInfo().getUserInfo()); - bankAccount.setLastModifiedBy(bankAccountRequest.getRequestInfo().getUserInfo()); - bankaccounts.add(bankAccount); - } - - bankaccounts = bankAccountService.create(bankaccounts, errors, bankAccountRequest.getRequestInfo()); - - for (BankAccount f : bankaccounts) { - contract = new BankAccountContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - bankAccountContracts.add(contract); - } - - bankAccountResponse.setBankAccounts(bankAccountContracts); - - return bankAccountResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public BankAccountResponse update(@RequestBody BankAccountRequest bankAccountRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - bankAccountRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - BankAccountResponse bankAccountResponse = new BankAccountResponse(); - List bankaccounts = new ArrayList<>(); - bankAccountResponse.setResponseInfo(getResponseInfo(bankAccountRequest.getRequestInfo())); - BankAccount bankAccount; - BankAccountContract contract; - List bankAccountContracts = new ArrayList<>(); - - for (BankAccountContract bankAccountContract : bankAccountRequest.getBankAccounts()) { - bankAccount = new BankAccount(); - model.map(bankAccountContract, bankAccount); - bankAccount.setLastModifiedBy(bankAccountRequest.getRequestInfo().getUserInfo()); - bankAccount.setLastModifiedDate(new Date()); - bankaccounts.add(bankAccount); - } - - bankaccounts = bankAccountService.update(bankaccounts, errors, bankAccountRequest.getRequestInfo()); - - for (BankAccount bankAccountObj : bankaccounts) { - contract = new BankAccountContract(); - model.map(bankAccountObj, contract); - bankAccountObj.setLastModifiedDate(new Date()); - bankAccountContracts.add(contract); - } - - bankAccountResponse.setBankAccounts(bankAccountContracts); - - return bankAccountResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public BankAccountResponse search(@ModelAttribute BankAccountSearchContract bankAccountSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - BankAccountSearch domain = new BankAccountSearch(); - mapper.map(bankAccountSearchContract, domain); - BankAccountContract contract; - ModelMapper model = new ModelMapper(); - List bankAccountContracts = new ArrayList<>(); - Pagination bankaccounts = bankAccountService.search(domain, errors); - - for (BankAccount bankAccount : bankaccounts.getPagedData()) { - contract = new BankAccountContract(); - model.map(bankAccount, contract); - bankAccountContracts.add(contract); - } - - BankAccountResponse response = new BankAccountResponse(); - response.setBankAccounts(bankAccountContracts); - response.setPage(new PaginationContract(bankaccounts)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BankBranchController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BankBranchController.java deleted file mode 100644 index ac79bc2907f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BankBranchController.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.BankBranchSearch; -import org.egov.egf.master.domain.service.BankBranchService; -import org.egov.egf.master.web.contract.BankBranchContract; -import org.egov.egf.master.web.contract.BankBranchSearchContract; -import org.egov.egf.master.web.requests.BankBranchRequest; -import org.egov.egf.master.web.requests.BankBranchResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/bankbranches") -public class BankBranchController { - - @Autowired - private BankBranchService bankBranchService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public BankBranchResponse create(@RequestBody BankBranchRequest bankBranchRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - BankBranchResponse bankBranchResponse = new BankBranchResponse(); - bankBranchResponse.setResponseInfo(getResponseInfo(bankBranchRequest.getRequestInfo())); - List bankbranches = new ArrayList<>(); - BankBranch bankBranch; - List bankBranchContracts = new ArrayList<>(); - BankBranchContract contract; - - bankBranchRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (BankBranchContract bankBranchContract : bankBranchRequest.getBankBranches()) { - bankBranch = new BankBranch(); - model.map(bankBranchContract, bankBranch); - bankBranch.setCreatedDate(new Date()); - bankBranch.setCreatedBy(bankBranchRequest.getRequestInfo().getUserInfo()); - bankBranch.setLastModifiedBy(bankBranchRequest.getRequestInfo().getUserInfo()); - bankbranches.add(bankBranch); - } - - bankbranches = bankBranchService.create(bankbranches, errors, bankBranchRequest.getRequestInfo()); - - for (BankBranch f : bankbranches) { - contract = new BankBranchContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - bankBranchContracts.add(contract); - } - - bankBranchResponse.setBankBranches(bankBranchContracts); - - return bankBranchResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public BankBranchResponse update(@RequestBody BankBranchRequest bankBranchRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - bankBranchRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - BankBranchResponse bankBranchResponse = new BankBranchResponse(); - List bankbranches = new ArrayList<>(); - bankBranchResponse.setResponseInfo(getResponseInfo(bankBranchRequest.getRequestInfo())); - BankBranch bankBranch; - BankBranchContract contract; - List bankBranchContracts = new ArrayList<>(); - - for (BankBranchContract bankBranchContract : bankBranchRequest.getBankBranches()) { - bankBranch = new BankBranch(); - model.map(bankBranchContract, bankBranch); - bankBranch.setLastModifiedBy(bankBranchRequest.getRequestInfo().getUserInfo()); - bankBranch.setLastModifiedDate(new Date()); - bankbranches.add(bankBranch); - } - - bankbranches = bankBranchService.update(bankbranches, errors, bankBranchRequest.getRequestInfo()); - - for (BankBranch bankBranchObj : bankbranches) { - contract = new BankBranchContract(); - model.map(bankBranchObj, contract); - bankBranchObj.setLastModifiedDate(new Date()); - bankBranchContracts.add(contract); - } - - bankBranchResponse.setBankBranches(bankBranchContracts); - - return bankBranchResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public BankBranchResponse search(@ModelAttribute BankBranchSearchContract bankBranchSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - BankBranchSearch domain = new BankBranchSearch(); - mapper.map(bankBranchSearchContract, domain); - BankBranchContract contract; - ModelMapper model = new ModelMapper(); - List bankBranchContracts = new ArrayList<>(); - Pagination bankbranches = bankBranchService.search(domain, errors); - - for (BankBranch bankBranch : bankbranches.getPagedData()) { - contract = new BankBranchContract(); - model.map(bankBranch, contract); - bankBranchContracts.add(contract); - } - - BankBranchResponse response = new BankBranchResponse(); - response.setBankBranches(bankBranchContracts); - response.setPage(new PaginationContract(bankbranches)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BankController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BankController.java deleted file mode 100644 index 29c641c6b9f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BankController.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankSearch; -import org.egov.egf.master.domain.service.BankService; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.BankSearchContract; -import org.egov.egf.master.web.requests.BankRequest; -import org.egov.egf.master.web.requests.BankResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/banks") -public class BankController { - - @Autowired - private BankService bankService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public BankResponse create(@RequestBody BankRequest bankRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - BankResponse bankResponse = new BankResponse(); - bankResponse.setResponseInfo(getResponseInfo(bankRequest.getRequestInfo())); - List banks = new ArrayList<>(); - Bank bank; - List bankContracts = new ArrayList<>(); - BankContract contract; - - bankRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (BankContract bankContract : bankRequest.getBanks()) { - bank = new Bank(); - model.map(bankContract, bank); - bank.setCreatedDate(new Date()); - bank.setCreatedBy(bankRequest.getRequestInfo().getUserInfo()); - bank.setLastModifiedBy(bankRequest.getRequestInfo().getUserInfo()); - banks.add(bank); - } - - banks = bankService.create(banks, errors, bankRequest.getRequestInfo()); - - for (Bank f : banks) { - contract = new BankContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - bankContracts.add(contract); - } - - bankResponse.setBanks(bankContracts); - - return bankResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public BankResponse update(@RequestBody BankRequest bankRequest, BindingResult errors,@RequestParam String tenantId) { - - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - bankRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - BankResponse bankResponse = new BankResponse(); - List banks = new ArrayList<>(); - bankResponse.setResponseInfo(getResponseInfo(bankRequest.getRequestInfo())); - Bank bank; - BankContract contract; - List bankContracts = new ArrayList<>(); - - for (BankContract bankContract : bankRequest.getBanks()) { - bank = new Bank(); - model.map(bankContract, bank); - bank.setLastModifiedBy(bankRequest.getRequestInfo().getUserInfo()); - bank.setLastModifiedDate(new Date()); - banks.add(bank); - } - - banks = bankService.update(banks, errors, bankRequest.getRequestInfo()); - - for (Bank bankObj : banks) { - contract = new BankContract(); - model.map(bankObj, contract); - bankObj.setLastModifiedDate(new Date()); - bankContracts.add(contract); - } - - bankResponse.setBanks(bankContracts); - - return bankResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public BankResponse search(@ModelAttribute BankSearchContract bankSearchContract, @RequestBody RequestInfo requestInfo, - BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - BankSearch domain = new BankSearch(); - mapper.map(bankSearchContract, domain); - BankContract contract; - ModelMapper model = new ModelMapper(); - List bankContracts = new ArrayList<>(); - Pagination banks = bankService.search(domain, errors); - - for (Bank bank : banks.getPagedData()) { - contract = new BankContract(); - model.map(bank, contract); - bankContracts.add(contract); - } - - BankResponse response = new BankResponse(); - response.setBanks(bankContracts); - response.setPage(new PaginationContract(banks)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BudgetGroupController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BudgetGroupController.java deleted file mode 100644 index 1cf22a2cc28..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/BudgetGroupController.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.BudgetGroup; -import org.egov.egf.master.domain.model.BudgetGroupSearch; -import org.egov.egf.master.domain.service.BudgetGroupService; -import org.egov.egf.master.web.contract.BudgetGroupContract; -import org.egov.egf.master.web.contract.BudgetGroupSearchContract; -import org.egov.egf.master.web.requests.BudgetGroupRequest; -import org.egov.egf.master.web.requests.BudgetGroupResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/budgetgroups") -public class BudgetGroupController { - - @Autowired - private BudgetGroupService budgetGroupService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public BudgetGroupResponse create(@RequestBody BudgetGroupRequest budgetGroupRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - BudgetGroupResponse budgetGroupResponse = new BudgetGroupResponse(); - budgetGroupResponse.setResponseInfo(getResponseInfo(budgetGroupRequest.getRequestInfo())); - List budgetgroups = new ArrayList<>(); - BudgetGroup budgetGroup; - List budgetGroupContracts = new ArrayList<>(); - BudgetGroupContract contract; - - budgetGroupRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (BudgetGroupContract budgetGroupContract : budgetGroupRequest.getBudgetGroups()) { - budgetGroup = new BudgetGroup(); - model.map(budgetGroupContract, budgetGroup); - budgetGroup.setCreatedDate(new Date()); - budgetGroup.setCreatedBy(budgetGroupRequest.getRequestInfo().getUserInfo()); - budgetGroup.setLastModifiedBy(budgetGroupRequest.getRequestInfo().getUserInfo()); - budgetgroups.add(budgetGroup); - } - - budgetgroups = budgetGroupService.add(budgetgroups, errors); - - for (BudgetGroup f : budgetgroups) { - contract = new BudgetGroupContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - budgetGroupContracts.add(contract); - } - - budgetGroupRequest.setBudgetGroups(budgetGroupContracts); - budgetGroupService.addToQue(budgetGroupRequest); - budgetGroupResponse.setBudgetGroups(budgetGroupContracts); - - return budgetGroupResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public BudgetGroupResponse update(@RequestBody BudgetGroupRequest budgetGroupRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - budgetGroupRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - BudgetGroupResponse budgetGroupResponse = new BudgetGroupResponse(); - List budgetgroups = new ArrayList<>(); - budgetGroupResponse.setResponseInfo(getResponseInfo(budgetGroupRequest.getRequestInfo())); - BudgetGroup budgetGroup; - BudgetGroupContract contract; - List budgetGroupContracts = new ArrayList<>(); - - for (BudgetGroupContract budgetGroupContract : budgetGroupRequest.getBudgetGroups()) { - budgetGroup = new BudgetGroup(); - model.map(budgetGroupContract, budgetGroup); - budgetGroup.setLastModifiedBy(budgetGroupRequest.getRequestInfo().getUserInfo()); - budgetGroup.setLastModifiedDate(new Date()); - budgetgroups.add(budgetGroup); - } - - budgetgroups = budgetGroupService.update(budgetgroups, errors); - - for (BudgetGroup budgetGroupObj : budgetgroups) { - contract = new BudgetGroupContract(); - model.map(budgetGroupObj, contract); - budgetGroupObj.setLastModifiedDate(new Date()); - budgetGroupContracts.add(contract); - } - - budgetGroupRequest.setBudgetGroups(budgetGroupContracts); - budgetGroupService.addToQue(budgetGroupRequest); - budgetGroupResponse.setBudgetGroups(budgetGroupContracts); - - return budgetGroupResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public BudgetGroupResponse search(@ModelAttribute BudgetGroupSearchContract budgetGroupSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - BudgetGroupSearch domain = new BudgetGroupSearch(); - mapper.map(budgetGroupSearchContract, domain); - BudgetGroupContract contract; - ModelMapper model = new ModelMapper(); - List budgetGroupContracts = new ArrayList<>(); - Pagination budgetgroups = budgetGroupService.search(domain, errors); - - for (BudgetGroup budgetGroup : budgetgroups.getPagedData()) { - contract = new BudgetGroupContract(); - model.map(budgetGroup, contract); - budgetGroupContracts.add(contract); - } - - BudgetGroupResponse response = new BudgetGroupResponse(); - response.setBudgetGroups(budgetGroupContracts); - response.setPage(new PaginationContract(budgetgroups)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/ChartOfAccountController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/ChartOfAccountController.java deleted file mode 100644 index 0fb9b34890d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/ChartOfAccountController.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.domain.service.ChartOfAccountService; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.egov.egf.master.web.contract.ChartOfAccountSearchContract; -import org.egov.egf.master.web.requests.ChartOfAccountRequest; -import org.egov.egf.master.web.requests.ChartOfAccountResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/chartofaccounts") -public class ChartOfAccountController { - - @Autowired - private ChartOfAccountService chartOfAccountService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public ChartOfAccountResponse create(@RequestBody ChartOfAccountRequest chartOfAccountRequest, - BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - ChartOfAccountResponse chartOfAccountResponse = new ChartOfAccountResponse(); - chartOfAccountResponse.setResponseInfo(getResponseInfo(chartOfAccountRequest.getRequestInfo())); - List chartofaccounts = new ArrayList<>(); - ChartOfAccount chartOfAccount; - List chartOfAccountContracts = new ArrayList<>(); - ChartOfAccountContract contract; - - chartOfAccountRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (ChartOfAccountContract chartOfAccountContract : chartOfAccountRequest.getChartOfAccounts()) { - chartOfAccount = new ChartOfAccount(); - model.map(chartOfAccountContract, chartOfAccount); - chartOfAccount.setCreatedDate(new Date()); - chartOfAccount.setCreatedBy(chartOfAccountRequest.getRequestInfo().getUserInfo()); - chartOfAccount.setLastModifiedBy(chartOfAccountRequest.getRequestInfo().getUserInfo()); - chartofaccounts.add(chartOfAccount); - } - - chartofaccounts = chartOfAccountService.add(chartofaccounts, errors); - - for (ChartOfAccount f : chartofaccounts) { - contract = new ChartOfAccountContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - chartOfAccountContracts.add(contract); - } - - chartOfAccountRequest.setChartOfAccounts(chartOfAccountContracts); - chartOfAccountService.addToQue(chartOfAccountRequest); - chartOfAccountResponse.setChartOfAccounts(chartOfAccountContracts); - - return chartOfAccountResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public ChartOfAccountResponse update(@RequestBody ChartOfAccountRequest chartOfAccountRequest, - BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - chartOfAccountRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - ChartOfAccountResponse chartOfAccountResponse = new ChartOfAccountResponse(); - List chartofaccounts = new ArrayList<>(); - chartOfAccountResponse.setResponseInfo(getResponseInfo(chartOfAccountRequest.getRequestInfo())); - ChartOfAccount chartOfAccount; - ChartOfAccountContract contract; - List chartOfAccountContracts = new ArrayList<>(); - - for (ChartOfAccountContract chartOfAccountContract : chartOfAccountRequest.getChartOfAccounts()) { - chartOfAccount = new ChartOfAccount(); - model.map(chartOfAccountContract, chartOfAccount); - chartOfAccount.setLastModifiedBy(chartOfAccountRequest.getRequestInfo().getUserInfo()); - chartOfAccount.setLastModifiedDate(new Date()); - chartofaccounts.add(chartOfAccount); - } - - chartofaccounts = chartOfAccountService.update(chartofaccounts, errors); - - for (ChartOfAccount chartOfAccountObj : chartofaccounts) { - contract = new ChartOfAccountContract(); - model.map(chartOfAccountObj, contract); - chartOfAccountObj.setLastModifiedDate(new Date()); - chartOfAccountContracts.add(contract); - } - - chartOfAccountRequest.setChartOfAccounts(chartOfAccountContracts); - chartOfAccountService.addToQue(chartOfAccountRequest); - chartOfAccountResponse.setChartOfAccounts(chartOfAccountContracts); - - return chartOfAccountResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public ChartOfAccountResponse search(@ModelAttribute ChartOfAccountSearchContract chartOfAccountSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - ChartOfAccountSearch domain = new ChartOfAccountSearch(); - mapper.map(chartOfAccountSearchContract, domain); - ChartOfAccountContract contract; - ModelMapper model = new ModelMapper(); - List chartOfAccountContracts = new ArrayList<>(); - Pagination chartofaccounts = chartOfAccountService.search(domain, errors); - - for (ChartOfAccount chartOfAccount : chartofaccounts.getPagedData()) { - contract = new ChartOfAccountContract(); - model.map(chartOfAccount, contract); - chartOfAccountContracts.add(contract); - } - - ChartOfAccountResponse response = new ChartOfAccountResponse(); - response.setChartOfAccounts(chartOfAccountContracts); - response.setPage(new PaginationContract(chartofaccounts)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/ChartOfAccountDetailController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/ChartOfAccountDetailController.java deleted file mode 100644 index af8a8c767e4..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/ChartOfAccountDetailController.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; -import org.egov.egf.master.domain.service.ChartOfAccountDetailService; -import org.egov.egf.master.web.contract.ChartOfAccountDetailContract; -import org.egov.egf.master.web.contract.ChartOfAccountDetailSearchContract; -import org.egov.egf.master.web.requests.ChartOfAccountDetailRequest; -import org.egov.egf.master.web.requests.ChartOfAccountDetailResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/chartofaccountdetails") -public class ChartOfAccountDetailController { - - @Autowired - private ChartOfAccountDetailService chartOfAccountDetailService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public ChartOfAccountDetailResponse create(@RequestBody ChartOfAccountDetailRequest chartOfAccountDetailRequest, - BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - ChartOfAccountDetailResponse chartOfAccountDetailResponse = new ChartOfAccountDetailResponse(); - chartOfAccountDetailResponse.setResponseInfo(getResponseInfo(chartOfAccountDetailRequest.getRequestInfo())); - List chartofaccountdetails = new ArrayList<>(); - ChartOfAccountDetail chartOfAccountDetail; - List chartOfAccountDetailContracts = new ArrayList<>(); - ChartOfAccountDetailContract contract; - - chartOfAccountDetailRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (ChartOfAccountDetailContract chartOfAccountDetailContract : chartOfAccountDetailRequest - .getChartOfAccountDetails()) { - chartOfAccountDetail = new ChartOfAccountDetail(); - model.map(chartOfAccountDetailContract, chartOfAccountDetail); - chartOfAccountDetail.setCreatedDate(new Date()); - chartOfAccountDetail.setCreatedBy(chartOfAccountDetailRequest.getRequestInfo().getUserInfo()); - chartOfAccountDetail.setLastModifiedBy(chartOfAccountDetailRequest.getRequestInfo().getUserInfo()); - chartofaccountdetails.add(chartOfAccountDetail); - } - - chartofaccountdetails = chartOfAccountDetailService.add(chartofaccountdetails, errors); - - for (ChartOfAccountDetail f : chartofaccountdetails) { - contract = new ChartOfAccountDetailContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - chartOfAccountDetailContracts.add(contract); - } - - chartOfAccountDetailRequest.setChartOfAccountDetails(chartOfAccountDetailContracts); - chartOfAccountDetailService.addToQue(chartOfAccountDetailRequest); - chartOfAccountDetailResponse.setChartOfAccountDetails(chartOfAccountDetailContracts); - - return chartOfAccountDetailResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public ChartOfAccountDetailResponse update(@RequestBody ChartOfAccountDetailRequest chartOfAccountDetailRequest, - BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - chartOfAccountDetailRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - ChartOfAccountDetailResponse chartOfAccountDetailResponse = new ChartOfAccountDetailResponse(); - List chartofaccountdetails = new ArrayList<>(); - chartOfAccountDetailResponse.setResponseInfo(getResponseInfo(chartOfAccountDetailRequest.getRequestInfo())); - ChartOfAccountDetail chartOfAccountDetail; - ChartOfAccountDetailContract contract; - List chartOfAccountDetailContracts = new ArrayList<>(); - - for (ChartOfAccountDetailContract chartOfAccountDetailContract : chartOfAccountDetailRequest - .getChartOfAccountDetails()) { - chartOfAccountDetail = new ChartOfAccountDetail(); - model.map(chartOfAccountDetailContract, chartOfAccountDetail); - chartOfAccountDetail.setLastModifiedBy(chartOfAccountDetailRequest.getRequestInfo().getUserInfo()); - chartOfAccountDetail.setLastModifiedDate(new Date()); - chartofaccountdetails.add(chartOfAccountDetail); - } - - chartofaccountdetails = chartOfAccountDetailService.update(chartofaccountdetails, errors); - - for (ChartOfAccountDetail chartOfAccountDetailObj : chartofaccountdetails) { - contract = new ChartOfAccountDetailContract(); - model.map(chartOfAccountDetailObj, contract); - chartOfAccountDetailObj.setLastModifiedDate(new Date()); - chartOfAccountDetailContracts.add(contract); - } - - chartOfAccountDetailRequest.setChartOfAccountDetails(chartOfAccountDetailContracts); - chartOfAccountDetailService.addToQue(chartOfAccountDetailRequest); - chartOfAccountDetailResponse.setChartOfAccountDetails(chartOfAccountDetailContracts); - - return chartOfAccountDetailResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public ChartOfAccountDetailResponse search( - @ModelAttribute ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - ChartOfAccountDetailSearch domain = new ChartOfAccountDetailSearch(); - mapper.map(chartOfAccountDetailSearchContract, domain); - ChartOfAccountDetailContract contract; - ModelMapper model = new ModelMapper(); - List chartOfAccountDetailContracts = new ArrayList<>(); - Pagination chartofaccountdetails = chartOfAccountDetailService.search(domain, errors); - - for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails.getPagedData()) { - contract = new ChartOfAccountDetailContract(); - model.map(chartOfAccountDetail, contract); - chartOfAccountDetailContracts.add(contract); - } - - ChartOfAccountDetailResponse response = new ChartOfAccountDetailResponse(); - response.setChartOfAccountDetails(chartOfAccountDetailContracts); - response.setPage(new PaginationContract(chartofaccountdetails)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FinancialConfigurationController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FinancialConfigurationController.java deleted file mode 100644 index a52de514d96..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FinancialConfigurationController.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.FinancialConfiguration; -import org.egov.egf.master.domain.model.FinancialConfigurationSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.web.contract.FinancialConfigurationContract; -import org.egov.egf.master.web.contract.FinancialConfigurationSearchContract; -import org.egov.egf.master.web.requests.FinancialConfigurationRequest; -import org.egov.egf.master.web.requests.FinancialConfigurationResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/financialconfigurations") -public class FinancialConfigurationController { - - @Autowired - private FinancialConfigurationService financialConfigurationService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public FinancialConfigurationResponse create( - @RequestBody FinancialConfigurationRequest financialConfigurationRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - FinancialConfigurationResponse financialConfigurationResponse = new FinancialConfigurationResponse(); - financialConfigurationResponse.setResponseInfo(getResponseInfo(financialConfigurationRequest.getRequestInfo())); - List financialconfigurations = new ArrayList<>(); - FinancialConfiguration financialConfiguration; - List financialConfigurationContracts = new ArrayList<>(); - FinancialConfigurationContract contract; - - financialConfigurationRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (FinancialConfigurationContract financialConfigurationContract : financialConfigurationRequest - .getFinancialConfigurations()) { - financialConfiguration = new FinancialConfiguration(); - model.map(financialConfigurationContract, financialConfiguration); - financialConfiguration.setCreatedDate(new Date()); - financialConfiguration.setCreatedBy(financialConfigurationRequest.getRequestInfo().getUserInfo()); - financialConfiguration.setLastModifiedBy(financialConfigurationRequest.getRequestInfo().getUserInfo()); - financialconfigurations.add(financialConfiguration); - } - - financialconfigurations = financialConfigurationService.add(financialconfigurations, errors); - - for (FinancialConfiguration f : financialconfigurations) { - contract = new FinancialConfigurationContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - financialConfigurationContracts.add(contract); - } - - financialConfigurationRequest.setFinancialConfigurations(financialConfigurationContracts); - financialConfigurationService.addToQue(financialConfigurationRequest); - financialConfigurationResponse.setFinancialConfigurations(financialConfigurationContracts); - - return financialConfigurationResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public FinancialConfigurationResponse update( - @RequestBody FinancialConfigurationRequest financialConfigurationRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - financialConfigurationRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - FinancialConfigurationResponse financialConfigurationResponse = new FinancialConfigurationResponse(); - List financialconfigurations = new ArrayList<>(); - financialConfigurationResponse.setResponseInfo(getResponseInfo(financialConfigurationRequest.getRequestInfo())); - FinancialConfiguration financialConfiguration; - FinancialConfigurationContract contract; - List financialConfigurationContracts = new ArrayList<>(); - - for (FinancialConfigurationContract financialConfigurationContract : financialConfigurationRequest - .getFinancialConfigurations()) { - financialConfiguration = new FinancialConfiguration(); - model.map(financialConfigurationContract, financialConfiguration); - financialConfiguration.setLastModifiedBy(financialConfigurationRequest.getRequestInfo().getUserInfo()); - financialConfiguration.setLastModifiedDate(new Date()); - financialconfigurations.add(financialConfiguration); - } - - financialconfigurations = financialConfigurationService.update(financialconfigurations, errors); - - for (FinancialConfiguration financialConfigurationObj : financialconfigurations) { - contract = new FinancialConfigurationContract(); - model.map(financialConfigurationObj, contract); - financialConfigurationObj.setLastModifiedDate(new Date()); - financialConfigurationContracts.add(contract); - } - - financialConfigurationRequest.setFinancialConfigurations(financialConfigurationContracts); - financialConfigurationService.addToQue(financialConfigurationRequest); - financialConfigurationResponse.setFinancialConfigurations(financialConfigurationContracts); - - return financialConfigurationResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public FinancialConfigurationResponse search( - @ModelAttribute FinancialConfigurationSearchContract financialConfigurationSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - FinancialConfigurationSearch domain = new FinancialConfigurationSearch(); - mapper.map(financialConfigurationSearchContract, domain); - FinancialConfigurationContract contract; - ModelMapper model = new ModelMapper(); - List financialConfigurationContracts = new ArrayList<>(); - Pagination financialconfigurations = financialConfigurationService.search(domain, errors); - - for (FinancialConfiguration financialConfiguration : financialconfigurations.getPagedData()) { - contract = new FinancialConfigurationContract(); - model.map(financialConfiguration, contract); - financialConfigurationContracts.add(contract); - } - - FinancialConfigurationResponse response = new FinancialConfigurationResponse(); - response.setFinancialConfigurations(financialConfigurationContracts); - response.setPage(new PaginationContract(financialconfigurations)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FinancialStatusController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FinancialStatusController.java deleted file mode 100644 index f3ffdab7ce3..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FinancialStatusController.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.FinancialStatus; -import org.egov.egf.master.domain.model.FinancialStatusSearch; -import org.egov.egf.master.domain.service.FinancialStatusService; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.egov.egf.master.web.contract.FinancialStatusSearchContract; -import org.egov.egf.master.web.requests.FinancialStatusRequest; -import org.egov.egf.master.web.requests.FinancialStatusResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/financialstatuses") -public class FinancialStatusController { - - @Autowired - private FinancialStatusService financialStatusService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public FinancialStatusResponse create(@RequestBody FinancialStatusRequest financialStatusRequest, - BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - FinancialStatusResponse financialStatusResponse = new FinancialStatusResponse(); - financialStatusResponse.setResponseInfo(getResponseInfo(financialStatusRequest.getRequestInfo())); - List financialstatuses = new ArrayList<>(); - FinancialStatus financialStatus; - List financialStatusContracts = new ArrayList<>(); - FinancialStatusContract contract; - - financialStatusRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (FinancialStatusContract financialStatusContract : financialStatusRequest.getFinancialStatuses()) { - financialStatus = new FinancialStatus(); - model.map(financialStatusContract, financialStatus); - financialStatus.setCreatedDate(new Date()); - financialStatus.setCreatedBy(financialStatusRequest.getRequestInfo().getUserInfo()); - financialStatus.setLastModifiedBy(financialStatusRequest.getRequestInfo().getUserInfo()); - financialstatuses.add(financialStatus); - } - - financialstatuses = financialStatusService.add(financialstatuses, errors); - - for (FinancialStatus f : financialstatuses) { - contract = new FinancialStatusContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - financialStatusContracts.add(contract); - } - - financialStatusRequest.setFinancialStatuses(financialStatusContracts); - financialStatusService.addToQue(financialStatusRequest); - financialStatusResponse.setFinancialStatuses(financialStatusContracts); - - return financialStatusResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public FinancialStatusResponse update(@RequestBody FinancialStatusRequest financialStatusRequest, - BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - financialStatusRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - FinancialStatusResponse financialStatusResponse = new FinancialStatusResponse(); - List financialstatuses = new ArrayList<>(); - financialStatusResponse.setResponseInfo(getResponseInfo(financialStatusRequest.getRequestInfo())); - FinancialStatus financialStatus; - FinancialStatusContract contract; - List financialStatusContracts = new ArrayList<>(); - - for (FinancialStatusContract financialStatusContract : financialStatusRequest.getFinancialStatuses()) { - financialStatus = new FinancialStatus(); - model.map(financialStatusContract, financialStatus); - financialStatus.setLastModifiedBy(financialStatusRequest.getRequestInfo().getUserInfo()); - financialStatus.setLastModifiedDate(new Date()); - financialstatuses.add(financialStatus); - } - - financialstatuses = financialStatusService.update(financialstatuses, errors); - - for (FinancialStatus financialStatusObj : financialstatuses) { - contract = new FinancialStatusContract(); - model.map(financialStatusObj, contract); - financialStatusObj.setLastModifiedDate(new Date()); - financialStatusContracts.add(contract); - } - - financialStatusRequest.setFinancialStatuses(financialStatusContracts); - financialStatusService.addToQue(financialStatusRequest); - financialStatusResponse.setFinancialStatuses(financialStatusContracts); - - return financialStatusResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public FinancialStatusResponse search(@ModelAttribute FinancialStatusSearchContract financialStatusSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - FinancialStatusSearch domain = new FinancialStatusSearch(); - mapper.map(financialStatusSearchContract, domain); - FinancialStatusContract contract; - ModelMapper model = new ModelMapper(); - List financialStatusContracts = new ArrayList<>(); - Pagination financialstatuses = financialStatusService.search(domain, errors); - - for (FinancialStatus financialStatus : financialstatuses.getPagedData()) { - contract = new FinancialStatusContract(); - model.map(financialStatus, contract); - financialStatusContracts.add(contract); - } - - FinancialStatusResponse response = new FinancialStatusResponse(); - response.setFinancialStatuses(financialStatusContracts); - response.setPage(new PaginationContract(financialstatuses)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FinancialYearController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FinancialYearController.java deleted file mode 100644 index 13c00f1cb3c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FinancialYearController.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.FinancialYear; -import org.egov.egf.master.domain.model.FinancialYearSearch; -import org.egov.egf.master.domain.service.FinancialYearService; -import org.egov.egf.master.web.contract.FinancialYearContract; -import org.egov.egf.master.web.contract.FinancialYearSearchContract; -import org.egov.egf.master.web.requests.FinancialYearRequest; -import org.egov.egf.master.web.requests.FinancialYearResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/financialyears") -public class FinancialYearController { - - @Autowired - private FinancialYearService financialYearService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public FinancialYearResponse create( - @RequestBody FinancialYearRequest financialYearContractRequest, - BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - FinancialYearResponse financialYearResponse = new FinancialYearResponse(); - List financialyears = new ArrayList<>(); - FinancialYear financialYear; - List financialYearContracts = new ArrayList<>(); - FinancialYearContract contract; - - financialYearContractRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (FinancialYearContract financialYearContract : financialYearContractRequest.getFinancialYears()) { - financialYear = new FinancialYear(); - model.map(financialYearContract, financialYear); - financialYear.setCreatedDate(new Date()); - financialYear.setCreatedBy(financialYearContractRequest.getRequestInfo().getUserInfo()); - financialYear.setLastModifiedBy(financialYearContractRequest.getRequestInfo().getUserInfo()); - financialyears.add(financialYear); - } - - financialyears = financialYearService.add(financialyears, errors); - - for (FinancialYear f : financialyears) { - contract = new FinancialYearContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - financialYearContracts.add(contract); - } - - financialYearContractRequest.setFinancialYears(financialYearContracts); - financialYearService.addToQue(financialYearContractRequest); - financialYearResponse.setFinancialYears(financialYearContracts); - - return financialYearResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public FinancialYearResponse update( - @RequestBody FinancialYearRequest financialYearContractRequest, - BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - financialYearContractRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - FinancialYearResponse financialYearResponse = new FinancialYearResponse(); - List financialyears = new ArrayList<>(); - FinancialYear financialYear; - FinancialYearContract contract; - List financialYearContracts = new ArrayList<>(); - - for (FinancialYearContract financialYearContract : financialYearContractRequest.getFinancialYears()) { - financialYear = new FinancialYear(); - model.map(financialYearContract, financialYear); - financialYear.setLastModifiedDate(new Date()); - financialYear.setLastModifiedBy(financialYearContractRequest.getRequestInfo().getUserInfo()); - financialyears.add(financialYear); - } - - financialyears = financialYearService.update(financialyears, errors); - - for (FinancialYear financialYearObj : financialyears) { - contract = new FinancialYearContract(); - model.map(financialYearObj, contract); - contract.setLastModifiedDate(new Date()); - financialYearContracts.add(contract); - } - - financialYearContractRequest.setFinancialYears(financialYearContracts); - financialYearService.addToQue(financialYearContractRequest); - financialYearResponse.setFinancialYears(financialYearContracts); - - return financialYearResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public FinancialYearResponse search( - @ModelAttribute FinancialYearSearchContract financialYearSearchContract, @RequestBody RequestInfo requestInfo, - BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - FinancialYearSearch domain = new FinancialYearSearch(); - mapper.map(financialYearSearchContract, domain); - FinancialYearContract contract; - ModelMapper model = new ModelMapper(); - List financialYearContracts = new ArrayList<>(); - - Pagination financialyears = financialYearService.search(domain, errors); - - for (FinancialYear financialYear : financialyears.getPagedData()) { - contract = new FinancialYearContract(); - model.map(financialYear, contract); - financialYearContracts.add(contract); - } - - FinancialYearResponse response = new FinancialYearResponse(); - response.setFinancialYears(financialYearContracts); - response.setPage(new PaginationContract(financialyears)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FiscalPeriodController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FiscalPeriodController.java deleted file mode 100644 index 048036a00ed..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FiscalPeriodController.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.FiscalPeriod; -import org.egov.egf.master.domain.model.FiscalPeriodSearch; -import org.egov.egf.master.domain.service.FiscalPeriodService; -import org.egov.egf.master.web.contract.FiscalPeriodContract; -import org.egov.egf.master.web.contract.FiscalPeriodSearchContract; -import org.egov.egf.master.web.requests.FiscalPeriodRequest; -import org.egov.egf.master.web.requests.FiscalPeriodResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/fiscalperiods") -public class FiscalPeriodController { - - @Autowired - private FiscalPeriodService fiscalPeriodService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public FiscalPeriodResponse create(@RequestBody FiscalPeriodRequest fiscalPeriodRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - FiscalPeriodResponse fiscalPeriodResponse = new FiscalPeriodResponse(); - fiscalPeriodResponse.setResponseInfo(getResponseInfo(fiscalPeriodRequest.getRequestInfo())); - List fiscalperiods = new ArrayList<>(); - FiscalPeriod fiscalPeriod; - List fiscalPeriodContracts = new ArrayList<>(); - FiscalPeriodContract contract; - - fiscalPeriodRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (FiscalPeriodContract fiscalPeriodContract : fiscalPeriodRequest.getFiscalPeriods()) { - fiscalPeriod = new FiscalPeriod(); - model.map(fiscalPeriodContract, fiscalPeriod); - fiscalPeriod.setCreatedDate(new Date()); - fiscalPeriod.setCreatedBy(fiscalPeriodRequest.getRequestInfo().getUserInfo()); - fiscalPeriod.setLastModifiedBy(fiscalPeriodRequest.getRequestInfo().getUserInfo()); - fiscalperiods.add(fiscalPeriod); - } - - fiscalperiods = fiscalPeriodService.add(fiscalperiods, errors); - - for (FiscalPeriod f : fiscalperiods) { - contract = new FiscalPeriodContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - fiscalPeriodContracts.add(contract); - } - - fiscalPeriodRequest.setFiscalPeriods(fiscalPeriodContracts); - fiscalPeriodService.addToQue(fiscalPeriodRequest); - fiscalPeriodResponse.setFiscalPeriods(fiscalPeriodContracts); - - return fiscalPeriodResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public FiscalPeriodResponse update(@RequestBody FiscalPeriodRequest fiscalPeriodRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - fiscalPeriodRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - FiscalPeriodResponse fiscalPeriodResponse = new FiscalPeriodResponse(); - List fiscalperiods = new ArrayList<>(); - fiscalPeriodResponse.setResponseInfo(getResponseInfo(fiscalPeriodRequest.getRequestInfo())); - FiscalPeriod fiscalPeriod; - FiscalPeriodContract contract; - List fiscalPeriodContracts = new ArrayList<>(); - - for (FiscalPeriodContract fiscalPeriodContract : fiscalPeriodRequest.getFiscalPeriods()) { - fiscalPeriod = new FiscalPeriod(); - model.map(fiscalPeriodContract, fiscalPeriod); - fiscalPeriod.setLastModifiedBy(fiscalPeriodRequest.getRequestInfo().getUserInfo()); - fiscalPeriod.setLastModifiedDate(new Date()); - fiscalperiods.add(fiscalPeriod); - } - - fiscalperiods = fiscalPeriodService.update(fiscalperiods, errors); - - for (FiscalPeriod fiscalPeriodObj : fiscalperiods) { - contract = new FiscalPeriodContract(); - model.map(fiscalPeriodObj, contract); - fiscalPeriodObj.setLastModifiedDate(new Date()); - fiscalPeriodContracts.add(contract); - } - - fiscalPeriodRequest.setFiscalPeriods(fiscalPeriodContracts); - fiscalPeriodService.addToQue(fiscalPeriodRequest); - fiscalPeriodResponse.setFiscalPeriods(fiscalPeriodContracts); - - return fiscalPeriodResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public FiscalPeriodResponse search(@ModelAttribute FiscalPeriodSearchContract fiscalPeriodSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - FiscalPeriodSearch domain = new FiscalPeriodSearch(); - mapper.map(fiscalPeriodSearchContract, domain); - FiscalPeriodContract contract; - ModelMapper model = new ModelMapper(); - List fiscalPeriodContracts = new ArrayList<>(); - Pagination fiscalperiods = fiscalPeriodService.search(domain, errors); - - for (FiscalPeriod fiscalPeriod : fiscalperiods.getPagedData()) { - contract = new FiscalPeriodContract(); - model.map(fiscalPeriod, contract); - fiscalPeriodContracts.add(contract); - } - - FiscalPeriodResponse response = new FiscalPeriodResponse(); - response.setFiscalPeriods(fiscalPeriodContracts); - response.setPage(new PaginationContract(fiscalperiods)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FunctionController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FunctionController.java deleted file mode 100644 index c3705d5995b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FunctionController.java +++ /dev/null @@ -1,144 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.domain.model.FunctionSearch; -import org.egov.egf.master.domain.service.FunctionService; -import org.egov.egf.master.web.contract.FunctionContract; -import org.egov.egf.master.web.contract.FunctionSearchContract; -import org.egov.egf.master.web.requests.FunctionRequest; -import org.egov.egf.master.web.requests.FunctionResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/functions") -public class FunctionController { - - @Autowired - private FunctionService functionService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public FunctionResponse create(@RequestBody FunctionRequest functionRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - FunctionResponse functionResponse = new FunctionResponse(); - functionResponse.setResponseInfo(getResponseInfo(functionRequest.getRequestInfo())); - List functions = new ArrayList<>(); - Function function; - List functionContracts = new ArrayList<>(); - FunctionContract contract; - - functionRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (FunctionContract functionContract : functionRequest.getFunctions()) { - function = new Function(); - model.map(functionContract, function); - function.setCreatedDate(new Date()); - function.setCreatedBy(functionRequest.getRequestInfo().getUserInfo()); - function.setLastModifiedBy(functionRequest.getRequestInfo().getUserInfo()); - functions.add(function); - } - - functions = functionService.create(functions, errors, functionRequest.getRequestInfo()); - - for (Function f : functions) { - contract = new FunctionContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - functionContracts.add(contract); - } - - functionResponse.setFunctions(functionContracts); - - return functionResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public FunctionResponse update(@RequestBody FunctionRequest functionRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - functionRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - FunctionResponse functionResponse = new FunctionResponse(); - List functions = new ArrayList<>(); - functionResponse.setResponseInfo(getResponseInfo(functionRequest.getRequestInfo())); - Function function; - FunctionContract contract; - List functionContracts = new ArrayList<>(); - for (FunctionContract functionContract : functionRequest.getFunctions()) { - function = new Function(); - model.map(functionContract, function); - function.setLastModifiedBy(functionRequest.getRequestInfo().getUserInfo()); - function.setLastModifiedDate(new Date()); - functions.add(function); - } - - functions = functionService.update(functions, errors, functionRequest.getRequestInfo()); - - for (Function functionObj : functions) { - contract = new FunctionContract(); - model.map(functionObj, contract); - functionObj.setLastModifiedDate(new Date()); - functionContracts.add(contract); - } - - functionResponse.setFunctions(functionContracts); - - return functionResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public FunctionResponse search(@ModelAttribute FunctionSearchContract functionSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - FunctionSearch domain = new FunctionSearch(); - mapper.map(functionSearchContract, domain); - FunctionContract contract; - ModelMapper model = new ModelMapper(); - List functionContracts = new ArrayList<>(); - Pagination functions = functionService.search(domain, errors); - - for (Function function : functions.getPagedData()) { - contract = new FunctionContract(); - model.map(function, contract); - functionContracts.add(contract); - } - - FunctionResponse response = new FunctionResponse(); - response.setFunctions(functionContracts); - response.setPage(new PaginationContract(functions)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FunctionaryController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FunctionaryController.java deleted file mode 100644 index 9d4b3f9e8cd..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FunctionaryController.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.Functionary; -import org.egov.egf.master.domain.model.FunctionarySearch; -import org.egov.egf.master.domain.service.FunctionaryService; -import org.egov.egf.master.web.contract.FunctionaryContract; -import org.egov.egf.master.web.contract.FunctionarySearchContract; -import org.egov.egf.master.web.requests.FunctionaryRequest; -import org.egov.egf.master.web.requests.FunctionaryResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/functionaries") -public class FunctionaryController { - - @Autowired - private FunctionaryService functionaryService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public FunctionaryResponse create(@RequestBody FunctionaryRequest functionaryRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - FunctionaryResponse functionaryResponse = new FunctionaryResponse(); - functionaryResponse.setResponseInfo(getResponseInfo(functionaryRequest.getRequestInfo())); - List functionaries = new ArrayList<>(); - Functionary functionary; - List functionaryContracts = new ArrayList<>(); - FunctionaryContract contract; - - functionaryRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (FunctionaryContract functionaryContract : functionaryRequest.getFunctionaries()) { - functionary = new Functionary(); - model.map(functionaryContract, functionary); - functionary.setCreatedDate(new Date()); - functionary.setCreatedBy(functionaryRequest.getRequestInfo().getUserInfo()); - functionary.setLastModifiedBy(functionaryRequest.getRequestInfo().getUserInfo()); - functionaries.add(functionary); - } - - functionaries = functionaryService.add(functionaries, errors); - - for (Functionary f : functionaries) { - contract = new FunctionaryContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - functionaryContracts.add(contract); - } - - functionaryRequest.setFunctionaries(functionaryContracts); - functionaryService.addToQue(functionaryRequest); - functionaryResponse.setFunctionaries(functionaryContracts); - - return functionaryResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public FunctionaryResponse update(@RequestBody FunctionaryRequest functionaryRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - functionaryRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - FunctionaryResponse functionaryResponse = new FunctionaryResponse(); - List functionaries = new ArrayList<>(); - functionaryResponse.setResponseInfo(getResponseInfo(functionaryRequest.getRequestInfo())); - Functionary functionary; - FunctionaryContract contract; - List functionaryContracts = new ArrayList<>(); - - for (FunctionaryContract functionaryContract : functionaryRequest.getFunctionaries()) { - functionary = new Functionary(); - model.map(functionaryContract, functionary); - functionary.setLastModifiedBy(functionaryRequest.getRequestInfo().getUserInfo()); - functionary.setLastModifiedDate(new Date()); - functionaries.add(functionary); - } - - functionaries = functionaryService.update(functionaries, errors); - - for (Functionary functionaryObj : functionaries) { - contract = new FunctionaryContract(); - model.map(functionaryObj, contract); - functionaryObj.setLastModifiedDate(new Date()); - functionaryContracts.add(contract); - } - - functionaryRequest.setFunctionaries(functionaryContracts); - functionaryService.addToQue(functionaryRequest); - functionaryResponse.setFunctionaries(functionaryContracts); - - return functionaryResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public FunctionaryResponse search(@ModelAttribute FunctionarySearchContract functionarySearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - FunctionarySearch domain = new FunctionarySearch(); - mapper.map(functionarySearchContract, domain); - FunctionaryContract contract; - ModelMapper model = new ModelMapper(); - List functionaryContracts = new ArrayList<>(); - Pagination functionaries = functionaryService.search(domain, errors); - - for (Functionary functionary : functionaries.getPagedData()) { - contract = new FunctionaryContract(); - model.map(functionary, contract); - functionaryContracts.add(contract); - } - - FunctionaryResponse response = new FunctionaryResponse(); - response.setFunctionaries(functionaryContracts); - response.setPage(new PaginationContract(functionaries)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FundController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FundController.java deleted file mode 100644 index 4e2189f0220..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FundController.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.FundSearch; -import org.egov.egf.master.domain.service.FundService; -import org.egov.egf.master.web.contract.FundContract; -import org.egov.egf.master.web.contract.FundSearchContract; -import org.egov.egf.master.web.requests.FundRequest; -import org.egov.egf.master.web.requests.FundResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/funds") -public class FundController { - - @Autowired - private FundService fundService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public FundResponse create(@RequestBody FundRequest fundRequest, BindingResult errors,@RequestParam String tenantId) { - - ApplicationThreadLocals.setRequestInfo(fundRequest.getRequestInfo()); -// ApplicationThreadLocals.setTenantId(); - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - FundResponse fundResponse = new FundResponse(); - fundResponse.setResponseInfo(getResponseInfo(fundRequest.getRequestInfo())); - List funds = new ArrayList<>(); - Fund fund; - List fundContracts = new ArrayList<>(); - FundContract contract; - - fundRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (FundContract fundContract : fundRequest.getFunds()) { - fund = new Fund(); - model.map(fundContract, fund); - fund.setCreatedDate(new Date()); - fund.setCreatedBy(fundRequest.getRequestInfo().getUserInfo()); - fund.setLastModifiedBy(fundRequest.getRequestInfo().getUserInfo()); - funds.add(fund); - } - - funds = fundService.create(funds, errors, fundRequest.getRequestInfo()); - - for (Fund f : funds) { - contract = new FundContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - fundContracts.add(contract); - } - - fundResponse.setFunds(fundContracts); - - return fundResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public FundResponse update(@RequestBody FundRequest fundRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - fundRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - FundResponse fundResponse = new FundResponse(); - List funds = new ArrayList<>(); - fundResponse.setResponseInfo(getResponseInfo(fundRequest.getRequestInfo())); - Fund fund; - FundContract contract; - List fundContracts = new ArrayList<>(); - - for (FundContract fundContract : fundRequest.getFunds()) { - fund = new Fund(); - model.map(fundContract, fund); - fund.setLastModifiedBy(fundRequest.getRequestInfo().getUserInfo()); - fund.setLastModifiedDate(new Date()); - funds.add(fund); - } - - funds = fundService.update(funds, errors, fundRequest.getRequestInfo()); - - for (Fund fundObj : funds) { - contract = new FundContract(); - model.map(fundObj, contract); - fundObj.setLastModifiedDate(new Date()); - fundContracts.add(contract); - } - - fundResponse.setFunds(fundContracts); - - return fundResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public FundResponse search(@ModelAttribute FundSearchContract fundSearchContract, @RequestBody RequestInfo requestInfo, - BindingResult errors,@RequestParam String tenantId) { - - System.out.println("requestInfo in FundController Search "+requestInfo.toString()); - System.out.println("requestInfo in FundController Search "+requestInfo.getAuthToken()); - ModelMapper mapper = new ModelMapper(); - FundSearch domain = new FundSearch(); - mapper.map(fundSearchContract, domain); - FundContract contract; - ModelMapper model = new ModelMapper(); - List fundContracts = new ArrayList<>(); - Pagination funds = fundService.search(domain, errors); - - if (funds.getPagedData() != null) { - for (Fund fund : funds.getPagedData()) { - contract = new FundContract(); - model.map(fund, contract); - fundContracts.add(contract); - } - } - - FundResponse response = new FundResponse(); - response.setFunds(fundContracts); - response.setPage(new PaginationContract(funds)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FundsourceController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FundsourceController.java deleted file mode 100644 index d04d3b584f6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/FundsourceController.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.Fundsource; -import org.egov.egf.master.domain.model.FundsourceSearch; -import org.egov.egf.master.domain.service.FundsourceService; -import org.egov.egf.master.web.contract.FundsourceContract; -import org.egov.egf.master.web.contract.FundsourceSearchContract; -import org.egov.egf.master.web.requests.FundsourceRequest; -import org.egov.egf.master.web.requests.FundsourceResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/fundsources") -public class FundsourceController { - - @Autowired - private FundsourceService fundsourceService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public FundsourceResponse create(@RequestBody FundsourceRequest fundsourceRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - FundsourceResponse fundsourceResponse = new FundsourceResponse(); - fundsourceResponse.setResponseInfo(getResponseInfo(fundsourceRequest.getRequestInfo())); - List fundsources = new ArrayList<>(); - Fundsource fundsource; - List fundsourceContracts = new ArrayList<>(); - FundsourceContract contract; - - fundsourceRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (FundsourceContract fundsourceContract : fundsourceRequest.getFundsources()) { - fundsource = new Fundsource(); - model.map(fundsourceContract, fundsource); - fundsource.setCreatedDate(new Date()); - fundsource.setCreatedBy(fundsourceRequest.getRequestInfo().getUserInfo()); - fundsource.setLastModifiedBy(fundsourceRequest.getRequestInfo().getUserInfo()); - fundsources.add(fundsource); - } - - fundsources = fundsourceService.add(fundsources, errors); - - for (Fundsource f : fundsources) { - contract = new FundsourceContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - fundsourceContracts.add(contract); - } - - fundsourceRequest.setFundsources(fundsourceContracts); - fundsourceService.addToQue(fundsourceRequest); - fundsourceResponse.setFundsources(fundsourceContracts); - - return fundsourceResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public FundsourceResponse update(@RequestBody FundsourceRequest fundsourceRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - fundsourceRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - FundsourceResponse fundsourceResponse = new FundsourceResponse(); - List fundsources = new ArrayList<>(); - fundsourceResponse.setResponseInfo(getResponseInfo(fundsourceRequest.getRequestInfo())); - Fundsource fundsource; - FundsourceContract contract; - List fundsourceContracts = new ArrayList<>(); - - for (FundsourceContract fundsourceContract : fundsourceRequest.getFundsources()) { - fundsource = new Fundsource(); - model.map(fundsourceContract, fundsource); - fundsource.setLastModifiedBy(fundsourceRequest.getRequestInfo().getUserInfo()); - fundsource.setLastModifiedDate(new Date()); - fundsources.add(fundsource); - } - - fundsources = fundsourceService.update(fundsources, errors); - - for (Fundsource fundsourceObj : fundsources) { - contract = new FundsourceContract(); - model.map(fundsourceObj, contract); - fundsourceObj.setLastModifiedDate(new Date()); - fundsourceContracts.add(contract); - } - - fundsourceRequest.setFundsources(fundsourceContracts); - fundsourceService.addToQue(fundsourceRequest); - fundsourceResponse.setFundsources(fundsourceContracts); - - return fundsourceResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public FundsourceResponse search(@ModelAttribute FundsourceSearchContract fundsourceSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - FundsourceSearch domain = new FundsourceSearch(); - mapper.map(fundsourceSearchContract, domain); - FundsourceContract contract; - ModelMapper model = new ModelMapper(); - List fundsourceContracts = new ArrayList<>(); - Pagination fundsources = fundsourceService.search(domain, errors); - - for (Fundsource fundsource : fundsources.getPagedData()) { - contract = new FundsourceContract(); - model.map(fundsource, contract); - fundsourceContracts.add(contract); - } - - FundsourceResponse response = new FundsourceResponse(); - response.setFundsources(fundsourceContracts); - response.setPage(new PaginationContract(fundsources)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/RecoveryController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/RecoveryController.java deleted file mode 100644 index 805b11c42b8..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/RecoveryController.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.egov.egf.master.web.controller; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.domain.model.Recovery; -import org.egov.egf.master.domain.model.RecoverySearch; -import org.egov.egf.master.domain.service.RecoveryService; -import org.egov.egf.master.web.contract.RecoveryContract; -import org.egov.egf.master.web.contract.RecoverySearchContract; -import org.egov.egf.master.web.requests.RecoveryRequest; -import org.egov.egf.master.web.requests.RecoveryResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -@RestController -@RequestMapping("/recoverys") -public class RecoveryController { - - @Autowired - private RecoveryService recoveryService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public RecoveryResponse create(@RequestBody RecoveryRequest recoveryRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - RecoveryResponse recoveryResponse = new RecoveryResponse(); - recoveryResponse.setResponseInfo(getResponseInfo(recoveryRequest.getRequestInfo())); - - List recoverys = new ArrayList<>(); - Recovery recovery; - List recoveryContracts = new ArrayList<>(); - RecoveryContract contract; - - recoveryRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (RecoveryContract recoveryContract : recoveryRequest.getRecoverys()) { - recovery = new Recovery(); - model.map(recoveryContract, recovery); - recovery.setCreatedDate(new Date()); - recovery.setCreatedBy(recoveryRequest.getRequestInfo().getUserInfo()); - recovery.setLastModifiedBy(recoveryRequest.getRequestInfo().getUserInfo()); - recoverys.add(recovery); - } - - recoverys = recoveryService.create(recoverys, errors, recoveryRequest.getRequestInfo()); - - for (Recovery f : recoverys) { - contract = new RecoveryContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - recoveryContracts.add(contract); - } - - recoveryResponse.setRecoverys(recoveryContracts); - - return recoveryResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public RecoveryResponse update(@RequestBody RecoveryRequest recoveryRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - recoveryRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - - ModelMapper model = new ModelMapper(); - RecoveryResponse recoveryResponse = new RecoveryResponse(); - recoveryResponse.setResponseInfo(getResponseInfo(recoveryRequest.getRequestInfo())); - - List recoverys = new ArrayList<>(); - Recovery recovery; - List recoveryContracts = new ArrayList<>(); - RecoveryContract contract; - - - for (RecoveryContract recoveryContract : recoveryRequest.getRecoverys()) { - recovery = new Recovery(); - model.map(recoveryContract, recovery); - recoveryContract.setLastModifiedBy(recoveryRequest.getRequestInfo().getUserInfo()); - recoveryContract.setLastModifiedDate(new Date()); - recoverys.add(recovery); - } - - recoverys = recoveryService.update(recoverys, errors, recoveryRequest.getRequestInfo()); - - for (Recovery recoveryObj : recoverys) { - contract = new RecoveryContract(); - model.map(recoveryObj, contract); - recoveryObj.setLastModifiedDate(new Date()); - recoveryContracts.add(contract); - } - - recoveryResponse.setRecoverys(recoveryContracts); - - return recoveryResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public RecoveryResponse search(@ModelAttribute RecoverySearchContract recoverySearchContract, @RequestBody RequestInfo requestInfo, - BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - RecoverySearch domain = new RecoverySearch(); - mapper.map(recoverySearchContract, domain); - RecoveryContract contract; - ModelMapper model = new ModelMapper(); - List recoveryContracts = new ArrayList<>(); - Pagination recoverys = recoveryService.search(domain, errors); - - if (recoverys.getPagedData() != null) { - for (Recovery recovery : recoverys.getPagedData()) { - contract = new RecoveryContract(); - model.map(recovery, contract); - recoveryContracts.add(contract); - } - } - - RecoveryResponse response = new RecoveryResponse(); - response.setRecoverys(recoveryContracts); - response.setPage(new PaginationContract(recoverys)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/SchemeController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/SchemeController.java deleted file mode 100644 index 381c9e725c2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/SchemeController.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.Scheme; -import org.egov.egf.master.domain.model.SchemeSearch; -import org.egov.egf.master.domain.service.SchemeService; -import org.egov.egf.master.web.contract.SchemeContract; -import org.egov.egf.master.web.contract.SchemeSearchContract; -import org.egov.egf.master.web.requests.SchemeRequest; -import org.egov.egf.master.web.requests.SchemeResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/schemes") -public class SchemeController { - - @Autowired - private SchemeService schemeService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public SchemeResponse create(@RequestBody SchemeRequest schemeRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - SchemeResponse schemeResponse = new SchemeResponse(); - schemeResponse.setResponseInfo(getResponseInfo(schemeRequest.getRequestInfo())); - List schemes = new ArrayList<>(); - Scheme scheme; - List schemeContracts = new ArrayList<>(); - SchemeContract contract; - - schemeRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (SchemeContract schemeContract : schemeRequest.getSchemes()) { - scheme = new Scheme(); - model.map(schemeContract, scheme); - scheme.setCreatedDate(new Date()); - scheme.setCreatedBy(schemeRequest.getRequestInfo().getUserInfo()); - scheme.setLastModifiedBy(schemeRequest.getRequestInfo().getUserInfo()); - schemes.add(scheme); - } - - schemes = schemeService.add(schemes, errors); - - for (Scheme f : schemes) { - contract = new SchemeContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - schemeContracts.add(contract); - } - - schemeRequest.setSchemes(schemeContracts); - schemeService.addToQue(schemeRequest); - schemeResponse.setSchemes(schemeContracts); - - return schemeResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public SchemeResponse update(@RequestBody SchemeRequest schemeRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - schemeRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - SchemeResponse schemeResponse = new SchemeResponse(); - List schemes = new ArrayList<>(); - schemeResponse.setResponseInfo(getResponseInfo(schemeRequest.getRequestInfo())); - Scheme scheme; - SchemeContract contract; - List schemeContracts = new ArrayList<>(); - - for (SchemeContract schemeContract : schemeRequest.getSchemes()) { - scheme = new Scheme(); - model.map(schemeContract, scheme); - scheme.setLastModifiedBy(schemeRequest.getRequestInfo().getUserInfo()); - scheme.setLastModifiedDate(new Date()); - schemes.add(scheme); - } - - schemes = schemeService.update(schemes, errors); - - for (Scheme schemeObj : schemes) { - contract = new SchemeContract(); - model.map(schemeObj, contract); - schemeObj.setLastModifiedDate(new Date()); - schemeContracts.add(contract); - } - - schemeRequest.setSchemes(schemeContracts); - schemeService.addToQue(schemeRequest); - schemeResponse.setSchemes(schemeContracts); - - return schemeResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public SchemeResponse search(@ModelAttribute SchemeSearchContract schemeSearchContract, @RequestBody RequestInfo requestInfo, - BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - SchemeSearch domain = new SchemeSearch(); - mapper.map(schemeSearchContract, domain); - SchemeContract contract; - ModelMapper model = new ModelMapper(); - List schemeContracts = new ArrayList<>(); - Pagination schemes = schemeService.search(domain, errors); - - for (Scheme scheme : schemes.getPagedData()) { - contract = new SchemeContract(); - model.map(scheme, contract); - schemeContracts.add(contract); - } - - SchemeResponse response = new SchemeResponse(); - response.setSchemes(schemeContracts); - response.setPage(new PaginationContract(schemes)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/SubSchemeController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/SubSchemeController.java deleted file mode 100644 index 00ec02dd623..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/SubSchemeController.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.SubScheme; -import org.egov.egf.master.domain.model.SubSchemeSearch; -import org.egov.egf.master.domain.service.SubSchemeService; -import org.egov.egf.master.web.contract.SubSchemeContract; -import org.egov.egf.master.web.contract.SubSchemeSearchContract; -import org.egov.egf.master.web.requests.SubSchemeRequest; -import org.egov.egf.master.web.requests.SubSchemeResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/subschemes") -public class SubSchemeController { - - @Autowired - private SubSchemeService subSchemeService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public SubSchemeResponse create(@RequestBody SubSchemeRequest subSchemeRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - SubSchemeResponse subSchemeResponse = new SubSchemeResponse(); - subSchemeResponse.setResponseInfo(getResponseInfo(subSchemeRequest.getRequestInfo())); - List subschemes = new ArrayList<>(); - SubScheme subScheme; - List subSchemeContracts = new ArrayList<>(); - SubSchemeContract contract; - - subSchemeRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (SubSchemeContract subSchemeContract : subSchemeRequest.getSubSchemes()) { - subScheme = new SubScheme(); - model.map(subSchemeContract, subScheme); - subScheme.setCreatedDate(new Date()); - subScheme.setCreatedBy(subSchemeRequest.getRequestInfo().getUserInfo()); - subScheme.setLastModifiedBy(subSchemeRequest.getRequestInfo().getUserInfo()); - subschemes.add(subScheme); - } - - subschemes = subSchemeService.add(subschemes, errors); - - for (SubScheme f : subschemes) { - contract = new SubSchemeContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - subSchemeContracts.add(contract); - } - - subSchemeRequest.setSubSchemes(subSchemeContracts); - subSchemeService.addToQue(subSchemeRequest); - subSchemeResponse.setSubSchemes(subSchemeContracts); - - return subSchemeResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public SubSchemeResponse update(@RequestBody SubSchemeRequest subSchemeRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - subSchemeRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - SubSchemeResponse subSchemeResponse = new SubSchemeResponse(); - List subschemes = new ArrayList<>(); - subSchemeResponse.setResponseInfo(getResponseInfo(subSchemeRequest.getRequestInfo())); - SubScheme subScheme; - SubSchemeContract contract; - List subSchemeContracts = new ArrayList<>(); - - for (SubSchemeContract subSchemeContract : subSchemeRequest.getSubSchemes()) { - subScheme = new SubScheme(); - model.map(subSchemeContract, subScheme); - subScheme.setLastModifiedBy(subSchemeRequest.getRequestInfo().getUserInfo()); - subScheme.setLastModifiedDate(new Date()); - subschemes.add(subScheme); - } - - subschemes = subSchemeService.update(subschemes, errors); - - for (SubScheme subSchemeObj : subschemes) { - contract = new SubSchemeContract(); - model.map(subSchemeObj, contract); - subSchemeObj.setLastModifiedDate(new Date()); - subSchemeContracts.add(contract); - } - - subSchemeRequest.setSubSchemes(subSchemeContracts); - subSchemeService.addToQue(subSchemeRequest); - subSchemeResponse.setSubSchemes(subSchemeContracts); - - return subSchemeResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public SubSchemeResponse search(@ModelAttribute SubSchemeSearchContract subSchemeSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - SubSchemeSearch domain = new SubSchemeSearch(); - mapper.map(subSchemeSearchContract, domain); - SubSchemeContract contract; - ModelMapper model = new ModelMapper(); - List subSchemeContracts = new ArrayList<>(); - Pagination subschemes = subSchemeService.search(domain, errors); - - for (SubScheme subScheme : subschemes.getPagedData()) { - contract = new SubSchemeContract(); - model.map(subScheme, contract); - subSchemeContracts.add(contract); - } - - SubSchemeResponse response = new SubSchemeResponse(); - response.setSubSchemes(subSchemeContracts); - response.setPage(new PaginationContract(subschemes)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/SupplierController.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/SupplierController.java deleted file mode 100644 index 96f3a08103c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/controller/SupplierController.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.egov.egf.master.web.controller; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.domain.model.Supplier; -import org.egov.egf.master.domain.model.SupplierSearch; -import org.egov.egf.master.domain.service.SupplierService; -import org.egov.egf.master.web.contract.SupplierContract; -import org.egov.egf.master.web.contract.SupplierSearchContract; -import org.egov.egf.master.web.requests.SupplierRequest; -import org.egov.egf.master.web.requests.SupplierResponse; -import org.modelmapper.ModelMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -@RestController -@RequestMapping("/suppliers") -public class SupplierController { - - @Autowired - private SupplierService supplierService; - - @PostMapping("/_create") - @ResponseStatus(HttpStatus.CREATED) - public SupplierResponse create(@RequestBody SupplierRequest supplierRequest, BindingResult errors,@RequestParam String tenantId) { - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - - ModelMapper model = new ModelMapper(); - SupplierResponse supplierResponse = new SupplierResponse(); - supplierResponse.setResponseInfo(getResponseInfo(supplierRequest.getRequestInfo())); - List suppliers = new ArrayList<>(); - Supplier supplier; - List supplierContracts = new ArrayList<>(); - SupplierContract contract; - - supplierRequest.getRequestInfo().setAction(Constants.ACTION_CREATE); - - for (SupplierContract supplierContract : supplierRequest.getSuppliers()) { - supplier = new Supplier(); - model.map(supplierContract, supplier); - supplier.setCreatedDate(new Date()); - supplier.setCreatedBy(supplierRequest.getRequestInfo().getUserInfo()); - supplier.setLastModifiedBy(supplierRequest.getRequestInfo().getUserInfo()); - suppliers.add(supplier); - } - - suppliers = supplierService.add(suppliers, errors); - - for (Supplier f : suppliers) { - contract = new SupplierContract(); - contract.setCreatedDate(new Date()); - model.map(f, contract); - supplierContracts.add(contract); - } - - supplierRequest.setSuppliers(supplierContracts); - supplierService.addToQue(supplierRequest); - supplierResponse.setSuppliers(supplierContracts); - - return supplierResponse; - } - - @PostMapping("/_update") - @ResponseStatus(HttpStatus.CREATED) - public SupplierResponse update(@RequestBody SupplierRequest supplierRequest, BindingResult errors,@RequestParam String tenantId) { - - if (errors.hasErrors()) { - throw new CustomBindException(errors); - } - supplierRequest.getRequestInfo().setAction(Constants.ACTION_UPDATE); - ModelMapper model = new ModelMapper(); - SupplierResponse supplierResponse = new SupplierResponse(); - List suppliers = new ArrayList<>(); - supplierResponse.setResponseInfo(getResponseInfo(supplierRequest.getRequestInfo())); - Supplier supplier; - SupplierContract contract; - List supplierContracts = new ArrayList<>(); - - for (SupplierContract supplierContract : supplierRequest.getSuppliers()) { - supplier = new Supplier(); - model.map(supplierContract, supplier); - supplier.setLastModifiedBy(supplierRequest.getRequestInfo().getUserInfo()); - supplier.setLastModifiedDate(new Date()); - suppliers.add(supplier); - } - - suppliers = supplierService.update(suppliers, errors); - - for (Supplier supplierObj : suppliers) { - contract = new SupplierContract(); - model.map(supplierObj, contract); - supplierObj.setLastModifiedDate(new Date()); - supplierContracts.add(contract); - } - - supplierRequest.setSuppliers(supplierContracts); - supplierService.addToQue(supplierRequest); - supplierResponse.setSuppliers(supplierContracts); - - return supplierResponse; - } - - @PostMapping("/_search") - @ResponseBody - @ResponseStatus(HttpStatus.OK) - public SupplierResponse search(@ModelAttribute SupplierSearchContract supplierSearchContract, - @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { - - ModelMapper mapper = new ModelMapper(); - SupplierSearch domain = new SupplierSearch(); - mapper.map(supplierSearchContract, domain); - SupplierContract contract; - ModelMapper model = new ModelMapper(); - List supplierContracts = new ArrayList<>(); - Pagination suppliers = supplierService.search(domain, errors); - - for (Supplier supplier : suppliers.getPagedData()) { - contract = new SupplierContract(); - model.map(supplier, contract); - supplierContracts.add(contract); - } - - SupplierResponse response = new SupplierResponse(); - response.setSuppliers(supplierContracts); - response.setPage(new PaginationContract(suppliers)); - response.setResponseInfo(getResponseInfo(requestInfo)); - - return response; - - } - - private ResponseInfo getResponseInfo(RequestInfo requestInfo) { - return ResponseInfo.builder().apiId(requestInfo.getApiId()).ver(requestInfo.getVer()) - .resMsgId(requestInfo.getMsgId()).resMsgId("placeholder").status("placeholder").build(); - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountCodePurposeContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountCodePurposeContractRepository.java deleted file mode 100644 index 8b8bb89f48a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountCodePurposeContractRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.AccountCodePurposeContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.AccountCodePurposeResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class AccountCodePurposeContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/accountcodepurposes/_search?"; - - public AccountCodePurposeContractRepository(@Value("${egf.master.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public AccountCodePurposeContract findById(AccountCodePurposeContract accountCodePurposeContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (accountCodePurposeContract.getId() != null) { - content.append("id=" + accountCodePurposeContract.getId()); - } - - if (accountCodePurposeContract.getTenantId() != null) { - content.append("&tenantId=" + accountCodePurposeContract.getTenantId()); - } - url = url + content.toString(); - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - AccountCodePurposeResponse result; - - result = restTemplate.postForObject(url, requestInfoWrapper, AccountCodePurposeResponse.class); - - if (result.getAccountCodePurposes() != null && result.getAccountCodePurposes().size() == 1) { - return result.getAccountCodePurposes().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountDetailKeyContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountDetailKeyContractRepository.java deleted file mode 100644 index f1982046f85..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountDetailKeyContractRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.AccountDetailKeyContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.AccountDetailKeyResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class AccountDetailKeyContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/accountdetailkeys/_search?"; - - public AccountDetailKeyContractRepository(@Value("${egf.master.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public AccountDetailKeyContract findById(AccountDetailKeyContract accountDetailKeyContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (accountDetailKeyContract.getId() != null) { - content.append("id=" + accountDetailKeyContract.getId()); - } - - if (accountDetailKeyContract.getTenantId() != null) { - content.append("&tenantId=" + accountDetailKeyContract.getTenantId()); - } - url = url + content.toString(); - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - AccountDetailKeyResponse result; - - result = restTemplate.postForObject(url, requestInfoWrapper, AccountDetailKeyResponse.class); - - if (result.getAccountDetailKeys() != null && result.getAccountDetailKeys().size() == 1) { - return result.getAccountDetailKeys().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountDetailTypeContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountDetailTypeContractRepository.java deleted file mode 100644 index e6ec0c1ad8d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountDetailTypeContractRepository.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.AccountDetailTypeResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class AccountDetailTypeContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/accountdetailtypes/_search?"; - - public AccountDetailTypeContractRepository(@Value("${egf.master.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public AccountDetailTypeContract findById(AccountDetailTypeContract accountDetailTypeContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (accountDetailTypeContract.getId() != null) { - content.append("id=" + accountDetailTypeContract.getId()); - } - - if (accountDetailTypeContract.getTenantId() != null) { - content.append("&tenantId=" + accountDetailTypeContract.getTenantId()); - } - url = url + content.toString(); - AccountDetailTypeResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, AccountDetailTypeResponse.class); - - - if (result.getAccountDetailTypes() != null && result.getAccountDetailTypes().size() == 1) { - return result.getAccountDetailTypes().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountEntityContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountEntityContractRepository.java deleted file mode 100644 index 145405625bf..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/AccountEntityContractRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.AccountEntityContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.AccountEntityResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class AccountEntityContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/accountentities/_search?"; - - public AccountEntityContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public AccountEntityContract findById(AccountEntityContract accountEntityContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (accountEntityContract.getId() != null) { - content.append("id=" + accountEntityContract.getId()); - } - - if (accountEntityContract.getTenantId() != null) { - content.append("&tenantId=" + accountEntityContract.getTenantId()); - } - url = url + content.toString(); - AccountEntityResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, AccountEntityResponse.class); - - - if (result.getAccountEntities() != null && result.getAccountEntities().size() == 1) { - return result.getAccountEntities().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BankAccountContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BankAccountContractRepository.java deleted file mode 100644 index 63da0d3c42f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BankAccountContractRepository.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.BankAccountResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class BankAccountContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/bankaccounts/_search?"; - - public BankAccountContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public BankAccountContract findById(BankAccountContract bankAccountContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (bankAccountContract.getId() != null) { - content.append("id=" + bankAccountContract.getId()); - } - - if (bankAccountContract.getTenantId() != null) { - content.append("&tenantId=" + bankAccountContract.getTenantId()); - } - url = url + content.toString(); - BankAccountResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, BankAccountResponse.class); - - - if (result.getBankAccounts() != null && result.getBankAccounts().size() == 1) { - return result.getBankAccounts().get(0); - } else { - return null; - } - - } - - public BankAccountContract findByAccountNumber(BankAccountContract bankAccountContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (bankAccountContract.getId() != null) { - content.append("accountNumber=" + bankAccountContract.getAccountNumber()); - } - - if (bankAccountContract.getTenantId() != null) { - content.append("&tenantId=" + bankAccountContract.getTenantId()); - } - url = url + content.toString(); - - BankAccountResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, BankAccountResponse.class); - - if (result.getBankAccounts() != null && result.getBankAccounts().size() == 1) { - return result.getBankAccounts().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BankBranchContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BankBranchContractRepository.java deleted file mode 100644 index 1164622a59a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BankBranchContractRepository.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.BankBranchContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.BankBranchResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class BankBranchContractRepository { - - public static final String SEARCH_URL = "/egf-master/bankbranches/_search?"; - private RestTemplate restTemplate; - private String hostUrl; - - public BankBranchContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public BankBranchContract findById(BankBranchContract bankBranchContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (bankBranchContract.getId() != null) { - content.append("id=" + bankBranchContract.getId()); - } - - if (bankBranchContract.getTenantId() != null) { - content.append("&tenantId=" + bankBranchContract.getTenantId()); - } - url = url + content.toString(); - BankBranchResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, BankBranchResponse.class); - - if (result.getBankBranches() != null && result.getBankBranches().size() == 1) { - return result.getBankBranches().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BankContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BankContractRepository.java deleted file mode 100644 index 55f993607d2..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BankContractRepository.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.BankResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class BankContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/banks/_search?"; - - public BankContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public BankContract findById(BankContract bankContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (bankContract.getId() != null) { - content.append("id=" + bankContract.getId()); - } - - if (bankContract.getTenantId() != null) { - content.append("&tenantId=" + bankContract.getTenantId()); - } - url = url + content.toString(); - - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - BankResponse result = restTemplate.postForObject(url, requestInfoWrapper, BankResponse.class); - - if (result.getBanks() != null && result.getBanks().size() == 1) { - return result.getBanks().get(0); - } else { - return null; - } - - } - - public BankContract findByCode(BankContract bankContract) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (bankContract.getCode() != null) { - content.append("code=" + bankContract.getCode()); - } - - if (bankContract.getTenantId() != null) { - content.append("&tenantId=" + bankContract.getTenantId()); - } - url = url + content.toString(); - BankResponse result = restTemplate.postForObject(url, null, BankResponse.class); - - if (result.getBanks() != null && result.getBanks().size() == 1) { - return result.getBanks().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BudgetGroupContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BudgetGroupContractRepository.java deleted file mode 100644 index 404907d1dc1..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/BudgetGroupContractRepository.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.BudgetGroupContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.BudgetGroupResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class BudgetGroupContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/budgetgroups/_search?"; - - public BudgetGroupContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public BudgetGroupContract findById(BudgetGroupContract budgetGroupContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (budgetGroupContract.getId() != null) { - content.append("id=" + budgetGroupContract.getId()); - } - - if (budgetGroupContract.getTenantId() != null) { - content.append("&tenantId=" + budgetGroupContract.getTenantId()); - } - url = url + content.toString(); - BudgetGroupResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, BudgetGroupResponse.class); - - if (result.getBudgetGroups() != null && result.getBudgetGroups().size() == 1) { - return result.getBudgetGroups().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/ChartOfAccountContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/ChartOfAccountContractRepository.java deleted file mode 100644 index 0e660e13815..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/ChartOfAccountContractRepository.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.ChartOfAccountResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class ChartOfAccountContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/chartofaccounts/_search?"; - - public ChartOfAccountContractRepository(@Value("${egf.master.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public ChartOfAccountContract findById(ChartOfAccountContract chartOfAccountContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (chartOfAccountContract.getId() != null) { - content.append("id=" + chartOfAccountContract.getId()); - } - - if (chartOfAccountContract.getTenantId() != null) { - content.append("&tenantId=" + chartOfAccountContract.getTenantId()); - } - url = url + content.toString(); - ChartOfAccountResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, ChartOfAccountResponse.class); - - if (result.getChartOfAccounts() != null && result.getChartOfAccounts().size() == 1) { - return result.getChartOfAccounts().get(0); - } else { - return null; - } - - } - - public ChartOfAccountContract findByGlcode(ChartOfAccountContract chartOfAccountContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (chartOfAccountContract.getGlcode() != null) { - content.append("glcode=" + chartOfAccountContract.getGlcode()); - } - - if (chartOfAccountContract.getTenantId() != null) { - content.append("&tenantId=" + chartOfAccountContract.getTenantId()); - } - url = url + content.toString(); - ChartOfAccountResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - result = restTemplate.postForObject(url, requestInfoWrapper, ChartOfAccountResponse.class); - - if (result.getChartOfAccounts() != null && result.getChartOfAccounts().size() == 1) { - return result.getChartOfAccounts().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/ChartOfAccountDetailContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/ChartOfAccountDetailContractRepository.java deleted file mode 100644 index ff264e02786..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/ChartOfAccountDetailContractRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.ChartOfAccountDetailContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.ChartOfAccountDetailResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class ChartOfAccountDetailContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/chartofaccountdetails/_search?"; - - public ChartOfAccountDetailContractRepository(@Value("${egf.master.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public ChartOfAccountDetailContract findById(ChartOfAccountDetailContract chartOfAccountDetailContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (chartOfAccountDetailContract.getId() != null) { - content.append("id=" + chartOfAccountDetailContract.getId()); - } - - if (chartOfAccountDetailContract.getTenantId() != null) { - content.append("&tenantId=" + chartOfAccountDetailContract.getTenantId()); - } - url = url + content.toString(); - ChartOfAccountDetailResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, ChartOfAccountDetailResponse.class); - - if (result.getChartOfAccountDetails() != null && result.getChartOfAccountDetails().size() == 1) { - return result.getChartOfAccountDetails().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FinancialConfigurationContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FinancialConfigurationContractRepository.java deleted file mode 100644 index 41d9a6ee026..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FinancialConfigurationContractRepository.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FinancialConfigurationContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.FinancialConfigurationResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.RestTemplate; - -@Repository -public class FinancialConfigurationContractRepository { - - public static final String SEARCH_URL = "/egf-master/financialconfigurations/_search?"; - private RestTemplate restTemplate; - private String hostUrl; - private String fetchDataFrom; - - public FinancialConfigurationContractRepository(@Value("${egf.master.host.url}") String hostUrl, - @Value("${fetch_data_from}") String fetchDataFrom, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - this.fetchDataFrom = fetchDataFrom; - } - - public FinancialConfigurationContract findById(FinancialConfigurationContract financialConfigurationContract, - RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (financialConfigurationContract.getId() != null) { - content.append("id=" + financialConfigurationContract.getId()); - } - - if (financialConfigurationContract.getTenantId() != null) { - content.append("&tenantId=" + financialConfigurationContract.getTenantId()); - } - url = url + content.toString(); - FinancialConfigurationResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, FinancialConfigurationResponse.class); - - if (result.getFinancialConfigurations() != null && result.getFinancialConfigurations().size() == 1) { - return result.getFinancialConfigurations().get(0); - } else { - return null; - } - - } - - public FinancialConfigurationContract findByModuleAndName( - FinancialConfigurationContract financialConfigurationContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (financialConfigurationContract.getName() != null) { - content.append("name=" + financialConfigurationContract.getName()); - } - - if (financialConfigurationContract.getModule() != null) { - content.append("&module=" + financialConfigurationContract.getModule()); - } - - if (financialConfigurationContract.getTenantId() != null) { - content.append("&tenantId=" + financialConfigurationContract.getTenantId()); - } - url = url + content.toString(); - FinancialConfigurationResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - result = restTemplate.postForObject(url, requestInfoWrapper, FinancialConfigurationResponse.class); - - if (result.getFinancialConfigurations() != null && result.getFinancialConfigurations().size() == 1) { - return result.getFinancialConfigurations().get(0); - } else { - return null; - } - - } - - public String fetchDataFrom() { - return fetchDataFrom; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FinancialStatusContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FinancialStatusContractRepository.java deleted file mode 100644 index d5434f573bc..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FinancialStatusContractRepository.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FinancialStatusContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.FinancialStatusResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class FinancialStatusContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/financialstatuses/_search?"; - - public FinancialStatusContractRepository(@Value("${egf.master.host.url}") String hostUrl, - RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public FinancialStatusContract findById(FinancialStatusContract financialStatusContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (financialStatusContract.getId() != null) { - content.append("id=" + financialStatusContract.getId()); - } - - if (financialStatusContract.getTenantId() != null) { - content.append("&tenantId=" + financialStatusContract.getTenantId()); - } - url = url + content.toString(); - FinancialStatusResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, FinancialStatusResponse.class); - - if (result.getFinancialStatuses() != null && result.getFinancialStatuses().size() == 1) { - return result.getFinancialStatuses().get(0); - } else { - return null; - } - - } - - public FinancialStatusContract findByModuleCode(FinancialStatusContract financialStatusContract) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (financialStatusContract.getCode() != null) { - content.append("code=" + financialStatusContract.getCode()); - } - - if (financialStatusContract.getModuleType() != null) { - content.append("&moduleType=" + financialStatusContract.getModuleType()); - } - url = url + content.toString(); - FinancialStatusResponse result = restTemplate.postForObject(url, null, FinancialStatusResponse.class); - - if (result.getFinancialStatuses() != null && result.getFinancialStatuses().size() == 1) { - return result.getFinancialStatuses().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FinancialYearContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FinancialYearContractRepository.java deleted file mode 100644 index 691f3083984..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FinancialYearContractRepository.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.egov.egf.master.web.repository; - -import java.text.SimpleDateFormat; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FinancialYearContract; -import org.egov.egf.master.web.contract.FinancialYearSearchContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.FinancialYearResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.RestTemplate; - -@Repository -public class FinancialYearContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/financialyears/_search?"; - - public FinancialYearContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public FinancialYearContract findById(FinancialYearContract financialYearContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (financialYearContract.getId() != null) { - content.append("id=" + financialYearContract.getId()); - } - - if (financialYearContract.getTenantId() != null) { - content.append("&tenantId=" + financialYearContract.getTenantId()); - } - url = url + content.toString(); - FinancialYearResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, FinancialYearResponse.class); - - if (result.getFinancialYears() != null && result.getFinancialYears().size() == 1) { - return result.getFinancialYears().get(0); - } else { - return null; - } - - } - - public FinancialYearContract findByAsOnDate(FinancialYearSearchContract financialYearSearchContract, - RequestInfo requestInfo) { - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (financialYearSearchContract.getAsOnDate() != null) { - content.append("asOnDate=" + sdf.format(financialYearSearchContract.getAsOnDate())); - } - - if (financialYearSearchContract.getTenantId() != null) { - content.append("&tenantId=" + financialYearSearchContract.getTenantId()); - } - url = url + content.toString(); - FinancialYearResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - result = restTemplate.postForObject(url, requestInfoWrapper, FinancialYearResponse.class); - - if (result.getFinancialYears() != null && result.getFinancialYears().size() == 1) { - return result.getFinancialYears().get(0); - } else { - return null; - } - - } -} diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FiscalPeriodContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FiscalPeriodContractRepository.java deleted file mode 100644 index 524b5af0d6d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FiscalPeriodContractRepository.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FiscalPeriodContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.FiscalPeriodResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class FiscalPeriodContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/fiscalperiods/_search?"; - - public FiscalPeriodContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public FiscalPeriodContract findById(FiscalPeriodContract fiscalPeriodContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (fiscalPeriodContract.getId() != null) { - content.append("id=" + fiscalPeriodContract.getId()); - } - - if (fiscalPeriodContract.getTenantId() != null) { - content.append("&tenantId=" + fiscalPeriodContract.getTenantId()); - } - url = url + content.toString(); - FiscalPeriodResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, FiscalPeriodResponse.class); - - if (result.getFiscalPeriods() != null && result.getFiscalPeriods().size() == 1) { - return result.getFiscalPeriods().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FunctionContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FunctionContractRepository.java deleted file mode 100644 index 418d4c3cd0d..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FunctionContractRepository.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FunctionContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.FunctionResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class FunctionContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/functions/_search?"; - - public FunctionContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public FunctionContract findById(FunctionContract functionContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (functionContract.getId() != null) { - content.append("id=" + functionContract.getId()); - } - - if (functionContract.getTenantId() != null) { - content.append("&tenantId=" + functionContract.getTenantId()); - } - url = url + content.toString(); - FunctionResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, FunctionResponse.class); - - if (result.getFunctions() != null && result.getFunctions().size() == 1) { - return result.getFunctions().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FunctionaryContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FunctionaryContractRepository.java deleted file mode 100644 index 38d464d38d8..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FunctionaryContractRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FunctionaryContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.FunctionaryResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class FunctionaryContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/functionaries/_search?"; - - public FunctionaryContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public FunctionaryContract findById(FunctionaryContract functionaryContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (functionaryContract.getId() != null) { - content.append("id=" + functionaryContract.getId()); - } - - if (functionaryContract.getTenantId() != null) { - content.append("&tenantId=" + functionaryContract.getTenantId()); - } - url = url + content.toString(); - FunctionaryResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, FunctionaryResponse.class); - - - if (result.getFunctionaries() != null && result.getFunctionaries().size() == 1) { - return result.getFunctionaries().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FundContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FundContractRepository.java deleted file mode 100644 index 7576d1a01dc..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FundContractRepository.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FundContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.FundResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class FundContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/funds/_search?"; - - public FundContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public FundContract findById(FundContract fundContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (fundContract.getId() != null) { - content.append("id=" + fundContract.getId()); - } - - if (fundContract.getTenantId() != null) { - content.append("&tenantId=" + fundContract.getTenantId()); - } - url = url + content.toString(); - FundResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, FundResponse.class); - - if (result.getFunds() != null && result.getFunds().size() == 1) { - return result.getFunds().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FundsourceContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FundsourceContractRepository.java deleted file mode 100644 index 7ed1b485c79..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/FundsourceContractRepository.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FundsourceContract; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.requests.FundsourceResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class FundsourceContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/fundsources/_search?"; - - public FundsourceContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public FundsourceContract findById(FundsourceContract fundsourceContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (fundsourceContract.getId() != null) { - content.append("id=" + fundsourceContract.getId()); - } - - if (fundsourceContract.getTenantId() != null) { - content.append("&tenantId=" + fundsourceContract.getTenantId()); - } - url = url + content.toString(); - FundsourceResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, FundsourceResponse.class); - - if (result.getFundsources() != null && result.getFundsources().size() == 1) { - return result.getFundsources().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/SchemeContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/SchemeContractRepository.java deleted file mode 100644 index 3b95769ae75..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/SchemeContractRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.contract.SchemeContract; -import org.egov.egf.master.web.requests.SchemeResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class SchemeContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/schemes/_search?"; - - public SchemeContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public SchemeContract findById(SchemeContract schemeContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (schemeContract.getId() != null) { - content.append("id=" + schemeContract.getId()); - } - - if (schemeContract.getTenantId() != null) { - content.append("&tenantId=" + schemeContract.getTenantId()); - } - url = url + content.toString(); - SchemeResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, SchemeResponse.class); - - - if (result.getSchemes() != null && result.getSchemes().size() == 1) { - return result.getSchemes().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/SubSchemeContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/SubSchemeContractRepository.java deleted file mode 100644 index 44d330d1966..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/SubSchemeContractRepository.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.contract.SubSchemeContract; -import org.egov.egf.master.web.requests.SubSchemeResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class SubSchemeContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/subschemes/_search?"; - - public SubSchemeContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public SubSchemeContract findById(SubSchemeContract subSchemeContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (subSchemeContract.getId() != null) { - content.append("id=" + subSchemeContract.getId()); - } - - if (subSchemeContract.getTenantId() != null) { - content.append("&tenantId=" + subSchemeContract.getTenantId()); - } - url = url + content.toString(); - SubSchemeResponse result; - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - - result = restTemplate.postForObject(url, requestInfoWrapper, SubSchemeResponse.class); - - if (result.getSubSchemes() != null && result.getSubSchemes().size() == 1) { - return result.getSubSchemes().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/SupplierContractRepository.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/SupplierContractRepository.java deleted file mode 100644 index e9ac7948e0a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/repository/SupplierContractRepository.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.egf.master.web.repository; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.RequestInfoWrapper; -import org.egov.egf.master.web.contract.SupplierContract; -import org.egov.egf.master.web.requests.SupplierResponse; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class SupplierContractRepository { - - private RestTemplate restTemplate; - private String hostUrl; - public static final String SEARCH_URL = "/egf-master/suppliers/_search?"; - - public SupplierContractRepository(@Value("${egf.master.host.url}") String hostUrl, RestTemplate restTemplate) { - this.restTemplate = restTemplate; - this.hostUrl = hostUrl; - } - - public SupplierContract findById(SupplierContract supplierContract, RequestInfo requestInfo) { - - String url = String.format("%s%s", hostUrl, SEARCH_URL); - StringBuffer content = new StringBuffer(); - if (supplierContract.getId() != null) { - content.append("id=" + supplierContract.getId()); - } - - if (supplierContract.getTenantId() != null) { - content.append("&tenantId=" + supplierContract.getTenantId()); - } - url = url + content.toString(); - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - SupplierResponse result; - - result = restTemplate.postForObject(url, requestInfoWrapper, SupplierResponse.class); - - if (result.getSuppliers() != null && result.getSuppliers().size() == 1) { - return result.getSuppliers().get(0); - } else { - return null; - } - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountCodePurposeRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountCodePurposeRequest.java deleted file mode 100644 index b6d2f95038c..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountCodePurposeRequest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.egf.master.web.requests; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.AccountCodePurposeContract; - -import lombok.Data; - -public @Data class AccountCodePurposeRequest { - private RequestInfo requestInfo = new RequestInfo(); - @NotNull - private List accountCodePurposes = new ArrayList(); -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountCodePurposeResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountCodePurposeResponse.java deleted file mode 100644 index feb4c38cf19..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountCodePurposeResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.egf.master.web.requests; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.web.contract.AccountCodePurposeContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class AccountCodePurposeResponse { - private ResponseInfo responseInfo; - private List accountCodePurposes; - private PaginationContract page; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailKeyRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailKeyRequest.java deleted file mode 100644 index 1ae33a46559..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailKeyRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.AccountDetailKeyContract; - -import lombok.Data; -public @Data class AccountDetailKeyRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List accountDetailKeys =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailKeyResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailKeyResponse.java deleted file mode 100644 index 51f76bdff7b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailKeyResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.AccountDetailKeyContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class AccountDetailKeyResponse { -private ResponseInfo responseInfo ; -private List accountDetailKeys; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailTypeRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailTypeRequest.java deleted file mode 100644 index 4a40fdbba51..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailTypeRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; - -import lombok.Data; -public @Data class AccountDetailTypeRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List accountDetailTypes =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailTypeResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailTypeResponse.java deleted file mode 100644 index 968179acef7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountDetailTypeResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class AccountDetailTypeResponse { -private ResponseInfo responseInfo ; -private List accountDetailTypes; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountEntityRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountEntityRequest.java deleted file mode 100644 index 0009877f28a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountEntityRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.AccountEntityContract; - -import lombok.Data; -public @Data class AccountEntityRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List accountEntities =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountEntityResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountEntityResponse.java deleted file mode 100644 index cf772ffa3e1..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/AccountEntityResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.AccountEntityContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class AccountEntityResponse { -private ResponseInfo responseInfo ; -private List accountEntities; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankAccountRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankAccountRequest.java deleted file mode 100644 index ddda4576c8a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankAccountRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.BankAccountContract; - -import lombok.Data; -public @Data class BankAccountRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List bankAccounts =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankAccountResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankAccountResponse.java deleted file mode 100644 index ac6bdce290b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankAccountResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.BankAccountContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class BankAccountResponse { -private ResponseInfo responseInfo ; -private List bankAccounts; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankBranchRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankBranchRequest.java deleted file mode 100644 index 0c2dd564108..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankBranchRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.BankBranchContract; - -import lombok.Data; -public @Data class BankBranchRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List bankBranches =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankBranchResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankBranchResponse.java deleted file mode 100644 index e1436f996c7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankBranchResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.BankBranchContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class BankBranchResponse { -private ResponseInfo responseInfo ; -private List bankBranches; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankRequest.java deleted file mode 100644 index 6106ecfadb8..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.BankContract; - -import lombok.Data; -public @Data class BankRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List banks =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankResponse.java deleted file mode 100644 index 937bf8f7af0..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BankResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.BankContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class BankResponse { -private ResponseInfo responseInfo ; -private List banks; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BudgetGroupRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BudgetGroupRequest.java deleted file mode 100644 index 8dfecce93e1..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BudgetGroupRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.BudgetGroupContract; - -import lombok.Data; -public @Data class BudgetGroupRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List budgetGroups =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BudgetGroupResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BudgetGroupResponse.java deleted file mode 100644 index 459306a6c67..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/BudgetGroupResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.BudgetGroupContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class BudgetGroupResponse { -private ResponseInfo responseInfo ; -private List budgetGroups; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountDetailRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountDetailRequest.java deleted file mode 100644 index 7c1b5d7e1e9..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountDetailRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.ChartOfAccountDetailContract; - -import lombok.Data; -public @Data class ChartOfAccountDetailRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List chartOfAccountDetails =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountDetailResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountDetailResponse.java deleted file mode 100644 index 1923fcfa62f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountDetailResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.ChartOfAccountDetailContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class ChartOfAccountDetailResponse { -private ResponseInfo responseInfo ; -private List chartOfAccountDetails; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountRequest.java deleted file mode 100644 index 0bc5c33f8d4..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.ChartOfAccountContract; - -import lombok.Data; -public @Data class ChartOfAccountRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List chartOfAccounts =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountResponse.java deleted file mode 100644 index dae042117c5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/ChartOfAccountResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.ChartOfAccountContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class ChartOfAccountResponse { -private ResponseInfo responseInfo ; -private List chartOfAccounts; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialConfigurationRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialConfigurationRequest.java deleted file mode 100644 index a3c00cd176a..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialConfigurationRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FinancialConfigurationContract; - -import lombok.Data; -public @Data class FinancialConfigurationRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List financialConfigurations =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialConfigurationResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialConfigurationResponse.java deleted file mode 100644 index 49595b3a1e6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialConfigurationResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.FinancialConfigurationContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class FinancialConfigurationResponse { -private ResponseInfo responseInfo ; -private List financialConfigurations; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialStatusRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialStatusRequest.java deleted file mode 100644 index 56dde20f1a3..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialStatusRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FinancialStatusContract; - -import lombok.Data; -public @Data class FinancialStatusRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List financialStatuses =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialStatusResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialStatusResponse.java deleted file mode 100644 index 4b3f762bbe9..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialStatusResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.FinancialStatusContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class FinancialStatusResponse { -private ResponseInfo responseInfo ; -private List financialStatuses; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialYearRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialYearRequest.java deleted file mode 100644 index 8998b6ab360..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialYearRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FinancialYearContract; - -import lombok.Data; -public @Data class FinancialYearRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List financialYears =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialYearResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialYearResponse.java deleted file mode 100644 index c0206d12d69..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FinancialYearResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.FinancialYearContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class FinancialYearResponse { -private ResponseInfo responseInfo ; -private List financialYears; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FiscalPeriodRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FiscalPeriodRequest.java deleted file mode 100644 index cb469715091..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FiscalPeriodRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FiscalPeriodContract; - -import lombok.Data; -public @Data class FiscalPeriodRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List fiscalPeriods =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FiscalPeriodResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FiscalPeriodResponse.java deleted file mode 100644 index 1f2f273d0f4..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FiscalPeriodResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.FiscalPeriodContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class FiscalPeriodResponse { -private ResponseInfo responseInfo ; -private List fiscalPeriods; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionRequest.java deleted file mode 100644 index 97d15a0c8b5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FunctionContract; - -import lombok.Data; -public @Data class FunctionRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List functions =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionResponse.java deleted file mode 100644 index c2410ece6f6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.FunctionContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class FunctionResponse { -private ResponseInfo responseInfo ; -private List functions; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionaryRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionaryRequest.java deleted file mode 100644 index 82659530af5..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionaryRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FunctionaryContract; - -import lombok.Data; -public @Data class FunctionaryRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List functionaries =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionaryResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionaryResponse.java deleted file mode 100644 index 72a5ece1403..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FunctionaryResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.FunctionaryContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class FunctionaryResponse { -private ResponseInfo responseInfo ; -private List functionaries; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundRequest.java deleted file mode 100644 index c0133a196fe..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.egov.egf.master.web.requests; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FundContract; - -import lombok.Data; - -public @Data class FundRequest { - private RequestInfo requestInfo = new RequestInfo(); - private List funds = new ArrayList(); -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundResponse.java deleted file mode 100644 index 1e6289f6d49..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.egf.master.web.requests; - -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.FundContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class FundResponse { - private ResponseInfo responseInfo; - private List funds; - private PaginationContract page; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundsourceRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundsourceRequest.java deleted file mode 100644 index 47b55ff0a7b..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundsourceRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.FundsourceContract; - -import lombok.Data; -public @Data class FundsourceRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List fundsources =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundsourceResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundsourceResponse.java deleted file mode 100644 index e9e4eb88382..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/FundsourceResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.FundsourceContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class FundsourceResponse { -private ResponseInfo responseInfo ; -private List fundsources; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/RecoveryRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/RecoveryRequest.java deleted file mode 100644 index 7ba9d448cc7..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/RecoveryRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.egov.egf.master.web.requests; - -import lombok.Data; -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.RecoveryContract; - -import java.util.ArrayList; -import java.util.List; - -public @Data class RecoveryRequest { - private RequestInfo requestInfo = new RequestInfo(); - private List recoverys = new ArrayList(); -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/RecoveryResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/RecoveryResponse.java deleted file mode 100644 index bed2cf4bbc6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/RecoveryResponse.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.egov.egf.master.web.requests; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import lombok.Data; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.web.contract.PaginationContract; -import org.egov.egf.master.web.contract.RecoveryContract; - -import java.util.List; - -@JsonInclude(value = Include.NON_NULL) -public @Data class RecoveryResponse { - private ResponseInfo responseInfo; - private List recoverys; - private PaginationContract page; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SchemeRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SchemeRequest.java deleted file mode 100644 index f42a6a916e6..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SchemeRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.SchemeContract; - -import lombok.Data; -public @Data class SchemeRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List schemes =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SchemeResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SchemeResponse.java deleted file mode 100644 index fe89c1cbd0e..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SchemeResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.SchemeContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class SchemeResponse { -private ResponseInfo responseInfo ; -private List schemes; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SubSchemeRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SubSchemeRequest.java deleted file mode 100644 index 7b735b198ce..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SubSchemeRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.SubSchemeContract; - -import lombok.Data; -public @Data class SubSchemeRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List subSchemes =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SubSchemeResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SubSchemeResponse.java deleted file mode 100644 index 65192959837..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SubSchemeResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.SubSchemeContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class SubSchemeResponse { -private ResponseInfo responseInfo ; -private List subSchemes; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SupplierRequest.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SupplierRequest.java deleted file mode 100644 index fcb2649748f..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SupplierRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.egf.master.web.contract.SupplierContract; - -import lombok.Data; -public @Data class SupplierRequest { -private RequestInfo requestInfo = new RequestInfo(); -private List suppliers =new ArrayList() ; -} \ No newline at end of file diff --git a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SupplierResponse.java b/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SupplierResponse.java deleted file mode 100644 index 03404536100..00000000000 --- a/business-services/egf-master/src/main/java/org/egov/egf/master/web/requests/SupplierResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.egov.egf.master.web.requests; -import java.util.List; - -import org.egov.common.web.contract.PaginationContract; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.egf.master.web.contract.SupplierContract; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; -@JsonInclude(value=Include.NON_NULL)public @Data class SupplierResponse { -private ResponseInfo responseInfo ; -private List suppliers; -private PaginationContract page;} \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/application.properties b/business-services/egf-master/src/main/resources/application.properties deleted file mode 100644 index 6deba3d9b31..00000000000 --- a/business-services/egf-master/src/main/resources/application.properties +++ /dev/null @@ -1,99 +0,0 @@ -server.port=8280 -server.context-path=/egf-master -server.servlet.context-path=/egf-master - -persist.through.kafka=yes - -fetch_data_from=db - -app.timezone=UTC - -spring.datasource.driver-class-name=org.postgresql.Driver - -spring.datasource.url=jdbc:postgresql://localhost:5432/egf-master - -spring.datasource.username=postgres -spring.datasource.password=postgres - -kafka.topics.egf.masters.validated.key=egov.egf.masters.bank.validated.key - -spring.kafka.listener.missing-topics-fatal=false - -#Kafka Topic config -kafka.topics.egf.masters.validated.topic=egov.egf.masters.validated.topic -kafka.topics.egf.masters.validated.group=egov.egf.masters.validated.group -kafka.topics.egf.masters.validated.id=egov.egf.masters.bank.validated.id - -kafka.topics.egf.masters.completed.topic=egov.egf.masters.completed -kafka.topics.egf.masters.completed.group=egov.egf.masters.completed.group - -kafka.topics.egf.masters.bank.validated.key=egov.egf.masters.bank.validated.key -kafka.topics.egf.masters.bankbranch.validated.key=egov.egf.masters.bankbranch.validated.key -kafka.topics.egf.masters.bankaccount.validated.key=egov.egf.masters.bankaccount.validated.key -kafka.topics.egf.masters.accountcodepurpose.validated.key=egov.egf.masters.accountcodepurpose.validated.key -kafka.topics.egf.masters.accountdetailkey.validated.key=egov.egf.masters.accountdetailkey.validated.key -kafka.topics.egf.masters.accountdetailtype.validated.key=egov.egf.masters.accountdetailtype.validated.key -kafka.topics.egf.masters.accountentity.validated.key=egov.egf.masters.accountentity.validated.key -kafka.topics.egf.masters.budgetgroup.validated.key=egov.egf.masters.budgetgroup.validated.key -kafka.topics.egf.masters.chartofaccount.validated.key=egov.egf.masters.chartofaccount.validated.key -kafka.topics.egf.masters.chartofaccountdetail.validated.key=egov.egf.masters.chartofaccountdetail.validated.key -kafka.topics.egf.masters.financialyear.validated.key=egov.egf.masters.financialyear.validated.key -kafka.topics.egf.masters.fiscalperiod.validated.key=egov.egf.masters.fiscalperiod.validated.key -kafka.topics.egf.masters.functionary.validated.key=egov.egf.masters.functionary.validated.key -kafka.topics.egf.masters.function.validated.key=egov.egf.masters.function.validated.key -kafka.topics.egf.masters.fund.validated.key=egov.egf.masters.fund.validated.key -kafka.topics.egf.masters.fundsource.validated.key=egov.egf.masters.fundsource.validated.key -kafka.topics.egf.masters.scheme.validated.key=egov.egf.masters.scheme.validated.key -kafka.topics.egf.masters.subscheme.validated.key=egov.egf.masters.subscheme.validated.key -kafka.topics.egf.masters.supplier.validated.key=egov.egf.masters.supplierfund.validated.key -kafka.topics.egf.masters.financialstatus.validated.key=egov.egf.masters.financialstatus.validated.key -kafka.topics.egf.masters.financialconfiguration.validated.key=egov.egf.masters.financialconfiguration.validated.key -kafka.topics.egf.masters.recovery.validated.key=egov.egf.masters.recovery.validated.key - - -kafka.topics.egf.masters.bank.completed.key=egov.egf.masters.bank.completed.key -kafka.topics.egf.masters.bankbranch.completed.key=egov.egf.masters.bankbranch.completed.key -kafka.topics.egf.masters.bankaccount.completed.key=egov.egf.masters.bankaccount.completed.key -kafka.topics.egf.masters.accountcodepurpose.completed.key=egov.egf.masters.accountcodepurpose.completed.key -kafka.topics.egf.masters.accountdetailkey.completed.key=egov.egf.masters.accountdetailkey.completed.key -kafka.topics.egf.masters.accountdetailtype.completed.key=egov.egf.masters.accountdetailtype.completed.key -kafka.topics.egf.masters.accountentity.completed.key=egov.egf.masters.accountentity.completed.key -kafka.topics.egf.masters.budgetgroup.completed.key=egov.egf.masters.budgetgroup.completed.key -kafka.topics.egf.masters.chartofaccount.completed.key=egov.egf.masters.chartofaccount.completed.key -kafka.topics.egf.masters.chartofaccountdetail.completed.key=egov.egf.masters.chartofaccountdetail.completed.key -kafka.topics.egf.masters.financialyear.completed.key=egov.egf.masters.financialyear.completed.key -kafka.topics.egf.masters.fiscalperiod.completed.key=egov.egf.masters.fiscalperiod.completed.key -kafka.topics.egf.masters.functionary.completed.key=egov.egf.masters.functionary.completed.key -kafka.topics.egf.masters.function.completed.key=egov.egf.masters.function.completed.key -kafka.topics.egf.masters.fund.completed.key=egov.egf.masters.fund.completed.key -kafka.topics.egf.masters.fundsource.completed.key=egov.egf.masters.fundsource.completed.key -kafka.topics.egf.masters.scheme.completed.key=egov.egf.masters.scheme.completed.key -kafka.topics.egf.masters.subscheme.completed.key=egov.egf.masters.subscheme.completed.key -kafka.topics.egf.masters.supplier.completed.key=egov.egf.masters.supplier.completed.key -kafka.topics.egf.masters.financialstatus.completed.key=egov.egf.masters.financialstatus.completed.key -kafka.topics.egf.masters.financialconfiguration.completed.key=egov.egf.masters.financialconfiguration.completed.key -kafka.topics.egf.masters.recovery.completed.key=egov.egf.masters.recovery.completed.key -spring.flyway.user=postgres -spring.flyway.password=postgres -#spring.flyway.outOfOrder=true -spring.flyway.table=egf_masters_schema_version -spring.flyway.baseline-on-migrate=true -spring.flyway.url=jdbc:postgresql://localhost:5432/egf-master -spring.flyway.locations=classpath:/db/migration/main,db/migration/seed,db/migration/dev - -es.host=localhost -es.transport.port=9300 -es.cluster.name=docker-cluster - -egf.master.host.url=http://localhost:8280 - -logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} - -spring.kafka.consumer.properties.spring.json.use.type.headers=false -spring.kafka.consumer.value-deserializer=org.egov.common.queue.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=egf-master -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer - -logging.level.org.egov=DEBUG \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/Dockerfile b/business-services/egf-master/src/main/resources/db/Dockerfile deleted file mode 100644 index bb0039c3f3f..00000000000 --- a/business-services/egf-master/src/main/resources/db/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM egovio/flyway:4.1.2 - -COPY ./migration/main /flyway/sql - -COPY ./migration/seed /flyway/seed - -COPY ./migration/dev /flyway/dev - -COPY ./migration/qa /flyway/qa - -COPY migrate.sh /usr/bin/migrate.sh - -RUN chmod +x /usr/bin/migrate.sh - -CMD ["/usr/bin/migrate.sh"] diff --git a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150149__chartofaccounts_data.sql b/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150149__chartofaccounts_data.sql deleted file mode 100644 index 9a70ea7eae6..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150149__chartofaccounts_data.sql +++ /dev/null @@ -1,1225 +0,0 @@ -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1, '1', 'Income', NULL, NULL, false, NULL, 'I', 0, false, false, '1', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (2, '2', 'Expenses', NULL, NULL, false, NULL, 'E', 0, false, false, '2', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (4, '4', 'Assets', NULL, NULL, false, NULL, 'A', 0, false, false, '4', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (3, '3', 'Liabilities', NULL, NULL, false, NULL, 'L', 0, false, false, '3', NULL, NULL, NULL, NULL, 0, 'default'); - -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (5, '110', 'Tax Revenue', NULL, NULL, false, 1, 'I', 1, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (6, '120', 'Assigned Revenues & Compensations', NULL, NULL, false, 1, 'I', 1, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (7, '130', 'Rental Income from Municipal Properties', NULL, NULL, false, 1, 'I', 1, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (8, '140', 'Fees & User Charges', NULL, NULL, false, 1, 'I', 1, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (9, '150', 'Sale & Hire Charges', NULL, NULL, false, 1, 'I', 1, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (10, '160', 'Revenue Grants, Contribution and Subsidies', NULL, NULL, false, 1, 'I', 1, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (11, '170', 'Income from Investments', NULL, NULL, false, 1, 'I', 1, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (12, '171', 'Interest Earned', NULL, NULL, false, 1, 'I', 1, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (13, '210', 'Establishment Expenses', NULL, NULL, false, 2, 'E', 1, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (14, '220', 'Administrative Expenses', NULL, NULL, false, 2, 'E', 1, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (15, '230', 'Operations & Maintenance', NULL, NULL, false, 2, 'E', 1, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (16, '240', 'Interest & Finance Charges', NULL, NULL, false, 2, 'E', 1, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (17, '250', 'Programme Expenses', NULL, NULL, false, 2, 'E', 1, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (18, '260', 'Revenue Grants, Contribution and Subsidies', NULL, NULL, false, 2, 'E', 1, false, false, '260', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (19, '270', 'Provisions and Write off', NULL, NULL, false, 2, 'E', 1, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (20, '271', 'Miscellaneous Expenses', NULL, NULL, false, 2, 'E', 1, false, false, '271', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (21, '272', 'Depreciation', 17, NULL, false, 2, 'E', 1, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (22, '280', 'Prior Period Item', NULL, NULL, false, 2, 'E', 1, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (23, '290', 'Transfer to Reserve Funds', NULL, NULL, false, 2, 'E', 1, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (24, '310', 'Municipal Fund', NULL, NULL, false, 3, 'L', 1, false, false, '310', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (25, '311', 'Earmarked Funds', NULL, NULL, false, 3, 'L', 1, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (26, '312', 'Reserves', 18, NULL, false, 3, 'L', 1, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (27, '320', 'Grants , Contribution for specific purposes', NULL, NULL, false, 3, 'L', 1, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (28, '330', 'Secured Loans', NULL, NULL, false, 3, 'L', 1, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (29, '331', 'Unsecured Loans', NULL, NULL, false, 3, 'L', 1, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (30, '340', 'Deposits Received', NULL, NULL, false, 3, 'L', 1, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (31, '341', 'Deposit works', NULL, NULL, false, 3, 'L', 1, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (32, '350', 'Other Liabilities', NULL, NULL, false, 3, 'L', 1, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (33, '360', 'Provisions', NULL, NULL, false, 3, 'L', 1, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (34, '410', 'Fixed Assets', 11, NULL, false, 4, 'A', 1, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (35, '411', 'Accumulated Depreciation', 15, NULL, false, 4, 'A', 1, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (36, '412', 'Capital Work-In-Progress', NULL, NULL, false, 4, 'A', 1, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (37, '420', 'Investments - General Fund', NULL, NULL, false, 4, 'A', 1, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (38, '421', 'Investments - Other Funds', NULL, NULL, false, 4, 'A', 1, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (39, '430', 'Stock - in- hand', NULL, NULL, false, 4, 'A', 1, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (40, '431', 'Sundry Debtors (Receivables)', NULL, NULL, false, 4, 'A', 1, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (41, '432', 'Accumulated Provisions against Debtors (Receivables)', NULL, NULL, false, 4, 'A', 1, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (42, '440', 'Pre-paid Expenses', NULL, NULL, false, 4, 'A', 1, false, false, '440', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (43, '450', 'Cash and Bank balance', NULL, NULL, false, 4, 'A', 1, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (44, '460', 'Loans, Advances and Deposits', NULL, NULL, false, 4, 'A', 1, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (45, '461', 'Accumulated Provisions against Loans, Advances and Deposits', NULL, NULL, false, 4, 'A', 1, false, false, '461', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (46, '470', 'Other Assets', NULL, NULL, false, 4, 'A', 1, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (47, '480', 'Miscellaneous Expenditure to be written off', NULL, NULL, false, 4, 'A', 1, false, false, '480', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (48, '11001', 'Property Tax', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (49, '11002', 'Water Tax', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (50, '11003', 'Sewerage Tax', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (51, '11004', 'Conservancy Tax', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (52, '11005', 'Lighting Tax', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (53, '11006', 'Education Tax', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (54, '11007', 'Vehicle Tax', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (55, '11008', 'Tax on Animals', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (56, '11011', 'Advertisement Tax', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (57, '11012', 'Pilgrimage Tax', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (58, '11051', 'Octroi and Toll', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (59, '11052', 'Cess', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (60, '11080', 'Others Taxes', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (61, '11090', 'Tax Remission and Refund', NULL, NULL, false, 5, 'I', 2, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (62, '12010', 'Taxes and Duties collected by others', NULL, NULL, false, 6, 'I', 2, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (63, '12020', 'Compensation in lieu of Taxes and duties', NULL, NULL, false, 6, 'I', 2, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (64, '12030', 'Compensations in lieu of Concessions', NULL, NULL, false, 6, 'I', 2, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (65, '13010', 'Rent from Civic Amenities', NULL, NULL, false, 7, 'I', 2, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (66, '13020', 'Rent from Office Buildings', NULL, NULL, false, 7, 'I', 2, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (67, '13030', 'Rent from Guest Houses', NULL, NULL, false, 7, 'I', 2, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (68, '13040', 'Rent from lease of lands', NULL, NULL, false, 7, 'I', 2, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (69, '13080', 'Other rents', NULL, NULL, false, 7, 'I', 2, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (70, '13090', 'Rent remission and refund', NULL, NULL, false, 7, 'I', 2, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (71, '14010', 'Empanelment and Registration Charges', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (72, '14011', 'Licensing Fees', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (73, '14012', 'Fees for Grant of Permit', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (74, '14013', 'Fees for Certificate or Extract', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (75, '14014', 'Development Charges', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (76, '14015', 'Regularization Fees', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (77, '14020', 'Penalties and Fines', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (78, '14040', 'Other Fees', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (79, '14050', 'User Charges', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (80, '14060', 'Entry Fees', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (81, '14070', 'Service Administrative Charges', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (82, '14080', 'Other Charges', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (83, '14090', 'Fees Remission and Refund', NULL, NULL, false, 8, 'I', 2, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (84, '15010', 'Sale of Products', NULL, NULL, false, 9, 'I', 2, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (85, '15011', 'Sale of Forms and Publications', NULL, NULL, false, 9, 'I', 2, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (86, '15012', 'Sale of stores and scrap', NULL, NULL, false, 9, 'I', 2, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (87, '15030', 'Sale of others', NULL, NULL, false, 9, 'I', 2, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (88, '15040', 'Hire Charges for Vehicles', NULL, NULL, false, 9, 'I', 2, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (89, '15041', 'Hire Charges on Equipments', NULL, NULL, false, 9, 'I', 2, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (90, '16010', 'Revenue Grant', NULL, NULL, false, 10, 'I', 2, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (91, '16020', 'Re-imbursement of expenses', NULL, NULL, false, 10, 'I', 2, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (92, '16030', 'Contribution towards schemes', NULL, NULL, false, 10, 'I', 2, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (93, '17010', 'Interest', NULL, NULL, false, 11, 'I', 2, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (94, '17020', 'Dividend', NULL, NULL, false, 11, 'I', 2, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (95, '17030', 'Income from projects taken up on commercial basis', NULL, NULL, false, 11, 'I', 2, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (96, '17040', 'Profit in Sale of Investments', NULL, NULL, false, 11, 'I', 2, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (97, '17080', 'Others', NULL, NULL, false, 11, 'I', 2, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (98, '17110', 'Interest from Bank Accounts', NULL, NULL, false, 12, 'I', 2, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (99, '17120', 'Interest on Loans and advances to Employees', NULL, NULL, false, 12, 'I', 2, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (100, '17130', 'Interest on loans to others', NULL, NULL, false, 12, 'I', 2, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (101, '17180', 'Other Interest', NULL, NULL, false, 12, 'I', 2, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (102, '18010', 'Deposits Forfeited', NULL, NULL, false, 557, 'I', 2, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (103, '18011', 'Lapsed Deposits', NULL, NULL, false, 557, 'I', 2, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (104, '18020', 'Insurance Claim Recovery', NULL, NULL, false, 557, 'I', 2, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (105, '18030', 'Profit on Disposal of Fixed assets', NULL, NULL, false, 557, 'I', 2, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (106, '18040', 'Recovery from Employees', NULL, NULL, false, 557, 'I', 2, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (107, '18050', 'Unclaimed Refund Payable Liabilities Written Back', NULL, NULL, false, 557, 'I', 2, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (108, '18060', 'Excess Provisions written back', NULL, NULL, false, 557, 'I', 2, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (109, '18080', 'Miscellaneous Income', NULL, NULL, false, 557, 'I', 2, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (110, '31010', 'General Fund', NULL, NULL, false, 24, 'L', 2, false, false, '310', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (111, '31090', 'Excess of Income over Expenditure', NULL, NULL, false, 24, 'L', 2, false, false, '310', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (112, '31110', 'Special Funds', NULL, NULL, false, 25, 'L', 2, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (113, '31150', 'Sinking Funds', NULL, NULL, false, 25, 'L', 2, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (114, '31170', 'Trust or Agency Funds', NULL, NULL, false, 25, 'L', 2, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (115, '31210', 'Capital Contribution', NULL, NULL, false, 26, 'L', 2, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (116, '31211', 'Capital Reserve', NULL, NULL, false, 26, 'L', 2, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (117, '31220', 'Borrowing Redemption reserve', NULL, NULL, false, 26, 'L', 2, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (118, '31230', 'Special Funds (Utilised)', NULL, NULL, false, 26, 'L', 2, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (119, '31240', 'Statutory Reserve', NULL, NULL, false, 26, 'L', 2, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (120, '31250', 'General Reserve', NULL, NULL, false, 26, 'L', 2, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (121, '31260', 'Revaluation Reserve', NULL, NULL, false, 26, 'L', 2, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (122, '32010', 'Central Government', NULL, NULL, false, 27, 'L', 2, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (123, '32020', 'State Government', NULL, NULL, false, 27, 'L', 2, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (124, '32030', 'Other Government Agencies', NULL, NULL, false, 27, 'L', 2, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (125, '32040', 'Financial Institutions', NULL, NULL, false, 27, 'L', 2, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (126, '32050', 'Welfare Bodies', NULL, NULL, false, 27, 'L', 2, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (127, '32060', 'International Organizations', NULL, NULL, false, 27, 'L', 2, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (128, '32080', 'Others', NULL, NULL, false, 27, 'L', 2, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (129, '33010', 'Loans from Central Government', NULL, NULL, false, 28, 'L', 2, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (130, '33020', 'Loans from State Government', NULL, NULL, false, 28, 'L', 2, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (131, '33030', 'Loans from Government Bodies and Association', NULL, NULL, false, 28, 'L', 2, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (132, '33040', 'Loans from International Agencies', NULL, NULL, false, 28, 'L', 2, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (133, '33050', 'Loans from Banks and Other Financial Institutions', NULL, NULL, false, 28, 'L', 2, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (134, '33060', 'Other Term Loans', NULL, NULL, false, 28, 'L', 2, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (135, '33070', 'Bonds and Debentures', NULL, NULL, false, 28, 'L', 2, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (136, '33080', 'Other Loans', NULL, NULL, false, 28, 'L', 2, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (137, '33110', 'Loans from Central Government', NULL, NULL, false, 29, 'L', 2, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (138, '33120', 'Loans from State Government', NULL, NULL, false, 29, 'L', 2, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (139, '33130', 'Loans from Government Bodies and Association', NULL, NULL, false, 29, 'L', 2, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (140, '33140', 'Loans from International Agencies', NULL, NULL, false, 29, 'L', 2, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (141, '33150', 'Loans from Banks and Other Financial Institutions', NULL, NULL, false, 29, 'L', 2, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (142, '33160', 'Other Term Loans', NULL, NULL, false, 29, 'L', 2, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (143, '33170', 'Bonds and Debentures', NULL, NULL, false, 29, 'L', 2, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (144, '33180', 'Other Loans', NULL, NULL, false, 29, 'L', 2, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (145, '34010', 'From Contractors Suppliers', NULL, NULL, false, 30, 'L', 2, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (146, '34020', 'Deposits – Revenues', NULL, NULL, false, 30, 'L', 2, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (147, '34030', 'From Staff', NULL, NULL, false, 30, 'L', 2, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (148, '34080', 'From Others', NULL, NULL, false, 30, 'L', 2, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (149, '34110', 'Civil works', NULL, NULL, false, 31, 'L', 2, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (150, '34120', 'Electrical works', NULL, NULL, false, 31, 'L', 2, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (151, '34180', 'Others', NULL, NULL, false, 31, 'L', 2, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (152, '35010', 'Creditors', NULL, NULL, false, 32, 'L', 2, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (153, '35011', 'Employee liabilities', NULL, NULL, false, 32, 'L', 2, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (154, '35012', 'Interest Accrued and due', NULL, NULL, false, 32, 'L', 2, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (155, '35020', 'Recoveries payable', NULL, NULL, false, 32, 'L', 2, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (156, '35030', 'Government Dues payable', NULL, NULL, false, 32, 'L', 2, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (157, '35040', 'Refunds payable', NULL, NULL, false, 32, 'L', 2, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (158, '35041', 'Advance Collection of Revenues', NULL, NULL, false, 32, 'L', 2, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (159, '35080', 'Others', NULL, NULL, false, 32, 'L', 2, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (160, '35090', 'Sale Proceeds', NULL, NULL, false, 32, 'L', 2, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (161, '36010', 'Provisions for Expenses', NULL, NULL, false, 33, 'L', 2, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (162, '36020', 'Provision for Interest', NULL, NULL, false, 33, 'L', 2, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (163, '36030', 'Provision for Other Assets', NULL, NULL, false, 33, 'L', 2, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (164, '36040', 'Provisions for Doubtful receivables', NULL, NULL, false, 33, 'L', 2, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (165, '41010', 'Land', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (166, '41020', 'Buildings', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (167, '41030', 'Roads and Bridges', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (168, '41031', 'Sewerage and Drainage', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (169, '41032', 'Water works', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (170, '41033', 'Public Lighting', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (171, '41040', 'Plant and Machinery', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (172, '41050', 'Vehicles', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (173, '41060', 'Office and Other Equipments', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (174, '41070', 'Furniture, Fixtures, Fittings and Electrical Appliances', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (175, '41080', 'Other Fixed Assets', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (176, '41090', 'Assets under Disposal', NULL, NULL, false, 34, 'A', 2, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (177, '41120', 'Buildings', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (178, '41130', 'Roads and Bridges', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (179, '41131', 'Sewerage and Drainage', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (180, '41132', 'Waterways', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (181, '41133', 'Public Lighting', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (182, '41140', 'Plant and Machinery', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (183, '41150', 'Vehicles', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (184, '41160', 'Office and Other Equipments', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (185, '41170', 'Furniture, Fixtures, Fittings and Electrical Appliances', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (186, '41180', 'Other Fixed Assets', NULL, NULL, false, 35, 'A', 2, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (187, '41200', 'General', NULL, NULL, false, 36, 'A', 2, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (188, '41210', 'Specific Grants', NULL, NULL, false, 36, 'A', 2, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (189, '41220', 'Special funds', NULL, NULL, false, 36, 'A', 2, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (190, '41230', 'Specific Schemes', NULL, NULL, false, 36, 'A', 2, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (191, '42010', 'Central Government Securities', NULL, NULL, false, 37, 'A', 2, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (192, '42020', 'State Government Securities', NULL, NULL, false, 37, 'A', 2, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (193, '42030', 'Debentures and Bonds', NULL, NULL, false, 37, 'A', 2, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (194, '42040', 'Preference Shares', NULL, NULL, false, 37, 'A', 2, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (195, '42050', 'Equity Shares', NULL, NULL, false, 37, 'A', 2, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (196, '42060', 'Units of Mutual Funds', NULL, NULL, false, 37, 'A', 2, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (197, '42080', 'Other Investments', NULL, NULL, false, 37, 'A', 2, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (198, '42090', 'Accumulated Provision', NULL, NULL, false, 37, 'A', 2, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (199, '42110', 'Central Government Securities', NULL, NULL, false, 38, 'A', 2, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (200, '42120', 'State Government Securities', NULL, NULL, false, 38, 'A', 2, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (201, '42130', 'Debentures and Bonds', NULL, NULL, false, 38, 'A', 2, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (202, '42140', 'Preference Shares', NULL, NULL, false, 38, 'A', 2, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (203, '42150', 'Equity Shares', NULL, NULL, false, 38, 'A', 2, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (204, '42160', 'Units of Mutual Funds', NULL, NULL, false, 38, 'A', 2, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (205, '42180', 'Other Investments', NULL, NULL, false, 38, 'A', 2, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (206, '42190', 'Accumulated Provision', NULL, NULL, false, 38, 'A', 2, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (208, '43010', 'Stores', NULL, NULL, false, 39, 'A', 2, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (209, '43020', 'Loose Tools', NULL, NULL, false, 39, 'A', 2, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (210, '43080', 'Others', NULL, NULL, false, 39, 'A', 2, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (211, '43110', 'Receivables for Property Taxes', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (212, '43119', 'Receivable for Other Taxes', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (213, '43120', 'Receivables for Cess', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (214, '43130', 'Receivable for Fees and User Charges', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (215, '43140', 'Receivable from other sources', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (216, '43150', 'Receivable from Government', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (217, '43180', 'Receivables control accounts', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (218, '43191', 'State Govt Cess/ levies in Property Taxes - Control account', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (219, '43192', 'State Govt Cess/ levies in Water Taxes - Control account', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (220, '43199', 'State Govt Cess/ levies in Other Taxes - Control account', NULL, NULL, false, 40, 'A', 2, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (221, '43210', 'Provision for outstanding Property Taxes', NULL, NULL, false, 41, 'A', 2, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (222, '43211', 'Provision for outstanding Water Taxes', NULL, NULL, false, 41, 'A', 2, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (223, '43212', 'Provision for outstanding Other Taxes', NULL, NULL, false, 41, 'A', 2, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (224, '43220', 'Provision for outstanding Cess', NULL, NULL, false, 41, 'A', 2, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (225, '43230', 'Provision for outstanding Fees and User Charges', NULL, NULL, false, 41, 'A', 2, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (226, '43240', 'Provision for outstanding other receivable', NULL, NULL, false, 41, 'A', 2, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (229, '43291', 'State Govt Cess/ levies in Property Taxes - Provision account', NULL, NULL, false, 41, 'A', 2, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (230, '43292', 'State Govt Cess/ levies in Water Taxes - Provision account', NULL, NULL, false, 41, 'A', 2, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (231, '43299', 'State Govt Cess/ levies in Other Taxes - Provision account', NULL, NULL, false, 41, 'A', 2, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (232, '44010', 'Establishment', NULL, NULL, false, 42, 'A', 2, false, false, '440', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (233, '44020', 'Administration', NULL, NULL, false, 42, 'A', 2, false, false, '440', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (234, '44030', 'Operations and Maintenance', NULL, NULL, false, 42, 'A', 2, false, false, '440', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (235, '45010', 'Cash', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (237, '45021', 'Nationalised Banks', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (238, '45022', 'Other Scheduled Banks', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (239, '45023', 'Scheduled Co-operative Banks', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (240, '45024', 'Post Office', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (241, '45041', 'Nationalised Banks', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (242, '45042', 'Other Scheduled Banks', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (243, '45043', 'Scheduled Co-operative Banks', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (244, '45044', 'Post Office', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (245, '45061', 'Nationalised Banks', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (246, '45062', 'Other Scheduled Banks', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (247, '45063', 'Scheduled Co-operative Banks', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (248, '45064', 'Post Office', NULL, NULL, false, 43, 'A', 2, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (249, '46010', 'Loans and advances to employees', NULL, NULL, false, 44, 'A', 2, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (250, '46020', 'Employee Provident Fund Loans', NULL, NULL, false, 44, 'A', 2, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (251, '46030', 'Loans to Others', NULL, NULL, false, 44, 'A', 2, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (252, '46040', 'Advance to Suppliers and contractors', NULL, NULL, false, 44, 'A', 2, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (253, '46050', 'Advance to others', NULL, NULL, false, 44, 'A', 2, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (254, '46060', 'Deposits with external Agencies', NULL, NULL, false, 44, 'A', 2, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (255, '46080', 'Other Current Assets', NULL, NULL, false, 44, 'A', 2, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (256, '46110', 'Loans to Others', NULL, NULL, false, 45, 'A', 2, false, false, '461', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (257, '46120', 'Advances', NULL, NULL, false, 45, 'A', 2, false, false, '461', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (258, '46130', 'Deposits', NULL, NULL, false, 45, 'A', 2, false, false, '461', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (259, '47010', 'Deposit Works – Expenditure', NULL, NULL, false, 46, 'A', 2, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (260, '47020', 'Inter Unit Accounts', NULL, NULL, false, 46, 'A', 2, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (261, '47030', 'Interest Control Payable', NULL, NULL, false, 46, 'A', 2, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (262, '48010', 'Loan Issue Expenses', NULL, NULL, false, 47, 'A', 2, false, false, '480', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (263, '48020', 'Discount on Issue of loans', NULL, NULL, false, 47, 'A', 2, false, false, '480', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (264, '48030', 'Others', NULL, NULL, false, 47, 'A', 2, false, false, '480', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (265, '21010', 'Salaries, Wages and Bonus', NULL, NULL, false, 13, 'E', 2, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (266, '21020', 'Benefits and Allowances', NULL, NULL, false, 13, 'E', 2, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (267, '21030', 'Pension', NULL, NULL, false, 13, 'E', 2, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (268, '21040', 'Other Terminal and Retirement Benefits', NULL, NULL, false, 13, 'E', 2, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (269, '22010', 'Rent, Rates and Taxes', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (270, '22011', 'Office maintenance', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (271, '22012', 'Communication Expenses', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (272, '22020', 'Books and Periodicals', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (273, '22021', 'Printing and Stationery', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (274, '22030', 'Traveling and Conveyance', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (275, '22040', 'Insurance', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (276, '22050', 'Audit Fees', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (277, '22051', 'Legal Expenses', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (278, '22052', 'Professional and other Fees', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (279, '22060', 'Advertisement and Publicity', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (280, '22061', 'Membership and subscriptions', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (281, '22080', 'Others', NULL, NULL, false, 14, 'E', 2, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (282, '23010', 'Power and Fuel', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (283, '23020', 'Bulk Purchases', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (284, '23030', 'Consumption of Stores', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (285, '23040', 'Hire Charges', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (286, '23050', 'Repairs and maintenance Infrastructure Assets', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (287, '23051', 'Repairs and maintenance - Civic Amenities', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (288, '23052', 'Repairs and maintenance – Buildings', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (289, '23053', 'Repairs and maintenance – Vehicles', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (290, '23059', 'Repairs and maintenance – Others', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (291, '23080', 'Other operating and maintenance expenses', NULL, NULL, false, 15, 'E', 2, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (292, '24010', 'Interest on Loans from Central Government', NULL, NULL, false, 16, 'E', 2, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (293, '24020', 'Interest on Loans from State Government', NULL, NULL, false, 16, 'E', 2, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (294, '24030', 'Interest on Loans from Government Bodies and Associations', NULL, NULL, false, 16, 'E', 2, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (295, '24040', 'Interest on Loans from International Agencies', NULL, NULL, false, 16, 'E', 2, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (296, '24050', 'Interest on Loans from Banks and Other Financial Institutions', NULL, NULL, false, 16, 'E', 2, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (297, '24060', 'Other Interest', NULL, NULL, false, 16, 'E', 2, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (298, '24070', 'Bank Charges', NULL, NULL, false, 16, 'E', 2, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (299, '24080', 'Other Finance Expenses', NULL, NULL, false, 16, 'E', 2, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (300, '25010', 'Election Expenses', NULL, NULL, false, 17, 'E', 2, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (301, '25020', 'Own Programme', NULL, NULL, false, 17, 'E', 2, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (302, '25030', 'Share in Programme of others', NULL, NULL, false, 17, 'E', 2, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (303, '26010', 'Grants', NULL, NULL, false, 18, 'E', 2, false, false, '260', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (304, '26020', 'Contributions', NULL, NULL, false, 18, 'E', 2, false, false, '260', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (305, '26030', 'Subsidies', NULL, NULL, false, 18, 'E', 2, false, false, '260', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (306, '27010', 'Provisions for Doubtful receivables', NULL, NULL, false, 19, 'E', 2, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (307, '27020', 'Provision for other Assets', NULL, NULL, false, 19, 'E', 2, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (308, '27030', 'Revenues written off', NULL, NULL, false, 19, 'E', 2, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (309, '27040', 'Assets written off', NULL, NULL, false, 19, 'E', 2, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (310, '27050', 'Miscellaneous Expense written off', NULL, NULL, false, 19, 'E', 2, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (311, '27110', 'Loss on disposal of Assets', NULL, NULL, false, 20, 'E', 2, false, false, '271', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (312, '27120', 'Loss on disposal of Investments', NULL, NULL, false, 20, 'E', 2, false, false, '271', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (313, '27130', 'Decline in Value of Investments', NULL, NULL, false, 20, 'E', 2, false, false, '271', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (314, '27180', 'Other miscellaneous expenditure', NULL, NULL, false, 20, 'E', 2, false, false, '271', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (315, '27220', 'Buildings', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (316, '27230', 'Roads and Bridges', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (317, '27231', 'Sewerage and Drainage', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (318, '27232', 'Waterways', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (319, '27233', 'Public Lighting', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (320, '27240', 'Plant and machinery', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (321, '27250', 'Vehicles', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (322, '27260', 'Office and Other Equipments', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (323, '27270', 'Furniture, Fixtures, Fittings and Electrical Appliances', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (324, '27280', 'Other Fixed Assets', NULL, NULL, false, 21, 'E', 2, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (325, '28010', 'Taxes', NULL, NULL, false, 22, 'E', 2, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (326, '28020', 'Other – Revenues', NULL, NULL, false, 22, 'E', 2, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (327, '28030', 'Recovery of revenues written off', NULL, NULL, false, 22, 'E', 2, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (328, '28040', 'Other Income', NULL, NULL, false, 22, 'E', 2, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (329, '28050', 'Refund of Taxes', NULL, NULL, false, 22, 'E', 2, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (330, '28060', 'Refund of Other – Revenues', NULL, NULL, false, 22, 'E', 2, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (331, '28080', 'Other Expenses', NULL, NULL, false, 22, 'E', 2, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (332, '29010', 'Transfer to Capital Funds', NULL, NULL, false, 23, 'E', 2, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (333, '29020', 'Transfer to Earmarked Funds', NULL, NULL, false, 23, 'E', 2, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (334, '29030', 'Revenue Surplus', NULL, NULL, false, 23, 'E', 2, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (335, '1100101', 'Property Tax-Properties – General', NULL, NULL, true, 48, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (336, '1100102', 'Property Tax-Vacant Land', NULL, NULL, true, 48, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (337, '1100103', 'Property Tax-State Government Properties', NULL, NULL, true, 48, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (338, '1100104', 'Property Tax-State Government Undertaking Properties', NULL, NULL, true, 48, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (339, '1100105', 'Property Tax-Central Government Undertaking Properties', NULL, NULL, true, 48, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (340, '1100106', 'Property Tax-Service Charges in lieu of Property Tax', NULL, NULL, true, 48, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (341, '1100201', 'Water Tax-Properties – Water Tax', NULL, NULL, true, 49, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (342, '1100202', 'Water Tax-Direct Water Tax', NULL, NULL, true, 49, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (343, '1100301', 'Sewerage Tax-Properties – Sewerage Tax', NULL, NULL, true, 50, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (344, '1100401', 'Conservancy Tax-Properties – Conservancy Tax', NULL, NULL, true, 51, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (345, '1100501', 'Lighting Tax-Properties – Lighting Tax', NULL, NULL, true, 52, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (346, '1100601', 'Education Tax-Properties – Education Tax', NULL, NULL, true, 53, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (347, '1100700', 'Vehicle Tax-Vehicle Tax', NULL, NULL, true, 54, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (348, '1100800', 'Tax on Animals-Tax on Animals', NULL, NULL, true, 55, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (349, '1101101', 'Advertisement Tax-Land Hoardings', NULL, NULL, true, 56, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (350, '1101102', 'Advertisement Tax-Bus Shelters', NULL, NULL, true, 56, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (351, '1101103', 'Advertisement Tax-Hoardings on Vehicles', NULL, NULL, true, 56, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (352, '1101104', 'Advertisement Tax-Traffic Signals', NULL, NULL, true, 56, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (353, '1101105', 'Advertisement Tax-Adv. Tax on Cable Operators', NULL, NULL, true, 56, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (354, '1101200', 'Pilgrimage Tax-Pilgrimage Tax', NULL, NULL, true, 57, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (355, '1105100', 'Octroi and Toll-Octroi & Toll', NULL, NULL, true, 58, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (356, '1105200', 'Cess-Cess', NULL, NULL, true, 59, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (357, '1108001', 'Others Taxes-Tax on Cable Operators', NULL, NULL, true, 60, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (358, '1109001', 'Tax Remission and Refund-Vacancy Remission', NULL, NULL, true, 61, 'I', 4, false, false, '110', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (359, '1201001', 'Taxes and Duties collected by others-Surcharge on Stamp Duty for Transfer of Immovable Properties', NULL, NULL, true, 62, 'I', 4, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (360, '1201002', 'Taxes and Duties collected by others-Entertainment Tax', NULL, NULL, true, 62, 'I', 4, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (361, '1201003', 'Taxes and Duties collected by others-Profession Tax', NULL, NULL, true, 62, 'I', 4, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (362, '1202001', 'Compensation in lieu of Taxes and duties-Compensation in lieu of Octroi & Toll Tax', NULL, NULL, true, 63, 'I', 4, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (363, '1202002', 'Compensation in lieu of Taxes and duties-Compensation in lieu of Motor Vehicles Tax', NULL, NULL, true, 63, 'I', 4, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (364, '1203001', 'Compensations in lieu of Concessions-Property Tax compensations due to concessions to tax payers', NULL, NULL, true, 64, 'I', 4, false, false, '120', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (365, '1301001', 'Rent from Civic Amenities-Markets', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (366, '1301002', 'Rent from Civic Amenities-Auditoriums', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (367, '1301003', 'Rent from Civic Amenities-Function/Community Halls', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (368, '1301004', 'Rent from Civic Amenities-Playgrounds', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (369, '1301005', 'Rent from Civic Amenities-Staff Quarters', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (370, '1301006', 'Rent from Civic Amenities-Canteens', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (371, '1301007', 'Rent from Civic Amenities-Stalls in Slaughter Houses', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (372, '1301008', 'Rent from Civic Amenities-Lease of Canteen/Cycle Stands in slaughter houses', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (373, '1301009', 'Rent from Civic Amenities-Nurseries', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (374, '1301010', 'Rent from Civic Amenities-Lease/Rent from Parking Places', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (375, '1301011', 'Rent from Civic Amenities-Lease of Traffic Islands/ Central Media', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (376, '1301012', 'Rent from Civic Amenities-Lease of Land for Bus Shelters', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (377, '1301013', 'Rent from Civic Amenities-Lease of Jetties & Boats', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (378, '1301014', 'Rent from Civic Amenities-Lease of Advertisement Right', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (379, '1301015', 'Rent from Civic Amenities-Shopping Complexes', NULL, NULL, true, 65, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (380, '1302001', 'Rent from Office Buildings-Government', NULL, NULL, true, 66, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (381, '1302002', 'Rent from Office Buildings-Private', NULL, NULL, true, 66, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (382, '1303001', 'Rent from Guest Houses-Guest House', NULL, NULL, true, 67, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (383, '1304001', 'Rent from lease of lands-Lease of Land', NULL, NULL, true, 68, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (384, '1308000', 'Other rents-Other rents', NULL, NULL, true, 69, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (385, '1309000', 'Rent remission and refund-Rent remission and refund', NULL, NULL, true, 70, 'I', 4, false, false, '130', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (386, '1401001', 'Empanelment and Registration Charges-Contractors, Agencies etc', NULL, NULL, true, 71, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (387, '1401002', 'Empanelment and Registration Charges-Technical Professionals', NULL, NULL, true, 71, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (388, '1401003', 'Empanelment and Registration Charges-P.W. Contractors', NULL, NULL, true, 71, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (389, '1401004', 'Empanelment and Registration Charges-Carts', NULL, NULL, true, 71, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (390, '1401005', 'Empanelment and Registration Charges-Patients', NULL, NULL, true, 71, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (391, '1401101', 'Licensing Fees-Trade License', NULL, NULL, true, 72, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (392, '1401102', 'Licensing Fees-Cattle Pounding', NULL, NULL, true, 72, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (393, '1401103', 'Licensing Fees-Licensing of Animals', NULL, NULL, true, 72, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (394, '1401104', 'Licensing Fees-Slaughter House', NULL, NULL, true, 72, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (395, '1401105', 'Licensing Fees-Butchers & Traders of Meat', NULL, NULL, true, 72, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (396, '1401106', 'Licensing Fees-Encroachment Fee', NULL, NULL, true, 72, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (397, '1401201', 'Fees for Grant of Permit-Layout/Sub-division', NULL, NULL, true, 73, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (398, '1401202', 'Fees for Grant of Permit-Building Permit Fee', NULL, NULL, true, 73, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (399, '1401203', 'Fees for Grant of Permit-Fee for Erection of Hoardings', NULL, NULL, true, 73, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (400, '1401204', 'Fees for Grant of Permit-Intensive Zoning Fee', NULL, NULL, true, 73, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (401, '1401205', 'Fees for Grant of Permit-Film Shooting in Parks', NULL, NULL, true, 73, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (402, '1401206', 'Fees for Grant of Permit-Animal Slaughtering Fee', NULL, NULL, true, 73, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (403, '1401207', 'Fees for Grant of Permit-Beef Export Slaughtering Fee', NULL, NULL, true, 73, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (404, '1401301', 'Fees for Certificate or Extract-Copy of Plan/Certificate', NULL, NULL, true, 74, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (405, '1401302', 'Fees for Certificate or Extract-Birth & Death certificates', NULL, NULL, true, 74, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (406, '1401401', 'Development Charges-Building Development Charges', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (407, '1401402', 'Development Charges-Betterment Charges', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (408, '1401403', 'Development Charges-External Betterment Charges', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (409, '1401404', 'Development Charges-Special Development Contribution', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (410, '1401405', 'Development Charges-Impact Fee', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (411, '1401406', 'Development Charges-Un-Authorised Colony Improvement Contribution', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (412, '1401407', 'Development Charges-Open Space Contribution', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (413, '1401408', 'Development Charges-Parking Contribution', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (414, '1401409', 'Development Charges-Postage & Advertisement Charges', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (415, '1401410', 'Development Charges-Other town planning receipts', NULL, NULL, true, 75, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (416, '1401501', 'Regularization Fees-Building Regularization', NULL, NULL, true, 76, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (417, '1402001', 'Penalties and Fines-Penalty for Un-authorised Construction', NULL, NULL, true, 77, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (418, '1402002', 'Penalties and Fines-Contractors', NULL, NULL, true, 77, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (419, '1402003', 'Penalties and Fines-Continuing Penalty for Un- authorised Construction', NULL, NULL, true, 77, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (420, '1402004', 'Penalties and Fines-Spot Fines', NULL, NULL, true, 77, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (421, '1404001', 'Other Fees-Advertisement Fees', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (422, '1404002', 'Other Fees-Admission Fees', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (423, '1404003', 'Other Fees-Sports Fee', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (424, '1404004', 'Other Fees-Library Fees', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (425, '1404005', 'Other Fees-Survey fees', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (426, '1404006', 'Other Fees-Connection/ Disconnection Charges', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (427, '1404007', 'Other Fees-Notice Fees', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (428, '1404008', 'Other Fees-Warrant & Distraint Fees', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (429, '1404009', 'Other Fees-Mutation Fees', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (430, '1404010', 'Other Fees-Property Transfer Charges', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (431, '1404011', 'Other Fees-Other Fees', NULL, NULL, true, 78, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (432, '1405001', 'User Charges-Medicines', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (433, '1405002', 'User Charges-Examination Charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (434, '1405003', 'User Charges-Ambulance', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (435, '1405004', 'User Charges-Funeral Van', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (436, '1405005', 'User Charges-Garbage Collection Charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (437, '1405006', 'User Charges-Littering and Debris collection', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (438, '1405007', 'User Charges-Septic Tank clearance', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (439, '1405008', 'User Charges-Special Sanitation Charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (440, '1405009', 'User Charges-Sewerage clearance charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (441, '1405010', 'User Charges-Crematorium Charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (442, '1405011', 'User Charges-Burial Ground Charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (443, '1405012', 'User Charges-Pay & use toilets', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (444, '1405013', 'User Charges-Water Supply', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (445, '1405014', 'User Charges-Sale of Electricity', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (446, '1405015', 'User Charges-Water Tanker', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (447, '1405016', 'User Charges-Meter charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (448, '1405017', 'User Charges-Fire Extinguishing', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (449, '1405018', 'User Charges-Lighting charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (450, '1405019', 'User Charges-Ticket charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (451, '1405020', 'User Charges-Luggage charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (452, '1405021', 'User Charges-Parking fees', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (453, '1405022', 'User Charges-Pre-Paid Parking Fee', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (454, '1405023', 'User Charges-Post-Paid Parking Fee', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (455, '1405024', 'User Charges-Quality Control Charges', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (456, '1405025', 'User Charges-Coaching Camp', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (457, '1405026', 'User Charges-Gym', NULL, NULL, true, 79, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (458, '1406001', 'Entry Fees-Parks', NULL, NULL, true, 80, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (459, '1406002', 'Entry Fees-Playgrounds', NULL, NULL, true, 80, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (460, '1406003', 'Entry Fees-Swimming Pool', NULL, NULL, true, 80, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (461, '1406004', 'Entry Fees-Zoo', NULL, NULL, true, 80, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (462, '1406005', 'Entry Fees-Museum', NULL, NULL, true, 80, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (463, '1406006', 'Entry Fees-Monuments', NULL, NULL, true, 80, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (464, '1406007', 'Entry Fees-Gym', NULL, NULL, true, 80, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (465, '1407001', 'Service Administrative Charges-Road Cutting & Restoration Charges', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (466, '1407002', 'Service Administrative Charges-Library Cess Collection Administrative Charges', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (467, '1407003', 'Service Administrative Charges-Plan Preparation Charges', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (468, '1407004', 'Service Administrative Charges-Removal of Un-authorised Hoardings', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (469, '1407005', 'Service Administrative Charges-Removal of Demolition', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (470, '1407006', 'Service Administrative Charges-Removal of Encroachments', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (471, '1407007', 'Service Administrative Charges-Removal of Public Nuisances', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (472, '1407008', 'Service Administrative Charges-Administrative Charges for Deposit Works', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (473, '1407009', 'Service Administrative Charges-NOC of Public Health Section', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (474, '1407011', 'Service Administrative Charges-Water Supply – Tap Estimation Charges', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (475, '1407012', 'Service Administrative Charges-Water Supply – Tap repairs', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (476, '1407013', 'Service Administrative Charges-Solvency Certificate', NULL, NULL, true, 81, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (477, '1408001', 'Other Charges-Compounding fee', NULL, NULL, true, 82, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (478, '1409001', 'Fees Remission and Refund-Refund of Fees', NULL, NULL, true, 83, 'I', 4, false, false, '140', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (479, '1501001', 'Sale of Products-Tree-Guards', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (480, '1501002', 'Sale of Products-House Number Plates', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (481, '1501003', 'Sale of Products-Raw Water', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (482, '1501004', 'Sale of Products-Nursery plants', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (483, '1501005', 'Sale of Products-Grass, Flowers & Fruits', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (484, '1501006', 'Sale of Products-Trees', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (485, '1501007', 'Sale of Products-Rubbish', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (486, '1501008', 'Sale of Products-Garbage', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (487, '1501009', 'Sale of Products-Manure', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (488, '1501010', 'Sale of Products-Compost', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (489, '1501011', 'Sale of Products-Water meter', NULL, NULL, true, 84, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (490, '1501101', 'Sale of Forms and Publications-Tenders Schedules', NULL, NULL, true, 85, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (491, '1501102', 'Sale of Forms and Publications-Data, Plans & Maps', NULL, NULL, true, 85, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (492, '1501103', 'Sale of Forms and Publications-Forms & Pass Books', NULL, NULL, true, 85, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (493, '1501201', 'Sale of stores and scrap-Obsolete stores', NULL, NULL, true, 86, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (494, '1501202', 'Sale of stores and scrap-Scrap', NULL, NULL, true, 86, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (495, '1503001', 'Sale of others-Assets', NULL, NULL, true, 87, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (496, '1503002', 'Sale of others-Old newspapers', NULL, NULL, true, 87, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (497, '1504001', 'Hire Charges for Vehicles-Cars, Jeeps and Buses', NULL, NULL, true, 88, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (498, '1504101', 'Hire Charges on Equipments-Rollers', NULL, NULL, true, 89, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (499, '1504102', 'Hire Charges on Equipments-Tools & Equipments', NULL, NULL, true, 89, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (500, '1504103', 'Hire Charges on Equipments-Medical Equipments', NULL, NULL, true, 89, 'I', 4, false, false, '150', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (501, '1601001', 'Revenue Grant-Road Maintenance Grant', NULL, NULL, true, 90, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (502, '1601002', 'Revenue Grant-Per Capita Grant', NULL, NULL, true, 90, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (503, '1601003', 'Revenue Grant-Census Grant', NULL, NULL, true, 90, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (504, '1601004', 'Revenue Grant-Election Grants', NULL, NULL, true, 90, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (505, '1601005', 'Revenue Grant-Family Welfare Grant', NULL, NULL, true, 90, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (506, '1602001', 'Re-imbursement of expenses-Election Expenses', NULL, NULL, true, 91, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (507, '1602002', 'Re-imbursement of expenses-External-aided Projects', NULL, NULL, true, 91, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (508, '1602003', 'Re-imbursement of expenses-Family Planning Centre Expenses', NULL, NULL, true, 91, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (509, '1602004', 'Re-imbursement of expenses-Family Planning Incentives', NULL, NULL, true, 91, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (510, '1602005', 'Re-imbursement of expenses-Anti Malaria Expenses', NULL, NULL, true, 91, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (511, '1603001', 'Contribution towards schemes-Swarna Jayanthi Shari Rojgar Yojana', NULL, NULL, true, 92, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (512, '1603002', 'Contribution towards schemes-National Slum Development Project', NULL, NULL, true, 92, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (513, '1603003', 'Contribution towards schemes-Integrated Development of Small and Medium Towns', NULL, NULL, true, 92, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (514, '1603004', 'Contribution towards schemes-Integrated Low Cost Sanitation', NULL, NULL, true, 92, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (515, '1603005', 'Contribution towards schemes-Water Supply –Donation', NULL, NULL, true, 92, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (516, '1603006', 'Contribution towards schemes-Sewerage Donation', NULL, NULL, true, 92, 'I', 4, false, false, '160', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (517, '1701001', 'Interest-Fixed Deposits with Scheduled Banks', NULL, NULL, true, 93, 'I', 4, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (518, '1701002', 'Interest-Fixed Deposits with Private Banks', NULL, NULL, true, 93, 'I', 4, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (519, '1701003', 'Interest-Government Securities', NULL, NULL, true, 93, 'I', 4, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (520, '1701004', 'Interest-Post office deposits', NULL, NULL, true, 93, 'I', 4, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (521, '1702001', 'Dividend-Mutual Fund Investments', NULL, NULL, true, 94, 'I', 4, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (522, '1703000', 'Income from projects taken up on commercial basis-Income from projects taken up on commercial basis', NULL, NULL, true, 95, 'I', 4, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (523, '1704001', 'Profit in Sale of Investments-Mutual Fund Investment', NULL, NULL, true, 96, 'I', 4, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (524, '1708001', 'Others-Application in Value of Investment', NULL, NULL, true, 97, 'I', 4, false, false, '170', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (525, '1711001', 'Interest from Bank Accounts-SB accounts', NULL, NULL, true, 98, 'I', 4, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (526, '1712001', 'Interest on Loans and advances to Employees-House Building Advance', NULL, NULL, true, 99, 'I', 4, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (527, '1712002', 'Interest on Loans and advances to Employees-Hire Purchase Quarters', NULL, NULL, true, 99, 'I', 4, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (528, '1712003', 'Interest on Loans and advances to Employees-Conveyance Advance (Vehicle Advance)', NULL, NULL, true, 99, 'I', 4, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (529, '1712004', 'Interest on Loans and advances to Employees-Marriage Advance', NULL, NULL, true, 99, 'I', 4, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (530, '1712005', 'Interest on Loans and advances to Employees-Computer Advance', NULL, NULL, true, 99, 'I', 4, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (531, '1713000', 'Interest on loans to others-Interest on loans to others', NULL, NULL, true, 100, 'I', 4, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (532, '1718001', 'Other Interest-Interest on Late Payment', NULL, NULL, true, 101, 'I', 4, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (533, '1718002', 'Other Interest-Interest on HP Sales', NULL, NULL, true, 101, 'I', 4, false, false, '171', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (534, '1801001', 'Deposits Forfeited-Security Deposits', NULL, NULL, true, 102, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (535, '1801101', 'Lapsed Deposits-Earnest Money Deposit', NULL, NULL, true, 103, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (536, '1801102', 'Lapsed Deposits-Deposits', NULL, NULL, true, 103, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (537, '1802000', 'Insurance Claim Recovery-Insurance Claim Recovery', NULL, NULL, true, 104, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (538, '1803000', 'Profit on Disposal of Fixed assets-Profit on Disposal of Fixed assets', NULL, NULL, true, 105, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (539, '1804001', 'Recovery from Employees-Recovery of Private Trunk calls charges', NULL, NULL, true, 106, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (540, '1804002', 'Recovery from Employees-Recovery of Vehicle Use Charges', NULL, NULL, true, 106, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (541, '1804003', 'Recovery from Employees-Recovery of Water & Electricity Charges', NULL, NULL, true, 106, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (542, '1804004', 'Recovery from Employees-Recovery of cell phone charges', NULL, NULL, true, 106, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (543, '1805001', 'Unclaimed Refund Payable Liabilities Written Back-Liabilities', NULL, NULL, true, 107, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (544, '1805002', 'Unclaimed Refund Payable Liabilities Written Back-Stale Cheques', NULL, NULL, true, 107, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (545, '1806001', 'Excess Provisions written back-Property Tax', NULL, NULL, true, 108, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (546, '1806002', 'Excess Provisions written back-Advertisement Tax', NULL, NULL, true, 108, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (547, '1806003', 'Excess Provisions written back-Trade License', NULL, NULL, true, 108, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (548, '1806004', 'Excess Provisions written back-confluence.egovernments.org', NULL, NULL, true, 108, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (549, '1806005', 'Excess Provisions written back-Loans & Advances to Others', NULL, NULL, true, 108, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (550, '1806006', 'Excess Provisions written back-Others', NULL, NULL, true, 108, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (551, '1808001', 'Miscellaneous Income-Pension & Leave Salary Contribution', NULL, NULL, true, 109, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (552, '1808002', 'Miscellaneous Income-Bounced Cheques Realization Charges', NULL, NULL, true, 109, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (553, '1808003', 'Miscellaneous Income-Fines Imposed by the Court', NULL, NULL, true, 109, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (554, '1808004', 'Miscellaneous Income-Prior Period Income', NULL, NULL, true, 109, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (555, '1808005', 'Miscellaneous Income-Penalties', NULL, NULL, true, 109, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (556, '1808006', 'Miscellaneous Income-Other Income Un-Classified', NULL, NULL, true, 109, 'I', 4, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (557, '180', 'Other Income', NULL, NULL, false, 1, 'I', 1, false, false, '180', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (558, '2101001', 'Salaries, Wages and Bonus-Basic Pay', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (559, '2101002', 'Salaries, Wages and Bonus-Dearness Allowance', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (560, '2101003', 'Salaries, Wages and Bonus-House Rent Allowance', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (561, '2101004', 'Salaries, Wages and Bonus-CCA', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (562, '2101005', 'Salaries, Wages and Bonus-Conveyance Allowance', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (563, '2101006', 'Salaries, Wages and Bonus-Interim Relief', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (564, '2101007', 'Salaries, Wages and Bonus-Surrender Leave Encashment', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (565, '2101008', 'Salaries, Wages and Bonus-Performance Bonus', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (566, '2101009', 'Salaries, Wages and Bonus-Honorarium/Sitting Fees to Corporators', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (567, '2101010', 'Salaries, Wages and Bonus-Honorarium – others', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (568, '2101011', 'Salaries, Wages and Bonus-Wages to workers through Placement Agencies', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (569, '2101012', 'Salaries, Wages and Bonus-Pensionary Contribution', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (570, '2101013', 'Salaries, Wages and Bonus-Anticipatory Pension', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (571, '2101016', 'Salaries, Wages and Bonus-Family Planning Incentive', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (572, '2101017', 'Salaries, Wages and Bonus-Graduate Allowance', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (573, '2101018', 'Salaries, Wages and Bonus-Post Graduate Allowance', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (574, '2101019', 'Salaries, Wages and Bonus-Stagnation Increment', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (575, '2101020', 'Salaries, Wages and Bonus-Addl. House Rent Allowance', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (576, '2101021', 'Salaries, Wages and Bonus-Dearness Pay', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (577, '2101022', 'Salaries, Wages and Bonus-Special Pay', NULL, NULL, true, 265, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (578, '2102001', 'Benefits and Allowances-Leave Travel Concession', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (579, '2102002', 'Benefits and Allowances-Medical Reimbursement', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (580, '2102003', 'Benefits and Allowances-Tuition Fees', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (581, '2102004', 'Benefits and Allowances-Education Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (582, '2102005', 'Benefits and Allowances-Uniform allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (583, '2102006', 'Benefits and Allowances-Workmen Compensations', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (584, '2102007', 'Benefits and Allowances-Training', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (585, '2102008', 'Benefits and Allowances-Concession in Bus-Pass', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (586, '2102009', 'Benefits and Allowances-Staff Welfare Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (587, '2102010', 'Benefits and Allowances-Educational Concession & Scholarships', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (588, '2102011', 'Benefits and Allowances-Over Time Allowances', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (589, '2102012', 'Benefits and Allowances-Special Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (590, '2102013', 'Benefits and Allowances-Addl. Charge Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (591, '2102014', 'Benefits and Allowances-Suspension Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (592, '2102016', 'Benefits and Allowances-Night Shift Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (593, '2102017', 'Benefits and Allowances-Conveyance Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (594, '2102018', 'Benefits and Allowances-Non Private Practice Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (595, '2102019', 'Benefits and Allowances-Washing Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (596, '2102020', 'Benefits and Allowances-Physically Handicapped Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (597, '2102021', 'Benefits and Allowances-Tribal/Bad Climate Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (598, '2102022', 'Benefits and Allowances-Risk Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (599, '2102023', 'Benefits and Allowances-Typist Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (600, '2102024', 'Benefits and Allowances-Computer Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (601, '2102025', 'Benefits and Allowances-Academic Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (602, '2102026', 'Benefits and Allowances-Higher Classes Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (603, '2102027', 'Benefits and Allowances-Reading Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (604, '2102028', 'Benefits and Allowances-Supervisory Allowance', NULL, NULL, true, 266, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (605, '2103001', 'Pension-Service Pension', NULL, NULL, true, 267, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (606, '2103002', 'Pension-Family Pension', NULL, NULL, true, 267, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (607, '2103003', 'Pension-Provisional Pension', NULL, NULL, true, 267, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (608, '2104001', 'Other Terminal and Retirement Benefits-Leave encashment on retirement', NULL, NULL, true, 268, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (609, '2104002', 'Other Terminal and Retirement Benefits-Death cum Retirement gratuity', NULL, NULL, true, 268, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (610, '2104003', 'Other Terminal and Retirement Benefits-Commuted Pension', NULL, NULL, true, 268, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (611, '2104004', 'Other Terminal and Retirement Benefits-Pension and Leave Salary Contributions for Deputationists', NULL, NULL, true, 268, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (612, '2104005', 'Other Terminal and Retirement Benefits-General Provident Fund Shortfall', NULL, NULL, true, 268, 'E', 4, false, false, '210', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (613, '2201001', 'Rent, Rates and Taxes-Rents for Hired Premises', NULL, NULL, true, 269, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (614, '2201002', 'Rent, Rates and Taxes-Rates and Taxes', NULL, NULL, true, 269, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (615, '2201101', 'Office maintenance-Electricity Charges', NULL, NULL, true, 270, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (616, '2201102', 'Office maintenance-Water charges security expenses', NULL, NULL, true, 270, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (617, '2201103', 'Office maintenance-Office Security', NULL, NULL, true, 270, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (618, '2201201', 'Communication Expenses-Telephone', NULL, NULL, true, 271, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (619, '2201202', 'Communication Expenses-Mobiles', NULL, NULL, true, 271, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (620, '2201203', 'Communication Expenses-Faxes', NULL, NULL, true, 271, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (621, '2201204', 'Communication Expenses-Leased Lines & Internet', NULL, NULL, true, 271, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (622, '2202001', 'Books and Periodicals-Newspapers & Journals', NULL, NULL, true, 272, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (623, '2202002', 'Books and Periodicals-Magazines', NULL, NULL, true, 272, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (624, '2202101', 'Printing and Stationery-Printing', NULL, NULL, true, 273, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (625, '2202102', 'Printing and Stationery-Stationery', NULL, NULL, true, 273, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (626, '2202103', 'Printing and Stationery-Computer Consumables', NULL, NULL, true, 273, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (627, '2202104', 'Printing and Stationery-Service postage', NULL, NULL, true, 273, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (628, '2203001', 'Traveling and Conveyance-Traveling – In land', NULL, NULL, true, 274, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (629, '2203002', 'Traveling and Conveyance-Traveling – Abroad', NULL, NULL, true, 274, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (630, '2203003', 'Traveling and Conveyance-Fuel – (Petrol & Diesel)', NULL, NULL, true, 274, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (631, '2204001', 'Insurance-Buildings', NULL, NULL, true, 275, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (632, '2204002', 'Insurance-Vehicles', NULL, NULL, true, 275, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (633, '2204003', 'Insurance-Electronic Equipment', NULL, NULL, true, 275, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (634, '2204004', 'Insurance-Furniture', NULL, NULL, true, 275, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (635, '2204005', 'Insurance-Inventory', NULL, NULL, true, 275, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (636, '2205001', 'Audit Fees-Statutory Audit Fee', NULL, NULL, true, 276, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (637, '2205002', 'Audit Fees-Certification Fee', NULL, NULL, true, 276, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (638, '2205003', 'Audit Fees-Out of Pocket Expenses', NULL, NULL, true, 276, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (639, '2205101', 'Legal Expenses-Legal Fees', NULL, NULL, true, 277, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (640, '2205102', 'Legal Expenses-Cost of recoveries of tax revenue', NULL, NULL, true, 277, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (641, '2205103', 'Legal Expenses-Cost of recoveries of other revenues', NULL, NULL, true, 277, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (642, '2205104', 'Legal Expenses-Compensation ordered by courts', NULL, NULL, true, 277, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (643, '2205201', 'Professional and other Fees-Consultancy Charges', NULL, NULL, true, 278, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (644, '2205202', 'Professional and other Fees-Other Professional Charges', NULL, NULL, true, 278, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (645, '2206001', 'Advertisement and Publicity-Advertisement – Print Media', NULL, NULL, true, 279, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (646, '2206002', 'Advertisement and Publicity-Advertisement -TV & Radio media', NULL, NULL, true, 279, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (647, '2206003', 'Advertisement and Publicity-Hoardings', NULL, NULL, true, 279, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (648, '2206004', 'Advertisement and Publicity-Hospitality Expenses', NULL, NULL, true, 279, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (649, '2206005', 'Advertisement and Publicity-Organisation of Festivals', NULL, NULL, true, 279, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (650, '2206100', 'Membership and subscriptions-Membership & subscriptions', NULL, NULL, true, 280, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (651, '2208000', 'Others-Others', NULL, NULL, true, 281, 'E', 4, false, false, '220', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (652, '2301001', 'Power and Fuel-Power Charges for Street Lighting', NULL, NULL, true, 282, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (653, '2301002', 'Power and Fuel-Power charges for water pumping', NULL, NULL, true, 282, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (654, '2301003', 'Power and Fuel-Power charges for other services', NULL, NULL, true, 282, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (655, '2301004', 'Power and Fuel-Fuel to Heavy Vehicles', NULL, NULL, true, 282, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (656, '2301005', 'Power and Fuel-Fuel to Light Vehicles', NULL, NULL, true, 282, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (657, '2301006', 'Power and Fuel-Fuel supply for field staff vehicles', NULL, NULL, true, 282, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (658, '2302001', 'Bulk Purchases-Sanitation/Conservancy Material', NULL, NULL, true, 283, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (659, '2302002', 'Bulk Purchases-Purchase of Medicines', NULL, NULL, true, 283, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (660, '2303001', 'Consumption of Stores-Engineering Stores', NULL, NULL, true, 284, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (661, '2303002', 'Consumption of Stores-Transport Stores', NULL, NULL, true, 284, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (662, '2303003', 'Consumption of Stores-Medical Stores', NULL, NULL, true, 284, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (663, '2303004', 'Consumption of Stores-Central Stationary Stores', NULL, NULL, true, 284, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (664, '2304001', 'Hire Charges-Machinery Rent', NULL, NULL, true, 285, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (665, '2304002', 'Hire Charges-Vehicles', NULL, NULL, true, 285, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (666, '2305001', 'Repairs and maintenance Infrastructure Assets-Main Roads', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (667, '2305002', 'Repairs and maintenance Infrastructure Assets-By-lane Roads', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (668, '2305003', 'Repairs and maintenance Infrastructure Assets-Bridges', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (669, '2305004', 'Repairs and maintenance Infrastructure Assets-Fly-Overs', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (670, '2305005', 'Repairs and maintenance Infrastructure Assets-Water Supply Lines', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (671, '2305006', 'Repairs and maintenance Infrastructure Assets-Sewerage Lines', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (672, '2305007', 'Repairs and maintenance Infrastructure Assets-Storm Water Drains', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (673, '2305008', 'Repairs and maintenance Infrastructure Assets-Traffic Signals', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (674, '2305009', 'Repairs and maintenance Infrastructure Assets-Street Lighting', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (675, '2305010', 'Repairs and maintenance Infrastructure Assets-Burial Grounds', NULL, NULL, true, 286, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (676, '2305101', 'Repairs and maintenance - Civic Amenities-Major Parks', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (677, '2305102', 'Repairs and maintenance - Civic Amenities-Minor Parks', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (678, '2305103', 'Repairs and maintenance - Civic Amenities-Colony Parks', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (679, '2305104', 'Repairs and maintenance - Civic Amenities-Stadium', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (680, '2305105', 'Repairs and maintenance - Civic Amenities-Play Grounds', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (681, '2305106', 'Repairs and maintenance - Civic Amenities-Swimming Pools', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (682, '2305107', 'Repairs and maintenance - Civic Amenities-Nursery', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (683, '2305108', 'Repairs and maintenance - Civic Amenities-Play Materials', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (684, '2305109', 'Repairs and maintenance - Civic Amenities-Public Toilets', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (685, '2305110', 'Repairs and maintenance - Civic Amenities-Market Yards', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (686, '2305111', 'Repairs and maintenance - Civic Amenities-Parking Lots', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (687, '2305112', 'Repairs and maintenance - Civic Amenities-Avenue and Other Plantations', NULL, NULL, true, 287, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (688, '2305201', 'Repairs and maintenance – Buildings-Community Halls', NULL, NULL, true, 288, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (689, '2305202', 'Repairs and maintenance – Buildings-Commercial Complex', NULL, NULL, true, 288, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (690, '2305203', 'Repairs and maintenance – Buildings-Office Buildings', NULL, NULL, true, 288, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (691, '2305204', 'Repairs and maintenance – Buildings-Staff Quarters', NULL, NULL, true, 288, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (692, '2305301', 'Repairs and maintenance – Vehicles-Heavy Vehicles', NULL, NULL, true, 289, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (693, '2305302', 'Repairs and maintenance – Vehicles-Light Vehicles', NULL, NULL, true, 289, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (694, '2305901', 'Repairs and maintenance – Others-Furniture & Fixtures', NULL, NULL, true, 290, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (695, '2305902', 'Repairs and maintenance – Others-Computers & Net Work', NULL, NULL, true, 290, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (696, '2305903', 'Repairs and maintenance – Others-Electronic Equipment', NULL, NULL, true, 290, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (697, '2305904', 'Repairs and maintenance – Others-Office Equipment', NULL, NULL, true, 290, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (698, '2305905', 'Repairs and maintenance – Others-Survey & Drawing Equipment', NULL, NULL, true, 290, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (699, '2305906', 'Repairs and maintenance – Others-Plant & Machinery', NULL, NULL, true, 290, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (700, '2305907', 'Repairs and maintenance – Others-Conservancy Tools', NULL, NULL, true, 290, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (701, '2308001', 'Other operating and maintenance expenses-Garbage Clearance', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (702, '2308002', 'Other operating and maintenance expenses-Testing & Inspection', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (703, '2308003', 'Other operating and maintenance expenses-Field Survey & Inspection', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (704, '2308004', 'Other operating and maintenance expenses-Water Purification', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (705, '2308005', 'Other operating and maintenance expenses-Mapping, Plotting & Drawing Expenses', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (706, '2308006', 'Other operating and maintenance expenses-Naming & Numbering of Streets', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (707, '2308007', 'Other operating and maintenance expenses-Demolition & Removal Expenses', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (708, '2308008', 'Other operating and maintenance expenses-Quality Control Expenses', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (709, '2308009', 'Other operating and maintenance expenses-Prevention of Epidemics', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (710, '2308010', 'Other operating and maintenance expenses-Collection and Testing of Food Samples', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (711, '2308011', 'Other operating and maintenance expenses-Expenses on Unclaimed Dead Bodies', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (712, '2308012', 'Other operating and maintenance expenses-Control of Stray Animals', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (713, '2308013', 'Other operating and maintenance expenses-Sanitation/Conservancy Expenses', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (714, '2308014', 'Other operating and maintenance expenses-Intensive/Special Sanitation including for Fairs & Festivals', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (715, '2308015', 'Other operating and maintenance expenses-Maintenance of Garbage Dumping Yards/Transfer Stations', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (716, '2308016', 'Other operating and maintenance expenses-Maintenance of slaughter houses', NULL, NULL, true, 291, 'E', 4, false, false, '230', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (717, '2401000', 'Interest on Loans from Central Government-Interest on Loans from Central Government', NULL, NULL, true, 292, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (718, '2402000', 'Interest on Loans from State Government-Interest on Loans from State Government', NULL, NULL, true, 293, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (719, '2403000', 'Interest on Loans from Government Bodies and Associations-Interest on Loans from Government Bodies & Associations', NULL, NULL, true, 294, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (720, '2404000', 'Interest on Loans from International Agencies-Interest on Loans from International Agencies', NULL, NULL, true, 295, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (721, '2405000', 'Interest on Loans from Banks and Other Financial Institutions-Interest on Loans from Banks and Other Financial Institutions', NULL, NULL, true, 296, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (722, '2406001', 'Other Interest-Bonds', NULL, NULL, true, 297, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (723, '2406002', 'Other Interest-Finance Lease', NULL, NULL, true, 297, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (724, '2406003', 'Other Interest-Hire Purchase', NULL, NULL, true, 297, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (725, '2407001', 'Bank Charges-Miscellaneous Bank Charges', NULL, NULL, true, 298, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (726, '2408001', 'Other Finance Expenses-Expenses on Issue of Bonds', NULL, NULL, true, 299, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (727, '2408002', 'Other Finance Expenses-Surveillance Fee', NULL, NULL, true, 299, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (728, '2408003', 'Other Finance Expenses-Transaction Processing For Collections', NULL, NULL, true, 299, 'E', 4, false, false, '240', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (729, '2501001', 'Election Expenses-Local Body Elections', NULL, NULL, true, 300, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (730, '2501002', 'Election Expenses-MLA/MP Elections', NULL, NULL, true, 300, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (731, '2502001', 'Own Programme-Environmental Awareness Programme', NULL, NULL, true, 301, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (732, '2502002', 'Own Programme-Urban Malaria Eradication', NULL, NULL, true, 301, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (733, '2502003', 'Own Programme-Study Tour/Trainings', NULL, NULL, true, 301, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (734, '2502004', 'Own Programme-Seminars', NULL, NULL, true, 301, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (735, '2502005', 'Own Programme-Voluntary Garbage Disposal Programme', NULL, NULL, true, 301, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (736, '2502006', 'Own Programme-Cultural Programmes', NULL, NULL, true, 301, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (737, '2502007', 'Own Programme-Community Organisation / Mobilisation', NULL, NULL, true, 301, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (738, '2502008', 'Own Programme-Special Nutritation Programme', NULL, NULL, true, 301, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (739, '2502009', 'Own Programme-Summer/Winter Coaching Camps', NULL, NULL, true, 301, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (740, '2503001', 'Share in Programme of others-Family Welfare Programme', NULL, NULL, true, 302, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (741, '2503002', 'Share in Programme of others-Financial Aid for Urban Self Help Groups', NULL, NULL, true, 302, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (742, '2503003', 'Share in Programme of others-Disbursements to T&S / DWCUA and Self Help groups under SJSRY', NULL, NULL, true, 302, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (743, '2503004', 'Share in Programme of others-Shilparamam Greening/Others', NULL, NULL, true, 302, 'E', 4, false, false, '250', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (744, '2601000', 'Grants-Grants', NULL, NULL, true, 303, 'E', 4, false, false, '260', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (745, '2602000', 'Contributions-Contributions', NULL, NULL, true, 304, 'E', 4, false, false, '260', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (746, '2603000', 'Subsidies-Subsidies', NULL, NULL, true, 305, 'E', 4, false, false, '260', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (747, '2701001', 'Provisions for Doubtful receivables-Property Tax', NULL, NULL, true, 306, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (748, '2701002', 'Provisions for Doubtful receivables-Advertisement Tax', NULL, NULL, true, 306, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (749, '2701003', 'Provisions for Doubtful receivables-Others', NULL, NULL, true, 306, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (750, '2702001', 'Provision for other Assets-Inventory', NULL, NULL, true, 307, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (751, '2702002', 'Provision for other Assets-Investments', NULL, NULL, true, 307, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (752, '2702003', 'Provision for other Assets-Loans & Advances to others', NULL, NULL, true, 307, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (753, '2703001', 'Revenues written off-Property Tax', NULL, NULL, true, 308, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (754, '2703002', 'Revenues written off-Advertisement Tax', NULL, NULL, true, 308, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (755, '2703003', 'Revenues written off-Assigned Revenue', NULL, NULL, true, 308, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (756, '2704001', 'Assets written off-Stores', NULL, NULL, true, 309, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (757, '2704002', 'Assets written off-Investments', NULL, NULL, true, 309, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (758, '2704003', 'Assets written off-Decline in Fixed Assets', NULL, NULL, true, 309, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (759, '2704004', 'Assets written off-Loans & Advances to others', NULL, NULL, true, 309, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (760, '2705001', 'Miscellaneous Expense written off-Deferred Revenue Expenses', NULL, NULL, true, 310, 'E', 4, false, false, '270', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (761, '2711000', 'Loss on disposal of Assets-Loss on disposal of Assets', NULL, NULL, true, 311, 'E', 4, false, false, '271', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (762, '2712001', 'Loss on disposal of Investments-Mutual Fund Investment', NULL, NULL, true, 312, 'E', 4, false, false, '271', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (763, '2713000', 'Decline in Value of Investments-Decline in Value of Investments', NULL, NULL, true, 313, 'E', 4, false, false, '271', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (764, '2718000', 'Other miscellaneous expenditure-Other miscellaneous expenditure', NULL, NULL, true, 314, 'E', 4, false, false, '271', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (765, '2722000', 'Buildings-Buildings', NULL, NULL, true, 315, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (766, '2723000', 'Roads and Bridges-Roads & Bridges', NULL, NULL, true, 316, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (767, '2723100', 'Sewerage and Drainage-Sewerage and Drainage', NULL, NULL, true, 317, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (768, '2723200', 'Waterways-Waterways', NULL, NULL, true, 318, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (769, '2723300', 'Public Lighting-Public Lighting', NULL, NULL, true, 319, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (770, '2724000', 'Plant and machinery-Plant & machinery', NULL, NULL, true, 320, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (771, '2725000', 'Vehicles-Vehicles', NULL, NULL, true, 321, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (772, '2726000', 'Office and Other Equipments-Office & Other Equipments', NULL, NULL, true, 322, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (773, '2727000', 'Furniture, Fixtures, Fittings and Electrical Appliances-Furniture, Fixtures, Fittings and Electrical Appliances', NULL, NULL, true, 323, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (774, '2728000', 'Other Fixed Assets-Other Fixed Assets', NULL, NULL, true, 324, 'E', 4, false, false, '272', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (775, '2801000', 'Taxes-Taxes', NULL, NULL, true, 325, 'E', 4, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (776, '2802000', 'Other – Revenues-Other – Revenues', NULL, NULL, true, 326, 'E', 4, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (777, '2803000', 'Recovery of revenues written off-Recovery of revenues written off', NULL, NULL, true, 327, 'E', 4, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (778, '2804000', 'Other Income-Other Income', NULL, NULL, true, 328, 'E', 4, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (779, '2805000', 'Refund of Taxes-Refund of Taxes', NULL, NULL, true, 329, 'E', 4, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (780, '2806000', 'Refund of Other – Revenues-Refund of Other – Revenues', NULL, NULL, true, 330, 'E', 4, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (781, '2808000', 'Other Expenses-Other Expenses', NULL, NULL, true, 331, 'E', 4, false, false, '280', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (782, '2901001', 'Transfer to Capital Funds-City Development Fund', NULL, NULL, true, 332, 'E', 4, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (783, '2901002', 'Transfer to Capital Funds-UCD Fund', NULL, NULL, true, 332, 'E', 4, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (784, '2902001', 'Transfer to Earmarked Funds-Sinking Fund', NULL, NULL, true, 333, 'E', 4, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (785, '2902002', 'Transfer to Earmarked Funds-Salary Reserve Fund', NULL, NULL, true, 333, 'E', 4, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (786, '2902003', 'Transfer to Earmarked Funds-Pension Reserve Fund', NULL, NULL, true, 333, 'E', 4, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (787, '2903001', 'Revenue Surplus-General Reserve', NULL, NULL, true, 334, 'E', 4, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (788, '2903002', 'Revenue Surplus-Surplus of Income Over Expenditure', NULL, NULL, true, 334, 'E', 4, false, false, '290', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (789, '3101001', 'General Fund-Revenue Transfers', NULL, NULL, true, 110, 'L', 4, false, false, '310', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (790, '3111001', 'Special Funds-City Development Fund', NULL, NULL, true, 112, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (791, '3111002', 'Special Funds-Urban Poverty Alleviation Fund', NULL, NULL, true, 112, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (792, '3111003', 'Special Funds-Abatement of Pollution of Rivers', NULL, NULL, true, 112, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (793, '3111004', 'Special Funds-Preservation of Heritage sites fund', NULL, NULL, true, 112, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (794, '3111005', 'Special Funds-Revolving Fund', NULL, NULL, true, 112, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (795, '3115001', 'Sinking Funds-City Development Bonds', NULL, NULL, true, 113, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (796, '3117001', 'Trust or Agency Funds-Salary Reserve Fund', NULL, NULL, true, 114, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (797, '3117002', 'Trust or Agency Funds-Pension Fund', NULL, NULL, true, 114, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (798, '3117003', 'Trust or Agency Funds-General Provident Fund', NULL, NULL, true, 114, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (799, '3117004', 'Trust or Agency Funds-Leave Salary and Gratuity Fund', NULL, NULL, true, 114, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (800, '3117005', 'Trust or Agency Funds-Employee Welfare Fund', NULL, NULL, true, 114, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (801, '3117006', 'Trust or Agency Funds-Old age Pension', NULL, NULL, true, 114, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (802, '3117007', 'Trust or Agency Funds-Widow Pension', NULL, NULL, true, 114, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (803, '3117008', 'Trust or Agency Funds-Disabled Pension', NULL, NULL, true, 114, 'L', 4, false, false, '311', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (805, '3121000', 'Capital Contribution-Capital Contribution', NULL, NULL, true, 115, 'L', 4, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (806, '3121100', 'Capital Reserve-Capital Reserve', NULL, NULL, true, 116, 'L', 4, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (807, '3122000', 'Borrowing Redemption reserve-Borrowing Redemption reserve', NULL, NULL, true, 117, 'L', 4, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (808, '3123000', 'Special Funds (Utilised)-Special Funds (Utilised)', NULL, NULL, true, 118, 'L', 4, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (809, '3124000', 'Statutory Reserve-Statutory Reserve', NULL, NULL, true, 119, 'L', 4, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (810, '3125000', 'General Reserve-General Reserve', NULL, NULL, true, 120, 'L', 4, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (811, '3126001', 'Revaluation Reserve-Fixed Assets', NULL, NULL, true, 121, 'L', 4, false, false, '312', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (812, '3201001', 'Central Government-Adarsh Basti Scheme', NULL, NULL, true, 122, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (813, '3201002', 'Central Government-Abatement of Pollution of Rivers', NULL, NULL, true, 122, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (814, '3202001', 'State Government-Water Supply', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (815, '3202002', 'State Government-XIIth Finance Commission', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (816, '3202003', 'State Government-MP Local Area Development', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (817, '3202004', 'State Government-Assembly Constituency Development Programme', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (818, '3202005', 'State Government-Clean & Green Programme', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (819, '3202006', 'State Government-Janmabhoomi Programme', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (820, '3202007', 'State Government-Mega City Project (MCP)', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (821, '3202008', 'State Government-Improvement of Cities', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (822, '3202009', 'State Government-Charminar Pedestrianisation Project', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (823, '3202010', 'State Government-Rain Water Harvesting (RWH)', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (824, '3202011', 'State Government-Make City Green', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (825, '3202012', 'State Government-MRTS Project', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (826, '3202013', 'State Government-TWINS/e-Seva Project', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (827, '3202014', 'State Government-National Slum Development Programme (NSDP)', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (828, '3202015', 'State Government-Swarna Jayanthi Shahri Rozgar Yojana (SJSRY)/NRY', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (829, '3202016', 'State Government-Balika Samrudhi Yojana (BSY)', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (830, '3202017', 'State Government-Local Water Supply & Sewerage in Slums', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (831, '3202018', 'State Government-Urban Community Development (UCD)', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (832, '3202019', 'State Government-IPP VIII Project', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (833, '3202020', 'State Government-Natural Calamities Grant', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (834, '3202021', 'State Government-Reimbursement from Govt Departments including R&B', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (835, '3202022', 'State Government-Abatement of Pollution of Rivers', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (836, '3202023', 'State Government-Others', NULL, NULL, true, 123, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (837, '3203001', 'Other Government Agencies-Green House Gas Pollution Prevention Project', NULL, NULL, true, 124, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (838, '3204000', 'Financial Institutions-Financial Institutions', NULL, NULL, true, 125, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (839, '3205000', 'Welfare Bodies-Welfare Bodies', NULL, NULL, true, 126, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (840, '3206001', 'International Organizations-Water & Sanitation Programme (World Bank)', NULL, NULL, true, 127, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (841, '3206002', 'International Organizations-Urban Management/Cities Alliance Programme (UNCHS – World Bank)', NULL, NULL, true, 127, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (842, '3208001', 'Others-Public Contribution for Works', NULL, NULL, true, 128, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (843, '3208002', 'Others-Abatement of Pollution of River (Industry Contribution)', NULL, NULL, true, 128, 'L', 4, false, false, '320', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (844, '3301001', 'Loans from Central Government-Short Term Loan', NULL, NULL, true, 129, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (845, '3301002', 'Loans from Central Government-Long Term Loan', NULL, NULL, true, 129, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (846, '3302001', 'Loans from State Government-Short Term Loan', NULL, NULL, true, 130, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (847, '3302002', 'Loans from State Government-Long Term Loan', NULL, NULL, true, 130, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (848, '3303000', 'Loans from Government Bodies and Association-Loans from Government Bodies & Association', NULL, NULL, true, 131, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (849, '3304000', 'Loans from International Agencies-Loans from International Agencies', NULL, NULL, true, 132, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (850, '3305001', 'Loans from Banks and Other Financial Institutions-From Banks', NULL, NULL, true, 133, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (851, '3305002', 'Loans from Banks and Other Financial Institutions-From Other Financial Institutions', NULL, NULL, true, 133, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (852, '3305003', 'Loans from Banks and Other Financial Institutions-Institutional Agencies', NULL, NULL, true, 133, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (853, '3306001', 'Other Term Loans-HUDCO Loans', NULL, NULL, true, 134, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (854, '3306002', 'Other Term Loans-Others', NULL, NULL, true, 134, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (855, '3307001', 'Bonds and Debentures-City Development Bonds', NULL, NULL, true, 135, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (856, '3308000', 'Other Loans-Other Loans', NULL, NULL, true, 136, 'L', 4, false, false, '330', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (857, '3311001', 'Loans from Central Government-Short Term Loan', NULL, NULL, true, 137, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (858, '3311002', 'Loans from Central Government-Long Term Loan', NULL, NULL, true, 137, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (859, '3312001', 'Loans from State Government-Short Term Loan', NULL, NULL, true, 138, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (860, '3312002', 'Loans from State Government-Long Term Loan', NULL, NULL, true, 138, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (861, '3313000', 'Loans from Government Bodies and Association-Loans from Government Bodies and Association', NULL, NULL, true, 139, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (862, '3314000', 'Loans from International Agencies-Loans from International Agencies', NULL, NULL, true, 140, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (863, '3315001', 'Loans from Banks and Other Financial Institutions-From Banks', NULL, NULL, true, 141, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (864, '3315002', 'Loans from Banks and Other Financial Institutions-From Other Financial Institutions', NULL, NULL, true, 141, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (865, '3315003', 'Loans from Banks and Other Financial Institutions-Institutional Agencies', NULL, NULL, true, 141, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (866, '3316001', 'Other Term Loans-HUDCO Loans', NULL, NULL, true, 142, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (867, '3317001', 'Bonds and Debentures-City Development Bonds', NULL, NULL, true, 143, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (868, '3318000', 'Other Loans-', NULL, NULL, true, 144, 'L', 4, false, false, '331', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (869, '3401001', 'From Contractors Suppliers-Ernest Money Deposit', NULL, NULL, true, 145, 'L', 4, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (870, '3401002', 'From Contractors Suppliers-Retention Money Deposit', 95, NULL, true, 145, 'L', 4, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (871, '3401003', 'From Contractors Suppliers-Further Security Deposit', 29, NULL, true, 145, 'L', 4, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (872, '3402001', 'Deposits – Revenues-Rental Deposits', NULL, NULL, true, 146, 'L', 4, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (873, '3402002', 'Deposits – Revenues-Security Deposits', NULL, NULL, true, 146, 'L', 4, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (874, '3403000', 'From Staff-From Staff', NULL, NULL, true, 147, 'L', 4, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (875, '3408000', 'From Others-From Others', NULL, NULL, true, 148, 'L', 4, false, false, '340', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (876, '3411001', 'Civil works-State Government Departments', NULL, NULL, true, 149, 'L', 4, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (877, '3411002', 'Civil works-Public Sector Undertakings', NULL, NULL, true, 149, 'L', 4, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (878, '3411003', 'Civil works-Private Organizations & Citizens', NULL, NULL, true, 149, 'L', 4, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (879, '3412001', 'Electrical works-State Government Departments', NULL, NULL, true, 150, 'L', 4, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (880, '3412002', 'Electrical works-Public Sector Undertakings', NULL, NULL, true, 150, 'L', 4, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (881, '3412003', 'Electrical works-Private Organizations & Citizens', NULL, NULL, true, 150, 'L', 4, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (882, '3418001', 'Others-State Government Departments', NULL, NULL, true, 151, 'L', 4, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (883, '3418002', 'Others-Public Sector Undertakings', NULL, NULL, true, 151, 'L', 4, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (884, '3418003', 'Others-Private Organizations & Citizens', NULL, NULL, true, 151, 'L', 4, false, false, '341', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (886, '3501001', 'Creditors-Suppliers', 27, NULL, true, 152, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (887, '3501002', 'Creditors-Contractors', 26, NULL, true, 152, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (888, '3501003', 'Creditors-Expenses', 28, NULL, true, 152, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (889, '3501101', 'Employee liabilities-Salary Payable', NULL, NULL, true, 153, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (890, '3501102', 'Employee liabilities-Pension Payable', NULL, NULL, true, 153, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (891, '3501103', 'Employee liabilities-Leave Salary Payable', NULL, NULL, true, 153, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (892, '3501104', 'Employee liabilities-Terminal Benefits Payable', NULL, NULL, true, 153, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (893, '3501105', 'Employee liabilities-GPF Payable', NULL, NULL, true, 153, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (894, '3501106', 'Employee liabilities-Unpaid Salaries', NULL, NULL, true, 153, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (895, '3501107', 'Employee liabilities-Contributory Pension Payable', NULL, NULL, true, 153, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (896, '3501201', 'Interest Accrued and due-Central Government Loans', NULL, NULL, true, 154, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (897, '3501202', 'Interest Accrued and due-State Government Loans', NULL, NULL, true, 154, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (898, '3501203', 'Interest Accrued and due-International Agencies', NULL, NULL, true, 154, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (899, '3501204', 'Interest Accrued and due-Financial Institutions', NULL, NULL, true, 154, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (900, '3501205', 'Interest Accrued and due-Bonds', NULL, NULL, true, 154, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (901, '3501206', 'Interest Accrued and due-Others', NULL, NULL, true, 154, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (902, '3502001', 'Recoveries payable-GPF', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (903, '3502002', 'Recoveries payable-GPF –Employees on Deputation', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (904, '3502003', 'Recoveries payable-GIS', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (905, '3502004', 'Recoveries payable-Profession Tax', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (906, '3502005', 'Recoveries payable-APGLI', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (907, '3502006', 'Recoveries payable-LIC', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (908, '3502007', 'Recoveries payable-Banks Loan', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (909, '3502008', 'Recoveries payable-TDS from Employees', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (910, '3502009', 'Recoveries payable-APWEF', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (911, '3502010', 'Recoveries payable-Court Recoveries', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (912, '3502011', 'Recoveries payable-House Rent (Other than Municipal Quarters)', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (913, '3502012', 'Recoveries payable-SCCS(SD)', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (914, '3502013', 'Recoveries payable-KCCS(SD)', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (915, '3502014', 'Recoveries payable-NGOCCS', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (916, '3502015', 'Recoveries payable-SMUCCS', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (917, '3502016', 'Recoveries payable-MDCCS', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (918, '3502017', 'Recoveries payable-LCCS', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (919, '3502018', 'Recoveries payable-DGCCS', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (920, '3502019', 'Recoveries payable-TWF', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (921, '3502020', 'Recoveries payable-MBF', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (922, '3502021', 'Recoveries payable-KNCCS', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (923, '3502022', 'Recoveries payable-SCCS', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (924, '3502023', 'Recoveries payable-KCCS', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (925, '3502024', 'Recoveries payable-Other Employee Deductions', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (926, '3502025', 'Recoveries payable-TDS from Contractors', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (927, '3502051', 'Recoveries payable-Turnover Tax', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (928, '3502052', 'Recoveries payable-APGST', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (929, '3502053', 'Recoveries payable-CST', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (930, '3502054', 'Recoveries payable-Service Tax', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (931, '3502055', 'Recoveries payable-NAC', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (932, '3502056', 'Recoveries payable-Seignorage Charges', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (933, '3502057', 'Recoveries payable-TDS Payable Interest', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (934, '3502058', 'Recoveries payable-Other Recoveries From Contractors', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (935, '3502061', 'Recoveries payable-Court Attachments', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (936, '3502062', 'Recoveries payable-PH Employees Coop Society', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (937, '3502063', 'Recoveries payable-DCC Bank', NULL, NULL, true, 155, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (938, '3503001', 'Government Dues payable-Library Cess', NULL, NULL, true, 156, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (939, '3503002', 'Government Dues payable-Education Cess', NULL, NULL, true, 156, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (940, '3503003', 'Government Dues payable-Court Attachment', NULL, NULL, true, 156, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (941, '3504001', 'Refunds payable-Taxes', NULL, NULL, true, 157, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (942, '3504002', 'Refunds payable-Family Benefit Fund Settlements', NULL, NULL, true, 157, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (943, '3504003', 'Refunds payable-Group Insurance Settlements', NULL, NULL, true, 157, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (944, '3504004', 'Refunds payable-Unutilized Grants', NULL, NULL, true, 157, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (945, '3504005', 'Refunds payable-Deposit Works', NULL, NULL, true, 157, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (946, '3504006', 'Refunds payable-Development Charges to UDA', NULL, NULL, true, 157, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (947, '3504007', 'Refunds payable-Others', NULL, NULL, true, 157, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (948, '3504101', 'Advance Collection of Revenues-Property Tax', NULL, NULL, true, 158, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (949, '3504102', 'Advance Collection of Revenues-Advertisement Tax', NULL, NULL, true, 158, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (950, '3504103', 'Advance Collection of Revenues-Trade License', NULL, NULL, true, 158, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (951, '3504104', 'Advance Collection of Revenues-Rent', NULL, NULL, true, 158, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (952, '3508001', 'Others-Stale Cheque', NULL, NULL, true, 159, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (953, '3508002', 'Others-Compensation Payable', NULL, NULL, true, 159, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (954, '3508003', 'Others-Lease Charges payable', NULL, NULL, true, 159, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (955, '3508004', 'Others-Advances under HP', NULL, NULL, true, 159, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (956, '3508005', 'Others-Election deposit from candidates', NULL, NULL, true, 159, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (957, '3509001', 'Sale Proceeds-Attached Properties', NULL, NULL, true, 160, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (958, '3509002', 'Sale Proceeds-Assets', NULL, NULL, true, 160, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (959, '3509003', 'Sale Proceeds-Stores', NULL, NULL, true, 160, 'L', 4, false, false, '350', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (960, '3601001', 'Provisions for Expenses-Establishment Expenses', NULL, NULL, true, 161, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (961, '3601002', 'Provisions for Expenses-Administrative Expenses', NULL, NULL, true, 161, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (962, '3601003', 'Provisions for Expenses-Operations & Maintenance', NULL, NULL, true, 161, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (963, '3602001', 'Provision for Interest-Interest Accrued and not due', NULL, NULL, true, 162, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (964, '3603001', 'Provision for Other Assets-Inventory', NULL, NULL, true, 163, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (965, '3603002', 'Provision for Other Assets-Investments', NULL, NULL, true, 163, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (966, '3604001', 'Provisions for Doubtful receivables-Property Tax', NULL, NULL, true, 164, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (967, '3604002', 'Provisions for Doubtful receivables-Advertisement Tax', NULL, NULL, true, 164, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (968, '3604003', 'Provisions for Doubtful receivables-Trade License', NULL, NULL, true, 164, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (969, '3604004', 'Provisions for Doubtful receivables-Rents', NULL, NULL, true, 164, 'L', 4, false, false, '360', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (970, '4101001', 'Land-Open Space', NULL, NULL, true, 165, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (971, '4101002', 'Land-Grounds', NULL, NULL, true, 165, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (972, '4101003', 'Land-Parks', NULL, NULL, true, 165, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (973, '4101004', 'Land-Gardens', NULL, NULL, true, 165, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (974, '4102001', 'Buildings-Office Buildings', NULL, NULL, true, 166, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (975, '4102002', 'Buildings-Commercial Complex', NULL, NULL, true, 166, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (976, '4102003', 'Buildings-Hospitals, Dispensaries & Health Posts', NULL, NULL, true, 166, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (977, '4102004', 'Buildings-Community Halls & Reading Rooms', NULL, NULL, true, 166, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (978, '4102005', 'Buildings-Gust Houses', NULL, NULL, true, 166, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (979, '4102006', 'Buildings-Staff Quarters', NULL, NULL, true, 166, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (980, '4102007', 'Buildings-Public Latrines & Urinals', NULL, NULL, true, 166, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (981, '4103001', 'Roads and Bridges-Concrete Road', NULL, NULL, true, 167, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (982, '4103002', 'Roads and Bridges-Black Topped Roads', NULL, NULL, true, 167, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (983, '4103003', 'Roads and Bridges-Link Roads, Parallel Roads & Slip Roads', NULL, NULL, true, 167, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (984, '4103004', 'Roads and Bridges-Footpaths & Table Drains', NULL, NULL, true, 167, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (985, '4103005', 'Roads and Bridges-Bridges & Culverts', NULL, NULL, true, 167, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (986, '4103006', 'Roads and Bridges-Fly-overs & Over Bridges', NULL, NULL, true, 167, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (987, '4103007', 'Roads and Bridges-Subways & Causeways', NULL, NULL, true, 167, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (988, '4103101', 'Sewerage and Drainage-Underground Drains', NULL, NULL, true, 168, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (989, '4103102', 'Sewerage and Drainage-Open Drains', NULL, NULL, true, 168, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (990, '4103201', 'Water works-Water works', NULL, NULL, true, 169, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (991, '4103202', 'Water works-Open/bore Wells', NULL, NULL, true, 169, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (992, '4103203', 'Water works-Reservoirs', NULL, NULL, true, 169, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (993, '4103301', 'Public Lighting-Modern Lighting On Main Roads', NULL, NULL, true, 170, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (994, '4103302', 'Public Lighting-Modern Lighting On Lanes, By- lanes', NULL, NULL, true, 170, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (995, '4104000', 'Plant and Machinery-Plant & Machinery', NULL, NULL, true, 171, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (996, '4105001', 'Vehicles-Ambulance', NULL, NULL, true, 172, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (997, '4105002', 'Vehicles-Buses', NULL, NULL, true, 172, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (998, '4105003', 'Vehicles-Cars & Jeeps', NULL, NULL, true, 172, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (999, '4105004', 'Vehicles-Cranes', NULL, NULL, true, 172, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1000, '4105005', 'Vehicles-Trucks', NULL, NULL, true, 172, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1001, '4105006', 'Vehicles-Tankers', NULL, NULL, true, 172, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1002, '4106001', 'Office and Other Equipments-Air Conditioners', NULL, NULL, true, 173, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1003, '4106002', 'Office and Other Equipments-Computers', NULL, NULL, true, 173, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1004, '4106003', 'Office and Other Equipments-Faxes', NULL, NULL, true, 173, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1005, '4106004', 'Office and Other Equipments-Photocopiers', NULL, NULL, true, 173, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1006, '4106005', 'Office and Other Equipments-Refrigerators', NULL, NULL, true, 173, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1007, '4106006', 'Office and Other Equipments-Network Equipment', NULL, NULL, true, 173, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1008, '4107001', 'Furniture, Fixtures, Fittings and Electrical Appliances-Cabinets & Partitions', NULL, NULL, true, 174, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1009, '4107002', 'Furniture, Fixtures, Fittings and Electrical Appliances-Cupboards', NULL, NULL, true, 174, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1010, '4107003', 'Furniture, Fixtures, Fittings and Electrical Appliances-Fans', NULL, NULL, true, 174, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1011, '4107004', 'Furniture, Fixtures, Fittings and Electrical Appliances-Electrical Fittings', NULL, NULL, true, 174, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1012, '4107005', 'Furniture, Fixtures, Fittings and Electrical Appliances-Tables & Chairs', NULL, NULL, true, 174, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1013, '4108000', 'Other Fixed Assets-Other Fixed Assets', NULL, NULL, true, 175, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1014, '4109001', 'Assets under Disposal-Valuable Assets', NULL, NULL, true, 176, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1015, '4109002', 'Assets under Disposal-Scraped Assets', NULL, NULL, true, 176, 'A', 4, false, false, '410', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1016, '4112001', 'Buildings-Office Buildings', NULL, NULL, true, 177, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1017, '4112002', 'Buildings-Commercial Complex', NULL, NULL, true, 177, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1018, '4112003', 'Buildings-Hospitals, Dispensaries & Health Posts', NULL, NULL, true, 177, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1019, '4112004', 'Buildings-Community Halls & Reading Rooms', NULL, NULL, true, 177, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1020, '4112005', 'Buildings-Gust Houses', NULL, NULL, true, 177, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1021, '4112006', 'Buildings-Staff Quarters', NULL, NULL, true, 177, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1022, '4112007', 'Buildings-Public Latrines & Urinals', NULL, NULL, true, 177, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1023, '4113001', 'Roads and Bridges-Concrete Road', NULL, NULL, true, 178, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1024, '4113002', 'Roads and Bridges-Black Topped Roads', NULL, NULL, true, 178, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1025, '4113003', 'Roads and Bridges-Link Roads, Parallel Roads & Slip Roads', NULL, NULL, true, 178, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1026, '4113004', 'Roads and Bridges-Footpaths & Table Drains', NULL, NULL, true, 178, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1027, '4113005', 'Roads and Bridges-Bridges & Culverts', NULL, NULL, true, 178, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1028, '4113006', 'Roads and Bridges-Fly-overs & Over Bridges', NULL, NULL, true, 178, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1029, '4113007', 'Roads and Bridges-Subways & Causeways', NULL, NULL, true, 178, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1030, '4113101', 'Sewerage and Drainage-Underground Drains', NULL, NULL, true, 179, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1031, '4113102', 'Sewerage and Drainage-Open Drains', NULL, NULL, true, 179, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1032, '4113201', 'Waterways-Bore wells', NULL, NULL, true, 180, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1033, '4113202', 'Waterways-Open Wells', NULL, NULL, true, 180, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1034, '4113203', 'Waterways-Reservoirs', NULL, NULL, true, 180, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1035, '4113301', 'Public Lighting-Modern Lighting On Main Roads', NULL, NULL, true, 181, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1036, '4113302', 'Public Lighting-Modern Lighting On Lanes, By- lanes', NULL, NULL, true, 181, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1037, '4114000', 'Plant and Machinery-Plant & Machinery', NULL, NULL, true, 182, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1038, '4115001', 'Vehicles-Ambulance', NULL, NULL, true, 183, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1039, '4115002', 'Vehicles-Buses', NULL, NULL, true, 183, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1040, '4115003', 'Vehicles-Cars & Jeeps', NULL, NULL, true, 183, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1041, '4115004', 'Vehicles-Cranes', NULL, NULL, true, 183, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1042, '4115005', 'Vehicles-Trucks', NULL, NULL, true, 183, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1043, '4115006', 'Vehicles-Tankers', NULL, NULL, true, 183, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1044, '4116001', 'Office and Other Equipments-Air Conditioners', NULL, NULL, true, 184, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1045, '4116002', 'Office and Other Equipments-Computers', NULL, NULL, true, 184, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1046, '4116003', 'Office and Other Equipments-Faxes', NULL, NULL, true, 184, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1047, '4116004', 'Office and Other Equipments-Photocopiers', NULL, NULL, true, 184, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1048, '4116005', 'Office and Other Equipments-Refrigerators', NULL, NULL, true, 184, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1049, '4116006', 'Office and Other Equipments-Network Equipment', NULL, NULL, true, 184, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1050, '4117001', 'Furniture, Fixtures, Fittings and Electrical Appliances-Cabinets & Partitions', NULL, NULL, true, 185, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1051, '4117002', 'Furniture, Fixtures, Fittings and Electrical Appliances-Cupboards', NULL, NULL, true, 185, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1052, '4117003', 'Furniture, Fixtures, Fittings and Electrical Appliances-Fans', NULL, NULL, true, 185, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1053, '4117004', 'Furniture, Fixtures, Fittings and Electrical Appliances-Electrical Fittings', NULL, NULL, true, 185, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1054, '4117005', 'Furniture, Fixtures, Fittings and Electrical Appliances-Tables & Chairs', NULL, NULL, true, 185, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1055, '4118000', 'Other Fixed Assets-Other Fixed Assets', NULL, NULL, true, 186, 'A', 4, false, false, '411', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1056, '4120011', 'General-Land Acquisition', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1057, '4120012', 'General-Garbage Dumping Yards', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1058, '4120013', 'General-Parking Lots', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1059, '4120014', 'General-Major Parks', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1060, '4120015', 'General-Colony Parks', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1061, '4120016', 'General-Traffic Islands/Central Media', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1062, '4120017', 'General-Raising of Nurseries', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1063, '4120018', 'General-Playgrounds/Stadia', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1064, '4120019', 'General-Purchase of Plants/ Translocation of Plants', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1065, '4120021', 'General-Office Buildings', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1066, '4120022', 'General-Markets, Shopping Complexes & Other Remunerative Enterprises', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1067, '4120023', 'General-Community Halls & Reading Rooms', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1068, '4120024', 'General-School Buildings', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1069, '4120025', 'General-Hospitals, Dispensaries, Health Posts', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1070, '4120026', 'General-Public Latrines & Urinals', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1071, '4120027', 'General-Burial Grounds/Crematoria', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1072, '4120031', 'General-Bridges & Culverts', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1073, '4120032', 'General-Fly-Overs', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1074, '4120033', 'General-Rail Over/Under-Bridges', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1075, '4120034', 'General-Subways & Causeways, Foot over Bridges', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1076, '4120041', 'General-Road Development/Upgradation', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1077, '4120042', 'General-Link, Parallel and Slip Road', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1078, '4120043', 'General-Road Widening', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1079, '4120044', 'General-Footpaths and Table Drains', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1080, '4120045', 'General-Junction Improvements', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1081, '4120046', 'General-Station Area Development', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1082, '4120047', 'General-Traffic Signals & Signage', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1083, '4120048', 'General-Local Rail Transit Infrastructure', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1084, '4120051', 'General-Major Strom Water Drains', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1085, '4120052', 'General-Minor Strom Water Drains', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1086, '4120053', 'General-Rainwater Harvesting', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1087, '4120054', 'General-Sewerage Lines', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1088, '4120055', 'General-Sewerage Treatment Plants', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1089, '4120056', 'General-Conservation of Rivers/Lakes', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1090, '4120057', 'General-Construction of Dhobighats', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1091, '4120061', 'General-Modern Lighting on Major Roads', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1092, '4120062', 'General-Modern Lighting in Lanes and Bye- lanes', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1093, '4120071', 'General-Heavy Vehicles', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1094, '4120072', 'General-Light Vehicles', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1095, '4120073', 'General-Other Vehicles', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1096, '4120081', 'General-Office Equipment', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1097, '4120082', 'General-Computers, Servers & Net Work Equipment', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1098, '4120083', 'General-Urban Mapping – GIS', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1099, '4120084', 'General-Hospital Equipment', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1100, '4120085', 'General-Play and Sports Equipment', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1101, '4120086', 'General-Water Fountains', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1102, '4120087', 'General-Dumber Bins/Garbage Dust and Litter Bins', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1103, '4120088', 'General-Machinery and Equipment', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1104, '4120091', 'General-Furniture', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1105, '4120092', 'General-Fixtures and Fittings', NULL, NULL, true, 187, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1106, '4121000', 'Specific Grants-Specific Grants', NULL, NULL, true, 188, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1107, '4122000', 'Special funds-Special funds', NULL, NULL, true, 189, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1108, '4123000', 'Specific Schemes-Specific Schemes', NULL, NULL, true, 190, 'A', 4, false, false, '412', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1109, '4201000', 'Central Government Securities-Central Government Securities', NULL, NULL, true, 191, 'A', 4, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1110, '4202000', 'State Government Securities-State Government Securities', NULL, NULL, true, 192, 'A', 4, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1111, '4203000', 'Debentures and Bonds-Debentures and Bonds', NULL, NULL, true, 193, 'A', 4, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1112, '4204000', 'Preference Shares-Preference Shares', NULL, NULL, true, 194, 'A', 4, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1113, '4205000', 'Equity Shares-Equity Shares', NULL, NULL, true, 195, 'A', 4, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1114, '4206001', 'Units of Mutual Funds-Open Ended Debt Fund', NULL, NULL, true, 196, 'A', 4, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1115, '4206002', 'Units of Mutual Funds-Open Ended Equity Fund', NULL, NULL, true, 196, 'A', 4, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1116, '4208001', 'Other Investments-Fixed Deposits', NULL, NULL, true, 197, 'A', 4, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1117, '4209001', 'Accumulated Provision-Decline in Investment Value', NULL, NULL, true, 198, 'A', 4, false, false, '420', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1118, '4211000', 'Central Government Securities-Central Government Securities', NULL, NULL, true, 199, 'A', 4, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1119, '4212000', 'State Government Securities-State Government Securities', NULL, NULL, true, 200, 'A', 4, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1120, '4213000', 'Debentures and Bonds-Debentures and Bonds', NULL, NULL, true, 201, 'A', 4, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1121, '4214000', 'Preference Shares-Preference Shares', NULL, NULL, true, 202, 'A', 4, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1122, '4215000', 'Equity Shares-Equity Shares', NULL, NULL, true, 203, 'A', 4, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1123, '4216001', 'Units of Mutual Funds-Open Ended Debt Fund', NULL, NULL, true, 204, 'A', 4, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1124, '4216002', 'Units of Mutual Funds-Open Ended Equity Fund', NULL, NULL, true, 204, 'A', 4, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1125, '4218001', 'Other Investments-Fixed Deposits with Banks', NULL, NULL, true, 205, 'A', 4, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1126, '4219001', 'Accumulated Provision-Decline in Investment Value', NULL, NULL, true, 206, 'A', 4, false, false, '421', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1127, '4301001', 'Stores-Engineering Stores', NULL, NULL, true, 208, 'A', 4, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1128, '4301002', 'Stores-Transport Stores', NULL, NULL, true, 208, 'A', 4, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1129, '4301003', 'Stores-Medical Stores', NULL, NULL, true, 208, 'A', 4, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1130, '4301004', 'Stores-Central Stationary Stores', NULL, NULL, true, 208, 'A', 4, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1131, '4302000', 'Loose Tools-Loose Tools', NULL, NULL, true, 209, 'A', 4, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1132, '4308000', 'Others-Others', NULL, NULL, true, 210, 'A', 4, false, false, '430', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1133, '4311001', 'Receivables for Property Taxes-Private Properties', NULL, NULL, true, 211, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1134, '4311002', 'Receivables for Property Taxes-Government Properties', NULL, NULL, true, 211, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1135, '4311003', 'Receivables for Property Taxes-Vacant Lands', NULL, NULL, true, 211, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1136, '4311901', 'Receivable for Other Taxes-Private Properties', NULL, NULL, true, 212, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1137, '4311902', 'Receivable for Other Taxes-Government Properties', NULL, NULL, true, 212, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1138, '4312000', 'Receivables for Cess-Receivables for Cess', NULL, NULL, true, 213, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1139, '4313001', 'Receivable for Fees and User Charges-Water Supply', NULL, NULL, true, 214, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1140, '4313002', 'Receivable for Fees and User Charges-Trade Licence', NULL, NULL, true, 214, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1141, '4314001', 'Receivable from other sources-Rent', NULL, NULL, true, 215, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1142, '4314002', 'Receivable from other sources-Interest Accrued & Due', NULL, NULL, true, 215, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1143, '4314003', 'Receivable from other sources-Interest Accrued but not due', NULL, NULL, true, 215, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1144, '4314004', 'Receivable from other sources-Interest Receivable On Employee Loans', NULL, NULL, true, 215, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1145, '4314005', 'Receivable from other sources-Other Rent', NULL, NULL, true, 215, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1146, '4315001', 'Receivable from Government-State Government', NULL, NULL, true, 216, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1147, '4315002', 'Receivable from Government-Central Government', NULL, NULL, true, 216, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1148, '4315003', 'Receivable from Government-Government Departments', NULL, NULL, true, 216, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1149, '4315004', 'Receivable from Government-Public Sector Undertakings', NULL, NULL, true, 216, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1150, '4318001', 'Receivables control accounts-Property Taxes', NULL, NULL, true, 217, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1151, '4319100', 'State Govt Cess/ levies in Property Taxes - Control account-State Govt Cess/ levies in Property Taxes - Control account', NULL, NULL, true, 218, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1152, '4319200', 'State Govt Cess/ levies in Water Taxes - Control account-State Govt Cess/ levies in Water Taxes - Control account', NULL, NULL, true, 219, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1153, '4319900', 'State Govt Cess/ levies in Other Taxes - Control account-State Govt Cess/ levies in Other Taxes - Control account', NULL, NULL, true, 220, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1154, '4321000', 'Provision for outstanding Property Taxes-Provision for outstanding Property Taxes', NULL, NULL, true, 221, 'A', 4, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1155, '4321100', 'Provision for outstanding Water Taxes-Provision for outstanding Water Taxes', NULL, NULL, true, 222, 'A', 4, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1156, '4321200', 'Provision for outstanding Other Taxes-Provision for outstanding Other Taxes', NULL, NULL, true, 223, 'A', 4, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1157, '4322000', 'Provision for outstanding Cess-Provision for outstanding Cess', NULL, NULL, true, 224, 'A', 4, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1158, '4323000', 'Provision for outstanding Fees and User Charges-Provision for outstanding Fees & User Charges', NULL, NULL, true, 225, 'A', 4, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1159, '4324000', 'Provision for outstanding other receivable-Provision for outstanding other receivable', NULL, NULL, true, 226, 'A', 4, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1160, '4329100', 'State Govt Cess/ levies in Property Taxes - Provision account-State Govt Cess/ levies in Property Taxes - Provision account', NULL, NULL, true, 229, 'A', 4, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1161, '4329200', 'State Govt Cess/ levies in Water Taxes - Provision account-State Govt Cess/ levies in Water Taxes - Provision account', NULL, NULL, true, 230, 'A', 4, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1162, '4329900', 'State Govt Cess/ levies in Other Taxes - Provision account-State Govt Cess/ levies in Other Taxes - Provision account', NULL, NULL, true, 231, 'A', 4, false, false, '432', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1163, '4401000', 'Establishment-Establishment', NULL, NULL, true, 232, 'A', 4, false, false, '440', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1164, '4402001', 'Administration-Rent, Rates Taxes', NULL, NULL, true, 233, 'A', 4, false, false, '440', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1165, '4402002', 'Administration-Insurance', NULL, NULL, true, 233, 'A', 4, false, false, '440', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1166, '4403001', 'Operations and Maintenance-Annual Maintenance Contracts', NULL, NULL, true, 234, 'A', 4, false, false, '440', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1167, '4501001', 'Cash-Cash On Hand', 4, NULL, true, 235, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1168, '4501002', 'Cash-Cash In Transit', 121, NULL, true, 235, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1169, '4501051', 'Cash-Cheques-in-hand', 5, NULL, true, 235, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1170, '4501091', 'Cash-Inter Bank Account Fund Transfer', NULL, NULL, true, 235, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1171, '4502101', 'Nationalised Banks-State Bank of India', NULL, NULL, true, 237, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1172, '4502102', 'Nationalised Banks-State Bank of Hyderabad', NULL, NULL, true, 237, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1173, '4502103', 'Nationalised Banks-Andhra Bank', NULL, NULL, true, 237, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1174, '4502104', 'Nationalised Banks-Canara Bank', NULL, NULL, true, 237, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1175, '4502201', 'Other Scheduled Banks-ICICI Bank', NULL, NULL, true, 238, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1176, '4502202', 'Other Scheduled Banks-IDBI Bank', NULL, NULL, true, 238, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1177, '4502203', 'Other Scheduled Banks-HDFC Bank', NULL, NULL, true, 238, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1178, '4502300', 'Scheduled Co-operative Banks-Scheduled Co-operative Banks', NULL, NULL, true, 239, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1179, '4502400', 'Post Office-Post Office', NULL, NULL, true, 240, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1180, '4504101', 'Nationalised Banks-State Bank Of India', NULL, NULL, true, 241, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1181, '4504102', 'Nationalised Banks-State Bank Of Hyderabad', NULL, NULL, true, 241, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1182, '4504103', 'Nationalised Banks-Andhra Bank', NULL, NULL, true, 241, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1183, '4504104', 'Nationalised Banks-Canara Bank', NULL, NULL, true, 241, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1184, '4504201', 'Other Scheduled Banks-ICICI Bank', NULL, NULL, true, 242, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1185, '4504202', 'Other Scheduled Banks-IDBI Bank', NULL, NULL, true, 242, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1186, '4504203', 'Other Scheduled Banks-HDFC Bank', NULL, NULL, true, 242, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1187, '4504300', 'Scheduled Co-operative Banks-Scheduled Co-operative Banks', NULL, NULL, true, 243, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1188, '4504400', 'Post Office-Post Office', NULL, NULL, true, 244, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1189, '4506101', 'Nationalised Banks-State Bank Of India', NULL, NULL, true, 245, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1190, '4506102', 'Nationalised Banks-State Bank Of Hyderabad', NULL, NULL, true, 245, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1191, '4506200', 'Other Scheduled Banks-Other Scheduled Banks', NULL, NULL, true, 246, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1192, '4506300', 'Scheduled Co-operative Banks-Scheduled Co-operative Banks', NULL, NULL, true, 247, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1193, '4506400', 'Post Office-Post Office', NULL, NULL, true, 248, 'A', 4, false, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1194, '4601001', 'Loans and advances to employees-House Building Advance', NULL, NULL, true, 249, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1195, '4601002', 'Loans and advances to employees-Conveyance Advance', NULL, NULL, true, 249, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1196, '4601003', 'Loans and advances to employees-Computer Advance', NULL, NULL, true, 249, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1197, '4601004', 'Loans and advances to employees-Festival Advance', NULL, NULL, true, 249, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1198, '4601005', 'Loans and advances to employees-Education Advance', NULL, NULL, true, 249, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1199, '4601006', 'Loans and advances to employees-Miscellaneous Advance', NULL, NULL, true, 249, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1200, '4602000', 'Employee Provident Fund Loans-Employee Provident Fund Loans', NULL, NULL, true, 250, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1201, '4603000', 'Loans to Others-Loans to Others', NULL, NULL, true, 251, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1202, '4604001', 'Advance to Suppliers and contractors-Suppliers', NULL, NULL, true, 252, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1203, '4604002', 'Advance to Suppliers and contractors-Contractors', NULL, NULL, true, 252, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1204, '4604003', 'Advance to Suppliers and contractors-Expenses', NULL, NULL, true, 252, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1205, '4604004', 'Advance to Suppliers and contractors-Materials Issued to Contractors', NULL, NULL, true, 252, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1206, '4605001', 'Advance to others-Employees for works', NULL, NULL, true, 253, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1207, '4605002', 'Advance to others-Travel Advance', NULL, NULL, true, 253, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1208, '4605003', 'Advance to others-Imprest', NULL, NULL, true, 253, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1209, '4605004', 'Advance to others-Executing agency for projects', NULL, NULL, true, 253, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1210, '4606001', 'Deposits with external Agencies-Telephone', NULL, NULL, true, 254, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1211, '4606002', 'Deposits with external Agencies-Electricity', NULL, NULL, true, 254, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1212, '4606003', 'Deposits with external Agencies-Petrol Pumps', NULL, NULL, true, 254, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1213, '4608001', 'Other Current Assets-HP Installments receivable', NULL, NULL, true, 255, 'A', 4, false, false, '460', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1214, '4611000', 'Loans to Others-Loans to Others', NULL, NULL, true, 256, 'A', 4, false, false, '461', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1215, '4612000', 'Advances-Advances', NULL, NULL, true, 257, 'A', 4, false, false, '461', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1216, '4613000', 'Deposits-Deposits', NULL, NULL, true, 258, 'A', 4, false, false, '461', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1217, '4701001', 'Deposit Works – Expenditure-Civil Works', NULL, NULL, true, 259, 'A', 4, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1218, '4701002', 'Deposit Works – Expenditure-Electric Works', NULL, NULL, true, 259, 'A', 4, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1219, '4701003', 'Deposit Works – Expenditure-Other Works', NULL, NULL, true, 259, 'A', 4, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1220, '4702000', 'Inter Unit Accounts-Inter Unit Accounts', NULL, NULL, true, 260, 'A', 4, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1221, '4702051', 'Inter Unit Accounts-Inter Fund Transfer', NULL, NULL, true, 260, 'A', 4, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1222, '4703000', 'Interest Control Payable-Interest Control Payable', NULL, NULL, true, 261, 'A', 4, false, false, '470', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1223, '4801001', 'Loan Issue Expenses-Deferred Revenue Expenses', NULL, NULL, true, 262, 'A', 4, false, false, '480', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1224, '4802000', 'Discount on Issue of loans-Discount on Issue of loans', NULL, NULL, true, 263, 'A', 4, false, false, '480', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1225, '4803000', 'Others-Others', NULL, NULL, true, 264, 'A', 4, false, false, '480', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1226, '4311004', 'Receivables for Property Taxes- Arrears', NULL, NULL, true, 211, 'A', 4, false, false, '431', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1227, '4504204', 'Allahabad UP Gramin Bank-Main branch-000000000001', NULL, 'Allahabad UP Gramin Bank-Main branch-000000000001', true, 242, 'A', 4, true, false, '450', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_chartofaccount (id, glcode, name, purposeid, description, isactiveforposting, parentid, type, classification, functionrequired, budgetcheckrequired, majorcode, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (1232, '3109000', 'Excess of Income over Expenditure', 7, NULL, true, 111, 'L', 4, false, false, '310', 1, '2017-05-08', NULL, 1, 0, 'default'); - -SELECT setval('seq_egf_chartofaccount',(select max(id)+1 from egf_chartofaccount)); diff --git a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150203__bank_data.sql b/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150203__bank_data.sql deleted file mode 100644 index 0a114d15e60..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150203__bank_data.sql +++ /dev/null @@ -1,85 +0,0 @@ - -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (1, '1', 'Allahabad UP Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (2, '2', 'Andhra Pradesh Grameena Vikas Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (3, '3', 'Andhra Pragathi Grameena Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (4, '4', 'Arunachal Pradesh Rural Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (5, '5', 'Aryavart Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (6, '6', 'Assam Gramin Vikash Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (7, '7', 'Baitarani Gramya Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (8, '8', 'Ballia –Etawah Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (9, '9', 'Bangiya Gramin Vikash Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (10, '10', 'Baroda Gujarat Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (11, '11', 'Baroda Rajasthan Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (12, '12', 'Baroda Uttar Pradesh Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (13, '13', 'Bihar Kshetriya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (14, '14', 'Cauvery Kalpatharu Grameena Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (15, '15', 'Chaitanya Godavari Grameena Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (16, '16', 'Chhattisgarh Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (17, '17', 'Chikmagalur-Kodagu Grameena Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (18, '18', 'Deccan Grameena Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (19, '19', 'Dena Gujarat Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (20, '20', 'Durg-Rajnandgaon Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (21, '21', 'Ellaquai Dehati Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (22, '22', 'Gurgaon Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (23, '23', 'Hadoti Kshetriya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (24, '24', 'Haryana Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (25, '25', 'Himachal Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (26, '26', 'Jaipur Thar Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (27, '27', 'Jhabua Dhar Kshetriya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (28, '28', 'Jharkhand Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (29, '29', 'Kalinga Gramya Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (30, '30', 'Karnataka Vikas Grameena Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (31, '31', 'Kashi Gomti Samyut Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (32, '32', 'Kerala Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (33, '33', 'Krishna Grameena Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (34, '34', 'Kshetriya Kisan Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (35, '35', 'Langpi Dehangi Rural Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (36, '36', 'Madhumalti Building Gupte Marg', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (37, '37', 'Madhya Bharat Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (38, '38', 'Madhya Bihar Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (39, '39', 'Mahakaushal Kshetriya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (40, '40', 'Maharashtra Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (41, '41', 'Malwa Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (42, '42', 'Manipur Rural Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (43, '43', 'Marwar Ganganagar Bikaner Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (44, '44', 'Meghalaya Rural Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (45, '45', 'Mewar Anchalik Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (46, '46', 'Mizoram Rural Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (47, '47', 'Nagaland Rural Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (48, '48', 'Uttrakhand Gramin Bank[1]', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (49, '49', 'Narmada Malwa Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (50, '50', 'Neelachal Gramya Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (51, '51', 'Pallavan Grama Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (52, '52', 'Pandyan Grama Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (53, '53', 'Parvatiya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (54, '54', 'Paschim Banga Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (55, '55', 'Pragathi Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (56, '56', 'Prathama Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (57, '57', 'Puduvai Bharathiar Grama Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (58, '58', 'Pune District Central Cooperative Bank Ltd.', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (59, '59', 'Punjab Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (60, '60', 'Purvanchal Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (61, '61', 'Rajasthan Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (62, '62', 'Rewa-Sidhi Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (63, '63', 'Rushikulya Gramya Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (64, '64', 'Samastipur Kshetriya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (65, '65', 'Saptagiri Grameena Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (66, '66', 'Sarva UP Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (67, '67', 'Satpura Narmada Kshetriya', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (68, '68', 'Saurashtra Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (69, '69', 'Sharda Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (70, '70', 'Shreyas Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (71, '71', 'Surguja Kshetriya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (72, '72', 'Sutlej Kshetriya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (73, '73', 'Tripura Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (74, '74', 'Utkal Gramya Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (75, '75', 'Uttar Banga Kshetriya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (76, '76', 'Uttar Bihar Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (77, '77', 'Vananchal Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (78, '78', 'Vidharbha Kshetriya Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (79, '79', 'Visveshvaraya Grameena Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_bank (id, code, name, description, active, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (80, '80', 'Wainganga Krishna Gramin Bank', NULL, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); - - - -SELECT setval('seq_egf_bank',(select max(id)+1 from egf_bank)); diff --git a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150217__bankbranch_data.sql b/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150217__bankbranch_data.sql deleted file mode 100644 index 15a57e4f972..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150217__bankbranch_data.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO egf_bankbranch (id, bankid, code, name, address, address2, city, state, pincode, phone, fax, contactperson, active, description, micr, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (1, 1, '001', 'Main branch', 'Srikakulam', NULL, NULL, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, 0, 'default'); - -SELECT setval('seq_egf_bankbranch',(select max(id)+1 from egf_bankbranch)); diff --git a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150224__bankaccount_data.sql b/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150224__bankaccount_data.sql deleted file mode 100644 index b604b41c03d..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150224__bankaccount_data.sql +++ /dev/null @@ -1,4 +0,0 @@ -INSERT INTO egf_bankaccount (id, branchid, glcodeid, fundid, accountnumber, accounttype, description, active, payto, type, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (1, 1, 1223, 1, '000000000001', 'OTHER SCHEDULED BANKS', NULL, true, NULL, 'RECEIPTS_PAYMENTS', 1, '2017-05-08 00:00:00', 1, '2017-05-08 00:00:00', 0, 'default'); - - -SELECT setval('seq_egf_bankaccount',(select max(id)+1 from egf_bankaccount)); diff --git a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150230__accountdetail_type_data.sql b/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150230__accountdetail_type_data.sql deleted file mode 100644 index c0a55accba3..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150230__accountdetail_type_data.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO egf_accountdetailtype (id, name, description, tablename, active, fully_qualified_name, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (1, 'Employee', 'Employee', 'eg_employee', true, 'org.egov.eis.entity.Employee', 1, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountdetailtype (id, name, description, tablename, active, fully_qualified_name, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (2, 'Telephone', 'Telephone', 'accountEntityMaster', true, 'org.egov.masters.model.AccountEntity', 1, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountdetailtype (id, name, description, tablename, active, fully_qualified_name, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (3, 'DrawingOfficer', 'Drawing Officer', 'EG_DRAWINGOFFICER', true, 'org.egov.eis.entity.DrawingOfficer', 1, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountdetailtype (id, name, description, tablename, active, fully_qualified_name, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (4, 'contractor', 'contractor', 'egw_contractor', true, 'org.egov.works.models.masters.Contractor', 1, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountdetailtype (id, name, description, tablename, active, fully_qualified_name, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (5, 'PROJECTCODE', 'PROJECTCODE', 'egw_projectcode', true, 'org.egov.works.models.estimate.ProjectCode', 1, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountdetailtype (id, name, description, tablename, active, fully_qualified_name, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (11, 'Supplier', 'Supplier', 'Supplier', true, 'org.egov.commons.Relation', 1, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountdetailtype (id, name, description, tablename, active, fully_qualified_name, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (12, 'DEPOSITCODE', 'DEPOSITCODE', 'egw_depositcode', true, 'org.egov.works.models.masters.DepositCode', 1, '2017-05-08', NULL, NULL, NULL, 'default'); -INSERT INTO egf_accountdetailtype (id, name, description, tablename, active, fully_qualified_name, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (13, 'lawyer', 'Standing Counsel', 'eglc_advocate_master', true, 'org.egov.lcms.masters.entity.AdvocateMaster', 1, '2017-05-08', NULL, '2017-05-08', 0, 'default'); - -SELECT setval('seq_egf_accountdetailtype',(select max(id)+1 from egf_accountdetailtype)); diff --git a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150234__fund_data.sql b/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150234__fund_data.sql deleted file mode 100644 index ef825ade82d..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150234__fund_data.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO egf_fund (id, name, code, identifier, level, parentid, isparent, active, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (1, 'Municipal Fund', '01', '1', 1, NULL, false, true, NULL, '2017-05-08', NULL, NULL, 0, 'default'); -INSERT INTO egf_fund (id, name, code, identifier, level, parentid, isparent, active, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (2, 'Capital Fund', '02', '2', 1, NULL, false, false, NULL, '2017-05-08', NULL, NULL, 0, 'default'); -INSERT INTO egf_fund (id, name, code, identifier, level, parentid, isparent, active, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (3, 'Elementary Education Fund', '03', '3', 1, NULL, false, false, NULL, '2017-05-08', NULL, NULL, 0, 'default'); -INSERT INTO egf_fund (id, name, code, identifier, level, parentid, isparent, active, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (4, 'Earmarked Funds', '04', '4', 1, NULL, false, false, NULL, '2017-05-08', NULL, NULL, 0, 'default'); - - -SELECT setval('seq_egf_fund',(select max(id)+1 from egf_fund)); diff --git a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150239__function_data.sql b/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150239__function_data.sql deleted file mode 100644 index 1ba576cf525..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/dev/V20170629150239__function_data.sql +++ /dev/null @@ -1,131 +0,0 @@ - -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (1, 'GENERAL ADMINISTRATION', '00', 0, true, false, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (2, 'PUBLIC WORKS', '20', 0, true, false, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (3, 'REVENUE', '90', 0, true, false, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (4, 'PLANNING AND REGULATIONS', '10', 0, true, false, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (5, 'CIVIC AMENITIES', '50', 0, true, false, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (6, 'URBAN FORESTRY', '60', 0, true, false, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (7, 'SANITATION AND SOLID WASTE MANAGEMENT', '40', 0, true, false, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (8, 'HEALTH', '30', 0, true, false, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (9, 'OTHER SERVICES', '80', 0, true, false, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (10, 'GENERAL ADMINISTRATION:Council (Municipal Body)', '0001', 0, true, false, 1, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (11, 'GENERAL ADMINISTRATION:Administration', '0002', 0, true, false, 1, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (12, 'GENERAL ADMINISTRATION:Accounts Central Cell (Finance, Accounts, Audit)', '0003', 0, true, false, 1, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (13, 'GENERAL ADMINISTRATION:Land & Estate (Estate)', '0006', 0, true, false, 1, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (14, 'GENERAL ADMINISTRATION:Stationery Stores (Stores & Purchase)', '0007', 0, true, false, 1, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (15, 'GENERAL ADMINISTRATION:CHIEF ENGINEERS Office', '0009', 0, true, false, 1, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (16, 'PLANNING AND REGULATIONS:Land Development and Planning Permits (City and Town Planning)', '1011', 0, true, false, 4, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (17, 'PLANNING AND REGULATIONS:Building Permits (Building Regulation)', '1012', 0, true, false, 4, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (18, 'PLANNING AND REGULATIONS:Enforcement Cell (Encroachment Removal)', '1014', 0, true, false, 4, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (19, 'PUBLIC WORKS:Roads and Pavement', '2021', 0, true, false, 2, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (20, 'PUBLIC WORKS:Bridges and Flyovers', '2022', 0, true, false, 2, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (21, 'PUBLIC WORKS:Street Lighting', '2024', 0, true, false, 2, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (22, 'PUBLIC WORKS:Storm Water Drains', '2025', 0, true, false, 2, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (23, 'PUBLIC WORKS:Buildings', '2028', 0, true, false, 2, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (24, 'HEALTH:Public Health', '3031', 0, true, false, 8, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (25, 'HEALTH:Epidemic / Prevention Control', '3032', 0, true, false, 8, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (26, 'HEALTH:Family Welfare (Family Planning)', '3033', 0, true, false, 8, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (27, 'HEALTH:Primary Health Care', '3034', 0, true, false, 8, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (28, 'HEALTH:Hospital Services', '3035', 0, true, false, 8, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (29, 'HEALTH:Burial and Burning Grounds (Burial and Cremations)', '3036', 0, true, false, 8, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (30, 'HEALTH:Birth and Death Registration (Vital Statistics)', '3037', 0, true, false, 8, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (31, 'HEALTH:Prevention of Food Adulteration', '3038', 0, true, false, 8, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (32, 'SANITATION AND SOLID WASTE MANAGEMENT:Solid Waste Management', '4041', 0, true, false, 7, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (33, 'SANITATION AND SOLID WASTE MANAGEMENT:Public Convenience', '4042', 0, true, false, 7, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (34, 'SANITATION AND SOLID WASTE MANAGEMENT:Veterinary Services', '4043', 0, true, false, 7, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (35, 'SANITATION AND SOLID WASTE MANAGEMENT:Slaughter Houses', '4045', 0, true, false, 7, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (36, 'SANITATION AND SOLID WASTE MANAGEMENT:Lethal Chamber', '4046', 0, true, false, 7, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (37, 'CIVIC AMENITIES:Community / Marriage Centres', '5055', 0, true, false, 5, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (38, 'CIVIC AMENITIES:Municipal Markets', '5058', 0, true, false, 5, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (39, 'CIVIC AMENITIES:Dhobikhana', '5059', 0, true, false, 5, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (40, 'URBAN FORESTRY:Parks, Gardens', '6061', 0, true, false, 6, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (41, 'URBAN FORESTRY:Play Grounds', '6062', 0, true, false, 6, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (42, 'URBAN FORESTRY:Stadium', '6067', 0, true, false, 6, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (43, 'URBAN FORESTRY:Swimming Pool', '6068', 0, true, false, 6, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (44, 'OTHER SERVICES:Education', '8082', 0, true, false, 9, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (45, 'OTHER SERVICES:Relief Centres', '8085', 0, true, false, 9, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (46, 'REVENUE:Revenue (Property Taxes)', '9091', 0, true, false, 3, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (47, 'Public Relation Office', '000202', 1, false, true, 11, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (48, 'Legal Cell', '000204', 1, false, true, 11, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (49, 'Accounts Central Cell (Finance, Accounts, Audit)', '000300', 1, false, true, 12, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (50, 'Land Development and Planning Permits (City and Town Planning)', '101100', 1, false, true, 16, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (51, 'Building Permits (Building Regulation)', '101200', 1, false, true, 17, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (52, 'Direction (Works Dept)', '202101', 1, false, true, 19, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (53, 'Capital Works-Elec', '202402', 1, false, true, 21, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (54, 'Communicable Diseases Hospital', '303201', 1, false, true, 25, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (55, 'Vaccination', '303206', 1, false, true, 25, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (56, 'Meternity Child Welfare', '303401', 1, false, true, 27, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (57, 'Prevention of Food Adulteration', '303800', 1, false, true, 31, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (58, 'Stadium', '606700', 1, false, true, 42, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (59, 'EDP Cell', '000205', 1, false, true, 11, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (60, 'Land & Estate (Estate)', '000600', 1, false, true, 13, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (61, 'Central Roller Station', '202104', 1, false, true, 19, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (62, 'Direction (Zones)', '202106', 1, false, true, 19, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (63, 'Anti Mosquito Operation', '303202', 1, false, true, 25, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (64, 'Urban Malaria Scheme', '303203', 1, false, true, 25, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (65, 'Burial and Burning Grounds (Burial and Cremations)', '303600', 1, false, true, 29, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (66, 'Parks and Gardens', '606100', 1, false, true, 40, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (67, 'Swimming Pool', '606800', 1, false, true, 43, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (68, 'Revenue (Property Taxes)', '909100', 1, false, false, 46, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (69, 'National Fileria Control programme', '303204', 1, false, true, 25, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (70, 'Solid Waste Management (Zones)', '404103', 1, false, true, 32, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (71, 'General Stores', '404106', 1, false, true, 32, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (72, 'Vehicle Maintenance', '404108', 1, false, true, 32, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (73, 'Community / Marriage Centres', '505500', 1, false, true, 37, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (74, 'Non-Plan Secondary School', '808201', 1, false, true, 44, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (75, 'Industrial Training Institute', '808202', 1, false, true, 44, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (76, 'Relief Centres', '808500', 1, false, true, 45, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (77, 'General Department', '000201', 1, false, true, 11, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (78, 'Taxation Appeals Committee', '000206', 1, false, true, 11, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (79, 'Traffic Engineering', '202105', 1, false, true, 19, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (80, 'Electrical Workshop', '202404', 1, false, true, 21, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (81, 'Electrical Stores', '202405', 1, false, true, 21, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (82, 'IPPV', '303402', 1, false, true, 27, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (83, 'T.B. Clinic', '303502', 1, false, true, 28, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (84, 'Slaughter Houses', '404500', 1, false, true, 35, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (85, 'Dhobikhana', '505900', 1, false, true, 39, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (86, 'Play Grounds', '606200', 1, false, true, 41, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (87, 'Primary School Age Group 6-11', '808206', 1, false, true, 44, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (88, 'Council (Municipal Body)', '000100', 1, false, true, 10, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (89, 'Vigilance', '000203', 1, false, true, 11, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (90, 'Printing Press', '000207', 1, false, true, 11, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (91, 'Enforcement Cell (Encroachment Removal)', '101400', 1, false, true, 18, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (92, 'Central Asphalt Plant', '202103', 1, false, true, 19, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (93, 'Sub-Station', '202403', 1, false, true, 21, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (94, 'Storm Water Drains', '202500', 1, false, true, 22, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (95, 'Direction (Heatlh Dept)', '303101', 1, false, true, 24, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (96, 'Medical Stores', '303205', 1, false, true, 25, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (97, 'Sanitation', '303207', 1, false, true, 25, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (99, 'Public Convenience', '404200', 1, false, true, 33, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (100, 'Health Programme (School)', '808204', 1, false, true, 44, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (101, 'CHIEF ENGINEERS Office', '000900', 1, false, false, 15, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (102, 'Capital Works-Works', '202102', 1, false, true, 19, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (103, 'Family Welfare (Family Planning)', '303300', 1, false, true, 26, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (104, 'Birth and Death Registration (Vital Statistics)', '303700', 1, false, true, 30, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (105, 'Direction (M.E. Department)', '404101', 1, false, true, 32, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (106, 'Lethal Chamber', '404600', 1, false, true, 36, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (107, 'Municipal Markets', '505800', 1, false, true, 38, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (108, 'Non-Plan Primary & Middle School', '808205', 1, false, true, 44, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (109, 'Primary School Age Group 11-14', '808207', 1, false, true, 44, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (110, 'Roads and Building Maintenance', '202107', 1, false, true, 19, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (111, 'Out Reach Services', '303403', 1, false, true, 27, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (112, 'Solid Waste Management Department', '404102', 1, false, true, 32, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (113, 'Veterinary Services(HQ)', '404302', 1, false, true, 34, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (114, 'Community College', '808203', 1, false, true, 44, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (115, 'Stationery Stores (Stores & Purchase)', '000700', 1, false, true, 14, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (116, 'Bus Route Roads', '202108', 1, false, true, 19, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (117, 'Bridges and Flyovers', '202200', 1, false, true, 20, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (118, 'Direction (Electircal Department)', '202401', 1, false, true, 21, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (119, 'Street Lighting Maintenance', '202406', 1, false, true, 21, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (120, 'Buildings', '202800', 1, false, true, 23, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (121, 'Dispensaries', '303501', 1, false, true, 28, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (123, 'General Workshop', '404107', 1, false, true, 32, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (124, 'Veterinary Services(Zones)', '404301', 1, false, true, 34, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (125, 'Revenue(H.Q)', '909101', 1, false, true, 46, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (126, 'Revenue(ZONES)', '909102', 1, false, true, 46, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (127, 'CHIEF ENGINEERS Office', '000208', 1, false, true, 11, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (129, 'Direction(Regional Office)', '101000', 0, false, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (130, 'CHIEF ENGINEERS OFFICE (S.W.D. AND BUILDINGS)', '000210', 0, false, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_function (id, name, code, level, isparent, active, parentid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) VALUES (131, 'CHIEF ENGINEERS OFFICE (SPECIAL PROJECTS)', '000209', 0, false, true, NULL, NULL, NULL, NULL, NULL, 0, 'default'); - -SELECT setval('seq_egf_function',(select max(id)+1 from egf_function)); diff --git a/business-services/egf-master/src/main/resources/db/migration/dev/V20170925112307__financialyear_data.sql b/business-services/egf-master/src/main/resources/db/migration/dev/V20170925112307__financialyear_data.sql deleted file mode 100644 index af77d16d9f2..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/dev/V20170925112307__financialyear_data.sql +++ /dev/null @@ -1,4 +0,0 @@ -insert into egf_financialyear (id,finyearrange,startingdate,endingdate,active,isactiveforposting,createdby,createddate,tenantid) values(nextval('seq_egf_financialyear'),'2016-17','01-Apr-2016','31-Mar-2017',true,true,73,current_date,'default'); -insert into egf_financialyear (id,finyearrange,startingdate,endingdate,active,isactiveforposting,createdby,createddate,tenantid) values(nextval('seq_egf_financialyear'),'2015-16','01-Apr-2015','31-Mar-2016',true,true,73,current_date,'default'); -insert into egf_financialyear (id,finyearrange,startingdate,endingdate,active,isactiveforposting,createdby,createddate,tenantid) values(nextval('seq_egf_financialyear'),'2017-18','01-Apr-2017','31-Mar-2018',true,true,73,current_date,'default'); -insert into egf_financialyear (id,finyearrange,startingdate,endingdate,active,isactiveforposting,createdby,createddate,tenantid) values(nextval('seq_egf_financialyear'),'2018-19','01-Apr-2018','31-Mar-2019',true,false,73,current_date,'default'); diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185629__egf_Bank_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185629__egf_Bank_ddl.sql deleted file mode 100644 index 3c804356ecf..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185629__egf_Bank_ddl.sql +++ /dev/null @@ -1,16 +0,0 @@ - -Create table egf_bank( - id bigint, - code varchar(50) NOT NULL, - name varchar(100) NOT NULL, - description varchar(250), - active boolean NOT NULL, - type varchar(50) NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_bank add constraint pk_egf_bank primary key (id); -create sequence seq_egf_bank; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185630__egf_BankBranch_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185630__egf_BankBranch_ddl.sql deleted file mode 100644 index 7fac8fb7a83..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185630__egf_BankBranch_ddl.sql +++ /dev/null @@ -1,26 +0,0 @@ - -Create table egf_bankbranch( - id bigint, - bankid bigint NOT NULL, - code varchar(50) NOT NULL, - name varchar(50) NOT NULL, - address varchar(50) NOT NULL, - address2 varchar(50), - city varchar(50), - state varchar(50), - pincode varchar(50), - phone varchar(15), - fax varchar(15), - contactPerson varchar(50), - active boolean NOT NULL, - description varchar(256), - micr varchar(50), - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_bankbranch add constraint pk_egf_bankbranch primary key (id); -alter table egf_bankbranch add constraint fk_egf_bankbranch_bankid FOREIGN KEY (bankid) REFERENCES egf_bank(id); -create sequence seq_egf_bankbranch; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185633__egf_FinancialYear_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185633__egf_FinancialYear_ddl.sql deleted file mode 100644 index 7e55bb3eab2..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185633__egf_FinancialYear_ddl.sql +++ /dev/null @@ -1,18 +0,0 @@ - -Create table egf_financialyear( - id bigint, - FinancialYear varchar(25), - startingDate date NOT NULL, - endingDate date NOT NULL, - active boolean NOT NULL, - isActiveForPosting boolean NOT NULL, - isClosed boolean, - transferClosingBalance boolean, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_financialyear add constraint pk_egf_financialyear primary key (id); -create sequence seq_egf_financialyear; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185634__egf_FiscalPeriod_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185634__egf_FiscalPeriod_ddl.sql deleted file mode 100644 index aef1fe56711..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185634__egf_FiscalPeriod_ddl.sql +++ /dev/null @@ -1,19 +0,0 @@ - -Create table egf_fiscalperiod( - id bigint, - name varchar(25) NOT NULL, - FinancialYearid bigint NOT NULL, - startingDate date NOT NULL, - endingDate date NOT NULL, - active boolean NOT NULL, - isActiveForPosting boolean NOT NULL, - isClosed boolean, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_fiscalperiod add constraint pk_egf_fiscalperiod primary key (id); -alter table egf_fiscalperiod add constraint fk_egf_fiscalperiod_FinancialYearid FOREIGN KEY (FinancialYearid) REFERENCES egf_financialyear(id); -create sequence seq_egf_fiscalperiod; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185635__egf_Function_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185635__egf_Function_ddl.sql deleted file mode 100644 index 50fc6faa946..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185635__egf_Function_ddl.sql +++ /dev/null @@ -1,18 +0,0 @@ - -Create table egf_function( - id bigint, - name varchar(128) NOT NULL, - code varchar(16) NOT NULL, - level smallint NOT NULL, - active boolean NOT NULL, - isParent boolean NOT NULL, - parentId bigint , - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_function add constraint pk_egf_function primary key (id); -alter table egf_function add constraint fk_egf_function_parentId FOREIGN KEY (parentId) REFERENCES egf_function(id); -create sequence seq_egf_function; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185636__egf_Functionary_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185636__egf_Functionary_ddl.sql deleted file mode 100644 index 0453952e33d..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185636__egf_Functionary_ddl.sql +++ /dev/null @@ -1,14 +0,0 @@ - -Create table egf_functionary( - id bigint, - code varchar(16) NOT NULL, - name varchar(256) NOT NULL, - active boolean NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_functionary add constraint pk_egf_functionary primary key (id); -create sequence seq_egf_functionary; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185637__egf_Fund_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185637__egf_Fund_ddl.sql deleted file mode 100644 index 1b628401c26..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185637__egf_Fund_ddl.sql +++ /dev/null @@ -1,19 +0,0 @@ - -Create table egf_fund( - id bigint, - name varchar(50) NOT NULL, - code varchar(50) NOT NULL, - identifier varchar(1) NOT NULL, - level bigint NOT NULL, - parentid bigint , - isParent boolean, - active boolean NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_fund add constraint pk_egf_fund primary key (id); -alter table egf_fund add constraint fk_egf_fund_parentid FOREIGN KEY (parentid) REFERENCES egf_fund(id); -create sequence seq_egf_fund; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185638__egf_Fundsource_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185638__egf_Fundsource_ddl.sql deleted file mode 100644 index 640c81984f8..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185638__egf_Fundsource_ddl.sql +++ /dev/null @@ -1,19 +0,0 @@ - -Create table egf_fundsource( - id bigint, - code varchar(25) NOT NULL, - name varchar(25) NOT NULL, - type varchar(25), - parentid bigint , - llevel numeric (13,2), - active boolean NOT NULL, - isParent boolean, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_fundsource add constraint pk_egf_fundsource primary key (id); -alter table egf_fundsource add constraint fk_egf_fundsource_parentid FOREIGN KEY (parentid) REFERENCES egf_fundsource(id); -create sequence seq_egf_fundsource; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185639__egf_Scheme_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185639__egf_Scheme_ddl.sql deleted file mode 100644 index bba6ae7a42d..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185639__egf_Scheme_ddl.sql +++ /dev/null @@ -1,20 +0,0 @@ - -Create table egf_scheme( - id bigint, - fundId bigint , - code varchar(25), - name varchar(25), - validFrom date NOT NULL, - validTo date NOT NULL, - active boolean NOT NULL, - description varchar(256), - boundary bigint, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_scheme add constraint pk_egf_scheme primary key (id); -alter table egf_scheme add constraint fk_egf_scheme_fundId FOREIGN KEY (fundId) REFERENCES egf_fund(id); -create sequence seq_egf_scheme; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185640__egf_SubScheme_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185640__egf_SubScheme_ddl.sql deleted file mode 100644 index fcff0ac5b7f..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185640__egf_SubScheme_ddl.sql +++ /dev/null @@ -1,18 +0,0 @@ - -Create table egf_subscheme( - id bigint, - scheme bigint NOT NULL, - code varchar(50) NOT NULL, - name varchar(50) NOT NULL, - validFrom date NOT NULL, - validTo date NOT NULL, - active boolean NOT NULL, - departmentId bigint, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_subscheme add constraint pk_egf_subscheme primary key (id); -create sequence seq_egf_subscheme; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185641__egf_Supplier_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185641__egf_Supplier_ddl.sql deleted file mode 100644 index 9c46493b51e..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185641__egf_Supplier_ddl.sql +++ /dev/null @@ -1,25 +0,0 @@ - -Create table egf_supplier( - id bigint, - code varchar(50) NOT NULL, - name varchar(50) NOT NULL, - address varchar(300), - mobile varchar(10), - email varchar(25), - description varchar(250), - active boolean NOT NULL, - panNo varchar(10), - tinNo varchar(20), - registationNo varchar(25), - bankAccount varchar(25), - ifscCode varchar(12), - bank bigint , - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_supplier add constraint pk_egf_supplier primary key (id); -alter table egf_supplier add constraint fk_egf_supplier_bank FOREIGN KEY (bank) REFERENCES egf_bank(id); -create sequence seq_egf_supplier; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185642__egf_AccountDetailType_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185642__egf_AccountDetailType_ddl.sql deleted file mode 100644 index ee0c42504b9..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185642__egf_AccountDetailType_ddl.sql +++ /dev/null @@ -1,18 +0,0 @@ - -Create table egf_accountdetailtype( - id bigint, - name varchar(50) NOT NULL, - description varchar(50) NOT NULL, - tableName varchar(25), - columnName varchar(25), - attributeName varchar(50), - active boolean NOT NULL, - FULLY_QUALIFIED_NAME varchar(250), - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_accountdetailtype add constraint pk_egf_accountdetailtype primary key (id); -create sequence seq_egf_accountdetailtype; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185643__egf_AccountDetailKey_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185643__egf_AccountDetailKey_ddl.sql deleted file mode 100644 index 42367a6e1fa..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185643__egf_AccountDetailKey_ddl.sql +++ /dev/null @@ -1,16 +0,0 @@ - -Create table egf_accountdetailkey( - id bigint, - groupId smallint, - name varchar(128), - key smallint, - detailTypeId bigint NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_accountdetailkey add constraint pk_egf_accountdetailkey primary key (id); -alter table egf_accountdetailkey add constraint fk_egf_accountdetailkey_detailTypeId FOREIGN KEY (detailTypeId) REFERENCES egf_accountdetailtype(id); -create sequence seq_egf_accountdetailkey; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185644__egf_AccountEntity_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185644__egf_AccountEntity_ddl.sql deleted file mode 100644 index 7c2a560deac..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185644__egf_AccountEntity_ddl.sql +++ /dev/null @@ -1,17 +0,0 @@ - -Create table egf_accountentitymaster( - id bigint, - detailtypeid bigint NOT NULL, - code varchar(25) NOT NULL, - name varchar(350) NOT NULL, - active boolean NOT NULL, - description varchar(256), - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_accountentitymaster add constraint pk_egf_accountentitymaster primary key (id); -alter table egf_accountentitymaster add constraint fk_egf_accountentitymaster_detailtypeid FOREIGN KEY (detailtypeid) REFERENCES egf_accountdetailtype(id); -create sequence seq_egf_accountentitymaster; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185645__egf_AccountCodePurpose_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185645__egf_AccountCodePurpose_ddl.sql deleted file mode 100644 index f093c8a027a..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185645__egf_AccountCodePurpose_ddl.sql +++ /dev/null @@ -1,12 +0,0 @@ - -Create table egf_accountcodepurpose( - id bigint, - name varchar(256) NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_accountcodepurpose add constraint pk_egf_accountcodepurpose primary key (id); -create sequence seq_egf_accountcodepurpose; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185646__egf_ChartOfAccount_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185646__egf_ChartOfAccount_ddl.sql deleted file mode 100644 index c38b2c35377..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185646__egf_ChartOfAccount_ddl.sql +++ /dev/null @@ -1,24 +0,0 @@ - -Create table egf_chartofaccount( - id bigint, - glcode varchar(16) NOT NULL, - name varchar(128) NOT NULL, - purposeId bigint , - desciption varchar(256), - isActiveForPosting boolean NOT NULL, - parentId bigint, - type varchar(1) NOT NULL, - classification bigint NOT NULL, - functionRequired boolean NOT NULL, - budgetCheckRequired boolean NOT NULL, - majorCode varchar(16), - isSubLedger boolean, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_chartofaccount add constraint pk_egf_chartofaccount primary key (id); -alter table egf_chartofaccount add constraint fk_egf_chartofaccount_purposeId FOREIGN KEY (purposeId) REFERENCES egf_accountcodepurpose(id); -create sequence seq_egf_chartofaccount; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185647__egf_ChartOfAccountDetail_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185647__egf_ChartOfAccountDetail_ddl.sql deleted file mode 100644 index 823f0b41edb..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185647__egf_ChartOfAccountDetail_ddl.sql +++ /dev/null @@ -1,15 +0,0 @@ - -Create table egf_chartofaccountdetail( - id bigint, - glcodeid bigint NOT NULL, - detailtypeid bigint NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_chartofaccountdetail add constraint pk_egf_chartofaccountdetail primary key (id); -alter table egf_chartofaccountdetail add constraint fk_egf_chartofaccountdetail_glcodeid FOREIGN KEY (glcodeid) REFERENCES egf_chartofaccount(id); -alter table egf_chartofaccountdetail add constraint fk_egf_chartofaccountdetail_detailtypeid FOREIGN KEY (detailtypeid) REFERENCES egf_accountdetailtype(id); -create sequence seq_egf_chartofaccountdetail; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185648__egf_BudgetGroup_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185648__egf_BudgetGroup_ddl.sql deleted file mode 100644 index 9935570e971..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185648__egf_BudgetGroup_ddl.sql +++ /dev/null @@ -1,22 +0,0 @@ - -Create table EGF_BUDGETGROUP( - id bigint, - name varchar(250), - description varchar(250), - majorcode bigint , - hgfdsa bigint , - mincode bigint , - accountType varchar(19), - budgetingType varchar(6), - active boolean, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table EGF_BUDGETGROUP add constraint pk_EGF_BUDGETGROUP primary key (id); -alter table EGF_BUDGETGROUP add constraint fk_EGF_BUDGETGROUP_majorcode FOREIGN KEY (majorcode) REFERENCES egf_chartofaccount(id); -alter table EGF_BUDGETGROUP add constraint fk_EGF_BUDGETGROUP_hgfdsa FOREIGN KEY (hgfdsa) REFERENCES egf_chartofaccount(id); -alter table EGF_BUDGETGROUP add constraint fk_EGF_BUDGETGROUP_mincode FOREIGN KEY (mincode) REFERENCES egf_chartofaccount(id); -create sequence seq_EGF_BUDGETGROUP; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185649__egf_BankAccount_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170227185649__egf_BankAccount_ddl.sql deleted file mode 100644 index db23c42ebd3..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170227185649__egf_BankAccount_ddl.sql +++ /dev/null @@ -1,23 +0,0 @@ - -Create table egf_bankaccount( - id bigint, - branchid bigint , - glcodeid bigint , - fundid bigint , - accountNumber varchar(25) NOT NULL, - accountType varchar(20), - description varchar(256), - active boolean NOT NULL, - payTo varchar(100), - type varchar(17) NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint -); -alter table egf_bankaccount add constraint pk_egf_bankaccount primary key (id); -alter table egf_bankaccount add constraint fk_egf_bankaccount_branchid FOREIGN KEY (branchid) REFERENCES egf_bankbranch(id); -alter table egf_bankaccount add constraint fk_egf_bankaccount_glcodeid FOREIGN KEY (glcodeid) REFERENCES egf_chartofaccount(id); -alter table egf_bankaccount add constraint fk_egf_bankaccount_fundid FOREIGN KEY (fundid) REFERENCES egf_fund(id); -create sequence seq_egf_bankaccount; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170313145649__egf_masters_add_tenantid.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170313145649__egf_masters_add_tenantid.sql deleted file mode 100644 index a31922235a6..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170313145649__egf_masters_add_tenantid.sql +++ /dev/null @@ -1,39 +0,0 @@ -ALTER TABLE egf_accountcodepurpose ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_accountdetailkey ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_accountdetailtype ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_bank ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_bankaccount ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_bankbranch ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_budgetgroup ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_chartofaccount ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_chartofaccountdetail ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_financialyear ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_fiscalperiod ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_function ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_functionary ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_fund ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_fundsource ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_scheme ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_subscheme ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_supplier ADD COLUMN tenantId CHARACTER VARYING(250) NULL; -ALTER TABLE egf_accountentitymaster ADD COLUMN tenantId CHARACTER VARYING(250) NULL; - ---rollback ALTER TABLE egf_accountcodepurpose DROP COLUMN tenantId; ---rollback ALTER TABLE egf_accountdetailkey DROP COLUMN tenantId; ---rollback ALTER TABLE egf_accountdetailtype DROP COLUMN tenantId; ---rollback ALTER TABLE egf_bank DROP COLUMN tenantId; ---rollback ALTER TABLE egf_bankaccount DROP COLUMN tenantId; ---rollback ALTER TABLE egf_bankbranch DROP COLUMN tenantId; ---rollback ALTER TABLE egf_budgetgroup DROP COLUMN tenantId; ---rollback ALTER TABLE egf_chartofaccount DROP COLUMN tenantId; ---rollback ALTER TABLE egf_chartofaccountdetail DROP COLUMN tenantId; ---rollback ALTER TABLE egf_financialyear DROP COLUMN tenantId; ---rollback ALTER TABLE egf_fiscalperiod DROP COLUMN tenantId; ---rollback ALTER TABLE egf_function DROP COLUMN tenantId; ---rollback ALTER TABLE egf_functionary DROP COLUMN tenantId; ---rollback ALTER TABLE egf_fund DROP COLUMN tenantId; ---rollback ALTER TABLE egf_fundsource DROP COLUMN tenantId; ---rollback ALTER TABLE egf_scheme DROP COLUMN tenantId; ---rollback ALTER TABLE egf_subscheme DROP COLUMN tenantId; ---rollback ALTER TABLE egf_supplier DROP COLUMN tenantId; ---rollback ALTER TABLE egf_accountentitymaster DROP COLUMN tenantId; \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170313185649__egf_bank_drop_type_notnull_constraint.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170313185649__egf_bank_drop_type_notnull_constraint.sql deleted file mode 100644 index 4119fccf74f..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170313185649__egf_bank_drop_type_notnull_constraint.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE egf_bank ALTER COLUMN type DROP NOT NULL; - ---rollback ALTER TABLE egf_bank ALTER COLUMN type set NOT NULL; \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170314145649__egf_masters_chartofaccount_rename_column.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170314145649__egf_masters_chartofaccount_rename_column.sql deleted file mode 100644 index 1b28970847b..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170314145649__egf_masters_chartofaccount_rename_column.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE egf_chartofaccount RENAME COLUMN desciption TO description; - ---rollback ALTER TABLE egf_chartofaccount RENAME COLUMN description TO desciption; \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170328145649__egf_masters_accountdetailtype_drop_column.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170328145649__egf_masters_accountdetailtype_drop_column.sql deleted file mode 100644 index 960839987e2..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170328145649__egf_masters_accountdetailtype_drop_column.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE egf_accountdetailtype DROP COLUMN columnname RESTRICT; -ALTER TABLE egf_accountdetailtype DROP COLUMN attributename RESTRICT; -ALTER TABLE egf_bankaccount ALTER COLUMN accounttype TYPE varchar(150); - ---rollback ALTER TABLE egf_accountdetailtype add COLUMN columnname varchar(50); ---rollback ALTER TABLE egf_accountdetailtype add COLUMN attributename varchar(50); ---rollback ALTER TABLE egf_bankaccount ALTER COLUMN accounttype TYPE varchar(20); \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170418105602__create_composit_primary_key.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170418105602__create_composit_primary_key.sql deleted file mode 100644 index 1841353c3aa..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170418105602__create_composit_primary_key.sql +++ /dev/null @@ -1,22 +0,0 @@ -ALTER TABLE egf_accountcodepurpose DROP CONSTRAINT pk_egf_accountcodepurpose cascade; -ALTER TABLE egf_accountdetailtype DROP CONSTRAINT pk_egf_accountdetailtype cascade; -ALTER TABLE egf_bankaccount DROP CONSTRAINT pk_egf_bankaccount cascade; -ALTER TABLE egf_bankbranch DROP CONSTRAINT pk_egf_bankbranch cascade; -ALTER TABLE egf_bank DROP CONSTRAINT pk_egf_bank cascade; -ALTER TABLE egf_chartofaccount DROP CONSTRAINT pk_egf_chartofaccount cascade; -ALTER TABLE egf_chartofaccountdetail DROP CONSTRAINT pk_egf_chartofaccountdetail cascade; -ALTER TABLE egf_functionary DROP CONSTRAINT pk_egf_functionary cascade; -ALTER TABLE egf_function DROP CONSTRAINT pk_egf_function cascade; -ALTER TABLE egf_fund DROP CONSTRAINT pk_egf_fund cascade; - -ALTER TABLE egf_accountcodepurpose ADD primary key (id, tenantid); -ALTER TABLE egf_accountdetailtype ADD primary key (id, tenantid); -ALTER TABLE egf_bankaccount ADD primary key (id, tenantid); -ALTER TABLE egf_bankbranch ADD primary key (id, tenantid); -ALTER TABLE egf_bank ADD primary key (id, tenantid); -ALTER TABLE egf_chartofaccount ADD primary key (id, tenantid); -ALTER TABLE egf_chartofaccountdetail ADD primary key (id, tenantid); -ALTER TABLE egf_functionary ADD primary key (id, tenantid); -ALTER TABLE egf_function ADD primary key (id, tenantid); -ALTER TABLE egf_fund ADD primary key (id, tenantid); - diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170510172206__egf_accountdetailkey_cleanup.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170510172206__egf_accountdetailkey_cleanup.sql deleted file mode 100644 index b7581589229..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170510172206__egf_accountdetailkey_cleanup.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE egf_accountdetailkey DROP CONSTRAINT pk_egf_accountdetailkey cascade; -ALTER TABLE egf_accountdetailkey ADD primary key (id, tenantid); -ALTER TABLE egf_accountdetailkey alter column key type bigint; -ALTER TABLE egf_accountdetailkey drop column groupid; -ALTER TABLE egf_accountdetailkey drop column name; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170524150531__egf_budgetgroup_rename_maxcode.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170524150531__egf_budgetgroup_rename_maxcode.sql deleted file mode 100644 index f3c193f1d11..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170524150531__egf_budgetgroup_rename_maxcode.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egf_budgetgroup RENAME hgfdsa TO maxcode; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170524164710__egf_configuration_status_configurationvalues.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170524164710__egf_configuration_status_configurationvalues.sql deleted file mode 100644 index 3a5ca0ede92..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170524164710__egf_configuration_status_configurationvalues.sql +++ /dev/null @@ -1,64 +0,0 @@ -CREATE TABLE egeis_egfStatus ( - id BIGINT NOT NULL, - objectName CHARACTER VARYING(50) NOT NULL, - code CHARACTER VARYING(20) NOT NULL, - description CHARACTER VARYING(250) NOT NULL, - tenantId CHARACTER VARYING(250) NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint, - - CONSTRAINT pk_egeis_egfStatus PRIMARY KEY (id) -); - -CREATE SEQUENCE seq_egeis_egfStatus - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -CREATE TABLE egeis_egfConfiguration ( - id BIGINT NOT NULL, - keyName CHARACTER VARYING(50) NOT NULL, - description CHARACTER VARYING(250), - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint, - tenantId CHARACTER VARYING(250) NOT NULL, - - CONSTRAINT pk_egeis_egfConfiguration PRIMARY KEY (Id) -); - -CREATE SEQUENCE seq_egeis_egfConfiguration - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -CREATE TABLE egeis_egfConfigurationValues ( - id BIGINT NOT NULL, - keyId BIGINT NOT NULL, - value CHARACTER VARYING(1000) NOT NULL, - effectiveFrom DATE NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint, - tenantId CHARACTER VARYING(250) NOT NULL, - - CONSTRAINT pk_egeis_egfConfigurationValues PRIMARY KEY (Id) -); - -CREATE SEQUENCE seq_egeis_egfConfigurationValues - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170525110921__egf_status_objectname_to_moduletype.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170525110921__egf_status_objectname_to_moduletype.sql deleted file mode 100644 index a4f5a8284a7..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170525110921__egf_status_objectname_to_moduletype.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egeis_egfStatus RENAME objectName TO moduleType; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170529150208__egf_fund_alter_table.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170529150208__egf_fund_alter_table.sql deleted file mode 100644 index 6a4edb01d73..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170529150208__egf_fund_alter_table.sql +++ /dev/null @@ -1 +0,0 @@ -alter table egf_fund alter column identifier DROP NOT NULL ; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170711155751__egf_alter_columnname_type.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170711155751__egf_alter_columnname_type.sql deleted file mode 100644 index db2267d3a8e..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170711155751__egf_alter_columnname_type.sql +++ /dev/null @@ -1,202 +0,0 @@ -ALTER TABLE egf_accountdetailkey RENAME detailtypeid TO accountdetailtypeid; -ALTER TABLE egf_accountdetailtype RENAME fully_qualified_name TO fullyqualifiedname; -ALTER TABLE egf_accountentitymaster RENAME TO egf_accountentity; -ALTER TABLE egf_accountentity RENAME detailtypeid TO accountdetailtypeid; -ALTER TABLE egf_bankaccount RENAME branchid TO bankbranchid; -ALTER TABLE egf_bankaccount RENAME glcodeid TO chartofaccountid; -ALTER TABLE egf_bankaccount RENAME type TO typeid; -ALTER TABLE egf_budgetgroup RENAME accounttype TO accounttypeid; -ALTER TABLE egf_budgetgroup RENAME budgetingtype TO budgetingtypeid; -ALTER TABLE egf_chartofaccount RENAME purposeid TO accountcodepurposeid; -ALTER TABLE egf_chartofaccountdetail RENAME glcodeid TO chartofaccountid; -ALTER TABLE egf_chartofaccountdetail RENAME detailtypeid TO accountdetailtypeid; -ALTER TABLE egf_financialyear RENAME financialyear TO finyearrange; -ALTER TABLE egf_subscheme RENAME scheme TO schemeid; -ALTER TABLE egf_supplier RENAME bankaccount TO bankaccountid; -ALTER TABLE egf_supplier RENAME bank TO bankid; -ALTER TABLE egf_accountcodepurpose ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_accountcodepurpose ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_accountcodepurpose ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_accountdetailkey ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_accountdetailkey ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_accountdetailkey ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_accountdetailkey ALTER COLUMN accountdetailtypeid TYPE varchar(256); -ALTER TABLE egf_accountdetailtype ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_accountdetailtype ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_accountdetailtype ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_accountentity ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_accountentity ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_accountentity ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_accountentity ALTER COLUMN accountdetailtypeid TYPE varchar(256); -ALTER TABLE egf_bankaccount ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_bankaccount ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_bankaccount ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_bankaccount ALTER COLUMN bankbranchid TYPE varchar(256); -ALTER TABLE egf_bankaccount ALTER COLUMN chartofaccountid TYPE varchar(256); -ALTER TABLE egf_bankaccount ALTER COLUMN fundid TYPE varchar(256); -ALTER TABLE egf_bankbranch ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_bankbranch ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_bankbranch ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_budgetgroup ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_budgetgroup ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_budgetgroup ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_budgetgroup ALTER COLUMN accounttypeid TYPE varchar(256); -ALTER TABLE egf_chartofaccountdetail ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_chartofaccountdetail ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_chartofaccountdetail ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_chartofaccountdetail ALTER COLUMN chartofaccountid TYPE varchar(256); -ALTER TABLE egf_chartofaccountdetail ALTER COLUMN accountdetailtypeid TYPE varchar(256); -ALTER TABLE egf_chartofaccount ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_chartofaccount ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_chartofaccount ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_chartofaccount ALTER COLUMN accountcodepurposeid TYPE varchar(256); -ALTER TABLE egf_chartofaccount ALTER COLUMN parentid TYPE varchar(256); -ALTER TABLE egf_fiscalperiod ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_fiscalperiod ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_fiscalperiod ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_fiscalperiod DROP CONSTRAINT fk_egf_fiscalperiod_FinancialYearid; -ALTER TABLE egf_fiscalperiod ALTER COLUMN financialyearid TYPE varchar(256); -ALTER TABLE egf_financialyear ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_financialyear ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_financialyear ALTER COLUMN lastmodifiedby TYPE varchar(256); -alter table egf_fiscalperiod add constraint fk_egf_fiscalperiod_FinancialYearid FOREIGN KEY (FinancialYearid) REFERENCES egf_financialyear(id); -ALTER TABLE egf_functionary ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_functionary ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_functionary ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_function ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_function ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_function ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_function ALTER COLUMN parentid TYPE varchar(256); -ALTER TABLE egf_fund ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_fund ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_fund ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_fund ALTER COLUMN parentid TYPE varchar(256); -ALTER TABLE egf_fundsource ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_fundsource ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_fundsource DROP CONSTRAINT fk_egf_fundsource_parentid; -ALTER TABLE egf_fundsource ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_fundsource ALTER COLUMN parentid TYPE varchar(256); -alter table egf_fundsource add constraint fk_egf_fundsource_parentid FOREIGN KEY (parentid) REFERENCES egf_fundsource(id); -ALTER TABLE egf_scheme ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_scheme ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_scheme ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_scheme ALTER COLUMN fundid TYPE varchar(256); -ALTER TABLE egf_scheme ALTER COLUMN boundary TYPE varchar(256); -ALTER TABLE egf_subscheme ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_subscheme ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_subscheme ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_subscheme ALTER COLUMN schemeid TYPE varchar(256); -ALTER TABLE egf_supplier ALTER COLUMN id TYPE varchar(256); -ALTER TABLE egf_supplier ALTER COLUMN createdby TYPE varchar(256); -ALTER TABLE egf_supplier ALTER COLUMN lastmodifiedby TYPE varchar(256); -ALTER TABLE egf_supplier ALTER COLUMN bankaccountid TYPE varchar(256); -ALTER TABLE egf_supplier ALTER COLUMN bankid TYPE varchar(256); - -alter table egf_bank alter column id TYPE varchar(256); -alter table egf_bank alter column createdby TYPE varchar(256); -alter table egf_bank alter column lastmodifiedby TYPE varchar(256); -alter table egf_bankbranch alter column bankid TYPE varchar(250); -ALTER TABLE egf_bankaccount RENAME COLUMN typeid TO type; -ALTER TABLE egf_budgetgroup RENAME maxcode TO maxcodeid ; -ALTER TABLE egf_budgetgroup alter maxcodeid type varchar(256) ; -ALTER TABLE egf_budgetgroup RENAME mincode TO mincodeid ; -ALTER TABLE egf_budgetgroup alter mincodeid type varchar(256) ; -ALTER TABLE egf_budgetgroup RENAME majorcode TO majorcodeid ; -ALTER TABLE egf_budgetgroup alter majorcodeid type varchar(256) ; -ALTER TABLE egf_accountdetailkey ALTER COLUMN key TYPE varchar(256); - - - ---rollback ALTER TABLE egf_fiscalperiod DROP CONSTRAINT fk_egf_fiscalperiod_FinancialYearid; ---rollback ALTER TABLE egf_fundsource DROP CONSTRAINT fk_egf_fundsource_parentid; ---rollback ALTER TABLE egf_supplier ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccount RENAME accountcodepurposeid TO purposeid; ---rollback ALTER TABLE egf_supplier ALTER COLUMN bankaccountid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_supplier ALTER COLUMN bankid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_supplier ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_supplier ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_subscheme ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_subscheme ALTER COLUMN schemeid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_subscheme ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_subscheme ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_scheme ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_scheme ALTER COLUMN fundid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_scheme ALTER COLUMN boundary TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_scheme ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_scheme ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fundsource ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fundsource ALTER COLUMN parentid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fundsource ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fundsource ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fund ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fund ALTER COLUMN parentid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fund ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fund ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_function ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_function ALTER COLUMN parentid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_function ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_function ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_functionary ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_functionary ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_functionary ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fiscalperiod ALTER COLUMN financialyearid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fiscalperiod ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fiscalperiod ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_fiscalperiod ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_financialyear ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_financialyear ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_financialyear ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccount ALTER COLUMN purposeid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccount ALTER COLUMN parentid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccount ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccount ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccount ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccountdetail ALTER COLUMN chartofaccountid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccountdetail ALTER COLUMN accountdetailtypeid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccountdetail ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccountdetail ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_chartofaccountdetail ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_budgetgroup ALTER COLUMN accounttypeid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_budgetgroup ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_budgetgroup ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_budgetgroup ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_bankbranch ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_bankbranch ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_bankbranch ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_bankaccount ALTER COLUMN bankbranchid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_bankaccount ALTER COLUMN chartofaccountid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_bankaccount ALTER COLUMN fundid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_bankaccount ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_bankaccount ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_bankaccount ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountentity ALTER COLUMN accountdetailtypeid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountentity ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountentity ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountentity ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountdetailtype ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountdetailtype ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountdetailtype ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountdetailkey ALTER COLUMN accountdetailtypeid TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountdetailkey ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountdetailkey ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountdetailkey ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountcodepurpose ALTER COLUMN id TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountcodepurpose ALTER COLUMN createdby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_accountcodepurpose ALTER COLUMN lastmodifiedby TYPE bigint USING id::bigint; ---rollback ALTER TABLE egf_supplier RENAME bankaccountid TO bankaccount; ---rollback ALTER TABLE egf_supplier RENAME bankid TO bank; ---rollback ALTER TABLE egf_subscheme RENAME schemeid TO scheme; ---rollback ALTER TABLE egf_financialyear RENAME finyearrange TO financialyear; ---rollback ALTER TABLE egf_chartofaccountdetail RENAME chartofaccountid TO glcodeid; ---rollback ALTER TABLE egf_chartofaccountdetail RENAME accountdetailtypeid TO detailtypeid; ---rollback ALTER TABLE egf_budgetgroup RENAME accounttypeid TO accounttype; ---rollback ALTER TABLE egf_budgetgroup RENAME budgetingtypeid TO budgetingtype; ---rollback ALTER TABLE egf_bankaccount RENAME bankbranchid TO branchid; ---rollback ALTER TABLE egf_bankaccount RENAME chartofaccountid TO glcodeid; ---rollback ALTER TABLE egf_bankaccount RENAME typeid TO type; ---rollback ALTER TABLE egf_accountdetailtype RENAME fullyqualifiedname TO fully_qualified_name; ---rollback ALTER TABLE egf_accountdetailkey RENAME accountdetailtypeid TO detailtypeid; ---rollback ALTER TABLE egf_accountentity RENAME TO egf_accountentitymaster; ---rollback ALTER TABLE egf_accountentitymaster RENAME accountdetailtypeid TO detailtypeid; ---rollback alter table egf_fundsource add constraint fk_egf_fundsource_parentid FOREIGN KEY (parentid) REFERENCES egf_fundsource(id); ---rollback alter table egf_fiscalperiod add constraint fk_egf_fiscalperiod_FinancialYearid FOREIGN KEY (FinancialYearid) REFERENCES egf_financialyear(id); diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170726175703__egf_FinancialStatus_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170726175703__egf_FinancialStatus_ddl.sql deleted file mode 100644 index 0faf5ac05e0..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170726175703__egf_FinancialStatus_ddl.sql +++ /dev/null @@ -1,18 +0,0 @@ - drop table if exists egeis_egfStatus ; - drop sequence if exists seq_egeis_egfStatus ; - - create table egf_financialstatus( - id varchar(50) NOT NULL, - moduleType varchar(50) NOT NULL, - code varchar(20) NOT NULL, - name varchar(20) NOT NULL, - description varchar(250) NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint, - tenantId varchar(250) -); -alter table egf_financialstatus add constraint pk_egf_financialstatus primary key (name,tenantId); -alter table egf_financialstatus add constraint unique_egf_financialstatus unique (code,tenantId); \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170801150208__egf_master_alter_table.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170801150208__egf_master_alter_table.sql deleted file mode 100644 index 6688577c2c1..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170801150208__egf_master_alter_table.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE egf_budgetgroup RENAME accounttypeid TO accounttype; -ALTER TABLE egf_budgetgroup RENAME budgetingtypeid TO budgetingtype; \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170804130050__egf_master_function_alterddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170804130050__egf_master_function_alterddl.sql deleted file mode 100644 index f4fe0c52197..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170804130050__egf_master_function_alterddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egf_function DROP COLUMN isparent; \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170804165325__egf_financialconfiguration_and_values_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170804165325__egf_financialconfiguration_and_values_ddl.sql deleted file mode 100644 index 8712a3a0eea..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170804165325__egf_financialconfiguration_and_values_ddl.sql +++ /dev/null @@ -1,49 +0,0 @@ - drop table if exists egeis_egfConfiguration ; - drop sequence if exists seq_egeis_egfConfiguration ; - drop table if exists egeis_egfConfigurationValues ; - drop sequence if exists seq_egeis_egfConfigurationValues ; - -CREATE TABLE egf_financialconfiguration ( - id CHARACTER VARYING(250) NOT NULL, - keyName CHARACTER VARYING(50) NOT NULL, - description CHARACTER VARYING(250), - module CHARACTER VARYING(50), - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint, - tenantId CHARACTER VARYING(250) NOT NULL, - - CONSTRAINT pk_egf_financialconfiguration PRIMARY KEY (Id) -); - -CREATE SEQUENCE seq_egf_financialconfiguration - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -CREATE TABLE egf_financialconfigurationvalues ( - id CHARACTER VARYING(250) NOT NULL, - keyId CHARACTER VARYING(250) NOT NULL, - value CHARACTER VARYING(1000) NOT NULL, - effectiveFrom DATE NOT NULL, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint, - tenantId CHARACTER VARYING(250) NOT NULL, - - CONSTRAINT pk_egf_financialconfigurationvalues PRIMARY KEY (Id) -); - -CREATE SEQUENCE seq_egf_financialconfigurationvalues - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170804165424__egf_master_fund_alterddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170804165424__egf_master_fund_alterddl.sql deleted file mode 100644 index 95a188ba577..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170804165424__egf_master_fund_alterddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE egf_fund DROP COLUMN isparent; \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170809154850__egf_financialconfiguration_and_values_alter_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170809154850__egf_financialconfiguration_and_values_alter_ddl.sql deleted file mode 100644 index c8cb6344706..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170809154850__egf_financialconfiguration_and_values_alter_ddl.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE egf_financialconfiguration RENAME COLUMN keyName TO name; - -ALTER TABLE egf_financialconfigurationvalues RENAME COLUMN keyId TO financialConfigurationId; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170810195820__egf_recovery_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170810195820__egf_recovery_ddl.sql deleted file mode 100644 index a80f0d41848..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170810195820__egf_recovery_ddl.sql +++ /dev/null @@ -1,24 +0,0 @@ - -Create table egf_recovery( - id VARCHAR(256), - chartofaccountid varchar(256) NOT NULL, - type varchar(20), - flat double precision, - active boolean NOT NULL, - remitted varchar(100) not null, - name VARCHAR(50) not null, - code VARCHAR(50) not null, - ifsccode VARCHAR(16), - mode VARCHAR(1), - remittancemode VARCHAR(1), - accountnumber VARCHAR(32), - percentage double precision, - createdby bigint, - createddate timestamp without time zone, - lastmodifiedby bigint, - lastmodifieddate timestamp without time zone, - version bigint default 0, - tenantid VARCHAR(256) not null -); -alter table egf_recovery add constraint pk_egf_recovery primary key (id,tenantid); -create sequence seq_egf_recovery; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170907150253__egf_vouchersubtype_drop_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170907150253__egf_vouchersubtype_drop_ddl.sql deleted file mode 100644 index c1cf77c9816..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170907150253__egf_vouchersubtype_drop_ddl.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP TABLE IF EXISTS egf_vouchersubtype; - -DROP SEQUENCE IF EXISTS seq_egf_vouchersubtype; diff --git a/business-services/egf-master/src/main/resources/db/migration/main/V20170920175048__egf_deletetransaction_ddl.sql b/business-services/egf-master/src/main/resources/db/migration/main/V20170920175048__egf_deletetransaction_ddl.sql deleted file mode 100644 index 69440762b9f..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/main/V20170920175048__egf_deletetransaction_ddl.sql +++ /dev/null @@ -1,3 +0,0 @@ -create table egf_deletedtxn (id varchar,tablename varchar,identifier varchar,tenantid varchar,reason varchar,data json, -updateddate date -); \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/qa/V20171106132517__financialyear_data b/business-services/egf-master/src/main/resources/db/migration/qa/V20171106132517__financialyear_data deleted file mode 100644 index 713a0051189..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/qa/V20171106132517__financialyear_data +++ /dev/null @@ -1,6 +0,0 @@ -delete from egf_financialyear; -insert into egf_financialyear (id,finyearrange,startingdate,endingdate,active,isactiveforposting,createdby,createddate,tenantid) values(nextval('seq_egf_financialyear'),'2019-20','01-Apr-2019','31-Mar-2020',true,false,1,current_date,'default'); -insert into egf_financialyear (id,finyearrange,startingdate,endingdate,active,isactiveforposting,createdby,createddate,tenantid) values(nextval('seq_egf_financialyear'),'2020-21','01-Apr-2020','31-Mar-2021',true,false,1,current_date,'default'); -insert into egf_financialyear (id,finyearrange,startingdate,endingdate,active,isactiveforposting,createdby,createddate,tenantid) values(nextval('seq_egf_financialyear'),'2021-22','01-Apr-2021','31-Mar-2022',true,false,1,current_date,'default'); -insert into egf_financialyear (id,finyearrange,startingdate,endingdate,active,isactiveforposting,createdby,createddate,tenantid) values(nextval('seq_egf_financialyear'),'2022-23','01-Apr-2022','31-Mar-2023',true,false,1,current_date,'default'); -insert into egf_financialyear (id,finyearrange,startingdate,endingdate,active,isactiveforposting,createdby,createddate,tenantid) values(nextval('seq_egf_financialyear'),'2023-24','01-Apr-2023','31-Mar-2024',true,false,1,current_date,'default'); diff --git a/business-services/egf-master/src/main/resources/db/migration/seed/V20170629150132__accountcode_purpose_data.sql b/business-services/egf-master/src/main/resources/db/migration/seed/V20170629150132__accountcode_purpose_data.sql deleted file mode 100644 index 1a6b0dad5df..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/seed/V20170629150132__accountcode_purpose_data.sql +++ /dev/null @@ -1,36 +0,0 @@ - -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (4, 'Cash In Hand', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (5, 'Cheque In Hand', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (7, 'ExcessIE', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (8, ' Payable to Other Funds', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (10, 'Contractor Deductions', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (11, 'Fixed Assets', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (12, 'Bank Account Codes', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (15, 'Accumulated Depreciation', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (16, 'CWIP Account code', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (17, 'Depreciation Expense Account', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (18, 'Revaluation Reserve Account', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (21, 'Fixed Assets Written off', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (22, 'Inter-Unit Transfer Account', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (26, 'Creditors-Contractor Payable', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (27, 'Creditors-Supplier Payable', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (28, 'Contigency Bill Code', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (29, 'Security Deposit', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (30, 'Bank Charges', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (31, 'Salary Payable', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (34, 'Pension Payable', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (35, 'Supplier Advance Account', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (36, 'Wages Payable', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (37, 'Material Clearing Account', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (38, 'Scrap Suspense Account', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (60, 'Overhead_account codes', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (61, 'DEPOSIT:OTHER WORKS', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (62, 'REPAIRS AND MAINTENANCE', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (95, 'RETENTION_MONEY', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (96, 'LandEstate_Rent_purpose', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (103, 'Pension Payable Code', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (105, 'CONTRACTOR_ADVANCE_ACCOUNTCODE', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (120, 'BPA Deposit CWIP Account Code', NULL, NULL, NULL, NULL, 0, 'default'); -INSERT INTO egf_accountcodepurpose (id, name, createdby, createddate, lastmodifieddate, lastmodifiedby, version, tenantid) VALUES (121, 'Cash In Transit', NULL, NULL, NULL, NULL, 0, 'default'); - -SELECT setval('seq_egf_accountcodepurpose',(select max(id)+1 from egf_accountcodepurpose)); diff --git a/business-services/egf-master/src/main/resources/db/migration/seed/V20170721155751__egf_configuration_fetch_data_from.sql b/business-services/egf-master/src/main/resources/db/migration/seed/V20170721155751__egf_configuration_fetch_data_from.sql deleted file mode 100644 index 56cf963063a..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/seed/V20170721155751__egf_configuration_fetch_data_from.sql +++ /dev/null @@ -1,15 +0,0 @@ -INSERT INTO egeis_egfconfiguration( - id, keyname, description, createdby, createddate, lastmodifiedby, - lastmodifieddate, version, tenantid) - VALUES (NEXTVAL('seq_egeis_egfconfiguration'), 'FETCH_DATA_FROM', 'Data to be fetched from es or db', 1, now(), 1, - now(), 0, 'default'); - - -INSERT INTO egeis_egfconfigurationvalues( - id, keyid, value, effectivefrom, createdby, createddate, lastmodifiedby, - lastmodifieddate, version, tenantid) - VALUES (NEXTVAL('seq_egeis_egfconfigurationvalues'), (select id from egeis_egfconfiguration where keyname='FETCH_DATA_FROM'), 'db', now(), 1, now(), - 1, now(), 0,'default'); - ---rollback delete from egeis_egfconfigurationvalues where keyid = (select id from egeis_egfconfiguration where keyname='FETCH_DATA_FROM'); ---rollback delete from egeis_egfconfiguration where keyname = 'FETCH_DATA_FROM'; \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/seed/V20170726175805__egf_instrument_status.sql b/business-services/egf-master/src/main/resources/db/migration/seed/V20170726175805__egf_instrument_status.sql deleted file mode 100644 index 7070052b722..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/seed/V20170726175805__egf_instrument_status.sql +++ /dev/null @@ -1,29 +0,0 @@ -INSERT INTO egf_financialstatus( - id, moduletype, code, name, description, createdby, createddate, - lastmodifiedby, lastmodifieddate, version, tenantid) - VALUES ('cc6e551b-3a75-4b1e-a9ec-a2293fe03137', 'Instrument', 'New', 'New', 'Status assign when instrument is created', '1', now(), - '1', now(), 0, 'default'); - -INSERT INTO egf_financialstatus( - id, moduletype, code, name, description, createdby, createddate, - lastmodifiedby, lastmodifieddate, version, tenantid) - VALUES ('a167095b-5a73-4e61-b489-af31f053c4e1', 'Instrument', 'Deposited', 'Deposited', 'Status assign when instrument is deposited to bank', '1', now(), - '1', now(), 0, 'default'); - -INSERT INTO egf_financialstatus( - id, moduletype, code, name, description, createdby, createddate, - lastmodifiedby, lastmodifieddate, version, tenantid) - VALUES ('b5880534-2bae-47e0-ae00-4820fc46d579', 'Instrument', 'Reconciled', 'Reconciled', 'Status assign when instrument is reconciled', '1', now(), - '1', now(), 0, 'default'); - -INSERT INTO egf_financialstatus( - id, moduletype, code, name, description, createdby, createddate, - lastmodifiedby, lastmodifieddate, version, tenantid) - VALUES ('b69493dc-c3ab-4927-973a-600c352a2afa', 'Instrument', 'Dishonored', 'Dishonored', 'Status assign when instrument is Dishonored', '1', now(), - '1', now(), 0, 'default'); - -INSERT INTO egf_financialstatus( - id, moduletype, code, name, description, createdby, createddate, - lastmodifiedby, lastmodifieddate, version, tenantid) - VALUES ('2d8a0047-a77f-43cd-bed7-700459bc24a9', 'Instrument', 'Surrendered', 'Surrendered', 'Status assign when instrument is given back', '1', now(), - '1', now(), 0, 'default'); \ No newline at end of file diff --git a/business-services/egf-master/src/main/resources/db/migration/seed/V20170804165728__egf_configurations_for_voucher.sql b/business-services/egf-master/src/main/resources/db/migration/seed/V20170804165728__egf_configurations_for_voucher.sql deleted file mode 100644 index 04e515d9f31..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/seed/V20170804165728__egf_configurations_for_voucher.sql +++ /dev/null @@ -1,42 +0,0 @@ -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('3a7010b3-611a-48e6-8333-f4c197ec4fd1','Bank balance mandatory','Bank balance mandatory check','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('dd2602f1-1ea8-4cbc-b855-9572ea6d872c','Use billdate in create voucher from bill','Use billdate in create voucher from bill api','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('f563956c-eeea-4fad-8d41-25a4aa0c74cc','Pre-approved voucher status','Pre-approved voucher status','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('3e8e8ac6-0b6b-45d5-91c4-57dd67b5dba6','Approved voucher status','Approved voucher status','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('8551d6af-74ad-4852-b845-8b782ae90da1','Default voucher creation status','Default voucher creation status','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('b3decea6-5c9f-46e9-8393-58c5b26d4256','Default transaction mis attrributes','default transaction mis attributes','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('cec345c3-cf64-4a8e-8c31-7ed10e8b52b9','Journal voucher confirm on create','journal voucher create isconfirmed value','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('1eafaf13-f406-46e2-9158-d3085690ed15','If restricted to one function center','If restricted to one function center','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('992ed89c-fdd0-4929-86b5-429d1179cb88','Voucher date from UI','Get voucher date from UI','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('68eb56f9-0752-43f4-ba58-98ba1b519342','Data entry cut off date','Data entry cut off date','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('32fbebc9-0768-4e39-ac65-bbfaf60249c5','Auto generate receipt vouchernumber','Voucher number to be autogenerated for receipt voucher number','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('48b655fa-54f4-4c8d-a1d2-441f12e059e0','Auto generate payment vouchernumber','Voucher number to be autogenerated for payment voucher number','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('12cb8a13-78b2-4fc4-9192-791f9f8841fe','Auto generate contra vouchernumber','Voucher number to be autogenerated for contra voucher number','egf-voucher',1,now(),1,now(),'default'); - -insert into egf_financialconfiguration(id,keyName,description,module,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('393c86ce-f58d-442e-9dc7-47918bdf829b','Auto generate journal vouchernumber','Voucher number to be autogenerated for journal voucher number','egf-voucher',1,now(),1,now(),'default'); - diff --git a/business-services/egf-master/src/main/resources/db/migration/seed/V20170804165736__egf_configuration_values_for_voucher.sql b/business-services/egf-master/src/main/resources/db/migration/seed/V20170804165736__egf_configuration_values_for_voucher.sql deleted file mode 100644 index 49b16db3023..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/seed/V20170804165736__egf_configuration_values_for_voucher.sql +++ /dev/null @@ -1,47 +0,0 @@ -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('db2c257a-e5b5-41e2-a73a-a5b0d86b4467',(select id from egf_financialconfiguration where keyname = 'Pre-approved voucher status'),'5','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('8dd955b9-8676-42a8-b524-c7616288cc58',(select id from egf_financialconfiguration where keyname = 'Approved voucher status'),'0','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('c1cb84f7-7427-4dac-9588-b9480421d97b',(select id from egf_financialconfiguration where keyname = 'Default voucher creation status'),'0','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('fe6f48bc-f6df-4869-8a25-36421dadfb15',(select id from egf_financialconfiguration where keyname = 'Default transaction mis attrributes'),'department|M','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('0d0b4ab5-57f7-44c4-a633-d8d2f73b356e',(select id from egf_financialconfiguration where keyname = 'Default transaction mis attrributes'),'fund|M','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('5493e25b-cf58-4d1a-a715-9298f10b7a42',(select id from egf_financialconfiguration where keyname = 'Default transaction mis attrributes'),'function|M','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('38d7f782-842d-4893-a7d4-b44c60e9dc48',(select id from egf_financialconfiguration where keyname = 'Journal voucher confirm on create'),'0','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('bd435fbf-bc65-4700-bfb1-b114ea5fabd1',(select id from egf_financialconfiguration where keyname = 'Use billdate in create voucher from bill'),'N','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('e4a4daf7-2098-4ee2-94b4-8e3c7da88221',(select id from egf_financialconfiguration where keyname = 'Bank balance mandatory'),'N','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('0a4a5bf6-d655-4cc3-bdc3-e84c1496608e',(select id from egf_financialconfiguration where keyname = 'Voucher date from UI'),'Y','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('cf7ef4f9-cc0e-4d5c-8dc7-702802195001',(select id from egf_financialconfiguration where keyname = 'If restricted to one function center'),'Yes','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('2411d97f-1f23-4134-93a3-24369e21320b',(select id from egf_financialconfiguration where keyname = 'Data entry cut off date'),'30-Jun-2017','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('4fc471b3-8b6c-4704-85ca-e9c7f1821662',(select id from egf_financialconfiguration where keyname = 'Auto generate receipt vouchernumber'),'Y','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('03120edf-eb43-40f2-84c2-bb719ff4a405',(select id from egf_financialconfiguration where keyname = 'Auto generate payment vouchernumber'),'Y','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('3587adf9-3195-4a13-b4fa-61d147e24063',(select id from egf_financialconfiguration where keyname = 'Auto generate contra vouchernumber'),'Y','01/01/2017',1,now(),1,now(),'default'); - -insert into egf_financialconfigurationvalues(id,keyid,value,effectivefrom,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantId) -values('07c8e274-29be-4ec6-8170-e2f6a0011ea7',(select id from egf_financialconfiguration where keyname = 'Auto generate journal vouchernumber'),'Y','01/01/2017',1,now(),1,now(),'default'); diff --git a/business-services/egf-master/src/main/resources/db/migration/seed/V20181010154907__egf_instrument_status_for_punjab.sql b/business-services/egf-master/src/main/resources/db/migration/seed/V20181010154907__egf_instrument_status_for_punjab.sql deleted file mode 100644 index fec42c6f47e..00000000000 --- a/business-services/egf-master/src/main/resources/db/migration/seed/V20181010154907__egf_instrument_status_for_punjab.sql +++ /dev/null @@ -1,61 +0,0 @@ -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate,lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff0acc-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'New', 'New', 'Status assign when instrument is created', '1', now(),'1', now(), 0, 'pb.jalandhar'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff1332-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Deposited', 'Deposited', 'Status assign when instrument is deposited to bank', '1', now(), '1', now(), 0, 'pb.jalandhar'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff14cc-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Reconciled', 'Reconciled', 'Status assign when instrument is reconciled', '1', now(), '1', now(), 0, 'pb.jalandhar'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff160c-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Dishonored', 'Dishonored', 'Status assign when instrument is Dishonored', '1', now(),'1', now(), 0, 'pb.jalandhar'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff1738-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Surrendered', 'Surrendered', 'Status assign when instrument is given back', '1', now(), '1', now(), 0, 'pb.jalandhar'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate,lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff1864-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'New', 'New', 'Status assign when instrument is created', '1', now(),'1', now(), 0, 'pb.mohali'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff1a1c-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Deposited', 'Deposited', 'Status assign when instrument is deposited to bank', '1', now(), '1', now(), 0, 'pb.mohali'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff1e18-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Reconciled', 'Reconciled', 'Status assign when instrument is reconciled', '1', now(), '1', now(), 0, 'pb.mohali'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff1f62-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Dishonored', 'Dishonored', 'Status assign when instrument is Dishonored', '1', now(),'1', now(), 0, 'pb.mohali'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff20ac-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Surrendered', 'Surrendered', 'Status assign when instrument is given back', '1', now(), '1', now(), 0, 'pb.mohali'); - - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate,lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff21d8-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'New', 'New', 'Status assign when instrument is created', '1', now(),'1', now(), 0, 'pb.nayagaon'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff2304-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Deposited', 'Deposited', 'Status assign when instrument is deposited to bank', '1', now(), '1', now(), 0, 'pb.nayagaon'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff2430-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Reconciled', 'Reconciled', 'Status assign when instrument is reconciled', '1', now(), '1', now(), 0, 'pb.nayagaon'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff2854-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Dishonored', 'Dishonored', 'Status assign when instrument is Dishonored', '1', now(),'1', now(), 0, 'pb.nayagaon'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff29bc-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Surrendered', 'Surrendered', 'Status assign when instrument is given back', '1', now(), '1', now(), 0, 'pb.nayagaon'); - - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate,lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff2ae8-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'New', 'New', 'Status assign when instrument is created', '1', now(),'1', now(), 0, 'pb.amritsar'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff2c14-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Deposited', 'Deposited', 'Status assign when instrument is deposited to bank', '1', now(), '1', now(), 0, 'pb.amritsar'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff2d40-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Reconciled', 'Reconciled', 'Status assign when instrument is reconciled', '1', now(), '1', now(), 0, 'pb.amritsar'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff2e6c-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Dishonored', 'Dishonored', 'Status assign when instrument is Dishonored', '1', now(),'1', now(), 0, 'pb.amritsar'); - -INSERT INTO egf_financialstatus(id, moduletype, code, name, description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) -VALUES ('48ff2f98-cc75-11e8-a8d5-f2801f1b9fd1', 'Instrument', 'Surrendered', 'Surrendered', 'Status assign when instrument is given back', '1', now(), '1', now(), 0, 'pb.amritsar'); \ No newline at end of file diff --git a/business-services/egf-master/src/postman/Recovery Negative.postman_collection.json b/business-services/egf-master/src/postman/Recovery Negative.postman_collection.json deleted file mode 100644 index 6f191ffedb4..00000000000 --- a/business-services/egf-master/src/postman/Recovery Negative.postman_collection.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "variables": [], - "info": { - "name": "Recovery Negative", - "_postman_id": "d83af2f9-9f64-1961-46e8-8113e9f2e4f4", - "description": "", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "http://localhost:8280/egf-master/recoverys/_update", - "request": { - "url": "http://localhost:8280/egf-master/recoverys/_update", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "\n{\n \"requestInfo\": {\n \"resMsgId\": \"placeholder\",\n \"status\": \"200\",\n \"apiId\": null,\n \"ver\": null,\n \"ts\": \"01-01-2017 01:01:01\",\n \"key\": null\n },\n \"recoverys\": [\n {\n \"code\":\"final\",\n \"name\":\"final\",\n \"chartOfAccount\":{\n \"glcode\":\"341\",\n \"tenantId\":\"default\"\n },\n \"active\":true,\n \"type\":\"M\",\n \"flat\":\"100\",\n \"remitted\":\"S\",\n \"ifscCode\":\"SBIN0005532U\",\n \"accountNumber\":\"3049223457\",\n \"tenantId\":\"default\",\n \"mode\":\"M\",\n \"remittanceMode\":\"M\"\n }\n \n ]\n}" - }, - "description": "Recovery Update fails because no ID is provided" - }, - "response": [] - }, - { - "name": "http://localhost:8280/egf-master/recoverys/_create", - "request": { - "url": "http://localhost:8280/egf-master/recoverys/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "\n{\n \"requestInfo\": {\n \"resMsgId\": \"placeholder\",\n \"status\": \"200\",\n \"apiId\": null,\n \"ver\": null,\n \"ts\": \"01-01-2017 01:01:01\",\n \"key\": null\n },\n \"recoverys\": [\n {\n \"name\":\"final\",\n \"chartOfAccount\":{\n \"glcode\":\"341\",\n \"tenantId\":\"default\"\n },\n \"active\":true,\n \"type\":\"M\",\n \"flat\":\"100\",\n \"remitted\":\"S\",\n \"ifscCode\":\"SBIN0005532U\",\n \"accountNumber\":\"3049223457\",\n \"tenantId\":\"default\",\n \"mode\":\"M\",\n \"remittanceMode\":\"M\"\n }\n \n ]\n}" - }, - "description": "Recovery Create Failed since mandatory fields not sent in request" - }, - "response": [] - }, - { - "name": "http://localhost:8280/egf-master/recoverys/_search", - "request": { - "url": "http://localhost:8280/egf-master/recoverys/_search", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "description": "Search fails because no tenantId is provided" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/postman/RecoveryPositive.postman_collection.json b/business-services/egf-master/src/postman/RecoveryPositive.postman_collection.json deleted file mode 100644 index bcb6714a4ce..00000000000 --- a/business-services/egf-master/src/postman/RecoveryPositive.postman_collection.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "variables": [], - "info": { - "name": "RecoveryPositive", - "_postman_id": "931c1f4f-c354-4549-f612-92206b7b95c2", - "description": "", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "http://localhost:8280/egf-master/recoverys/_create", - "request": { - "url": "http://localhost:8280/egf-master/recoverys/_create", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "\n{\n \"requestInfo\": {\n \"resMsgId\": \"placeholder\",\n \"status\": \"200\",\n \"apiId\": null,\n \"ver\": null,\n \"ts\": \"01-01-2017 01:01:01\",\n \"key\": null\n },\n \"recoverys\": [\n {\n \"code\":\"final\",\n \"name\":\"final\",\n \"chartOfAccount\":{\n \"glcode\":\"341\",\n \"tenantId\":\"default\"\n },\n \"active\":true,\n \"type\":\"M\",\n \"flat\":\"100\",\n \"remitted\":\"S\",\n \"ifscCode\":\"SBIN0005532\",\n \"accountNumber\":\"3049223457\",\n \"tenantId\":\"default\",\n \"mode\":\"M\",\n \"remittanceMode\":\"M\"\n }\n \n ]\n}" - }, - "description": "Recovery Create" - }, - "response": [] - }, - { - "name": "http://localhost:8280/egf-master/recoverys/_update", - "request": { - "url": "http://localhost:8280/egf-master/recoverys/_update", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "\n{\n \"requestInfo\": {\n \"resMsgId\": \"placeholder\",\n \"status\": \"200\",\n \"apiId\": null,\n \"ver\": null,\n \"ts\": \"01-01-2017 01:01:01\",\n \"key\": null\n },\n \"recoverys\": [\n {\n \t\"id\":\"2\",\n \"code\":\"final\",\n \"name\":\"final\",\n \"chartOfAccount\":{\n \"glcode\":\"341\",\n \"tenantId\":\"default\"\n },\n \"active\":true,\n \"type\":\"M\",\n \"flat\":\"100\",\n \"remitted\":\"S\",\n \"ifscCode\":\"SBIN0005532U\",\n \"accountNumber\":\"3049223457\",\n \"tenantId\":\"default\",\n \"mode\":\"M\",\n \"remittanceMode\":\"M\"\n }\n \n ]\n}" - }, - "description": "Recovery Update" - }, - "response": [] - }, - { - "name": "http://localhost:8280/egf-master/recoverys/_search", - "request": { - "url": "http://localhost:8280/egf-master/recoverys/_search", - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "description": "" - } - ], - "body": { - "mode": "raw", - "raw": "\n{\n \"requestInfo\": {\n \"resMsgId\": \"placeholder\",\n \"status\": \"200\",\n \"apiId\": null,\n \"ver\": null,\n \"ts\": \"01-01-2017 01:01:01\",\n \"key\": null\n }\n}" - }, - "description": "Recovery Search" - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/common/utils/RequestJsonReader.java b/business-services/egf-master/src/test/java/org/egov/common/utils/RequestJsonReader.java deleted file mode 100644 index ff9ac47ac26..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/common/utils/RequestJsonReader.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.egov.common.utils; - -import java.io.IOException; - -import org.apache.commons.io.IOUtils; - -public class RequestJsonReader { - - public String readRequest(String fileName) { - try { - String info=IOUtils.toString(this.getClass().getClassLoader() - .getResourceAsStream("common/request_info.json"), "UTF-8"); - - String data= IOUtils.toString(this.getClass().getClassLoader() - .getResourceAsStream(fileName), "UTF-8"); - return "{\n"+info+","+data+"}"; - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public String readResponse(String fileName) { - try { - String info=IOUtils.toString(this.getClass().getClassLoader() - .getResourceAsStream("common/response_info.json"), "UTF-8"); - - String data= IOUtils.toString(this.getClass().getClassLoader() - .getResourceAsStream(fileName), "UTF-8"); - return "{\n"+info+","+data+"}"; - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public String readErrorResponse(String fileName) { - try { - String info=IOUtils.toString(this.getClass().getClassLoader() - .getResourceAsStream("common/error_info.json"), "UTF-8"); - - String data= IOUtils.toString(this.getClass().getClassLoader() - .getResourceAsStream(fileName), "UTF-8"); - return "{\n"+info+","+data+"}"; - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - public String getRequestInfo() { - try { - String info = IOUtils.toString( - this.getClass().getClassLoader().getResourceAsStream("common/request_info.json"), "UTF-8"); - - return "{\n" + info + "}"; - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/FinancialsApplicationTests.java b/business-services/egf-master/src/test/java/org/egov/egf/FinancialsApplicationTests.java deleted file mode 100644 index 34d8b5a3cf4..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/FinancialsApplicationTests.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.egf; - -import org.egov.egf.master.TestConfiguration; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -@SpringBootTest -@Ignore -public class FinancialsApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/TestConfiguration.java b/business-services/egf-master/src/test/java/org/egov/egf/master/TestConfiguration.java deleted file mode 100644 index 5e67a0423cf..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/TestConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egf.master; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.kafka.core.KafkaTemplate; - -import static org.mockito.Mockito.mock; - -@Configuration -public class TestConfiguration { - - @Bean - @SuppressWarnings("unchecked") - public KafkaTemplate kafkaTemplate() { - return mock(KafkaTemplate.class); - } - -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountCodePurposeRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountCodePurposeRepositoryTest.java deleted file mode 100644 index a27f10bf691..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountCodePurposeRepositoryTest.java +++ /dev/null @@ -1,266 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.AccountCodePurposeSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.AccountCodePurposeEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.AccountCodePurposeJdbcRepository; -import org.egov.egf.master.web.contract.AccountCodePurposeContract; -import org.egov.egf.master.web.contract.AccountCodePurposeSearchContract; -import org.egov.egf.master.web.requests.AccountCodePurposeRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class AccountCodePurposeRepositoryTest { - - private AccountCodePurposeRepository accountCodePurposeRepositoryWithKafka; - private AccountCodePurposeRepository accountCodePurposeRepositoryWithOutKafka; - - @InjectMocks - private AccountCodePurposeRepository accountCodePurposeRepository; - - @Mock - private AccountCodePurposeJdbcRepository accountCodePurposeJdbcRepository; - - @Mock - private MastersQueueRepository accountCodePurposeQueueRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - @Mock - private AccountCodePurposeESRepository accountCodePurposeESRepository; - - @Captor - private ArgumentCaptor> captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - accountCodePurposeRepositoryWithKafka = new AccountCodePurposeRepository(accountCodePurposeJdbcRepository, - accountCodePurposeQueueRepository, financialConfigurationService, accountCodePurposeESRepository, - "yes"); - accountCodePurposeRepositoryWithOutKafka = new AccountCodePurposeRepository(accountCodePurposeJdbcRepository, - accountCodePurposeQueueRepository, financialConfigurationService, accountCodePurposeESRepository, "no"); - - } - - @Test - public void testFindById() { - AccountCodePurposeEntity accountCodePurposeEntity = getAccountCodePurposeEntity(); - AccountCodePurpose expectedResult = accountCodePurposeEntity.toDomain(); - when(accountCodePurposeJdbcRepository.findById(any(AccountCodePurposeEntity.class))) - .thenReturn(accountCodePurposeEntity); - AccountCodePurpose actualResult = accountCodePurposeRepository.findById(getAccountCodePurposeDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSave() { - List expectedResult = getAccountCodePurposes(); - requestInfo.setAction(Constants.ACTION_CREATE); - accountCodePurposeRepositoryWithKafka.save(expectedResult, requestInfo); - verify(accountCodePurposeQueueRepository).add(captor.capture()); - } - - @Test - public void testSave1() { - List expectedResult = getAccountCodePurposes(); - AccountCodePurposeEntity entity = new AccountCodePurposeEntity().toEntity(expectedResult.get(0)); - when(accountCodePurposeJdbcRepository.create(any(AccountCodePurposeEntity.class))).thenReturn(entity); - accountCodePurposeRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(accountCodePurposeQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testSavee() { - AccountCodePurposeEntity accountCodePurposeEntity = getAccountCodePurposeEntity(); - AccountCodePurpose expectedResult = accountCodePurposeEntity.toDomain(); - when(accountCodePurposeJdbcRepository.create(any(AccountCodePurposeEntity.class))) - .thenReturn(accountCodePurposeEntity); - AccountCodePurpose actualResult = accountCodePurposeRepository.save(getAccountCodePurposeDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testUpdate() { - List expectedResult = getAccountCodePurposes(); - requestInfo.setAction(Constants.ACTION_CREATE); - accountCodePurposeRepositoryWithKafka.update(expectedResult, requestInfo); - verify(accountCodePurposeQueueRepository).add(captor.capture()); - } - - @Test - public void testUpdate1() { - List expectedResult = getAccountCodePurposes(); - AccountCodePurposeEntity entity = new AccountCodePurposeEntity().toEntity(expectedResult.get(0)); - when(accountCodePurposeJdbcRepository.update(any(AccountCodePurposeEntity.class))).thenReturn(entity); - accountCodePurposeRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(accountCodePurposeQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testUpdatee() { - AccountCodePurposeEntity accountCodePurposeEntity = getAccountCodePurposeEntity(); - AccountCodePurpose expectedResult = accountCodePurposeEntity.toDomain(); - when(accountCodePurposeJdbcRepository.update(any(AccountCodePurposeEntity.class))) - .thenReturn(accountCodePurposeEntity); - AccountCodePurpose actualResult = accountCodePurposeRepository.update(getAccountCodePurposeDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testAddToQue() { - Mockito.doNothing().when(accountCodePurposeQueueRepository).add(Mockito.any()); - AccountCodePurposeRequest request = new AccountCodePurposeRequest(); - request.setRequestInfo(getRequestInfo()); - request.setAccountCodePurposes(new ArrayList()); - request.getAccountCodePurposes().add(getAccountCodePurposeContract()); - accountCodePurposeRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("accountcodepurpose_create", request); - Mockito.verify(accountCodePurposeQueueRepository).add(message); - } - - @Test - public void testAddToQue1() { - Mockito.doNothing().when(accountCodePurposeQueueRepository).add(Mockito.any()); - AccountCodePurposeRequest request = new AccountCodePurposeRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setAccountCodePurposes(new ArrayList()); - request.getAccountCodePurposes().add(getAccountCodePurposeContract()); - accountCodePurposeRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("accountcodepurpose_update", request); - Mockito.verify(accountCodePurposeQueueRepository).add(message); - } - - @Test - public void testAddToSearchQueue() { - Mockito.lenient().doNothing().when(accountCodePurposeQueueRepository).add(Mockito.any()); - AccountCodePurposeRequest request = new AccountCodePurposeRequest(); - request.setRequestInfo(getRequestInfo()); - request.setAccountCodePurposes(new ArrayList()); - request.getAccountCodePurposes().add(getAccountCodePurposeContract()); - accountCodePurposeRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("accountcodepurpose_persisted", request); - Mockito.verify(accountCodePurposeQueueRepository).addToSearch(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(accountCodePurposeJdbcRepository.search(any(AccountCodePurposeSearch.class))).thenReturn(expectedResult); - Pagination actualResult = accountCodePurposeRepository - .search(getAccountCodePurposeSearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSearch1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(accountCodePurposeESRepository.search(any(AccountCodePurposeSearchContract.class))) - .thenReturn(expectedResult); - Pagination actualResult = accountCodePurposeRepository - .search(getAccountCodePurposeSearch()); - assertEquals(expectedResult, actualResult); - } - - private AccountCodePurposeContract getAccountCodePurposeContract() { - return AccountCodePurposeContract.builder().name("name").build(); - } - - private AccountCodePurposeEntity getAccountCodePurposeEntity() { - AccountCodePurposeEntity entity = new AccountCodePurposeEntity(); - AccountCodePurpose accountCodePurpose = getAccountCodePurposeDomain(); - entity.setName(accountCodePurpose.getName()); - entity.setTenantId(accountCodePurpose.getTenantId()); - return entity; - } - - private AccountCodePurpose getAccountCodePurposeDomain() { - AccountCodePurpose accountCodePurpose = new AccountCodePurpose(); - accountCodePurpose.setId("1"); - accountCodePurpose.setName("name"); - accountCodePurpose.setTenantId("default"); - return accountCodePurpose; - } - - public List getAccountCodePurposeDomains() { - List accountCodePurposes = new ArrayList<>(); - accountCodePurposes.add(getAccountCodePurposeDomain()); - return accountCodePurposes; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private AccountCodePurposeSearch getAccountCodePurposeSearch() { - AccountCodePurposeSearch accountCodePurposeSearch = new AccountCodePurposeSearch(); - accountCodePurposeSearch.setPageSize(500); - accountCodePurposeSearch.setOffset(0); - accountCodePurposeSearch.setSortBy("name desc"); - return accountCodePurposeSearch; - } - - private List getAccountCodePurposes() { - List accountCodePurposes = new ArrayList(); - AccountCodePurpose accountCodePurpose = AccountCodePurpose.builder().id("1").name("name").build(); - accountCodePurpose.setTenantId("default"); - accountCodePurposes.add(accountCodePurpose); - return accountCodePurposes; - } - - private AccountCodePurposeSearchContract getAccountCodePurposeSearchContract() { - AccountCodePurposeSearchContract accountCodePurposeSearchContract = new AccountCodePurposeSearchContract(); - accountCodePurposeSearchContract.setPageSize(0); - accountCodePurposeSearchContract.setOffset(0); - accountCodePurposeSearchContract.setSortBy("name desc"); - return accountCodePurposeSearchContract; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountDetailKeyRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountDetailKeyRepositoryTest.java deleted file mode 100644 index 9e197b52319..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountDetailKeyRepositoryTest.java +++ /dev/null @@ -1,282 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailKeySearch; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.AccountDetailKeyEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.AccountDetailKeyJdbcRepository; -import org.egov.egf.master.web.contract.AccountDetailKeyContract; -import org.egov.egf.master.web.contract.AccountDetailKeySearchContract; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; -import org.egov.egf.master.web.requests.AccountDetailKeyRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class AccountDetailKeyRepositoryTest { - - private AccountDetailKeyRepository accountDetailKeyRepositoryWithKafka; - private AccountDetailKeyRepository accountDetailKeyRepositoryWithOutKafka; - - @InjectMocks - private AccountDetailKeyRepository accountDetailKeyRepository; - - @Mock - private AccountDetailKeyJdbcRepository accountDetailKeyJdbcRepository; - - @Mock - private MastersQueueRepository accountDetailKeyQueueRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - @Mock - private AccountDetailKeyESRepository accountDetailKeyESRepository; - - @Captor - private ArgumentCaptor> captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - accountDetailKeyRepositoryWithKafka = new AccountDetailKeyRepository(accountDetailKeyJdbcRepository, - accountDetailKeyQueueRepository, financialConfigurationService, accountDetailKeyESRepository, "yes"); - accountDetailKeyRepositoryWithOutKafka = new AccountDetailKeyRepository(accountDetailKeyJdbcRepository, - accountDetailKeyQueueRepository, financialConfigurationService, accountDetailKeyESRepository, "no"); - - } - - @Test - public void testFindById() { - AccountDetailKeyEntity accountDetailKeyEntity = getAccountDetailKeyEntity(); - AccountDetailKey expectedResult = accountDetailKeyEntity.toDomain(); - when(accountDetailKeyJdbcRepository.findById(any(AccountDetailKeyEntity.class))) - .thenReturn(accountDetailKeyEntity); - AccountDetailKey actualResult = accountDetailKeyRepository.findById(getAccountDetailKeyDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSaveWithKafka() { - List expectedResult = getAccountDetailKies(); - requestInfo.setAction(Constants.ACTION_CREATE); - accountDetailKeyRepositoryWithKafka.save(expectedResult, requestInfo); - verify(accountDetailKeyQueueRepository).add(captor.capture()); - } - - @Test - public void testSaveWithOutKafka() { - List expectedResult = getAccountDetailKies(); - AccountDetailKeyEntity entity = new AccountDetailKeyEntity().toEntity(expectedResult.get(0)); - when(accountDetailKeyJdbcRepository.create(any(AccountDetailKeyEntity.class))).thenReturn(entity); - accountDetailKeyRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(accountDetailKeyQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testSave() { - AccountDetailKeyEntity accountDetailKeyEntity = getAccountDetailKeyEntity(); - AccountDetailKey expectedResult = accountDetailKeyEntity.toDomain(); - when(accountDetailKeyJdbcRepository.create(any(AccountDetailKeyEntity.class))) - .thenReturn(accountDetailKeyEntity); - AccountDetailKey actualResult = accountDetailKeyRepository.save(getAccountDetailKeyDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testUpdateWithKafka() { - List expectedResult = getAccountDetailKies(); - requestInfo.setAction(Constants.ACTION_CREATE); - accountDetailKeyRepositoryWithKafka.update(expectedResult, requestInfo); - verify(accountDetailKeyQueueRepository).add(captor.capture()); - } - - @Test - public void testUpdateWithOutKafka() { - List expectedResult = getAccountDetailKies(); - AccountDetailKeyEntity entity = new AccountDetailKeyEntity().toEntity(expectedResult.get(0)); - when(accountDetailKeyJdbcRepository.update(any(AccountDetailKeyEntity.class))).thenReturn(entity); - accountDetailKeyRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(accountDetailKeyQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testUpdate() { - AccountDetailKeyEntity accountDetailKeyEntity = getAccountDetailKeyEntity(); - AccountDetailKey expectedResult = accountDetailKeyEntity.toDomain(); - when(accountDetailKeyJdbcRepository.update(any(AccountDetailKeyEntity.class))) - .thenReturn(accountDetailKeyEntity); - AccountDetailKey actualResult = accountDetailKeyRepository.update(getAccountDetailKeyDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testAddToQue() { - Mockito.doNothing().when(accountDetailKeyQueueRepository).add(Mockito.any()); - AccountDetailKeyRequest request = new AccountDetailKeyRequest(); - request.setRequestInfo(getRequestInfo()); - request.setAccountDetailKeys(new ArrayList()); - request.getAccountDetailKeys().add(getAccountDetailKeyContract()); - accountDetailKeyRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("accountdetailkey_create", request); - Mockito.verify(accountDetailKeyQueueRepository).add(message); - } - - @Test - public void testAddToQue1() { - Mockito.doNothing().when(accountDetailKeyQueueRepository).add(Mockito.any()); - AccountDetailKeyRequest request = new AccountDetailKeyRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setAccountDetailKeys(new ArrayList()); - request.getAccountDetailKeys().add(getAccountDetailKeyContract()); - accountDetailKeyRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("accountdetailkey_update", request); - Mockito.verify(accountDetailKeyQueueRepository).add(message); - } - - @Test - public void testAddToSearchQueue() { - Mockito.lenient().doNothing().when(accountDetailKeyQueueRepository).add(Mockito.any()); - AccountDetailKeyRequest request = new AccountDetailKeyRequest(); - request.setRequestInfo(getRequestInfo()); - request.setAccountDetailKeys(new ArrayList()); - request.getAccountDetailKeys().add(getAccountDetailKeyContract()); - accountDetailKeyRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("accountdetailkey_persisted", request); - Mockito.verify(accountDetailKeyQueueRepository).addToSearch(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(accountDetailKeyJdbcRepository.search(any(AccountDetailKeySearch.class))).thenReturn(expectedResult); - Pagination actualResult = accountDetailKeyRepository.search(getAccountDetailKeySearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSearch1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(accountDetailKeyESRepository.search(any(AccountDetailKeySearchContract.class))).thenReturn(expectedResult); - Pagination actualResult = accountDetailKeyRepository.search(getAccountDetailKeySearch()); - assertEquals(expectedResult, actualResult); - } - - private AccountDetailKeyContract getAccountDetailKeyContract() { - return AccountDetailKeyContract.builder().id("1").key("1").accountDetailType(getAccountDetailTypeContract()) - .build(); - } - - private AccountDetailKeyEntity getAccountDetailKeyEntity() { - AccountDetailKeyEntity entity = new AccountDetailKeyEntity(); - AccountDetailKey accountDetailKey = getAccountDetailKeyDomain(); - entity.setKey(accountDetailKey.getKey()); - entity.setAccountDetailTypeId(accountDetailKey.getAccountDetailType().getId()); - entity.setTenantId(accountDetailKey.getTenantId()); - return entity; - } - - private AccountDetailKey getAccountDetailKeyDomain() { - AccountDetailKey accountDetailKey = new AccountDetailKey(); - accountDetailKey.setId("1"); - accountDetailKey.setKey("1"); - accountDetailKey.setAccountDetailType(getAccountDetailType()); - accountDetailKey.setTenantId("default"); - return accountDetailKey; - } - - public List getAccountDetailKeyDomains() { - List accountDetailKies = new ArrayList<>(); - accountDetailKies.add(getAccountDetailKeyDomain()); - return accountDetailKies; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private AccountDetailKeySearch getAccountDetailKeySearch() { - AccountDetailKeySearch accountDetailKeySearch = new AccountDetailKeySearch(); - accountDetailKeySearch.setPageSize(500); - accountDetailKeySearch.setOffset(0); - accountDetailKeySearch.setSortBy("name desc"); - return accountDetailKeySearch; - } - - private List getAccountDetailKies() { - List accountDetailKies = new ArrayList(); - AccountDetailKey accountDetailKey = AccountDetailKey.builder().id("1").key("1") - .accountDetailType(getAccountDetailType()).build(); - accountDetailKey.setTenantId("default"); - accountDetailKies.add(accountDetailKey); - return accountDetailKies; - } - - private AccountDetailKeySearchContract getAccountDetailKeySearchContract() { - AccountDetailKeySearchContract accountDetailKeySearchContract = new AccountDetailKeySearchContract(); - accountDetailKeySearchContract.setPageSize(0); - accountDetailKeySearchContract.setOffset(0); - accountDetailKeySearchContract.setSortBy("name desc"); - return accountDetailKeySearchContract; - } - - private AccountDetailTypeContract getAccountDetailTypeContract() { - AccountDetailTypeContract accountDetailType = AccountDetailTypeContract.builder().id("1").name("name") - .tableName("contractor").fullyQualifiedName("abc/acb").active(true).build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } - - private AccountDetailType getAccountDetailType() { - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("contractor") - .fullyQualifiedName("abc/acb").active(true).build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountDetailTypeRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountDetailTypeRepositoryTest.java deleted file mode 100644 index 618b5355b56..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountDetailTypeRepositoryTest.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.AccountDetailTypeEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.AccountDetailTypeJdbcRepository; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; -import org.egov.egf.master.web.contract.AccountDetailTypeSearchContract; -import org.egov.egf.master.web.requests.AccountDetailTypeRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class AccountDetailTypeRepositoryTest { - - private AccountDetailTypeRepository accountDetailTypeRepositoryWithKafka; - private AccountDetailTypeRepository accountDetailTypeRepositoryWithOutKafka; - - @InjectMocks - private AccountDetailTypeRepository accountDetailTypeRepository; - - @Mock - private AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository; - - @Mock - private MastersQueueRepository accountDetailTypeQueueRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - @Mock - private AccountDetailTypeESRepository accountDetailTypeESRepository; - - @Captor - private ArgumentCaptor> captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - accountDetailTypeRepositoryWithKafka = new AccountDetailTypeRepository(accountDetailTypeJdbcRepository, - accountDetailTypeQueueRepository, financialConfigurationService, accountDetailTypeESRepository, "yes"); - accountDetailTypeRepositoryWithOutKafka = new AccountDetailTypeRepository(accountDetailTypeJdbcRepository, - accountDetailTypeQueueRepository, financialConfigurationService, accountDetailTypeESRepository, "no"); - - } - - @Test - public void testFindById() { - AccountDetailTypeEntity accountDetailTypeEntity = getAccountDetailTypeEntity(); - AccountDetailType expectedResult = accountDetailTypeEntity.toDomain(); - when(accountDetailTypeJdbcRepository.findById(any(AccountDetailTypeEntity.class))) - .thenReturn(accountDetailTypeEntity); - AccountDetailType actualResult = accountDetailTypeRepository.findById(getAccountDetailTypeDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testSaveWithKafka() { - List expectedResult = getAccountDetailTypes(); - requestInfo.setAction(Constants.ACTION_CREATE); - accountDetailTypeRepositoryWithKafka.save(expectedResult, requestInfo); - verify(accountDetailTypeQueueRepository).add(captor.capture()); - } - - @Test - public void testSaveWithOutKafka() { - List expectedResult = getAccountDetailTypes(); - AccountDetailTypeEntity entity = new AccountDetailTypeEntity().toEntity(expectedResult.get(0)); - when(accountDetailTypeJdbcRepository.create(any(AccountDetailTypeEntity.class))).thenReturn(entity); - accountDetailTypeRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(accountDetailTypeQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testSave() { - AccountDetailTypeEntity accountDetailTypeEntity = getAccountDetailTypeEntity(); - AccountDetailType expectedResult = accountDetailTypeEntity.toDomain(); - when(accountDetailTypeJdbcRepository.create(any(AccountDetailTypeEntity.class))) - .thenReturn(accountDetailTypeEntity); - AccountDetailType actualResult = accountDetailTypeRepository.save(getAccountDetailTypeDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testUpdateWithKafka() { - List expectedResult = getAccountDetailTypes(); - requestInfo.setAction(Constants.ACTION_CREATE); - accountDetailTypeRepositoryWithKafka.update(expectedResult, requestInfo); - verify(accountDetailTypeQueueRepository).add(captor.capture()); - } - - @Test - public void testUpdateWithOutKafka() { - List expectedResult = getAccountDetailTypes(); - AccountDetailTypeEntity entity = new AccountDetailTypeEntity().toEntity(expectedResult.get(0)); - when(accountDetailTypeJdbcRepository.update(any(AccountDetailTypeEntity.class))).thenReturn(entity); - accountDetailTypeRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(accountDetailTypeQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testUpdate() { - AccountDetailTypeEntity accountDetailTypeEntity = getAccountDetailTypeEntity(); - AccountDetailType expectedResult = accountDetailTypeEntity.toDomain(); - when(accountDetailTypeJdbcRepository.update(any(AccountDetailTypeEntity.class))) - .thenReturn(accountDetailTypeEntity); - AccountDetailType actualResult = accountDetailTypeRepository.update(getAccountDetailTypeDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testAddToQue() { - Mockito.doNothing().when(accountDetailTypeQueueRepository).add(Mockito.any()); - AccountDetailTypeRequest request = new AccountDetailTypeRequest(); - request.setRequestInfo(getRequestInfo()); - request.setAccountDetailTypes(new ArrayList()); - request.getAccountDetailTypes().add(getAccountDetailTypeContract()); - accountDetailTypeRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("accountdetailtype_create", request); - Mockito.verify(accountDetailTypeQueueRepository).add(message); - } - - @Test - public void testAddToQue1() { - Mockito.doNothing().when(accountDetailTypeQueueRepository).add(Mockito.any()); - AccountDetailTypeRequest request = new AccountDetailTypeRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setAccountDetailTypes(new ArrayList()); - request.getAccountDetailTypes().add(getAccountDetailTypeContract()); - accountDetailTypeRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("accountdetailtype_update", request); - Mockito.verify(accountDetailTypeQueueRepository).add(message); - } - - @Test - public void testAddToSearchQueue() { - Mockito.lenient().doNothing().when(accountDetailTypeQueueRepository).add(Mockito.any()); - AccountDetailTypeRequest request = new AccountDetailTypeRequest(); - request.setRequestInfo(getRequestInfo()); - request.setAccountDetailTypes(new ArrayList()); - request.getAccountDetailTypes().add(getAccountDetailTypeContract()); - accountDetailTypeRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("accountdetailtype_persisted", request); - Mockito.verify(accountDetailTypeQueueRepository).addToSearch(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(accountDetailTypeJdbcRepository.search(any(AccountDetailTypeSearch.class))).thenReturn(expectedResult); - Pagination actualResult = accountDetailTypeRepository.search(getAccountDetailTypeSearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSearch1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(accountDetailTypeESRepository.search(any(AccountDetailTypeSearchContract.class))) - .thenReturn(expectedResult); - Pagination actualResult = accountDetailTypeRepository.search(getAccountDetailTypeSearch()); - assertEquals(expectedResult, actualResult); - } - - private AccountDetailTypeContract getAccountDetailTypeContract() { - return AccountDetailTypeContract.builder().tableName("contractor").fullyQualifiedName("abc/contractor") - .name("name").active(true).build(); - } - - private AccountDetailTypeEntity getAccountDetailTypeEntity() { - AccountDetailTypeEntity entity = new AccountDetailTypeEntity(); - AccountDetailType accountDetailType = getAccountDetailTypeDomain(); - entity.setTablename(accountDetailType.getTableName()); - entity.setName(accountDetailType.getName()); - entity.setActive(accountDetailType.getActive()); - entity.setFullyQualifiedName(accountDetailType.getFullyQualifiedName()); - entity.setTenantId(accountDetailType.getTenantId()); - return entity; - } - - private AccountDetailType getAccountDetailTypeDomain() { - AccountDetailType accountDetailType = new AccountDetailType(); - accountDetailType.setId("1"); - accountDetailType.setTableName("contractor"); - accountDetailType.setName("name"); - accountDetailType.setActive(true); - accountDetailType.setFullyQualifiedName("abc/contractor"); - accountDetailType.setTenantId("default"); - return accountDetailType; - } - - public List getAccountDetailTypeDomains() { - List accountDetailTypes = new ArrayList<>(); - accountDetailTypes.add(getAccountDetailTypeDomain()); - return accountDetailTypes; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private AccountDetailTypeSearch getAccountDetailTypeSearch() { - AccountDetailTypeSearch accountDetailTypeSearch = new AccountDetailTypeSearch(); - accountDetailTypeSearch.setPageSize(500); - accountDetailTypeSearch.setOffset(0); - accountDetailTypeSearch.setSortBy("name desc"); - return accountDetailTypeSearch; - } - - private List getAccountDetailTypes() { - List accountDetailTypes = new ArrayList(); - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("contractor") - .fullyQualifiedName("abc/contractor").active(true).build(); - accountDetailType.setTenantId("default"); - accountDetailTypes.add(accountDetailType); - return accountDetailTypes; - } - - private AccountDetailTypeSearchContract getAccountDetailTypeSearchContract() { - AccountDetailTypeSearchContract accountDetailTypeSearchContract = new AccountDetailTypeSearchContract(); - accountDetailTypeSearchContract.setPageSize(0); - accountDetailTypeSearchContract.setOffset(0); - accountDetailTypeSearchContract.setSortBy("name desc"); - return accountDetailTypeSearchContract; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountEntityRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountEntityRepositoryTest.java deleted file mode 100644 index 13a9e97b1b5..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/AccountEntityRepositoryTest.java +++ /dev/null @@ -1,270 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.domain.model.AccountEntitySearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.AccountEntityEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.AccountEntityJdbcRepository; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; -import org.egov.egf.master.web.contract.AccountEntityContract; -import org.egov.egf.master.web.contract.AccountEntitySearchContract; -import org.egov.egf.master.web.requests.AccountEntityRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.*; -import org.mockito.runners.MockitoJUnitRunner; - -import java.util.*; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class AccountEntityRepositoryTest { - - private AccountEntityRepository accountEntityRepositoryWithKafka; - private AccountEntityRepository accountEntityRepositoryWithOutKafka; - - @InjectMocks - private AccountEntityRepository accountEntityRepository; - - @Mock - private AccountEntityJdbcRepository accountEntityJdbcRepository; - - @Mock - private MastersQueueRepository accountEntityQueueRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - @Mock - private AccountEntityESRepository accountEntityESRepository; - - @Captor - private ArgumentCaptor> captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - accountEntityRepositoryWithKafka = new AccountEntityRepository(accountEntityJdbcRepository, accountEntityQueueRepository, - financialConfigurationService, accountEntityESRepository, "yes"); - accountEntityRepositoryWithOutKafka = new AccountEntityRepository(accountEntityJdbcRepository, accountEntityQueueRepository, - financialConfigurationService, accountEntityESRepository, "no"); - - } - - @Test - public void testFindById() { - AccountEntityEntity accountEntityEntity = getAccountEntityEntity(); - AccountEntity expectedResult = accountEntityEntity.toDomain(); - when(accountEntityJdbcRepository.findById(any(AccountEntityEntity.class))).thenReturn(accountEntityEntity); - AccountEntity actualResult = accountEntityRepository.findById(getAccountEntityDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSaveWithKafka() { - List expectedResult = getAccountEntitys(); - requestInfo.setAction(Constants.ACTION_CREATE); - accountEntityRepositoryWithKafka.save(expectedResult, requestInfo); - verify(accountEntityQueueRepository).add(captor.capture()); - } - - @Test - public void testSaveWithOutKafka() { - List expectedResult = getAccountEntitys(); - AccountEntityEntity entity = new AccountEntityEntity().toEntity(expectedResult.get(0)); - when(accountEntityJdbcRepository.create(any(AccountEntityEntity.class))).thenReturn(entity); - accountEntityRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(accountEntityQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testSave() { - AccountEntityEntity accountEntityEntity = getAccountEntityEntity(); - AccountEntity expectedResult = accountEntityEntity.toDomain(); - when(accountEntityJdbcRepository.create(any(AccountEntityEntity.class))).thenReturn(accountEntityEntity); - AccountEntity actualResult = accountEntityRepository.save(getAccountEntityDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testUpdateWithKafka() { - List expectedResult = getAccountEntitys(); - requestInfo.setAction(Constants.ACTION_CREATE); - accountEntityRepositoryWithKafka.update(expectedResult, requestInfo); - verify(accountEntityQueueRepository).add(captor.capture()); - } - - @Test - public void testUpdateWithOutKafka() { - List expectedResult = getAccountEntitys(); - AccountEntityEntity entity = new AccountEntityEntity().toEntity(expectedResult.get(0)); - when(accountEntityJdbcRepository.update(any(AccountEntityEntity.class))).thenReturn(entity); - accountEntityRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(accountEntityQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testUpdate() { - AccountEntityEntity accountEntityEntity = getAccountEntityEntity(); - AccountEntity expectedResult = accountEntityEntity.toDomain(); - when(accountEntityJdbcRepository.update(any(AccountEntityEntity.class))).thenReturn(accountEntityEntity); - AccountEntity actualResult = accountEntityRepository.update(getAccountEntityDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testAddToQue() { - Mockito.doNothing().when(accountEntityQueueRepository).add(Mockito.any()); - AccountEntityRequest request = new AccountEntityRequest(); - request.setRequestInfo(getRequestInfo()); - request.setAccountEntities(new ArrayList()); - request.getAccountEntities().add(getAccountEntityContract()); - accountEntityRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("accountentity_create", request); - Mockito.verify(accountEntityQueueRepository).add(message); - } - - @Test - public void testAddToQue1() { - Mockito.doNothing().when(accountEntityQueueRepository).add(Mockito.any()); - AccountEntityRequest request = new AccountEntityRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setAccountEntities(new ArrayList()); - request.getAccountEntities().add(getAccountEntityContract()); - accountEntityRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("accountentity_update", request); - Mockito.verify(accountEntityQueueRepository).add(message); - } - - @Test - public void testAddToSearchQueue() { - Mockito.lenient().doNothing().when(accountEntityQueueRepository).add(Mockito.any()); - AccountEntityRequest request = new AccountEntityRequest(); - request.setRequestInfo(getRequestInfo()); - request.setAccountEntities(new ArrayList()); - request.getAccountEntities().add(getAccountEntityContract()); - accountEntityRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("accountentity_persisted", request); - Mockito.verify(accountEntityQueueRepository).addToSearch(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(accountEntityJdbcRepository.search(any(AccountEntitySearch.class))).thenReturn(expectedResult); - Pagination actualResult = accountEntityRepository.search(getAccountEntitySearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSearch1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(accountEntityESRepository.search(any(AccountEntitySearchContract.class))).thenReturn(expectedResult); - Pagination actualResult = accountEntityRepository.search(getAccountEntitySearch()); - assertEquals(expectedResult, actualResult); - } - - private AccountEntityContract getAccountEntityContract() { - AccountDetailTypeContract accountDetailTypeContract = AccountDetailTypeContract.builder().id("1"). - name("name").tableName("table") - .fullyQualifiedName("abc/table").build(); - return AccountEntityContract.builder().code("code").name("name").active(true).accountDetailType(accountDetailTypeContract).build(); - } - - private AccountEntityEntity getAccountEntityEntity() { - AccountEntityEntity entity = new AccountEntityEntity(); - AccountEntity accountEntity = getAccountEntityDomain(); - entity.setCode(accountEntity.getCode()); - entity.setName(accountEntity.getName()); - entity.setActive(accountEntity.getActive()); - entity.setAccountDetailTypeId(accountEntity.getAccountDetailType().getId()); - entity.setTenantId(accountEntity.getTenantId()); - return entity; - } - - private AccountEntity getAccountEntityDomain() { - AccountEntity accountEntity = new AccountEntity(); - accountEntity.setId("1"); - accountEntity.setCode("code"); - accountEntity.setName("name"); - accountEntity.setActive(true); - accountEntity.setAccountDetailType(getAccountDetaialType()); - accountEntity.setTenantId("default"); - return accountEntity; - } - - public List getAccountEntityDomains() { - List accountEntities = new ArrayList<>(); - accountEntities.add(getAccountEntityDomain()); - return accountEntities; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private AccountEntitySearch getAccountEntitySearch() { - AccountEntitySearch accountEntitySearch = new AccountEntitySearch(); - accountEntitySearch.setPageSize(500); - accountEntitySearch.setOffset(0); - accountEntitySearch.setSortBy("name desc"); - return accountEntitySearch; - } - - private List getAccountEntitys() { - List accountEntities = new ArrayList<>(); - AccountEntity accountEntity = AccountEntity.builder().id("1").name("name").code("code").accountDetailType(getAccountDetaialType()).active(true).build(); - accountEntity.setTenantId("default"); - accountEntities.add(accountEntity); - return accountEntities; - } - - private AccountEntitySearchContract getAccountEntitySearchContract() { - AccountEntitySearchContract accountEntitySearchContract = new AccountEntitySearchContract(); - accountEntitySearchContract.setPageSize(0); - accountEntitySearchContract.setOffset(0); - accountEntitySearchContract.setSortBy("name desc"); - return accountEntitySearchContract; - } - - private AccountDetailType getAccountDetaialType() { - - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("table") - .fullyQualifiedName("abc/table").build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/BankAccountRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/BankAccountRepositoryTest.java deleted file mode 100644 index 4b8d75e3884..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/BankAccountRepositoryTest.java +++ /dev/null @@ -1,252 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.enums.BankAccountType; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankAccountSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.BankAccountEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.BankAccountJdbcRepository; -import org.egov.egf.master.web.contract.BankAccountContract; -import org.egov.egf.master.web.contract.BankAccountSearchContract; -import org.egov.egf.master.web.contract.enums.BankAccountTypeContract; -import org.egov.egf.master.web.requests.BankAccountRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class BankAccountRepositoryTest { - - @Mock - private BankAccountJdbcRepository bankAccountJdbcRepository; - - @Mock - private MastersQueueRepository bankAccountQueueRepository; - - @InjectMocks - private BankAccountRepository bankAccountRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - private RequestInfo requestInfo = new RequestInfo(); - @Captor - private ArgumentCaptor> captor; - - private BankAccountRepository bankAccountRepositoryWithKafka; - - private BankAccountRepository bankAccountRepositoryWithOutKafka; - - @Mock - private BankAccountESRepository bankAccountESRepository; - - @Before - public void setup() { - bankAccountRepositoryWithKafka = new BankAccountRepository(bankAccountJdbcRepository, - bankAccountQueueRepository, financialConfigurationService, bankAccountESRepository, "yes"); - bankAccountRepositoryWithOutKafka = new BankAccountRepository(bankAccountJdbcRepository, - bankAccountQueueRepository, financialConfigurationService, bankAccountESRepository, "no"); - - } - - @Test - public void testFindById() { - BankAccountEntity bankAccountEntity = getBankAccountEntity(); - BankAccount expectedResult = bankAccountEntity.toDomain(); - when(bankAccountJdbcRepository.findById(any(BankAccountEntity.class))).thenReturn(bankAccountEntity); - BankAccount actualResult = bankAccountRepository.findById(getBankAccountDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testSaveWithKafka() { - List expectedResult = new ArrayList<>(); - expectedResult.add(getBankAccountDomain()); - requestInfo.setAction(Constants.ACTION_CREATE); - bankAccountRepositoryWithKafka.save(expectedResult, requestInfo); - verify(bankAccountQueueRepository).add(captor.capture()); - } - - @Test - public void testSaveWithOutKafka() { - List expectedResult = new ArrayList<>(); - expectedResult.add(getBankAccountDomain()); - BankAccountEntity entity = new BankAccountEntity().toEntity(expectedResult.get(0)); - when(bankAccountJdbcRepository.create(any(BankAccountEntity.class))).thenReturn(entity); - bankAccountRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(bankAccountQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testSave() { - BankAccountEntity bankAccountEntity = getBankAccountEntity(); - BankAccount expectedResult = bankAccountEntity.toDomain(); - when(bankAccountJdbcRepository.create(any(BankAccountEntity.class))).thenReturn(bankAccountEntity); - BankAccount actualResult = bankAccountRepository.save(getBankAccountDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testUpdateWithKafka() { - List expectedResult = new ArrayList<>(); - expectedResult.add(getBankAccountDomain()); - requestInfo.setAction(Constants.ACTION_CREATE); - bankAccountRepositoryWithKafka.update(expectedResult, requestInfo); - verify(bankAccountQueueRepository).add(captor.capture()); - } - - @Test - public void testUpdateWithOutKafka() { - List expectedResult = new ArrayList<>(); - expectedResult.add(getBankAccountDomain()); - BankAccountEntity entity = new BankAccountEntity().toEntity(expectedResult.get(0)); - when(bankAccountJdbcRepository.update(any(BankAccountEntity.class))).thenReturn(entity); - bankAccountRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(bankAccountQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testUpdate() { - BankAccountEntity bankAccountEntity = getBankAccountEntity(); - BankAccount expectedResult = bankAccountEntity.toDomain(); - when(bankAccountJdbcRepository.update(any(BankAccountEntity.class))).thenReturn(bankAccountEntity); - BankAccount actualResult = bankAccountRepository.update(bankAccountEntity.toDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testAddToQue() { - Mockito.doNothing().when(bankAccountQueueRepository).add(Mockito.any()); - BankAccountRequest request = new BankAccountRequest(); - request.setRequestInfo(getRequestInfo()); - request.setBankAccounts(new ArrayList()); - request.getBankAccounts().add(getBankAccountContract()); - bankAccountRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("bankaccount_create", request); - Mockito.verify(bankAccountQueueRepository).add(message); - } - - @Test - public void testAddToQue1() { - Mockito.doNothing().when(bankAccountQueueRepository).add(Mockito.any()); - BankAccountRequest request = new BankAccountRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setBankAccounts(new ArrayList()); - request.getBankAccounts().add(getBankAccountContract()); - bankAccountRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("bankaccount_update", request); - Mockito.verify(bankAccountQueueRepository).add(message); - } - - @Test - public void testAddToSearchQueue() { - Mockito.lenient().doNothing().when(bankAccountQueueRepository).add(Mockito.any()); - BankAccountRequest request = new BankAccountRequest(); - request.setRequestInfo(getRequestInfo()); - request.setBankAccounts(new ArrayList()); - request.getBankAccounts().add(getBankAccountContract()); - bankAccountRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("bankaccount_persisted", request); - Mockito.verify(bankAccountQueueRepository).addToSearch(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(bankAccountJdbcRepository.search(any(BankAccountSearch.class))).thenReturn(expectedResult); - Pagination actualResult = bankAccountRepository.search(getBankAccountSearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSearch1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(bankAccountESRepository.search(any(BankAccountSearchContract.class))).thenReturn(expectedResult); - Pagination actualResult = bankAccountRepository.search(getBankAccountSearch()); - assertEquals(expectedResult, actualResult); - } - - private BankAccountEntity getBankAccountEntity() { - BankAccountEntity bankAccountEntity = new BankAccountEntity(); - BankAccount bankAccount = getBankAccountDomain(); - bankAccountEntity.setId(bankAccount.getId()); - bankAccountEntity.setDescription(bankAccount.getDescription()); - bankAccountEntity.setActive(bankAccount.getActive()); - bankAccountEntity.setTenantId(bankAccount.getTenantId()); - bankAccountEntity.setType(bankAccount.getType().toString()); - return bankAccountEntity; - } - - private BankAccount getBankAccountDomain() { - BankAccount bankAccount = new BankAccount(); - bankAccount.setId("1"); - bankAccount.setDescription("description"); - bankAccount.setActive(true); - bankAccount.setTenantId("default"); - bankAccount.setType(BankAccountType.PAYMENTS); - return bankAccount; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private BankAccountContract getBankAccountContract() { - BankAccountContract bankAccountContract = BankAccountContract.builder().id("1").description("description") - .active(true).type(BankAccountTypeContract.PAYMENTS).build(); - bankAccountContract.setTenantId("default"); - return bankAccountContract; - } - - private BankAccountSearch getBankAccountSearch() { - BankAccountSearch bankAccountSearch = new BankAccountSearch(); - bankAccountSearch.setPageSize(500); - bankAccountSearch.setOffset(0); - bankAccountSearch.setSortBy("name desc"); - return bankAccountSearch; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/BankBranchRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/BankBranchRepositoryTest.java deleted file mode 100644 index e2ead1b28bb..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/BankBranchRepositoryTest.java +++ /dev/null @@ -1,259 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.BankBranchSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.BankBranchEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.BankBranchJdbcRepository; -import org.egov.egf.master.web.contract.BankBranchContract; -import org.egov.egf.master.web.contract.BankBranchSearchContract; -import org.egov.egf.master.web.requests.BankBranchRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class BankBranchRepositoryTest { - - @Mock - private BankBranchJdbcRepository bankBranchJdbcRepository; - - @Mock - private MastersQueueRepository bankBranchQueueRepository; - - @InjectMocks - private BankBranchRepository bankBranchRepository; - - private BankBranchRepository bankBranchRepositoryWithKafka; - - private BankBranchRepository bankBranchRepositoryWithOutKafka; - - @Mock - private FinancialConfigurationService financialConfigurationService; - @Mock - private BankBranchESRepository bankBranchESRepository; - - private RequestInfo requestInfo = new RequestInfo(); - @Captor - private ArgumentCaptor> captor; - - @Before - public void setup() { - bankBranchRepositoryWithKafka = new BankBranchRepository(bankBranchJdbcRepository, bankBranchQueueRepository, - financialConfigurationService, bankBranchESRepository, "yes"); - bankBranchRepositoryWithOutKafka = new BankBranchRepository(bankBranchJdbcRepository, bankBranchQueueRepository, - financialConfigurationService, bankBranchESRepository, "no"); - - } - - @Test - public void testFindById() { - BankBranchEntity bankBranchEntity = getBankBranchEntity(); - BankBranch expectedResult = bankBranchEntity.toDomain(); - when(bankBranchJdbcRepository.findById(any(BankBranchEntity.class))).thenReturn(bankBranchEntity); - BankBranch actualResult = bankBranchRepository.findById(getBankBranchDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testSaveWithKafka() { - List expectedResult = getBankBranches(); - requestInfo.setAction(Constants.ACTION_CREATE); - bankBranchRepositoryWithKafka.save(expectedResult, requestInfo); - verify(bankBranchQueueRepository).add(captor.capture()); - } - - @Test - public void testSaveWithOutKafka() { - List expectedResult = getBankBranches(); - BankBranchEntity entity = new BankBranchEntity().toEntity(expectedResult.get(0)); - when(bankBranchJdbcRepository.create(any(BankBranchEntity.class))).thenReturn(entity); - bankBranchRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(bankBranchQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testSave() { - BankBranchEntity bankBranchEntity = getBankBranchEntity(); - BankBranch expectedResult = bankBranchEntity.toDomain(); - when(bankBranchJdbcRepository.create(any(BankBranchEntity.class))).thenReturn(bankBranchEntity); - BankBranch actualResult = bankBranchRepository.save(getBankBranchDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testUpdateWithKafka() { - List expectedResult = getBankBranches(); - requestInfo.setAction(Constants.ACTION_CREATE); - bankBranchRepositoryWithKafka.update(expectedResult, requestInfo); - verify(bankBranchQueueRepository).add(captor.capture()); - } - - @Test - public void testUpdateWithOutKafka() { - List expectedResult = getBankBranches(); - BankBranchEntity entity = new BankBranchEntity().toEntity(expectedResult.get(0)); - when(bankBranchJdbcRepository.update(any(BankBranchEntity.class))).thenReturn(entity); - bankBranchRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(bankBranchQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testUpdate() { - BankBranchEntity bankBranchEntity = getBankBranchEntity(); - BankBranch expectedResult = bankBranchEntity.toDomain(); - when(bankBranchJdbcRepository.update(any(BankBranchEntity.class))).thenReturn(bankBranchEntity); - BankBranch actualResult = bankBranchRepository.update(bankBranchEntity.toDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testAddToQue() { - Mockito.doNothing().when(bankBranchQueueRepository).add(Mockito.any()); - BankBranchRequest request = new BankBranchRequest(); - request.setRequestInfo(getRequestInfo()); - request.setBankBranches(new ArrayList()); - request.getBankBranches().add(getBankBranchContract()); - bankBranchRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("bankbranch_create", request); - Mockito.verify(bankBranchQueueRepository).add(message); - } - - @Test - public void testAddToQue1() { - Mockito.doNothing().when(bankBranchQueueRepository).add(Mockito.any()); - BankBranchRequest request = new BankBranchRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setBankBranches(new ArrayList()); - request.getBankBranches().add(getBankBranchContract()); - bankBranchRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("bankbranch_update", request); - Mockito.verify(bankBranchQueueRepository).add(message); - } - - @Test - public void testAddToSearchQueue() { - Mockito.lenient().doNothing().when(bankBranchQueueRepository).add(Mockito.any()); - BankBranchRequest request = new BankBranchRequest(); - request.setRequestInfo(getRequestInfo()); - request.setBankBranches(new ArrayList()); - request.getBankBranches().add(getBankBranchContract()); - bankBranchRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("bankbranch_persisted", request); - Mockito.verify(bankBranchQueueRepository).addToSearch(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(bankBranchJdbcRepository.search(any(BankBranchSearch.class))).thenReturn(expectedResult); - Pagination actualResult = bankBranchRepository.search(getBankBranchSearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSearch1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(bankBranchESRepository.search(any(BankBranchSearchContract.class))).thenReturn(expectedResult); - Pagination actualResult = bankBranchRepository.search(getBankBranchSearch()); - assertEquals(expectedResult, actualResult); - } - - private BankBranchContract getBankBranchContract() { - return BankBranchContract.builder().code("code").name("name").active(true).build(); - } - - private BankBranchEntity getBankBranchEntity() { - BankBranchEntity entity = new BankBranchEntity(); - BankBranch bankBranch = getBankBranchDomain(); - entity.setId(bankBranch.getId()); - entity.setCode(bankBranch.getCode()); - entity.setName(bankBranch.getName()); - entity.setActive(bankBranch.getActive()); - entity.setDescription(bankBranch.getDescription()); - entity.setTenantId(bankBranch.getTenantId()); - return entity; - } - - private BankBranch getBankBranchDomain() { - BankBranch bankBranch = new BankBranch(); - bankBranch.setId("1"); - bankBranch.setCode("code"); - bankBranch.setName("name"); - bankBranch.setActive(true); - bankBranch.setDescription("description"); - bankBranch.setTenantId("default"); - return bankBranch; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private BankBranchSearch getBankBranchSearch() { - BankBranchSearch bankBranchSearch = new BankBranchSearch(); - bankBranchSearch.setPageSize(500); - bankBranchSearch.setOffset(0); - bankBranchSearch.setSortBy("name desc"); - return bankBranchSearch; - } - - private List getBankBranches() { - List bankBranches = new ArrayList(); - BankBranch bankBranch = BankBranch.builder().id("1").name("name").code("code").active(true).build(); - bankBranch.setTenantId("default"); - bankBranches.add(bankBranch); - return bankBranches; - } - - private BankBranchSearchContract getBankBranchSearchContract() { - BankBranchSearchContract bankBranchSearchContract = new BankBranchSearchContract(); - bankBranchSearchContract.setPageSize(0); - bankBranchSearchContract.setOffset(0); - bankBranchSearchContract.setSortBy("name desc"); - return bankBranchSearchContract; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/BankRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/BankRepositoryTest.java deleted file mode 100644 index 90a7a621b4a..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/BankRepositoryTest.java +++ /dev/null @@ -1,261 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.BankEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.BankJdbcRepository; -import org.egov.egf.master.web.contract.BankContract; -import org.egov.egf.master.web.contract.BankSearchContract; -import org.egov.egf.master.web.requests.BankRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class BankRepositoryTest { - - @Mock - private BankJdbcRepository bankJdbcRepository; - - @Mock - private MastersQueueRepository bankQueueRepository; - - @InjectMocks - private BankRepository bankRepository; - - private BankRepository bankRepositoryWithKafka; - - private BankRepository bankRepositoryWithOutKafka; - - @Mock - private BankESRepository bankESRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - private RequestInfo requestInfo = new RequestInfo(); - - @Captor - private ArgumentCaptor> captor; - - @Before - public void setup() { - bankRepositoryWithKafka = new BankRepository(bankJdbcRepository, bankQueueRepository, - financialConfigurationService, bankESRepository, "yes"); - bankRepositoryWithOutKafka = new BankRepository(bankJdbcRepository, bankQueueRepository, - financialConfigurationService, bankESRepository, "no"); - - } - - @Test - public void testFindById() { - BankEntity bankEntity = getBankEntity(); - Bank expectedResult = bankEntity.toDomain(); - when(bankJdbcRepository.findById(any(BankEntity.class))).thenReturn(bankEntity); - Bank actualResult = bankRepository.findById(getBankDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testSaveWithKafka() { - List expectedResult = getBanks(); - requestInfo.setAction(Constants.ACTION_CREATE); - bankRepositoryWithKafka.save(expectedResult, requestInfo); - verify(bankQueueRepository).add(captor.capture()); - } - - @Test - public void testSaveWithOutKafka() { - List expectedResult = getBanks(); - BankEntity entity = new BankEntity().toEntity(expectedResult.get(0)); - when(bankJdbcRepository.create(any(BankEntity.class))).thenReturn(entity); - bankRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(bankQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testSave() { - BankEntity bankEntity = getBankEntity(); - Bank expectedResult = bankEntity.toDomain(); - when(bankJdbcRepository.create(any(BankEntity.class))).thenReturn(bankEntity); - Bank actualResult = bankRepository.save(getBankDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testUpdateWithKafka() { - List expectedResult = getBanks(); - requestInfo.setAction(Constants.ACTION_CREATE); - bankRepositoryWithKafka.update(expectedResult, requestInfo); - verify(bankQueueRepository).add(captor.capture()); - } - - @Test - public void testUpdateWithOutKafka() { - List expectedResult = getBanks(); - BankEntity entity = new BankEntity().toEntity(expectedResult.get(0)); - when(bankJdbcRepository.update(any(BankEntity.class))).thenReturn(entity); - bankRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(bankQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testUpdate() { - BankEntity bankEntity = getBankEntity(); - Bank expectedResult = bankEntity.toDomain(); - when(bankJdbcRepository.update(any(BankEntity.class))).thenReturn(bankEntity); - Bank actualResult = bankRepository.update(bankEntity.toDomain()); - assertEquals(expectedResult.getId(), actualResult.getId()); - } - - @Test - public void testAddToQue() { - Mockito.doNothing().when(bankQueueRepository).add(Mockito.any()); - BankRequest request = new BankRequest(); - request.setRequestInfo(getRequestInfo()); - request.setBanks(new ArrayList()); - request.getBanks().add(getBankContract()); - bankRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("bank_create", request); - Mockito.verify(bankQueueRepository).add(message); - } - - @Test - public void testAddToQue1() { - Mockito.doNothing().when(bankQueueRepository).add(Mockito.any()); - BankRequest request = new BankRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setBanks(new ArrayList()); - request.getBanks().add(getBankContract()); - bankRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("bank_update", request); - Mockito.verify(bankQueueRepository).add(message); - } - - @Test - public void testAddToSearchQueue() { - Mockito.lenient().doNothing().when(bankQueueRepository).add(Mockito.any()); - BankRequest request = new BankRequest(); - request.setRequestInfo(getRequestInfo()); - request.setBanks(new ArrayList()); - request.getBanks().add(getBankContract()); - bankRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("bank_persisted", request); - Mockito.verify(bankQueueRepository).addToSearch(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(bankJdbcRepository.search(any(BankSearch.class))).thenReturn(expectedResult); - Pagination actualResult = bankRepository.search(getBankSearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSearch1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(bankESRepository.search(any(BankSearchContract.class))).thenReturn(expectedResult); - Pagination actualResult = bankRepository.search(getBankSearch()); - assertEquals(expectedResult, actualResult); - } - - private BankContract getBankContract() { - return BankContract.builder().code("code").name("name").active(true).build(); - } - - private BankEntity getBankEntity() { - BankEntity entity = new BankEntity(); - Bank bank = getBankDomain(); - entity.setId(bank.getId()); - entity.setCode(bank.getCode()); - entity.setName(bank.getName()); - entity.setActive(bank.getActive()); - entity.setDescription(bank.getDescription()); - entity.setTenantId(bank.getTenantId()); - return entity; - } - - private Bank getBankDomain() { - Bank bank = new Bank(); - bank.setId("1"); - bank.setCode("code"); - bank.setName("name"); - bank.setActive(true); - bank.setDescription("description"); - bank.setTenantId("default"); - return bank; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private BankSearch getBankSearch() { - BankSearch bankSearch = new BankSearch(); - bankSearch.setPageSize(500); - bankSearch.setOffset(0); - bankSearch.setSortBy("name desc"); - return bankSearch; - } - - private List getBanks() { - List banks = new ArrayList(); - Bank bank = Bank.builder().id("1").name("name").code("code").active(true).build(); - bank.setTenantId("default"); - banks.add(bank); - return banks; - } - - private BankSearchContract getBankSearchContract() { - BankSearchContract bankSearchContract = new BankSearchContract(); - bankSearchContract.setPageSize(0); - bankSearchContract.setOffset(0); - bankSearchContract.setSortBy("name desc"); - return bankSearchContract; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/ChartOfAccountDetailRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/ChartOfAccountDetailRepositoryTest.java deleted file mode 100644 index 27407912d08..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/ChartOfAccountDetailRepositoryTest.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; -import org.egov.egf.master.domain.repository.ChartOfAccountDetailRepository; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.ChartOfAccountDetailEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.ChartOfAccountDetailJdbcRepository; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.egov.egf.master.web.contract.ChartOfAccountDetailContract; -import org.egov.egf.master.web.requests.ChartOfAccountDetailRequest; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ChartOfAccountDetailRepositoryTest { - - @Mock - private ChartOfAccountDetailJdbcRepository chartofAccountDetailJdbcRepository; - - @Mock - private MastersQueueRepository chartofAccountDetailQueueRepository; - - @InjectMocks - private ChartOfAccountDetailRepository chartOfAccountDetailRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - @Test - public void testFindById() { - ChartOfAccountDetailEntity chartOfAccountDetailEntity = getChartOfAccountDetailEntity(); - ChartOfAccountDetail expectedResult = chartOfAccountDetailEntity.toDomain(); - when(chartofAccountDetailJdbcRepository.findById(any(ChartOfAccountDetailEntity.class))) - .thenReturn(chartOfAccountDetailEntity); - ChartOfAccountDetail actualResult = chartOfAccountDetailRepository.findById(getChartOfAccountDetailDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSave() { - ChartOfAccountDetailEntity chartOfAccountDetailEntity = getChartOfAccountDetailEntity(); - ChartOfAccountDetail expectedResult = chartOfAccountDetailEntity.toDomain(); - when(chartofAccountDetailJdbcRepository.create(any(ChartOfAccountDetailEntity.class))) - .thenReturn(chartOfAccountDetailEntity); - ChartOfAccountDetail actualResult = chartOfAccountDetailRepository.save(getChartOfAccountDetailDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testUpdate() { - ChartOfAccountDetailEntity chartOfAccountDetailEntity = getChartOfAccountDetailEntity(); - ChartOfAccountDetail expectedResult = chartOfAccountDetailEntity.toDomain(); - when(chartofAccountDetailJdbcRepository.update(any(ChartOfAccountDetailEntity.class))) - .thenReturn(chartOfAccountDetailEntity); - ChartOfAccountDetail actualResult = chartOfAccountDetailRepository.update(getChartOfAccountDetailDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testAdd() { - Mockito.doNothing().when(chartofAccountDetailQueueRepository).add(Mockito.any()); - ChartOfAccountDetailRequest request = new ChartOfAccountDetailRequest(); - List coadcs = new ArrayList<>(); - coadcs.add(getChartOfAccountDetailContract()); - request.setRequestInfo(getRequestInfo()); - request.setChartOfAccountDetails(coadcs); - chartOfAccountDetailRepository.add(request); - Map message = new HashMap<>(); - message.put("chartofaccountdetail_create", request); - verify(chartofAccountDetailQueueRepository).add(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(chartofAccountDetailJdbcRepository.search(any(ChartOfAccountDetailSearch.class))).thenReturn(expectedResult); - Pagination actualResult = chartOfAccountDetailRepository.search(getChartOfAccountDetailSearch()); - assertEquals(expectedResult, actualResult); - } - - private ChartOfAccountDetailEntity getChartOfAccountDetailEntity() { - ChartOfAccountDetailEntity chartOfAccountDetailEntity = new ChartOfAccountDetailEntity(); - chartOfAccountDetailEntity.setId("1"); - chartOfAccountDetailEntity.setChartOfAccountId(getChartOfAccount().getId()); - chartOfAccountDetailEntity.setAccountDetailTypeId(getAccountDetailType().getId()); - return chartOfAccountDetailEntity; - } - - private ChartOfAccountDetail getChartOfAccountDetailDomain() { - ChartOfAccountDetail chartOfAccountDetail = ChartOfAccountDetail.builder().id("1").build(); - chartOfAccountDetail.setChartOfAccount(getChartOfAccount()); - chartOfAccountDetail.setAccountDetailType(getAccountDetailType()); - return chartOfAccountDetail; - } - - private ChartOfAccount getChartOfAccount() { - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("1") - .glcode("glcode").name("name") - .description("description").isActiveForPosting(true) - .type('A').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } - - private ChartOfAccountContract getChartOfAccountContract() { - ChartOfAccountContract chartOfAccountContract = ChartOfAccountContract.builder().id("1") - .glcode("glcode").name("name") - .description("description").isActiveForPosting(true) - .type('A').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).build(); - chartOfAccountContract.setTenantId("default"); - return chartOfAccountContract; - } - - private AccountDetailType getAccountDetailType() { - AccountDetailType accountDetailType = AccountDetailType.builder().id("1") - .name("name").description("description").active(true).build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } - - private AccountDetailTypeContract getAccountDetailTypeContract() { - AccountDetailTypeContract accountDetailTypeContract = AccountDetailTypeContract.builder().id("1") - .name("name").description("description").active(true).build(); - accountDetailTypeContract.setTenantId("default"); - return accountDetailTypeContract; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private ChartOfAccountDetailContract getChartOfAccountDetailContract() { - ChartOfAccountDetailContract chartOfAccountDetailContract = ChartOfAccountDetailContract.builder().id("1").build(); - chartOfAccountDetailContract.setChartOfAccount(getChartOfAccountContract()); - chartOfAccountDetailContract.setAccountDetailType(getAccountDetailTypeContract()); - return chartOfAccountDetailContract; - } - - private ChartOfAccountDetailSearch getChartOfAccountDetailSearch() { - ChartOfAccountDetailSearch chartOfAccountDetailSearch = new ChartOfAccountDetailSearch(); - chartOfAccountDetailSearch.setPageSize(500); - chartOfAccountDetailSearch.setOffset(0); - chartOfAccountDetailSearch.setSortBy("name desc"); - return chartOfAccountDetailSearch; - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/ChartOfAccountRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/ChartOfAccountRepositoryTest.java deleted file mode 100644 index 48515ce62fb..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/ChartOfAccountRepositoryTest.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.ChartOfAccountEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.ChartOfAccountJdbcRepository; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.egov.egf.master.web.requests.ChartOfAccountRequest; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ChartOfAccountRepositoryTest { - - @Mock - private ChartOfAccountJdbcRepository chartofAccountJdbcRepository; - - @Mock - private MastersQueueRepository chartofAccountQueueRepository; - - @InjectMocks - private ChartOfAccountRepository chartOfAccountRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - @Test - public void testFindById() { - ChartOfAccountEntity chartOfAccountEntity = getChartOfAccountEntity(); - ChartOfAccount expectedResult = chartOfAccountEntity.toDomain(); - when(chartofAccountJdbcRepository.findById(any(ChartOfAccountEntity.class))).thenReturn(chartOfAccountEntity); - ChartOfAccount actualResult = chartOfAccountRepository.findById(getChartOfAccountDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSave() { - ChartOfAccountEntity chartOfAccountEntity = getChartOfAccountEntity(); - ChartOfAccount expectedResult = chartOfAccountEntity.toDomain(); - when(chartofAccountJdbcRepository.create(any(ChartOfAccountEntity.class))).thenReturn(chartOfAccountEntity); - ChartOfAccount actualResult = chartOfAccountRepository.save(getChartOfAccountDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testUpdate() { - ChartOfAccountEntity chartOfAccountEntity = getChartOfAccountEntity(); - ChartOfAccount expectedResult = chartOfAccountEntity.toDomain(); - when(chartofAccountJdbcRepository.update(any(ChartOfAccountEntity.class))).thenReturn(chartOfAccountEntity); - ChartOfAccount actualResult = chartOfAccountRepository.update(getChartOfAccountDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testAdd() { - Mockito.doNothing().when(chartofAccountQueueRepository).add(Mockito.any()); - ChartOfAccountRequest request = new ChartOfAccountRequest(); - request.setRequestInfo(getRequestInfo()); - request.setChartOfAccounts(new ArrayList()); - request.getChartOfAccounts().add(getChartOfAccountContract()); - chartOfAccountRepository.add(request); - Map message = new HashMap<>(); - message.put("chartofaccount_create", request); - Mockito.verify(chartofAccountQueueRepository).add(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(chartofAccountJdbcRepository.search(any(ChartOfAccountSearch.class))).thenReturn(expectedResult); - Pagination actualResult = chartOfAccountRepository.search(getChartOfAccountSearch()); - assertEquals(expectedResult, actualResult); - } - - private ChartOfAccountEntity getChartOfAccountEntity() { - ChartOfAccountEntity chartOfAccountEntity = new ChartOfAccountEntity(); - ChartOfAccount chartOfAccount = getChartOfAccountDomain(); - chartOfAccountEntity.setGlcode(chartOfAccount.getGlcode()); - chartOfAccountEntity.setName(chartOfAccount.getName()); - chartOfAccountEntity.setDescription(chartOfAccount.getDescription()); - chartOfAccountEntity.setIsActiveForPosting(chartOfAccount.getIsActiveForPosting()); - chartOfAccountEntity.setType(chartOfAccount.getType()); - chartOfAccountEntity.setClassification(chartOfAccount.getClassification()); - chartOfAccountEntity.setFunctionRequired(chartOfAccount.getFunctionRequired()); - chartOfAccountEntity.setBudgetCheckRequired(chartOfAccount.getBudgetCheckRequired()); - return chartOfAccountEntity; - } - - private ChartOfAccount getChartOfAccountDomain() { - ChartOfAccount chartOfAccount = ChartOfAccount.builder() - .glcode("GLCode").name("AadharBank") - .description("DefaultDescription").isActiveForPosting(true) - .type('B').classification((long) 123456).functionRequired(true) - .budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } - - private ChartOfAccountContract getChartOfAccountContract() { - - return ChartOfAccountContract.builder() - .glcode("GLCode").name("AadharBank") - .description("DefaultDescription").isActiveForPosting(true) - .type('B').classification((long) 123456).functionRequired(true) - .budgetCheckRequired(true).build(); - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private ChartOfAccountSearch getChartOfAccountSearch() { - ChartOfAccountSearch chartOfAccountSearch = new ChartOfAccountSearch(); - chartOfAccountSearch.setPageSize(500); - chartOfAccountSearch.setOffset(0); - chartOfAccountSearch.setSortBy("name desc"); - return chartOfAccountSearch; - - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/FunctionRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/FunctionRepositoryTest.java deleted file mode 100644 index ee36c1f8c78..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/FunctionRepositoryTest.java +++ /dev/null @@ -1,265 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.domain.model.FunctionSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.FunctionEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FunctionJdbcRepository; -import org.egov.egf.master.web.contract.FunctionContract; -import org.egov.egf.master.web.contract.FunctionSearchContract; -import org.egov.egf.master.web.requests.FunctionRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class FunctionRepositoryTest { - - private FunctionRepository functionRepositoryWithKafka; - private FunctionRepository functionRepositoryWithOutKafka; - - @InjectMocks - private FunctionRepository functionRepository; - - @Mock - private FunctionJdbcRepository functionJdbcRepository; - - @Mock - private MastersQueueRepository functionQueueRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - @Mock - private FunctionESRepository functionESRepository; - - @Captor - private ArgumentCaptor> captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - functionRepositoryWithKafka = new FunctionRepository(functionJdbcRepository, functionQueueRepository, - financialConfigurationService, functionESRepository, "yes"); - functionRepositoryWithOutKafka = new FunctionRepository(functionJdbcRepository, functionQueueRepository, - financialConfigurationService, functionESRepository, "no"); - - } - - @Test - public void testFindById() { - FunctionEntity functionEntity = getFunctionEntity(); - Function expectedResult = functionEntity.toDomain(); - when(functionJdbcRepository.findById(any(FunctionEntity.class))).thenReturn(functionEntity); - Function actualResult = functionRepository.findById(getFunctionDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSave() { - List expectedResult = getFunctions(); - requestInfo.setAction(Constants.ACTION_CREATE); - functionRepositoryWithKafka.save(expectedResult, requestInfo); - verify(functionQueueRepository).add(captor.capture()); - } - - @Test - public void testSave1() { - List expectedResult = getFunctions(); - FunctionEntity entity = new FunctionEntity().toEntity(expectedResult.get(0)); - when(functionJdbcRepository.create(any(FunctionEntity.class))).thenReturn(entity); - functionRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(functionQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testSavee() { - FunctionEntity functionEntity = getFunctionEntity(); - Function expectedResult = functionEntity.toDomain(); - when(functionJdbcRepository.create(any(FunctionEntity.class))).thenReturn(functionEntity); - Function actualResult = functionRepository.save(getFunctionDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testUpdate() { - List expectedResult = getFunctions(); - requestInfo.setAction(Constants.ACTION_CREATE); - functionRepositoryWithKafka.update(expectedResult, requestInfo); - verify(functionQueueRepository).add(captor.capture()); - } - - @Test - public void testUpdate1() { - List expectedResult = getFunctions(); - FunctionEntity entity = new FunctionEntity().toEntity(expectedResult.get(0)); - when(functionJdbcRepository.update(any(FunctionEntity.class))).thenReturn(entity); - functionRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(functionQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testUpdatee() { - FunctionEntity functionEntity = getFunctionEntity(); - Function expectedResult = functionEntity.toDomain(); - when(functionJdbcRepository.update(any(FunctionEntity.class))).thenReturn(functionEntity); - Function actualResult = functionRepository.update(getFunctionDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testAddToQue() { - Mockito.doNothing().when(functionQueueRepository).add(Mockito.any()); - FunctionRequest request = new FunctionRequest(); - request.setRequestInfo(getRequestInfo()); - request.setFunctions(new ArrayList()); - request.getFunctions().add(getFunctionContract()); - functionRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("function_create", request); - Mockito.verify(functionQueueRepository).add(message); - } - - @Test - public void testAddToQue1() { - Mockito.doNothing().when(functionQueueRepository).add(Mockito.any()); - FunctionRequest request = new FunctionRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setFunctions(new ArrayList()); - request.getFunctions().add(getFunctionContract()); - functionRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("function_update", request); - Mockito.verify(functionQueueRepository).add(message); - } - - @Test - public void testAddToSearchQueue() { - Mockito.lenient().doNothing().when(functionQueueRepository).add(Mockito.any()); - FunctionRequest request = new FunctionRequest(); - request.setRequestInfo(getRequestInfo()); - request.setFunctions(new ArrayList()); - request.getFunctions().add(getFunctionContract()); - functionRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("function_persisted", request); - Mockito.verify(functionQueueRepository).addToSearch(message); - } - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(functionJdbcRepository.search(any(FunctionSearch.class))).thenReturn(expectedResult); - Pagination actualResult = functionRepository.search(getFunctionSearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSearch1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(functionESRepository.search(any(FunctionSearchContract.class))).thenReturn(expectedResult); - Pagination actualResult = functionRepository.search(getFunctionSearch()); - assertEquals(expectedResult, actualResult); - } - - private FunctionContract getFunctionContract() { - return FunctionContract.builder().code("code").name("name").active(true).level(1).build(); - } - - private FunctionEntity getFunctionEntity() { - FunctionEntity entity = new FunctionEntity(); - Function function = getFunctionDomain(); - entity.setCode(function.getCode()); - entity.setName(function.getName()); - entity.setActive(function.getActive()); - entity.setLevel(function.getLevel()); - entity.setTenantId(function.getTenantId()); - return entity; - } - - private Function getFunctionDomain() { - Function function = new Function(); - function.setId("1"); - function.setCode("code"); - function.setName("name"); - function.setActive(true); - function.setLevel(1); - function.setTenantId("default"); - return function; - } - - public List getFunctionDomains() { - List functions = new ArrayList<>(); - functions.add(getFunctionDomain()); - return functions; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private FunctionSearch getFunctionSearch() { - FunctionSearch functionSearch = new FunctionSearch(); - functionSearch.setPageSize(500); - functionSearch.setOffset(0); - functionSearch.setSortBy("name desc"); - return functionSearch; - } - - private List getFunctions() { - List functions = new ArrayList(); - Function function = Function.builder().id("1").name("name").code("code").level(1).active(true).build(); - function.setTenantId("default"); - functions.add(function); - return functions; - } - - private FunctionSearchContract getFunctionSearchContract() { - FunctionSearchContract functionSearchContract = new FunctionSearchContract(); - functionSearchContract.setPageSize(0); - functionSearchContract.setOffset(0); - functionSearchContract.setSortBy("name desc"); - return functionSearchContract; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/FundRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/FundRepositoryTest.java deleted file mode 100644 index 556d44f8041..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/FundRepositoryTest.java +++ /dev/null @@ -1,265 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.FundSearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.FundEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.FundJdbcRepository; -import org.egov.egf.master.web.contract.FundContract; -import org.egov.egf.master.web.contract.FundSearchContract; -import org.egov.egf.master.web.requests.FundRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class FundRepositoryTest { - - private FundRepository fundRepositoryWithKafka; - private FundRepository fundRepositoryWithOutKafka; - - @InjectMocks - private FundRepository fundRepository; - - @Mock - private FundJdbcRepository fundJdbcRepository; - - @Mock - private MastersQueueRepository fundQueueRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - @Mock - private FundESRepository fundESRepository; - - @Captor - private ArgumentCaptor> captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - fundRepositoryWithKafka = new FundRepository(fundJdbcRepository, fundQueueRepository, financialConfigurationService, - fundESRepository, "yes"); - fundRepositoryWithOutKafka = new FundRepository(fundJdbcRepository, fundQueueRepository, financialConfigurationService, - fundESRepository, "no"); - - } - - @Test - public void testFindById() { - FundEntity fundEntity = getFundEntity(); - Fund expectedResult = fundEntity.toDomain(); - when(fundJdbcRepository.findById(any(FundEntity.class))).thenReturn(fundEntity); - Fund actualResult = fundRepository.findById(getFundDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSave() { - List expectedResult = getFunds(); - requestInfo.setAction(Constants.ACTION_CREATE); - fundRepositoryWithKafka.save(expectedResult, requestInfo); - verify(fundQueueRepository).add(captor.capture()); - } - - @Test - public void testSave1() { - List expectedResult = getFunds(); - FundEntity entity = new FundEntity().toEntity(expectedResult.get(0)); - when(fundJdbcRepository.create(any(FundEntity.class))).thenReturn(entity); - fundRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(fundQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testSavee() { - FundEntity fundEntity = getFundEntity(); - Fund expectedResult = fundEntity.toDomain(); - when(fundJdbcRepository.create(any(FundEntity.class))).thenReturn(fundEntity); - Fund actualResult = fundRepository.save(getFundDomain()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testUpdate() { - List expectedResult = getFunds(); - requestInfo.setAction(Constants.ACTION_CREATE); - fundRepositoryWithKafka.update(expectedResult, requestInfo); - verify(fundQueueRepository).add(captor.capture()); - } - - @Test - public void testUpdate1() { - List expectedResult = getFunds(); - FundEntity entity = new FundEntity().toEntity(expectedResult.get(0)); - when(fundJdbcRepository.update(any(FundEntity.class))).thenReturn(entity); - fundRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(fundQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void testUpdatee() { - FundEntity fundEntity = getFundEntity(); - Fund expectedResult = fundEntity.toDomain(); - when(fundJdbcRepository.update(any(FundEntity.class))).thenReturn(fundEntity); - Fund actualResult = fundRepository.update(getFundDomain()); - assertEquals(expectedResult, actualResult); - } - - /* @Test - public void testAddToQue() { - Mockito.doNothing().when(fundQueueRepository).add(Mockito.any()); - FundRequest request = new FundRequest(); - request.setRequestInfo(getRequestInfo()); - request.setFunds(new ArrayList()); - request.getFunds().add(getFundContract()); - // fundRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("fund_create", request); - Mockito.verify(fundQueueRepository).add(message); - }*/ - -/* @Test - public void testAddToQue1() { - Mockito.doNothing().when(fundQueueRepository).add(Mockito.any()); - FundRequest request = new FundRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setFunds(new ArrayList()); - request.getFunds().add(getFundContract()); - fundRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("fund_update", request); - Mockito.verify(fundQueueRepository).add(message); - } -*/ - /* @Test - public void testAddToSearchQueue() { - Mockito.doNothing().when(fundQueueRepository).add(Mockito.any()); - FundRequest request = new FundRequest(); - request.setRequestInfo(getRequestInfo()); - request.setFunds(new ArrayList()); - request.getFunds().add(getFundContract()); - fundRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("fund_persisted", request); - Mockito.verify(fundQueueRepository).addToSearch(message); - }*/ - - @Test - public void testSearch() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(fundJdbcRepository.search(any(FundSearch.class))).thenReturn(expectedResult); - Pagination actualResult = fundRepository.search(getFundSearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void testSearch1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(fundESRepository.search(any(FundSearchContract.class))).thenReturn(expectedResult); - Pagination actualResult = fundRepository.search(getFundSearch()); - assertEquals(expectedResult, actualResult); - } - - private FundContract getFundContract() { - return FundContract.builder().code("code").name("name").active(true).level(1234l).build(); - } - - private FundEntity getFundEntity() { - FundEntity entity = new FundEntity(); - Fund fund = getFundDomain(); - entity.setCode(fund.getCode()); - entity.setName(fund.getName()); - entity.setActive(fund.getActive()); - entity.setLevel(fund.getLevel()); - entity.setTenantId(fund.getTenantId()); - return entity; - } - - private Fund getFundDomain() { - Fund fund = new Fund(); - fund.setId("1"); - fund.setCode("code"); - fund.setName("name"); - fund.setActive(true); - fund.setLevel(1234l); - fund.setTenantId("default"); - return fund; - } - - public List getFundDomains() { - List funds = new ArrayList<>(); - funds.add(getFundDomain()); - return funds; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private FundSearch getFundSearch() { - FundSearch fundSearch = new FundSearch(); - fundSearch.setPageSize(500); - fundSearch.setOffset(0); - fundSearch.setSortBy("name desc"); - return fundSearch; - } - - private List getFunds() { - List funds = new ArrayList(); - Fund fund = Fund.builder().id("1").name("name").code("code").identifier('I').level(1234l).active(true).build(); - fund.setTenantId("default"); - funds.add(fund); - return funds; - } - - private FundSearchContract getFundSearchContract() { - FundSearchContract fundSearchContract = new FundSearchContract(); - fundSearchContract.setPageSize(0); - fundSearchContract.setOffset(0); - fundSearchContract.setSortBy("name desc"); - return fundSearchContract; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/RecoveryRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/RecoveryRepositoryTest.java deleted file mode 100644 index 583c352c543..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/repository/RecoveryRepositoryTest.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.egov.egf.master.domain.repository; - -import org.egov.common.constants.Constants; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.Recovery; -import org.egov.egf.master.domain.model.RecoverySearch; -import org.egov.egf.master.domain.service.FinancialConfigurationService; -import org.egov.egf.master.persistence.entity.RecoveryEntity; -import org.egov.egf.master.persistence.queue.MastersQueueRepository; -import org.egov.egf.master.persistence.repository.RecoveryJdbcRepository; -import org.egov.egf.master.web.contract.RecoveryContract; -import org.egov.egf.master.web.contract.RecoverySearchContract; -import org.egov.egf.master.web.requests.RecoveryRequest; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.*; -import org.mockito.runners.MockitoJUnitRunner; - -import java.util.*; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class RecoveryRepositoryTest { - - private RecoveryRepository recoveryRepositoryWithKafka; - private RecoveryRepository recoveryRepositoryWithOutKafka; - - @InjectMocks - private RecoveryRepository recoveryRepository; - - @Mock - private RecoveryJdbcRepository recoveryJdbcRepository; - - @Mock - private MastersQueueRepository recoveryQueueRepository; - - @Mock - private FinancialConfigurationService financialConfigurationService; - - @Mock - private RecoveryESRepository recoveryESRepository; - - @Captor - private ArgumentCaptor> captor; - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - recoveryRepositoryWithKafka = new RecoveryRepository(recoveryQueueRepository, financialConfigurationService, "yes", recoveryJdbcRepository, - recoveryESRepository); - recoveryRepositoryWithOutKafka = new RecoveryRepository(recoveryQueueRepository, financialConfigurationService, "no", recoveryJdbcRepository, - recoveryESRepository); - - } - - @Test - public void test_findbyid() { - RecoveryEntity recoveryEntity = getRecoveryEntity(); - Recovery expectedResult = recoveryEntity.toDomain(); - when(recoveryJdbcRepository.findById(any(RecoveryEntity.class))).thenReturn(recoveryEntity); - Recovery actualResult = recoveryRepository.findById(getRecoveryDomain()); - assertEquals(expectedResult.getCode(), actualResult.getCode()); - } - - @Test - public void test_save() { - List expectedResult = getRecoverys(); - requestInfo.setAction(Constants.ACTION_CREATE); - recoveryRepositoryWithKafka.save(expectedResult, requestInfo); - verify(recoveryQueueRepository).add(captor.capture()); - } - - @Test - public void test_save1() { - List expectedResult = getRecoverys(); - RecoveryEntity entity = new RecoveryEntity().toEntity(expectedResult.get(0)); - when(recoveryJdbcRepository.create(any(RecoveryEntity.class))).thenReturn(entity); - recoveryRepositoryWithOutKafka.save(expectedResult, requestInfo); - verify(recoveryQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void test_savee() { - RecoveryEntity recoveryEntity = getRecoveryEntity(); - Recovery expectedResult = recoveryEntity.toDomain(); - when(recoveryJdbcRepository.create(any(RecoveryEntity.class))).thenReturn(recoveryEntity); - Recovery actualResult = recoveryRepository.save(getRecoveryDomain()); - assertEquals(expectedResult.getCode(), actualResult.getCode()); - } - - @Test - public void test_update() { - List expectedResult = getRecoverys(); - requestInfo.setAction(Constants.ACTION_CREATE); - recoveryRepositoryWithKafka.update(expectedResult, requestInfo); - verify(recoveryQueueRepository).add(captor.capture()); - } - - @Test - public void test_update1() { - List expectedResult = getRecoverys(); - RecoveryEntity entity = new RecoveryEntity().toEntity(expectedResult.get(0)); - when(recoveryJdbcRepository.update(any(RecoveryEntity.class))).thenReturn(entity); - recoveryRepositoryWithOutKafka.update(expectedResult, requestInfo); - verify(recoveryQueueRepository).addToSearch(any(Map.class)); - } - - @Test - public void test_updatee() { - RecoveryEntity recoveryEntity = getRecoveryEntity(); - Recovery expectedResult = recoveryEntity.toDomain(); - when(recoveryJdbcRepository.update(any(RecoveryEntity.class))).thenReturn(recoveryEntity); - Recovery actualResult = recoveryRepository.update(getRecoveryDomain()); - assertEquals(expectedResult.getCode(), actualResult.getCode()); - } - - @Test - public void test_addtoque() { - Mockito.doNothing().when(recoveryQueueRepository).add(Mockito.any()); - RecoveryRequest request = new RecoveryRequest(); - request.setRequestInfo(getRequestInfo()); - request.setRecoverys(new ArrayList()); - request.getRecoverys().add(getRecoveryContract()); - recoveryRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("recovery_create", request); - Mockito.verify(recoveryQueueRepository).add(message); - } - - @Test - public void test_addtoque1() { - Mockito.doNothing().when(recoveryQueueRepository).add(Mockito.any()); - RecoveryRequest request = new RecoveryRequest(); - request.setRequestInfo(getRequestInfo()); - request.getRequestInfo().setAction(Constants.ACTION_UPDATE); - request.setRecoverys(new ArrayList()); - request.getRecoverys().add(getRecoveryContract()); - recoveryRepository.addToQue(request); - Map message = new HashMap<>(); - message.put("recovery_update", request); - Mockito.verify(recoveryQueueRepository).add(message); - } - - @Test - public void test_addtosearchqueue() { - Mockito.lenient().doNothing().when(recoveryQueueRepository).add(Mockito.any()); - RecoveryRequest request = new RecoveryRequest(); - request.setRequestInfo(getRequestInfo()); - request.setRecoverys(new ArrayList()); - request.getRecoverys().add(getRecoveryContract()); - recoveryRepository.addToSearchQueue(request); - Map message = new HashMap<>(); - message.put("recovery_persisted", request); - Mockito.verify(recoveryQueueRepository).addToSearch(message); - } - - @Test - public void test_search() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("db"); - when(recoveryJdbcRepository.search(any(RecoverySearch.class))).thenReturn(expectedResult); - Pagination actualResult = recoveryRepository.search(getRecoverySearch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public void test_search1() { - Pagination expectedResult = new Pagination<>(); - expectedResult.setPageSize(500); - expectedResult.setOffset(0); - when(financialConfigurationService.fetchDataFrom()).thenReturn("es"); - when(recoveryESRepository.search(any(RecoverySearchContract.class))).thenReturn(expectedResult); - Pagination actualResult = recoveryRepository.search(getRecoverySearch()); - assertEquals(expectedResult, actualResult); - } - - private RecoveryContract getRecoveryContract() { - return RecoveryContract.builder().id("1").name("name").code("code").type("M").accountNumber("30492234547").active(true). - remittanceMode('M').remitted("ritesh").build(); - } - - private RecoveryEntity getRecoveryEntity() { - RecoveryEntity entity = new RecoveryEntity(); - Recovery recovery = getRecoveryDomain(); - entity.setId(recovery.getId()); - entity.setCode(recovery.getCode()); - entity.setName(recovery.getName()); - entity.setActive(recovery.getActive()); - entity.setType(recovery.getType()); - entity.setAccountNumber(recovery.getAccountNumber()); - entity.setRemittanceMode(recovery.getRemittanceMode()); - entity.setRemitted(recovery.getRemitted()); - entity.setTenantId(recovery.getTenantId()); - return entity; - } - - private Recovery getRecoveryDomain() { - Recovery recovery = new Recovery(); - recovery.setId("1"); - recovery.setCode("code"); - recovery.setName("name"); - recovery.setActive(true); - recovery.setType("M"); - recovery.setAccountNumber("30492234547"); - recovery.setRemittanceMode('M'); - recovery.setRemitted("ritesh"); - recovery.setTenantId("default"); - return recovery; - } - - public List getRecoveryDomains() { - List recoverys = new ArrayList<>(); - recoverys.add(getRecoveryDomain()); - return recoverys; - } - - private RequestInfo getRequestInfo() { - RequestInfo info = new RequestInfo(); - User user = new User(); - user.setId(1l); - info.setAction(Constants.ACTION_CREATE); - info.setDid("did"); - info.setApiId("apiId"); - info.setKey("key"); - info.setMsgId("msgId"); - info.setTs(new Date()); - info.setUserInfo(user); - info.setAuthToken("null"); - return info; - } - - private RecoverySearch getRecoverySearch() { - RecoverySearch recoverySearch = new RecoverySearch(); - recoverySearch.setPageSize(500); - recoverySearch.setOffset(0); - recoverySearch.setSortBy("name desc"); - return recoverySearch; - } - - private List getRecoverys() { - List recoverys = new ArrayList(); - Recovery recovery = Recovery.builder().id("1").name("name").code("code").type("M").accountNumber("30492234547").active(true). - remittanceMode('M').remitted("ritesh").build(); - recovery.setTenantId("default"); - recovery.setChartOfAccount(getChartOfAccount()); - recoverys.add(recovery); - return recoverys; - } - - private RecoverySearchContract getRecoverySearchContract() { - RecoverySearchContract recoverySearchContract = new RecoverySearchContract(); - recoverySearchContract.setPageSize(0); - recoverySearchContract.setOffset(0); - recoverySearchContract.setSortBy("name desc"); - return recoverySearchContract; - } - - private ChartOfAccount getChartOfAccount() { - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("1") - .glcode("glcode").name("name") - .description("description").isActiveForPosting(true) - .type('A').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountCodePurposeServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountCodePurposeServiceTest.java deleted file mode 100644 index 9efc4a8a8ef..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountCodePurposeServiceTest.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.AccountCodePurposeSearch; -import org.egov.egf.master.domain.repository.AccountCodePurposeRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class AccountCodePurposeServiceTest { - - @InjectMocks - private AccountCodePurposeService accountCodePurposeService; - - @Mock - private SmartValidator validator; - - @Mock - private AccountCodePurposeRepository accountCodePurposeRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - private RequestInfo requestInfo = new RequestInfo(); - private List accountCodePurposes = new ArrayList<>(); - - @Before - public void setup() { - } - - @Test - public final void testCreate() { - accountCodePurposes.add(getAccountCodePurpose()); - when(accountCodePurposeRepository.uniqueCheck(any(String.class), any(AccountCodePurpose.class))) - .thenReturn(true); - accountCodePurposeService.create(accountCodePurposes, errors, requestInfo); - } - - @Test - public final void testUpdate() { - accountCodePurposes.add(getAccountCodePurpose()); - when(accountCodePurposeRepository.uniqueCheck(any(String.class), any(AccountCodePurpose.class))) - .thenReturn(true); - accountCodePurposeService.update(accountCodePurposes, errors, requestInfo); - } - - @Test - public final void testCreateInvalid() { - AccountCodePurpose accountCodePurpose = AccountCodePurpose.builder().id("a").name("name").build(); - when(accountCodePurposeRepository.uniqueCheck(any(String.class), any(AccountCodePurpose.class))) - .thenReturn(true); - accountCodePurposes.add(accountCodePurpose); - accountCodePurposeService.create(accountCodePurposes, errors, requestInfo); - } - - @Test - public final void test_save() { - AccountCodePurpose expextedResult = getAccountCodePurposes().get(0); - when(accountCodePurposeRepository.save(any(AccountCodePurpose.class))).thenReturn(expextedResult); - AccountCodePurpose actualResult = accountCodePurposeService.save(getAccountCodePurposes().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void testSearch() { - List search = new ArrayList<>(); - search.add(getAccountCodePurposeSearch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(accountCodePurposeRepository.search(any(AccountCodePurposeSearch.class))).thenReturn(expectedResult); - Pagination actualResult = accountCodePurposeService.search(getAccountCodePurposeSearch(), - errors); - assertEquals(expectedResult, actualResult); - - } - - @Test - public final void test_update() { - AccountCodePurpose expextedResult = getAccountCodePurposes().get(0); - when(accountCodePurposeRepository.update(any(AccountCodePurpose.class))).thenReturn(expextedResult); - AccountCodePurpose actualResult = accountCodePurposeService.update(getAccountCodePurposes().get(0)); - assertEquals(expextedResult, actualResult); - } - - private List getAccountCodePurposes() { - List accountCodePurposes = new ArrayList(); - AccountCodePurpose accountCodePurpose = AccountCodePurpose.builder().id("1").name("name").build(); - accountCodePurpose.setTenantId("default"); - accountCodePurposes.add(accountCodePurpose); - return accountCodePurposes; - } - - private AccountCodePurposeSearch getAccountCodePurposeSearch() { - AccountCodePurposeSearch accountCodePurposeSearch = new AccountCodePurposeSearch(); - accountCodePurposeSearch.setPageSize(0); - accountCodePurposeSearch.setOffset(0); - accountCodePurposeSearch.setSortBy("Sort"); - accountCodePurposeSearch.setTenantId("default"); - return accountCodePurposeSearch; - } - - private AccountCodePurpose getAccountCodePurpose() { - AccountCodePurpose accountCodePurpose = AccountCodePurpose.builder().id("1").name("name").build(); - accountCodePurpose.setTenantId("default"); - return accountCodePurpose; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountDetailKeyServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountDetailKeyServiceTest.java deleted file mode 100644 index f7792078cf9..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountDetailKeyServiceTest.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailKeySearch; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.repository.AccountDetailKeyRepository; -import org.egov.egf.master.domain.repository.AccountDetailTypeRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class AccountDetailKeyServiceTest { - - @InjectMocks - private AccountDetailKeyService accountDetailKeyService; - - @Mock - private SmartValidator validator; - - @Mock - private AccountDetailKeyRepository accountDetailKeyRepository; - - @Mock - private AccountDetailTypeRepository accountDetailTypeRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - private RequestInfo requestInfo = new RequestInfo(); - private List accountDetailKies = new ArrayList<>(); - - @Before - public void setup() { - } - - @Test - public final void testCreate() { - when(accountDetailTypeRepository.findById(any(AccountDetailType.class))).thenReturn(getAccountDetailType()); - when(accountDetailKeyRepository.uniqueCheck(any(String.class), any(AccountDetailKey.class))).thenReturn(true); - accountDetailKeyService.create(getAccountDetailKeys(), errors, requestInfo); - } - - @Test - public final void testUpdate() { - when(accountDetailTypeRepository.findById(any(AccountDetailType.class))).thenReturn(getAccountDetailType()); - when(accountDetailKeyRepository.uniqueCheck(any(String.class), any(AccountDetailKey.class))).thenReturn(true); - accountDetailKeyService.update(getAccountDetailKeys(), errors, requestInfo); - } - - @Test - public final void testCreateInvalid() { - AccountDetailKey accountDetailKey1 = AccountDetailKey.builder().id("a").key("1").accountDetailType(null) - .build(); - accountDetailKies.add(accountDetailKey1); - when(accountDetailKeyRepository.uniqueCheck(any(String.class), any(AccountDetailKey.class))).thenReturn(true); - accountDetailKeyService.create(accountDetailKies, errors, requestInfo); - } - - @Test - public final void test_save() { - AccountDetailKey expextedResult = getAccountDetailKeys().get(0); - when(accountDetailKeyRepository.save(any(AccountDetailKey.class))).thenReturn(expextedResult); - AccountDetailKey actualResult = accountDetailKeyService.save(getAccountDetailKeys().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void testSearch() { - List search = new ArrayList<>(); - search.add(getAccountDetailKeySearch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(accountDetailKeyRepository.search(any(AccountDetailKeySearch.class))).thenReturn(expectedResult); - Pagination actualResult = accountDetailKeyService.search(getAccountDetailKeySearch(), errors); - assertEquals(expectedResult, actualResult); - - } - - @Test - public final void test_update() { - AccountDetailKey expextedResult = getAccountDetailKeys().get(0); - when(accountDetailKeyRepository.update(any(AccountDetailKey.class))).thenReturn(expextedResult); - AccountDetailKey actualResult = accountDetailKeyService.update(getAccountDetailKeys().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_fetch_related_data() { - List expextedResult = new ArrayList<>(); - expextedResult.add(getAccountDetailType()); - List accountDetailKies = new ArrayList<>(); - accountDetailKies.add(getAccountDetailKey()); - when(accountDetailTypeRepository.findById(any(AccountDetailType.class))).thenReturn(getAccountDetailType()); - List actualResult = accountDetailKeyService.fetchRelated(accountDetailKies); - assertEquals(expextedResult.get(0).getId(), actualResult.get(0).getAccountDetailType().getId()); - assertEquals(expextedResult.get(0).getName(), actualResult.get(0).getAccountDetailType().getName()); - } - - @Test(expected = InvalidDataException.class) - public final void test_fetch_related_data_when_parentid_is_wrong() { - List expextedResult = new ArrayList<>(); - expextedResult.add(getAccountDetailType()); - List accountDetailKies = new ArrayList<>(); - accountDetailKies.add(getAccountDetailKey()); - when(accountDetailKeyRepository.findById(any(AccountDetailKey.class))).thenReturn(null); - accountDetailKeyService.fetchRelated(accountDetailKies); - } - - private List getAccountDetailKeys() { - List accountDetailKies = new ArrayList(); - AccountDetailKey accountDetailKey = AccountDetailKey.builder().id("1").key("1") - .accountDetailType(getAccountDetailType()).build(); - accountDetailKey.setTenantId("default"); - accountDetailKies.add(accountDetailKey); - return accountDetailKies; - } - - private AccountDetailKeySearch getAccountDetailKeySearch() { - AccountDetailKeySearch accountDetailKeySearch = new AccountDetailKeySearch(); - accountDetailKeySearch.setPageSize(0); - accountDetailKeySearch.setOffset(0); - accountDetailKeySearch.setSortBy("Sort"); - accountDetailKeySearch.setTenantId("default"); - return accountDetailKeySearch; - } - - private AccountDetailKey getAccountDetailKey() { - AccountDetailKey accountDetailKey = AccountDetailKey.builder().id("1").key("1") - .accountDetailType(getAccountDetailType()).build(); - accountDetailKey.setTenantId("default"); - return accountDetailKey; - } - - private AccountDetailType getAccountDetailType() { - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("contractor") - .fullyQualifiedName("abc/acb").active(true).build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountDetailTypeServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountDetailTypeServiceTest.java deleted file mode 100644 index 3f7516637fd..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountDetailTypeServiceTest.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; -import org.egov.egf.master.domain.repository.AccountDetailTypeRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class AccountDetailTypeServiceTest { - - @InjectMocks - private AccountDetailTypeService accountDetailTypeService; - - @Mock - private SmartValidator validator; - - @Mock - private AccountDetailTypeRepository accountDetailTypeRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - private RequestInfo requestInfo = new RequestInfo(); - private List accountDetailTypes = new ArrayList<>(); - - @Before - public void setup() { - } - - @Test - public final void testCreate() { - when(accountDetailTypeRepository.uniqueCheck(any(String.class), any(AccountDetailType.class))).thenReturn(true); - accountDetailTypeService.create(getAccountDetailTypes(), errors, requestInfo); - } - - @Test - public final void testUpdate() { - when(accountDetailTypeRepository.uniqueCheck(any(String.class), any(AccountDetailType.class))).thenReturn(true); - accountDetailTypeService.update(getAccountDetailTypes(), errors, requestInfo); - } - - @Test - public final void testCreateInvalid() { - AccountDetailType accountDetailType1 = AccountDetailType.builder().id("a").tableName("contractor") - .fullyQualifiedName("abc/contractor").active(true).build(); - accountDetailTypes.add(accountDetailType1); - when(accountDetailTypeRepository.uniqueCheck(any(String.class), any(AccountDetailType.class))).thenReturn(true); - accountDetailTypeService.create(accountDetailTypes, errors, requestInfo); - } - - @Test - public final void test_save() { - AccountDetailType expextedResult = getAccountDetailTypes().get(0); - when(accountDetailTypeRepository.save(any(AccountDetailType.class))).thenReturn(expextedResult); - AccountDetailType actualResult = accountDetailTypeService.save(getAccountDetailTypes().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void testSearch() { - List search = new ArrayList<>(); - search.add(getAccountDetailTypeSearch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(accountDetailTypeRepository.search(any(AccountDetailTypeSearch.class))).thenReturn(expectedResult); - Pagination actualResult = accountDetailTypeService.search(getAccountDetailTypeSearch(), - errors); - assertEquals(expectedResult, actualResult); - - } - - @Test - public final void test_update() { - AccountDetailType expextedResult = getAccountDetailTypes().get(0); - when(accountDetailTypeRepository.update(any(AccountDetailType.class))).thenReturn(expextedResult); - AccountDetailType actualResult = accountDetailTypeService.update(getAccountDetailTypes().get(0)); - assertEquals(expextedResult, actualResult); - } - - private List getAccountDetailTypes() { - List accountDetailTypes = new ArrayList(); - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("contractor") - .fullyQualifiedName("abc/contractor").active(true).build(); - accountDetailType.setTenantId("default"); - accountDetailTypes.add(accountDetailType); - return accountDetailTypes; - } - - private AccountDetailTypeSearch getAccountDetailTypeSearch() { - AccountDetailTypeSearch accountDetailTypeSearch = new AccountDetailTypeSearch(); - accountDetailTypeSearch.setPageSize(0); - accountDetailTypeSearch.setOffset(0); - accountDetailTypeSearch.setSortBy("Sort"); - accountDetailTypeSearch.setTenantId("default"); - return accountDetailTypeSearch; - } - - private AccountDetailType getAccountDetailType() { - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").active(true) - .tableName("contractor").fullyQualifiedName("abc/contractor").build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountEntityServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountEntityServiceTest.java deleted file mode 100644 index 2d8cdb0ee77..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/AccountEntityServiceTest.java +++ /dev/null @@ -1,157 +0,0 @@ -package org.egov.egf.master.domain.service; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.domain.model.AccountEntitySearch; -import org.egov.egf.master.domain.repository.AccountDetailTypeRepository; -import org.egov.egf.master.domain.repository.AccountEntityRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class AccountEntityServiceTest { - - @InjectMocks - private AccountEntityService accountEntityService; - - @Mock - private SmartValidator validator; - - @Mock - private AccountDetailTypeRepository accountDetailTypeRepository; - - @Mock - private AccountEntityRepository accountEntityRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - private RequestInfo requestInfo = new RequestInfo(); - private List accountEntities = new ArrayList<>(); - - @Before - public void setup() { - } - - @Test - public final void testCreate() { - when(accountDetailTypeRepository.findById(any(AccountDetailType.class))).thenReturn(getAccountDetaialType()); - when(accountEntityRepository.uniqueCheck(any(String.class), any(AccountEntity.class))).thenReturn(true); - accountEntityService.create(getAccountEntitys(), errors, requestInfo); - } - - @Test - public final void testUpdate() { - when(accountDetailTypeRepository.findById(any(AccountDetailType.class))).thenReturn(getAccountDetaialType()); - when(accountEntityRepository.uniqueCheck(any(String.class), any(AccountEntity.class))).thenReturn(true); - accountEntityService.update(getAccountEntitys(), errors, requestInfo); - } - - @Test - public final void testCreateInvalid() { - AccountEntity accountEntity1 = AccountEntity.builder().id("a").code("code").active(true).accountDetailType(null).build(); - accountEntities.add(accountEntity1); - when(accountEntityRepository.uniqueCheck(any(String.class), any(AccountEntity.class))).thenReturn(true); - accountEntityService.create(accountEntities, errors, requestInfo); - } - - @Test - public final void test_save() { - AccountEntity expextedResult = getAccountEntitys().get(0); - when(accountEntityRepository.save(any(AccountEntity.class))).thenReturn(expextedResult); - AccountEntity actualResult = accountEntityService.save(getAccountEntitys().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void testSearch() { - List search = new ArrayList<>(); - search.add(getAccountEntitySearch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(accountEntityRepository.search(any(AccountEntitySearch.class))).thenReturn(expectedResult); - Pagination actualResult = accountEntityService.search(getAccountEntitySearch(), errors); - assertEquals(expectedResult, actualResult); - - } - - @Test - public final void test_update() { - AccountEntity expextedResult = getAccountEntitys().get(0); - when(accountEntityRepository.update(any(AccountEntity.class))).thenReturn(expextedResult); - AccountEntity actualResult = accountEntityService.update(getAccountEntitys().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_fetch_related_data() { - List expextedResult = new ArrayList<>(); - expextedResult.add(getAccountDetaialType()); - List accountEntities = new ArrayList<>(); - accountEntities.add(getAccountEntity()); - when(accountDetailTypeRepository.findById(any(AccountDetailType.class))).thenReturn(getAccountDetaialType()); - List actualResult = accountEntityService.fetchRelated(accountEntities); - assertEquals(expextedResult.get(0).getId(), actualResult.get(0).getAccountDetailType().getId()); - assertEquals(expextedResult.get(0).getName(), actualResult.get(0).getAccountDetailType().getName()); - } - - @Test(expected = InvalidDataException.class) - public final void test_fetch_related_data_when_parentid_is_wrong() { - List expextedResult = new ArrayList<>(); - expextedResult.add(getAccountDetaialType()); - List accountEntities = new ArrayList<>(); - accountEntities.add(getAccountEntity()); - when(accountEntityRepository.findById(any(AccountEntity.class))).thenReturn(null); - accountEntityService.fetchRelated(accountEntities); - } - - private List getAccountEntitys() { - List accountEntities = new ArrayList(); - AccountEntity accountEntity = AccountEntity.builder().id("1").name("name").code("code").accountDetailType(getAccountDetaialType()).active(true).build(); - accountEntity.setTenantId("default"); - accountEntities.add(accountEntity); - return accountEntities; - } - - private AccountEntitySearch getAccountEntitySearch() { - AccountEntitySearch accountEntitySearch = new AccountEntitySearch(); - accountEntitySearch.setPageSize(0); - accountEntitySearch.setOffset(0); - accountEntitySearch.setSortBy("Sort"); - accountEntitySearch.setTenantId("default"); - return accountEntitySearch; - } - - private AccountEntity getAccountEntity() { - AccountEntity accountEntity = AccountEntity.builder().id("1").name("accountEntity").code("001").active(true) - .accountDetailType(getAccountDetaialType()).build(); - accountEntity.setTenantId("default"); - return accountEntity; - } - - private AccountDetailType getAccountDetaialType() { - - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("table") - .fullyQualifiedName("abc/table").build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/BankAccountServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/BankAccountServiceTest.java deleted file mode 100644 index 9464ac15d4e..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/BankAccountServiceTest.java +++ /dev/null @@ -1,211 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.CustomBindException; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankAccountSearch; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.repository.BankAccountRepository; -import org.egov.egf.master.domain.repository.BankBranchRepository; -import org.egov.egf.master.domain.repository.ChartOfAccountRepository; -import org.egov.egf.master.domain.repository.FundRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class BankAccountServiceTest { - - @InjectMocks - private BankAccountService bankAccountService; - - @Mock - private SmartValidator validator; - - @Mock - private BankAccountRepository bankAccountRepository; - - @Mock - private BankBranchRepository bankBranchRepository; - - @Mock - private ChartOfAccountRepository chartOfAccountRepository; - - @Mock - private FundRepository fundRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - - private List bankAccounts = new ArrayList<>(); - - private RequestInfo requestInfo = new RequestInfo(); - - @Before - public void setup() { - - } - - @Test - public final void testCreate() { - bankAccounts.add(getBankAccount()); - when(bankBranchRepository.findById(any(BankBranch.class))).thenReturn(getBankBranch()); - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - when(fundRepository.findById(any(Fund.class))).thenReturn(getFund()); - when(bankAccountRepository.uniqueCheck(anyString(), any(BankAccount.class))).thenReturn(true); - bankAccountService.create(bankAccounts, errors, requestInfo); - } - - @Test - public final void testUpdate() { - bankAccounts.add(getBankAccount()); - when(bankBranchRepository.findById(any(BankBranch.class))).thenReturn(getBankBranch()); - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - when(fundRepository.findById(any(Fund.class))).thenReturn(getFund()); - when(bankAccountRepository.uniqueCheck(anyString(), any(BankAccount.class))).thenReturn(true); - bankAccountService.update(bankAccounts, errors, requestInfo); - } - - @Test - public final void test_save() { - BankAccount expextedResult = getBankAccount(); - when(bankAccountRepository.save(any(BankAccount.class))).thenReturn(getBankAccount()); - BankAccount actualResult = bankAccountService.save(getBankAccount()); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void testSearch() { - List search = new ArrayList<>(); - search.add(getBankAccount()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(bankAccountRepository.search(any(BankAccountSearch.class))).thenReturn(expectedResult); - Pagination actualResult = bankAccountService.search(getBankAccountSearch(), errors); - assertEquals(expectedResult, actualResult); - } - - @Test(expected = InvalidDataException.class) - public final void testSearchInvalid() { - List search = new ArrayList<>(); - search.add(getBankAccount()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(bankAccountRepository.search(any(BankAccountSearch.class))).thenReturn(expectedResult); - BankAccountSearch b = getBankAccountSearch(); - b.setTenantId(null); - Pagination actualResult = bankAccountService.search(b, errors); - } - - @Test - public final void testSave() { - BankAccount expectedResult = getBankAccount(); - when(bankAccountRepository.save(any(BankAccount.class))).thenReturn(expectedResult); - final BankAccount actualResult = bankAccountService.save(getBankAccount()); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void test_Update() { - BankAccount expectedResult = getBankAccount(); - when(bankAccountRepository.update(any(BankAccount.class))).thenReturn(expectedResult); - final BankAccount actualResult = bankAccountService.update(getBankAccount()); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void test_fetch_related_data() { - List expextedResult = new ArrayList<>(); - List bankAccounts = new ArrayList<>(); - expextedResult.add(getBankAccount()); - bankAccounts.add(getBankAccount()); - when(bankBranchRepository.findById(any(BankBranch.class))).thenReturn(getBankBranch()); - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - when(fundRepository.findById(any(Fund.class))).thenReturn(getFund()); - List actualResult = bankAccountService.fetchRelated(bankAccounts); - assertEquals(expextedResult.get(0).getBankBranch().getId(), actualResult.get(0).getBankBranch().getId()); - assertEquals(expextedResult.get(0).getFund().getId(), actualResult.get(0).getFund().getId()); - assertEquals(expextedResult.get(0).getChartOfAccount().getId(), - actualResult.get(0).getChartOfAccount().getId()); - } - - @Test(expected = CustomBindException.class) - public final void testCreateInvalid() { - bankAccounts.add(getBankAccount()); - when(bankBranchRepository.findById(any(BankBranch.class))).thenReturn(getBankBranch()); - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - when(fundRepository.findById(any(Fund.class))).thenReturn(getFund()); - when(bankAccountRepository.uniqueCheck(anyString(), any(BankAccount.class))).thenReturn(false); - bankAccountService.create(bankAccounts, errors, requestInfo); - } - - private Bank getBank() { - Bank bank = Bank.builder().id("1").code("code").description("description").build(); - bank.setTenantId("default"); - return bank; - } - - private BankBranch getBankBranch() { - BankBranch bankBranch = BankBranch.builder().code("code").build(); - bankBranch.setTenantId("default"); - bankBranch.setBank(getBank()); - return bankBranch; - } - - private ChartOfAccount getChartOfAccount() { - ChartOfAccount parent = ChartOfAccount.builder().id("parent").build(); - ChartOfAccount chartOfAccount = ChartOfAccount.builder().glcode("glcode").name("name") - .description("description").isActiveForPosting(true).type('B').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).build(); - chartOfAccount.setAccountCodePurpose(getAccountCodePurpose()); - chartOfAccount.setParentId(parent); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } - - private AccountCodePurpose getAccountCodePurpose() { - AccountCodePurpose acp = AccountCodePurpose.builder().id("id").name("name").build(); - acp.setTenantId("default"); - return acp; - } - - private Fund getFund() { - return Fund.builder().id("1").code("code").build(); - } - - private BankAccount getBankAccount() { - return BankAccount.builder().id("1").chartOfAccount(getChartOfAccount()).fund(getFund()) - .bankBranch(getBankBranch()).build(); - } - - private BankAccountSearch getBankAccountSearch() { - BankAccountSearch bankAccountSearch = new BankAccountSearch(); - bankAccountSearch.setTenantId("default"); - bankAccountSearch.setPageSize(0); - bankAccountSearch.setOffset(0); - bankAccountSearch.setSortBy("Sort"); - return bankAccountSearch; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/BankBranchServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/BankBranchServiceTest.java deleted file mode 100644 index 6cfd9edff52..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/BankBranchServiceTest.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.BankBranchSearch; -import org.egov.egf.master.domain.repository.BankBranchRepository; -import org.egov.egf.master.domain.repository.BankRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class BankBranchServiceTest { - - @InjectMocks - private BankBranchService bankBranchService; - - @Mock - private SmartValidator validator; - - @Mock - private BankBranchRepository bankBranchRepository; - - @Mock - private BankRepository bankRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - - private RequestInfo requestInfo = new RequestInfo(); - - private List bankBranches = new ArrayList<>(); - - @Before - public void setup() { - - } - - @Test - public final void testCreate() { - bankBranches.add(getBankBranch()); - when(bankRepository.findById(any(Bank.class))).thenReturn(getBank()); - when(bankBranchRepository.uniqueCheck(any(String.class), any(BankBranch.class))).thenReturn(true); - bankBranchService.create(bankBranches, errors, requestInfo); - } - - @Test - public final void testUpdate() { - bankBranches.add(getBankBranch()); - when(bankRepository.findById(any(Bank.class))).thenReturn(getBank()); - when(bankBranchRepository.uniqueCheck(any(String.class), any(BankBranch.class))).thenReturn(true); - bankBranchService.update(bankBranches, errors, requestInfo); - } - - @Test - public final void testCreateInvalid() { - BankBranch bankBranch = BankBranch.builder().id("a").code("code").name("name").active(true).build(); - when(bankBranchRepository.uniqueCheck(any(String.class), any(BankBranch.class))).thenReturn(true); - bankBranches.add(bankBranch); - bankBranchService.create(bankBranches, errors, requestInfo); - } - - @Test - public final void test_save() { - BankBranch expextedResult = getBankBranch(); - when(bankBranchRepository.save(any(BankBranch.class))).thenReturn(getBankBranch()); - BankBranch actualResult = bankBranchService.save(getBankBranch()); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void testSearch() { - List search = new ArrayList<>(); - search.add(getBankBranch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(bankBranchRepository.search(any(BankBranchSearch.class))).thenReturn(expectedResult); - Pagination actualResult = bankBranchService.search(getBankBranchSearch(), errors); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void testSave() { - BankBranch expectedResult = getBankBranch(); - when(bankBranchRepository.save(any(BankBranch.class))).thenReturn(expectedResult); - final BankBranch actualResult = bankBranchService.save(getBankBranch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void test_Update() { - BankBranch expectedResult = getBankBranch(); - when(bankBranchRepository.update(any(BankBranch.class))).thenReturn(expectedResult); - final BankBranch actualResult = bankBranchService.update(getBankBranch()); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void test_fetch_related_data() { - List expextedResult = new ArrayList<>(); - List bankBranches = new ArrayList<>(); - expextedResult.add(getBankBranch()); - bankBranches.add(getBankBranch()); - when(bankRepository.findById(any(Bank.class))).thenReturn(getBank()); - List actualResult = bankBranchService.fetchRelated(bankBranches); - assertEquals(expextedResult.get(0).getBank().getId(), actualResult.get(0).getBank().getId()); - } - - private BankBranch getBankBranch() { - return BankBranch.builder().id("1").code("code").name("name").bank(getBank()).description("description") - .build(); - } - - private Bank getBank() { - return Bank.builder().id("1").code("code").description("description").build(); - } - - private BankBranchSearch getBankBranchSearch() { - BankBranchSearch bankBranchSearch = new BankBranchSearch(); - bankBranchSearch.setPageSize(0); - bankBranchSearch.setOffset(0); - bankBranchSearch.setSortBy("Sort"); - bankBranchSearch.setTenantId("default"); - return bankBranchSearch; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/BankServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/BankServiceTest.java deleted file mode 100644 index 20b84e2eda8..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/BankServiceTest.java +++ /dev/null @@ -1,133 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankSearch; -import org.egov.egf.master.domain.repository.BankRepository; -import org.egov.egf.master.domain.repository.FundRepository; -import org.egov.egf.master.persistence.repository.BankJdbcRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class BankServiceTest { - - @InjectMocks - private BankService bankService; - - @Mock - private SmartValidator validator; - - @Mock - private BankRepository bankRepository; - - @Mock - private BankJdbcRepository bankJdbcRepository; - - @Mock - private FundRepository fundRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - private RequestInfo requestInfo = new RequestInfo(); - - private List banks = new ArrayList<>(); - - @Before - public void setup() { - - } - - @Test - public final void testCreate() { - banks.add(getBank()); - when(bankRepository.uniqueCheck(any(String.class), any(Bank.class))).thenReturn(true); - bankService.create(banks, errors, requestInfo); - } - - @Test - public final void testUpdate() { - banks.add(getBank()); - when(bankRepository.uniqueCheck(any(String.class), any(Bank.class))).thenReturn(true); - bankService.update(banks, errors, requestInfo); - } - - @Test - public final void testCreateInvalid() { - Bank bank = Bank.builder().id("a").code("code").name("name").active(true).build(); - banks.add(bank); - when(bankRepository.uniqueCheck(any(String.class), any(Bank.class))).thenReturn(true); - bankService.create(banks, errors, requestInfo); - } - - @Test - public final void test_save() { - banks.add(getBank()); - Bank expextedResult = banks.get(0); - when(bankRepository.save(any(Bank.class))).thenReturn(expextedResult); - Bank actualResult = bankService.save(banks.get(0)); - assertEquals(expextedResult, actualResult); - } - @Test - public final void testFetchRelated() { - banks.add(getBank()); - bankService.fetchRelated(banks); - } - - @Test - public final void testSearch() { - List search = new ArrayList<>(); - search.add(getBank()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(bankRepository.search(any(BankSearch.class))).thenReturn(expectedResult); - Pagination actualResult = bankService.search(getBankSearch(), errors); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void testSave() { - Bank expectedResult = getBank(); - when(bankRepository.save(any(Bank.class))).thenReturn(expectedResult); - final Bank actualResult = bankService.save(getBank()); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void test_Update() { - Bank expectedResult = getBank(); - when(bankRepository.update(any(Bank.class))).thenReturn(expectedResult); - final Bank actualResult = bankService.update(getBank()); - assertEquals(expectedResult, actualResult); - } - - private Bank getBank() { - return Bank.builder().id("12212heuu").code("codeeeeee").name("nameeeee").description("description").build(); - } - - private BankSearch getBankSearch() { - BankSearch bankSearch = new BankSearch(); - bankSearch.setPageSize(0); - bankSearch.setOffset(0); - bankSearch.setSortBy("Sort"); - bankSearch.setTenantId("default"); - return bankSearch; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/ChartOfAccountDetailServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/ChartOfAccountDetailServiceTest.java deleted file mode 100644 index 7f7922208f8..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/ChartOfAccountDetailServiceTest.java +++ /dev/null @@ -1,175 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; -import org.egov.egf.master.domain.repository.AccountDetailTypeRepository; -import org.egov.egf.master.domain.repository.ChartOfAccountDetailRepository; -import org.egov.egf.master.domain.repository.ChartOfAccountRepository; -import org.egov.egf.master.web.contract.AccountDetailTypeContract; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.egov.egf.master.web.contract.ChartOfAccountDetailContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class ChartOfAccountDetailServiceTest { - - @InjectMocks - ChartOfAccountDetailService chartOfAccountDetailService; - - @Mock - private SmartValidator validator; - - @Mock - private ChartOfAccountRepository chartOfAccountRepository; - - @Mock - private ChartOfAccountDetailRepository chartOfAccountDetailRepository; - - @Mock - private AccountDetailTypeRepository accountDetailTypeRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - - private List chartOfAccountDetails = new ArrayList<>(); - - @Before - public void setup() { - - } - - @Test - public final void testFetchRelated() { - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - when(accountDetailTypeRepository.findById(any(AccountDetailType.class))).thenReturn(getAccountDetailType()); - chartOfAccountDetails.add(getChartOfAccountDetail()); - chartOfAccountDetailService.fetchRelated(chartOfAccountDetails); - } - - @Test - public final void testAdd(){ - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - when(accountDetailTypeRepository.findById(any(AccountDetailType.class))).thenReturn(getAccountDetailType()); - chartOfAccountDetails.add(getChartOfAccountDetail()); - chartOfAccountDetailService.add(chartOfAccountDetails, errors); - } - - @Test - public final void testUpdate(){ - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - when(accountDetailTypeRepository.findById(any(AccountDetailType.class))).thenReturn(getAccountDetailType()); - chartOfAccountDetails.add(getChartOfAccountDetail()); - chartOfAccountDetailService.update(chartOfAccountDetails, errors); - } - -/* @Test - public final void testAddToQue(){ - CommonRequest request = new CommonRequest<>(); - List coadcs = new ArrayList<>(); - ChartOfAccountDetailContract coadc = getChartOfAccountDetailContract(); - coadcs.add(coadc); - request.setData(coadcs); - chartOfAccountDetailService.addToQue(request); - verify(chartOfAccountDetailRepository).add(request); - }*/ - - @Test - public final void testSearch(){ - List search = new ArrayList<>(); - search.add(getChartOfAccountDetailSearch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(chartOfAccountDetailRepository.search(any(ChartOfAccountDetailSearch.class))).thenReturn(expectedResult); - Pagination actualResult = chartOfAccountDetailService.search(getChartOfAccountDetailSearch(), errors); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void testSave(){ - ChartOfAccountDetail expectedResult = getChartOfAccountDetail(); - when(chartOfAccountDetailRepository.save(any(ChartOfAccountDetail.class))).thenReturn(expectedResult); - final ChartOfAccountDetail actualResult = chartOfAccountDetailService.save(getChartOfAccountDetail()); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void test_Update(){ - ChartOfAccountDetail expectedResult = getChartOfAccountDetail(); - when(chartOfAccountDetailRepository.update(any(ChartOfAccountDetail.class))).thenReturn(expectedResult); - final ChartOfAccountDetail actualResult = chartOfAccountDetailService.update(getChartOfAccountDetail()); - assertEquals(expectedResult, actualResult); - } - - private ChartOfAccountDetail getChartOfAccountDetail() { - ChartOfAccountDetail chartOfAccountDetail = ChartOfAccountDetail.builder().id("1").build(); - chartOfAccountDetail.setChartOfAccount(getChartOfAccount()); - chartOfAccountDetail.setAccountDetailType(getAccountDetailType()); - return chartOfAccountDetail; - } - - private ChartOfAccount getChartOfAccount(){ - ChartOfAccount chartOfAccount = ChartOfAccount.builder() - .glcode("glcode").name("name") - .description("description").isActiveForPosting(true) - .type('A').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } - - private AccountDetailType getAccountDetailType(){ - AccountDetailType accountDetailType = AccountDetailType.builder() - .name("name").description("description").active(true).build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } - - private ChartOfAccountDetailContract getChartOfAccountDetailContract(){ - ChartOfAccountDetailContract chartOfAccountDetailContract = ChartOfAccountDetailContract.builder().id("1").build(); - chartOfAccountDetailContract.setChartOfAccount(getChartofAccountContract()); - chartOfAccountDetailContract.setAccountDetailType(getAccountDetailTypeContract()); - return chartOfAccountDetailContract; - } - - private ChartOfAccountContract getChartofAccountContract(){ - ChartOfAccountContract chartOfAccountContract = ChartOfAccountContract.builder().glcode("glcode").name("name").type('A').isActiveForPosting(true).isActiveForPosting(true).build(); - return chartOfAccountContract; - } - - private AccountDetailTypeContract getAccountDetailTypeContract(){ - AccountDetailTypeContract accountDetailTypeContract = AccountDetailTypeContract.builder() - .name("name").description("description").active(true).build(); - accountDetailTypeContract.setTenantId("default"); - return accountDetailTypeContract; - } - - private ChartOfAccountDetailSearch getChartOfAccountDetailSearch(){ - ChartOfAccountDetailSearch chartOfAccountDetailSearch = new ChartOfAccountDetailSearch(); - chartOfAccountDetailSearch.setPageSize(0); - chartOfAccountDetailSearch.setOffset(0); - chartOfAccountDetailSearch.setSortBy("Sort"); - chartOfAccountDetailSearch.setTenantId("default"); - return chartOfAccountDetailSearch; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/ChartOfAccountServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/ChartOfAccountServiceTest.java deleted file mode 100644 index a1449dd6445..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/ChartOfAccountServiceTest.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.domain.repository.AccountCodePurposeRepository; -import org.egov.egf.master.domain.repository.ChartOfAccountRepository; -import org.egov.egf.master.web.contract.ChartOfAccountContract; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class ChartOfAccountServiceTest { - - @InjectMocks - ChartOfAccountService chartOfAccountService; - - @Mock - private SmartValidator validator; - - @Mock - private ChartOfAccountRepository chartOfAccountRepository; - - @Mock - private AccountCodePurposeRepository accountCodePurposeRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - - private List chartOfAccounts = new ArrayList<>(); - - @Before - public void setup() { - - } - - @Test - public final void testFetchRelated() { - when(accountCodePurposeRepository.findById(any(AccountCodePurpose.class))).thenReturn(getAccountCodePurpose()); - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - chartOfAccounts.add(getChartOfAccount()); - chartOfAccountService.fetchRelated(chartOfAccounts); - - } - - @Test - public final void testAdd() { - when(accountCodePurposeRepository.findById(any(AccountCodePurpose.class))).thenReturn(getAccountCodePurpose()); - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - when(chartOfAccountRepository.uniqueCheck(any(String.class), any(ChartOfAccount.class))).thenReturn(true); - chartOfAccounts.add(getChartOfAccount()); - chartOfAccountService.add(chartOfAccounts, errors); - } - - @Test - public final void testUpdate() { - when(accountCodePurposeRepository.findById(any(AccountCodePurpose.class))).thenReturn(getAccountCodePurpose()); - when(chartOfAccountRepository.findById(any(ChartOfAccount.class))).thenReturn(getChartOfAccount()); - chartOfAccounts.add(getChartOfAccount()); - when(chartOfAccountRepository.uniqueCheck(any(String.class), any(ChartOfAccount.class))).thenReturn(true); - chartOfAccountService.update(chartOfAccounts, errors); - } - - @Test - public final void testSave() { - ChartOfAccount expectedResult = getChartOfAccount(); - when(chartOfAccountRepository.save(any(ChartOfAccount.class))).thenReturn(expectedResult); - final ChartOfAccount actualResult = chartOfAccountService.save(getChartOfAccount()); - assertEquals(expectedResult, actualResult); - } - - @Test - public final void test_Update(){ - ChartOfAccount expectedResult = getChartOfAccount(); - when(chartOfAccountRepository.update(any(ChartOfAccount.class))).thenReturn(expectedResult); - final ChartOfAccount actualResult = chartOfAccountService.update(getChartOfAccount()); - assertEquals(expectedResult, actualResult); - } - -/* @Test - public final void testAddToQue(){ - CommonRequest request = new CommonRequest<>(); - List coas = new ArrayList<>(); - ChartOfAccountContract coa = getChartOfAccountContract(); - coas.add(coa); - request.setData(coas); - chartOfAccountService.addToQue(request); - verify(chartOfAccountRepository).add(request); - }*/ - - @Test - public final void testSearch(){ - List search = new ArrayList<>(); - search.add(getChartOfAccountSearch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(chartOfAccountRepository.search(any(ChartOfAccountSearch.class))).thenReturn(expectedResult); - Pagination actualResult = chartOfAccountService.search(getChartOfAccountSearch(), errors); - assertEquals(expectedResult, actualResult); - } - - private ChartOfAccount getChartOfAccount() { - ChartOfAccount parent = ChartOfAccount.builder().id("parent").build(); - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("1") - .glcode("GLCode").name("AadharBank") - .description("DefaultDescription").isActiveForPosting(true) - .type('B').classification((long) 123456).functionRequired(true) - .budgetCheckRequired(true).build(); - chartOfAccount.setAccountCodePurpose(getAccountCodePurpose()); - chartOfAccount.setParentId(parent); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } - - private AccountCodePurpose getAccountCodePurpose() { - AccountCodePurpose acp = AccountCodePurpose.builder().id("id") - .name("name").build(); - acp.setTenantId("default"); - return acp; - } - - private ChartOfAccountContract getChartOfAccountContract(){ - ChartOfAccountContract coac = ChartOfAccountContract.builder().glcode("glcode").name("name").description("description").budgetCheckRequired(true).isActiveForPosting(true).build(); - //coac.setParentId(getChartOfAccountContract().getParentId()); - return coac; - } - - private List getChartOfAccounts() { - List chartOfAccounts = new ArrayList(); - ChartOfAccount chartOfAccount = ChartOfAccount.builder() - .glcode("GLCode").name("AadharBank") - .description("DefaultDescription").isActiveForPosting(true) - .type('B').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - chartOfAccounts.add(chartOfAccount); - return chartOfAccounts; - } - - private Pagination getPagination(){ - Pagination pgn = new Pagination<>(); - pgn.setCurrentPage(0); - pgn.setOffset(0); - pgn.setPageSize(500); - pgn.setTotalPages(1); - pgn.setTotalResults(1); - pgn.setPagedData(getChartOfAccounts()); - return pgn; - } - - private ChartOfAccountSearch getChartOfAccountSearch(){ - ChartOfAccountSearch chartOfAccountSearch = new ChartOfAccountSearch(); - chartOfAccountSearch.setPageSize(0); - chartOfAccountSearch.setOffset(0); - chartOfAccountSearch.setSortBy("Sort"); - chartOfAccountSearch.setTenantId("default"); - return chartOfAccountSearch; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/FunctionServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/FunctionServiceTest.java deleted file mode 100644 index 8c7292845eb..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/FunctionServiceTest.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.common.util.ApplicationThreadLocals; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.domain.model.FunctionSearch; -import org.egov.egf.master.domain.repository.FunctionRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class FunctionServiceTest { - - @InjectMocks - private FunctionService functionService; - - @Mock - private SmartValidator validator; - - @Mock - private FunctionRepository functionRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - private RequestInfo requestInfo = new RequestInfo(); - private List functions = new ArrayList<>(); - - @Before - public void setup() { - } - - @Test - public final void testCreate() { - when(functionRepository.findById(any(Function.class))).thenReturn(getParentFunction()); - when(functionRepository.uniqueCheck(any(String.class), any(Function.class))).thenReturn(true); - functionService.create(getFunctions(), errors, requestInfo); - } - - @Test - public final void testUpdate() { - when(functionRepository.findById(any(Function.class))).thenReturn(getParentFunction()); - when(functionRepository.uniqueCheck(any(String.class), any(Function.class))).thenReturn(true); - functionService.update(getFunctions(), errors, requestInfo); - } - - @Test - public final void testCreateInvalid() { - Function function1 = Function.builder().id("a").code("code").active(true).parentId(null).level(1).build(); - functions.add(function1); - when(functionRepository.uniqueCheck(any(String.class), any(Function.class))).thenReturn(true); - functionService.create(functions, errors, requestInfo); - } - - @Test - public final void test_save() { - Function expextedResult = getFunctions().get(0); - when(functionRepository.save(any(Function.class))).thenReturn(expextedResult); - Function actualResult = functionService.save(getFunctions().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void testSearch() { - List search = new ArrayList<>(); - search.add(getFunctionSearch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(functionRepository.search(any(FunctionSearch.class))).thenReturn(expectedResult); - Pagination actualResult = functionService.search(getFunctionSearch(), errors); - assertEquals(expectedResult, actualResult); - - } - - @Test - public final void test_update() { - Function expextedResult = getFunctions().get(0); - when(functionRepository.update(any(Function.class))).thenReturn(expextedResult); - Function actualResult = functionService.update(getFunctions().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_fetch_related_data() { - List expextedResult = new ArrayList<>(); - expextedResult.add(getParentFunction()); - List functions = new ArrayList<>(); - functions.add(getFunction()); - when(functionRepository.findById(any(Function.class))).thenReturn(getParentFunction()); - List actualResult = functionService.fetchRelated(functions); - assertEquals(expextedResult.get(0).getId(), actualResult.get(0).getParentId().getId()); - assertEquals(expextedResult.get(0).getName(), actualResult.get(0).getParentId().getName()); - } - - @Test(expected = InvalidDataException.class) - public final void test_fetch_related_data_when_parentid_is_wrong() { - List expextedResult = new ArrayList<>(); - expextedResult.add(getParentFunction()); - List functions = new ArrayList<>(); - functions.add(getFunction()); - ApplicationThreadLocals.setTenantId("default"); - when(functionRepository.findById(any(Function.class))).thenReturn(null); - functionService.fetchRelated(functions); - } - - private List getFunctions() { - List functions = new ArrayList(); - Function function = Function.builder().id("1").name("name").code("code").level(1).parentId(getParentFunction()).active(true).build(); - function.setTenantId("default"); - functions.add(function); - return functions; - } - - private FunctionSearch getFunctionSearch() { - FunctionSearch functionSearch = new FunctionSearch(); - functionSearch.setPageSize(0); - functionSearch.setOffset(0); - functionSearch.setSortBy("Sort"); - functionSearch.setTenantId("default"); - return functionSearch; - } - - private Function getFunction() { - Function function = Function.builder().id("1").name("function").code("001").active(true) - .parentId(getParentFunction()).level(1).build(); - function.setTenantId("default"); - return function; - } - - private Function getParentFunction() { - Function function = Function.builder().id("2").name("functionParent").code("002").active(true).parentId(null) - .level(1).build(); - return function; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/FundServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/FundServiceTest.java deleted file mode 100644 index 4ca21293a19..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/FundServiceTest.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.FundSearch; -import org.egov.egf.master.domain.repository.FundRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class FundServiceTest { - - @InjectMocks - private FundService fundService; - - @Mock - private SmartValidator validator; - - @Mock - private FundRepository fundRepository; - - private BindingResult errors = new BeanPropertyBindingResult(null, null); - private RequestInfo requestInfo = new RequestInfo(); - private List funds = new ArrayList<>(); - - @Before - public void setup() { - } - - /*@Test - public final void testCreate() { - when(fundRepository.findById(any(Fund.class))).thenReturn(getParentFund()); - fundService.create(getFunds(), errors, requestInfo); - }*/ -/* - @Test - public final void testUpdate() { - when(fundRepository.findById(any(Fund.class))).thenReturn(getParentFund()); - fundService.update(getFunds(), errors, requestInfo); - }*/ - -/* @Test - public final void testCreateInvalid() { - Fund fund1 = Fund.builder().id("a").code("code").identifier('I').active(true).parent(null).level(1234l).build(); - funds.add(fund1); - fundService.create(funds, errors, requestInfo); - } -*/ - @Test - public final void test_save() { - Fund expextedResult = getFunds().get(0); - when(fundRepository.save(any(Fund.class))).thenReturn(expextedResult); - Fund actualResult = fundService.save(getFunds().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void testSearch() { - List search = new ArrayList<>(); - search.add(getFundSearch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(fundRepository.search(any(FundSearch.class))).thenReturn(expectedResult); - Pagination actualResult = fundService.search(getFundSearch(), errors); - assertEquals(expectedResult, actualResult); - - } - - @Test - public final void test_update() { - Fund expextedResult = getFunds().get(0); - when(fundRepository.update(any(Fund.class))).thenReturn(expextedResult); - Fund actualResult = fundService.update(getFunds().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_fetch_related_data() { - List expextedResult = new ArrayList<>(); - expextedResult.add(getParentFund()); - when(fundRepository.findById(any(Fund.class))).thenReturn(getParentFund()); - List actualResult = fundService.fetchRelated(getFunds()); - assertEquals(expextedResult.get(0).getId(), actualResult.get(0).getParent().getId()); - assertEquals(expextedResult.get(0).getName(), actualResult.get(0).getParent().getName()); - } - - private List getFunds() { - List funds = new ArrayList(); - Fund fund = Fund.builder().id("1").name("name").code("code").identifier('I').parent(getParentFund()) - .level(1234l).active(true).build(); - fund.setTenantId("default"); - funds.add(fund); - return funds; - } - - private Fund getParentFund() { - return Fund.builder().id("2").name("nameP").code("codeP").identifier('P').parent(null).level(1234l).active(true) - .build(); - } - - private FundSearch getFundSearch() { - FundSearch fundSearch = new FundSearch(); - fundSearch.setPageSize(0); - fundSearch.setOffset(0); - fundSearch.setSortBy("Sort"); - fundSearch.setTenantId("default"); - return fundSearch; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/RecoveryServiceTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/RecoveryServiceTest.java deleted file mode 100644 index 03a094c62f2..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/domain/service/RecoveryServiceTest.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.egov.egf.master.domain.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.domain.model.Recovery; -import org.egov.egf.master.domain.model.RecoverySearch; -import org.egov.egf.master.domain.repository.ChartOfAccountRepository; -import org.egov.egf.master.domain.repository.RecoveryRepository; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.validation.BindingResult; -import org.springframework.validation.SmartValidator; - -@Import(TestConfiguration.class) -@RunWith(SpringRunner.class) -public class RecoveryServiceTest { - - @InjectMocks - private RecoveryService recoveryService; - - @Mock - private SmartValidator validator; - - @Mock - private RecoveryRepository recoveryRepository; - - @Mock - private ChartOfAccountRepository chartOfAccountRepository; - private BindingResult errors = new BeanPropertyBindingResult(null, null); - private RequestInfo requestInfo = new RequestInfo(); - private List recoverys = new ArrayList<>(); - - @Before - public void setup() { - } - - @Test - public final void test_create() { - when(chartOfAccountRepository.search(any(ChartOfAccountSearch.class))).thenReturn(getPagination()); - when(recoveryRepository.uniqueCheck(any(String.class), any(Recovery.class))).thenReturn(true); - recoveryService.create(getRecoverys(), errors, requestInfo); - } - - @Test - public final void test_update() { - when(chartOfAccountRepository.search(any(ChartOfAccountSearch.class))).thenReturn(getPagination()); - when(recoveryRepository.uniqueCheck(any(String.class), any(Recovery.class))).thenReturn(true); - recoveryService.update(getRecoverys(), errors, requestInfo); - } - - @Test - public final void test_createinvalid() { - Recovery recovery1 = Recovery.builder().name("name").code("code").type("M").mode('M').remittanceMode('M').active(true).build(); - recoverys.add(recovery1); - when(recoveryRepository.uniqueCheck(any(String.class), any(Recovery.class))).thenReturn(true); - recoveryService.create(recoverys, errors, requestInfo); - } - - @Test - public final void test_save() { - Recovery expextedResult = getRecoverys().get(0); - when(recoveryRepository.save(any(Recovery.class))).thenReturn(expextedResult); - Recovery actualResult = recoveryService.save(getRecoverys().get(0)); - assertEquals(expextedResult, actualResult); - } - - @Test - public final void test_search() { - List search = new ArrayList<>(); - search.add(getRecoverySearch()); - Pagination expectedResult = new Pagination<>(); - expectedResult.setPagedData(search); - when(recoveryRepository.search(any(RecoverySearch.class))).thenReturn(expectedResult); - Pagination actualResult = recoveryService.search(getRecoverySearch(), errors); - assertEquals(expectedResult, actualResult); - - } - - @Test - public final void test_updatee() { - Recovery expextedResult = getRecoverys().get(0); - when(recoveryRepository.update(any(Recovery.class))).thenReturn(expextedResult); - Recovery actualResult = recoveryService.update(getRecoverys().get(0)); - assertEquals(expextedResult, actualResult); - } - - private List getRecoverys() { - List recoverys = new ArrayList(); - Recovery recovery = Recovery.builder().name("name").code("code").type("M").mode('M').remittanceMode('M').active(true).build(); - recovery.setTenantId("default"); - recovery.setChartOfAccount(getCOAccount()); - recovery.setRemitted("S"); - recovery.setIfscCode("SBIN0005532"); - recovery.setAccountNumber("3049223457"); - recovery.setId("1"); - recoverys.add(recovery); - return recoverys; - } - - private ChartOfAccount getCOAccount() { - ChartOfAccount chartOfAccount = new ChartOfAccount(); - chartOfAccount.setGlcode("341"); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } - - private RecoverySearch getRecoverySearch() { - RecoverySearch recoverySearch = new RecoverySearch(); - recoverySearch.setPageSize(0); - recoverySearch.setOffset(0); - recoverySearch.setSortBy("Sort"); - recoverySearch.setTenantId("default"); - return recoverySearch; - } - - private Pagination getPagination(){ - Pagination pgn = new Pagination<>(); - pgn.setCurrentPage(0); - pgn.setOffset(0); - pgn.setPageSize(500); - pgn.setTotalPages(1); - pgn.setTotalResults(1); - pgn.setPagedData(getChartOfAccounts()); - return pgn; - } - - private List getChartOfAccounts() { - List chartOfAccounts = new ArrayList(); - ChartOfAccount chartOfAccount = ChartOfAccount.builder() - .glcode("GLCode").name("AadharBank") - .description("DefaultDescription").isActiveForPosting(true) - .type('B').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - chartOfAccounts.add(chartOfAccount); - return chartOfAccounts; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountCodePurposeJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountCodePurposeJdbcRepositoryTest.java deleted file mode 100644 index 8ec8a2dec77..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountCodePurposeJdbcRepositoryTest.java +++ /dev/null @@ -1,186 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.AccountCodePurposeSearch; -import org.egov.egf.master.persistence.entity.AccountCodePurposeEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class AccountCodePurposeJdbcRepositoryTest { - - private AccountCodePurposeJdbcRepository accountCodePurposeJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - accountCodePurposeJdbcRepository = new AccountCodePurposeJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/clearAccountCodePurpose.sql" }) - public void test_create() { - - AccountCodePurposeEntity accountCodePurpose = AccountCodePurposeEntity.builder().id("1").name("name").build(); - accountCodePurpose.setTenantId("default"); - AccountCodePurposeEntity actualResult = accountCodePurposeJdbcRepository.create(accountCodePurpose); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_accountCodePurpose", - new AccountCodePurposeResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = { "/sql/clearAccountCodePurpose.sql" }) - public void test_create_with_tenantId_null() { - - AccountCodePurposeEntity accountCodePurpose = AccountCodePurposeEntity.builder().name("name").build(); - accountCodePurposeJdbcRepository.create(accountCodePurpose); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountCodePurpose.sql", "/sql/insertAccountCodePurposeData.sql" }) - public void test_update() { - - AccountCodePurposeEntity accountCodePurpose = AccountCodePurposeEntity.builder().id("1").name("nameU").build(); - accountCodePurpose.setTenantId("default"); - AccountCodePurposeEntity actualResult = accountCodePurposeJdbcRepository.update(accountCodePurpose); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_accountCodePurpose", - new AccountCodePurposeResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountCodePurpose.sql", "/sql/insertAccountCodePurposeData.sql" }) - public void test_search() { - - Pagination page = (Pagination) accountCodePurposeJdbcRepository - .search(getAccountCodePurposeSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountCodePurpose.sql", "/sql/insertAccountCodePurposeData.sql" }) - public void test_search_with_no_parameter() { - - Pagination page = (Pagination) accountCodePurposeJdbcRepository - .search(new AccountCodePurposeSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountCodePurpose.sql", "/sql/insertAccountCodePurposeData.sql" }) - public void test_find_by_id() { - - AccountCodePurposeEntity accountCodePurposeEntity = AccountCodePurposeEntity.builder().id("1").build(); - accountCodePurposeEntity.setTenantId("default"); - AccountCodePurposeEntity result = accountCodePurposeJdbcRepository.findById(accountCodePurposeEntity); - assertThat(result.getId()).isEqualTo("1"); - assertThat(result.getName()).isEqualTo("name"); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountCodePurpose.sql", "/sql/insertAccountCodePurposeData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - AccountCodePurposeEntity accountCodePurposeEntity = AccountCodePurposeEntity.builder().id("5").build(); - accountCodePurposeEntity.setTenantId("default"); - AccountCodePurposeEntity result = accountCodePurposeJdbcRepository.findById(accountCodePurposeEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/clearAccountCodePurpose.sql", "/sql/insertAccountCodePurposeData.sql" }) - public void test_search_invalid_sort_option() { - - AccountCodePurposeSearch search = getAccountCodePurposeSearch(); - search.setSortBy("desc"); - accountCodePurposeJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountCodePurpose.sql", "/sql/insertAccountCodePurposeData.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - AccountCodePurposeSearch search = getAccountCodePurposeSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) accountCodePurposeJdbcRepository - .search(getAccountCodePurposeSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - - } - - class AccountCodePurposeResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("name", resultSet.getString("name")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private AccountCodePurposeSearch getAccountCodePurposeSearch() { - AccountCodePurposeSearch accountCodePurposeSearch = new AccountCodePurposeSearch(); - accountCodePurposeSearch.setId("1"); - accountCodePurposeSearch.setName("name"); - accountCodePurposeSearch.setPageSize(500); - accountCodePurposeSearch.setOffset(0); - accountCodePurposeSearch.setSortBy("name desc"); - return accountCodePurposeSearch; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountDetailKeyJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountDetailKeyJdbcRepositoryTest.java deleted file mode 100644 index 767bf0befe8..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountDetailKeyJdbcRepositoryTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailKeySearch; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.persistence.entity.AccountDetailKeyEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class AccountDetailKeyJdbcRepositoryTest { - - private AccountDetailKeyJdbcRepository accountDetailKeyJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - accountDetailKeyJdbcRepository = new AccountDetailKeyJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailKey.sql" }) - public void test_create() { - - AccountDetailKeyEntity accountDetailKey = AccountDetailKeyEntity.builder().id("1").key("1") - .accountDetailTypeId(getAccountDetailType().getId()).build(); - accountDetailKey.setTenantId("default"); - AccountDetailKeyEntity actualResult = accountDetailKeyJdbcRepository.create(accountDetailKey); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_accountDetailKey", - new AccountDetailKeyResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("key")).isEqualTo(actualResult.getKey()); - - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = { "/sql/clearAccountDetailKey.sql" }) - public void test_create_with_tenantId_null() { - - AccountDetailKeyEntity accountDetailKey = AccountDetailKeyEntity.builder().id("1").key("1") - .accountDetailTypeId(getAccountDetailType().getId()).build(); - accountDetailKeyJdbcRepository.create(accountDetailKey); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailKey.sql", "/sql/insertAccountDetailKey.sql" }) - public void test_update() { - - AccountDetailKeyEntity accountDetailKey = AccountDetailKeyEntity.builder().id("1").key("1") - .accountDetailTypeId(getAccountDetailType().getId()).build(); - accountDetailKey.setTenantId("default"); - AccountDetailKeyEntity actualResult = accountDetailKeyJdbcRepository.update(accountDetailKey); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_accountDetailKey", - new AccountDetailKeyResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("key")).isEqualTo(actualResult.getKey()); - assertThat(row.get("accountDetailTypeId")).isEqualTo(actualResult.getAccountDetailTypeId()); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailKey.sql", "/sql/insertAccountDetailKey.sql" }) - public void test_search() { - - Pagination page = (Pagination) accountDetailKeyJdbcRepository - .search(getAccountDetailKeySearch()); - assertThat(page.getPagedData().get(0).getKey()).isEqualTo("1"); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailKey.sql", "/sql/insertAccountDetailKey.sql" }) - public void test_search_with_no_parameter() { - - Pagination page = (Pagination) accountDetailKeyJdbcRepository - .search(new AccountDetailKeySearch()); - assertThat(page.getPagedData().get(0).getKey()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getAccountDetailType().getId()).isEqualTo(getAccountDetailType().getId()); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailKey.sql", "/sql/insertAccountDetailKey.sql" }) - public void test_find_by_id() { - - AccountDetailKeyEntity accountDetailKeyEntity = AccountDetailKeyEntity.builder().id("1").build(); - accountDetailKeyEntity.setTenantId("default"); - AccountDetailKeyEntity result = accountDetailKeyJdbcRepository.findById(accountDetailKeyEntity); - assertThat(result.getId()).isEqualTo("1"); - assertThat(result.getKey()).isEqualTo("1"); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailKey.sql", "/sql/insertAccountDetailKey.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - AccountDetailKeyEntity accountDetailKeyEntity = AccountDetailKeyEntity.builder().id("5").build(); - accountDetailKeyEntity.setTenantId("default"); - AccountDetailKeyEntity result = accountDetailKeyJdbcRepository.findById(accountDetailKeyEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/clearAccountDetailKey.sql", "/sql/insertAccountDetailKey.sql" }) - public void test_search_invalid_sort_option() { - - AccountDetailKeySearch search = getAccountDetailKeySearch(); - search.setSortBy("desc"); - accountDetailKeyJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailKey.sql", "/sql/insertAccountDetailKey.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - AccountDetailKeySearch search = getAccountDetailKeySearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) accountDetailKeyJdbcRepository - .search(getAccountDetailKeySearch()); - assertThat(page.getPagedData().get(0).getKey()).isEqualTo("1"); - - } - - class AccountDetailKeyResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("key", resultSet.getString("key")); - put("accountDetailTypeId", resultSet.getString("accountDetailTypeId")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private AccountDetailKeySearch getAccountDetailKeySearch() { - AccountDetailKeySearch accountDetailKeySearch = new AccountDetailKeySearch(); - accountDetailKeySearch.setId("1"); - accountDetailKeySearch.setKey("1"); - accountDetailKeySearch.setAccountDetailType(getAccountDetailType()); - accountDetailKeySearch.setPageSize(500); - accountDetailKeySearch.setOffset(0); - accountDetailKeySearch.setSortBy("key desc"); - accountDetailKeySearch.setTenantId("default"); - return accountDetailKeySearch; - } - - private AccountDetailType getAccountDetailType() { - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("contractor") - .fullyQualifiedName("abc/acb").active(true).build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountDetailTypeJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountDetailTypeJdbcRepositoryTest.java deleted file mode 100644 index b53fc6270f0..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountDetailTypeJdbcRepositoryTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; -import org.egov.egf.master.persistence.entity.AccountDetailTypeEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class AccountDetailTypeJdbcRepositoryTest { - - private AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - accountDetailTypeJdbcRepository = new AccountDetailTypeJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailType.sql" }) - public void test_create() { - - AccountDetailTypeEntity accountDetailType = AccountDetailTypeEntity.builder().id("1").tablename("contractor") - .description("contractor").fullyQualifiedName("abc/contractor").name("name").active(true).build(); - accountDetailType.setTenantId("default"); - AccountDetailTypeEntity actualResult = accountDetailTypeJdbcRepository.create(accountDetailType); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_accountDetailType", - new AccountDetailTypeResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("tableName")).isEqualTo(actualResult.getTablename()); - assertThat(row.get("fullyQualifiedName")).isEqualTo(actualResult.getFullyQualifiedName()); - - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = { "/sql/clearAccountDetailType.sql" }) - public void test_create_with_tenantId_null() { - - AccountDetailTypeEntity accountDetailType = AccountDetailTypeEntity.builder().tablename("contractor") - .fullyQualifiedName("abc/contractor").name("name").active(true).build(); - accountDetailTypeJdbcRepository.create(accountDetailType); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailType.sql", "/sql/insertAccountDetailType.sql" }) - public void test_update() { - - AccountDetailTypeEntity accountDetailType = AccountDetailTypeEntity.builder().tablename("contractorU") - .description("contractor").fullyQualifiedName("abc/contractorU").name("nameU").active(true).id("1") - .build(); - accountDetailType.setTenantId("default"); - AccountDetailTypeEntity actualResult = accountDetailTypeJdbcRepository.update(accountDetailType); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_accountDetailType", - new AccountDetailTypeResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailType.sql", "/sql/insertAccountDetailType.sql" }) - public void test_search() { - - Pagination page = (Pagination) accountDetailTypeJdbcRepository - .search(getAccountDetailTypeSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailType.sql", "/sql/insertAccountDetailType.sql" }) - public void test_search_with_no_parameter() { - - Pagination page = (Pagination) accountDetailTypeJdbcRepository - .search(new AccountDetailTypeSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailType.sql", "/sql/insertAccountDetailType.sql" }) - public void test_find_by_id() { - - AccountDetailTypeEntity accountDetailTypeEntity = AccountDetailTypeEntity.builder().id("1").build(); - accountDetailTypeEntity.setTenantId("default"); - AccountDetailTypeEntity result = accountDetailTypeJdbcRepository.findById(accountDetailTypeEntity); - assertThat(result.getId()).isEqualTo("1"); - assertThat(result.getName()).isEqualTo("name"); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailType.sql", "/sql/insertAccountDetailType.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - AccountDetailTypeEntity accountDetailTypeEntity = AccountDetailTypeEntity.builder().id("5").build(); - accountDetailTypeEntity.setTenantId("default"); - AccountDetailTypeEntity result = accountDetailTypeJdbcRepository.findById(accountDetailTypeEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/clearAccountDetailType.sql", "/sql/insertAccountDetailType.sql" }) - public void test_search_invalid_sort_option() { - - AccountDetailTypeSearch search = getAccountDetailTypeSearch(); - search.setSortBy("desc"); - accountDetailTypeJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/clearAccountDetailType.sql", "/sql/insertAccountDetailType.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - AccountDetailTypeSearch search = getAccountDetailTypeSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) accountDetailTypeJdbcRepository - .search(getAccountDetailTypeSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - class AccountDetailTypeResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("name", resultSet.getString("name")); - put("tableName", resultSet.getString("tableName")); - put("active", resultSet.getBoolean("active")); - put("fullyQualifiedName", resultSet.getString("fullyQualifiedName")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private AccountDetailTypeSearch getAccountDetailTypeSearch() { - AccountDetailTypeSearch accountDetailTypeSearch = new AccountDetailTypeSearch(); - accountDetailTypeSearch.setId("1"); - accountDetailTypeSearch.setName("name"); - accountDetailTypeSearch.setTableName("contractor"); - accountDetailTypeSearch.setActive(true); - accountDetailTypeSearch.setFullyQualifiedName("abc/contractor"); - accountDetailTypeSearch.setPageSize(500); - accountDetailTypeSearch.setOffset(0); - accountDetailTypeSearch.setSortBy("name desc"); - return accountDetailTypeSearch; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountEntityJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountEntityJdbcRepositoryTest.java deleted file mode 100644 index 5a5667b93ff..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/AccountEntityJdbcRepositoryTest.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.domain.model.AccountEntitySearch; -import org.egov.egf.master.persistence.entity.AccountEntityEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class AccountEntityJdbcRepositoryTest { - - private AccountEntityJdbcRepository accountEntityJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - accountEntityJdbcRepository = new AccountEntityJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = {"/sql/clearAccountEntity.sql"}) - public void test_create() { - - AccountEntityEntity accountEntity = AccountEntityEntity.builder().id("1").code("code").name("name").active(true) - .accountDetailTypeId(getAccountDetaialType().getId()).description("entity").build(); - accountEntity.setTenantId("default"); - AccountEntityEntity actualResult = accountEntityJdbcRepository.create(accountEntity); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_accountEntity", - new AccountEntityResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - assertThat(row.get("accountDetailTypeId")).isEqualTo(actualResult.getAccountDetailTypeId()); - - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = {"/sql/clearAccountEntity.sql"}) - public void test_create_with_tenantId_null() { - - AccountEntityEntity accountEntity = AccountEntityEntity.builder().code("code").name("name").active(true) - .accountDetailTypeId(getAccountDetaialType().getId()).description("entity").build(); - accountEntityJdbcRepository.create(accountEntity); - - } - - @Test - @Sql(scripts = {"/sql/clearAccountEntity.sql", "/sql/insertAccountEntity.sql"}) - public void test_update() { - - AccountEntityEntity accountEntity = AccountEntityEntity.builder().code("codeU").name("nameU").active(true).id("1") - .accountDetailTypeId(getAccountDetaialType().getId()).description("entity").build(); - accountEntity.setTenantId("default"); - AccountEntityEntity actualResult = accountEntityJdbcRepository.update(accountEntity); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_accountEntity", - new AccountEntityResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - - } - - @Test - @Sql(scripts = {"/sql/clearAccountEntity.sql", "/sql/insertAccountEntity.sql"}) - public void test_search() { - - Pagination page = (Pagination) accountEntityJdbcRepository.search(getAccountEntitySearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = {"/sql/clearAccountEntity.sql", "/sql/insertAccountEntity.sql"}) - public void test_search_with_no_parameter() { - - Pagination page = (Pagination) accountEntityJdbcRepository.search(new AccountEntitySearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = {"/sql/clearAccountEntity.sql", "/sql/insertAccountEntity.sql"}) - public void test_find_by_id() { - - AccountEntityEntity accountEntityEntity = AccountEntityEntity.builder().id("1").build(); - accountEntityEntity.setTenantId("default"); - AccountEntityEntity result = accountEntityJdbcRepository.findById(accountEntityEntity); - assertThat(result.getId()).isEqualTo("1"); - assertThat(result.getName()).isEqualTo("name"); - assertThat(result.getCode()).isEqualTo("code"); - - } - - @Test - @Sql(scripts = {"/sql/clearAccountEntity.sql", "/sql/insertAccountEntity.sql"}) - public void test_find_by_invalid_id_should_return_null() { - - AccountEntityEntity accountEntityEntity = AccountEntityEntity.builder().id("5").build(); - accountEntityEntity.setTenantId("default"); - AccountEntityEntity result = accountEntityJdbcRepository.findById(accountEntityEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = {"/sql/clearAccountEntity.sql", "/sql/insertAccountEntity.sql"}) - public void test_search_invalid_sort_option() { - - AccountEntitySearch search = getAccountEntitySearch(); - search.setSortBy("desc"); - accountEntityJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = {"/sql/clearAccountEntity.sql", "/sql/insertAccountEntity.sql"}) - public void test_search_without_pagesize_offset_sortby() { - - AccountEntitySearch search = getAccountEntitySearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) accountEntityJdbcRepository.search(getAccountEntitySearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - private AccountEntitySearch getAccountEntitySearch() { - AccountEntitySearch accountEntitySearch = new AccountEntitySearch(); - accountEntitySearch.setId("1"); - accountEntitySearch.setName("name"); - accountEntitySearch.setCode("code"); - accountEntitySearch.setActive(true); - accountEntitySearch.setAccountDetailType(getAccountDetaialType()); - accountEntitySearch.setDescription("entity"); - accountEntitySearch.setPageSize(500); - accountEntitySearch.setOffset(0); - accountEntitySearch.setSortBy("name desc"); - return accountEntitySearch; - } - - private AccountDetailType getAccountDetaialType() { - - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("table") - .fullyQualifiedName("abc/table").build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } - - class AccountEntityResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("name", resultSet.getString("name")); - put("code", resultSet.getString("code")); - put("active", resultSet.getBoolean("active")); - put("accountDetailTypeId", resultSet.getString("accountDetailTypeId")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - put("description", resultSet.getString("description")); - - } - }; - - rows.add(row); - } - return rows; - } - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/BankAccountJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/BankAccountJdbcRepositoryTest.java deleted file mode 100644 index aa25e3f11d0..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/BankAccountJdbcRepositoryTest.java +++ /dev/null @@ -1,238 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.enums.BankAccountType; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankAccountSearch; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.persistence.entity.BankAccountEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class BankAccountJdbcRepositoryTest { - - private BankAccountJdbcRepository bankAccountJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - bankAccountJdbcRepository = new BankAccountJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/clearBankAccount.sql" }) - public void testCreate() { - BankAccountEntity bankAccountEntity = getBankAccountEntity(); - BankAccountEntity actualResult = bankAccountJdbcRepository.create(bankAccountEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_bankaccount", - new BankAccountResultExtractor()); - Map row = result.get(0); - assertThat(row.get("accountNumber")).isEqualTo(actualResult.getAccountNumber()); - } - - @Test - @Sql(scripts = { "/sql/clearBankAccount.sql", "/sql/insertBankAccount.sql" }) - public void testUpdate() { - BankAccountEntity bankAccountEntity = getBankAccountEntity(); - BankAccountEntity actualResult = bankAccountJdbcRepository.update(bankAccountEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_bankaccount", - new BankAccountResultExtractor()); - Map row = result.get(0); - assertThat(row.get("accountNumber")).isEqualTo(actualResult.getAccountNumber()); - } - - @Test - @Sql(scripts = { "/sql/clearBankAccount.sql", "/sql/insertBankAccount.sql" }) - public void testSearch() { - Pagination page = (Pagination) bankAccountJdbcRepository - .search(getBankAccountSearch()); - assertThat(page.getPagedData().get(0).getAccountNumber()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - } - - @Test - @Sql(scripts = { "/sql/clearBankAccount.sql", "/sql/insertBankAccount.sql" }) - public void testFindById() { - BankAccountEntity bankAccountEntity = BankAccountEntity.builder().id("1").build(); - bankAccountEntity.setTenantId("default"); - BankAccountEntity result = bankAccountJdbcRepository.findById(bankAccountEntity); - assertThat(result.getId()).isEqualTo("1"); - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = { "/sql/clearBankAccount.sql" }) - public void test_create_with_tenantId_null() { - - BankAccountEntity bankAccount = BankAccountEntity.builder().accountNumber("001").active(true).build(); - bankAccountJdbcRepository.create(bankAccount); - - } - - @Test - @Sql(scripts = { "/sql/clearBankAccount.sql", "/sql/insertBankAccount.sql" }) - public void test_search_with_no_parameter() { - - Pagination page = (Pagination) bankAccountJdbcRepository - .search(new BankAccountSearch()); - assertThat(page.getPagedData().get(0).getAccountNumber()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = { "/sql/clearBankAccount.sql", "/sql/insertBankAccount.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - BankAccountEntity bankAccountEntity = BankAccountEntity.builder().id("5").build(); - bankAccountEntity.setTenantId("default"); - BankAccountEntity result = bankAccountJdbcRepository.findById(bankAccountEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/clearBankAccount.sql", "/sql/insertBankAccount.sql" }) - public void test_search_invalid_sort_option() { - - BankAccountSearch search = getBankAccountSearch(); - search.setSortBy("desc"); - bankAccountJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/clearBankAccount.sql", "/sql/insertBankAccount.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - BankAccountSearch search = getBankAccountSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) bankAccountJdbcRepository - .search(getBankAccountSearch()); - assertThat(page.getPagedData().get(0).getAccountNumber()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - class BankAccountResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("accountNumber", resultSet.getString("accountNumber")); - put("bankBranchId", resultSet.getString("bankBranchId")); - put("coa", resultSet.getString("chartOfAccountId")); - put("fund", resultSet.getBoolean("fundId")); - put("tenantId", resultSet.getBoolean("tenantId")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private BankAccountEntity getBankAccountEntity() { - BankAccountEntity bankAccountEntity = new BankAccountEntity(); - BankAccount bankAccount = getBankAccountDomain(); - bankAccountEntity.setId(bankAccount.getId()); - bankAccountEntity.setBankBranchId(bankAccount.getBankBranch().getId()); - bankAccountEntity.setAccountNumber(bankAccount.getAccountNumber()); - bankAccountEntity.setActive(bankAccount.getActive()); - bankAccountEntity.setChartOfAccountId(bankAccount.getChartOfAccount().getId()); - bankAccountEntity.setFundId(bankAccount.getFund().getId()); - bankAccountEntity.setActive(bankAccount.getActive()); - bankAccountEntity.setTenantId(bankAccount.getTenantId()); - bankAccountEntity.setAccountType(bankAccount.getAccountType()); - bankAccountEntity.setDescription(bankAccount.getDescription()); - bankAccountEntity.setPayTo(bankAccount.getPayTo()); - bankAccountEntity.setType(bankAccount.getType().toString()); - return bankAccountEntity; - } - - private BankAccount getBankAccountDomain() { - BankAccount bankAccount = new BankAccount(); - bankAccount.setId("1"); - bankAccount.setBankBranch(getBankBranch()); - bankAccount.setAccountNumber("1"); - bankAccount.setChartOfAccount(getCOA()); - bankAccount.setFund(getFund()); - bankAccount.setActive(true); - bankAccount.setTenantId("default"); - bankAccount.setAccountType("Payment"); - bankAccount.setDescription("bank account"); - bankAccount.setPayTo("abc"); - bankAccount.setType(BankAccountType.PAYMENTS); - return bankAccount; - } - - private BankBranch getBankBranch() { - return BankBranch.builder().id("1").code("branch").name("branch").active(true).bank(getBank()).build(); - } - - private Bank getBank() { - Bank bank = new Bank(); - bank.setId("1"); - bank.setCode("code"); - bank.setName("name"); - bank.setDescription("description"); - bank.setType("type"); - bank.setActive(true); - bank.setTenantId("default"); - return bank; - } - - private ChartOfAccount getCOA() { - return ChartOfAccount.builder().id("1").glcode("101010").build(); - - } - - private Fund getFund() { - return Fund.builder().id("1").code("fund").name("fund").build(); - } - - private BankAccountSearch getBankAccountSearch() { - BankAccountSearch bankAccountSearch = new BankAccountSearch(); - bankAccountSearch.setAccountNumber("1"); - bankAccountSearch.setType(BankAccountType.PAYMENTS); - bankAccountSearch.setPageSize(500); - bankAccountSearch.setOffset(0); - bankAccountSearch.setSortBy("id desc"); - return bankAccountSearch; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/BankBranchJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/BankBranchJdbcRepositoryTest.java deleted file mode 100644 index 813c57687fe..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/BankBranchJdbcRepositoryTest.java +++ /dev/null @@ -1,217 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.BankBranchSearch; -import org.egov.egf.master.persistence.entity.BankBranchEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class BankBranchJdbcRepositoryTest { - - private BankBranchJdbcRepository bankBranchJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - bankBranchJdbcRepository = new BankBranchJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/clearBank.sql", "/sql/clearBankBranch.sql" }) - public void testCreate() { - BankBranchEntity bankBranchEntity = getBankBranchEntity(); - BankBranchEntity actualResult = bankBranchJdbcRepository.create(bankBranchEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_bankbranch", - new BankBranchResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - } - - @Test - @Sql(scripts = { "/sql/clearBankBranch.sql", "/sql/insertBankBranch.sql" }) - public void testUpdate() { - BankBranchEntity bankBranchEntity = getBankBranchEntity(); - BankBranchEntity actualResult = bankBranchJdbcRepository.update(bankBranchEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_bankbranch", - new BankBranchResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - } - - @Test - @Sql(scripts = { "/sql/clearBankBranch.sql", "/sql/insertBankBranch.sql" }) - public void testSearch() { - Pagination page = (Pagination) bankBranchJdbcRepository.search(getBankBranchSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - } - - @Test - @Sql(scripts = { "/sql/clearBankBranch.sql", "/sql/insertBankBranch.sql" }) - public void testFindById() { - BankBranchEntity bankBranchEntity = BankBranchEntity.builder().id("2").build(); - bankBranchEntity.setTenantId("default"); - BankBranchEntity result = bankBranchJdbcRepository.findById(bankBranchEntity); - assertThat(result.getId()).isEqualTo("2"); - assertThat(result.getName()).isEqualTo("name"); - assertThat(result.getCode()).isEqualTo("code"); - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = { "/sql/clearBankBranch.sql" }) - public void test_create_with_tenantId_null() { - - BankBranchEntity bankBranch = BankBranchEntity.builder().code("code").name("name").active(true).build(); - bankBranchJdbcRepository.create(bankBranch); - - } - -@Test - @Sql(scripts = { "/sql/clearBankBranch.sql", "/sql/insertBankBranch.sql" }) - public void test_search_with_no_parameter() { - - Pagination page = (Pagination) bankBranchJdbcRepository.search(new BankBranchSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - -@Test - @Sql(scripts = { "/sql/clearBankBranch.sql", "/sql/insertBankBranch.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - BankBranchEntity bankBranchEntity = BankBranchEntity.builder().id("5").build(); - bankBranchEntity.setTenantId("default"); - BankBranchEntity result = bankBranchJdbcRepository.findById(bankBranchEntity); - assertNull(result); - - } -@Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/clearBankBranch.sql", "/sql/insertBankBranch.sql" }) - public void test_search_invalid_sort_option() { - - BankBranchSearch search = getBankBranchSearch(); - search.setSortBy("desc"); - bankBranchJdbcRepository.search(search); - - } - -@Test - @Sql(scripts = { "/sql/clearBankBranch.sql", "/sql/insertBankBranch.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - BankBranchSearch search = getBankBranchSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) bankBranchJdbcRepository.search(getBankBranchSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - - - class BankBranchResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("code", resultSet.getString("code")); - put("name", resultSet.getString("name")); - put("description", resultSet.getString("description")); - put("active", resultSet.getBoolean("active")); - } - }; - - rows.add(row); - } - return rows; - } - } - - private BankBranchEntity getBankBranchEntity() { - BankBranchEntity bankBranchEntity = new BankBranchEntity(); - BankBranch bankBranch = getBankBranchDomain(); - bankBranchEntity.setId(bankBranch.getId()); - bankBranchEntity.setBankId(bankBranch.getBank().getId()); - bankBranchEntity.setCode(bankBranch.getCode()); - bankBranchEntity.setName(bankBranch.getName()); - bankBranchEntity.setDescription(bankBranch.getDescription()); - bankBranchEntity.setAddress(getBankBranchDomain().getAddress()); - bankBranchEntity.setActive(bankBranch.getActive()); - bankBranchEntity.setTenantId(bankBranch.getTenantId()); - return bankBranchEntity; - } - - private BankBranch getBankBranchDomain() { - BankBranch bankBranch = new BankBranch(); - bankBranch.setId("124234"); - bankBranch.setBank(getBankDomain()); - bankBranch.setCode("code"); - bankBranch.setName("name"); - bankBranch.setAddress("address"); - bankBranch.setDescription("description"); - bankBranch.setActive(true); - bankBranch.setTenantId("default"); - return bankBranch; - } - - private Bank getBankDomain() { - Bank bank = new Bank(); - bank.setId("1"); - bank.setCode("code"); - bank.setName("name"); - bank.setDescription("description"); - bank.setType("type"); - bank.setActive(true); - bank.setTenantId("default"); - return bank; - } - - private BankBranchSearch getBankBranchSearch() { - BankBranchSearch bankBranchSearch = new BankBranchSearch(); - bankBranchSearch.setName("name"); - bankBranchSearch.setCode("code"); - bankBranchSearch.setPageSize(500); - bankBranchSearch.setOffset(0); - bankBranchSearch.setSortBy("name desc"); - return bankBranchSearch; - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/BankJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/BankJdbcRepositoryTest.java deleted file mode 100644 index 6677b8283d0..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/BankJdbcRepositoryTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankSearch; -import org.egov.egf.master.persistence.entity.BankEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class BankJdbcRepositoryTest { - - private BankJdbcRepository bankJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - bankJdbcRepository = new BankJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/clearBank.sql" }) - public void testCreate() { - BankEntity bankEntity = getBankEntity(); - BankEntity actualResult = bankJdbcRepository.create(bankEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_bank", - new BankResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - } - - @Test - @Sql(scripts = { "/sql/clearBank.sql", "/sql/insertBank.sql" }) - public void testUpdate() { - BankEntity bankEntity = getBankEntity(); - BankEntity actualResult = bankJdbcRepository.update(bankEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_bank", - new BankResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - } - - @Test - @Sql(scripts = { "/sql/clearBank.sql", "/sql/insertBank.sql" }) - public void testSearch() { - Pagination page = (Pagination) bankJdbcRepository.search(getBankSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - } - - @Test - @Sql(scripts = { "/sql/clearBank.sql", "/sql/insertBank.sql" }) - public void testFindById() { - BankEntity bankEntity = BankEntity.builder().id("2").build(); - bankEntity.setTenantId("default"); - BankEntity result = bankJdbcRepository.findById(bankEntity); - assertThat(result.getId()).isEqualTo("2"); - assertThat(result.getName()).isEqualTo("name"); - assertThat(result.getCode()).isEqualTo("code"); - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = { "/sql/clearBank.sql" }) - public void test_create_with_tenantId_null() { - - BankEntity bank = BankEntity.builder().code("code").name("name").active(true).build(); - bankJdbcRepository.create(bank); - - } - - @Test - @Sql(scripts = { "/sql/clearBank.sql", "/sql/insertBank.sql" }) - public void test_search_with_no_parameter() { - - Pagination page = (Pagination) bankJdbcRepository.search(new BankSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = { "/sql/clearBank.sql", "/sql/insertBank.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - BankEntity bankEntity = BankEntity.builder().id("5").build(); - bankEntity.setTenantId("default"); - BankEntity result = bankJdbcRepository.findById(bankEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/clearBank.sql", "/sql/insertBank.sql" }) - public void test_search_invalid_sort_option() { - - BankSearch search = getBankSearch(); - search.setSortBy("desc"); - bankJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/clearBank.sql", "/sql/insertBank.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - BankSearch search = getBankSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) bankJdbcRepository.search(getBankSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - class BankResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("code", resultSet.getString("code")); - put("name", resultSet.getString("name")); - put("description", resultSet.getString("description")); - put("active", resultSet.getBoolean("active")); - put("type", resultSet.getString("type")); - } - }; - - rows.add(row); - } - return rows; - } - } - - private BankEntity getBankEntity() { - BankEntity bankEntity = new BankEntity(); - Bank bank = getBankDomain(); - bankEntity.setId(bank.getId()); - bankEntity.setCode(bank.getCode()); - bankEntity.setName(bank.getName()); - bankEntity.setDescription(bank.getDescription()); - bankEntity.setType(bank.getType()); - bankEntity.setActive(bank.getActive()); - bankEntity.setTenantId(bank.getTenantId()); - return bankEntity; - } - - private Bank getBankDomain() { - Bank bank = new Bank(); - bank.setId("134235"); - bank.setCode("code"); - bank.setName("name"); - bank.setDescription("description"); - bank.setType("type"); - bank.setActive(true); - bank.setTenantId("default"); - return bank; - } - - private BankSearch getBankSearch() { - BankSearch bankSearch = new BankSearch(); - bankSearch.setName("name"); - bankSearch.setCode("code"); - bankSearch.setPageSize(500); - bankSearch.setOffset(0); - bankSearch.setSortBy("name desc"); - return bankSearch; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/ChartOfAccountDetailJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/ChartOfAccountDetailJdbcRepositoryTest.java deleted file mode 100644 index e3bf2a9ef5d..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/ChartOfAccountDetailJdbcRepositoryTest.java +++ /dev/null @@ -1,196 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; -import org.egov.egf.master.persistence.entity.ChartOfAccountDetailEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class ChartOfAccountDetailJdbcRepositoryTest { - - private ChartOfAccountDetailJdbcRepository chartOfAccountDetailJdbcRepository; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository; - - @Before - public void setUp() throws Exception { - chartOfAccountDetailJdbcRepository = new ChartOfAccountDetailJdbcRepository( - namedParameterJdbcTemplate,accountDetailTypeJdbcRepository); - } - - @Test - @Sql(scripts = { "/sql/clearChartOfAccount.sql" }) - @Sql(scripts = { "/sql/insertChartOfAccountData.sql" }) - @Sql(scripts = { "/sql/clearAccountDetailType.sql" }) - @Sql(scripts = { "/sql/insertAccountDetailType.sql" }) - @Sql(scripts = { "/sql/clearChartOfAccountDetail.sql" }) - @Sql(scripts = { "/sql/insertChartOfAccountDetail.sql" }) - public void testCreate() { - ChartOfAccountDetailEntity chartOfAccountDetailEntity = getChartOfAccountDetailEntity(); - ChartOfAccountDetailEntity actualResult = chartOfAccountDetailJdbcRepository - .create(chartOfAccountDetailEntity); - List> result = namedParameterJdbcTemplate.query( - "SELECT * FROM egf_chartofaccountdetail", - new ChartOfAccountDetailResultExtractor()); - assertThat(result.get(0).get("id")).isEqualTo("1"); - assertThat(result.get(0).get("chartofaccountid")).isEqualTo("1"); - assertThat(result.get(0).get("accountdetailtypeid")).isEqualTo("1"); - - } - - @Test - @Sql(scripts = { "/sql/clearChartOfAccount.sql" }) - @Sql(scripts = { "/sql/insertChartOfAccountData.sql" }) - @Sql(scripts = { "/sql/clearAccountDetailType.sql" }) - @Sql(scripts = { "/sql/insertAccountDetailType.sql" }) - @Sql(scripts = { "/sql/clearChartOfAccountDetail.sql", - "/sql/insertChartOfAccountDetail.sql" }) - public void testUpdate() { - ChartOfAccountDetailEntity chartOfAccountDetailEntity = getChartOfAccountDetailEntity(); - ChartOfAccountDetailEntity actualResult = chartOfAccountDetailJdbcRepository - .update(chartOfAccountDetailEntity); - List> result = namedParameterJdbcTemplate.query( - "SELECT * FROM egf_chartofaccountdetail order by id asc", - new ChartOfAccountDetailResultExtractor()); - assertThat(result.get(0).get("id")).isEqualTo("1"); - assertThat(result.get(0).get("chartofaccountid")).isEqualTo("1"); - assertThat(result.get(0).get("accountdetailtypeid")).isEqualTo("1"); - - } - - @Test - @Sql(scripts = { "/sql/clearChartOfAccount.sql" }) - @Sql(scripts = { "/sql/insertChartOfAccountData.sql" }) - @Sql(scripts = { "/sql/clearAccountDetailType.sql" }) - @Sql(scripts = { "/sql/insertAccountDetailType.sql" }) - @Sql(scripts = { "/sql/clearChartOfAccountDetail.sql", - "/sql/insertChartOfAccountDetail.sql" }) - public void testSearch() { - Pagination page = (Pagination) chartOfAccountDetailJdbcRepository - .search(getChartOfAccountDetailSearch()); - assertThat(page.getPagedData().get(0).getId()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getChartOfAccount().getId()).isEqualTo("1"); - assertThat(page.getPagedData().get(0).getAccountDetailType().getId()).isEqualTo("1"); - } - - @Test - @Sql(scripts = { "/sql/clearChartOfAccount.sql" }) - @Sql(scripts = { "/sql/insertChartOfAccountData.sql" }) - @Sql(scripts = { "/sql/clearAccountDetailType.sql" }) - @Sql(scripts = { "/sql/insertAccountDetailType.sql" }) - @Sql(scripts = { "/sql/clearChartOfAccountDetail.sql", - "/sql/insertChartOfAccountDetail.sql" }) - public void testFindById() { - ChartOfAccountDetailEntity chartOfAccountDetailEntity = getChartOfAccountDetailEntity(); - ChartOfAccountDetailEntity actualResult = chartOfAccountDetailJdbcRepository - .findById(chartOfAccountDetailEntity); - List> result = namedParameterJdbcTemplate.query( - "SELECT * FROM egf_chartofaccountdetail", - new ChartOfAccountDetailResultExtractor()); - assertThat(result.get(0).get("id")).isEqualTo("1"); - assertThat(result.get(0).get("chartofaccountid")).isEqualTo("1"); - assertThat(result.get(0).get("accountdetailtypeid")).isEqualTo("1"); - } - - class ChartOfAccountDetailResultExtractor implements - ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) - throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("chartofaccountid", resultSet.getString("chartofaccountid")); - put("accountdetailtypeid", resultSet.getString("accountdetailtypeid")); - put("createdby", resultSet.getString("createdby")); - put("createddate", resultSet.getString("createddate")); - put("lastmodifiedby", resultSet.getBoolean("lastmodifiedby")); - put("lastmodifieddate", resultSet.getString("lastmodifieddate")); - put("version", resultSet.getString("version")); - put("tenantid", resultSet.getString("tenantid")); - } - }; - - rows.add(row); - } - return rows; - } - } - - private ChartOfAccountDetailEntity getChartOfAccountDetailEntity() { - ChartOfAccountDetailEntity chartOfAccountDetailEntity = new ChartOfAccountDetailEntity(); - ChartOfAccountDetail chartOfAccountDetail = getChartOfAccountDetailDomain(); - chartOfAccountDetailEntity.setId(chartOfAccountDetail.getId()); - chartOfAccountDetailEntity.setChartOfAccountId(chartOfAccountDetail.getChartOfAccount().getId()); - chartOfAccountDetailEntity.setAccountDetailTypeId(chartOfAccountDetail.getAccountDetailType().getId()); - chartOfAccountDetailEntity.setTenantId("default"); - return chartOfAccountDetailEntity; - } - - private ChartOfAccountDetail getChartOfAccountDetailDomain() { - ChartOfAccountDetail chartOfAccountDetail = ChartOfAccountDetail - .builder().id("14632342").accountDetailType(getAccountDetailType()).chartOfAccount(getChartOfAccount()).build(); - chartOfAccountDetail.setChartOfAccount(getChartOfAccount()); - chartOfAccountDetail.setAccountDetailType(getAccountDetailType()); - chartOfAccountDetail.setTenantId("default"); - return chartOfAccountDetail; - } - - private ChartOfAccount getChartOfAccount() { - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("1") - .glcode("glcode").name("name").description("description") - .isActiveForPosting(true).type('A') - .classification((long) 123456).functionRequired(true) - .budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } - - private AccountDetailType getAccountDetailType() { - AccountDetailType accountDetailType = AccountDetailType.builder() - .id("1").name("name").description("description").active(true) - .build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } - - private ChartOfAccountDetailSearch getChartOfAccountDetailSearch() { - ChartOfAccountDetailSearch chartOfAccountDetailSearch = new ChartOfAccountDetailSearch(); - chartOfAccountDetailSearch.setId("1"); - chartOfAccountDetailSearch.setPageSize(500); - chartOfAccountDetailSearch.setOffset(0); - chartOfAccountDetailSearch.setSortBy("id asc"); - chartOfAccountDetailSearch.setTenantId("default"); - return chartOfAccountDetailSearch; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/ChartOfAccountJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/ChartOfAccountJdbcRepositoryTest.java deleted file mode 100644 index 079fb2f1afa..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/ChartOfAccountJdbcRepositoryTest.java +++ /dev/null @@ -1,196 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.persistence.entity.ChartOfAccountEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class ChartOfAccountJdbcRepositoryTest { - - private ChartOfAccountJdbcRepository chartOfAccountJdbcRepository; - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Autowired - private ChartOfAccountDetailJdbcRepository chartOfAccountDetailJdbcRepository; - - @Before - public void setUp() throws Exception { - chartOfAccountJdbcRepository = new ChartOfAccountJdbcRepository(namedParameterJdbcTemplate,chartOfAccountDetailJdbcRepository); - } - - @Test - @Sql(scripts = { "/sql/clearChartOfAccount.sql" }) - @Sql(scripts = { "/sql/insertChartOfAccountData.sql" }) - public void testCreate() { - ChartOfAccountEntity chartOfAccountEntity = getChartOfAccountEntity(); - ChartOfAccountEntity actualResult =chartOfAccountJdbcRepository.create(chartOfAccountEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_chartofaccount", - new ChartOfAccountResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("glcode")).isEqualTo(actualResult.getGlcode()); - assertThat(row.get("budgetCheckRequired")).isEqualTo(actualResult.getBudgetCheckRequired()); - } - - @Test - @Sql(scripts = { "/sql/clearChartOfAccount.sql", "/sql/insertChartOfAccountData.sql" }) - public void testUpdate() { - ChartOfAccountEntity chartOfAccountEntity = getChartOfAccountEntity(); - ChartOfAccountEntity actualResult =chartOfAccountJdbcRepository.update(chartOfAccountEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_chartofaccount", - new ChartOfAccountResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("glcode")).isEqualTo(actualResult.getGlcode()); - } - - @Test - @Sql(scripts = { "/sql/clearChartOfAccount.sql", "/sql/insertChartOfAccountData.sql" }) - public void testSearch() { - Pagination page = (Pagination) chartOfAccountJdbcRepository.search(getChartOfAccountSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getGlcode()).isEqualTo("glcode"); - assertThat(page.getPagedData().get(0).getBudgetCheckRequired()).isEqualTo(true); - } - - @Test - @Sql(scripts = { "/sql/clearChartOfAccount.sql", "/sql/insertChartOfAccountData.sql" }) - public void testFindById() { - ChartOfAccountEntity chartOfAccountEntity = getChartOfAccountEntity(); - ChartOfAccountEntity actualResult =chartOfAccountJdbcRepository.findById(chartOfAccountEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_chartofaccount", - new ChartOfAccountResultExtractor()); - assertThat(result.get(0).get("id")).isEqualTo("2"); - assertThat(result.get(0).get("name")).isEqualTo("name"); - assertThat(result.get(0).get("glcode")).isEqualTo("glcode"); - } - -/* @Test - public void testFindByAccountCodePurposeId() { - ChartOfAccountEntity chartOfAccountEntity = getChartOfAccountEntity(); - ChartOfAccountEntity actualResult =chartOfAccountJdbcRepository.findByAccountCodePurposeId(chartOfAccountEntity); - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_chartofaccount", - new ChartOfAccountResultExtractor()); - assertThat(result.get(0).get("id")).isEqualTo("2"); - assertThat(result.get(0).get("name")).isEqualTo("name"); - assertThat(result.get(0).get("glcode")).isEqualTo("glcode"); - }*/ - - private ChartOfAccountEntity getChartOfAccountEntity() { - ChartOfAccountEntity chartOfAccountEntity = new ChartOfAccountEntity(); - ChartOfAccount chartOfAccount = getChartOfAccountDomain(); - chartOfAccountEntity.setId(chartOfAccount.getId()); - chartOfAccountEntity.setGlcode(chartOfAccount.getGlcode()); - chartOfAccountEntity.setName(chartOfAccount.getName()); - chartOfAccountEntity.setDescription(chartOfAccount.getDescription()); - chartOfAccountEntity.setIsActiveForPosting(chartOfAccount.getIsActiveForPosting()); - chartOfAccountEntity.setType(chartOfAccount.getType()); - chartOfAccountEntity.setClassification(chartOfAccount.getClassification()); - chartOfAccountEntity.setFunctionRequired(chartOfAccount.getFunctionRequired()); - chartOfAccountEntity.setBudgetCheckRequired(chartOfAccount.getBudgetCheckRequired()); - chartOfAccountEntity.setTenantId("default"); - chartOfAccountEntity.setCreatedBy("1"); - chartOfAccountEntity.setLastModifiedBy("1"); - return chartOfAccountEntity; - } - - private ChartOfAccount getChartOfAccountDomain() { - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("B") - .glcode("glcode").name("name") - .description("description").isActiveForPosting(true) - .type('B').classification((long) 123456).functionRequired(true) - .budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } - - class ChartOfAccountResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("glcode", resultSet.getString("glcode")); - put("name", resultSet.getString("name")); - put("accountCodePurposeId", resultSet.getString("accountCodePurposeId")); - put("description", resultSet.getString("description")); - put("isActiveForPosting", resultSet.getBoolean("isActiveForPosting")); - put("parentId", resultSet.getString("parentId")); - put("type", resultSet.getString("type")); - put("functionRequired", resultSet.getString("functionRequired")); - put("budgetCheckRequired", resultSet.getString("budgetCheckRequired")); - put("majorCode", resultSet.getString("majorCode")); - put("isSubLedger", resultSet.getString("isSubLedger")); - put("functionRequired", resultSet.getBoolean("functionRequired")); - put("budgetCheckRequired", resultSet.getBoolean("budgetCheckRequired")); - put("majorCode", resultSet.getString("majorCode")); - } - }; - - rows.add(row); - } - return rows; - } - } - - private ChartOfAccountSearch getChartOfAccountSearch() { - ChartOfAccountSearch chartOfAccountSearch = new ChartOfAccountSearch(); - chartOfAccountSearch.setId("2"); - //chartOfAccountSearch.setGlcode("glcode"); - chartOfAccountSearch.setName("name"); - chartOfAccountSearch.setDescription("description"); - chartOfAccountSearch.setIsActiveForPosting(true); - chartOfAccountSearch.setType(Character.valueOf('B')); - chartOfAccountSearch.setClassification(123456l); - chartOfAccountSearch.setBudgetCheckRequired(true); - chartOfAccountSearch.setIsSubLedger(true); - chartOfAccountSearch.setMajorCode("majorcode"); - chartOfAccountSearch.setFunctionRequired(true); - chartOfAccountSearch.setAccountCodePurpose(getAccountCodePurpose()); - chartOfAccountSearch.setParentId(getParent()); - chartOfAccountSearch.setPageSize(500); - chartOfAccountSearch.setOffset(0); - chartOfAccountSearch.setSortBy("name desc"); - chartOfAccountSearch.setTenantId("default"); - return chartOfAccountSearch; - } - - private ChartOfAccount getParent(){ - return ChartOfAccount.builder().id("1").glcode("glcode").name("name") - .isActiveForPosting(true).type(Character.valueOf('B')).classification(123456l) - .isSubLedger(true).accountCodePurpose(getAccountCodePurpose()).budgetCheckRequired(true) - .majorCode("majorcode").functionRequired(true).build(); - } - - private AccountCodePurpose getAccountCodePurpose(){ - return AccountCodePurpose.builder().id("P").name("accountpurpose").build(); - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/FunctionJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/FunctionJdbcRepositoryTest.java deleted file mode 100644 index 30e11a35db0..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/FunctionJdbcRepositoryTest.java +++ /dev/null @@ -1,209 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.domain.model.FunctionSearch; -import org.egov.egf.master.persistence.entity.FunctionEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class FunctionJdbcRepositoryTest { - - private FunctionJdbcRepository functionJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - functionJdbcRepository = new FunctionJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/clearFunction.sql" }) - public void test_create() { - - FunctionEntity function = FunctionEntity.builder().id("46353532").code("code").name("name").active(true) - .level(1).parentId("1").build(); - function.setTenantId("default"); - FunctionEntity actualResult = functionJdbcRepository.create(function); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_function", - new FunctionResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - assertThat(row.get("parentId")).isEqualTo(actualResult.getParentId()); - - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = { "/sql/clearFunction.sql" }) - public void test_create_with_tenantId_null() { - - FunctionEntity function = FunctionEntity.builder().code("code").name("name").active(true).level(1).parentId("1") - .level(1).build(); - functionJdbcRepository.create(function); - - } - - @Test - @Sql(scripts = { "/sql/clearFunction.sql", "/sql/insertFunctionData.sql" }) - public void test_update() { - - FunctionEntity function = FunctionEntity.builder().code("codeU").name("nameU").active(true).id("2").level(1) - .build(); - function.setTenantId("default"); - FunctionEntity actualResult = functionJdbcRepository.update(function); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_function", - new FunctionResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - - } - - @Test - @Sql(scripts = { "/sql/clearFunction.sql", "/sql/insertFunctionData.sql" }) - public void test_search() { - - Pagination page = (Pagination) functionJdbcRepository.search(getFunctionSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = { "/sql/clearFunction.sql", "/sql/insertFunctionData.sql" }) - public void test_search_with_no_parameter() { - - Pagination page = (Pagination) functionJdbcRepository.search(new FunctionSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = { "/sql/clearFunction.sql", "/sql/insertFunctionData.sql" }) - public void test_find_by_id() { - - FunctionEntity functionEntity = FunctionEntity.builder().id("2").build(); - functionEntity.setTenantId("default"); - FunctionEntity result = functionJdbcRepository.findById(functionEntity); - assertThat(result.getId()).isEqualTo("2"); - assertThat(result.getName()).isEqualTo("name"); - assertThat(result.getCode()).isEqualTo("code"); - - } - - @Test - @Sql(scripts = { "/sql/clearFunction.sql", "/sql/insertFunctionData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - FunctionEntity functionEntity = FunctionEntity.builder().id("5").build(); - functionEntity.setTenantId("default"); - FunctionEntity result = functionJdbcRepository.findById(functionEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/clearFunction.sql", "/sql/insertFunctionData.sql" }) - public void test_search_invalid_sort_option() { - - FunctionSearch search = getFunctionSearch(); - search.setSortBy("desc"); - functionJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/clearFunction.sql", "/sql/insertFunctionData.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - FunctionSearch search = getFunctionSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) functionJdbcRepository.search(getFunctionSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - class FunctionResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("name", resultSet.getString("name")); - put("code", resultSet.getString("code")); - put("active", resultSet.getBoolean("active")); - put("level", resultSet.getLong("level")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - put("parentId", resultSet.getString("parentId")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private FunctionSearch getFunctionSearch() { - FunctionSearch functionSearch = new FunctionSearch(); - functionSearch.setId("2"); - functionSearch.setName("name"); - functionSearch.setCode("code"); - functionSearch.setActive(true); - functionSearch.setLevel(1); - functionSearch.setParentId(parentFunction()); - functionSearch.setPageSize(500); - functionSearch.setOffset(0); - functionSearch.setSortBy("name desc"); - return functionSearch; - } - - private Function parentFunction() { - Function function = Function.builder().name("parent").code("001").level(0).active(true).id("1").build(); - function.setTenantId("default"); - return function; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/FundJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/FundJdbcRepositoryTest.java deleted file mode 100644 index 30599f3490c..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/FundJdbcRepositoryTest.java +++ /dev/null @@ -1,189 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.FundSearch; -import org.egov.egf.master.persistence.entity.FundEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class FundJdbcRepositoryTest { - - private FundJdbcRepository fundJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - fundJdbcRepository = new FundJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/clearFund.sql" }) - public void test_create() { - - FundEntity fund = FundEntity.builder().id("2374257").code("code").name("name").active(true).level(1l) - .parentId("1").identifier('F').build(); - fund.setTenantId("default"); - FundEntity actualResult = fundJdbcRepository.create(fund); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_fund", - new FundResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - assertThat(row.get("parentId")).isEqualTo(actualResult.getParentId()); - - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = { "/sql/clearFund.sql" }) - public void test_create_with_tenantId_null() { - - FundEntity fund = FundEntity.builder().code("code").name("name").active(true).level(1l) - .parentId("1").identifier('F').build(); - fundJdbcRepository.create(fund); - - } - - @Test - @Sql(scripts = { "/sql/clearFund.sql", "/sql/insertFundData.sql" }) - public void test_update() { - - FundEntity fund = FundEntity.builder().code("codeU").name("nameU").active(true).level(1l) - .identifier('F').id("2").build(); - fund.setTenantId("default"); - FundEntity actualResult = fundJdbcRepository.update(fund); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_fund", - new FundResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - - } - - @Test - @Sql(scripts = { "/sql/clearFund.sql", "/sql/insertFundData.sql" }) - public void test_search() { - - Pagination page = (Pagination) fundJdbcRepository.search(getFundSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = { "/sql/clearFund.sql", "/sql/insertFundData.sql" }) - public void test_find_by_id() { - - FundEntity fundEntity = FundEntity.builder().id("2").build(); - fundEntity.setTenantId("default"); - FundEntity result = fundJdbcRepository.findById(fundEntity); - assertThat(result.getId()).isEqualTo("2"); - assertThat(result.getName()).isEqualTo("name"); - assertThat(result.getCode()).isEqualTo("code"); - - } - - @Test - @Sql(scripts = { "/sql/clearFund.sql", "/sql/insertFundData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - FundEntity fundEntity = FundEntity.builder().id("5").build(); - fundEntity.setTenantId("default"); - FundEntity result = fundJdbcRepository.findById(fundEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/clearFund.sql", "/sql/insertFundData.sql" }) - public void test_search_invalid_sort_option() { - - FundSearch search = getFundSearch(); - search.setSortBy("desc"); - fundJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/clearFund.sql", "/sql/insertFundData.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - FundSearch search = getFundSearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) fundJdbcRepository.search(getFundSearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - class FundResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("name", resultSet.getString("name")); - put("code", resultSet.getString("code")); - put("active", resultSet.getBoolean("active")); - put("level", resultSet.getLong("level")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - put("identifier", resultSet.getString("identifier")); - put("parentId", resultSet.getString("parentId")); - - } - }; - - rows.add(row); - } - return rows; - } - } - - private FundSearch getFundSearch() { - FundSearch fundSearch = new FundSearch(); - fundSearch.setName("name"); - fundSearch.setCode("code"); - fundSearch.setPageSize(500); - fundSearch.setOffset(0); - fundSearch.setSortBy("name desc"); - return fundSearch; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/RecoveryJdbcRepositoryTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/RecoveryJdbcRepositoryTest.java deleted file mode 100644 index e63f81c5c23..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/persistence/repository/RecoveryJdbcRepositoryTest.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.egov.egf.master.persistence.repository; - -import org.egov.common.domain.exception.InvalidDataException; -import org.egov.common.domain.model.Pagination; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.Recovery; -import org.egov.egf.master.domain.model.RecoverySearch; -import org.egov.egf.master.persistence.entity.RecoveryEntity; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertNull; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Ignore -public class RecoveryJdbcRepositoryTest { - - private RecoveryJdbcRepository recoveryJdbcRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - @Before - public void setUp() throws Exception { - recoveryJdbcRepository = new RecoveryJdbcRepository(namedParameterJdbcTemplate); - } - - @Test - @Sql(scripts = { "/sql/clearRecovery.sql" }) - public void test_create() { - - RecoveryEntity recovery = RecoveryEntity.builder().id("2374257").code("code").name("name").active(true) - .mode('M').accountNumber("30492234547").flat(100.00).ifscCode("ifsccode").chartOfAccountId("1").remittanceMode('M').remitted("test").build(); - recovery.setTenantId("default"); - RecoveryEntity actualResult = recoveryJdbcRepository.create(recovery); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_recovery", - new RecoveryResultExtractor()); - Map row = result.get(0); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - - } - - @Test(expected = DataIntegrityViolationException.class) - @Sql(scripts = { "/sql/clearRecovery.sql" }) - public void test_create_with_tenantId_null() { - - RecoveryEntity recovery = RecoveryEntity.builder().id("2374257").code("code").name("name").active(true) - .mode('M').accountNumber("30492234547").flat(100.00).ifscCode("ifsccode").chartOfAccountId("1").remittanceMode('M').remitted("test").build(); - recoveryJdbcRepository.create(recovery); - - } - - @Test - @Sql(scripts = { "/sql/clearRecovery.sql", "/sql/insertRecoveryData.sql" }) - public void test_update() { - - RecoveryEntity recovery = RecoveryEntity.builder().id("2374257").code("code").name("name").active(true) - .mode('M').accountNumber("30492234547").flat(100.00).ifscCode("ifsccode").chartOfAccountId("1").remittanceMode('M').remitted("test").build(); - recovery.setTenantId("default"); - RecoveryEntity actualResult = recoveryJdbcRepository.update(recovery); - - List> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_recovery", - new RecoveryResultExtractor()); - Map row = result.get(0); - assertThat(row.get("id")).isEqualTo(actualResult.getId()); - assertThat(row.get("name")).isEqualTo(actualResult.getName()); - assertThat(row.get("code")).isEqualTo(actualResult.getCode()); - - } - - @Test - @Sql(scripts = { "/sql/clearRecovery.sql", "/sql/insertRecoveryData.sql" }) - public void test_search() { - - Pagination page = (Pagination) recoveryJdbcRepository.search(getRecoverySearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - @Test - @Sql(scripts = { "/sql/clearRecovery.sql", "/sql/insertRecoveryData.sql" }) - public void test_find_by_id() { - - RecoveryEntity recoveryEntity = RecoveryEntity.builder().id("2374257").build(); - recoveryEntity.setTenantId("default"); - RecoveryEntity result = recoveryJdbcRepository.findById(recoveryEntity); - assertThat(result.getId()).isEqualTo("2374257"); - assertThat(result.getName()).isEqualTo("name"); - assertThat(result.getCode()).isEqualTo("code"); - - } - - @Test - @Sql(scripts = { "/sql/clearRecovery.sql", "/sql/insertRecoveryData.sql" }) - public void test_find_by_invalid_id_should_return_null() { - - RecoveryEntity recoveryEntity = RecoveryEntity.builder().id("5").build(); - recoveryEntity.setTenantId("default"); - RecoveryEntity result = recoveryJdbcRepository.findById(recoveryEntity); - assertNull(result); - - } - - @Test(expected = InvalidDataException.class) - @Sql(scripts = { "/sql/clearRecovery.sql", "/sql/insertRecoveryData.sql" }) - public void test_search_invalid_sort_option() { - - RecoverySearch search = getRecoverySearch(); - search.setSortBy("desc"); - recoveryJdbcRepository.search(search); - - } - - @Test - @Sql(scripts = { "/sql/clearRecovery.sql", "/sql/insertRecoveryData.sql" }) - public void test_search_without_pagesize_offset_sortby() { - - RecoverySearch search = getRecoverySearch(); - search.setSortBy(null); - search.setPageSize(null); - search.setOffset(null); - Pagination page = (Pagination) recoveryJdbcRepository.search(getRecoverySearch()); - assertThat(page.getPagedData().get(0).getName()).isEqualTo("name"); - assertThat(page.getPagedData().get(0).getCode()).isEqualTo("code"); - assertThat(page.getPagedData().get(0).getActive()).isEqualTo(true); - - } - - class RecoveryResultExtractor implements ResultSetExtractor>> { - @Override - public List> extractData(ResultSet resultSet) throws SQLException, DataAccessException { - List> rows = new ArrayList<>(); - while (resultSet.next()) { - Map row = new HashMap() { - { - put("id", resultSet.getString("id")); - put("name", resultSet.getString("name")); - put("code", resultSet.getString("code")); - put("active", resultSet.getBoolean("active")); - put("createdBy", resultSet.getString("createdBy")); - put("createdDate", resultSet.getString("createdDate")); - put("lastModifiedBy", resultSet.getString("lastModifiedBy")); - put("lastModifiedDate", resultSet.getString("lastModifiedDate")); - } - }; - - rows.add(row); - } - return rows; - } - } - - private RecoverySearch getRecoverySearch() { - RecoverySearch recoverySearch = new RecoverySearch(); - recoverySearch.setName("name"); - recoverySearch.setCode("code"); - recoverySearch.setPageSize(500); - recoverySearch.setOffset(0); - recoverySearch.setSortBy("name desc"); - return recoverySearch; - } - - private ChartOfAccount getChartOfAccount() { - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("1") - .glcode("glcode").name("name").description("description") - .isActiveForPosting(true).type('A') - .classification((long) 123456).functionRequired(true) - .budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountCodePurposeControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountCodePurposeControllerTest.java deleted file mode 100644 index de77e2d0ea7..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountCodePurposeControllerTest.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountCodePurpose; -import org.egov.egf.master.domain.model.AccountCodePurposeSearch; -import org.egov.egf.master.domain.service.AccountCodePurposeService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(AccountCodePurposeController.class) -@Import(TestConfiguration.class) -public class AccountCodePurposeControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - AccountCodePurposeService accountCodePurposeService; - - @Captor - private ArgumentCaptor> captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void testCreate() throws IOException, Exception { - when(accountCodePurposeService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getAccountCodePurposes()); - mockMvc.perform(post("/accountcodepurposes/_create?tenantId=default") - .content(resources.readRequest("accountcodepurpose/accountcodepurpose_create_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json( - resources.readResponse("accountcodepurpose/accountcodepurpose_create_response.json"))); - - verify(accountCodePurposeService).create(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("name", actualRequest.get(0).getName()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void testCreate_Error() throws IOException, Exception { - when(accountCodePurposeService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getAccountCodePurposes()); - mockMvc.perform(post("/accountcodepurposes/_create") - .content(resources.readRequest("accountcodepurpose/accountcodepurpose_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void testUpdate() throws IOException, Exception { - when(accountCodePurposeService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getUpdateAccountCodePurposes()); - - mockMvc.perform(post("/accountcodepurposes/_update?tenantId=default") - .content(resources.readRequest("accountcodepurpose/accountcodepurpose_update_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json( - resources.readResponse("accountcodepurpose/accountcodepurpose_update_response.json"))); - - verify(accountCodePurposeService).update(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("nameU", actualRequest.get(0).getName()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getAccountCodePurposes()); - page.getPagedData().get(0).setId("1"); - - when(accountCodePurposeService.search(any(AccountCodePurposeSearch.class), any(BindingResult.class))) - .thenReturn(page); - - mockMvc.perform(post("/accountcodepurposes/_search?tenantId=default").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json( - resources.readResponse("accountcodepurpose/accountcodepurpose_search_response.json"))); - - } - - private List getAccountCodePurposes() { - List accountCodePurposes = new ArrayList(); - AccountCodePurpose accountCodePurpose = AccountCodePurpose.builder().id("1").name("name").build(); - accountCodePurpose.setTenantId("default"); - accountCodePurposes.add(accountCodePurpose); - return accountCodePurposes; - } - - private List getUpdateAccountCodePurposes() { - List accountCodePurposes = new ArrayList(); - AccountCodePurpose accountCodePurpose = AccountCodePurpose.builder().id("1").name("nameU").build(); - accountCodePurpose.setTenantId("default"); - accountCodePurposes.add(accountCodePurpose); - return accountCodePurposes; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountDetailKeyControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountDetailKeyControllerTest.java deleted file mode 100644 index ca2168bc55f..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountDetailKeyControllerTest.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountDetailKey; -import org.egov.egf.master.domain.model.AccountDetailKeySearch; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.service.AccountDetailKeyService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(AccountDetailKeyController.class) -@Import(TestConfiguration.class) -public class AccountDetailKeyControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - AccountDetailKeyService accountDetailKeyService; - - @Captor - private ArgumentCaptor> captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void testCreate() throws IOException, Exception { - when(accountDetailKeyService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getAccountDetailKies()); - mockMvc.perform(post("/accountdetailkeys/_create?tenantId=default") - .content(resources.readRequest("accountdetailkey/accountdetailkey_create_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("accountdetailkey/accountdetailkey_create_response.json"))); - - verify(accountDetailKeyService).create(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("1", actualRequest.get(0).getKey()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void testCreate_Error() throws IOException, Exception { - when(accountDetailKeyService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getAccountDetailKies()); - mockMvc.perform(post("/accountdetailkeys/_create") - .content(resources.readRequest("accountdetailkey/accountdetailkey_create_invalid_fieldvalue.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void testUpdate() throws IOException, Exception { - when(accountDetailKeyService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getUpdateAccountDetailKies()); - - mockMvc.perform(post("/accountdetailkeys/_update?tenantId=default") - .content(resources.readRequest("accountdetailkey/accountdetailkey_update_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("accountdetailkey/accountdetailkey_update_response.json"))); - - verify(accountDetailKeyService).update(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("2", actualRequest.get(0).getKey()); - assertEquals("1", actualRequest.get(0).getAccountDetailType().getId()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getAccountDetailKies()); - page.getPagedData().get(0).setId("1"); - - when(accountDetailKeyService.search(any(AccountDetailKeySearch.class), any(BindingResult.class))) - .thenReturn(page); - - mockMvc.perform(post("/accountdetailkeys/_search?tenantId=default").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content() - .json(resources.readResponse("accountdetailkey/accountdetailkey_search_response.json"))); - - } - - private List getAccountDetailKies() { - List accountDetailKies = new ArrayList(); - AccountDetailKey accountDetailKey = AccountDetailKey.builder().id("1").key("1") - .accountDetailType(getAccountDetailType()).build(); - accountDetailKey.setTenantId("default"); - accountDetailKies.add(accountDetailKey); - return accountDetailKies; - } - - private List getUpdateAccountDetailKies() { - List accountDetailKies = new ArrayList(); - AccountDetailKey accountDetailKey = AccountDetailKey.builder().id("1").key("2") - .accountDetailType(getAccountDetailType()).build(); - accountDetailKey.setTenantId("default"); - accountDetailKies.add(accountDetailKey); - return accountDetailKies; - } - - private AccountDetailType getAccountDetailType() { - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("contractor") - .fullyQualifiedName("abc/acb").active(true).build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountDetailTypeControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountDetailTypeControllerTest.java deleted file mode 100644 index 6a7f222380b..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountDetailTypeControllerTest.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountDetailTypeSearch; -import org.egov.egf.master.domain.service.AccountDetailTypeService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(AccountDetailTypeController.class) -@Import(TestConfiguration.class) -public class AccountDetailTypeControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - AccountDetailTypeService accountDetailTypeService; - - @Captor - private ArgumentCaptor> captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void testCreate() throws IOException, Exception { - when(accountDetailTypeService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getAccountDetailTypes()); - mockMvc.perform(post("/accountdetailtypes/_create?tenantId=default") - .content(resources.readRequest("accountdetailtype/accountdetailtype_create_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json( - resources.readResponse("accountdetailtype/accountdetailtype_create_response.json"))); - - verify(accountDetailTypeService).create(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("name", actualRequest.get(0).getName()); - assertEquals("contractor", actualRequest.get(0).getTableName()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void testCreate_Error() throws IOException, Exception { - when(accountDetailTypeService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getAccountDetailTypes()); - mockMvc.perform(post("/accountdetailtypes/_create") - .content(resources.readRequest("accountdetailtype/accountdetailtype_create_invalid_fieldvalue.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void testUpdate() throws IOException, Exception { - when(accountDetailTypeService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getUpdateAccountDetailTypes()); - - mockMvc.perform(post("/accountdetailtypes/_update?tenantId=default") - .content(resources.readRequest("accountdetailtype/accountdetailtype_update_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json( - resources.readResponse("accountdetailtype/accountdetailtype_update_response.json"))); - - verify(accountDetailTypeService).update(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("nameU", actualRequest.get(0).getName()); - assertEquals("abc/contractorU", actualRequest.get(0).getFullyQualifiedName()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getAccountDetailTypes()); - page.getPagedData().get(0).setId("1"); - - when(accountDetailTypeService.search(any(AccountDetailTypeSearch.class), any(BindingResult.class))) - .thenReturn(page); - - mockMvc.perform(post("/accountdetailtypes/_search?tenantId=default").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json( - resources.readResponse("accountdetailtype/accountdetailtype_search_response.json"))); - - } - - private List getAccountDetailTypes() { - List accountDetailTypes = new ArrayList(); - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("contractor") - .fullyQualifiedName("abc/contractor").active(true).build(); - accountDetailType.setTenantId("default"); - accountDetailTypes.add(accountDetailType); - return accountDetailTypes; - } - - private List getUpdateAccountDetailTypes() { - List accountDetailTypes = new ArrayList(); - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("nameU").tableName("contractorU") - .fullyQualifiedName("abc/contractorU").active(true).build(); - accountDetailType.setTenantId("default"); - accountDetailTypes.add(accountDetailType); - return accountDetailTypes; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountEntityControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountEntityControllerTest.java deleted file mode 100644 index 25ed29e431f..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/AccountEntityControllerTest.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.egov.egf.master.web.controller; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.AccountEntity; -import org.egov.egf.master.domain.model.AccountEntitySearch; -import org.egov.egf.master.domain.service.AccountEntityService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@RunWith(SpringRunner.class) -@WebMvcTest(AccountEntityController.class) -@Import(TestConfiguration.class) -public class AccountEntityControllerTest { - - @MockBean - AccountEntityService accountEntityService; - @Autowired - private MockMvc mockMvc; - @Captor - private ArgumentCaptor> captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void testCreate() throws IOException, Exception { - when(accountEntityService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getAccountEntities()); - mockMvc.perform( - post("/accountentities/_create?tenantId=default").content(resources.readRequest("accountentity/accountentity_create_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is(201)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("accountentity/accountentity_create_response.json"))); - - verify(accountEntityService).create(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("name", actualRequest.get(0).getName()); - assertEquals("code", actualRequest.get(0).getCode()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void testCreate_Error() throws IOException, Exception { - when(accountEntityService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getAccountEntities()); - mockMvc.perform(post("/accountentities/_create?tenantId=default") - .content(resources.readRequest("accountentity/accountentity_create_invalid_fieldvalue.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void testUpdate() throws IOException, Exception { - when(accountEntityService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getUpdateAccountEntities()); - - mockMvc.perform( - post("/accountentities/_update?tenantId=default").content(resources.readRequest("accountentity/accountentity_update_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is(201)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("accountentity/accountentity_update_response.json"))); - - verify(accountEntityService).update(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("nameU", actualRequest.get(0).getName()); - assertEquals("codeU", actualRequest.get(0).getCode()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getAccountEntities()); - page.getPagedData().get(0).setId("1"); - - when(accountEntityService.search(any(AccountEntitySearch.class), any(BindingResult.class))).thenReturn(page); - - mockMvc.perform(post("/accountentities/_search?tenantId=default").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("accountentity/accountentity_search_response.json"))); - - } - - private List getAccountEntities() { - List accountEntities = new ArrayList(); - AccountEntity accountEntity = AccountEntity.builder().id("1").name("name").code("code").active(true) - .accountDetailType(getAccountDetaialType()).description("entity").build(); - accountEntity.setTenantId("default"); - accountEntities.add(accountEntity); - return accountEntities; - } - - private List getUpdateAccountEntities() { - List accountEntities = new ArrayList(); - AccountEntity accountEntity = AccountEntity.builder().name("nameU").code("codeU").active(true) - .accountDetailType(getAccountDetaialType()).id("1").description("entity").build(); - accountEntity.setTenantId("default"); - accountEntities.add(accountEntity); - return accountEntities; - } - - private AccountDetailType getAccountDetaialType() { - - AccountDetailType accountDetailType = AccountDetailType.builder().id("1").name("name").tableName("table") - .fullyQualifiedName("abc/table").build(); - accountDetailType.setTenantId("default"); - return accountDetailType; - } - -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/BankAccountControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/BankAccountControllerTest.java deleted file mode 100644 index d047125ed3c..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/BankAccountControllerTest.java +++ /dev/null @@ -1,178 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankAccount; -import org.egov.egf.master.domain.model.BankAccountSearch; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.service.BankAccountService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(BankAccountController.class) -@Import(TestConfiguration.class) -public class BankAccountControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private BankAccountService bankAccountService; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Captor - private ArgumentCaptor> captor; - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testCreate() throws IOException, Exception { - when(bankAccountService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn((getBankAccounts())); - - mockMvc.perform(post("/bankaccounts/_create?tenantId=default") - .content(resources.readRequest("bankaccount/bankAccount_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect( - content().json(resources.readResponse("bankaccount/bankAccount_create_valid_response.json"))); - - verify(bankAccountService).create(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("1", actualRequest.get(0).getBankBranch().getId()); - assertEquals("1", actualRequest.get(0).getChartOfAccount().getId()); - assertEquals("2", actualRequest.get(0).getFund().getId()); - assertEquals("0004", actualRequest.get(0).getAccountNumber()); - assertEquals(true, actualRequest.get(0).getActive()); - } - - @Test - public void testUpdate() throws IOException, Exception { - when(bankAccountService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn((getUpdatedBankAccounts())); - - mockMvc.perform(post("/bankaccounts/_update?tenantId=default") - .content(resources.readRequest("bankaccount/bankAccount_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect( - content().json(resources.readResponse("bankaccount/bankAccount_update_valid_response.json"))); - - verify(bankAccountService).update(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("1", actualRequest.get(0).getBankBranch().getId()); - assertEquals("1", actualRequest.get(0).getChartOfAccount().getId()); - assertEquals("2", actualRequest.get(0).getFund().getId()); - assertEquals("0004", actualRequest.get(0).getAccountNumber()); - assertEquals("testupdate", actualRequest.get(0).getAccountType()); - assertEquals(true, actualRequest.get(0).getActive()); - } - - @Test - public void testCreate_Error() throws IOException, Exception { - - when(bankAccountService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn((getBankAccounts())); - - mockMvc.perform(post("/bankaccounts/_create") - .content(resources.readRequest("bankaccount/bankaccount_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void testSearch() throws IOException, Exception { - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getBankAccounts()); - page.getPagedData().get(0).setId("1"); - - when(bankAccountService.search(any(BankAccountSearch.class), any(BindingResult.class))).thenReturn(page); - - mockMvc.perform(post("/bankaccounts/_search?tenantId=default").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect( - content().json(resources.readResponse("bankaccount/bankAccount_search_valid_response.json"))); - } - - private List getBankAccounts() { - List bankAccounts = new ArrayList(); - BankAccount bankAccount = BankAccount.builder().accountNumber("0004").accountType("test") - .description("accountNumber").active(true).payTo("tester").build(); - BankBranch bankBranch = BankBranch.builder().id("1").build(); - bankBranch.setTenantId("default"); - Bank bank = Bank.builder().id("1").active(true).type("Bank").build(); - bank.setTenantId("default"); - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("1").build(); - chartOfAccount.setTenantId("default"); - Fund fund = Fund.builder().id("2").build(); - fund.setTenantId("default"); - bankBranch.setBank(bank); - bankAccount.setBankBranch(bankBranch); - bankAccount.setChartOfAccount(chartOfAccount); - bankAccount.setFund(fund); - bankAccount.setTenantId("default"); - bankAccounts.add(bankAccount); - return bankAccounts; - } - - private List getUpdatedBankAccounts() { - List bankAccounts = new ArrayList(); - BankAccount bankAccount = BankAccount.builder().accountNumber("0004").accountType("testupdate") - .description("accountNumber").active(true).payTo("tester").build(); - BankBranch bankBranch = BankBranch.builder().id("1").build(); - bankBranch.setTenantId("default"); - Bank bank = Bank.builder().id("1").active(true).type("Bank").build(); - bank.setTenantId("default"); - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("1").build(); - chartOfAccount.setTenantId("default"); - Fund fund = Fund.builder().id("2").build(); - fund.setTenantId("default"); - bankBranch.setBank(bank); - bankAccount.setBankBranch(bankBranch); - bankAccount.setChartOfAccount(chartOfAccount); - bankAccount.setFund(fund); - bankAccount.setTenantId("default"); - bankAccounts.add(bankAccount); - return bankAccounts; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/BankBranchControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/BankBranchControllerTest.java deleted file mode 100644 index bf2ce0a72ec..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/BankBranchControllerTest.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankBranch; -import org.egov.egf.master.domain.model.BankBranchSearch; -import org.egov.egf.master.domain.service.BankBranchService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(BankBranchController.class) -@Import(TestConfiguration.class) -public class BankBranchControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private BankBranchService bankBranchService; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Captor - private ArgumentCaptor> captor; - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testCreate() throws IOException, Exception { - when(bankBranchService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn((getBankBranches())); - - mockMvc.perform(post("/bankbranches/_create?tenantId=default") - .content(resources.readRequest("bankbranch/bankbranch_create_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("bankbranch/bankbranch_create_response.json"))); - - verify(bankBranchService).create(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("code", actualRequest.get(0).getCode()); - assertEquals("default", actualRequest.get(0).getTenantId()); - assertEquals(true, actualRequest.get(0).getActive()); - } - - @Test - public void testUpdate() throws IOException, Exception { - when(bankBranchService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn((getUpdatedBankBranches())); - - mockMvc.perform(post("/bankbranches/_update?tenantId=default") - .content(resources.readRequest("bankbranch/bankbranch_update_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("bankbranch/bankbranch_update_response.json"))); - - verify(bankBranchService).update(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("1", actualRequest.get(0).getBank().getId()); - assertEquals("default", actualRequest.get(0).getTenantId()); - assertEquals(true, actualRequest.get(0).getActive()); - } - - @Test - public void testSearch() throws IOException, Exception { - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setOffset(0); - page.setPageSize(0); - page.setPagedData(getBankBranches()); - page.getPagedData().get(0).setId("1"); - - when(bankBranchService.search(any(BankBranchSearch.class), any(BindingResult.class))).thenReturn(page); - - mockMvc.perform(post("/bankbranches/_search?tenantId=default").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("bankbranch/bankbranch_search_response.json"))); - } - - @Test - public void testCreate_Error() throws IOException, Exception { - - when(bankBranchService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))).thenReturn((getBankBranches())); - - mockMvc.perform(post("/bankbranches/_create") - .content(resources.readRequest("bankbranch/bankbranch_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - private List getBankBranches() { - List bankBranches = new ArrayList(); - Bank bank = Bank.builder().id("1").build(); - BankBranch bankBranch = BankBranch.builder().bank(bank).code("code").name("name").address("Bangalore") - .address2("Bangalore").city("Bangalore").state("Bangalore").pincode("Bangalore").phone("Bangalore") - .fax("Bangalore").contactPerson("Bangalore").active(true).description("Bangalore").micr("Bangalore") - .build(); - bankBranch.setTenantId("default"); - bankBranches.add(bankBranch); - return bankBranches; - } - - private List getUpdatedBankBranches() { - List bankBranches = new ArrayList(); - Bank bank = Bank.builder().id("1").build(); - BankBranch bankBranch = BankBranch.builder().bank(bank).code("codeupdate").name("nameupdate") - .address("Bangalore").address2("Bangalore").city("Bangalore").state("Bangalore").pincode("Bangalore") - .phone("Bangalore").fax("Bangalore").contactPerson("Bangalore").active(true).description("Bangalore") - .micr("Bangalore").build(); - bankBranch.setTenantId("default"); - bankBranches.add(bankBranch); - return bankBranches; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/BankControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/BankControllerTest.java deleted file mode 100644 index 941d70a3b3d..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/BankControllerTest.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.Bank; -import org.egov.egf.master.domain.model.BankSearch; -import org.egov.egf.master.domain.service.BankService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(BankController.class) -@Import(TestConfiguration.class) -public class BankControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private BankService bankService; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Captor - private ArgumentCaptor> captor; - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - /*@Test - public void testCreate() throws IOException, Exception { - when(bankService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getBanks()); - - mockMvc.perform(post("/banks/_create").content(resources.readRequest("bank/bank_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("bank/bank_create_valid_response.json"))); - - verify(bankService).create(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("name", actualRequest.get(0).getName()); - assertEquals("default", actualRequest.get(0).getTenantId()); - assertEquals(true, actualRequest.get(0).getActive()); - }*/ - - @Test - public void testUpdate() throws IOException, Exception { - when(bankService.update(captor.capture(), any(BindingResult.class), any(RequestInfo.class))).thenReturn((getUpdateBanks())); - - mockMvc.perform(post("/banks/_update?tenantId=default").content(resources.readRequest("bank/bank_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("bank/bank_update_valid_response.json"))); - - verify(bankService).update(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("nameupdate", actualRequest.get(0).getName()); - assertEquals("codeupdate", actualRequest.get(0).getCode()); - assertEquals(true, actualRequest.get(0).getActive()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void testSearch() throws IOException, Exception { - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getBanks()); - page.getPagedData().get(0).setId("1"); - - when(bankService.search(any(BankSearch.class), any(BindingResult.class))).thenReturn(page); - - mockMvc.perform( - post("/banks/_search?tenantId=default").content(resources.getRequestInfo()).contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is(200)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("bank/bank_search_valid_response.json"))); - } - - /*@Test - public void testCreate_Error() throws IOException, Exception { - - when(bankService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))).thenReturn(getBanks()); - - mockMvc.perform( - post("/banks/_create").content(resources.readRequest("bank/bank_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is5xxServerError()); - - } -*/ - private List getBanks() { - List banks = new ArrayList(); - Bank bank = Bank.builder().code("code").name("name").description("description").active(true).type("type") - .build(); - bank.setTenantId("default"); - banks.add(bank); - return banks; - } - - private List getUpdateBanks() { - List banks = new ArrayList(); - Bank bank = Bank.builder().code("codeupdate").name("nameupdate").description("descriptionupdate").active(true) - .type("typeupdate").build(); - bank.setTenantId("default"); - banks.add(bank); - return banks; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/ChartOfAccountControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/ChartOfAccountControllerTest.java deleted file mode 100644 index d280621d391..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/ChartOfAccountControllerTest.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountSearch; -import org.egov.egf.master.domain.service.ChartOfAccountService; -import org.egov.egf.master.web.requests.ChartOfAccountRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(ChartOfAccountController.class) -@Import(TestConfiguration.class) -public class ChartOfAccountControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private ChartOfAccountService chartOfAccountService; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Captor - private ArgumentCaptor captor; - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testCreate() throws IOException, Exception { - when(chartOfAccountService.add(any(List.class),any(BindingResult.class))) - .thenReturn((getChartOfAccounts())); - - mockMvc.perform(post("/chartofaccounts/_create?tenantId=default").content(resources.readRequest("chartofaccount/chartofaccount_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("chartofaccount/chartofaccount_create_valid_response.json"))); - - verify(chartOfAccountService).addToQue(captor.capture()); - - final ChartOfAccountRequest actualRequest = captor.getValue(); - assertEquals("AadharBank", actualRequest.getChartOfAccounts().get(0).getName()); - assertEquals("GLCode", actualRequest.getChartOfAccounts().get(0).getGlcode()); - assertEquals(true, actualRequest.getChartOfAccounts().get(0).getIsActiveForPosting()); - assertEquals("default", actualRequest.getChartOfAccounts().get(0).getTenantId()); - assertEquals(true, actualRequest.getChartOfAccounts().get(0).getBudgetCheckRequired()); - } - - @Test - public void testUpdate() throws IOException, Exception { - when(chartOfAccountService.update(any(List.class),any(BindingResult.class))) - .thenReturn((getUpdatedChartOfAccounts())); - - mockMvc.perform(post("/chartofaccounts/_update?tenantId=default").content(resources.readRequest("chartofaccount/chartofaccount_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("chartofaccount/chartofaccount_update_valid_response.json"))); - - verify(chartOfAccountService).addToQue(captor.capture()); - - final ChartOfAccountRequest actualRequest = captor.getValue(); - assertEquals("MunicipalBank", actualRequest.getChartOfAccounts().get(0).getName()); - assertEquals("GLCode", actualRequest.getChartOfAccounts().get(0).getGlcode()); - assertEquals("DefaultDescription", actualRequest.getChartOfAccounts().get(0).getDescription()); - assertEquals(true, actualRequest.getChartOfAccounts().get(0).getBudgetCheckRequired()); - assertEquals(true, actualRequest.getChartOfAccounts().get(0).getIsActiveForPosting()); - assertEquals("default", actualRequest.getChartOfAccounts().get(0).getTenantId()); - assertEquals(true, actualRequest.getChartOfAccounts().get(0).getFunctionRequired()); - assertEquals(true, actualRequest.getChartOfAccounts().get(0).getBudgetCheckRequired()); - } - - @Test - public void testSearch() throws IOException, Exception { - when(chartOfAccountService.search(any(ChartOfAccountSearch.class), any(BindingResult.class))) - .thenReturn((getPagination())); - - mockMvc.perform( - post("/chartofaccounts/_search?tenantId=default").content(resources.getRequestInfo()).contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is(200)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("chartofaccount/chartofaccount_search_valid_response.json"))); - - - } - - private List getChartOfAccounts() { - List chartOfAccounts = new ArrayList(); - ChartOfAccount chartOfAccount = ChartOfAccount.builder() - .glcode("GLCode").name("AadharBank") - .description("DefaultDescription").isActiveForPosting(true) - .type('B').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).majorCode("GLC").build(); - chartOfAccount.setTenantId("default"); - chartOfAccounts.add(chartOfAccount); - return chartOfAccounts; - } - - private List getUpdatedChartOfAccounts() { - List chartOfAccounts = new ArrayList(); - ChartOfAccount chartOfAccount = ChartOfAccount.builder() - .glcode("GLCode").name("MunicipalBank") - .description("DefaultDescription").isActiveForPosting(true) - .type('B').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - chartOfAccounts.add(chartOfAccount); - return chartOfAccounts; - } - - private Pagination getPagination(){ - Pagination pgn = new Pagination<>(); - pgn.setCurrentPage(0); - pgn.setOffset(0); - pgn.setPageSize(500); - pgn.setTotalPages(1); - pgn.setTotalResults(1); - pgn.setPagedData(getChartOfAccounts()); - return pgn; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/ChartOfAccountDetailControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/ChartOfAccountDetailControllerTest.java deleted file mode 100644 index 7d94034e0ed..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/ChartOfAccountDetailControllerTest.java +++ /dev/null @@ -1,181 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.AccountDetailType; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.ChartOfAccountDetail; -import org.egov.egf.master.domain.model.ChartOfAccountDetailSearch; -import org.egov.egf.master.domain.service.ChartOfAccountDetailService; -import org.egov.egf.master.web.requests.ChartOfAccountDetailRequest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(ChartOfAccountDetailController.class) -@Import(TestConfiguration.class) -public class ChartOfAccountDetailControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private ChartOfAccountDetailService chartOfAccountDetailService; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Captor - private ArgumentCaptor captor; - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testCreate() throws IOException, Exception { - when(chartOfAccountDetailService.add(any(List.class),any(BindingResult.class))) - .thenReturn((getChartOfAccountDetails())); - - mockMvc.perform(post("/chartofaccountdetails/_create?tenantId=default").content(resources.readRequest("chartofaccountdetail/chartofaccountdetail_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("chartofaccountdetail/chartofaccountdetail_create_valid_response.json"))); - - verify(chartOfAccountDetailService).addToQue(captor.capture()); - - final ChartOfAccountDetailRequest actualRequest = captor.getValue(); - assertEquals("830bf3dc60504244babfe228bdf80bac", actualRequest.getChartOfAccountDetails().get(0).getChartOfAccount().getId()); - assertEquals("e647d2406902400cbf3cee71a4befb35", actualRequest.getChartOfAccountDetails().get(0).getAccountDetailType().getId()); - } - - @Test - public void testUpdate() throws IOException, Exception { - when(chartOfAccountDetailService.update(any(List.class),any(BindingResult.class))) - .thenReturn((getUpdatedChartOfAccountDetails())); - - mockMvc.perform(post("/chartofaccountdetails/_update?tenantId=default").content(resources.readRequest("chartofaccountdetail/chartofaccountdetail_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("chartofaccountdetail/chartofaccountdetail_update_valid_response.json"))); - - verify(chartOfAccountDetailService).addToQue(captor.capture()); - - final ChartOfAccountDetailRequest actualRequest = captor.getValue(); - assertEquals("4ff38860184f4f348fa9b9a9ebb25c53", actualRequest.getChartOfAccountDetails().get(0).getId()); - assertEquals("830bf3dc60504244babfe228bdf80bac", actualRequest.getChartOfAccountDetails().get(0).getChartOfAccount().getId()); - assertEquals("9ed569220386455fb3b1f1a81535396d", actualRequest.getChartOfAccountDetails().get(0).getAccountDetailType().getId()); -} - - @Test - public void testSearch() throws IOException, Exception { - when(chartOfAccountDetailService.search(any(ChartOfAccountDetailSearch.class), any(BindingResult.class))) - .thenReturn((getPagination())); - - mockMvc.perform( - post("/chartofaccountdetails/_search?tenantId=default").content(resources.getRequestInfo()).contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is(200)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("chartofaccountdetail/chartofaccountdetail_search_valid_response.json"))); - } - - private List getChartOfAccountDetails(){ - - List chartOfAccountDetails = new ArrayList(); - ChartOfAccountDetail chartOfAccountDetail = ChartOfAccountDetail.builder().build(); - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("830bf3dc60504244babfe228bdf80bac").glcode("1201").name("finalfdf").description("accountNumber").build(); - chartOfAccount.setTenantId("default"); - AccountDetailType accountDetailType = AccountDetailType.builder().id("e647d2406902400cbf3cee71a4befb35").name("final").description("final").tableName("final").active(true).fullyQualifiedName("final").build(); - accountDetailType.setTenantId("default"); - chartOfAccountDetail.setTenantId("default"); - chartOfAccountDetail.setChartOfAccount(chartOfAccount); - chartOfAccountDetail.setAccountDetailType(accountDetailType); - chartOfAccountDetails.add(chartOfAccountDetail); - return chartOfAccountDetails; - } - - private List getChartOfAccountDetailsSearch(){ - - List chartOfAccountDetails = new ArrayList(); - ChartOfAccountDetail chartOfAccountDetail1 = ChartOfAccountDetail.builder().id("4ff38860184f4f348fa9b9a9ebb25c53").build(); - ChartOfAccountDetail chartOfAccountDetail2 = ChartOfAccountDetail.builder().id("9bea76ae70e04164a1f98df7b996ba0f").build(); - ChartOfAccountDetail chartOfAccountDetail3 = ChartOfAccountDetail.builder().id("cabf5df544af4253a1cc26aa80e57270").build(); - ChartOfAccount chartOfAccount1 = ChartOfAccount.builder().id("830bf3dc60504244babfe228bdf80bac").build(); - ChartOfAccount chartOfAccount2 = ChartOfAccount.builder().id("830bf3dc60504244babfe228bdf80bac").build(); - ChartOfAccount chartOfAccount3 = ChartOfAccount.builder().id("830bf3dc60504244babfe228bdf80bac").build(); - chartOfAccount1.setTenantId("default"); - chartOfAccount2.setTenantId("default"); - chartOfAccount3.setTenantId("default"); - AccountDetailType accountDetailType1 = AccountDetailType.builder().id("e647d2406902400cbf3cee71a4befb35").build(); - AccountDetailType accountDetailType2 = AccountDetailType.builder().id("e647d2406902400cbf3cee71a4befb35").build(); - AccountDetailType accountDetailType3 = AccountDetailType.builder().id("e647d2406902400cbf3cee71a4befb35").build(); - chartOfAccountDetail1.setTenantId("default"); - chartOfAccountDetail2.setTenantId("default"); - chartOfAccountDetail3.setTenantId("default"); - chartOfAccountDetail1.setChartOfAccount(chartOfAccount1); - chartOfAccountDetail1.setAccountDetailType(accountDetailType1); - chartOfAccountDetail2.setChartOfAccount(chartOfAccount2); - chartOfAccountDetail2.setAccountDetailType(accountDetailType2); - chartOfAccountDetail3.setChartOfAccount(chartOfAccount3); - chartOfAccountDetail3.setAccountDetailType(accountDetailType3); - chartOfAccountDetails.add(chartOfAccountDetail1); - chartOfAccountDetails.add(chartOfAccountDetail2); - chartOfAccountDetails.add(chartOfAccountDetail3); - return chartOfAccountDetails; - } - - private List getUpdatedChartOfAccountDetails(){ - List chartOfAccountDetails = new ArrayList(); - ChartOfAccountDetail chartOfAccountDetail = ChartOfAccountDetail.builder().id("4ff38860184f4f348fa9b9a9ebb25c53").build(); - ChartOfAccount chartOfAccount = ChartOfAccount.builder().id("830bf3dc60504244babfe228bdf80bac") - .glcode("updatedglcode").name("name") - .description("description").isActiveForPosting(true) - .type('B').classification((long) 123456) - .functionRequired(true).budgetCheckRequired(true).build(); - chartOfAccount.setTenantId("default"); - chartOfAccountDetail.setTenantId("default"); - AccountDetailType accountDetailType = AccountDetailType.builder().id("9ed569220386455fb3b1f1a81535396d").build(); - chartOfAccountDetail.setChartOfAccount(chartOfAccount); - chartOfAccountDetail.setAccountDetailType(accountDetailType); - chartOfAccountDetails.add(chartOfAccountDetail); - return chartOfAccountDetails; - } - - private Pagination getPagination(){ - Pagination pgn = new Pagination<>(); - pgn.setCurrentPage(0); - pgn.setOffset(0); - pgn.setPageSize(500); - pgn.setTotalPages(1); - pgn.setTotalResults(3); - pgn.setPagedData(getChartOfAccountDetailsSearch()); - return pgn; - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/FunctionControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/FunctionControllerTest.java deleted file mode 100644 index 341d5ae5449..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/FunctionControllerTest.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.Function; -import org.egov.egf.master.domain.model.FunctionSearch; -import org.egov.egf.master.domain.service.FunctionService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(FunctionController.class) -@Import(TestConfiguration.class) -public class FunctionControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - FunctionService functionService; - - @Captor - private ArgumentCaptor> captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void testCreate() throws IOException, Exception { - when(functionService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getFunctions()); - mockMvc.perform( - post("/functions/_create?tenantId=default").content(resources.readRequest("function/function_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is(201)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("function/function_create_valid_response.json"))); - - verify(functionService).create(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("name", actualRequest.get(0).getName()); - assertEquals("code", actualRequest.get(0).getCode()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void testCreate_Error() throws IOException, Exception { - when(functionService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getFunctions()); - mockMvc.perform(post("/functions/_create") - .content(resources.readRequest("function/function_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is5xxServerError()); - - } - - @Test - public void testUpdate() throws IOException, Exception { - when(functionService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getUpdateFunctions()); - - mockMvc.perform( - post("/functions/_update?tenantId=default").content(resources.readRequest("function/function_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is(201)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("function/function_update_valid_response.json"))); - - verify(functionService).update(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("nameU", actualRequest.get(0).getName()); - assertEquals("codeU", actualRequest.get(0).getCode()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getFunctions()); - page.getPagedData().get(0).setId("1"); - - when(functionService.search(any(FunctionSearch.class), any(BindingResult.class))).thenReturn(page); - - mockMvc.perform(post("/functions/_search?tenantId=default").content(resources.getRequestInfo()) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("function/function_search_valid_response.json"))); - - } - - private List getFunctions() { - List functions = new ArrayList(); - Function function = Function.builder().name("name").code("code").level(1).active(true).build(); - function.setTenantId("default"); - functions.add(function); - return functions; - } - - private List getUpdateFunctions() { - List functions = new ArrayList(); - Function function = Function.builder().name("nameU").code("codeU").active(true).id("1").level(2).build(); - function.setTenantId("default"); - functions.add(function); - return functions; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/FundControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/FundControllerTest.java deleted file mode 100644 index f0e7f526d6f..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/FundControllerTest.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.Fund; -import org.egov.egf.master.domain.model.FundSearch; -import org.egov.egf.master.domain.service.FundService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(FundController.class) -@Import(TestConfiguration.class) -public class FundControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - FundService fundService; - - @Captor - private ArgumentCaptor> captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void testCreate() throws IOException, Exception { - when(fundService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getFunds()); - mockMvc.perform(post("/funds/_create?tenantId=default") - .content(resources.readRequest("fund/fund_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json(resources - .readResponse("fund/fund_create_valid_response.json"))); - - verify(fundService).create(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("name", actualRequest.get(0).getName()); - assertEquals("code", actualRequest.get(0).getCode()); - assertEquals(Character.valueOf('I'), actualRequest.get(0).getIdentifier()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void testCreate_Error() throws IOException, Exception { - when(fundService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getFunds()); - mockMvc.perform( - post("/funds/_create").content(resources.readRequest("fund/fund_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is5xxServerError()); - - } - - @Test - public void testUpdate() throws IOException, Exception { - when(fundService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getUpdateFunds()); - - mockMvc.perform(post("/funds/_update?tenantId=default") - .content(resources.readRequest("fund/fund_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json(resources - .readResponse("fund/fund_update_valid_response.json"))); - - verify(fundService).update(captor.capture(), any(BindingResult.class), any(RequestInfo.class)); - - final List actualRequest = captor.getValue(); - assertEquals("nameupdate", actualRequest.get(0).getName()); - assertEquals("code", actualRequest.get(0).getCode()); - assertEquals(Character.valueOf('U'), actualRequest.get(0).getIdentifier()); - assertEquals("default", actualRequest.get(0).getTenantId()); - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getFunds()); - page.getPagedData().get(0).setId("1"); - - when(fundService.search(any(FundSearch.class), any(BindingResult.class))).thenReturn(page); - - mockMvc.perform( - post("/funds/_search?tenantId=default").content(resources.getRequestInfo()).contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is(200)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("fund/fund_search_valid_response.json"))); - - } - - private List getFunds() { - List funds = new ArrayList(); - Fund fund = Fund.builder().name("name").code("code").identifier('I').level(1234l).active(true).build(); - fund.setTenantId("default"); - funds.add(fund); - return funds; - } - - private List getUpdateFunds() { - List funds = new ArrayList(); - Fund fund = Fund.builder().name("nameupdate").code("code").identifier('U').active(true).id("1").level(1234l).build(); - fund.setTenantId("default"); - funds.add(fund); - return funds; - } -} diff --git a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/RecoveryControllerTest.java b/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/RecoveryControllerTest.java deleted file mode 100644 index 3561e5b68b0..00000000000 --- a/business-services/egf-master/src/test/java/org/egov/egf/master/web/controller/RecoveryControllerTest.java +++ /dev/null @@ -1,136 +0,0 @@ -package org.egov.egf.master.web.controller; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.domain.model.Pagination; -import org.egov.common.utils.RequestJsonReader; -import org.egov.egf.master.TestConfiguration; -import org.egov.egf.master.domain.model.ChartOfAccount; -import org.egov.egf.master.domain.model.Recovery; -import org.egov.egf.master.domain.model.RecoverySearch; -import org.egov.egf.master.domain.service.RecoveryService; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.validation.BindingResult; - -@RunWith(SpringRunner.class) -@WebMvcTest(RecoveryController.class) -@Import(TestConfiguration.class) -public class RecoveryControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - RecoveryService recoveryService; - - @Captor - private ArgumentCaptor> captor; - - private RequestJsonReader resources = new RequestJsonReader(); - - @Test - public void testCreate() throws IOException, Exception { - when(recoveryService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getRecoverys()); - mockMvc.perform(post("/recoverys/_create?tenantId=default") - .content(resources.readRequest("recovery/recovery_create_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json(resources - .readResponse("recovery/recovery_create_valid_response.json"))); - } - - @Test - public void testCreate_Error() throws IOException, Exception { - when(recoveryService.create(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getRecoverys()); - mockMvc.perform( - post("/recoverys/_create").content(resources.readRequest("recovery/recovery_create_invalid_field_value.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is5xxServerError()); - - } - - @Test - public void testUpdate() throws IOException, Exception { - when(recoveryService.update(any(List.class), any(BindingResult.class), any(RequestInfo.class))) - .thenReturn(getUpdateRecoverys()); - - mockMvc.perform(post("/recoverys/_update?tenantId=default") - .content(resources.readRequest("recovery/recovery_update_valid_request.json")) - .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(201)) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json(resources - .readResponse("recovery/recovery_update_valid_response.json"))); - } - - @Test - public void test_search() throws IOException, Exception { - - Pagination page = new Pagination<>(); - page.setTotalPages(1); - page.setTotalResults(1); - page.setCurrentPage(0); - page.setPagedData(getRecoverys()); - page.getPagedData().get(0).setId("1"); - - when(recoveryService.search(any(RecoverySearch.class), any(BindingResult.class))).thenReturn(page); - - mockMvc.perform( - post("/recoverys/_search?tenantId=default").content(resources.getRequestInfo()).contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(status().is(200)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) - .andExpect(content().json(resources.readResponse("recovery/recovery_search_valid_response.json"))); - - } - - private List getRecoverys() { - List recoverys = new ArrayList(); - Recovery recovery = Recovery.builder().name("name").code("code").type("M").mode('M').remittanceMode('M').active(true).build(); - recovery.setTenantId("default"); - recovery.setChartOfAccount(getCOAccount()); - recovery.setRemitted("S"); - recovery.setIfscCode("SBIN0005532"); - recovery.setAccountNumber("3049223457"); - recovery.setId("1"); - recoverys.add(recovery); - return recoverys; - } - - private ChartOfAccount getCOAccount() { - ChartOfAccount chartOfAccount = new ChartOfAccount(); - chartOfAccount.setGlcode("341"); - chartOfAccount.setTenantId("default"); - return chartOfAccount; - } - - private List getUpdateRecoverys() { - List recoverys = new ArrayList(); - Recovery recovery = Recovery.builder().name("nameU").code("codeU").type("M").mode('M').remittanceMode('M').active(true).build(); - recovery.setTenantId("default"); - recovery.setChartOfAccount(getCOAccount()); - recovery.setRemitted("S"); - recovery.setIfscCode("SBIN0005532"); - recovery.setAccountNumber("3049223457"); - recovery.setId("1"); - recoverys.add(recovery); - return recoverys; - } - -} diff --git a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_create_invalid_field_value.json b/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_create_invalid_field_value.json deleted file mode 100644 index 0b8e3e77fa2..00000000000 --- a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_create_invalid_field_value.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "accountCodePurpose": - { - "name":"namee", - "tenantId":"default" - } - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_create_request.json b/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_create_request.json deleted file mode 100644 index 3d20fe45643..00000000000 --- a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_create_request.json +++ /dev/null @@ -1,9 +0,0 @@ -"accountCodePurposes": - [ - { - "id":"1", - "name":"name", - "tenantId":"default" - } - - ] diff --git a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_create_response.json b/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_create_response.json deleted file mode 100644 index 8a213eb4619..00000000000 --- a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_create_response.json +++ /dev/null @@ -1,7 +0,0 @@ - "accountCodePurposes": [ - { - "id": "1", - "name": "name", - "tenantId": "default" - } - ] diff --git a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_search_request.json b/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_search_request.json deleted file mode 100644 index e788be4470b..00000000000 --- a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_search_request.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_search_response.json b/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_search_response.json deleted file mode 100644 index 325de61b920..00000000000 --- a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_search_response.json +++ /dev/null @@ -1,16 +0,0 @@ -"accountCodePurposes": [ - { - "id": "1", - "name": "name", - "tenantId":"default" - } - ], - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_allrequest.json b/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_allrequest.json deleted file mode 100644 index 97a790982ca..00000000000 --- a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_allrequest.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "accountCodePurposes": - [ - { - "id":1, - "name":"accountCodePurposeUU", - "tenantId":"default" - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_allresponse.json b/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_allresponse.json deleted file mode 100644 index 09574dfee83..00000000000 --- a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_allresponse.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "responseInfo": { - "resMsgId": "placeholder", - "status": "200", - "apiId": null, - "ver": null, - "key": null, - "tenantId": null - }, - "accountCodePurposes": [ - { - "id": 1, - "name": "accountCodePurposeUU", - "createdBy": null, - "createdDate": null, - "lastModifiedBy": null, - "lastModifiedDate": null, - "tenantId": "default" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_request.json b/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_request.json deleted file mode 100644 index aa5629c6f0f..00000000000 --- a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_request.json +++ /dev/null @@ -1,7 +0,0 @@ - "accountCodePurposes": [ - { - "id":"1", - "name":"nameU", - "tenantId":"default" - }] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_response.json b/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_response.json deleted file mode 100644 index ca7dddc5a0e..00000000000 --- a/business-services/egf-master/src/test/resources/accountcodepurpose/accountcodepurpose_update_response.json +++ /dev/null @@ -1,7 +0,0 @@ - "accountCodePurposes": [ - { - "id":"1", - "name":"nameU", - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_create_invalid_fieldvalue.json b/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_create_invalid_fieldvalue.json deleted file mode 100644 index 8328799b60b..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_create_invalid_fieldvalue.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - "accountDetailKeys": - [ - { - "id":"1", - "key":null, - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "tenantId":"default" - } - - ] - -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_create_request.json b/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_create_request.json deleted file mode 100644 index f038210dbe7..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_create_request.json +++ /dev/null @@ -1,13 +0,0 @@ -"accountDetailKeys": - [ - { - "id":"1", - "key":"1", - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "tenantId":"default" - } - - ] diff --git a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_create_response.json b/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_create_response.json deleted file mode 100644 index f038210dbe7..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_create_response.json +++ /dev/null @@ -1,13 +0,0 @@ -"accountDetailKeys": - [ - { - "id":"1", - "key":"1", - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "tenantId":"default" - } - - ] diff --git a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_search_response.json b/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_search_response.json deleted file mode 100644 index ec45ee388ea..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_search_response.json +++ /dev/null @@ -1,24 +0,0 @@ -"accountDetailKeys": - [ - { - "id":"1", - "key":"1", - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "tenantId":"default" - } - - ] - -, - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_update_request.json b/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_update_request.json deleted file mode 100644 index b6c7a45a2e3..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_update_request.json +++ /dev/null @@ -1,13 +0,0 @@ - "accountDetailKeys": - [ - { - "id":"1", - "key":"2", - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "tenantId":"default" - } - - ] diff --git a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_update_response.json b/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_update_response.json deleted file mode 100644 index ca517180550..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailkey/accountdetailkey_update_response.json +++ /dev/null @@ -1,13 +0,0 @@ -"accountDetailKeys": - [ - { - "id":"1", - "key":"2", - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "tenantId":"default" - } - - ] diff --git a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_create_invalid_fieldvalue.json b/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_create_invalid_fieldvalue.json deleted file mode 100644 index 5344a8a5ecd..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_create_invalid_fieldvalue.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "accountDetailTypes": - [ - { - "id":"1", - "name":"nameU", - "tableName":"abc", - "fullyQualifiedName":"abc/contractor", - "tenantId":"default" - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_create_request.json b/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_create_request.json deleted file mode 100644 index 818361c0183..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_create_request.json +++ /dev/null @@ -1,11 +0,0 @@ -"accountDetailTypes": - [ - { - "id":"1", - "name":"name", - "tableName":"contractor", - "fullyQualifiedName":"abc/contractor", - "tenantId":"default" - } - - ] diff --git a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_create_response.json b/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_create_response.json deleted file mode 100644 index 818361c0183..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_create_response.json +++ /dev/null @@ -1,11 +0,0 @@ -"accountDetailTypes": - [ - { - "id":"1", - "name":"name", - "tableName":"contractor", - "fullyQualifiedName":"abc/contractor", - "tenantId":"default" - } - - ] diff --git a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_search_response.json b/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_search_response.json deleted file mode 100644 index 530923cc58f..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_search_response.json +++ /dev/null @@ -1,20 +0,0 @@ - "accountDetailTypes": - [ - { - "id":"1", - "name":"name", - "tableName":"contractor", - "fullyQualifiedName":"abc/contractor", - "tenantId":"default" - } - - ], - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_update_request.json b/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_update_request.json deleted file mode 100644 index 1b9a22b8593..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_update_request.json +++ /dev/null @@ -1,11 +0,0 @@ - "accountDetailTypes": - [ - { - "id":"1", - "name":"nameU", - "tableName":"contractorU", - "fullyQualifiedName":"abc/contractorU", - "tenantId":"default" - } - - ] diff --git a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_update_response.json b/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_update_response.json deleted file mode 100644 index c9e1a965a5d..00000000000 --- a/business-services/egf-master/src/test/resources/accountdetailtype/accountdetailtype_update_response.json +++ /dev/null @@ -1,11 +0,0 @@ -"accountDetailTypes": - [ - { - "id":"1", - "name":"nameU", - "tableName":"contractorU", - "fullyQualifiedName":"abc/contractorU", - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountentity/accountentity_create_invalid_fieldvalue.json b/business-services/egf-master/src/test/resources/accountentity/accountentity_create_invalid_fieldvalue.json deleted file mode 100644 index 9177c80641c..00000000000 --- a/business-services/egf-master/src/test/resources/accountentity/accountentity_create_invalid_fieldvalue.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "accountEntities": - [ - { - "id":"1", - "name":"nameee", - "code":"code", - "accountDetailType":null, - "active":true, - "description":"entity", - "tenantId":"default" - } - - ] - - - } \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountentity/accountentity_create_request.json b/business-services/egf-master/src/test/resources/accountentity/accountentity_create_request.json deleted file mode 100644 index 3fd245a4bfa..00000000000 --- a/business-services/egf-master/src/test/resources/accountentity/accountentity_create_request.json +++ /dev/null @@ -1,16 +0,0 @@ -"accountEntities": - [ - { - "id":"1", - "name":"name", - "code":"code", - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "active":true, - "description":"entity", - "tenantId":"default" - } - - ] diff --git a/business-services/egf-master/src/test/resources/accountentity/accountentity_create_response.json b/business-services/egf-master/src/test/resources/accountentity/accountentity_create_response.json deleted file mode 100644 index 1a0a4fec471..00000000000 --- a/business-services/egf-master/src/test/resources/accountentity/accountentity_create_response.json +++ /dev/null @@ -1,15 +0,0 @@ -"accountEntities": -[ - { - "id": "1", - "name": "name", - "code": "code", - "accountDetailType": { - "id": "1", - "tenantId": "default" - }, - "active": true, - "description": "entity", - "tenantId": "default" - } -] diff --git a/business-services/egf-master/src/test/resources/accountentity/accountentity_search_response.json b/business-services/egf-master/src/test/resources/accountentity/accountentity_search_response.json deleted file mode 100644 index f605c816e62..00000000000 --- a/business-services/egf-master/src/test/resources/accountentity/accountentity_search_response.json +++ /dev/null @@ -1,28 +0,0 @@ -"accountEntities": -[ - { - "id":"1", - "name":"name", - "code":"code", - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "active":true, - "description":"entity", - "tenantId":"default" - } - -] - - -, - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/accountentity/accountentity_update_request.json b/business-services/egf-master/src/test/resources/accountentity/accountentity_update_request.json deleted file mode 100644 index 9cbd36cdd47..00000000000 --- a/business-services/egf-master/src/test/resources/accountentity/accountentity_update_request.json +++ /dev/null @@ -1,16 +0,0 @@ -"accountEntities": -[ - { - "id":"1", - "name":"nameU", - "code":"codeU", - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "active":true, - "description":"entity", - "tenantId":"default" - } - -] diff --git a/business-services/egf-master/src/test/resources/accountentity/accountentity_update_response.json b/business-services/egf-master/src/test/resources/accountentity/accountentity_update_response.json deleted file mode 100644 index 9cbd36cdd47..00000000000 --- a/business-services/egf-master/src/test/resources/accountentity/accountentity_update_response.json +++ /dev/null @@ -1,16 +0,0 @@ -"accountEntities": -[ - { - "id":"1", - "name":"nameU", - "code":"codeU", - "accountDetailType":{ - "id":"1", - "tenantId":"default" - }, - "active":true, - "description":"entity", - "tenantId":"default" - } - -] diff --git a/business-services/egf-master/src/test/resources/application.properties b/business-services/egf-master/src/test/resources/application.properties deleted file mode 100644 index 190f6aeae25..00000000000 --- a/business-services/egf-master/src/test/resources/application.properties +++ /dev/null @@ -1,96 +0,0 @@ -app.timezone=UTC - -fetch_data_from=db - -persist.through.kafka=yes - -es.host=localhost -es.transport.port=9300 -es.cluster.name=docker-cluster - - -kafka.topics.egf.masters.validated.key=egov.egf.masters.bank.validated.key - - -#Kafka Topic config -kafka.topics.egf.masters.validated.topic=egov.egf.masters.validated.topic -kafka.topics.egf.masters.validated.group=egov.egf.masters.validated.group -kafka.topics.egf.masters.validated.id=egov.egf.masters.bank.validated.id - -kafka.topics.egf.masters.completed.topic=egov.egf.masters.completed -kafka.topics.egf.masters.completed.group=egov.egf.masters.completed.group - -kafka.topics.egf.masters.bank.validated.key=egov.egf.masters.bank.validated.key -kafka.topics.egf.masters.bankbranch.validated.key=egov.egf.masters.bankbranch.validated.key -kafka.topics.egf.masters.bankaccount.validated.key=egov.egf.masters.bankaccount.validated.key -kafka.topics.egf.masters.accountcodepurpose.validated.key=egov.egf.masters.accountcodepurpose.validated.key -kafka.topics.egf.masters.accountdetailkey.validated.key=egov.egf.masters.accountdetailkey.validated.key -kafka.topics.egf.masters.accountdetailtype.validated.key=egov.egf.masters.accountdetailtype.validated.key -kafka.topics.egf.masters.accountentity.validated.key=egov.egf.masters.accountentity.validated.key -kafka.topics.egf.masters.budgetgroup.validated.key=egov.egf.masters.budgetgroup.validated.key -kafka.topics.egf.masters.chartofaccount.validated.key=egov.egf.masters.chartofaccount.validated.key -kafka.topics.egf.masters.chartofaccountdetail.validated.key=egov.egf.masters.chartofaccountdetail.validated.key -kafka.topics.egf.masters.financialyear.validated.key=egov.egf.masters.financialyear.validated.key -kafka.topics.egf.masters.fiscalperiod.validated.key=egov.egf.masters.fiscalperiod.validated.key -kafka.topics.egf.masters.functionary.validated.key=egov.egf.masters.functionary.validated.key -kafka.topics.egf.masters.function.validated.key=egov.egf.masters.function.validated.key -kafka.topics.egf.masters.fund.validated.key=egov.egf.masters.fund.validated.key -kafka.topics.egf.masters.fundsource.validated.key=egov.egf.masters.fundsource.validated.key -kafka.topics.egf.masters.scheme.validated.key=egov.egf.masters.scheme.validated.key -kafka.topics.egf.masters.subscheme.validated.key=egov.egf.masters.subscheme.validated.key -kafka.topics.egf.masters.supplier.validated.key=egov.egf.masters.supplierfund.validated.key -kafka.topics.egf.masters.financialstatus.validated.key=egov.egf.masters.financialstatus.validated.key -kafka.topics.egf.masters.financialconfiguration.validated.key=egov.egf.masters.financialconfiguration.validated.key -kafka.topics.egf.masters.recovery.validated.key=egov.egf.masters.recovery.validated.key - - - -kafka.topics.egf.masters.bank.completed.key=egov.egf.masters.bank.completed.key -kafka.topics.egf.masters.bankbranch.completed.key=egov.egf.masters.bankbranch.completed.key -kafka.topics.egf.masters.bankaccount.completed.key=egov.egf.masters.bankaccount.completed.key -kafka.topics.egf.masters.accountcodepurpose.completed.key=egov.egf.masters.accountcodepurpose.completed.key -kafka.topics.egf.masters.accountdetailkey.completed.key=egov.egf.masters.accountdetailkey.completed.key -kafka.topics.egf.masters.accountdetailtype.completed.key=egov.egf.masters.accountdetailtype.completed.key -kafka.topics.egf.masters.accountentity.completed.key=egov.egf.masters.accountentity.completed.key -kafka.topics.egf.masters.budgetgroup.completed.key=egov.egf.masters.budgetgroup.completed.key -kafka.topics.egf.masters.chartofaccount.completed.key=egov.egf.masters.chartofaccount.completed.key -kafka.topics.egf.masters.chartofaccountdetail.completed.key=egov.egf.masters.chartofaccountdetail.completed.key -kafka.topics.egf.masters.financialyear.completed.key=egov.egf.masters.financialyear.completed.key -kafka.topics.egf.masters.fiscalperiod.completed.key=egov.egf.masters.fiscalperiod.completed.key -kafka.topics.egf.masters.functionary.completed.key=egov.egf.masters.functionary.completed.key -kafka.topics.egf.masters.function.completed.key=egov.egf.masters.function.completed.key -kafka.topics.egf.masters.fund.completed.key=egov.egf.masters.fund.completed.key -kafka.topics.egf.masters.fundsource.completed.key=egov.egf.masters.fundsource.completed.key -kafka.topics.egf.masters.scheme.completed.key=egov.egf.masters.scheme.completed.key -kafka.topics.egf.masters.subscheme.completed.key=egov.egf.masters.subscheme.completed.key -kafka.topics.egf.masters.supplier.completed.key=egov.egf.masters.supplier.completed.key -kafka.topics.egf.masters.financialstatus.completed.key=egov.egf.masters.financialstatus.completed.key -kafka.topics.egf.masters.financialconfiguration.completed.key=egov.egf.masters.financialconfiguration.completed.key -kafka.topics.egf.masters.recovery.completed.key=egov.egf.masters.recovery.completed.key - - - - -egf.master.host.url=http://localhost:8280 - -logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} - - -spring.kafka.consumer.value-deserializer=org.egov.common.queue.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=egf-master -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer - -spring.datasource.driver-class-name=org.postgresql.Driver - -spring.datasource.url=jdbc:postgresql://localhost:5432/postgres -spring.datasource.username=postgres -spring.datasource.password=postgres -flyway.user=postgres -flyway.password=postgres -flyway.outOfOrder=true -flyway.table=egf_masters_schema_version -flyway.baseline-on-migrate=true -flyway.url=jdbc:postgresql://localhost:5432/postgres -flyway.locations=db/migration/main diff --git a/business-services/egf-master/src/test/resources/bank/bank_create_invalid_field_value.json b/business-services/egf-master/src/test/resources/bank/bank_create_invalid_field_value.json deleted file mode 100644 index eb6e7d396f9..00000000000 --- a/business-services/egf-master/src/test/resources/bank/bank_create_invalid_field_value.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "requestInfo":{ - "action":"action", - "did":"did", - "msgId":"msgId", - "requesterId":"requesterId", - "ts":"01-01-2017 01:01:01", - "authToken":null - }, - "banks":[ - { - "code":"code", - "name":"name", - "description":"description", - "active":true, - "type":1, - "tenantId":"default" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bank/bank_create_valid_request.json b/business-services/egf-master/src/test/resources/bank/bank_create_valid_request.json deleted file mode 100644 index 40b02a384f9..00000000000 --- a/business-services/egf-master/src/test/resources/bank/bank_create_valid_request.json +++ /dev/null @@ -1,10 +0,0 @@ -"banks":[ - { - "code":"code", - "name":"name", - "description":"description", - "active":true, - "type":"type", - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bank/bank_create_valid_response.json b/business-services/egf-master/src/test/resources/bank/bank_create_valid_response.json deleted file mode 100644 index 40b02a384f9..00000000000 --- a/business-services/egf-master/src/test/resources/bank/bank_create_valid_response.json +++ /dev/null @@ -1,10 +0,0 @@ -"banks":[ - { - "code":"code", - "name":"name", - "description":"description", - "active":true, - "type":"type", - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bank/bank_search_valid_response.json b/business-services/egf-master/src/test/resources/bank/bank_search_valid_response.json deleted file mode 100644 index 40b02a384f9..00000000000 --- a/business-services/egf-master/src/test/resources/bank/bank_search_valid_response.json +++ /dev/null @@ -1,10 +0,0 @@ -"banks":[ - { - "code":"code", - "name":"name", - "description":"description", - "active":true, - "type":"type", - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bank/bank_update_valid_request.json b/business-services/egf-master/src/test/resources/bank/bank_update_valid_request.json deleted file mode 100644 index d7dd3d3eb26..00000000000 --- a/business-services/egf-master/src/test/resources/bank/bank_update_valid_request.json +++ /dev/null @@ -1,10 +0,0 @@ -"banks":[ - { - "code":"codeupdate", - "name":"nameupdate", - "description":"descriptionupdate", - "active":true, - "type":"typeupdate", - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bank/bank_update_valid_response.json b/business-services/egf-master/src/test/resources/bank/bank_update_valid_response.json deleted file mode 100644 index d7dd3d3eb26..00000000000 --- a/business-services/egf-master/src/test/resources/bank/bank_update_valid_response.json +++ /dev/null @@ -1,10 +0,0 @@ -"banks":[ - { - "code":"codeupdate", - "name":"nameupdate", - "description":"descriptionupdate", - "active":true, - "type":"typeupdate", - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankSearchRequest.json b/business-services/egf-master/src/test/resources/bankSearchRequest.json deleted file mode 100644 index 93e3ed14e17..00000000000 --- a/business-services/egf-master/src/test/resources/bankSearchRequest.json +++ /dev/null @@ -1,16 +0,0 @@ - { - "action": "_search", - "did": "", - "msgid": "", - "requesterId": "1", - "authToken": "", - "apiId": "org.egov.egf.bank", - "ver": "1", - "ts": "", - "key": null, - "tenantId": "ap.kurnool", - "userInfo":{ - - } - } - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankSearchResponse.json b/business-services/egf-master/src/test/resources/bankSearchResponse.json deleted file mode 100644 index 93e3ed14e17..00000000000 --- a/business-services/egf-master/src/test/resources/bankSearchResponse.json +++ /dev/null @@ -1,16 +0,0 @@ - { - "action": "_search", - "did": "", - "msgid": "", - "requesterId": "1", - "authToken": "", - "apiId": "org.egov.egf.bank", - "ver": "1", - "ts": "", - "key": null, - "tenantId": "ap.kurnool", - "userInfo":{ - - } - } - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_create_valid_request.json b/business-services/egf-master/src/test/resources/bankaccount/bankAccount_create_valid_request.json deleted file mode 100644 index ae4f22cf732..00000000000 --- a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_create_valid_request.json +++ /dev/null @@ -1,29 +0,0 @@ - - "bankAccounts":[ - { - "bankBranch":{ - "id":"1", - "bank":{ - "id":"1", - "active":true, - "type":"Bank", - "tenantId":"default" - }, - "tenantId":"default" - }, - "chartOfAccount":{ - "id":"1", - "tenantId":"default" - }, - "fund":{ - "id":"2", - "tenantId":"default" - }, - "accountNumber":"0004", - "accountType":"test", - "description":"accountNumber", - "active":true, - "payTo":"tester", - "tenantId":"default" - } - ] diff --git a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_create_valid_response.json b/business-services/egf-master/src/test/resources/bankaccount/bankAccount_create_valid_response.json deleted file mode 100644 index 40bc1ae8f92..00000000000 --- a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_create_valid_response.json +++ /dev/null @@ -1,27 +0,0 @@ - - "bankAccounts":[ - { - "id":null, - "bankBranch":{ - "id":"1", - "bank":{ - "id":"1" - }, - "tenantId":"default" - }, - "chartOfAccount":{ - "id":"1", - "tenantId":"default" - }, - "fund":{ - "id":"2", - "tenantId":"default" - }, - "accountNumber":"0004", - "accountType":"test", - "description":"accountNumber", - "active":true, - "payTo":"tester", - "tenantId":"default" - } - ] diff --git a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_search_valid_response.json b/business-services/egf-master/src/test/resources/bankaccount/bankAccount_search_valid_response.json deleted file mode 100644 index 571fb38eda5..00000000000 --- a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_search_valid_response.json +++ /dev/null @@ -1,18 +0,0 @@ - "bankAccounts": [ - { - "id": "1", - "bankBranch": { - "id": "1" - }, - "chartOfAccount": { - "id": "1" - }, - "fund": { - "id": "2" - }, - "accountNumber": "0004", - "accountType": "test", - "active": true, - "tenantId": "default" - } - ] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_update_valid_request.json b/business-services/egf-master/src/test/resources/bankaccount/bankAccount_update_valid_request.json deleted file mode 100644 index 8121546a7e0..00000000000 --- a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_update_valid_request.json +++ /dev/null @@ -1,29 +0,0 @@ - - "bankAccounts":[ - { - "bankBranch":{ - "id":"1", - "bank":{ - "id":"1", - "active":true, - "type":"Bank", - "tenantId":"default" - }, - "tenantId":"default" - }, - "chartOfAccount":{ - "id":"1", - "tenantId":"default" - }, - "fund":{ - "id":"2", - "tenantId":"default" - }, - "accountNumber":"0004", - "accountType":"testupdate", - "description":"accountNumber", - "active":true, - "payTo":"tester", - "tenantId":"default" - } - ] diff --git a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_update_valid_response.json b/business-services/egf-master/src/test/resources/bankaccount/bankAccount_update_valid_response.json deleted file mode 100644 index 87a57ce74a5..00000000000 --- a/business-services/egf-master/src/test/resources/bankaccount/bankAccount_update_valid_response.json +++ /dev/null @@ -1,27 +0,0 @@ - - "bankAccounts":[ - { - "id":null, - "bankBranch":{ - "id":"1", - "bank":{ - "id":"1" - }, - "tenantId":"default" - }, - "chartOfAccount":{ - "id":"1", - "tenantId":"default" - }, - "fund":{ - "id":"2", - "tenantId":"default" - }, - "accountNumber":"0004", - "accountType":"testupdate", - "description":"accountNumber", - "active":true, - "payTo":"tester", - "tenantId":"default" - } - ] diff --git a/business-services/egf-master/src/test/resources/bankaccount/bankaccount_create_invalid_field_value.json b/business-services/egf-master/src/test/resources/bankaccount/bankaccount_create_invalid_field_value.json deleted file mode 100644 index 46ff1c45ece..00000000000 --- a/business-services/egf-master/src/test/resources/bankaccount/bankaccount_create_invalid_field_value.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "requestInfo": { - "resMsgId": "placeholder", - "status": "200", - "apiId": null, - "ver": null, - "ts": "01-01-2017 01:01:01", - "key": null, - "userInfo": { - "id": 1 - } - }, - "bankAccounts":[ - { - "fund":{ - "id":"2", - "tenantId":"default" - }, - "accountNumber":"2212", - "accountType":"test", - "description":"accountNumber", - "active":true, - "payTo":"tester", - "tenantId":"default" - } - ] diff --git a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_create_invalid_field_value.json b/business-services/egf-master/src/test/resources/bankbranch/bankbranch_create_invalid_field_value.json deleted file mode 100644 index c5a8014b750..00000000000 --- a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_create_invalid_field_value.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "requestInfo": { - "resMsgId": "placeholder", - "status": "200", - "apiId": null, - "ver": null, - "ts": "01-01-2017 01:01:01", - "key": null, - "userInfo": { - "id": 1 - } - }, - "bankBranches": [ - { - "bank": { - "id": 1 - }, - "code": "code", - "name": "name", - "address": "Bangalore", - "address2": "Bangalore", - "city": "Bangalore", - "state": "Bangalore", - "pincode": "Bangalore", - "phone": "Bangalore", - "fax": "Bangalore", - "contactPerson": "Bangalore", - "active": true, - "description": "Bangalore", - "micr": "Bangalore", - "tenantId": "default" - } - ] -} diff --git a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_create_request.json b/business-services/egf-master/src/test/resources/bankbranch/bankbranch_create_request.json deleted file mode 100644 index 3475d461f02..00000000000 --- a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_create_request.json +++ /dev/null @@ -1,21 +0,0 @@ -"bankBranches":[ - { - "bank":{ - "id":1 - }, - "code":"code", - "name":"name", - "address":"Bangalore", - "address2":"Bangalore", - "city":"Bangalore", - "state":"Bangalore", - "pincode":"Bangalore", - "phone":"Bangalore", - "fax":"Bangalore", - "contactPerson":"Bangalore", - "active":true, - "description":"Bangalore", - "micr":"Bangalore", - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_create_response.json b/business-services/egf-master/src/test/resources/bankbranch/bankbranch_create_response.json deleted file mode 100644 index bb231532c04..00000000000 --- a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_create_response.json +++ /dev/null @@ -1,26 +0,0 @@ -"bankBranches":[ - { - "id":null, - "code":"code", - "name":"name", - "bank":{ - "id":"1" - }, - "address":"Bangalore", - "address2":"Bangalore", - "city":"Bangalore", - "state":"Bangalore", - "pincode":"Bangalore", - "phone":"Bangalore", - "fax":"Bangalore", - "contactPerson":"Bangalore", - "active":true, - "description":"Bangalore", - "micr":"Bangalore", - "createdBy":null, - "createdDate":null, - "lastModifiedBy":null, - "lastModifiedDate":null, - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_search_request.json b/business-services/egf-master/src/test/resources/bankbranch/bankbranch_search_request.json deleted file mode 100644 index e788be4470b..00000000000 --- a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_search_request.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_search_response.json b/business-services/egf-master/src/test/resources/bankbranch/bankbranch_search_response.json deleted file mode 100644 index dc4e346f2b4..00000000000 --- a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_search_response.json +++ /dev/null @@ -1,26 +0,0 @@ -"bankBranches":[ - { - "id":"1", - "code":"code", - "name":"name", - "bank":{ - "id":"1" - }, - "address":"Bangalore", - "address2":"Bangalore", - "city":"Bangalore", - "state":"Bangalore", - "pincode":"Bangalore", - "phone":"Bangalore", - "fax":"Bangalore", - "contactPerson":"Bangalore", - "active":true, - "description":"Bangalore", - "micr":"Bangalore", - "createdBy":null, - "createdDate":null, - "lastModifiedBy":null, - "lastModifiedDate":null, - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_allrequest.json b/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_allrequest.json deleted file mode 100644 index 4542896d3b0..00000000000 --- a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_allrequest.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "requestInfo": - { - "resMsgId": "placeholder", - "status": "200", - "apiId": null, - "ver": null, - "ts": "01-01-2017 01:01:01", - "key": null, - "userInfo":{ - "id":1 - } - }, - "bankBranches": [ - { - "id":1, - "bank": - { - "id":1 - - }, - "code":"codeU", - "name":"nameU", - "address": "Bangalore", - "address2": "Bangalore", - "city": "Bangalore", - "state": "Bangalore", - "pincode": "Bangalore", - "phone": "Bangalore", - "fax": "Bangalore", - "contactPerson": "Bangalore", - "active": true, - "description": "Bangalore", - "micr": "Bangalore", - "tenantId":"default" - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_allresponse.json b/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_allresponse.json deleted file mode 100644 index fa85144cf08..00000000000 --- a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_allresponse.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "responseInfo": { - "resMsgId": "placeholder", - "status": "200", - "apiId": null, - "ver": null, - "key": null, - "tenantId": null - }, - "bankBranches": [ - { - "id": 1, - "code": "codeU", - "name": "nameU", - "bank": { - "id": 1 - }, - "address": "Bangalore", - "address2": "Bangalore", - "city": "Bangalore", - "state": "Bangalore", - "pincode": "Bangalore", - "phone": "Bangalore", - "fax": "Bangalore", - "contactPerson": "Bangalore", - "active": true, - "description": "Bangalore", - "micr": "Bangalore", - "createdBy": null, - "createdDate": null, - "lastModifiedBy": null, - "lastModifiedDate": null, - "tenantId": "default" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_request.json b/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_request.json deleted file mode 100644 index 8db28aae9b4..00000000000 --- a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_request.json +++ /dev/null @@ -1,26 +0,0 @@ -"bankBranches":[ - { - "id":null, - "code":"codeupdate", - "name":"nameupdate", - "bank":{ - "id":"1" - }, - "address":"Bangalore", - "address2":"Bangalore", - "city":"Bangalore", - "state":"Bangalore", - "pincode":"Bangalore", - "phone":"Bangalore", - "fax":"Bangalore", - "contactPerson":"Bangalore", - "active":true, - "description":"Bangalore", - "micr":"Bangalore", - "createdBy":null, - "createdDate":null, - "lastModifiedBy":null, - "lastModifiedDate":null, - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_response.json b/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_response.json deleted file mode 100644 index 8db28aae9b4..00000000000 --- a/business-services/egf-master/src/test/resources/bankbranch/bankbranch_update_response.json +++ /dev/null @@ -1,26 +0,0 @@ -"bankBranches":[ - { - "id":null, - "code":"codeupdate", - "name":"nameupdate", - "bank":{ - "id":"1" - }, - "address":"Bangalore", - "address2":"Bangalore", - "city":"Bangalore", - "state":"Bangalore", - "pincode":"Bangalore", - "phone":"Bangalore", - "fax":"Bangalore", - "contactPerson":"Bangalore", - "active":true, - "description":"Bangalore", - "micr":"Bangalore", - "createdBy":null, - "createdDate":null, - "lastModifiedBy":null, - "lastModifiedDate":null, - "tenantId":"default" - } -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_create_valid_request.json b/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_create_valid_request.json deleted file mode 100644 index 7a7adb7f79a..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_create_valid_request.json +++ /dev/null @@ -1,15 +0,0 @@ - "chartOfAccounts": - [ - { - "glcode":"GLCode", - "name":"AadharBank", - "isActiveForPosting":true, - "type":"B", - "classification":123456, - "functionRequired":true, - "budgetCheckRequired":true, - "tenantId":"default" - } - - ] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_create_valid_response.json b/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_create_valid_response.json deleted file mode 100644 index 7e98fabc838..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_create_valid_response.json +++ /dev/null @@ -1,12 +0,0 @@ - "chartOfAccounts": [ - { - "glcode": "GLCode", - "name": "AadharBank", - "isActiveForPosting": true, - "type": "B", - "classification": 123456, - "functionRequired": true, - "budgetCheckRequired": true, - "tenantId": "default" - } - ] diff --git a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_search_valid_request.json b/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_search_valid_request.json deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_search_valid_response.json b/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_search_valid_response.json deleted file mode 100644 index 60d60e271d1..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_search_valid_response.json +++ /dev/null @@ -1,19 +0,0 @@ -"chartOfAccounts": [ - { - "name": "AadharBank", - "isActiveForPosting": true, - "type": "B", - "classification": 123456, - "functionRequired": true, - "budgetCheckRequired": true, - "majorCode": "GLC", - "tenantId": "default" - } - ], - "page": { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } diff --git a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_update_valid_request.json b/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_update_valid_request.json deleted file mode 100644 index 224fd9bef39..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_update_valid_request.json +++ /dev/null @@ -1,16 +0,0 @@ - "chartOfAccounts": - [ - { - "glcode":"GLCode", - "name":"MunicipalBank", - "isActiveForPosting":true, - "description": "DefaultDescription", - "type":"B", - "classification":123456, - "functionRequired":true, - "budgetCheckRequired":true, - "tenantId":"default" - } - - ] - diff --git a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_update_valid_response.json b/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_update_valid_response.json deleted file mode 100644 index d36483fbf18..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccount/chartofaccount_update_valid_response.json +++ /dev/null @@ -1,13 +0,0 @@ - "chartOfAccounts": [ - { - "glcode": "GLCode", - "name": "MunicipalBank", - "description": "DefaultDescription", - "isActiveForPosting": true, - "type": "B", - "classification": 123456, - "functionRequired": true, - "budgetCheckRequired": true, - "tenantId": "default" - } - ] diff --git a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_create_valid_request.json b/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_create_valid_request.json deleted file mode 100644 index a9ae30402c3..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_create_valid_request.json +++ /dev/null @@ -1,14 +0,0 @@ - "chartOfAccountDetails": [ - { - "chartOfAccount":{ - "id":"830bf3dc60504244babfe228bdf80bac", - "tenantId":"default" - }, - "accountDetailType":{ - "id":"e647d2406902400cbf3cee71a4befb35", - "tenantId":"default" - }, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_create_valid_response.json b/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_create_valid_response.json deleted file mode 100644 index 6ae7b84d15c..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_create_valid_response.json +++ /dev/null @@ -1,21 +0,0 @@ - "chartOfAccountDetails": [ - { - "chartOfAccount": { - "id": "830bf3dc60504244babfe228bdf80bac", - "glcode": "1201", - "name": "finalfdf", - "description": "accountNumber", - "tenantId": "default" - }, - "accountDetailType": { - "id": "e647d2406902400cbf3cee71a4befb35", - "name": "final", - "description": "final", - "tableName": "final", - "active": true, - "fullyQualifiedName": "final", - "tenantId": "default" - }, - "tenantId": "default" - } - ] diff --git a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_search_valid_request.json b/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_search_valid_request.json deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_search_valid_response.json b/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_search_valid_response.json deleted file mode 100644 index f7ced974320..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_search_valid_response.json +++ /dev/null @@ -1,39 +0,0 @@ - "chartOfAccountDetails": [ - { - "id": "4ff38860184f4f348fa9b9a9ebb25c53", - "chartOfAccount": { - "id": "830bf3dc60504244babfe228bdf80bac" - }, - "accountDetailType": { - "id": "e647d2406902400cbf3cee71a4befb35" - }, - "tenantId": "default" - }, - { - "id": "9bea76ae70e04164a1f98df7b996ba0f", - "chartOfAccount": { - "id": "830bf3dc60504244babfe228bdf80bac" - }, - "accountDetailType": { - "id": "e647d2406902400cbf3cee71a4befb35" - }, - "tenantId": "default" - }, - { - "id": "cabf5df544af4253a1cc26aa80e57270", - "chartOfAccount": { - "id": "830bf3dc60504244babfe228bdf80bac" - }, - "accountDetailType": { - "id": "e647d2406902400cbf3cee71a4befb35" - }, - "tenantId": "default" - } - ], - "page": { - "totalResults": 3, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } diff --git a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_update_valid_request.json b/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_update_valid_request.json deleted file mode 100644 index 75392f2a221..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_update_valid_request.json +++ /dev/null @@ -1,15 +0,0 @@ - "chartOfAccountDetails": [ - { - "id": "4ff38860184f4f348fa9b9a9ebb25c53", - "chartOfAccount":{ - "id":"830bf3dc60504244babfe228bdf80bac", - "tenantId":"default" - }, - "accountDetailType":{ - "id":"9ed569220386455fb3b1f1a81535396d", - "tenantId":"default" - }, - "tenantId":"default" - } - - ] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_update_valid_response.json b/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_update_valid_response.json deleted file mode 100644 index 3802644facf..00000000000 --- a/business-services/egf-master/src/test/resources/chartofaccountdetail/chartofaccountdetail_update_valid_response.json +++ /dev/null @@ -1,12 +0,0 @@ - "chartOfAccountDetails": [ - { - "id": "4ff38860184f4f348fa9b9a9ebb25c53", - "chartOfAccount": { - "id": "830bf3dc60504244babfe228bdf80bac" - }, - "accountDetailType": { - "id": "9ed569220386455fb3b1f1a81535396d" - }, - "tenantId": "default" - } - ] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/common/error_info.json b/business-services/egf-master/src/test/resources/common/error_info.json deleted file mode 100644 index 8bca32084ed..00000000000 --- a/business-services/egf-master/src/test/resources/common/error_info.json +++ /dev/null @@ -1,8 +0,0 @@ -"responseInfo": { - "resMsgId": null, - "status": "400", - "apiId": null, - "ver": null, - "key": null, - "tenantId": null - } \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/common/error_response.json b/business-services/egf-master/src/test/resources/common/error_response.json deleted file mode 100644 index ee05d470ce6..00000000000 --- a/business-services/egf-master/src/test/resources/common/error_response.json +++ /dev/null @@ -1,6 +0,0 @@ -"error": - { - "code":null, - "message":"sample", - "description":"sample" - } \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/common/request_info.json b/business-services/egf-master/src/test/resources/common/request_info.json deleted file mode 100644 index f01cf8c2d0d..00000000000 --- a/business-services/egf-master/src/test/resources/common/request_info.json +++ /dev/null @@ -1,8 +0,0 @@ -"requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - } \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/common/response_info.json b/business-services/egf-master/src/test/resources/common/response_info.json deleted file mode 100644 index 04cae36133a..00000000000 --- a/business-services/egf-master/src/test/resources/common/response_info.json +++ /dev/null @@ -1,6 +0,0 @@ -"responseInfo": { - "resMsgId": "placeholder", - "status": "placeholder", - "apiId": null, - "ver": null - } \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/function/function_create_invalid_field_value.json b/business-services/egf-master/src/test/resources/function/function_create_invalid_field_value.json deleted file mode 100644 index 53df424dc37..00000000000 --- a/business-services/egf-master/src/test/resources/function/function_create_invalid_field_value.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "functions": - [ - { - "name":"function", - "tenantId":"default", - "code":"001900000000000000000000000000000", - "active":true - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/function/function_create_invalid_fieldsize.json b/business-services/egf-master/src/test/resources/function/function_create_invalid_fieldsize.json deleted file mode 100644 index 097e67500db..00000000000 --- a/business-services/egf-master/src/test/resources/function/function_create_invalid_fieldsize.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "functions": - [ - { - "name":"functions", - "tenantId":"default", - "code":"001", - "active":true - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/function/function_create_valid_request.json b/business-services/egf-master/src/test/resources/function/function_create_valid_request.json deleted file mode 100644 index 479e40abd99..00000000000 --- a/business-services/egf-master/src/test/resources/function/function_create_valid_request.json +++ /dev/null @@ -1,12 +0,0 @@ - "functions": - [ - { - "name":"name", - "tenantId":"default", - "code":"code", - "active":true, - "level":1 - } - - ] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/function/function_create_valid_response.json b/business-services/egf-master/src/test/resources/function/function_create_valid_response.json deleted file mode 100644 index bf5a20be43f..00000000000 --- a/business-services/egf-master/src/test/resources/function/function_create_valid_response.json +++ /dev/null @@ -1,12 +0,0 @@ - - "functions": - [ - { - "name":"name", - "tenantId":"default", - "code":"code", - "active":true - } - - ] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/function/function_search_valid_response.json b/business-services/egf-master/src/test/resources/function/function_search_valid_response.json deleted file mode 100644 index 079a5004e9e..00000000000 --- a/business-services/egf-master/src/test/resources/function/function_search_valid_response.json +++ /dev/null @@ -1,18 +0,0 @@ - "functions": - [ - { - "id": "1", - "name": "name", - "code": "code", - "tenantId": "default" - } - ], - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/function/function_update_invalid_field_value.json b/business-services/egf-master/src/test/resources/function/function_update_invalid_field_value.json deleted file mode 100644 index 564dcf2dd91..00000000000 --- a/business-services/egf-master/src/test/resources/function/function_update_invalid_field_value.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "functions": - [ - { - "id":"2", - "name":"functionUaa", - "tenantId":"default", - "code":"003", - "active":true - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/function/function_update_valid_request.json b/business-services/egf-master/src/test/resources/function/function_update_valid_request.json deleted file mode 100644 index 28777abd3df..00000000000 --- a/business-services/egf-master/src/test/resources/function/function_update_valid_request.json +++ /dev/null @@ -1,13 +0,0 @@ - "functions": - [ - { - "id":"1", - "name":"nameU", - "tenantId":"default", - "code":"codeU", - "active":true, - "level":2 - } - - ] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/function/function_update_valid_response.json b/business-services/egf-master/src/test/resources/function/function_update_valid_response.json deleted file mode 100644 index ec8bdda8a27..00000000000 --- a/business-services/egf-master/src/test/resources/function/function_update_valid_response.json +++ /dev/null @@ -1,14 +0,0 @@ - - "functions": - [ - { - "id":"1", - "name":"nameU", - "tenantId":"default", - "code":"codeU", - "active":true, - "level":2 - } - - ] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/fund/fund_create_invalid_field_value.json b/business-services/egf-master/src/test/resources/fund/fund_create_invalid_field_value.json deleted file mode 100644 index 99c3e97c7e6..00000000000 --- a/business-services/egf-master/src/test/resources/fund/fund_create_invalid_field_value.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "funds": - [ - { - "name":"MunicipalFund", - "tenantId":"default", - "code":"001900000000000000000000000000000", - "active":true - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/fund/fund_create_invalid_fieldsize.json b/business-services/egf-master/src/test/resources/fund/fund_create_invalid_fieldsize.json deleted file mode 100644 index d2da315b182..00000000000 --- a/business-services/egf-master/src/test/resources/fund/fund_create_invalid_fieldsize.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "funds": - [ - { - "name":"MunicipalFund", - "tenantId":"default", - "code":"001", - "active":true - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/fund/fund_create_valid_request.json b/business-services/egf-master/src/test/resources/fund/fund_create_valid_request.json deleted file mode 100644 index 50dc6811631..00000000000 --- a/business-services/egf-master/src/test/resources/fund/fund_create_valid_request.json +++ /dev/null @@ -1,13 +0,0 @@ - "funds": - [ - { - "name":"name", - "tenantId":"default", - "code":"code", - "level":1234, - "identifier":"I", - "active":true - } - - ] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/fund/fund_create_valid_response.json b/business-services/egf-master/src/test/resources/fund/fund_create_valid_response.json deleted file mode 100644 index 2e8765ae9f2..00000000000 --- a/business-services/egf-master/src/test/resources/fund/fund_create_valid_response.json +++ /dev/null @@ -1,14 +0,0 @@ - - "funds": - [ - { - "name":"name", - "tenantId":"default", - "code":"code", - "level":1234, - "identifier":"I", - "active":true - } - - ] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/fund/fund_search_valid_response.json b/business-services/egf-master/src/test/resources/fund/fund_search_valid_response.json deleted file mode 100644 index 048564de1da..00000000000 --- a/business-services/egf-master/src/test/resources/fund/fund_search_valid_response.json +++ /dev/null @@ -1,19 +0,0 @@ - "funds": - [ - { - "id": "1", - "name": "name", - "code": "code", - "identifier": "I", - "tenantId": "default" - } - ], - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/fund/fund_update_invalid_field_value.json b/business-services/egf-master/src/test/resources/fund/fund_update_invalid_field_value.json deleted file mode 100644 index d780beb6da8..00000000000 --- a/business-services/egf-master/src/test/resources/fund/fund_update_invalid_field_value.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "funds": - [ - { - "id":"1", - "name":"MunicipalFundUpdate", - "tenantId":"default", - "code":"001", - "identifier":1, - "active":true - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/fund/fund_update_valid_request.json b/business-services/egf-master/src/test/resources/fund/fund_update_valid_request.json deleted file mode 100644 index caf65283e7b..00000000000 --- a/business-services/egf-master/src/test/resources/fund/fund_update_valid_request.json +++ /dev/null @@ -1,14 +0,0 @@ - "funds": - [ - { - "id":"1", - "name":"nameupdate", - "tenantId":"default", - "code":"code", - "active":true, - "identifier":"U", - "level":1234 - } - - ] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/fund/fund_update_valid_response.json b/business-services/egf-master/src/test/resources/fund/fund_update_valid_response.json deleted file mode 100644 index 5ffb2ad871a..00000000000 --- a/business-services/egf-master/src/test/resources/fund/fund_update_valid_response.json +++ /dev/null @@ -1,15 +0,0 @@ - - "funds": - [ - { - "id":"1", - "name":"nameupdate", - "tenantId":"default", - "code":"code", - "active":true, - "identifier":"U", - "level":1234 - } - - ] - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/recovery/recovery_create_invalid_field_value.json b/business-services/egf-master/src/test/resources/recovery/recovery_create_invalid_field_value.json deleted file mode 100644 index 060ee06274d..00000000000 --- a/business-services/egf-master/src/test/resources/recovery/recovery_create_invalid_field_value.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "recoverys": [ - { - "id": "1", - "code": "0123123132", - "name": "name", - "chartOfAccount": { - "glcode": "341", - "tenantId": "default" - }, - "active": true, - "type": "M", - "remitted": "S", - "ifscCode": "SBIN0005532", - "accountNumber": "3049223457", - "tenantId": "default", - "mode": "M", - "remittanceMode": "M" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/recovery/recovery_create_invalid_fieldsize.json b/business-services/egf-master/src/test/resources/recovery/recovery_create_invalid_fieldsize.json deleted file mode 100644 index d2da315b182..00000000000 --- a/business-services/egf-master/src/test/resources/recovery/recovery_create_invalid_fieldsize.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "funds": - [ - { - "name":"MunicipalFund", - "tenantId":"default", - "code":"001", - "active":true - } - - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/recovery/recovery_create_valid_request.json b/business-services/egf-master/src/test/resources/recovery/recovery_create_valid_request.json deleted file mode 100644 index 534a864befc..00000000000 --- a/business-services/egf-master/src/test/resources/recovery/recovery_create_valid_request.json +++ /dev/null @@ -1,18 +0,0 @@ -"recoverys": [ -{ -"code": "code", -"name": "name", -"chartOfAccount": { -"glcode": "341", -"tenantId": "default" -}, -"active": true, -"type": "M", -"remitted": "S", -"ifscCode": "SBIN0005532", -"accountNumber": "3049223457", -"tenantId": "default", -"mode": "M", -"remittanceMode": "M" -} -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/recovery/recovery_create_valid_response.json b/business-services/egf-master/src/test/resources/recovery/recovery_create_valid_response.json deleted file mode 100644 index 4fe8a3724e1..00000000000 --- a/business-services/egf-master/src/test/resources/recovery/recovery_create_valid_response.json +++ /dev/null @@ -1,19 +0,0 @@ -"recoverys": [ -{ -"id": "1", -"code": "code", -"name": "name", -"chartOfAccount": { -"glcode": "341", -"tenantId": "default" -}, -"active": true, -"type": "M", -"remitted": "S", -"ifscCode": "SBIN0005532", -"accountNumber": "3049223457", -"tenantId": "default", -"mode": "M", -"remittanceMode": "M" -} -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/recovery/recovery_search_valid_response.json b/business-services/egf-master/src/test/resources/recovery/recovery_search_valid_response.json deleted file mode 100644 index d7190e78f20..00000000000 --- a/business-services/egf-master/src/test/resources/recovery/recovery_search_valid_response.json +++ /dev/null @@ -1,28 +0,0 @@ -"recoverys": [ -{ -"id": "1", -"code": "code", -"name": "name", -"chartOfAccount": { -"glcode": "341", -"tenantId": "default" -}, -"active": true, -"type": "M", -"remitted": "S", -"ifscCode": "SBIN0005532", -"accountNumber": "3049223457", -"tenantId": "default", -"mode": "M", -"remittanceMode": "M" -} -], - "page": - { - "totalResults": 1, - "totalPages": 1, - "pageSize": 500, - "currentPage": 0, - "offset": 0 - } - \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/recovery/recovery_update_invalid_field_value.json b/business-services/egf-master/src/test/resources/recovery/recovery_update_invalid_field_value.json deleted file mode 100644 index 5effce13a9f..00000000000 --- a/business-services/egf-master/src/test/resources/recovery/recovery_update_invalid_field_value.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "requestInfo": { - "action": "action", - "did": "did", - "msgId": "msgId", - "requesterId": "requesterId", - "ts": "01-01-2017 01:01:01", - "authToken": null - }, - "recoverys": [ - { - "code": "12312313132", - "name": "name", - "chartOfAccount": { - "glcode": "341", - "tenantId": "default" - }, - "active": true, - "type": "M", - "remitted": "S", - "ifscCode": "SBIN0005532", - "accountNumber": "3049223457", - "tenantId": "default", - "mode": "M", - "remittanceMode": "M" - } - ] -} \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/recovery/recovery_update_valid_request.json b/business-services/egf-master/src/test/resources/recovery/recovery_update_valid_request.json deleted file mode 100644 index 677254e1f6a..00000000000 --- a/business-services/egf-master/src/test/resources/recovery/recovery_update_valid_request.json +++ /dev/null @@ -1,19 +0,0 @@ -"recoverys": [ -{ -"id": "1", -"code": "codeU", -"name": "nameU", -"chartOfAccount": { -"glcode": "341", -"tenantId": "default" -}, -"active": true, -"type": "M", -"remitted": "S", -"ifscCode": "SBIN0005532", -"accountNumber": "3049223457", -"tenantId": "default", -"mode": "M", -"remittanceMode": "M" -} -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/recovery/recovery_update_valid_response.json b/business-services/egf-master/src/test/resources/recovery/recovery_update_valid_response.json deleted file mode 100644 index 677254e1f6a..00000000000 --- a/business-services/egf-master/src/test/resources/recovery/recovery_update_valid_response.json +++ /dev/null @@ -1,19 +0,0 @@ -"recoverys": [ -{ -"id": "1", -"code": "codeU", -"name": "nameU", -"chartOfAccount": { -"glcode": "341", -"tenantId": "default" -}, -"active": true, -"type": "M", -"remitted": "S", -"ifscCode": "SBIN0005532", -"accountNumber": "3049223457", -"tenantId": "default", -"mode": "M", -"remittanceMode": "M" -} -] \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearAccountCodePurpose.sql b/business-services/egf-master/src/test/resources/sql/clearAccountCodePurpose.sql deleted file mode 100644 index d19ec50cae7..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearAccountCodePurpose.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_accountcodepurpose; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearAccountDetailKey.sql b/business-services/egf-master/src/test/resources/sql/clearAccountDetailKey.sql deleted file mode 100644 index 39be682ef75..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearAccountDetailKey.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_accountdetailkey; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearAccountDetailType.sql b/business-services/egf-master/src/test/resources/sql/clearAccountDetailType.sql deleted file mode 100644 index a3e5fe41459..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearAccountDetailType.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_accountdetailtype; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearAccountEntity.sql b/business-services/egf-master/src/test/resources/sql/clearAccountEntity.sql deleted file mode 100644 index 3d4639215ba..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearAccountEntity.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_accountentity; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearBank.sql b/business-services/egf-master/src/test/resources/sql/clearBank.sql deleted file mode 100644 index 9d8dda60c73..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearBank.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_bank; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearBankAccount.sql b/business-services/egf-master/src/test/resources/sql/clearBankAccount.sql deleted file mode 100644 index c7f7d102759..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearBankAccount.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_bankaccount; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearBankBranch.sql b/business-services/egf-master/src/test/resources/sql/clearBankBranch.sql deleted file mode 100644 index 20e90d67163..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearBankBranch.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_bankbranch; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearChartOfAccount.sql b/business-services/egf-master/src/test/resources/sql/clearChartOfAccount.sql deleted file mode 100644 index 6fb02b45434..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearChartOfAccount.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_chartofaccount; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearChartOfAccountDetail.sql b/business-services/egf-master/src/test/resources/sql/clearChartOfAccountDetail.sql deleted file mode 100644 index 87b59cb9afa..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearChartOfAccountDetail.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_chartofaccountdetail; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearFunction.sql b/business-services/egf-master/src/test/resources/sql/clearFunction.sql deleted file mode 100644 index f00d403a396..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearFunction.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_function; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearFund.sql b/business-services/egf-master/src/test/resources/sql/clearFund.sql deleted file mode 100644 index b14403a27d0..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearFund.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_fund; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/clearRecovery.sql b/business-services/egf-master/src/test/resources/sql/clearRecovery.sql deleted file mode 100644 index 02d5b97a3ca..00000000000 --- a/business-services/egf-master/src/test/resources/sql/clearRecovery.sql +++ /dev/null @@ -1 +0,0 @@ -delete from egf_recovery; \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/insertAccountCodePurposeData.sql b/business-services/egf-master/src/test/resources/sql/insertAccountCodePurposeData.sql deleted file mode 100644 index 96a7ce6be7f..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertAccountCodePurposeData.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_accountcodepurpose (id,name,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('1','name',1,now(),null,null,0,'default'); diff --git a/business-services/egf-master/src/test/resources/sql/insertAccountDetailKey.sql b/business-services/egf-master/src/test/resources/sql/insertAccountDetailKey.sql deleted file mode 100644 index ca9e581f150..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertAccountDetailKey.sql +++ /dev/null @@ -1 +0,0 @@ -insert into egf_accountdetailkey (id, key, accountdetailtypeid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) values('1', '1', '1', '1', 'now()', '1', 'now()', 0, 'default'); diff --git a/business-services/egf-master/src/test/resources/sql/insertAccountDetailType.sql b/business-services/egf-master/src/test/resources/sql/insertAccountDetailType.sql deleted file mode 100644 index 0a75f497281..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertAccountDetailType.sql +++ /dev/null @@ -1 +0,0 @@ -insert into egf_accountdetailtype (id, name, description, tablename, active, fullyqualifiedname, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) values('1', 'name', 'contractor', 'contractor', 'true', 'abc/contractor', '1', 'now()', '1', 'now()', 0, 'default'); diff --git a/business-services/egf-master/src/test/resources/sql/insertAccountEntity.sql b/business-services/egf-master/src/test/resources/sql/insertAccountEntity.sql deleted file mode 100644 index 27db809bff4..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertAccountEntity.sql +++ /dev/null @@ -1 +0,0 @@ -insert into egf_accountentity (id, accountdetailtypeid,code,name,active,description, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) values('1', '1', 'code', 'name',true,'entity','1', 'now()', '1', 'now()', 0, 'default'); diff --git a/business-services/egf-master/src/test/resources/sql/insertBank.sql b/business-services/egf-master/src/test/resources/sql/insertBank.sql deleted file mode 100644 index 985a6bb049f..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertBank.sql +++ /dev/null @@ -1,11 +0,0 @@ -insert into egf_bank (id,code,name,description,active,type,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('1','code','name','description',true,'type','1',now(),null,null,1234,'default'); - -insert into egf_bank (id,code,name,description,active,type,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('2','code','name','description',true,'type','1',now(),null,null,1234,'default'); - -insert into egf_bank (id,code,name,description,active,type,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('3','code','name','description',true,'type','1',now(),null,null,1234,'default'); - -insert into egf_bank (id,code,name,description,active,type,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('4','code','name','description',true,'type','1',now(),null,null,1234,'default'); \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/insertBankAccount.sql b/business-services/egf-master/src/test/resources/sql/insertBankAccount.sql deleted file mode 100644 index 4d4c4a73ede..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertBankAccount.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_bankaccount (id,bankbranchid,chartofaccountid,fundid,accountnumber,accounttype,description,active,payto,type,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('1','1','1','1','1','PAYMENTS','description',true,'payto','PAYMENTS',null,now(),null,null,1234,'default'); diff --git a/business-services/egf-master/src/test/resources/sql/insertBankBranch.sql b/business-services/egf-master/src/test/resources/sql/insertBankBranch.sql deleted file mode 100644 index e51ca8fb78b..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertBankBranch.sql +++ /dev/null @@ -1,11 +0,0 @@ -insert into egf_bankbranch (id,bankid,code,name,address,address2,city,state,pincode,phone,fax,contactperson,active,description,micr,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('1','1','code','name','address','address2','city','state','pincode','phone','fax','person',true,'description','micr',null,now(),null,null,1234,'default'); - -insert into egf_bankbranch (id,bankid,code,name,address,address2,city,state,pincode,phone,fax,contactperson,active,description,micr,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('2','1','code','name','address','address2','city','state','pincode','phone','fax','person',true,'description','micr',null,now(),null,null,1234,'default'); - -insert into egf_bankbranch (id,bankid,code,name,address,address2,city,state,pincode,phone,fax,contactperson,active,description,micr,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('3','1','code','name','address','address2','city','state','pincode','phone','fax','person',true,'description','micr',null,now(),null,null,1234,'default'); - -insert into egf_bankbranch (id,bankid,code,name,address,address2,city,state,pincode,phone,fax,contactperson,active,description,micr,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) -values('4','1','code','name','address','address2','city','state','pincode','phone','fax','person',true,'description','micr',null,now(),null,null,1234,'default'); \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/insertChartOfAccountData.sql b/business-services/egf-master/src/test/resources/sql/insertChartOfAccountData.sql deleted file mode 100644 index af4d9605665..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertChartOfAccountData.sql +++ /dev/null @@ -1,7 +0,0 @@ -insert into egf_chartofaccount (id, glcode,name,accountcodepurposeid,description,isactiveforposting,parentid,type,classification,functionrequired,budgetcheckrequired,majorcode,issubledger,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) values('2','glcode','name','P','description',true,'1','B',123456,true,true,'majorcode',true,'',now(),'',now(),'1','default'); - -insert into egf_chartofaccount (id, glcode,name,accountcodepurposeid,description,isactiveforposting,parentid,type,classification,functionrequired,budgetcheckrequired,majorcode,issubledger,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) values('1','glcode','name','P','description',true,'','B',123456,true,true,'majorcode',true,'',now(),'',now(),'1','default'); - -insert into egf_chartofaccount (id, glcode,name,accountcodepurposeid,description,isactiveforposting,parentid,type,classification,functionrequired,budgetcheckrequired,majorcode,issubledger,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) values('4','glcode','name','P','description',true,'3','B',123456,true,true,'majorcode',true,'',now(),'',now(),'1','default'); - -insert into egf_chartofaccount (id, glcode,name,accountcodepurposeid,description,isactiveforposting,parentid,type,classification,functionrequired,budgetcheckrequired,majorcode,issubledger,createdby,createddate,lastmodifiedby,lastmodifieddate,version,tenantid) values('3','glcode','name','P','description',true,'','B',123456,true,true,'majorcode',true,'',now(),'',now(),'1','default'); \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/insertChartOfAccountDetail.sql b/business-services/egf-master/src/test/resources/sql/insertChartOfAccountDetail.sql deleted file mode 100644 index 1e213986eba..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertChartOfAccountDetail.sql +++ /dev/null @@ -1,4 +0,0 @@ -insert into egf_chartofaccountdetail (id, chartofaccountid, accountdetailtypeid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) values('1', '1', '1', '1', 'now()','1', 'now()', '1', 'default'); -insert into egf_chartofaccountdetail (id, chartofaccountid, accountdetailtypeid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) values('2', '2', '2', '1', 'now()','1', 'now()', '1', 'default'); -insert into egf_chartofaccountdetail (id, chartofaccountid, accountdetailtypeid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) values('3', '3', '3', '1', 'now()','1', 'now()', '1', 'default'); -insert into egf_chartofaccountdetail (id, chartofaccountid, accountdetailtypeid, createdby, createddate, lastmodifiedby, lastmodifieddate, version, tenantid) values('4', '4', '4', '1', 'now()','1', 'now()', '1', 'default'); \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/insertFunctionData.sql b/business-services/egf-master/src/test/resources/sql/insertFunctionData.sql deleted file mode 100644 index d65e668ab30..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertFunctionData.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_function (id,name,code,level,parentid,active,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantid) -values('2','name','code',1,'1',true,1,now(),null,null,'default'); \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/insertFundData.sql b/business-services/egf-master/src/test/resources/sql/insertFundData.sql deleted file mode 100644 index 3c6bdcfbb72..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertFundData.sql +++ /dev/null @@ -1,2 +0,0 @@ -insert into egf_fund (id,name,code,identifier,level,parentid,active,createdby,createddate,lastmodifiedby,lastmodifieddate,tenantid) -values('2','name','code','F',1,'1',true,1,now(),null,null,'default'); \ No newline at end of file diff --git a/business-services/egf-master/src/test/resources/sql/insertRecoveryData.sql b/business-services/egf-master/src/test/resources/sql/insertRecoveryData.sql deleted file mode 100644 index fd2ee30fa66..00000000000 --- a/business-services/egf-master/src/test/resources/sql/insertRecoveryData.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO egf_recovery( - id, chartofaccountid, flat, active, remitted, name, code, - ifsccode, mode, remittancemode, accountnumber,createdby, - createddate, lastmodifiedby, lastmodifieddate, version, tenantid) - VALUES ('2374257', '1', 100.00, TRUE , 'test', 'name', 'code', - 'ifsccode', 'M', 'M', '30492234547' - ,1,now(),null,null,0,'default'); \ No newline at end of file diff --git a/business-services/egf-master/start.sh b/business-services/egf-master/start.sh deleted file mode 100644 index 13fdcee6517..00000000000 --- a/business-services/egf-master/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -if [[ -z "${JAVA_OPTS}" ]];then - export JAVA_OPTS="-Xmx64m -Xms64m" -fi - -java ${JAVA_OPTS} -jar /opt/egov/egf-master.jar diff --git a/business-services/egov-apportion-service/Apportion.postman_collection.json b/business-services/egov-apportion-service/Apportion.postman_collection.json deleted file mode 100644 index 8ae77190db5..00000000000 --- a/business-services/egov-apportion-service/Apportion.postman_collection.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "info": { - "_postman_id": "199db000-e1ea-41e0-a559-2fca1e4d5d9d", - "name": "Apportion", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "apportion", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"RequestInfo\": {\n \"apiId\": \"Rainmaker\",\n \"action\": \"\",\n \"did\": 1,\n \"key\": \"\",\n \"msgId\": \"20170310130900|en_IN\",\n \"requesterId\": \"\",\n \"ts\": \"\",\n \"ver\": \".01\",\n \"userInfo\": {\n \n \"id\": 104,\n \"uuid\": \"1dc1db2c-6f26-4803-a3a7-028eb4abff6e\",\n \"userName\": \"9999999999\",\n \"name\": \"dfghj\",\n \"gender\": null,\n \"mobileNumber\": \"9999999999\",\n \"type\": \"CITIZEN\",\n \"roles\": [\n {\n \"id\": null,\n \"name\": \"Citizen\",\n \"code\": \"CITIZEN\"\n }\n ],\n \"tenantId\": \"pb\"\n },\n \"authToken\": \"7f7d617b-f7b4-4e2c-907d-dfd0256f2331\"\n },\n \"tenantId\":\"pb.amritsar\",\n \"Bills\":[\n {\n \"id\": \"10090\",\n \"payeeName\": \"NAMEchanged\",\n \"payeeAddress\": \"ADDRESS\",\n \"mobileNumber\": \"9999999999\",\n \"payeeEmail\": null,\n \"isActive\": true,\n \"isCancelled\": false,\n \"collectionMap\": {\n \"PT\": \"213409\"\n },\n \"billDetails\": [\n {\n \"id\": \"10166\",\n \"bill\": \"10090\",\n \"billDate\": 1551249289654,\n \"billDescription\": \"PT Consumer Code: PT-107-016526:AS-2019-02-27-016985\",\n \"billNumber\": \"10166\",\n \"consumerCode\": \"PT-107-016526:AS-2019-02-27-016985\",\n \"consumerType\": \"BUILTUP\",\n \"minimumAmount\": 100,\n \"totalAmount\": 213409,\n \"collectedAmount\": 0,\n \"collectionModesNotAllowed\": [\n \"\"\n ],\n \"tenantId\": \"pb.amritsar\",\n \"businessService\": \"PT\",\n \"displayMessage\": \"PT Consumer Code: PT-107-016526:AS-2019-02-27-016985\",\n \"callBackForApportioning\": false,\n \"receiptNumber\": null,\n \"receiptDate\": null,\n \"receiptType\": null,\n \"channel\": null,\n \"voucherHeader\": null,\n \"boundary\": null,\n \"reasonForCancellation\": null,\n \"amountPaid\": null,\n \"cancellationRemarks\": null,\n \"status\": null,\n \"billAccountDetails\": [\n {\n \"id\": \"37770\",\n \"tenantId\": \"pb.amritsar\",\n \"billDetail\": \"10166\",\n \"glcode\": \"1100101\",\n \"order\": 2,\n \"accountDescription\": \"PT_CANCER_CESS-1522540800000-1554076799000\",\n \"amount\": 8750,\n \"adjustedAmount\": 0,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n },\n {\n \"id\": \"37771\",\n \"tenantId\": \"pb.amritsar\",\n \"billDetail\": \"10166\",\n \"glcode\": \"1405019\",\n \"order\": 99,\n \"accountDescription\": \"PT_DECIMAL_CEILING_CREDIT-1522540800000-1554076799000\",\n \"amount\": 0.1,\n \"adjustedAmount\": 0,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n },\n {\n \"id\": \"37772\",\n \"tenantId\": \"pb.amritsar\",\n \"billDetail\": \"10166\",\n \"glcode\": \"1405013\",\n \"order\": 2,\n \"accountDescription\": \"PT_FIRE_CESS-1522540800000-1554076799000\",\n \"amount\": 8750,\n \"adjustedAmount\": 0,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n },\n {\n \"id\": \"37773\",\n \"tenantId\": \"pb.amritsar\",\n \"billDetail\": \"10166\",\n \"glcode\": \"1405015\",\n \"order\": 1,\n \"accountDescription\": \"PT_OWNER_EXEMPTION-1522540800000-1554076799000\",\n \"amount\": -5000,\n \"adjustedAmount\": 0,\n \"isActualDemand\": true,\n \"purpose\": \"EXEMPTION\"\n },\n {\n \"id\": \"37774\",\n \"tenantId\": \"pb.amritsar\",\n \"billDetail\": \"10166\",\n \"glcode\": \"1405013\",\n \"order\": 3,\n \"accountDescription\": \"PT_TAX-1522540800000-1554076799000\",\n \"amount\": 180000,\n \"adjustedAmount\": 0,\n \"isActualDemand\": true,\n \"purpose\": \"CURRENT_AMOUNT\"\n },\n {\n \"id\": \"37775\",\n \"tenantId\": \"pb.amritsar\",\n \"billDetail\": \"10166\",\n \"glcode\": \"1405019\",\n \"order\": 10,\n \"accountDescription\": \"PT_TIME_INTEREST-1522540800000-1554076799000\",\n \"amount\": 3408.9,\n \"adjustedAmount\": 0,\n \"isActualDemand\": true,\n \"purpose\": \"OTHERS\"\n },\n {\n \"id\": \"37776\",\n \"tenantId\": \"pb.amritsar\",\n \"billDetail\": \"10166\",\n \"glcode\": \"1405013\",\n \"order\": 1,\n \"accountDescription\": \"PT_TIME_PENALTY-1522540800000-1554076799000\",\n \"amount\": 17500,\n \"adjustedAmount\": 0,\n \"isActualDemand\": true,\n \"purpose\": \"OTHERS\"\n },\n {\n \"id\": \"37777\",\n \"tenantId\": \"pb.amritsar\",\n \"billDetail\": \"10166\",\n \"glcode\": \"1405016\",\n \"order\": 1,\n \"accountDescription\": \"PT_TIME_REBATE-1522540800000-1554076799000\",\n \"amount\": 0,\n \"adjustedAmount\": 0,\n \"isActualDemand\": true,\n \"purpose\": \"REBATE\"\n },\n {\n \"id\": \"37778\",\n \"tenantId\": \"pb.amritsar\",\n \"billDetail\": \"10166\",\n \"glcode\": \"1405019\",\n \"order\": 100,\n \"accountDescription\": \"PT_UNIT_USAGE_EXEMPTION-1522540800000-1554076799000\",\n \"amount\": 0,\n \"adjustedAmount\": 0,\n \"isActualDemand\": true,\n \"purpose\": \"EXEMPTION\"\n }\n ],\n \"manualReceiptNumber\": null,\n \"stateId\": null\n } \n ],\n \"tenantId\": \"pb.amritsar\",\n \"auditDetails\": null\n }\n \t]\n\n}" - }, - "url": { - "raw": "https://egov-micro-dev.egovernments.org/apportion-service/v1/_apportion", - "protocol": "https", - "host": [ - "egov-micro-dev", - "egovernments", - "org" - ], - "path": [ - "apportion-service", - "v1", - "_apportion" - ] - } - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/business-services/egov-apportion-service/CHANGELOG.md b/business-services/egov-apportion-service/CHANGELOG.md deleted file mode 100644 index c1fa8845e85..00000000000 --- a/business-services/egov-apportion-service/CHANGELOG.md +++ /dev/null @@ -1,33 +0,0 @@ - - -# Changelog -All notable changes to this module will be documented in this file. -## 1.1.5 - 2022-01-13 -- Updated to log4j2 version 2.17.1 - -## 1.1.4 2021-02-26 - -- Updated domain name in application.properties - -## 1.1.3 2021-01-12 - -- Apportion and backupdate to demands enabled for zero payments, which was blocked till this point of time - -## 1.1.3 - -## 1.1.2 2020-08-24 -- Fixed Bug RAIN-1432: Added audit for demand apportion - -## 1.1.1 - 2020-06-17 - -- Fixed Bug WOR-415: Regarding adjustedAmount during multiple advance adjustment - -## 1.1.0 - 2020-06-25 -- Added typescript definition generation plugin -- Upgraded to `tracer:2.0.0-SNAPSHOT` -- Upgraded to spring boot `2.2.6-RELEASE` -- Deleted `Dockerfile` and `start.sh` as it is no longer in use - -## 1.0.0 - -- Base version diff --git a/business-services/egov-apportion-service/LOCALSETUP.md b/business-services/egov-apportion-service/LOCALSETUP.md deleted file mode 100644 index e696a785441..00000000000 --- a/business-services/egov-apportion-service/LOCALSETUP.md +++ /dev/null @@ -1,37 +0,0 @@ -# Local Setup - -To setup the egov-apportion-service service in your local system, clone the [Business Service repository](https://github.com/egovernments/business-services). - -## Dependencies - -### Infra Dependency - -- [x] Postgres DB -- [ ] Redis -- [ ] Elasticsearch -- [x] Kafka - - [ ] Consumer - - [x] Producer - -## Running Locally - -To run the egov-apportion-service in local system, you need to port forward below services. - -```bash - kubectl port-forward -n egov {egov-mdms} 8088:8080 -``` - -Update below listed properties in `application.properties` before running the project: - -```ini - --spring.datasource.url=jdbc:postgresql://localhost:5432/{local postgres db name} - --spring.flyway.url=jdbc:postgresql://localhost:5432/{local postgres db name} - --egov.mdms.host={mdms hostname} - -``` - -Optionally egov=persister should be ran locally if auditing is required and following config path should be added in it: - (https://raw.githubusercontent.com/egovernments/configs/master/egov-persister/apportion-persister.yml) \ No newline at end of file diff --git a/business-services/egov-apportion-service/README.md b/business-services/egov-apportion-service/README.md deleted file mode 100644 index f8d6cda415e..00000000000 --- a/business-services/egov-apportion-service/README.md +++ /dev/null @@ -1,73 +0,0 @@ - - -# eGov ApportionService - - -Module is used to distribute the paid amount among the taxHeads. - -### Apportion -The Apportioning service is used to distribute the paid amount among the respective taxHead. -There are two API's first is /apportion-service/bill/_apportion endpoint which is used to apportion the bill. In this case each bill is processed seperately. -The billDetails in each bill are grouped by businessService. For each group the apportionPaidAmount() function is called to apportion the paid amount. -The second endpoint is /apportion-service/demand/_apportion which is used to apportion advance amount in demands. Demands for the same consumer code should be sent for the apportion. -The interface Apportion is to be implemented for custom logic. Default implementation is provided in class called OrderByPriorityApportion, -Default Implementation: - 1. Apportions the paid amount based on the order in each taxhead (ascending wise priority) - 2. If multiple billDetails are present they are sorted by fromPeriod and the oldest one is apportioned first - 3. Validation is placed to enforce that all taxHeads containing negative amounts should have order less than the one with positive amounts - 4. Any advance amount is added to the latest billDetail as new billAccountDetail -For custom implementation the methods getBusinessService() and apportionPaidAmount() has to be implemented. The first method returns key of the implementation while the second method contains the apportion logic for the particular key -The apportion request and respose are stored for audit using persister - - - -### Service Dependencies -- egov-mdms -- egov-persister - - -### Project Structure -*Packages* - - config - Contains all the configuration properties related to module - - service - Consists of all services containing the business logic. - - util - Contains utility functions and constants. - - repository - Fetch data from dependent micro services - - web/controllers - Controllers for the app. - - web/models - POJO for the module. - - producer - Contains kafka producer - - -### Resources -- Granular details about the API's can be found in the [swagger api definition](https://raw.githubusercontent.com/egovernments/docs/collections/contracts/apportion/egov-apportion-service.yml) -- Postman collection for all the API's can be found in the [postman collection](https://raw.githubusercontent.com/egovernments/egov-services/core/egov-apportion-service/Apportion.postman_collection.json) - - -## Build & Run - - - mvn clean install - java -jar target/egov-apportion-service-1.1.1-SNAPSHOT.jar - - - -### API Details - -`BasePath` /apportion-service/v2/[API endpoint] - -##### Method -**a) Apportion Bill `POST /bill/_apportion` :** API (Bulk API) Apportions the paid amount in the field collectedAmount of billDetails in the bill -**b) Apportion demands `POST /demand/_apportion` :** API Apportions the advance amount from previous billing cycles in the latest demands - - -### Kafka Consumers - -- NA - - -### Kafka Producers - -- Following are the Producer topic. - - **save-apportion-bill-request** :- This topic is used to save the bill apportion request for audit. - - **save-apportion-bill-response** :- This topic is used to save the bill apportion response for audit. - - **save-apportion-demand-request** :- This topic is used to save the demand apportion request for audit. - - **save-apportion-demand-response** :- This topic is used to save the demand apportion response for audit. diff --git a/business-services/egov-apportion-service/pom.xml b/business-services/egov-apportion-service/pom.xml deleted file mode 100644 index 3d8a5f0e240..00000000000 --- a/business-services/egov-apportion-service/pom.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - org.egov - egov-apportion-service - 1.1.5-SNAPSHOT - egov-apportion-service - - 2.17.1 - 1.8 - ${java.version} - 1.18.8 - ${java.version} - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework.boot - spring-boot-starter-test - test - - - io.swagger - swagger-core - 1.5.18 - - - org.flywaydb - flyway-core - - - org.projectlombok - lombok - true - - - org.egov.services - services-common - 1.0.0-RELEASE - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - org.postgresql - postgresql - 42.2.2.jre7 - - - javax.validation - validation-api - - - org.egov.services - tracer - 2.1.0-SNAPSHOT - compile - - - org.egov - mdms-client - 0.0.2-SNAPSHOT - compile - - - - - repo.egovernments.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - - src/main/java - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.web.models.ApportionDemandResponse - org.egov.web.models.ApportionRequest - org.egov.web.models.ApportionResponse - org.egov.web.models.ApportionRequestV2 - org.egov.web.models.Bill - org.egov.web.models.BillAccountDetail - org.egov.web.models.BillDetail - org.egov.web.models.Demand - org.egov.web.models.DemandDetail - org.egov.web.models.Role - org.egov.web.models.TaxHeadMaster - org.egov.web.models.AuditDetails - org.egov.web.models.enums.Category - org.egov.web.models.enums.DemandApportionRequest - org.egov.web.models.enums.Purpose - org.egov.web.models.enums.ReceiptType - - - org.egov.web.models.Demand$StatusEnum:DemandStatusEnum - - - org.egov.common.contract.request.User:User - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - true - module - - - - - diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/ApportionApp.java b/business-services/egov-apportion-service/src/main/java/org/egov/ApportionApp.java deleted file mode 100644 index cd931b8398b..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/ApportionApp.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov; - - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.tracer.config.TracerConfiguration; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Import; - -import java.util.TimeZone; - -@SpringBootApplication -@ComponentScan(basePackages = { "org.egov", "org.egov.web.controllers" , "org.egov.config"}) -@Import({ TracerConfiguration.class }) -public class ApportionApp { - - @Value("${app.timezone}") - private String timeZone; - - @Bean - public ObjectMapper objectMapper(){ - return new ObjectMapper() - .configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .setTimeZone(TimeZone.getTimeZone(timeZone)); - } - - public static void main(String[] args) throws Exception { - SpringApplication.run(ApportionApp.class, args); - } - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/config/ApportionConfig.java b/business-services/egov-apportion-service/src/main/java/org/egov/config/ApportionConfig.java deleted file mode 100644 index 0a0484063da..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/config/ApportionConfig.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.egov.config; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.Data; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.TimeZone; - -@Data -@Component -public class ApportionConfig { - - @Value("${app.timezone}") - private String timeZone; - - @PostConstruct - public void initialize() { - TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); - } - - /*@Bean - public ObjectMapper objectMapper(){ - return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).setTimeZone(TimeZone.getTimeZone(timeZone)); - }*/ - - @Bean - @Autowired - public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - converter.setObjectMapper(objectMapper); - return converter; - } - - - - //Persister Config - @Value("${persister.save.bill.apportion.request.topic}") - private String billRequestTopic; - - @Value("${persister.save.bill.apportion.response.topic}") - private String billResponseTopic; - - @Value("${persister.save.demand.apportion.request.topic}") - private String demandRequestTopic; - - @Value("${persister.save.demand.apportion.response.topic}") - private String demandResponseTopic; - - //MDMS - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsEndPoint; - - //Default implementation switch - @Value("${egov.apportion.default.value.order}") - private Boolean apportionByValueAndOrder; - - - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/producer/Producer.java b/business-services/egov-apportion-service/src/main/java/org/egov/producer/Producer.java deleted file mode 100644 index 118934431cd..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/producer/Producer.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.producer; - -import lombok.extern.slf4j.Slf4j; -import org.egov.tracer.kafka.CustomKafkaTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -@Slf4j -public class Producer { - - @Autowired - private CustomKafkaTemplate kafkaTemplate; - - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); - } -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/repository/ServiceRequestRepository.java b/business-services/egov-apportion-service/src/main/java/org/egov/repository/ServiceRequestRepository.java deleted file mode 100644 index 6bf3c517216..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/repository/ServiceRequestRepository.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.egov.repository; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import lombok.extern.slf4j.Slf4j; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import java.util.Map; - -@Repository -@Slf4j -public class ServiceRequestRepository { - - private ObjectMapper mapper; - - private RestTemplate restTemplate; - - - @Autowired - public ServiceRequestRepository(ObjectMapper mapper, RestTemplate restTemplate) { - this.mapper = mapper; - this.restTemplate = restTemplate; - } - - - public Object fetchResult(StringBuilder uri, Object request) { - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - Object response = null; - log.info("URI: "+uri.toString()); - try { - log.info("Request: "+mapper.writeValueAsString(request)); - response = restTemplate.postForObject(uri.toString(), request, Map.class); - }catch(HttpClientErrorException e) { - log.error("External Service threw an Exception: ",e); - throw new ServiceCallException(e.getResponseBodyAsString()); - }catch(Exception e) { - log.error("Exception while fetching from searcher: ",e); - } - - return response; - } -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/service/Apportion.java b/business-services/egov-apportion-service/src/main/java/org/egov/service/Apportion.java deleted file mode 100644 index bcb2d4a8b33..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/service/Apportion.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.service; - -import org.egov.web.models.Bill; -import org.egov.web.models.BillDetail; - -import java.math.BigDecimal; -import java.util.*; - -public interface Apportion { - - - - /** - * Should return the code of the BusinessService for which the interface is implemented - * @return Code of the BusinessService - */ - String getBusinessService(); - - - /** - * Distibutes the paid amount among the Bill account details - * @param bill The bill to be apportioned - * @return Apportioned BillDetails - */ - List apportionPaidAmount(Bill bill, Object masterData); - - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/service/ApportionService.java b/business-services/egov-apportion-service/src/main/java/org/egov/service/ApportionService.java deleted file mode 100644 index c550a7a7f94..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/service/ApportionService.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.egov.service; - -import static org.egov.util.ApportionConstants.DEFAULT; - -import java.math.BigDecimal; -import java.util.*; - -import org.egov.config.ApportionConfig; -import org.egov.producer.Producer; -import org.egov.web.models.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - - -@Service -public class ApportionService { - - private final List apportions; - private Map APPORTION_MAP = new HashMap<>(); - - private Producer producer; - private ApportionConfig config; - private MDMSService mdmsService; - - - @Autowired - public ApportionService(List apportions, Producer producer, - ApportionConfig config, MDMSService mdmsService) { - this.apportions = Collections.unmodifiableList(apportions); - this.producer = producer; - this.config = config; - this.mdmsService = mdmsService; - initialize(); - } - - private void initialize() { - if (Objects.isNull(apportions)) - throw new IllegalStateException("No Apportion found, spring initialization failed."); - - if (APPORTION_MAP.isEmpty() && !apportions.isEmpty()) { - apportions.forEach(apportion -> { - APPORTION_MAP.put(apportion.getBusinessService(), apportion); - }); - } - APPORTION_MAP = Collections.unmodifiableMap(APPORTION_MAP); - } - - - /** - * Apportions the paid amount for the given list of bills - * - * @param request The apportion request - * @return Apportioned Bills - */ - public List apportionBills(ApportionRequest request) { - List bills = request.getBills(); - Apportion apportion; - - //Save the request through persister - producer.push(config.getBillRequestTopic(), request); - - //Fetch the required MDMS data - Object masterData = mdmsService.mDMSCall(request.getRequestInfo(), request.getTenantId()); - - for (Bill bill : bills) { - - // Create a map of businessService to list of billDetails belonging to that businessService - // Map> businessServiceToBillDetails = util.groupByBusinessService(billInfo.getBillDetails()); - - bill.getBillDetails().sort(Comparator.comparing(BillDetail::getFromPeriod)); - - - String businessKey = bill.getBusinessService(); - BigDecimal amountPaid = bill.getAmountPaid(); - - List billDetails = bill.getBillDetails(); - - if (CollectionUtils.isEmpty(billDetails)) - continue; - - // Get the appropriate implementation of Apportion - if (isApportionPresent(businessKey)) - apportion = getApportion(businessKey); - else - apportion = getApportion(DEFAULT); - - /* - * Apportion the paid amount among the given list of billDetail - */ - apportion.apportionPaidAmount(bill, masterData); - } - - - - - //Save the response through persister - producer.push(config.getBillResponseTopic(), request); - return bills; - } - - - /** - * Retrives the apportion for the given businessService - * - * @param businessService The businessService of the billDetails - * @return Apportion object for the given businessService - */ - private Apportion getApportion(String businessService) { - return APPORTION_MAP.get(businessService); - } - - - /** - * Checks if the apportion is present for the given businessService - * - * @param businessService The businessService of the billDetails - * @return True if the apportion is present else false - */ - private Boolean isApportionPresent(String businessService) { - return APPORTION_MAP.containsKey(businessService); - } - - -} \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/service/ApportionServiceV2.java b/business-services/egov-apportion-service/src/main/java/org/egov/service/ApportionServiceV2.java deleted file mode 100644 index fd39214a842..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/service/ApportionServiceV2.java +++ /dev/null @@ -1,274 +0,0 @@ -package org.egov.service; - -import static org.egov.util.ApportionConstants.DEFAULT; - -import java.math.BigDecimal; -import java.util.*; - -import org.egov.config.ApportionConfig; -import org.egov.producer.Producer; -import org.egov.web.models.*; -import org.egov.web.models.enums.DemandApportionRequest; -import org.egov.web.models.enums.Purpose; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - - -@Service -public class ApportionServiceV2 { - - private final List apportions; - private Map APPORTION_MAP = new HashMap<>(); - - private Producer producer; - private ApportionConfig config; - private MDMSService mdmsService; - private TranslationService translationService; - - - @Autowired - public ApportionServiceV2(List apportions, Producer producer, - ApportionConfig config, MDMSService mdmsService, - TranslationService translationService) { - this.apportions = Collections.unmodifiableList(apportions); - this.producer = producer; - this.config = config; - this.mdmsService = mdmsService; - this.translationService = translationService; - initialize(); - } - - private void initialize() { - if (Objects.isNull(apportions)) - throw new IllegalStateException("No Apportion found, spring initialization failed."); - - if (APPORTION_MAP.isEmpty() && !apportions.isEmpty()) { - apportions.forEach(apportion -> { - APPORTION_MAP.put(apportion.getBusinessService(), apportion); - }); - } - APPORTION_MAP = Collections.unmodifiableMap(APPORTION_MAP); - } - - - /** - * Apportions the paid amount for the given list of bills - * - * @param request The apportion request - * @return Apportioned Bills - */ - public List apportionBills(ApportionRequest request) { - List bills = request.getBills(); - ApportionV2 apportion; - - //Save the request through persister - producer.push(config.getBillRequestTopic(), request); - - //Fetch the required MDMS data - Object masterData = mdmsService.mDMSCall(request.getRequestInfo(), request.getTenantId()); - - for (Bill bill : bills) { - - // Create a map of businessService to list of billDetails belonging to that businessService - // Map> businessServiceToBillDetails = util.groupByBusinessService(billInfo.getBillDetails()); - - bill.getBillDetails().sort(Comparator.comparing(BillDetail::getFromPeriod)); - - - String businessKey = bill.getBusinessService(); - BigDecimal amountPaid = bill.getAmountPaid(); - - List billDetails = bill.getBillDetails(); - - if (CollectionUtils.isEmpty(billDetails)) - continue; - - // Get the appropriate implementation of Apportion - if (isApportionPresent(businessKey)) - apportion = getApportion(businessKey); - else - apportion = getApportion(DEFAULT); - - /* - * Apportion the paid amount among the given list of billDetail - */ - - ApportionRequestV2 apportionRequestV2 = translationService.translate(bill); - List taxDetails = apportion.apportionPaidAmount(apportionRequestV2, masterData); - updateAdjustedAmountInBills(bill,taxDetails); - addAdvanceIfExistForBill(billDetails,taxDetails); - } - - //Save the response through persister - producer.push(config.getBillResponseTopic(), request); - return bills; - } - - - /** - * Retrives the apportion for the given businessService - * - * @param businessService The businessService of the billDetails - * @return Apportion object for the given businessService - */ - private ApportionV2 getApportion(String businessService) { - return APPORTION_MAP.get(businessService); - } - - - /** - * Checks if the apportion is present for the given businessService - * - * @param businessService The businessService of the billDetails - * @return True if the apportion is present else false - */ - private Boolean isApportionPresent(String businessService) { - return APPORTION_MAP.containsKey(businessService); - } - - - - /** - * Apportions the paid amount for the given list of demands - * - * @param request The apportion request - * @return Apportioned Bills - */ - public List apportionDemands(DemandApportionRequest request) { - List demands = request.getDemands(); - ApportionV2 apportion; - - //Save the request through persister - producer.push(config.getDemandRequestTopic(), request); - - //Fetch the required MDMS data - Object masterData = mdmsService.mDMSCall(request.getRequestInfo(), request.getTenantId()); - - demands.sort(Comparator.comparing(Demand::getTaxPeriodFrom)); - - ApportionRequestV2 apportionRequestV2 = translationService.translate(demands,masterData); - - - /* - * Need to validate that all demands that come for apportioning - * has same businessService and consumerCode - * */ - String businessKey = demands.get(0).getBusinessService(); - - if (isApportionPresent(businessKey)) - apportion = getApportion(businessKey); - else - apportion = getApportion(DEFAULT); - - List taxDetails = apportion.apportionPaidAmount(apportionRequestV2, masterData); - updateAdjustedAmountInDemands(demands,taxDetails); - addAdvanceIfExistForDemand(demands,taxDetails); - - - - //Save the response through persister - producer.push(config.getDemandResponseTopic(), request); - return demands; - } - - - /** - * Updates adjusted amount in demand from mao returned after apportion - * @param demands - * @param taxDetails - */ - private void updateAdjustedAmountInDemands(List demands,List taxDetails){ - - Map idToAdjustedAmount = new HashMap<>(); - taxDetails.forEach(taxDetail -> { - taxDetail.getBuckets().forEach(bucket -> { - idToAdjustedAmount.put(bucket.getEntityId(),bucket.getAdjustedAmount()); - }); - }); - - demands.forEach(demand -> { - demand.getDemandDetails().forEach(demandDetail -> { - demandDetail.setCollectionAmount(idToAdjustedAmount.get(demandDetail.getId())); - }); - }); - - } - - /** - * Updates adjusted amount in bill from mao returned after apportion - * @param bill - * @param taxDetails - */ - private void updateAdjustedAmountInBills(Bill bill,List taxDetails){ - - Map idToBucket = new HashMap<>(); - Map idToAmountPaid = new HashMap<>(); - - taxDetails.forEach(taxDetail -> { - idToAmountPaid.put(taxDetail.getEntityId(),taxDetail.getAmountPaid()); - taxDetail.getBuckets().forEach(bucket -> { - idToBucket.put(bucket.getEntityId(),bucket); - }); - }); - - bill.getBillDetails().forEach(billDetail -> { - billDetail.setAmountPaid(idToAmountPaid.get(billDetail.getId())); - billDetail.getBillAccountDetails().forEach(billAccountDetail -> { - billAccountDetail.setAdjustedAmount(idToBucket.get(billAccountDetail.getId()).getAdjustedAmount()); - if(billAccountDetail.getTaxHeadCode().contains("ADVANCE")){ - billAccountDetail.setAmount(idToBucket.get(billAccountDetail.getId()).getAmount()); - } - - }); - }); - } - - - private void addAdvanceIfExistForDemand(List demands,List taxDetails){ - - Bucket advanceBucket = null; - TaxDetail taxDetail = taxDetails.get(taxDetails.size()-1); - - for(Bucket bucket : taxDetail.getBuckets()){ - if(bucket.getEntityId()==null && bucket.getPurpose().equals(Purpose.ADVANCE_AMOUNT)){ - advanceBucket = bucket; - break; - } - } - - if(advanceBucket != null){ - DemandDetail demandDetailForAdvance = new DemandDetail(); - demandDetailForAdvance.setTaxAmount(advanceBucket.getAmount()); - demandDetailForAdvance.setTaxHeadMasterCode(advanceBucket.getTaxHeadCode()); - demands.get(demands.size()-1).getDemandDetails().add(demandDetailForAdvance); - } - - } - - - private void addAdvanceIfExistForBill(List billDetails,List taxDetails){ - - Bucket advanceBucket = null; - TaxDetail taxDetail = taxDetails.get(taxDetails.size()-1); - - for(Bucket bucket : taxDetail.getBuckets()){ - if(bucket.getEntityId()==null && bucket.getPurpose().equals(Purpose.ADVANCE_AMOUNT)){ - advanceBucket = bucket; - break; - } - } - - if(advanceBucket != null){ - BillAccountDetail billAccountDetailForAdvance = new BillAccountDetail(); - billAccountDetailForAdvance.setAmount(advanceBucket.getAmount()); - billAccountDetailForAdvance.setPurpose(Purpose.ADVANCE_AMOUNT); - billAccountDetailForAdvance.setTaxHeadCode(advanceBucket.getTaxHeadCode()); - billDetails.get(billDetails.size()-1).getBillAccountDetails().add(billAccountDetailForAdvance); - } - - } - - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/service/ApportionV2.java b/business-services/egov-apportion-service/src/main/java/org/egov/service/ApportionV2.java deleted file mode 100644 index 76fba301a1f..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/service/ApportionV2.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.egov.service; - -import org.egov.web.models.ApportionRequestV2; -import org.egov.web.models.Bill; -import org.egov.web.models.BillDetail; -import org.egov.web.models.TaxDetail; - -import java.util.List; - -public interface ApportionV2 { - - /** - * Should return the code of the BusinessService for which the interface is implemented - * @return Code of the BusinessService - */ - String getBusinessService(); - - - - List apportionPaidAmount(ApportionRequestV2 apportionRequestV2, Object masterData); - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/service/MDMSService.java b/business-services/egov-apportion-service/src/main/java/org/egov/service/MDMSService.java deleted file mode 100644 index f230811646b..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/service/MDMSService.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.egov.service; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.config.ApportionConfig; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.ModuleDetail; -import org.egov.repository.ServiceRequestRepository; -import org.egov.web.models.ApportionRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import static org.egov.util.ApportionConstants.*; - -@Service -public class MDMSService { - - - private ServiceRequestRepository serviceRequestRepository; - - private ApportionConfig config; - - @Autowired - public MDMSService(ServiceRequestRepository serviceRequestRepository,ApportionConfig config) { - this.serviceRequestRepository = serviceRequestRepository; - this.config = config; - } - - /** - * Fetches MDMS data based on the apportion request - * @param requestInfo The apportion request for which master data is required - * @return MasterData from MDMS - */ - public Object mDMSCall(RequestInfo requestInfo,String tenantId){ - MdmsCriteriaReq mdmsCriteriaReq = getMDMSRequest(requestInfo,tenantId); - Object result = serviceRequestRepository.fetchResult(getMdmsSearchUrl(), mdmsCriteriaReq); - return result; - } - - /** - * Creates MDMS search criteria object MdmsCriteriaReq - * @param requestInfo The requestInfo of the apportion request - * @param tenantId TenantId of the request - * @return MDMS search criteria - */ - private MdmsCriteriaReq getMDMSRequest(RequestInfo requestInfo, String tenantId){ - ModuleDetail moduleDetail = getBillingModuleDetail(); - - List moduleDetails = new LinkedList<>(); - moduleDetails.add(moduleDetail); - - MdmsCriteria mdmsCriteria = MdmsCriteria.builder().moduleDetails(moduleDetails).tenantId(tenantId) - .build(); - - MdmsCriteriaReq mdmsCriteriaReq = MdmsCriteriaReq.builder().mdmsCriteria(mdmsCriteria) - .requestInfo(requestInfo).build(); - return mdmsCriteriaReq; - } - - - - /** - * Returns the url for mdms search endpoint - * - * @return url for mdms search endpoint - */ - public StringBuilder getMdmsSearchUrl() { - return new StringBuilder().append(config.getMdmsHost()).append(config.getMdmsEndPoint()); - } - - - /** - * Creates request to search taxhead in mdms - * @return MDMS request for taxhead - */ - private ModuleDetail getTaxHeadMasterRequest() { - // filter to only get code field from master data - - // final String filterCodeForUom = "$.[?(@.active==true)]"; - - ModuleDetail tlModuleDtls = ModuleDetail.builder() - .masterDetails(Collections.singletonList(MasterDetail.builder().name(MDMS_TAXHEAD).build())) - .moduleName(MDMS_BILLING_SERVICE).build(); - - return tlModuleDtls; - } - - - /** - * Creates request to search businessService in mdms - * @return MDMS request for businessService - */ - private ModuleDetail getBusinessServiceRequest() { - // filter to only get code field from master data - - // final String filterCodeForUom = "$.[?(@.active==true)]"; - - ModuleDetail tlModuleDtls = ModuleDetail.builder() - .masterDetails(Collections.singletonList(MasterDetail.builder().name(MDMS_BUSINESSSERVICE).build())) - .moduleName(MDMS_BILLING_SERVICE).build(); - - return tlModuleDtls; - } - - - /** - * Creates request to search businessService in mdms - * @return MDMS request for businessService - */ - private ModuleDetail getBillingModuleDetail() { - - List masterDetails = new ArrayList<>(); - - MasterDetail businessServiceMasterDetail = MasterDetail.builder().name(MDMS_BUSINESSSERVICE).build(); - MasterDetail taxHeadMasterDetail = MasterDetail.builder().name(MDMS_TAXHEAD).build(); - - masterDetails.add(businessServiceMasterDetail); - masterDetails.add(taxHeadMasterDetail); - - ModuleDetail tlModuleDtls = ModuleDetail.builder() - .masterDetails(masterDetails) - .moduleName(MDMS_BILLING_SERVICE).build(); - - return tlModuleDtls; - } - - - - - - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/service/TaxHeadMasterService.java b/business-services/egov-apportion-service/src/main/java/org/egov/service/TaxHeadMasterService.java deleted file mode 100644 index 0af052bd389..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/service/TaxHeadMasterService.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.egov.service; - -import com.jayway.jsonpath.JsonPath; -import org.egov.tracer.model.CustomException; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.egov.util.ApportionConstants.*; - -@Service -public class TaxHeadMasterService { - - - /** - * Fetches the advance amount taxHead for the given businessService from MDMSData - * @param businessService The businessService for which taxhead is to be fetched - * @param mdmsData The master data received from MDMS Service - * @return The code of the TaxHead - */ - public String getAdvanceTaxHead(String businessService,Object mdmsData){ - - String jsonpath = ADVANCE_TAXHEAD_JSONPATH_CODE; - jsonpath = jsonpath.replace("{}",businessService); - - - List taxHeads = JsonPath.read(mdmsData,jsonpath); - - if(CollectionUtils.isEmpty(taxHeads)) - throw new CustomException("NO TAXHEAD FOUND","No Advance taxHead found for businessService: "+businessService); - - return taxHeads.get(0); - } - - - /** - * Creates a map of taxHeadCode to priority for taxHeads of given businessService - * @param businessService - * @param mdmsData - * @return - */ - public Map getCodeToOrderMap(String businessService,Object mdmsData){ - - String jsonpath = TAXHEAD_JSONPATH_CODE; - jsonpath = jsonpath.replace("{}",businessService); - - List> taxHeads = JsonPath.read(mdmsData,jsonpath); - - if(CollectionUtils.isEmpty(taxHeads)) - throw new CustomException("NO TAXHEAD FOUND","No taxHeads found for businessService: "+businessService); - - Map codeToOrderMap = new HashMap<>(); - - taxHeads.forEach(taxHead -> { - String taxHeadCode = taxHead.get(MDMS_TAXHEADCODE_KEY); - Integer order = Integer.valueOf(taxHead.get(MDMS_ORDER_KEY)); - codeToOrderMap.put(taxHeadCode,order); - }); - - return codeToOrderMap; - } - - - /** - * Fetches the isAdvanceAllowed flag from the MDMS data for the given businessService - * @param businessService BusinessService for which advance flag has to be returned - * @param mdmsData MDMS data for Billing - * @return boolean flag indicating whether advance payment is allowed for the given businessService - */ - public Boolean isAdvanceAllowed(String businessService, Object mdmsData){ - - String jsonpath = ADVANCE_BUSINESSSERVICE_JSONPATH_CODE; - jsonpath = jsonpath.replace("{}",businessService); - - List isAdvanceAllowedList = JsonPath.read(mdmsData,jsonpath); - - if(CollectionUtils.isEmpty(isAdvanceAllowedList)) - throw new CustomException("NO BUSINESSSERVICE FOUND","No businessService or isAdvanceAllowed flag found for code: "+businessService); - - return isAdvanceAllowedList.get(0); - } - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/service/TranslationService.java b/business-services/egov-apportion-service/src/main/java/org/egov/service/TranslationService.java deleted file mode 100644 index 7f683da729a..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/service/TranslationService.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.egov.service; - -import org.egov.tracer.model.CustomException; -import org.egov.web.models.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.math.BigDecimal; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class TranslationService { - - - private TaxHeadMasterService taxHeadMasterService; - - - @Autowired - public TranslationService(TaxHeadMasterService taxHeadMasterService) { - this.taxHeadMasterService = taxHeadMasterService; - } - - - public ApportionRequestV2 translate(Bill bill){ - - String businessService = bill.getBusinessService(); - BigDecimal amountPaid = bill.getAmountPaid(); - Boolean isAdvanceAllowed = bill.getIsAdvanceAllowed(); - - ApportionRequestV2 apportionRequestV2 = ApportionRequestV2.builder().amountPaid(amountPaid).businessService(businessService) - .isAdvanceAllowed(isAdvanceAllowed).build(); - - List billDetails = bill.getBillDetails(); - - for(BillDetail billDetail : billDetails){ - - TaxDetail taxDetail = TaxDetail.builder().fromPeriod(billDetail.getFromPeriod()).amountToBePaid(billDetail.getAmount()) - .amountPaid((billDetail.getAmountPaid() == null) ? BigDecimal.ZERO : billDetail.getAmountPaid()) - .entityId(billDetail.getId()) - .build(); - - billDetail.getBillAccountDetails().forEach(billAccountDetail -> { - Bucket bucket = Bucket.builder().amount(billAccountDetail.getAmount()) - .adjustedAmount((billAccountDetail.getAdjustedAmount()==null) ? BigDecimal.ZERO : billAccountDetail.getAdjustedAmount()) - .taxHeadCode(billAccountDetail.getTaxHeadCode()) - .priority(billAccountDetail.getOrder()) - .entityId(billAccountDetail.getId()) - .build(); - taxDetail.addBucket(bucket); - }); - - apportionRequestV2.addTaxDetail(taxDetail); - } - - return apportionRequestV2; - - } - - - - public ApportionRequestV2 translate(List demands,Object mdmsData) { - - // Group by businessService before calling this function - String businessService = demands.get(0).getBusinessService(); - - - Map codeToOrderMap = taxHeadMasterService.getCodeToOrderMap(businessService,mdmsData); - - // FIX ME - BigDecimal amountPaid = BigDecimal.ZERO; - Boolean isAdvanceAllowed = taxHeadMasterService.isAdvanceAllowed(businessService,mdmsData); - - - ApportionRequestV2 apportionRequestV2 = ApportionRequestV2.builder().amountPaid(amountPaid).businessService(businessService) - .isAdvanceAllowed(isAdvanceAllowed).build(); - - Map errorMap = new HashMap<>(); - - for(Demand demand : demands){ - - TaxDetail taxDetail = TaxDetail.builder().fromPeriod(demand.getTaxPeriodFrom()).entityId(demand.getId()).build(); - - BigDecimal amountToBePaid = BigDecimal.ZERO; - BigDecimal collectedAmount = BigDecimal.ZERO; - - for(DemandDetail demandDetail : demand.getDemandDetails()){ - - Integer priority = codeToOrderMap.get(demandDetail.getTaxHeadMasterCode()); - - if(priority == null) - errorMap.put("INVALID_TAXHEAD_CODE","Order is null or taxHead is not found for code: "+demandDetail.getTaxHeadMasterCode()); - - Bucket bucket = Bucket.builder().amount(demandDetail.getTaxAmount()) - .adjustedAmount((demandDetail.getCollectionAmount()==null) ? BigDecimal.ZERO : demandDetail.getCollectionAmount()) - .taxHeadCode(demandDetail.getTaxHeadMasterCode()) - .priority(priority) - .entityId(demandDetail.getId()) - .build(); - taxDetail.addBucket(bucket); - - - amountToBePaid = amountToBePaid.add(demandDetail.getTaxAmount()); - collectedAmount = collectedAmount.add(demandDetail.getCollectionAmount()); - } - - taxDetail.setAmountPaid(collectedAmount); - taxDetail.setAmountToBePaid(amountToBePaid); - - apportionRequestV2.addTaxDetail(taxDetail); - - } - - if(!CollectionUtils.isEmpty(errorMap)) - throw new CustomException(errorMap); - - return apportionRequestV2; - } - - - - - - } diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/service/apportions/OrderByPriority.java b/business-services/egov-apportion-service/src/main/java/org/egov/service/apportions/OrderByPriority.java deleted file mode 100644 index ba71e6cd65e..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/service/apportions/OrderByPriority.java +++ /dev/null @@ -1,326 +0,0 @@ -package org.egov.service.apportions; - -import org.egov.config.ApportionConfig; -import org.egov.service.ApportionV2; -import org.egov.service.TaxHeadMasterService; -import org.egov.tracer.model.CustomException; -import org.egov.web.models.ApportionRequestV2; -import org.egov.web.models.Bucket; -import org.egov.web.models.TaxDetail; -import org.egov.web.models.enums.Purpose; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.egov.util.ApportionConstants.DEFAULT; - -@Service -public class OrderByPriority implements ApportionV2 { - - - private TaxHeadMasterService taxHeadMasterService; - - private ApportionConfig config; - - - @Autowired - public OrderByPriority(TaxHeadMasterService taxHeadMasterService, ApportionConfig config) { - this.taxHeadMasterService = taxHeadMasterService; - this.config = config; - } - - - @Override - public String getBusinessService() { - return DEFAULT; - } - - @Override - public List apportionPaidAmount(ApportionRequestV2 apportionRequestV2, Object masterData) { - List taxDetails = apportionRequestV2.getTaxDetails(); - taxDetails.sort(Comparator.comparing(TaxDetail::getFromPeriod)); - BigDecimal remainingAmount = apportionRequestV2.getAmountPaid(); - BigDecimal amount; - Boolean isAmountPositive; - - /* - * If zero amount payment is done and the total amount of bill or demands is zero. We will - * set the collection amount to the taxamount for all taxHeads - * */ - if(apportionRequestV2.getAmountPaid().compareTo(BigDecimal.ZERO) == 0 - && getTotalAmount(taxDetails).compareTo(BigDecimal.ZERO) == 0){ - apportionZeroPaymentAndZeroAmountToBePaid(taxDetails); - return taxDetails; - } - - if(apportionRequestV2.getIsAdvanceAllowed()){ - BigDecimal requiredAdvanceAmount = apportionAndGetRequiredAdvance(apportionRequestV2); - remainingAmount = remainingAmount.add(requiredAdvanceAmount); - } - - if(!config.getApportionByValueAndOrder()) - validateOrder(taxDetails); - - BigDecimal amountBeforeApportion = remainingAmount; - - for (TaxDetail taxDetail : taxDetails){ - - if(remainingAmount.compareTo(BigDecimal.ZERO)==0){ - taxDetail.setAmountPaid(BigDecimal.ZERO); - continue; - } - - if(!config.getApportionByValueAndOrder()) - taxDetail.getBuckets().sort(Comparator.comparing(Bucket::getAmount)); - else - taxDetail.getBuckets().sort(Comparator.comparing(Bucket::getAmount).thenComparing(Bucket::getPriority)); - - - for(Bucket bucket : taxDetail.getBuckets()) { - - amount = bucket.getAmount().subtract(bucket.getAdjustedAmount()); - isAmountPositive = amount.compareTo(BigDecimal.ZERO) >= 0; - - if (isAmountPositive) { - - if (remainingAmount.equals(BigDecimal.ZERO)) { - bucket.setAdjustedAmount(bucket.getAdjustedAmount().add(BigDecimal.ZERO)); - continue; - } - - if (remainingAmount.compareTo(amount) <= 0) { - bucket.setAdjustedAmount(bucket.getAdjustedAmount().add(remainingAmount)); - remainingAmount = BigDecimal.ZERO; - } - - if (remainingAmount.compareTo(amount) > 0) { - bucket.setAdjustedAmount(bucket.getAdjustedAmount().add(amount)); - remainingAmount = remainingAmount.subtract(amount); - } - } - else { - // FIX ME - // advance should be checked from purpose - if(!bucket.getTaxHeadCode().contains("ADVANCE")) { - bucket.setAdjustedAmount(amount); - remainingAmount = remainingAmount.subtract(amount); - } - } - } - - if(taxDetail.getAmountPaid()==null) - taxDetail.setAmountPaid(BigDecimal.ZERO); - - taxDetail.setAmountPaid(taxDetail.getAmountPaid().add(amountBeforeApportion.subtract(remainingAmount))); - amountBeforeApportion = remainingAmount; - } - - - //If advance amount is available - if(remainingAmount.compareTo(BigDecimal.ZERO)>0){ - addAdvanceBillAccountDetail(remainingAmount,apportionRequestV2,masterData); - } - - - return taxDetails; - } - - - - /** - * Creates a advance BillAccountDetail and adds it to the latest billDetail - * @param advanceAmount The advance amount paid - * @param apportionRequestV2 The bill for which apportioning is done - * @param masterData The required masterData for the TaxHeads - */ - private void addAdvanceBillAccountDetail(BigDecimal advanceAmount, ApportionRequestV2 apportionRequestV2, Object masterData){ - List taxDetails = apportionRequestV2.getTaxDetails(); - String taxHead = taxHeadMasterService.getAdvanceTaxHead(apportionRequestV2.getBusinessService(),masterData); - - TaxDetail latestTaxDetail = taxDetails.get(taxDetails.size()-1); - Bucket bucketForAdvance = null; - - - // Search if advance bucket already exist - for(Bucket bucket : latestTaxDetail.getBuckets()){ - if(bucket.getTaxHeadCode().contains("ADVANCE")){ - bucketForAdvance = bucket; - break; - } - } - - // If advance bucket is not present add new one else update existing one - if(bucketForAdvance == null){ - // Creating the advance bucket - bucketForAdvance = new Bucket(); - bucketForAdvance.setAmount(advanceAmount.negate()); - bucketForAdvance.setPurpose(Purpose.ADVANCE_AMOUNT); - bucketForAdvance.setTaxHeadCode(taxHead); - - // Setting the advance bucket in the latest taxDetail - taxDetails.get(taxDetails.size()-1).getBuckets().add(bucketForAdvance); - } - - else { - bucketForAdvance.setAmount(bucketForAdvance.getAmount().add(advanceAmount.negate())); - } - - - // Updating the amountPaid in the taxDetail - BigDecimal amountPaid = taxDetails.get(taxDetails.size()-1).getAmountPaid(); - taxDetails.get(taxDetails.size()-1).setAmountPaid(amountPaid.add(advanceAmount)); - } - - - private void validateOrder(List taxDetails){ - Map errorMap = new HashMap<>(); - taxDetails.forEach(taxDetail -> { - - if(taxDetail.getFromPeriod()==null) - errorMap.put("INVALID PERIOD","The fromPeriod cannot be null"); - - List buckets = taxDetail.getBuckets(); - - int maxOrderOfNegativeTaxHead = Integer.MIN_VALUE; - int minOrderOfPositiveTaxHead = Integer.MAX_VALUE; - - for(int i=0;i0 && - minOrderOfPositiveTaxHead > buckets.get(i).getPriority()){ - minOrderOfPositiveTaxHead = buckets.get(i).getPriority(); - } - else if(buckets.get(i).getAmount().compareTo(BigDecimal.ZERO)<0 && - maxOrderOfNegativeTaxHead < buckets.get(i).getPriority()){ - maxOrderOfNegativeTaxHead = buckets.get(i).getPriority(); - } - } - if(minOrderOfPositiveTaxHead < maxOrderOfNegativeTaxHead) - throw new CustomException("INVALID ORDER","Positive TaxHeads should be after Negative TaxHeads"); - }); - if(!errorMap.isEmpty()) - throw new CustomException(errorMap); - } - - - /** - * Apportions the advance taxhead and returns the advance amount. - * @param apportionRequestV2 - * @return - */ - private BigDecimal apportionAndGetRequiredAdvance(ApportionRequestV2 apportionRequestV2){ - - List taxDetails = apportionRequestV2.getTaxDetails(); - - BigDecimal totalPositiveAmount = BigDecimal.ZERO; - - for (TaxDetail taxDetail : taxDetails) { - - if(taxDetail.getAmountToBePaid().compareTo(BigDecimal.ZERO) > 0 ) - totalPositiveAmount = totalPositiveAmount.add(taxDetail.getAmountToBePaid()); - - } - - /** - * If net amount to be paid is zero for all billDetails no advance payment from - * previous billing cycles is required for apportion - * - */ - - if(totalPositiveAmount.compareTo(BigDecimal.ZERO) == 0) - return BigDecimal.ZERO; - - - /* net = Bill Account Detail amount - Bill Account Detail adj amount - * In case when advance + net > total Positive: 200 + (100 - 20) > 230 - * Bill Account Detail amount 100 - Bill Account Detail adj amount 20 - current advance 200 - Total positive 230 - final adjusted amount = 20 + (230 - 200) = 50 - * */ - - BigDecimal advance = BigDecimal.ZERO; - for (TaxDetail taxDetail : taxDetails) { - - if(taxDetail.getAmountPaid()==null) - taxDetail.setAmountPaid(BigDecimal.ZERO); - - for(Bucket bucket : taxDetail.getBuckets()) { - - // FIX ME - // advance should be checked from purpose - if(bucket.getTaxHeadCode().contains("ADVANCE")){ - - BigDecimal net = bucket.getAmount().subtract(bucket.getAdjustedAmount()); - if(advance.add(net).abs().compareTo(totalPositiveAmount) > 0){ - // Advance heads whose amount is partially getting used - BigDecimal diff = totalPositiveAmount.subtract(advance.abs()); - BigDecimal adjustedAmount = bucket.getAdjustedAmount(); - bucket.setAdjustedAmount(adjustedAmount.add(diff.negate())); - advance = totalPositiveAmount.negate(); - taxDetail.setAmountPaid(taxDetail.getAmountPaid().add(diff.negate())); - break; - } - else { - // Advance heads whose amount is completely getting used - advance = advance.add(net); - bucket.setAdjustedAmount(bucket.getAmount()); - taxDetail.setAmountPaid(taxDetail.getAmountPaid().add(net)); - } - } - - } - - } - return advance.negate(); - } - - - private BigDecimal getTotalAmount(List taxDetails){ - - BigDecimal totalAmount = BigDecimal.ZERO; - - for(TaxDetail taxDetail : taxDetails){ - - totalAmount = totalAmount.add(taxDetail.getAmountToBePaid()); - - } - return totalAmount; - } - - /** - * In case of zero payment and total amount to be paid equal to zero - * we set adjusted amount equal to tax amount for all buckets - * @param taxDetails - */ - private void apportionZeroPaymentAndZeroAmountToBePaid(List taxDetails){ - - for(TaxDetail taxDetail : taxDetails){ - - List buckets = taxDetail.getBuckets(); - - buckets.forEach(bucket -> { - bucket.setAdjustedAmount(bucket.getAmount()); - }); - - } - - } - - - - - - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/service/apportions/OrderByPriorityApportion.java b/business-services/egov-apportion-service/src/main/java/org/egov/service/apportions/OrderByPriorityApportion.java deleted file mode 100644 index e4d50a878e7..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/service/apportions/OrderByPriorityApportion.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.egov.service.apportions; - - -import org.egov.config.ApportionConfig; -import org.egov.service.Apportion; -import org.egov.service.TaxHeadMasterService; -import org.egov.tracer.model.CustomException; -import org.egov.web.models.Bill; -import org.egov.web.models.enums.Purpose; -import org.egov.web.models.BillAccountDetail; -import org.egov.web.models.BillDetail; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.egov.util.ApportionConstants.*; - -@Service -public class OrderByPriorityApportion implements Apportion { - - - private TaxHeadMasterService taxHeadMasterService; - - private ApportionConfig config; - - - @Autowired - public OrderByPriorityApportion(TaxHeadMasterService taxHeadMasterService, ApportionConfig config) { - this.taxHeadMasterService = taxHeadMasterService; - this.config = config; - } - - - - @Override - public String getBusinessService() { - return DEFAULT; - } - - - /** - * 1. Sort the billDetails based on fromPeriod - * 2. For each billDetail sort the BillAccountDetails by order - * 3. Start apportioning by assigning positive adjustedAmount for negative amounts - * and negative adjustmentAmount for postive amounts - * 4. If any advance amount is remaining new BillAccountDetail is created for it - * and assigned to last BillDetail - * @return - */ - @Override - public List apportionPaidAmount(Bill bill, Object masterData) { - bill.getBillDetails().sort(Comparator.comparing(BillDetail::getFromPeriod)); - List billDetails = bill.getBillDetails(); - BigDecimal remainingAmount = bill.getAmountPaid(); - BigDecimal amount; - Boolean isAmountPositive; - - if(bill.getIsAdvanceAllowed()){ - BigDecimal requiredAdvanceAmount = apportionAndGetRequiredAdvance(bill); - remainingAmount = remainingAmount.add(requiredAdvanceAmount); - } - - if(!config.getApportionByValueAndOrder()) - validateOrder(billDetails); - - BigDecimal amountBeforeApportion = remainingAmount; - - for (BillDetail billDetail : billDetails){ - - if(remainingAmount.compareTo(BigDecimal.ZERO)==0){ - billDetail.setAmountPaid(BigDecimal.ZERO); - continue; - } - - if(!config.getApportionByValueAndOrder()) - billDetail.getBillAccountDetails().sort(Comparator.comparing(BillAccountDetail::getAmount)); - else - billDetail.getBillAccountDetails().sort(Comparator.comparing(BillAccountDetail::getAmount).thenComparing(BillAccountDetail::getOrder)); - - - for(BillAccountDetail billAccountDetail : billDetail.getBillAccountDetails()) { - - amount = billAccountDetail.getAmount(); - isAmountPositive = amount.compareTo(BigDecimal.ZERO) >= 0; - - if (isAmountPositive) { - - if (remainingAmount.equals(BigDecimal.ZERO)) { - billAccountDetail.setAdjustedAmount(BigDecimal.ZERO); - continue; - } - - if (remainingAmount.compareTo(amount) <= 0) { - billAccountDetail.setAdjustedAmount(remainingAmount); - remainingAmount = BigDecimal.ZERO; - } - - if (remainingAmount.compareTo(amount) > 0) { - billAccountDetail.setAdjustedAmount(amount); - remainingAmount = remainingAmount.subtract(amount); - } - } - else { - // FIX ME - // advance should be checked from purpose - if(!billAccountDetail.getTaxHeadCode().contains("ADVANCE")) { - billAccountDetail.setAdjustedAmount(amount); - remainingAmount = remainingAmount.subtract(amount); - } - } - } - - if(billDetail.getAmountPaid()==null) - billDetail.setAmountPaid(BigDecimal.ZERO); - - billDetail.setAmountPaid(billDetail.getAmountPaid().add(amountBeforeApportion.subtract(remainingAmount))); - amountBeforeApportion = remainingAmount; - } - - - //If advance amount is available - if(remainingAmount.compareTo(BigDecimal.ZERO)>0){ - addAdvanceBillAccountDetail(remainingAmount,bill,masterData); - } - - - return billDetails; - } - - - /** - * Validates if order is not null in each BillAccountDetail in the given list of billDetails - * and all positive taxHeadOrder come after negative taxHeadOrder - * @param billDetails List of billDetails to be validated - */ - private void validateOrder(List billDetails){ - Map errorMap = new HashMap<>(); - billDetails.forEach(billDetail -> { - - if(billDetail.getFromPeriod()==null || billDetail.getToPeriod()==null) - errorMap.put("INVALID PERIOD","The fromPeriod and toPeriod in BillDetail cannot be null"); - - List billAccountDetails = billDetail.getBillAccountDetails(); - - int maxOrderOfNegativeTaxHead = Integer.MIN_VALUE; - int minOrderOfPositiveTaxHead = Integer.MAX_VALUE; - - for(int i=0;i0 && - minOrderOfPositiveTaxHead > billAccountDetails.get(i).getOrder()){ - minOrderOfPositiveTaxHead = billAccountDetails.get(i).getOrder(); - } - else if(billAccountDetails.get(i).getAmount().compareTo(BigDecimal.ZERO)<0 && - maxOrderOfNegativeTaxHead < billAccountDetails.get(i).getOrder()){ - maxOrderOfNegativeTaxHead = billAccountDetails.get(i).getOrder(); - } - } - if(minOrderOfPositiveTaxHead < maxOrderOfNegativeTaxHead) - throw new CustomException("INVALID ORDER","Positive TaxHeads should be after Negative TaxHeads"); - }); - if(!errorMap.isEmpty()) - throw new CustomException(errorMap); - } - - - /** - * Creates a advance BillAccountDetail and adds it to the latest billDetail - * @param advanceAmount The advance amount paid - * @param bill The bill for which apportioning is done - * @param masterData The required masterData for the TaxHeads - */ - private void addAdvanceBillAccountDetail(BigDecimal advanceAmount,Bill bill,Object masterData){ - List billDetails = bill.getBillDetails(); - String taxHead = taxHeadMasterService.getAdvanceTaxHead(bill.getBusinessService(),masterData); - BillAccountDetail billAccountDetailForAdvance = new BillAccountDetail(); - billAccountDetailForAdvance.setAmount(advanceAmount.negate()); - billAccountDetailForAdvance.setPurpose(Purpose.ADVANCE_AMOUNT); - billAccountDetailForAdvance.setTaxHeadCode(taxHead); - billDetails.get(billDetails.size()-1).getBillAccountDetails().add(billAccountDetailForAdvance); - } - - - /** - * Apportions the advance taxhead and returns the advance amount. - * @param bill - * @return - */ - private BigDecimal apportionAndGetRequiredAdvance(Bill bill){ - - List billDetails = bill.getBillDetails(); - - BigDecimal totalPositiveAmount = BigDecimal.ZERO; - - for (BillDetail billDetail : billDetails) { - - if(billDetail.getAmount().compareTo(BigDecimal.ZERO) > 0 ) - totalPositiveAmount = totalPositiveAmount.add(billDetail.getAmount()); - - } - - /** - * If net amount to be paid is zero for all billDetails no advance payment from - * previous billing cycles is required for apportion - * - */ - - if(totalPositiveAmount.compareTo(BigDecimal.ZERO) == 0) - return BigDecimal.ZERO; - - - /* net = Bill Account Detail amount - Bill Account Detail adj amount - * In case when advance + net > total Positive: 200 + (100 - 20) > 230 - * Bill Account Detail amount 100 - Bill Account Detail adj amount 20 - current advance 200 - Total positive 230 - final adjusted amount = 20 + (230 - 200) = 50 - * */ - - BigDecimal advance = BigDecimal.ZERO; - for (BillDetail billDetail : billDetails) { - - if(billDetail.getAmountPaid()==null) - billDetail.setAmountPaid(BigDecimal.ZERO); - - for(BillAccountDetail billAccountDetail : billDetail.getBillAccountDetails()) { - - // FIX ME - // advance should be checked from purpose - if(billAccountDetail.getTaxHeadCode().contains("ADVANCE")){ - - BigDecimal net = billAccountDetail.getAmount().subtract(billAccountDetail.getAdjustedAmount()); - if(advance.add(net).abs().compareTo(totalPositiveAmount) > 0){ - BigDecimal diff = totalPositiveAmount.subtract(advance); - BigDecimal adjustedAmount = billAccountDetail.getAdjustedAmount(); - billAccountDetail.setAdjustedAmount(adjustedAmount.add(diff).negate()); - advance = totalPositiveAmount.negate(); - billDetail.setAmountPaid(billDetail.getAmountPaid().add(diff.negate())); - break; - } - else { - advance = advance.add(net); - billAccountDetail.setAdjustedAmount(billAccountDetail.getAmount()); - billDetail.setAmountPaid(billDetail.getAmountPaid().add(net)); - } - } - - } - - } - return advance.negate(); - } - - - - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/util/ApportionConstants.java b/business-services/egov-apportion-service/src/main/java/org/egov/util/ApportionConstants.java deleted file mode 100644 index 376d33ec07d..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/util/ApportionConstants.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.util; - -import org.springframework.stereotype.Component; - -@Component -public class ApportionConstants { - - public static final String DEFAULT = "DEFAULT"; - - public static final String MDMS_BILLING_SERVICE = "BillingService"; - - public static final String MDMS_TAXHEAD = "TaxHeadMaster"; - - public static final String MDMS_BUSINESSSERVICE = "BusinessService"; - - public static final String ADVANCE_TAXHEAD_JSONPATH_CODE = "$.MdmsRes.BillingService.TaxHeadMaster[?(@.category=='ADVANCE_COLLECTION' && @.service==\"{}\")].code"; - - public static final String ADVANCE_BUSINESSSERVICE_JSONPATH_CODE = "$.MdmsRes.BillingService.BusinessService[?(@.code==\"{}\")].isAdvanceAllowed"; - - public static final String TAXHEAD_JSONPATH_CODE = "$.MdmsRes.BillingService.TaxHeadMaster[?(@.service==\"{}\")]"; - - public static final String MDMS_ORDER_KEY = "order"; - - public static final String MDMS_TAXHEADCODE_KEY = "code"; - - - public ApportionConstants() { - } -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/util/ResponseInfoFactory.java b/business-services/egov-apportion-service/src/main/java/org/egov/util/ResponseInfoFactory.java deleted file mode 100644 index 43735b827bb..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/util/ResponseInfoFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.egov.util; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.stereotype.Component; - -@Component -public class ResponseInfoFactory { - - public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { - - final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; - final String ver = requestInfo != null ? requestInfo.getVer() : ""; - Long ts = null; - if(requestInfo!=null) - ts = requestInfo.getTs(); - final String resMsgId = "uief87324"; // FIXME : Hard-coded - final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; - final String responseStatus = success ? "successful" : "failed"; - - return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) - .status(responseStatus).build(); - } - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/controllers/ApportionController.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/controllers/ApportionController.java deleted file mode 100644 index 4126b1aeec4..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/controllers/ApportionController.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.egov.web.controllers; - - -import org.egov.service.ApportionService; -import org.egov.service.ApportionServiceV2; -import org.egov.util.ResponseInfoFactory; -import org.egov.web.models.ApportionRequest; -import org.egov.web.models.ApportionResponse; -import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.*; -import org.egov.web.models.AuditDetails; -import org.egov.web.models.Bill; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestMapping; - -import java.util.*; - -import javax.validation.Valid; - -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2019-02-25T15:07:36.183+05:30") - -@Controller -@RequestMapping("/v1") -public class ApportionController { - - private final ObjectMapper objectMapper; - - @Autowired - private ApportionService apportionService; - - @Autowired - private ResponseInfoFactory responseInfoFactory; - - @Autowired - public ApportionController(ObjectMapper objectMapper, ApportionService apportionService) { - this.objectMapper = objectMapper; - this.apportionService = apportionService; - } - - - /** - * Executes the apportioning process on the given bills - * @param apportionRequest The ApportionRequest containing the bill to be apportioned - * @return Apportioned Bills - */ - @RequestMapping(value="/_apportion", method = RequestMethod.POST) - public ResponseEntity apportionPost(@Valid @RequestBody ApportionRequest apportionRequest){ - List billInfos = apportionService.apportionBills(apportionRequest); - ApportionResponse response = ApportionResponse.builder() - .tenantId(apportionRequest.getTenantId()) - .bills(billInfos) - .responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(apportionRequest.getRequestInfo(), - true)).build(); - return new ResponseEntity<>(response,HttpStatus.OK); - } - - - - -} \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/controllers/ApportionControllerV2.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/controllers/ApportionControllerV2.java deleted file mode 100644 index 028c9ee3d79..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/controllers/ApportionControllerV2.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.egov.web.controllers; - - -import org.egov.service.ApportionServiceV2; -import org.egov.util.ResponseInfoFactory; -import org.egov.web.models.*; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.web.models.enums.DemandApportionRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestMapping; - -import java.util.*; - -import javax.validation.Valid; - -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2019-02-25T15:07:36.183+05:30") - -@Controller -@RequestMapping("/v2") -public class ApportionControllerV2 { - - private final ObjectMapper objectMapper; - - private ApportionServiceV2 apportionService; - - private ResponseInfoFactory responseInfoFactory; - - - @Autowired - public ApportionControllerV2(ObjectMapper objectMapper, ApportionServiceV2 apportionService, ResponseInfoFactory responseInfoFactory) { - this.objectMapper = objectMapper; - this.apportionService = apportionService; - this.responseInfoFactory = responseInfoFactory; - } - - - - - /** - * Executes the apportioning process on the given bills - * @param apportionRequest The ApportionRequest containing the bill to be apportioned - * @return Apportioned Bills - */ - @RequestMapping(value="/bill/_apportion", method = RequestMethod.POST) - public ResponseEntity apportionPost(@Valid @RequestBody ApportionRequest apportionRequest){ - List billInfos = apportionService.apportionBills(apportionRequest); - ApportionResponse response = ApportionResponse.builder() - .tenantId(apportionRequest.getTenantId()) - .bills(billInfos) - .responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(apportionRequest.getRequestInfo(), - true)).build(); - return new ResponseEntity<>(response,HttpStatus.OK); - } - - @RequestMapping(value="/demand/_apportion", method = RequestMethod.POST) - public ResponseEntity apportionPost(@Valid @RequestBody DemandApportionRequest apportionRequest){ - List demands = apportionService.apportionDemands(apportionRequest); - ApportionDemandResponse response = ApportionDemandResponse.builder() - .tenantId(apportionRequest.getTenantId()) - .demands(demands) - .responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(apportionRequest.getRequestInfo(), - true)).build(); - return new ResponseEntity<>(response,HttpStatus.OK); - } - - - - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/enums/CollectionType.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/enums/CollectionType.java deleted file mode 100644 index c185ff1ab44..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/enums/CollectionType.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.web.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@NoArgsConstructor -public enum CollectionType { - - COUNTER("COUNTER"), - FIELD("FIELD"), - ONLINE("ONLINE"); - - - private String value; - - CollectionType(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - public String getValue() { - return value; - } - - @JsonCreator - public static CollectionType fromValue(String text) { - for (CollectionType b : CollectionType.values()) { - if (0 ==b.value.toString().compareTo(text)) { - return b; - } - } - return null; - } - -} - diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionDemandResponse.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionDemandResponse.java deleted file mode 100644 index 76df9d22ca9..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionDemandResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.egov.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Builder; -import lombok.Data; -import org.egov.common.contract.response.ResponseInfo; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -@Data -@Builder -public class ApportionDemandResponse { - - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("demands") - @Valid - private List demands = null; - - - public ApportionDemandResponse addDemandsItem(Demand demand) { - if (this.demands == null) { - this.demands = new ArrayList<>(); - } - this.demands.add(demand); - return this; - } - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionRequest.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionRequest.java deleted file mode 100644 index d53f36810f7..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionRequest.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; -import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.Builder; - -/** - * Receipt Request with Request Info. - */ -@ApiModel(description = "Receipt Request with Request Info.") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2019-02-25T15:07:36.183+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class ApportionRequest { - @JsonProperty("RequestInfo") - private RequestInfo requestInfo = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("Bills") - @Valid - private List bills = null; - - - public ApportionRequest addBillsItem(Bill billsItem) { - if (this.bills == null) { - this.bills = new ArrayList<>(); - } - this.bills.add(billsItem); - return this; - } - -} - diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionRequestV2.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionRequestV2.java deleted file mode 100644 index 503210d6b62..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionRequestV2.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.egov.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Builder; -import lombok.Data; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Data -@Builder -public class ApportionRequestV2 { - - @JsonProperty("businessService") - private String businessService = null; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid = null; - - @JsonProperty("isAdvanceAllowed") - private Boolean isAdvanceAllowed = null; - - @JsonProperty("buckets") - private List taxDetails = null; - - - public void addTaxDetail(TaxDetail taxDetail){ - if(this.taxDetails==null){ - this.taxDetails = new ArrayList<>(); - this.taxDetails.add(taxDetail); - } - else this.getTaxDetails().add(taxDetail); - - } - - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionResponse.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionResponse.java deleted file mode 100644 index b2fb8ccf22b..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/ApportionResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.egov.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.Builder; - -/** - * Receipt Request with Request Info. - */ -@ApiModel(description = "Receipt Request with Request Info.") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2019-02-25T15:07:36.183+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class ApportionResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("Bills") - @Valid - private List bills = null; - - - public ApportionResponse addBillsItem(Bill billsItem) { - if (this.bills == null) { - this.bills = new ArrayList<>(); - } - this.bills.add(billsItem); - return this; - } - -} - diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/AuditDetails.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/AuditDetails.java deleted file mode 100644 index 46e7dcd0029..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/AuditDetails.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.web.models; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.Builder; - -/** - * Collection of audit related fields used by most models - */ -@ApiModel(description = "Collection of audit related fields used by most models") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2019-02-25T15:07:36.183+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class AuditDetails { - @JsonProperty("createdBy") - private String createdBy = null; - - @JsonProperty("lastModifiedBy") - private String lastModifiedBy = null; - - @JsonProperty("createdTime") - private Long createdTime = null; - - @JsonProperty("lastModifiedTime") - private Long lastModifiedTime = null; - - -} - diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Bill.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Bill.java deleted file mode 100644 index b3784163bb9..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Bill.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.egov.web.models; - - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.databind.JsonNode; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import org.springframework.util.CollectionUtils; - -@Getter -@Setter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class Bill { - // TODO some of the fields are mandatory in yml, lets discuss billdetail and billaccountdetail also for more clarity - - @JsonProperty("id") - private String id = null; - - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @JsonProperty("paidBy") - private String paidBy = null; - - @JsonProperty("payerName") - private String payerName = null; - - @JsonProperty("payerAddress") - private String payerAddress = null; - - @JsonProperty("payerEmail") - private String payerEmail = null; - - @JsonProperty("payerId") - private String payerId = null; - - @JsonProperty("status") - private StatusEnum status = null; - - @JsonProperty("reasonForCancellation") - private String reasonForCancellation = null; - - @JsonProperty("isCancelled") - private Boolean isCancelled = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("billDetails") - @Valid - private List billDetails = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - - @JsonProperty("collectionModesNotAllowed") - private List collectionModesNotAllowed = null; - - @JsonProperty("partPaymentAllowed") - private Boolean partPaymentAllowed = null; - - @NotNull - @JsonProperty("isAdvanceAllowed") - private Boolean isAdvanceAllowed; - - @JsonProperty("minimumAmountToBePaid") - private BigDecimal minimumAmountToBePaid = null; - - @JsonProperty("businessService") - private String businessService = null; - - @JsonProperty("totalAmount") - private BigDecimal totalAmount = null; - - @JsonProperty("consumerCode") - private String consumerCode = null; - - @JsonProperty("billNumber") - private String billNumber = null; - - @JsonProperty("billDate") - private Long billDate = null; - - @NotNull - @JsonProperty("amountPaid") - private BigDecimal amountPaid = null; - - - - public enum StatusEnum { - ACTIVE("ACTIVE"), - - CANCELLED("CANCELLED"), - - PAID("PAID"), - - EXPIRED("EXPIRED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - public static boolean contains(String test) { - for (StatusEnum val : StatusEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - - } - - public Boolean addBillDetail(BillDetail billDetail) { - - if (CollectionUtils.isEmpty(billDetails)) { - - billDetails = new ArrayList<>(); - return billDetails.add(billDetail); - } else { - - if (!billDetails.contains(billDetail)) - return billDetails.add(billDetail); - else - return false; - } - } - - -} \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/BillAccountDetail.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/BillAccountDetail.java deleted file mode 100644 index 7c63e65ef34..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/BillAccountDetail.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.egov.web.models; - - -import java.math.BigDecimal; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import org.egov.web.models.AuditDetails; -import org.egov.web.models.enums.Purpose; - -import javax.validation.constraints.Size; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class BillAccountDetail { - - @Size(max=64) - @JsonProperty("id") - private String id = null; - - @Size(max=64) - @JsonProperty("tenantId") - private String tenantId = null; - - @Size(max=64) - @JsonProperty("billDetailId") - private String billDetailId = null; - - @Size(max=64) - @JsonProperty("demandDetailId") - private String demandDetailId = null; - - @JsonProperty("order") - private Integer order = null; - - @JsonProperty("amount") - private BigDecimal amount = null; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount = null; - - @JsonProperty("isActualDemand") - private Boolean isActualDemand = null; - - @Size(max=64) - @JsonProperty("taxHeadCode") - private String taxHeadCode = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("purpose") - private Purpose purpose = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; -} \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/BillDetail.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/BillDetail.java deleted file mode 100644 index 9740c9d160e..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/BillDetail.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.egov.web.models; - - - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; -import org.egov.web.enums.CollectionType; -import org.egov.web.models.AuditDetails; -import org.egov.web.models.BillAccountDetail; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class BillDetail { - - @JsonProperty("id") - private String id = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("demandId") - private String demandId = null; - - @JsonProperty("billId") - private String billId = null; - - @JsonProperty("amount") - @NotNull - private BigDecimal amount = null; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid = null; - - @NotNull - @JsonProperty("fromPeriod") - private Long fromPeriod = null; - - @NotNull - @JsonProperty("toPeriod") - private Long toPeriod = null; - - @JsonProperty("collectedAmount") - private BigDecimal collectedAmount = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("receiptDate") - private Long receiptDate = null; - - @JsonProperty("receiptType") - private String receiptType = null; - - @JsonProperty("channel") - private String channel = null; - - @JsonProperty("voucherHeader") - private String voucherHeader = null; - - @JsonProperty("boundary") - private String boundary = null; - - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber = null; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate = null; - - - @JsonProperty("billAccountDetails") - private List billAccountDetails = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - - - private String billDescription; - - @NotNull - @JsonProperty("expiryDate") - private Long expiryDate; - - private String displayMessage; - - private Boolean callBackForApportioning; - - private String cancellationRemarks; - - public Boolean addBillAccountDetail(BillAccountDetail billAccountDetail) { - - if (CollectionUtils.isEmpty(billAccountDetails)) { - - billAccountDetails = new ArrayList<>(); - return billAccountDetails.add(billAccountDetail); - } else { - - if (!billAccountDetails.contains(billAccountDetail)) - return billAccountDetails.add(billAccountDetail); - else - return false; - } - } - -} \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Bucket.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Bucket.java deleted file mode 100644 index 11d40016f1e..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Bucket.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.egov.web.models; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.web.models.enums.Category; -import org.egov.web.models.enums.Purpose; - -import java.math.BigDecimal; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class Bucket { - - @JsonProperty("taxHeadCode") - private String taxHeadCode = null; - - @JsonProperty("category") - private Category category = null; - - @JsonProperty("amount") - private BigDecimal amount = null; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount = null; - - @JsonProperty("priority") - private Integer priority = null; - - @JsonProperty("purpose") - private Purpose purpose = null; - - @JsonProperty("entityId") - private String entityId = null; - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Demand.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Demand.java deleted file mode 100644 index 7635cf9c96a..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Demand.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.egov.web.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.User; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -/** - * A Object which holds the basic info about the revenue assessment for which the demand is generated like module name, consumercode, owner, etc. - */ - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Demand { - - @JsonProperty("id") - private String id; - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @NotNull - @JsonProperty("consumerCode") - private String consumerCode; - - @NotNull - @JsonProperty("consumerType") - private String consumerType; - - @NotNull - @JsonProperty("businessService") - private String businessService; - - @Valid - @JsonProperty("payer") - private User payer; - - @NotNull - @JsonProperty("taxPeriodFrom") - private Long taxPeriodFrom; - - @NotNull - @JsonProperty("taxPeriodTo") - private Long taxPeriodTo; - - @Default - @JsonProperty("demandDetails") - @Valid - @NotNull - @Size(min=1) - private List demandDetails = new ArrayList<>(); - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("billExpiryTime") - private Long billExpiryTime; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - @Default - @JsonProperty("minimumAmountPayable") - private BigDecimal minimumAmountPayable = BigDecimal.ZERO; - - /** - * Gets or Sets status - */ - public enum StatusEnum { - - ACTIVE("ACTIVE"), - - CANCELLED("CANCELLED"), - - ADJUSTED("ADJUSTED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } - } - - @JsonProperty("status") - private StatusEnum status; - - - public Demand addDemandDetailsItem(DemandDetail demandDetailsItem) { - this.demandDetails.add(demandDetailsItem); - return this; - } - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/DemandDetail.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/DemandDetail.java deleted file mode 100644 index 95469ac2ba5..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/DemandDetail.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; - -/** - * A object holds a demand and collection values for a tax head and period. - */ - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class DemandDetail { - - @NotNull - @JsonProperty("id") - private String id; - - @JsonProperty("demandId") - private String demandId; - - @NotNull @JsonProperty("taxHeadMasterCode") - private String taxHeadMasterCode; - - @NotNull @JsonProperty("taxAmount") - private BigDecimal taxAmount; - - @NotNull @JsonProperty("collectionAmount") @Default - private BigDecimal collectionAmount = BigDecimal.ZERO; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("tenantId") - private String tenantId; -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Role.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Role.java deleted file mode 100644 index 879d3c6a5ae..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/Role.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.egov.web.models; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.Builder; - -/** - * minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes - */ -@ApiModel(description = "minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes ") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2019-02-25T15:07:36.183+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Role { - @JsonProperty("name") - private String name = null; - - @JsonProperty("description") - private String description = null; - - -} - diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/TaxAndPayment.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/TaxAndPayment.java deleted file mode 100644 index 59298da3c88..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/TaxAndPayment.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.egov.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Data; - -import java.math.BigDecimal; - -@Data -public class TaxAndPayment { - - @JsonProperty("businessService") - private String businessService = null; - - @JsonProperty("taxAmount") - private BigDecimal taxAmount = null; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid = null; - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/TaxDetail.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/TaxDetail.java deleted file mode 100644 index 50afc3bef71..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/TaxDetail.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.egov.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Builder; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Data -@Builder -public class TaxDetail { - - - @NotNull - @JsonProperty("entityId") - private String entityId = null; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid = null; - - @JsonProperty("amountToBePaid") - private BigDecimal amountToBePaid = null; - - @JsonProperty("fromPeriod") - private Long fromPeriod = null; - - @JsonProperty("buckets") - private List buckets = null; - - public void addBucket(Bucket bucket){ - if(this.buckets==null){ - this.buckets = new ArrayList<>(); - this.buckets.add(bucket); - } - else this.getBuckets().add(bucket); - - } - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/TaxHeadMaster.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/TaxHeadMaster.java deleted file mode 100644 index 26e6dc81799..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/TaxHeadMaster.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.web.models; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.web.models.enums.Category; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class TaxHeadMaster { - - private String id; - - @NotNull - private String tenantId; - @Valid - @NotNull - private Category category; - @NotNull - private String service; - @NotNull - private String name; - - private String code; - - private Boolean isDebit = false; - - private Boolean isActualDemand; - @NotNull - private Long validFrom; - @NotNull - private Long validTill; - - private Integer order; - - private AuditDetails auditDetail; - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/Category.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/Category.java deleted file mode 100644 index 5fcc891f429..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/Category.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.web.models.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Category of demand like tax, fee, rebate, penalty etc. - */ -public enum Category { - - TAX("TAX"), - - FEE("FEE"), - - REBATE("REBATE"), - - EXEMPTION("EXEMPTION"), - - ADVANCE_COLLECTION("ADVANCE_COLLECTION"), - - PENALTY("PENALTY"), - - FINES("FINES"), - - CHARGES("CHARGES"); - - private String value; - - Category(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Category fromValue(String text) { - for (Category b : Category.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/DemandApportionRequest.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/DemandApportionRequest.java deleted file mode 100644 index a4844bda5fb..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/DemandApportionRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.egov.web.models.enums; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.RequestInfo; -import org.egov.web.models.Demand; - -import javax.validation.Valid; -import java.util.List; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class DemandApportionRequest { - - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo = null; - - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("Demands") - @Valid - private List demands = null; - - - - - -} diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/Purpose.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/Purpose.java deleted file mode 100644 index 2fe7c8f5571..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/Purpose.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.web.models.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum Purpose { - - ARREAR_AMOUNT("ARREAR"), - - CURRENT_AMOUNT("CURRENT"), - - ADVANCE_AMOUNT("ADVANCE"), - - EXEMPTION("EXEMPTION"), - - ARREAR_LATEPAYMENT_CHARGES("ARREAR_LATEPAYMENT_CHARGES"), - - CURRENT_LATEPAYMENT_CHARGES("CURRENT_LATEPAYMENT_CHARGES"), - - CHEQUE_BOUNCE_PENALTY("CHEQUE_BOUNCE_PENALTY"), - - REBATE("REBATE"), - - OTHERS("OTHERS"); - - private String value; - - Purpose(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Purpose fromValue(String text) { - for (Purpose b : Purpose.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } -} \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/ReceiptType.java b/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/ReceiptType.java deleted file mode 100644 index a2196356313..00000000000 --- a/business-services/egov-apportion-service/src/main/java/org/egov/web/models/enums/ReceiptType.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.egov.web.models.enums; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonValue; - - public enum ReceiptType { - ADHOC("Adhoc"), - BILLBASED("BillBased"), - CHALLAN("Challan"); - - - private String name; - - ReceiptType(final String name) { - this.name = name; - } - - @Override - @JsonValue - public String toString() { - return StringUtils.capitalize(name()); - } - - public String getName() { - return name; - } - - } - diff --git a/business-services/egov-apportion-service/src/main/resources/application.properties b/business-services/egov-apportion-service/src/main/resources/application.properties deleted file mode 100644 index 8c7993f45b5..00000000000 --- a/business-services/egov-apportion-service/src/main/resources/application.properties +++ /dev/null @@ -1,57 +0,0 @@ -server.contextPath=/apportion-service -server.servlet.context-path=/apportion-service -server.port=8280 -app.timezone=UTC - -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/test -spring.datasource.username=postgres -spring.datasource.password=postgres - -##----------------------------- FLYWAY CONFIGURATIONS ------------------------------# - -spring.flyway.url=jdbc:postgresql://localhost:5432/test -spring.flyway.user=postgres -spring.flyway.password=postgres -#spring.flyway.table=public -spring.flyway.baseline-on-migrate=true -spring.flyway.outOfOrder=true -spring.flyway.locations=classpath:/db/migration/main -spring.flyway.enabled=true - -# KAFKA SERVER CONFIGURATIONS -kafka.config.bootstrap_server_config=localhost:9092 -spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=egov-tl-services -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer -spring.kafka.consumer.properties.spring.json.use.type.headers=false - -# KAFKA CONSUMER CONFIGURATIONS -kafka.consumer.config.auto_commit=true -kafka.consumer.config.auto_commit_interval=100 -kafka.consumer.config.session_timeout=15000 -kafka.consumer.config.auto_offset_reset=earliest -# KAFKA PRODUCER CONFIGURATIONS -kafka.producer.config.retries_config=0 -kafka.producer.config.batch_size_config=16384 -kafka.producer.config.linger_ms_config=1 -kafka.producer.config.buffer_memory_config=33554432 -#org.egov.detailed.tracing.enabled = false - -#Persister Config -persister.save.bill.apportion.request.topic=save-apportion-bill-request -persister.save.bill.apportion.response.topic=save-apportion-bill-response -persister.save.demand.apportion.request.topic=save-apportion-demand-request -persister.save.demand.apportion.response.topic=save-apportion-demand-response - -#MDMS Config -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search - -#Default apportion switch -egov.apportion.default.value.order=true - -management.endpoints.web.base-path=/ -spring.main.allow-bean-definition-overriding=false \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/resources/apportion-persister.yml b/business-services/egov-apportion-service/src/main/resources/apportion-persister.yml deleted file mode 100644 index 9416d1567bf..00000000000 --- a/business-services/egov-apportion-service/src/main/resources/apportion-persister.yml +++ /dev/null @@ -1,220 +0,0 @@ -serviceMaps: - serviceName: apportion-services - mappings: - - version: 1.0 - description: Persists apportioning request - fromTopic: save-apportion-request - isTransaction: true - queryMaps: - - - query: INSERT INTO eg_appr_bills_request(billId,tenantid,mobileNumber,payerName,payerAddress,payerEmail,paidBy,taxAndPayments,isActive,isCancelled,billDetails,createdBy,createdTime) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) - basePath: Bills.* - jsonMaps: - - jsonPath: $.Bills.*.id - - - jsonPath: $.Bills.*.tenantId - - - jsonPath: $.Bills.*.mobileNumber - - - jsonPath: $.Bills.*.payerName - - - jsonPath: $.Bills.*.payerAddress - - - jsonPath: $.Bills.*.payerEmail - - - jsonPath: $.Bills.*.paidBy - - - jsonPath: $.Bills.*.taxAndPayments - type: JSON - dbType: JSONB - - - jsonPath: $.Bills.*.isActive - - - jsonPath: $.Bills.*.isCancelled - - - jsonPath: $.Bills.*.billDetails - type: JSON - dbType: JSONB - - - jsonPath: $.Bills.*.auditDetails.createdBy - - - jsonPath: $.Bills.*.auditDetails.createdTime - - - - version: 1.0 - description: Persists apportioning response - fromTopic: save-apportion-response - isTransaction: true - queryMaps: - - - query: INSERT INTO eg_appr_bills_response(billId,tenantid,mobileNumber,payerName,payerAddress,payerEmail,paidBy,taxAndPayments,isActive,isCancelled,billDetails,createdBy,createdTime) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) - basePath: Bills.* - jsonMaps: - - jsonPath: $.Bills.*.id - - - jsonPath: $.Bills.*.tenantId - - - jsonPath: $.Bills.*.mobileNumber - - - jsonPath: $.Bills.*.payerName - - - jsonPath: $.Bills.*.payerAddress - - - jsonPath: $.Bills.*.payerEmail - - - jsonPath: $.Bills.*.paidBy - - - jsonPath: $.Bills.*.taxAndPayments - type: JSON - dbType: JSONB - - - jsonPath: $.Bills.*.isActive - - - jsonPath: $.Bills.*.isCancelled - - - jsonPath: $.Bills.*.billDetails - type: JSON - dbType: JSONB - - - jsonPath: $.Bills.*.auditDetails.createdBy - - - jsonPath: $.Bills.*.auditDetails.createdTime - - - version: 1.0 - description: Persists apportioning request - fromTopic: save-apportion-bill-request - isTransaction: true - queryMaps: - - - query: INSERT INTO eg_appr_bills_request(billId,tenantid,mobileNumber,payerName,payerAddress,payerEmail,paidBy,taxAndPayments,isActive,isCancelled,billDetails,createdBy,createdTime) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) - basePath: Bills.* - jsonMaps: - - jsonPath: $.Bills.*.id - - - jsonPath: $.Bills.*.tenantId - - - jsonPath: $.Bills.*.mobileNumber - - - jsonPath: $.Bills.*.payerName - - - jsonPath: $.Bills.*.payerAddress - - - jsonPath: $.Bills.*.payerEmail - - - jsonPath: $.Bills.*.paidBy - - - jsonPath: $.Bills.*.taxAndPayments - type: JSON - dbType: JSONB - - - jsonPath: $.Bills.*.isActive - - - jsonPath: $.Bills.*.isCancelled - - - jsonPath: $.Bills.*.billDetails - type: JSON - dbType: JSONB - - - jsonPath: $.Bills.*.auditDetails.createdBy - - - jsonPath: $.Bills.*.auditDetails.createdTime - - - - version: 1.0 - description: Persists apportioning response - fromTopic: save-apportion-bill-response - isTransaction: true - queryMaps: - - - query: INSERT INTO eg_appr_bills_response(billId,tenantid,mobileNumber,payerName,payerAddress,payerEmail,paidBy,taxAndPayments,isActive,isCancelled,billDetails,createdBy,createdTime) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) - basePath: Bills.* - jsonMaps: - - jsonPath: $.Bills.*.id - - - jsonPath: $.Bills.*.tenantId - - - jsonPath: $.Bills.*.mobileNumber - - - jsonPath: $.Bills.*.payerName - - - jsonPath: $.Bills.*.payerAddress - - - jsonPath: $.Bills.*.payerEmail - - - jsonPath: $.Bills.*.paidBy - - - jsonPath: $.Bills.*.taxAndPayments - type: JSON - dbType: JSONB - - - jsonPath: $.Bills.*.isActive - - - jsonPath: $.Bills.*.isCancelled - - - jsonPath: $.Bills.*.billDetails - type: JSON - dbType: JSONB - - - jsonPath: $.Bills.*.auditDetails.createdBy - - - jsonPath: $.Bills.*.auditDetails.createdTime - - - - version: 1.0 - description: Persists apportioning request - fromTopic: save-apportion-demand-request - isTransaction: true - queryMaps: - - - query: INSERT INTO eg_appr_demand_request(demandId,tenantid,consumerCode,demandDetails,taxPeriodFrom,taxPeriodTo,status,createdBy,createdTime) VALUES (?,?,?,?,?,?,?,?,?) - basePath: Demands.* - jsonMaps: - - jsonPath: $.Demands.*.id - - - jsonPath: $.Demands.*.tenantId - - - jsonPath: $.Demands.*.consumerCode - - - jsonPath: $.Demands.*.demandDetails - type: JSON - dbType: JSONB - - - jsonPath: $.Demands.*.taxPeriodFrom - - - jsonPath: $.Demands.*.taxPeriodTo - - - jsonPath: $.Demands.*.status - - - jsonPath: $.Demands.*.auditDetails.createdBy - - - jsonPath: $.Demands.*.auditDetails.createdTime - - - - version: 1.0 - description: Persists apportioning response - fromTopic: save-apportion-demand-response - isTransaction: true - queryMaps: - - - query: INSERT INTO eg_appr_demand_response(demandId,tenantid,consumerCode,demandDetails,taxPeriodFrom,taxPeriodTo,status,createdBy,createdTime) VALUES (?,?,?,?,?,?,?,?,?) - basePath: Demands.* - jsonMaps: - - jsonPath: $.Demands.*.id - - - jsonPath: $.Demands.*.tenantId - - - jsonPath: $.Demands.*.consumerCode - - - jsonPath: $.Demands.*.demandDetails - type: JSON - dbType: JSONB - - - jsonPath: $.Demands.*.taxPeriodFrom - - - jsonPath: $.Demands.*.taxPeriodTo - - - jsonPath: $.Demands.*.status - - - jsonPath: $.Demands.*.auditDetails.createdBy - - - jsonPath: $.Demands.*.auditDetails.createdTime diff --git a/business-services/egov-apportion-service/src/main/resources/db/Dockerfile b/business-services/egov-apportion-service/src/main/resources/db/Dockerfile deleted file mode 100644 index a5699ff7d99..00000000000 --- a/business-services/egov-apportion-service/src/main/resources/db/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM egovio/flyway:4.1.2 - -COPY ./migration/main /flyway/sql - -COPY migrate.sh /usr/bin/migrate.sh - -RUN chmod +x /usr/bin/migrate.sh - -CMD ["/usr/bin/migrate.sh"] diff --git a/business-services/egov-apportion-service/src/main/resources/db/migrate.sh b/business-services/egov-apportion-service/src/main/resources/db/migrate.sh deleted file mode 100644 index 43960b25cdb..00000000000 --- a/business-services/egov-apportion-service/src/main/resources/db/migrate.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/resources/db/migration/main/V20190226180533__eg_appr_create_ddl.sql b/business-services/egov-apportion-service/src/main/resources/db/migration/main/V20190226180533__eg_appr_create_ddl.sql deleted file mode 100644 index 22d0fd259c1..00000000000 --- a/business-services/egov-apportion-service/src/main/resources/db/migration/main/V20190226180533__eg_appr_create_ddl.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE eg_appr_bills_request( - billDetails JSONB, - tenantId character varying(64), - payerName character varying(256), - payerAddress character varying(1024), - payerEmail character varying(254), - paidBy character varying(1024), - collectionMap JSONB, - billId character varying(64), - isActive boolean, - isCancelled boolean, - mobileNumber character varying(64), - createdBy character varying(64), - createdTime bigint - ); - - CREATE TABLE eg_appr_bills_response( - billDetails JSONB, - tenantId character varying(64), - payerName character varying(256), - payerAddress character varying(1024), - payerEmail character varying(254), - paidBy character varying(1024), - collectionMap JSONB, - billId character varying(64), - isActive boolean, - isCancelled boolean, - mobileNumber character varying(64), - createdBy character varying(64), - createdTime bigint - ); \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/resources/db/migration/main/V20190311135135__eg_alter_column_ddl.sql b/business-services/egov-apportion-service/src/main/resources/db/migration/main/V20190311135135__eg_alter_column_ddl.sql deleted file mode 100644 index e238e5a17ad..00000000000 --- a/business-services/egov-apportion-service/src/main/resources/db/migration/main/V20190311135135__eg_alter_column_ddl.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE eg_appr_bills_request -RENAME COLUMN collectionMap TO taxAndPayments; - -ALTER TABLE eg_appr_bills_response -RENAME COLUMN collectionMap TO taxAndPayments; \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/main/resources/db/migration/main/V20200803122838__eg_appr_demand_ddl.sql b/business-services/egov-apportion-service/src/main/resources/db/migration/main/V20200803122838__eg_appr_demand_ddl.sql deleted file mode 100644 index 4b8edd62d63..00000000000 --- a/business-services/egov-apportion-service/src/main/resources/db/migration/main/V20200803122838__eg_appr_demand_ddl.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE eg_appr_demand_request( -demandId character varying(128), -tenantId character varying(128), -consumerCode character varying(128), -taxperiodfrom bigint, -taxperiodto bigint, -"status" character varying(128), -demandDetails JSONB, -createdBy character varying(64), -createdTime bigint -); - -CREATE TABLE eg_appr_demand_response( -demandId character varying(128), -tenantId character varying(128), -consumerCode character varying(128), -taxperiodfrom bigint, -taxperiodto bigint, -"status" character varying(128), -demandDetails JSONB, -createdBy character varying(64), -createdTime bigint -); \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/test/java/org/egov/TestConfiguration.java b/business-services/egov-apportion-service/src/test/java/org/egov/TestConfiguration.java deleted file mode 100644 index d13056a19e6..00000000000 --- a/business-services/egov-apportion-service/src/test/java/org/egov/TestConfiguration.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.kafka.core.KafkaTemplate; - -import static org.mockito.Mockito.mock; - -@Configuration -public class TestConfiguration { - @Bean - @SuppressWarnings("unchecked") - public KafkaTemplate kafkaTemplate() { - return mock(KafkaTemplate.class); - } -} \ No newline at end of file diff --git a/business-services/egov-apportion-service/src/test/java/org/egov/web/controllers/ApportionControllerTest.java b/business-services/egov-apportion-service/src/test/java/org/egov/web/controllers/ApportionControllerTest.java deleted file mode 100644 index 727a04eedb7..00000000000 --- a/business-services/egov-apportion-service/src/test/java/org/egov/web/controllers/ApportionControllerTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.egov.web.controllers; - -import org.junit.Test; -import org.junit.Ignore; -import org.junit.runner.RunWith; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.egov.TestConfiguration; - -import static org.mockito.Matchers.any; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -/** -* API tests for ApportionController -*/ -@Ignore -@RunWith(SpringRunner.class) -@WebMvcTest(ApportionController.class) -@Import(TestConfiguration.class) -public class ApportionControllerTest { - - @Autowired - private MockMvc mockMvc; - - @Test - public void apportionPostSuccess() throws Exception { - mockMvc.perform(post("/apportion/_apportion").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isOk()); - } - - @Test - public void apportionPostFailure() throws Exception { - mockMvc.perform(post("/apportion/_apportion").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - -} diff --git a/business-services/egov-hrms/CHANGELOG.md b/business-services/egov-hrms/CHANGELOG.md deleted file mode 100644 index 60d034a79e9..00000000000 --- a/business-services/egov-hrms/CHANGELOG.md +++ /dev/null @@ -1,39 +0,0 @@ -# Changelog -All notable changes to this module will be documented in this file. - -## 1.2.7 - 2023-08-11 -- Central Instance Library Integration - -## 1.2.6 - 2023-03-31 -- Fixed bug where employee search causes server error in single instance clusters. - -## 1.2.5 - 2022-03-02 -- Added security fix for restricting employee search from citizen role - -## 1.2.4 - 2022-01-13 -- Updated to log4j2 version 2.17.1 - -## 1.2.3 - 2021-07-26 - - Fixed RAIN-3056: Able to re-activate employee by selecting the previous date - -## 1.2.2 - 2021-05-11 - - VUL-WEB-L008 - - Added @SafeHtml annotaion on string fields - - Updated POM to add safeHtml validator libraries - -## 1.2.1 - 2021-02-26 -- Updated domain name in application.properties - -## 1.2.0 - 2021-01-12 -- Added employee reactivation feature - -## 1.1.0 - 2020-05-27 - -- Upgraded to `tracer:2.0.0-SNAPSHOT` -- Upgraded to `Spring boot 2.2.6` -- Renamed `ReferenceType` enum to `EmployeeDocumentReferenceType` -- Added typescript interface generation plugin - -## 1.0.0 - -- Base version diff --git a/business-services/egov-hrms/LOCALSETUP.md b/business-services/egov-hrms/LOCALSETUP.md deleted file mode 100644 index 275a5420e3c..00000000000 --- a/business-services/egov-hrms/LOCALSETUP.md +++ /dev/null @@ -1,46 +0,0 @@ -# Local Setup - -To setup the egov-hrms service in your local system, clone the [Core Service repository](https://github.com/egovernments/core-services). - -## Dependencies - -### Infra Dependency - -- [x] Postgres DB -- [ ] Redis -- [ ] Elasticsearch -- [x] Kafka - - [ ] Consumer - - [x] Producer - -## Running Locally - -To run the egov-hrms services in local system, you need to port forward below services. - -```bash -function kgpt(){kubectl get pods -n egov --selector=app=$1 --no-headers=true | head -n1 | awk '{print $1}'} -kubectl port-forward -n egov $(kgpt egov-idgen) 8087:8080 & -kubectl port-forward -n egov $(kgpt egov-mdms-service) 8088:8080 & -kubectl port-forward -n egov $(kgpt egov-user) 8089:8080 & -kubectl port-forward -n egov $(kgpt egov-filestore) 8090:8080 & -kubectl port-forward -n egov $(kgpt egov-localization) 8091:8080 & -``` - -Update below listed properties in `application.properties` before running the project: - -```ini -# {Id Gen service hostname} -egov.idgen.host = http://127.0.0.1:8087 - -# {mdms hostname} -egov.mdms.host=http://127.0.0.1:8088 - -# {user service hostname} -egov.user.host = http://127.0.0.1:8089 - -# {Filestore service hostname} -egov.filestore.host = http://127.0.0.1:8090 - -# {Localization service hostname} -egov.localization.host = http://127.0.0.1:8091 -``` diff --git a/business-services/egov-hrms/README.md b/business-services/egov-hrms/README.md deleted file mode 100644 index ceb2f235664..00000000000 --- a/business-services/egov-hrms/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# Egov-HRMS Service -### HRMS Service -The objective of HRMS is to provide a service that manages all the employees enrolled onto the system. HRMS provides extensive APIs to create, update and search the employees with attributes like assignments, service history, jurisdiction etc. HRMS can be treated a sub-set of the egov-user service, Every employee created through HRMS will also be created as a user in egov-user. - -### DB UML Diagram - -- NA - -### Service Dependencies -- egov-user -- egov-localization -- egov-idgen -- egov-mdms -- egov-filestore - -### Swagger API Contract -- Please refer to the [Swagger API contarct](https://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/business-services/master/Docs/hrms-v1.0.0.yaml#!/) for HRMS service to understand the structure of APIs and to have visualization of all internal APIs. - - -## Service Details -**Details of all the entities involved:** - -**a) Assignments:** Every employee is assigned a list of assignments, every assignment is a designation provided to that employee for a given period of time. These designations are mapped to departments. This also includes marking the employee as HOD for that dept if needed. Employee can also provide information on who does he report to. - - - **Constraints:** - 1. For a given period of time an employee shouldn't have more than one assignments. - 2. The department and designation part of the employee must be configured in the system. - 3. Details of assignment once entered in the system cannot be deleted. - 4. An employee cannot have more than one active assignment. - -**b) Jurisdictions:** A jurisdiction is a area of power for any employee. It can be a zone, ward, block, city, state or the country. Currently a jurisdiction is defined as combination of Hierarchy type, Boundary Type and the actual Boundary. However, in the current system we are not validating these jurisdictions. This is being collected only for the sake of data. - - - **Constraints:** - 1. The details pertaining to a jurisdiction like Hierarchy, Boundary Type and Boundary must be configured in the system. - 2. An employee can have more than one jurisdictions. - 3. Currently in the system jurisdiction is limited to within a ULB. - -**c) Service History:** Service history is the record of an employee's professional experience. It captures information about location and period of work with necessary order number. Information about the current work details are to be entered here. - - - **Constraints:** - 1. There's no rule on period, dates of different services can overlap. - 2. There's no cap on the number of entries in the service history. - 3. Captured as legacy data. - -**d) Educational Details:** Captures educational details of the employee. Captures information like Degree, Year of Passing, University, Specialization etc as part of the educational details. - - - **Constraints:** - 1. Details pertaining to educational details like Degree, Specialization must be configured. - - -**e) Departmental Tests:** Captures details of the tests undertaken by the employee. Like name of the test and year of passing. - - - **Constraints:** - 1. Test details must be configures in the system. - -**f) Deactivation Details:** Details of deactivation of the employee, which captures reason for deactivation, period of deactivation and other necessary details. - - - **Constraints:** - 1. Deactivation details are compulsory while deactivating an employee. - -**f) Reactivation Details:** Details of reactivation of the employee, which captures reason for reactivation, the effective date from when reactivation take place and other necessary details. - - - **Constraints:** - 1. Reactivation details are compulsory while reactivating an employee. - - - -**Uniqueness Constraints:** -- Employee code has to be unique and will be used as username for login. -- Phone number has to be unique, which means no 2 employees can have the same phone number. - - - -**Notification:** -- Notification is sent to the phone number of the employee who has been created in the system. This is an SMS notification. - -### Configurable properties - -| Environment Variables | Description | Value | -| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------| -| `egov.hrms.employee.app.link` | This is the link to the mseva app, which differs based on the environment. | https://mseva.lgpunjab.gov.in/employee/user/login | -| `egov.hrms.default.pagination.limit` | This is the pagination limit on search results of employee search, it can be set to any numeric value without decimals. | 200 | -| `egov.hrms.default.pwd.length` | This is the length of password to be generated at the time of employee creation. However, please ensure this is in sync with the egov-user pwd policy. | 10 | -| `open.search.enabled.roles` | This is a list of Role codes that are allowed to perform an open-search in hrms. | SUPERUSER,ADMIN | -| `egov.idgen.ack.name` | Key to be configured in Idgen alongwith the ID format to generate employee code. | hrms.employeecode | -| `egov.idgen.ack.format` | Format to be configured in ID gen to generate employee code. | EMP-[city]-[SEQ_EG_HRMS_EMP_CODE] | -### API Details - -`BasePath` /egov-hrms/employees/[API endpoint] - -##### Method -**a) Create Employee `POST /_create` :** API (Bulk API) to create an employee with the following details: Assignments, Jurisdictions, Service History, Educational Details, Departmental Tests - -**b) Update Employee `POST /_update` :** API (Bulk API) to update the details of an employee with the following details: Assignments, Jurisdictions, Service History, Educational Details, Departmental Tests. There are constraints under which the update works, which are listed in the details of entities. As part of the personal details of the employee, Code of the employee cannot be updated once created. - -Deactivation is a part of the update API where the employee is marked inactive. This marks the user entry of this employee also as inactive. While deactivating an employee it is mandatory to provide deactivation details as well. - -**c) Search Employee `POST /_search` :** API to search the employee in the system on the following criteria: Id, UUID, Name, Code, Status, Type, Department, Designation, Position. All of them being arrays, at a time more than one employees can be fetched. -Constraints: a. Open Search is enabled only for a set of users. Currently it is enabled only for SUPERUSER, if it has to be enabled for other roles, add those roles to the parameter 'open.search.enabled.roles' in app.properties with values(role codes) separated by comma. - -**d) Count of Employee `POST /_count` :** This API is use to get list of active and inactive employee present in the system. - -### Kafka Consumers - -- NA - -### Kafka Producers - -- Following are the Producer topic. - - **save-hrms-employee** :- This topic is used to create new employee in the system. - - **update-hrms-employee** :- This topic is used to update the existing employee in the systen. - - **egov.core.notification.sms** :- This topic is used to send noification to the phone number of the employee who has been created in the system. \ No newline at end of file diff --git a/business-services/egov-hrms/pom.xml b/business-services/egov-hrms/pom.xml deleted file mode 100644 index b945470a62d..00000000000 --- a/business-services/egov-hrms/pom.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - org.egov - egov-hrms - 1.2.7-SNAPSHOT - egov-hrms - HR Management System - - 2.17.1 - UTF-8 - 1.8 - 2.9.6 - UTF-8 - 3.3.9 - 1.18.8 - 2.6 - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.flywaydb - flyway-core - - - org.postgresql - postgresql - - - org.egov.services - services-common - 1.1.1-SNAPSHOT - - - commons-lang - commons-lang - ${commons-lang-version} - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - org.springframework - spring-test - test - - - org.springframework.boot - spring-boot-starter-test - test - - - com.google.code.gson - gson - 2.8.0 - - - org.egov - mdms-client - 0.0.4-SNAPSHOT - - - org.egov.services - tracer - 2.1.2-SNAPSHOT - - - org.hibernate - hibernate-validator - 6.0.16.Final - - - org.jsoup - jsoup - 1.10.2 - - - - - repo.digit.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.hrms.web.contract.EmployeeRequest - org.egov.hrms.web.contract.EmployeeResponse - org.egov.hrms.web.contract.EmployeeSearchCriteria - - - - - org.egov.hrms.web.contract.User:User - org.egov.hrms.model.AuditDetails:AuditDetails - org.egov.common.contract.request.User:User - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - true - module - - - - - diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java deleted file mode 100644 index f9c4df5d061..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/EgovEmployeeApplication.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms; - -import java.util.TimeZone; - -import javax.annotation.PostConstruct; - -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.config.TracerConfiguration; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Import; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -@SpringBootApplication -@ComponentScan(basePackages = { "org.egov.hrms", "org.egov.hrms.web.controllers" , "org.egov.hrms.config"}) -@Import({TracerConfiguration.class, MultiStateInstanceUtil.class}) -public class EgovEmployeeApplication { - - @Value("${app.timezone}") - private String timeZone; - - @PostConstruct - public void initialize() { - TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); - } - - @Bean - public ObjectMapper getObjectMapper() { - final ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - objectMapper.setTimeZone(TimeZone.getTimeZone(timeZone)); - return objectMapper; - } - - public static void main(String[] args) { - SpringApplication.run(EgovEmployeeApplication.class, args); - } -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java deleted file mode 100644 index ff486ebf359..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/config/PropertiesManager.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.empernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@empernments.org. - */ - -package org.egov.hrms.config; - -import lombok.*; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -@Component -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class PropertiesManager { - - //Hosts and Endpoints - @Value("${egov.mdms.host}") - public String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - public String mdmsSearchEndpoint; - - @Value("${egov.user.host}") - public String userHost; - - @Value("${egov.user.search.endpoint}") - public String userSearchEndpoint; - - @Value("${egov.user.create.endpoint}") - public String userCreateEndpoint; - - @Value("${egov.user.update.endpoint}") - public String userUpdateEndpoint; - - @Value("${egov.localization.host}") - public String localizationHost; - - @Value("${egov.localization.search.endpoint}") - public String localizationSearchEndpoint; - - @Value("${egov.idgen.host}") - public String idGenHost; - - @Value("${egov.idgen.path}") - public String idGenEndpoint; - - - //Kafka Topics - @Value("${kafka.topics.save.service}") - public String saveEmployeeTopic; - - @Value("${kafka.topics.update.service}") - public String UpdateEmployeeTopic; - - @Value("${kafka.topics.notification.sms}") - public String coreNotificationTopic; - - @Value("${kafka.topics.hrms.updateData}") - public String updateTopic; - - - //Variables - @Value("${egov.idgen.ack.name}") - public String hrmsIdGenKey; - - @Value("${egov.idgen.ack.format}") - public String hrmsIdGenFormat; - - @Value("${open.search.enabled.roles}") - public String openSearchEnabledRoles; - - @Value("${state.level.tenant.id}") - public String stateLevelTenantId; - - @Value("${decryption.abac.enable}") - private Boolean isDecryptionEnable; -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/consumer/HrmsConsumer.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/consumer/HrmsConsumer.java deleted file mode 100644 index 7dd2d852ccc..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/consumer/HrmsConsumer.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.egov.hrms.consumer; - -import java.util.HashMap; - -import org.egov.hrms.config.PropertiesManager; -import org.egov.hrms.producer.HRMSProducer; -import org.egov.hrms.service.NotificationService; -import org.egov.hrms.web.contract.EmployeeRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; - -@Component -@Slf4j -public class HrmsConsumer { - - @Autowired - private NotificationService notificationService; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private HRMSProducer hrmsProducer; - - @Autowired - private PropertiesManager propertiesManager; - - @KafkaListener(topics = {"${kafka.topics.hrms.updateData}"}) - public void listenUpdateEmployeeData(final HashMap record,@Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - try { - EmployeeRequest employeeRequest = mapper.convertValue(record, EmployeeRequest.class); - String tenantId = employeeRequest.getEmployees().get(0).getTenantId(); - hrmsProducer.push(tenantId, propertiesManager.getUpdateEmployeeTopic(), employeeRequest); - notificationService.sendReactivationNotification(employeeRequest); - } catch (final Exception e) { - - log.error("Error while listening to value: " + record + " on topic: " + topic + ": ", e); - } - } - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Assignment.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Assignment.java deleted file mode 100644 index 9df7a4b92bd..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Assignment.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -@Validated -@EqualsAndHashCode(exclude = {"auditDetails"}) -@AllArgsConstructor -@Builder -@Getter -@NoArgsConstructor -@Setter -@ToString -public class Assignment { - - @SafeHtml - private String id; - - private Long position; - - @SafeHtml - @NotNull - private String designation; - - @SafeHtml - @NotNull - private String department; - - @NotNull - private Long fromDate; - - private Long toDate; - - @SafeHtml - private String govtOrderNumber; - - @SafeHtml - private String tenantid; - - @SafeHtml - private String reportingTo; - - @JsonProperty("isHOD") - private Boolean isHOD=false; - - @NotNull - @JsonProperty("isCurrentAssignment") - private Boolean isCurrentAssignment; - - private AuditDetails auditDetails; - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/AuditDetails.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/AuditDetails.java deleted file mode 100644 index bb368cd9852..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/AuditDetails.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.egov.hrms.model; - -import lombok.*; - -import javax.validation.constraints.NotNull; - - -@AllArgsConstructor -@Builder -@Getter -@NoArgsConstructor -@Setter -@ToString -public class AuditDetails { - - private String createdBy; - - private Long createdDate; - - private String lastModifiedBy; - - private Long lastModifiedDate; - - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/DeactivationDetails.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/DeactivationDetails.java deleted file mode 100644 index 32b7787825f..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/DeactivationDetails.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.egov.hrms.model; - -import lombok.*; -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -import javax.validation.constraints.NotNull; - -@Validated -@EqualsAndHashCode(exclude = {"auditDetails"}) -@AllArgsConstructor -@Getter -@NoArgsConstructor -@Setter -@ToString -@Builder -public class DeactivationDetails { - - @SafeHtml - private String id; - - @SafeHtml - @NotNull - private String reasonForDeactivation; - - @SafeHtml - private String orderNo; - - @SafeHtml - private String remarks; - - @NotNull - private Long effectiveFrom; - - @SafeHtml - private String tenantId; - - private AuditDetails auditDetails; - - - - -} - - diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/DepartmentalTest.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/DepartmentalTest.java deleted file mode 100644 index 6341ce3893a..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/DepartmentalTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model; - -import lombok.*; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -@Validated -@EqualsAndHashCode(exclude = {"auditDetails"}) -@Builder -@AllArgsConstructor -@Getter -@NoArgsConstructor -@Setter -@ToString -public class DepartmentalTest { - - @SafeHtml - private String id; - - @SafeHtml - @NotNull - private String test; - - @NotNull - private Long yearOfPassing; - - @SafeHtml - private String remarks; - - @SafeHtml - private String tenantId; - - private AuditDetails auditDetails; - - private Boolean isActive; - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/EducationalQualification.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/EducationalQualification.java deleted file mode 100644 index 2071915c165..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/EducationalQualification.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model; - -import lombok.*; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -@Validated -@EqualsAndHashCode(exclude = {"auditDetails"}) -@Builder -@AllArgsConstructor -@Getter -@NoArgsConstructor -@Setter -@ToString -public class EducationalQualification { - - @SafeHtml - private String id; - - @SafeHtml - @NotNull - private String qualification; - - @SafeHtml - @NotNull - private String stream; - - @NotNull - private Long yearOfPassing; - - @SafeHtml - private String university; - - @SafeHtml - private String remarks; - - @SafeHtml - private String tenantId; - - private AuditDetails auditDetails; - - private Boolean isActive; - - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java deleted file mode 100644 index e75d2f8bb30..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Employee.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model; - -import lombok.*; -import org.egov.hrms.web.contract.User; -import org.hibernate.validator.constraints.NotEmpty; -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@Validated -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -@Builder -public class Employee { - - private Long id; - - @SafeHtml - @Size(max = 1024) - private String uuid; - - @SafeHtml - @Size(min = 1, max = 256) - private String code; - - @SafeHtml - @Size(max = 250) - private String employeeStatus; - - @SafeHtml - @NotNull - @Size(max = 250) - private String employeeType; - - private Long dateOfAppointment; - - @Valid - @NotEmpty - @Size(min = 1,max = 50) - private List jurisdictions = new ArrayList<>(); - - - @Valid - @NotEmpty - @Size(min = 1) - private List assignments = new ArrayList<>(); - - @Valid - @Size(max=25) - private List serviceHistory = new ArrayList<>(); - - - private Boolean IsActive; - - @Valid - @Size(max=25) - private List education = new ArrayList<>(); - - @Valid - @Size(max=25) - private List tests = new ArrayList<>(); - - @SafeHtml - @NotNull - @Size(max = 250) - private String tenantId; - - @Valid - @Size(max=50) - private List documents = new ArrayList<>(); - - @Valid - private List deactivationDetails = new ArrayList<>(); - - private List reactivationDetails = new ArrayList<>(); - - private AuditDetails auditDetails; - - private Boolean reActivateEmployee; - - @Valid - @NotNull - private User user; - - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/EmployeeDocument.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/EmployeeDocument.java deleted file mode 100644 index d93c69f4cf0..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/EmployeeDocument.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model; - -import org.egov.hrms.model.enums.EmployeeDocumentReferenceType; -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Validated -@EqualsAndHashCode(exclude = {"auditDetails"}) -@AllArgsConstructor -@Getter -@NoArgsConstructor -@Setter -@ToString -@Builder -public class EmployeeDocument { - - @SafeHtml - private String id; - - @SafeHtml - private String documentName; - - @SafeHtml - private String documentId; - - private EmployeeDocumentReferenceType referenceType; - - @SafeHtml - private String referenceId; - - @SafeHtml - private String tenantId; - - private AuditDetails auditDetails; - - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Jurisdiction.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Jurisdiction.java deleted file mode 100644 index 5afc27194cb..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Jurisdiction.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model; - -import lombok.*; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -@Validated -@EqualsAndHashCode(exclude = {"auditDetails"}) -@Builder -@AllArgsConstructor -@Getter -@NoArgsConstructor -@Setter -@ToString -public class Jurisdiction { - - @SafeHtml - private String id; - - @SafeHtml - @NotNull - @Size(min=2, max=100) - private String hierarchy; - - @SafeHtml - @NotNull - @Size(min=2, max=100) - private String boundary; - - @SafeHtml - @NotNull - @Size(max=256) - private String boundaryType; - - @SafeHtml - private String tenantId; - - private AuditDetails auditDetails; - - private Boolean isActive; - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/ReactivationDetails.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/ReactivationDetails.java deleted file mode 100644 index a5cb0c1a3c4..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/ReactivationDetails.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.egov.hrms.model; - -import lombok.*; -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -import javax.validation.constraints.NotNull; - -@Validated -@EqualsAndHashCode(exclude = {"auditDetails"}) -@AllArgsConstructor -@Getter -@NoArgsConstructor -@Setter -@ToString -@Builder -public class ReactivationDetails { - - @SafeHtml - private String id; - - @SafeHtml - @NotNull - private String reasonForReactivation; - - @SafeHtml - private String orderNo; - - @SafeHtml - private String remarks; - - @NotNull - private Long effectiveFrom; - - @SafeHtml - private String tenantId; - - private AuditDetails auditDetails; - - - - -} - - diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Role.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Role.java deleted file mode 100644 index 6ab3212b245..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/Role.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model; - -import lombok.*; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -@Builder -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -public class Role { - - - @NotNull - @Size(min=2, max=100) - private String name; - - @Size(min=2, max=100) - private String code; - - @Size(max=256) - private String description; - - @Size(max = 256) - private String tenantId; - - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/SMSRequest.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/SMSRequest.java deleted file mode 100644 index 31c92e38ef7..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/SMSRequest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.egov.hrms.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.ToString; - - -@Getter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -public class SMSRequest { - private String mobileNumber; - private String message; - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/ServiceHistory.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/ServiceHistory.java deleted file mode 100644 index 56bdb6e2ca9..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/ServiceHistory.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model; - -import lombok.*; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.SafeHtml; -import org.springframework.validation.annotation.Validated; - -@Validated -@EqualsAndHashCode(exclude = {"auditDetails"}) -@Builder -@AllArgsConstructor -@Getter -@NoArgsConstructor -@Setter -@ToString -public class ServiceHistory { - - @SafeHtml - private String id; - - @SafeHtml - private String serviceStatus; - - private Long serviceFrom; - - private Long serviceTo; - - @SafeHtml - private String orderNo; - - @SafeHtml - private String location; - - @SafeHtml - private String tenantId; - - private Boolean isCurrentPosition; - - private AuditDetails auditDetails; - - - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/DeactivationType.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/DeactivationType.java deleted file mode 100644 index 3b632fc1e03..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/DeactivationType.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.hrms.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - - -public enum DeactivationType { - SUSPENSION("SUSPENSION"), DEATH("DEATH"), RETIRED("RETIRED"); - - private String value; - - DeactivationType(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return name(); - } - - @JsonCreator - public static DeactivationType fromValue(String passedValue) { - for (DeactivationType obj : DeactivationType.values()) { - if (String.valueOf(obj.value).equals(passedValue.toUpperCase())) { - return obj; - } - } - return null; - } -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/EmployeeDocumentReferenceType.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/EmployeeDocumentReferenceType.java deleted file mode 100644 index f18fcd65a4d..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/EmployeeDocumentReferenceType.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.egov.hrms.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum EmployeeDocumentReferenceType { - HEADER("HEADER"), ASSIGNMENT("ASSIGNMENT"), JURISDICTION("JURISDICTION"), SERVICE("SERVICE"), - EDUCATION("EDUCATION"), TEST("TEST"), DEACTIVATION("DEACTIVATION"); - - private String value; - - EmployeeDocumentReferenceType(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return name(); - } - - @JsonCreator - public static EmployeeDocumentReferenceType fromValue(String passedValue) { - for (EmployeeDocumentReferenceType obj : EmployeeDocumentReferenceType.values()) { - if (String.valueOf(obj.value).equals(passedValue.toUpperCase())) { - return obj; - } - } - return null; - } -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/Gender.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/Gender.java deleted file mode 100644 index 7ab9adf1c8d..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/Gender.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum Gender { - MALE("MALE"), FEMALE("FEMALE"), OTHERS("OTHERS"); - - private String value; - - Gender(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return name(); - } - - @JsonCreator - public static Gender fromValue(String passedValue) { - for (Gender obj : Gender.values()) { - if (String.valueOf(obj.value).equals(passedValue.toUpperCase())) { - return obj; - } - } - return null; - } -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/GuardianRelation.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/GuardianRelation.java deleted file mode 100644 index dead1f98b69..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/GuardianRelation.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.egov.hrms.model.enums; - -public enum GuardianRelation { - FATHER, MOTHER, HUSBAND, OTHER; -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/UserType.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/UserType.java deleted file mode 100644 index 153e5db53cd..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/model/enums/UserType.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.model.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum UserType { - EMPLOYEE("EMPLOYEE"), CITIZEN("CITIZEN"), SYSTEM("SYSTEM"); - - private String value; - - UserType(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return name(); - } - - @JsonCreator - public static UserType fromValue(String passedValue) { - for (UserType obj : UserType.values()) { - if (String.valueOf(obj.value).equals(passedValue.toUpperCase())) { - return obj; - } - } - return null; - } -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/producer/HRMSProducer.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/producer/HRMSProducer.java deleted file mode 100644 index 3b7854a31e9..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/producer/HRMSProducer.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.hrms.producer; - -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.tracer.kafka.CustomKafkaTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class HRMSProducer { - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - private CustomKafkaTemplate kafkaTemplate; - - public void push(String tenantId, String topic, Object value) { - - String updatedTopic = centralInstanceUtil.getStateSpecificTopicName(tenantId, topic); - log.info("The Kafka topic for the tenantId : " + tenantId + " is : " + updatedTopic); - kafkaTemplate.send(updatedTopic, value); - } -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeCountRowMapper.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeCountRowMapper.java deleted file mode 100644 index 2266e24695f..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeCountRowMapper.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.egov.hrms.repository; - -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.egov.hrms.model.*; -import org.egov.hrms.model.enums.EmployeeDocumentReferenceType; -import org.egov.hrms.web.contract.User; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Component -@Slf4j -public class EmployeeCountRowMapper implements ResultSetExtractor> { - - @Autowired - private ObjectMapper mapper; - - @Override - /** - * Maps ResultSet to Employee POJO. - */ - public Map extractData(ResultSet rs) throws SQLException, DataAccessException { - Map response = new HashMap<>(); - int totalEmployee = 0; - int activeEmployee = 0; - int inactiveEmployee = 0; - while(rs.next()) { - if(rs.getBoolean("active")) - activeEmployee = activeEmployee + rs.getInt("count"); - else - inactiveEmployee = inactiveEmployee + rs.getInt("count"); - totalEmployee = totalEmployee + rs.getInt("count"); - } - if(totalEmployee==0){ - response.put("activeEmployee","0"); - response.put("inactiveEmployee", "0"); - } - response.put("activeEmployee", String.valueOf(activeEmployee)); - response.put("inactiveEmployee", String.valueOf(inactiveEmployee)); - response.put("totalEmployee", String.valueOf(totalEmployee)); - return response; - } - - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueries.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueries.java deleted file mode 100644 index 1587ed7ff53..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueries.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.egov.hrms.repository; - -import org.springframework.stereotype.Component; - -@Component -public class EmployeeQueries { - - public static final String HRMS_GET_EMPLOYEES = "SELECT employee.id as employee_id, employee.uuid as employee_uuid, employee.code as employee_code, " - + "employee.dateOfAppointment as employee_doa, employee.employeestatus as employee_status, employeetype as employee_type, employee.active as employee_active, employee.reactivateemployee as employee_reactive, " - + "employee.tenantid as employee_tenantid, employee.createdby as employee_createdby, employee.createddate as employee_createddate, " - + "employee.lastmodifiedby as employee_lastmodifiedby, employee.lastmodifieddate as employee_lastmodifieddate, assignment.uuid as assignment_uuid, " - + "assignment.position as assignment_position, assignment.department as assignment_department, assignment.designation as assignment_designation, " - + "assignment.fromdate as assignment_fromdate, assignment.todate as assignment_todate, assignment.govtordernumber as assignment_govtordernumber, " - + "assignment.reportingto as assignment_reportingto, assignment.ishod as assignment_ishod, assignment.iscurrentassignment as assignment_iscurrentassignment, " - + "assignment.tenantid as assignment_tenantid, " - + "assignment.createdby as assignment_createdby, assignment.createddate as assignment_createddate, assignment.lastmodifiedby as assignment_lastmodifiedby, " - + "assignment.lastmodifieddate as assignment_lastmodifieddate, education.uuid as education_uuid, education.qualification as education_qualification, " - + "education.stream as education_stream, education.yearofpassing as education_yearofpassing, education.university as education_university, " - + "education.remarks as education_remarks,education.isactive as education_isactive ,education.tenantid as education_tenantid, education.createdby as education_createdby, " - + "education.createddate as education_createddate, education.lastmodifiedby as education_lastmodifiedby, education.lastmodifieddate as education_lastmodifieddate, " - + "depttest.uuid as depttest_uuid, depttest.test as depttest_test, depttest.yearofpassing as depttest_yearofpassing, depttest.remarks as depttest_remarks, " - + "depttest.isactive as depttest_isactive, depttest.tenantid as depttest_tenantid, depttest.createdby as depttest_createdby, depttest.createddate as depttest_createddate, " - + "depttest.lastmodifiedby as depttest_lastmodifiedby, depttest.lastmodifieddate as depttest_lastmodifieddate, docs.uuid as docs_uuid, " - + "docs.documentid as docs_documentid, docs.documentname as docs_documentname, docs.referencetype as docs_referencetype, " - + "docs.referenceid as docs_referenceid, docs.tenantid as docs_tenantid, docs.createdby as docs_createdby, docs.createddate as docs_createddate, " - + "docs.lastmodifiedby as docs_lastmodifiedby, docs.lastmodifieddate as docs_lastmodifieddate, jurisdiction.uuid as jurisdiction_uuid, " - + "jurisdiction.hierarchy as jurisdiction_hierarchy, jurisdiction.boundarytype as jurisdiction_boundarytype, jurisdiction.boundary as jurisdiction_boundary, " - + "jurisdiction.isactive as jurisdiction_isactive, jurisdiction.tenantid as jurisdiction_tenantid, jurisdiction.createdby as jurisdiction_createdby, jurisdiction.createddate as jurisdiction_createddate, " - + "jurisdiction.lastmodifiedby as jurisdiction_lastmodifiedby, jurisdiction.lastmodifieddate as jurisdiction_lastmodifieddate, history.uuid as history_uuid, " - + "history.servicestatus as history_servicestatus, history.servicefrom as history_servicefrom, history.serviceto as history_serviceto, " - + "history.ordernumber as history_ordernumber, history.iscurrentposition as history_iscurrentposition, history.location as history_location, " - + "history.tenantid as history_tenantid, history.createdby as history_createdby, history.createddate as history_createddate, " - + "history.lastmodifiedby as history_lastmodifiedby, history.lastmodifieddate as history_lastmodifieddate, deact.uuid as deact_uuid, " - + "deact.reasonfordeactivation as deact_reasonfordeactivation, deact.effectivefrom as deact_effectivefrom, deact.ordernumber as deact_ordernumber, " - + "deact.remarks as deact_remarks, deact.tenantid as deact_tenantid, deact.createdby as deact_createdby, " - + "deact.createddate as deact_createddate, deact.lastmodifiedby as deact_lastmodifiedby, deact.lastmodifieddate as deact_lastmodifieddate, " - + "react.uuid as react_uuid, react.reasonforreactivation as react_reasonforreactivation, react.effectivefrom as react_effectivefrom, react.ordernumber as react_ordernumber, " - + "react.remarks as react_remarks, react.tenantid as react_tenantid, react.createdby as react_createdby, " - + "react.createddate as react_createddate, react.lastmodifiedby as react_lastmodifiedby, react.lastmodifieddate as react_lastmodifieddate " - + "FROM {schema}.eg_hrms_employee employee LEFT JOIN {schema}.eg_hrms_assignment assignment ON employee.uuid = assignment.employeeid LEFT JOIN {schema}.eg_hrms_educationaldetails education " - + "ON employee.uuid = education.employeeid LEFT JOIN {schema}.eg_hrms_departmentaltests depttest ON employee.uuid = depttest.employeeid LEFT JOIN {schema}.eg_hrms_empdocuments docs " - + "ON employee.uuid = docs.employeeid LEFT JOIN {schema}.eg_hrms_servicehistory history ON employee.uuid = history.employeeid LEFT JOIN {schema}.eg_hrms_jurisdiction jurisdiction " - + "ON employee.uuid = jurisdiction.employeeid LEFT JOIN {schema}.eg_hrms_deactivationdetails deact ON employee.uuid = deact.employeeid LEFT JOIN {schema}.eg_hrms_reactivationdetails react " - + "ON employee.uuid = react.employeeid WHERE "; - - public static final String HRMS_PAGINATION_WRAPPER = "SELECT * FROM " - + "(SELECT *, DENSE_RANK() OVER (ORDER BY employee_uuid) offset_ FROM " + "({})" + " result) result_offset " - + "WHERE offset_ > $offset AND offset_ <= $limit"; - - public static final String HRMS_POSITION_SEQ = "SELECT NEXTVAL('EG_HRMS_POSITION')"; - - public static final String HRMS_GET_ASSIGNMENT = "select distinct(employeeid) from {schema}.eg_hrms_assignment assignment where assignment.tenantid notnull "; - - public static final String HRMS_COUNT_EMP_QUERY = "SELECT active, count(*) FROM {schema}.eg_hrms_employee WHERE tenantid "; -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java deleted file mode 100644 index db24d5b60fa..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeQueryBuilder.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.egov.hrms.repository; - -import java.util.List; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; -import org.egov.hrms.config.PropertiesManager; -import org.egov.hrms.web.contract.EmployeeSearchCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -@Service -public class EmployeeQueryBuilder { - - @Value("${egov.hrms.default.pagination.limit}") - private Integer defaultLimit; - - @Autowired - private PropertiesManager properties; - - /** - * Returns query for searching employees - * - * @param criteria - * @return - */ - public String getEmployeeSearchQuery(EmployeeSearchCriteria criteria,List preparedStmtList ) { - StringBuilder builder = new StringBuilder(EmployeeQueries.HRMS_GET_EMPLOYEES); - addWhereClause(criteria, builder, preparedStmtList); - return paginationClause(criteria, builder); - } - - public String getEmployeeCountQuery(String tenantId, List preparedStmtList ) { - StringBuilder builder = new StringBuilder(EmployeeQueries.HRMS_COUNT_EMP_QUERY); - if(tenantId.equalsIgnoreCase(properties.stateLevelTenantId)){ - builder.append("LIKE ? "); - preparedStmtList.add(tenantId+"%"); - } - else{ - builder.append("= ? "); - preparedStmtList.add(tenantId); - } - builder.append("GROUP BY active"); - return builder.toString(); - } - - public String getPositionSeqQuery() { - return EmployeeQueries.HRMS_POSITION_SEQ; - } - - /** - * Adds where clause to the query based on the requirement. - * @param criteria - * @param builder - * @param preparedStmtList - */ - public void addWhereClause(EmployeeSearchCriteria criteria, StringBuilder builder, List preparedStmtList) { - - if(!StringUtils.isEmpty(criteria.getTenantId())) { - builder.append(" employee.tenantid = ?"); - preparedStmtList.add(criteria.getTenantId()); - } - else - builder.append(" employee.tenantid NOTNULL"); - - if(!CollectionUtils.isEmpty(criteria.getCodes())){ - List codes = criteria.getCodes().stream().map(String::toLowerCase).collect(Collectors.toList()); - builder.append(" and lower(employee.code) IN (").append(createQuery(codes)).append(")"); - addToPreparedStatement(preparedStmtList, codes); - } - if(!CollectionUtils.isEmpty(criteria.getIds())){ - builder.append(" and employee.id IN (").append(createQuery(criteria.getIds())).append(")"); - addToPreparedStatement(preparedStmtList, criteria.getIds()); - } - if(!CollectionUtils.isEmpty(criteria.getUuids())){ - builder.append(" and employee.uuid IN (").append(createQuery(criteria.getUuids())).append(")"); - addToPreparedStatement(preparedStmtList, criteria.getUuids()); - } - if(!CollectionUtils.isEmpty(criteria.getEmployeestatuses())){ - builder.append(" and employee.employeestatus IN (").append(createQuery(criteria.getEmployeestatuses())).append(")"); - addToPreparedStatement(preparedStmtList, criteria.getEmployeestatuses()); - } - if(!CollectionUtils.isEmpty(criteria.getEmployeetypes())){ - builder.append(" and employee.employeetype IN (").append(createQuery(criteria.getEmployeetypes())).append(")"); - addToPreparedStatement(preparedStmtList, criteria.getEmployeetypes()); - } - if(criteria.getIsActive() != null){ - builder.append(" and employee.active = ?"); - preparedStmtList.add(criteria.getIsActive()); - } - } - - public String paginationClause(EmployeeSearchCriteria criteria, StringBuilder builder) { - String pagination = EmployeeQueries.HRMS_PAGINATION_WRAPPER; - pagination = pagination.replace("{}", builder.toString()); - if(null != criteria.getOffset()) - pagination = pagination.replace("$offset", criteria.getOffset().toString()); - else - pagination = pagination.replace("$offset", "0"); - - if(null != criteria.getLimit()){ - Integer limit = criteria.getLimit() + criteria.getOffset(); - pagination = pagination.replace("$limit", limit.toString()); - } - else - pagination = pagination.replace("$limit", defaultLimit.toString()); - - return pagination; - } - - public String getAssignmentSearchQuery(EmployeeSearchCriteria criteria, List preparedStmtList) { - StringBuilder builder = new StringBuilder(EmployeeQueries.HRMS_GET_ASSIGNMENT); - addWhereClauseAssignment(criteria, builder, preparedStmtList); - return builder.toString(); - } - - private void addWhereClauseAssignment(EmployeeSearchCriteria criteria, StringBuilder builder, List preparedStmtList) { - if(!CollectionUtils.isEmpty(criteria.getDepartments())){ - builder.append(" and assignment.department IN (").append(createQuery(criteria.getDepartments())).append(")"); - addToPreparedStatement(preparedStmtList, criteria.getDepartments()); - } - if(!CollectionUtils.isEmpty(criteria.getDesignations())){ - builder.append(" and assignment.designation IN (").append(createQuery(criteria.getDesignations())+")"); - addToPreparedStatement(preparedStmtList,criteria.getDesignations()); - } - if(!CollectionUtils.isEmpty(criteria.getPositions())){ - builder.append(" and assignment.position IN (").append(createQuery(criteria.getPositions())+")"); - addToPreparedStatement(preparedStmtList,criteria.getPositions()); - } - if(null != criteria.getAsOnDate()) { - builder.append( " and case when assignment.todate is null then assignment.fromdate <= ? else assignment.fromdate <= ? and assignment.todate > ? end"); - preparedStmtList.add(criteria.getAsOnDate()); - preparedStmtList.add(criteria.getAsOnDate()); - preparedStmtList.add(criteria.getAsOnDate()); - } - - - } - - - private String createQuery(List ids) { - StringBuilder builder = new StringBuilder(); - int length = ids.size(); - for (int i = 0; i < length; i++) { - builder.append(" ?"); - if (i != length - 1) - builder.append(","); - } - return builder.toString(); - } - - private void addToPreparedStatement(List preparedStmtList, List ids) { - ids.forEach(id -> { - preparedStmtList.add(id); - }); - } - - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java deleted file mode 100644 index 950efa8361e..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRepository.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.egov.hrms.repository; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.exception.InvalidTenantIdException; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.hrms.model.Employee; -import org.egov.hrms.utils.HRMSUtils; -import org.egov.hrms.web.contract.EmployeeSearchCriteria; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Repository; -import org.springframework.util.CollectionUtils; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class EmployeeRepository { - - @Autowired - private EmployeeQueryBuilder queryBuilder; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Autowired - private JdbcTemplate jdbcTemplate; - - @Autowired - private EmployeeRowMapper rowMapper; - - @Autowired - private EmployeeCountRowMapper countRowMapper; - - @Autowired - private HRMSUtils hrmsUtils; - - /** - * DB Repository that makes jdbc calls to the db and fetches employees. - * - * @param criteria - * @param requestInfo - * @return - */ - public List fetchEmployees(EmployeeSearchCriteria criteria, RequestInfo requestInfo, String stateLevelTenantId){ - List employees = new ArrayList<>(); - List preparedStmtList = new ArrayList<>(); - - if(hrmsUtils.isAssignmentSearchReqd(criteria)) { - List empUuids = fetchEmployeesforAssignment(criteria, requestInfo, stateLevelTenantId); - if (CollectionUtils.isEmpty(empUuids)) - return employees; - else { - if(!CollectionUtils.isEmpty(criteria.getUuids())) - criteria.setUuids(criteria.getUuids().stream().filter(empUuids::contains).collect(Collectors.toList())); - else - criteria.setUuids(empUuids); - } - } - - String query = queryBuilder.getEmployeeSearchQuery(criteria, preparedStmtList); - String finalQuery; - try { - finalQuery = centralInstanceUtil.replaceSchemaPlaceholder(query, stateLevelTenantId); - } catch (InvalidTenantIdException e1) { - throw new CustomException("HRMS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - try { - employees = jdbcTemplate.query(finalQuery, preparedStmtList.toArray(),rowMapper); - }catch(Exception e) { - log.error("Exception while making the db call: ",e); - log.error("query; "+ finalQuery); - } - return employees; - } - - private List fetchEmployeesforAssignment(EmployeeSearchCriteria criteria, RequestInfo requestInfo, String stateLevelTenantId) { - List employeesIds = new ArrayList<>(); - List preparedStmtList = new ArrayList<>(); - String query = queryBuilder.getAssignmentSearchQuery(criteria, preparedStmtList); - - try { - query = centralInstanceUtil.replaceSchemaPlaceholder(query, stateLevelTenantId); - } catch (InvalidTenantIdException e1) { - throw new CustomException("HRMS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - try { - - employeesIds = jdbcTemplate.queryForList(query, preparedStmtList.toArray(),String.class); - }catch(Exception e) { - log.error("Exception while making the db call: ",e); - log.error("query; "+query); - } - return employeesIds; - } - - /** - * Fetches next value in the position seq table - * - * @return - */ - public Long fetchPosition(){ - String query = queryBuilder.getPositionSeqQuery(); - Long id = null; - try { - id = jdbcTemplate.queryForObject(query, Long.class); - }catch(Exception e) { - log.error("Exception while making the db call: ",e); - log.error("query; "+query); - } - return id; - } - - /** - * DB Repository that makes jdbc calls to the db and fetches employee count. - * - * @param tenantId - * @return - */ - public Map fetchEmployeeCount(String tenantId){ - Map response = new HashMap<>(); - List preparedStmtList = new ArrayList<>(); - - String query = queryBuilder.getEmployeeCountQuery(tenantId, preparedStmtList); - String finalQuery; - try { - finalQuery = centralInstanceUtil.replaceSchemaPlaceholder(query, centralInstanceUtil.getStateLevelTenant(tenantId)); - } catch (InvalidTenantIdException e1) { - throw new CustomException("HRMS_TENANTID_ERROR", - "TenantId length is not sufficient to replace query schema in a multi state instance"); - } - - - log.info("query; "+finalQuery); - try { - response=jdbcTemplate.query(finalQuery, preparedStmtList.toArray(),countRowMapper); - }catch(Exception e) { - log.error("Exception while making the db call: ",e); - log.error("query; "+ finalQuery); - } - return response; - } - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRowMapper.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRowMapper.java deleted file mode 100644 index 9d1ab4dd875..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/EmployeeRowMapper.java +++ /dev/null @@ -1,338 +0,0 @@ -package org.egov.hrms.repository; - -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.egov.hrms.model.*; -import org.egov.hrms.model.enums.EmployeeDocumentReferenceType; -import org.egov.hrms.web.contract.User; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Component -@Slf4j -public class EmployeeRowMapper implements ResultSetExtractor> { - - @Autowired - private ObjectMapper mapper; - - @Override - /** - * Maps ResultSet to Employee POJO. - */ - public List extractData(ResultSet rs) throws SQLException, DataAccessException { - Map employeeMap = new HashMap<>(); - while(rs.next()) { - String currentid = rs.getString("employee_uuid"); - Employee currentEmployee = employeeMap.get(currentid); - if(null == currentEmployee) { - AuditDetails auditDetails = AuditDetails.builder().createdBy(rs.getString("employee_createdby")).createdDate(rs.getLong("employee_createddate")) - .lastModifiedBy(rs.getString("employee_lastmodifiedby")).lastModifiedDate(rs.getLong("employee_lastmodifieddate")).build(); - currentEmployee = Employee.builder().id(rs.getLong("employee_id")).uuid(rs.getString("employee_uuid")).tenantId(rs.getString("employee_tenantid")) - .code(rs.getString("employee_code")).dateOfAppointment(null == rs.getObject("employee_doa")? null : rs.getLong("employee_doa")).IsActive(rs.getBoolean("employee_active")) - .employeeStatus(rs.getString("employee_status")).employeeType(rs.getString("employee_type")).auditDetails(auditDetails).reActivateEmployee(rs.getBoolean("employee_reactive")) - .jurisdictions(new ArrayList()).assignments(new ArrayList()).user(new User()) - .build(); - } - addChildrenToEmployee(rs, currentEmployee); - employeeMap.put(currentid, currentEmployee); - } - - return new ArrayList<>(employeeMap.values()); - - } - - /** - * Adds all the children data to a employee object. - * - * @param rs - * @param currentEmployee - */ - public void addChildrenToEmployee(ResultSet rs, Employee currentEmployee) { - setAssignments(rs, currentEmployee); - setJurisdictions(rs, currentEmployee); - setEducationDetails(rs, currentEmployee); - setDeptTests(rs, currentEmployee); - setServiceHistory(rs, currentEmployee); - setDocuments(rs, currentEmployee); - setDeactivationDetails(rs, currentEmployee); - setReactivationDetails(rs, currentEmployee); - } - - /** - * Maps Assignments inside a ResultSet to the Assignment POJO inside employee object. - * - * @param rs - * @param currentEmployee - */ - public void setAssignments(ResultSet rs, Employee currentEmployee) { - try { - List assignments = new ArrayList<>(); - if(CollectionUtils.isEmpty(currentEmployee.getAssignments())) - assignments = new ArrayList(); - else - assignments = currentEmployee.getAssignments(); - - List ids = assignments.stream().map(Assignment::getId).collect(Collectors.toList()); - if(!StringUtils.isEmpty(rs.getString("assignment_uuid")) && !ids.contains(rs.getString("assignment_uuid"))) { - AuditDetails auditDetails = AuditDetails.builder().createdBy(rs.getString("assignment_createdby")).createdDate(rs.getLong("assignment_createddate")) - .lastModifiedBy(rs.getString("assignment_lastmodifiedby")).lastModifiedDate(rs.getLong("assignment_lastmodifieddate")).build(); - - Assignment assignment = Assignment.builder().id(rs.getString("assignment_uuid")).position(rs.getLong("assignment_position")).department(rs.getString("assignment_department")) - .designation(rs.getString("assignment_designation")).fromDate(rs.getLong("assignment_fromdate")).toDate(null == rs.getObject("assignment_todate")? null : rs.getLong("assignment_todate")) - .govtOrderNumber(rs.getString("assignment_govtordernumber")).reportingTo(rs.getString("assignment_reportingto")).isHOD(rs.getBoolean("assignment_ishod")) - .isCurrentAssignment(rs.getBoolean("assignment_iscurrentassignment")).tenantid(rs.getString("assignment_tenantid")).auditDetails(auditDetails).build(); - - assignments.add(assignment); - } - currentEmployee.setAssignments(assignments); - }catch(Exception e) { - log.error("Error in row mapper while mapping Assignments: ",e); - throw new CustomException("ROWMAPPER_ERROR","Error in row mapper while mapping Assignments"); - } - } - - /** - * Maps Jurisdictions inside a ResultSet to the Jurisdiction POJO inside employee object. - * - * @param rs - * @param currentEmployee - */ - public void setJurisdictions(ResultSet rs, Employee currentEmployee) { - try { - List jurisdictions = new ArrayList<>(); - if(CollectionUtils.isEmpty(currentEmployee.getJurisdictions())) - jurisdictions = new ArrayList(); - else - jurisdictions = currentEmployee.getJurisdictions(); - - List ids = jurisdictions.stream().map(Jurisdiction::getId).collect(Collectors.toList()); - Boolean isActive = rs.getBoolean("jurisdiction_isactive") !=false; - if(isActive && !StringUtils.isEmpty(rs.getString("jurisdiction_uuid")) && !ids.contains(rs.getString("jurisdiction_uuid"))) { - AuditDetails auditDetails = AuditDetails.builder().createdBy(rs.getString("jurisdiction_createdby")).createdDate(rs.getLong("jurisdiction_createddate")) - .lastModifiedBy(rs.getString("jurisdiction_lastmodifiedby")).lastModifiedDate(rs.getLong("jurisdiction_lastmodifieddate")).build(); - - Jurisdiction jurisdiction = Jurisdiction.builder().id(rs.getString("jurisdiction_uuid")).hierarchy(rs.getString("jurisdiction_hierarchy")) - .boundary(rs.getString("jurisdiction_boundary")).boundaryType(rs.getString("jurisdiction_boundarytype")) - .tenantId(rs.getString("jurisdiction_tenantid")) - .isActive(null == rs.getObject("jurisdiction_isactive")?true:rs.getBoolean("jurisdiction_isactive")) - .auditDetails(auditDetails).build(); - - jurisdictions.add(jurisdiction); - } - currentEmployee.setJurisdictions(jurisdictions); - }catch(Exception e) { - log.error("Error in row mapper while mapping Jurisdictions: ",e); - throw new CustomException("ROWMAPPER_ERROR","Error in row mapper while mapping Jurisdictions"); - } - } - - /** - * Maps EducationDetails inside a ResultSet to the EducationDetails POJO inside employee object. - * - * @param rs - * @param currentEmployee - */ - public void setEducationDetails(ResultSet rs, Employee currentEmployee) { - try { - List educationDetails = new ArrayList<>(); - if(CollectionUtils.isEmpty(currentEmployee.getEducation())) - educationDetails = new ArrayList(); - else - educationDetails = currentEmployee.getEducation(); - List ids = educationDetails.stream().map(EducationalQualification::getId).collect(Collectors.toList()); - Boolean isActive =rs.getBoolean("education_isactive") !=false; - if( isActive &&!StringUtils.isEmpty( rs.getString("education_uuid")) && !ids.contains(rs.getString("education_uuid"))) { - AuditDetails auditDetails = AuditDetails.builder().createdBy(rs.getString("education_createdby")).createdDate(rs.getLong("education_createddate")) - .lastModifiedBy(rs.getString("education_lastmodifiedby")).lastModifiedDate(rs.getLong("education_lastmodifieddate")).build(); - EducationalQualification education = EducationalQualification.builder().id(rs.getString("education_uuid")).qualification(rs.getString("education_qualification")).stream(rs.getString("education_stream")) - .yearOfPassing(rs.getLong("education_yearofpassing")).university(rs.getString("education_university")).remarks(rs.getString("education_remarks")) - .tenantId(rs.getString("education_tenantid")) - .isActive(null == rs.getObject("education_isactive")?true:rs.getBoolean("education_isactive")) - .auditDetails(auditDetails).build(); - - educationDetails.add(education); - } - currentEmployee.setEducation(educationDetails); - }catch(Exception e) { - log.error("Error in row mapper while mapping Educational Details: ",e); - throw new CustomException("ROWMAPPER_ERROR","Error in row mapper while mapping Educational Details"); - } - } - - /** - * Maps Dept Tests inside a ResultSet to the DeptTest POJO inside employee object. - * - * @param rs - * @param currentEmployee - */ - public void setDeptTests(ResultSet rs, Employee currentEmployee) { - try { - List tests = new ArrayList<>(); - if(CollectionUtils.isEmpty(currentEmployee.getTests())) - tests = new ArrayList(); - else - tests = currentEmployee.getTests(); - - List ids = tests.stream().map(DepartmentalTest::getId).collect(Collectors.toList()); - Boolean isActive = rs.getBoolean("depttest_isactive") !=false; - if(isActive && !StringUtils.isEmpty(rs.getString("depttest_uuid")) && !ids.contains(rs.getString("depttest_uuid"))) { - AuditDetails auditDetails = AuditDetails.builder().createdBy(rs.getString("depttest_createdby")).createdDate(rs.getLong("depttest_createddate")) - .lastModifiedBy(rs.getString("depttest_lastmodifiedby")).lastModifiedDate(rs.getLong("depttest_lastmodifieddate")).build(); - - DepartmentalTest test = DepartmentalTest.builder().id(rs.getString("depttest_uuid")).test(rs.getString("depttest_test")).yearOfPassing(rs.getLong("depttest_yearofpassing")) - .remarks(rs.getString("depttest_remarks")).tenantId(rs.getString("depttest_tenantid")) - .isActive(null == rs.getObject("depttest_isactive")?true:rs.getBoolean("depttest_isactive")) - .auditDetails(auditDetails).build(); - - tests.add(test); - } - currentEmployee.setTests(tests); - }catch(Exception e) { - log.error("Error in row mapper while mapping Departmental Tests: ",e); - throw new CustomException("ROWMAPPER_ERROR","Error in row mapper while mapping Departmental Tests"); - } - } - - /** - * Maps ServiceHistory inside a ResultSet to the ServiceHistory POJO inside employee object. - * - * @param rs - * @param currentEmployee - */ - public void setServiceHistory(ResultSet rs, Employee currentEmployee) { - try { - List history = new ArrayList<>(); - if(CollectionUtils.isEmpty(currentEmployee.getServiceHistory())) - history = new ArrayList(); - else - history = currentEmployee.getServiceHistory(); - - List ids = history.stream().map(ServiceHistory::getId).collect(Collectors.toList()); - if(!StringUtils.isEmpty(rs.getString("history_uuid")) && !ids.contains(rs.getString("history_uuid"))) { - AuditDetails auditDetails = AuditDetails.builder().createdBy(rs.getString("history_createdby")).createdDate(rs.getLong("history_createddate")) - .lastModifiedBy(rs.getString("history_lastmodifiedby")).lastModifiedDate(rs.getLong("history_lastmodifieddate")).build(); - - ServiceHistory service = ServiceHistory.builder().id(rs.getString("history_uuid")).serviceStatus(rs.getString("history_servicestatus")).serviceFrom(rs.getLong("history_servicefrom")) - .serviceTo(null == rs.getObject("history_serviceto")? null :rs.getLong("history_serviceto")).orderNo(rs.getString("history_ordernumber")).isCurrentPosition(rs.getBoolean("history_iscurrentposition")) - .location(rs.getString("history_location")).tenantId(rs.getString("history_tenantid")).auditDetails(auditDetails).build(); - - history.add(service); - } - currentEmployee.setServiceHistory(history); - }catch(Exception e) { - log.error("Error in row mapper while mapping Service History: ",e); - throw new CustomException("ROWMAPPER_ERROR","Error in row mapper while mapping Service History"); - } - - } - - /** - * Maps Documents inside a ResultSet to the Document POJO inside employee object. - * - * @param rs - * @param currentEmployee - */ - public void setDocuments(ResultSet rs, Employee currentEmployee) { - try { - List documents = new ArrayList<>(); - if(CollectionUtils.isEmpty(currentEmployee.getDocuments())) - documents = new ArrayList(); - else - documents = currentEmployee.getDocuments(); - - List ids = documents.stream().map(EmployeeDocument::getId).collect(Collectors.toList()); - if(!StringUtils.isEmpty(rs.getString("docs_uuid")) && !ids.contains(rs.getString("docs_uuid")) ) { - AuditDetails auditDetails = AuditDetails.builder().createdBy(rs.getString("docs_createdby")).createdDate(rs.getLong("docs_createddate")) - .lastModifiedBy(rs.getString("docs_lastmodifiedby")).lastModifiedDate(rs.getLong("docs_lastmodifieddate")).build(); - EmployeeDocument document = EmployeeDocument.builder().id(rs.getString("docs_uuid")).documentId(rs.getString("docs_documentid")) - .documentName(rs.getString("docs_documentname")).referenceType(rs.getString("docs_referencetype") != null ? EmployeeDocumentReferenceType.valueOf(rs.getString("docs_referencetype")): null) - .referenceId(rs.getString("docs_referenceid")).tenantId(rs.getString("docs_tenantid")).auditDetails(auditDetails).build(); - - documents.add(document); - } - currentEmployee.setDocuments(documents); - }catch(Exception e) { - log.error("Error in row mapper while mapping document: ",e); - throw new CustomException("ROWMAPPER_ERROR","Error in row mapper while mapping document"); - - } - } - - /** - * Maps DeactivationDetails inside a ResultSet to the DeactivationDetail POJO inside employee object. - * - * @param rs - * @param currentEmployee - */ - public void setDeactivationDetails(ResultSet rs, Employee currentEmployee) { - try { - List deactDetails = new ArrayList<>(); - if(CollectionUtils.isEmpty(currentEmployee.getDeactivationDetails())) - deactDetails = new ArrayList(); - else - deactDetails = currentEmployee.getDeactivationDetails(); - - List ids = deactDetails.stream().map(DeactivationDetails::getId).collect(Collectors.toList()); - if(!StringUtils.isEmpty(rs.getString("deact_uuid")) && !ids.contains(rs.getString("deact_uuid")) ) { - if(rs.getString("deact_uuid")!=null){ - AuditDetails auditDetails = AuditDetails.builder().createdBy(rs.getString("deact_createdby")).createdDate(rs.getLong("deact_createddate")) - .lastModifiedBy(rs.getString("deact_lastmodifiedby")).lastModifiedDate(rs.getLong("deact_lastmodifieddate")).build(); - - DeactivationDetails deactDetail = DeactivationDetails.builder().id(rs.getString("deact_uuid")).reasonForDeactivation(rs.getString("deact_reasonfordeactivation")) - .effectiveFrom(rs.getLong("deact_effectivefrom")).orderNo(rs.getString("deact_ordernumber")).remarks(rs.getString("deact_remarks")!= null ? (rs.getString("deact_remarks")) : null) - .tenantId(rs.getString("deact_tenantid")).auditDetails(auditDetails).build(); - - deactDetails.add(deactDetail); - } - } - currentEmployee.setDeactivationDetails(deactDetails); - - }catch(Exception e) { - log.error("Error in row mapper while mapping deactivation details: ",e); - throw new CustomException("ROWMAPPER_ERROR","Error in row mapper while mapping deactivation details"); - } - } - - public void setReactivationDetails(ResultSet rs, Employee currentEmployee){ - try { - List reactDetails = new ArrayList<>(); - if(CollectionUtils.isEmpty(currentEmployee.getReactivationDetails())) - reactDetails = new ArrayList(); - else - reactDetails = currentEmployee.getReactivationDetails(); - - List ids = reactDetails.stream().map(ReactivationDetails::getId).collect(Collectors.toList()); - if(!StringUtils.isEmpty(rs.getString("react_uuid")) && !ids.contains(rs.getString("react_uuid")) ) { - if(rs.getString("react_uuid")!=null){ - AuditDetails auditDetails = AuditDetails.builder().createdBy(rs.getString("react_createdby")).createdDate(rs.getLong("react_createddate")) - .lastModifiedBy(rs.getString("react_lastmodifiedby")).lastModifiedDate(rs.getLong("react_lastmodifieddate")).build(); - - ReactivationDetails reactDetail = ReactivationDetails.builder().id(rs.getString("react_uuid")).reasonForReactivation(rs.getString("react_reasonforreactivation")) - .effectiveFrom(rs.getLong("react_effectivefrom")).orderNo(rs.getString("react_ordernumber")).remarks(rs.getString("react_remarks")!= null ? (rs.getString("react_remarks")) : null) - .tenantId(rs.getString("react_tenantid")).auditDetails(auditDetails).build(); - - reactDetails.add(reactDetail); - } - } - currentEmployee.setReactivationDetails(reactDetails); - - }catch(Exception e) { - log.error("Error in row mapper while mapping reactivation details ",e); - throw new CustomException("ROWMAPPER_ERROR","Error in row mapper while mapping reactivation details"); - } - } - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/RestCallRepository.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/RestCallRepository.java deleted file mode 100644 index 13b4e023e12..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/repository/RestCallRepository.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.egov.hrms.repository; - -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class RestCallRepository { - - @Autowired - private RestTemplate restTemplate; - - /** - * Fetches results from the given API and request and handles errors. - * - * @param requestInfo - * @param serviceReqSearchCriteria - * @return Object - * @author vishal - */ - public Object fetchResult(StringBuilder uri, Object request) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - Object response = null; - try { - response = restTemplate.postForObject(uri.toString(), request, Map.class); - } catch (HttpClientErrorException e) { - log.error("External Service threw an Exception: ", e); - if (!StringUtils.isEmpty(e.getResponseBodyAsString())) { - throw new ServiceCallException(e.getResponseBodyAsString()); - } - } catch (Exception e) { - log.error("Exception while fetching from searcher: ", e); - log.info("req: " + (request)); - } - - return response; - - } - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java deleted file mode 100644 index 9d4de8192b1..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/EmployeeService.java +++ /dev/null @@ -1,592 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.service; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.hrms.config.PropertiesManager; -import org.egov.hrms.model.AuditDetails; -import org.egov.hrms.model.Employee; -import org.egov.hrms.model.enums.UserType; -import org.egov.hrms.producer.HRMSProducer; -import org.egov.hrms.repository.EmployeeRepository; -import org.egov.hrms.utils.ErrorConstants; -import org.egov.hrms.utils.HRMSConstants; -import org.egov.hrms.utils.HRMSUtils; -import org.egov.hrms.utils.ResponseInfoFactory; -import org.egov.hrms.web.contract.EmployeeRequest; -import org.egov.hrms.web.contract.EmployeeResponse; -import org.egov.hrms.web.contract.EmployeeSearchCriteria; -import org.egov.hrms.web.contract.User; -import org.egov.hrms.web.contract.UserRequest; -import org.egov.hrms.web.contract.UserResponse; -import org.egov.tracer.kafka.LogAwareKafkaTemplate; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; - -@Data -@Slf4j -@Service -public class EmployeeService { - - - @Autowired - private UserService userService; - - @Autowired - private IdGenService idGenService; - - @Autowired - private ResponseInfoFactory factory; - - @Autowired - private LogAwareKafkaTemplate kafkaTemplate; - - @Autowired - private PropertiesManager propertiesManager; - - @Autowired - private HRMSProducer hrmsProducer; - - @Autowired - private EmployeeRepository repository; - - @Autowired - private HRMSUtils hrmsUtils; - - @Autowired - private NotificationService notificationService; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - /** - * Service method for create employee. Does following: - * 1. Sets ids to all the objects using idgen service. - * 2. Enriches the employee object with required parameters - * 3. Creates user in the egov-user service. - * 4. Sends notification upon successful creation - * - * @param employeeRequest - * @return - */ - public EmployeeResponse create(EmployeeRequest employeeRequest) { - - RequestInfo requestInfo = employeeRequest.getRequestInfo(); - String tenantId = employeeRequest.getEmployees().get(0).getTenantId(); - - Map pwdMap = new HashMap<>(); - idGenService.setIds(employeeRequest); - employeeRequest.getEmployees().stream().forEach(employee -> { - enrichCreateRequest(employee, requestInfo); - createUser(employee, requestInfo); - pwdMap.put(employee.getUuid(), employee.getUser().getPassword()); - employee.getUser().setPassword(null); - }); - String hrmsCreateTopic = propertiesManager.getSaveEmployeeTopic(); - hrmsProducer.push(tenantId, hrmsCreateTopic, employeeRequest); - notificationService.sendNotification(employeeRequest, pwdMap); - return generateResponse(employeeRequest); - } - - - /** - * Searches employees on a given criteria. - * - * @param criteria - * @param requestInfo - * @return - */ - public EmployeeResponse search(EmployeeSearchCriteria criteria, RequestInfo requestInfo) { - boolean userChecked = false; - /*if(null == criteria.getIsActive() || criteria.getIsActive()) - criteria.setIsActive(true); - else - criteria.setIsActive(false);*/ - Map mapOfUsers = new HashMap(); - if(!StringUtils.isEmpty(criteria.getPhone()) || !CollectionUtils.isEmpty(criteria.getRoles())) { - Map userSearchCriteria = new HashMap<>(); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTID,criteria.getTenantId()); - if(!StringUtils.isEmpty(criteria.getPhone())) - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_MOBILENO,criteria.getPhone()); - if( !CollectionUtils.isEmpty(criteria.getRoles()) ) - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_ROLECODES,criteria.getRoles()); - UserResponse userResponse = userService.getUser(requestInfo, userSearchCriteria); - userChecked =true; - if(!CollectionUtils.isEmpty(userResponse.getUser())) { - mapOfUsers.putAll(userResponse.getUser().stream() - .collect(Collectors.toMap(User::getUuid, Function.identity()))); - } - List userUUIDs = userResponse.getUser().stream().map(User :: getUuid).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(criteria.getUuids())) - criteria.setUuids(criteria.getUuids().stream().filter(userUUIDs::contains).collect(Collectors.toList())); - else - criteria.setUuids(userUUIDs); - } - //checks if above criteria met and result is not null will check for name search if list of names are given as user search on name is not bulk api - - if(!((!CollectionUtils.isEmpty(criteria.getRoles()) || !StringUtils.isEmpty(criteria.getPhone())) && CollectionUtils.isEmpty(criteria.getUuids()))){ - if(!CollectionUtils.isEmpty(criteria.getNames())) { - List userUUIDs = new ArrayList<>(); - for(String name: criteria.getNames()) { - Map userSearchCriteria = new HashMap<>(); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTID,criteria.getTenantId()); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_NAME,name); - UserResponse userResponse = userService.getUser(requestInfo, userSearchCriteria); - userChecked =true; - if(!CollectionUtils.isEmpty(userResponse.getUser())) { - mapOfUsers.putAll(userResponse.getUser().stream() - .collect(Collectors.toMap(User::getUuid, Function.identity()))); - } - List uuids = userResponse.getUser().stream().map(User :: getUuid).collect(Collectors.toList()); - userUUIDs.addAll(uuids); - } - if(!CollectionUtils.isEmpty(criteria.getUuids())) - criteria.setUuids(criteria.getUuids().stream().filter(userUUIDs::contains).collect(Collectors.toList())); - else - criteria.setUuids(userUUIDs); - } - } - - String stateLevelTenantId = centralInstanceUtil.getStateLevelTenant(criteria.getTenantId()); - if(userChecked) - criteria.setTenantId(null); - - List employees = new ArrayList<>(); - if(!((!CollectionUtils.isEmpty(criteria.getRoles()) || !CollectionUtils.isEmpty(criteria.getNames()) || !StringUtils.isEmpty(criteria.getPhone())) && CollectionUtils.isEmpty(criteria.getUuids()))) - employees = repository.fetchEmployees(criteria, requestInfo, stateLevelTenantId); - List uuids = employees.stream().map(Employee :: getUuid).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(uuids)){ - Map UserSearchCriteria = new HashMap<>(); - UserSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_UUID,uuids); - if(mapOfUsers.isEmpty()){ - UserResponse userResponse = userService.getUser(requestInfo, UserSearchCriteria); - if(!CollectionUtils.isEmpty(userResponse.getUser())) { - mapOfUsers = userResponse.getUser().stream() - .collect(Collectors.toMap(User :: getUuid, Function.identity())); - } - } - for(Employee employee: employees){ - employee.setUser(mapOfUsers.get(employee.getUuid())); - } - } - return EmployeeResponse.builder().responseInfo(factory.createResponseInfoFromRequestInfo(requestInfo, true)) - .employees(employees).build(); - } - - - /** - * Creates user by making call to egov-user. - * - * @param employee - * @param requestInfo - */ - private void createUser(Employee employee, RequestInfo requestInfo) { - enrichUser(employee); - UserRequest request = UserRequest.builder().requestInfo(requestInfo).user(employee.getUser()).build(); - try { - UserResponse response = userService.createUser(request); - User user = response.getUser().get(0); - employee.setId(user.getId()); - employee.setUuid(user.getUuid()); - employee.getUser().setId(user.getId()); - employee.getUser().setUuid(user.getUuid()); - }catch(Exception e) { - log.error("Exception while creating user: ",e); - log.error("request: "+request); - throw new CustomException(ErrorConstants.HRMS_USER_CREATION_FAILED_CODE, ErrorConstants.HRMS_USER_CREATION_FAILED_MSG); - } - - } - - /** - * Enriches the user object. - * - * @param employee - */ - private void enrichUser(Employee employee) { - List pwdParams = new ArrayList<>(); - pwdParams.add(employee.getCode()); - pwdParams.add(employee.getUser().getMobileNumber()); - pwdParams.add(employee.getTenantId()); - pwdParams.add(employee.getUser().getName().toUpperCase()); - employee.getUser().setPassword(hrmsUtils.generatePassword(pwdParams)); - employee.getUser().setUserName(employee.getCode()); - employee.getUser().setActive(true); - employee.getUser().setType(UserType.EMPLOYEE.toString()); - } - - /** - * Enriches employee object by setting parent ids to all the child objects - * - * @param employee - * @param requestInfo - */ - private void enrichCreateRequest(Employee employee, RequestInfo requestInfo) { - - AuditDetails auditDetails = AuditDetails.builder() - .createdBy(requestInfo.getUserInfo().getUuid()) - .createdDate(new Date().getTime()) - .build(); - - employee.getJurisdictions().stream().forEach(jurisdiction -> { - jurisdiction.setId(UUID.randomUUID().toString()); - jurisdiction.setAuditDetails(auditDetails); - if(null == jurisdiction.getIsActive()) - jurisdiction.setIsActive(true); - }); - employee.getAssignments().stream().forEach(assignment -> { - assignment.setId(UUID.randomUUID().toString()); - assignment.setAuditDetails(auditDetails); - assignment.setPosition(getPosition()); - }); - if(!CollectionUtils.isEmpty(employee.getServiceHistory())) { - employee.getServiceHistory().stream().forEach(serviceHistory -> { - serviceHistory.setId(UUID.randomUUID().toString()); - serviceHistory.setAuditDetails(auditDetails); - if(null == serviceHistory.getIsCurrentPosition()) - serviceHistory.setIsCurrentPosition(false); - }); - } - if(!CollectionUtils.isEmpty(employee.getEducation())) { - employee.getEducation().stream().forEach(educationalQualification -> { - educationalQualification.setId(UUID.randomUUID().toString()); - educationalQualification.setAuditDetails(auditDetails); - if(null == educationalQualification.getIsActive()) - educationalQualification.setIsActive(true); - }); - } - if(!CollectionUtils.isEmpty(employee.getTests())) { - employee.getTests().stream().forEach(departmentalTest -> { - departmentalTest.setId(UUID.randomUUID().toString()); - departmentalTest.setAuditDetails(auditDetails); - if(null == departmentalTest.getIsActive()) - departmentalTest.setIsActive(true); - }); - } - if(!CollectionUtils.isEmpty(employee.getDocuments())) { - employee.getDocuments().stream().forEach(document -> { - document.setId(UUID.randomUUID().toString()); - document.setAuditDetails(auditDetails); - }); - } - employee.setAuditDetails(auditDetails); - employee.setIsActive(true); - } - - /** - * Fetches next value from the position sequence table - * @return - */ - public Long getPosition() { - return repository.fetchPosition(); - } - - /** - * Service method to update user. Performs the following: - * 1. Enriches the employee object with required parameters. - * 2. Updates user by making call to the user service. - * - * @param employeeRequest - * @return - */ - public EmployeeResponse update(EmployeeRequest employeeRequest) { - - RequestInfo requestInfo = employeeRequest.getRequestInfo(); - String tenantId = employeeRequest.getEmployees().get(0).getTenantId(); - - List uuidList= new ArrayList<>(); - for(Employee employee: employeeRequest.getEmployees()) { - uuidList.add(employee.getUuid()); - } - EmployeeResponse existingEmployeeResponse = search(EmployeeSearchCriteria.builder().uuids(uuidList).tenantId(tenantId).build(),requestInfo); - List existingEmployees = existingEmployeeResponse.getEmployees(); - employeeRequest.getEmployees().stream().forEach(employee -> { - enrichUpdateRequest(employee, requestInfo, existingEmployees); - updateUser(employee, requestInfo); - }); - String hrmsUpdateTopic = propertiesManager.getUpdateEmployeeTopic(); - hrmsProducer.push(tenantId, hrmsUpdateTopic, employeeRequest); - //notificationService.sendReactivationNotification(employeeRequest); - return generateResponse(employeeRequest); - } - - /** - * Updates the user by making call to the user service. - * - * @param employee - * @param requestInfo - */ - private void updateUser(Employee employee, RequestInfo requestInfo) { - UserRequest request = UserRequest.builder().requestInfo(requestInfo).user(employee.getUser()).build(); - try { - userService.updateUser(request); - }catch(Exception e) { - log.error("Exception while updating user: ",e); - log.error("request: "+request); - throw new CustomException(ErrorConstants.HRMS_USER_UPDATION_FAILED_CODE, ErrorConstants.HRMS_USER_UPDATION_FAILED_MSG); - } - - } - - /** - * Enriches update request with required parameters. - * - * @param employee - * @param requestInfo - * @param existingEmployeesData - */ - private void enrichUpdateRequest(Employee employee, RequestInfo requestInfo, List existingEmployeesData) { - AuditDetails auditDetails = AuditDetails.builder() - .createdBy(requestInfo.getUserInfo().getUserName()) - .createdDate(new Date().getTime()) - .build(); - Employee existingEmpData = existingEmployeesData.stream().filter(existingEmployee -> existingEmployee.getUuid().equals(employee.getUuid())).findFirst().get(); - - employee.getUser().setUserName(employee.getCode()); - if(!employee.getIsActive()) - employee.getUser().setActive(false); - else - employee.getUser().setActive(true); - - employee.getJurisdictions().stream().forEach(jurisdiction -> { - - if(null == jurisdiction.getIsActive()) - jurisdiction.setIsActive(true); - if(jurisdiction.getId()==null) { - jurisdiction.setId(UUID.randomUUID().toString()); - jurisdiction.setAuditDetails(auditDetails); - }else{ - if(!existingEmpData.getJurisdictions().stream() - .filter(jurisdictionData ->jurisdictionData.getId().equals(jurisdiction.getId() )) - .findFirst().orElse(null) - .equals(jurisdiction)){ - jurisdiction.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getUserName()); - jurisdiction.getAuditDetails().setLastModifiedDate(new Date().getTime()); - } - } - }); - employee.getAssignments().stream().forEach(assignment -> { - if(assignment.getId()==null) { - assignment.setId(UUID.randomUUID().toString()); - assignment.setAuditDetails(auditDetails); - }else { - if(!existingEmpData.getAssignments().stream() - .filter(assignmentData -> assignmentData.getId().equals(assignment.getId())) - .findFirst().orElse(null) - .equals(assignment)){ - assignment.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getUserName()); - assignment.getAuditDetails().setLastModifiedDate(new Date().getTime()); - } - } - }); - - if(employee.getServiceHistory()!=null){ - employee.getServiceHistory().stream().forEach(serviceHistory -> { - if(null == serviceHistory.getIsCurrentPosition()) - serviceHistory.setIsCurrentPosition(false); - if(serviceHistory.getId()==null) { - serviceHistory.setId(UUID.randomUUID().toString()); - serviceHistory.setAuditDetails(auditDetails); - }else { - if(!existingEmpData.getServiceHistory().stream() - .filter(serviceHistoryData -> serviceHistoryData.getId().equals(serviceHistory.getId())) - .findFirst().orElse(null) - .equals(serviceHistory)){ - serviceHistory.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getUserName()); - serviceHistory.getAuditDetails().setLastModifiedDate(new Date().getTime()); - } - } - }); - - } - - if(employee.getEducation() != null){ - employee.getEducation().stream().forEach(educationalQualification -> { - if(null == educationalQualification.getIsActive()) - educationalQualification.setIsActive(true); - if(educationalQualification.getId()==null) { - educationalQualification.setId(UUID.randomUUID().toString()); - educationalQualification.setAuditDetails(auditDetails); - }else { - - if(!existingEmpData.getEducation().stream() - .filter(educationalQualificationData -> educationalQualificationData.getId().equals(educationalQualification.getId())) - .findFirst().orElse(null) - .equals(educationalQualification)){ - educationalQualification.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getUserName()); - educationalQualification.getAuditDetails().setLastModifiedDate(new Date().getTime()); - } - } - }); - - } - - if(employee.getTests() != null){ - employee.getTests().stream().forEach(departmentalTest -> { - - if(null == departmentalTest.getIsActive()) - departmentalTest.setIsActive(true); - if(departmentalTest.getId()==null) { - departmentalTest.setId(UUID.randomUUID().toString()); - departmentalTest.setAuditDetails(auditDetails); - }else { - if(!existingEmpData.getTests().stream() - .filter(departmentalTestData -> departmentalTestData.getId().equals(departmentalTest.getId())) - .findFirst().orElse(null) - .equals(departmentalTest)){ - departmentalTest.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getUserName()); - departmentalTest.getAuditDetails().setLastModifiedDate(new Date().getTime()); - } - } - }); - - } - - if(employee.getDocuments() != null){ - employee.getDocuments().stream().forEach(document -> { - if(document.getId()==null) { - document.setId(UUID.randomUUID().toString()); - document.setAuditDetails(auditDetails); - }else { - if(!existingEmpData.getDocuments().stream() - .filter(documentData -> documentData.getId().equals(document.getId())) - .findFirst().orElse(null) - .equals(document)){ - document.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getUserName()); - document.getAuditDetails().setLastModifiedDate(new Date().getTime()); - } - } - }); - - } - - if(employee.getDeactivationDetails() != null){ - employee.getDeactivationDetails().stream().forEach(deactivationDetails -> { - if(deactivationDetails.getId()==null) { - deactivationDetails.setId(UUID.randomUUID().toString()); - deactivationDetails.setAuditDetails(auditDetails); - employee.getDocuments().forEach(employeeDocument -> { - employeeDocument.setReferenceId( deactivationDetails.getId()); - }); - }else { - if(!existingEmpData.getDeactivationDetails().stream() - .filter(deactivationDetailsData -> deactivationDetailsData.getId().equals(deactivationDetails.getId())) - .findFirst().orElse(null) - .equals(deactivationDetails)){ - deactivationDetails.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getUserName()); - deactivationDetails.getAuditDetails().setLastModifiedDate(new Date().getTime()); - } - } - }); - - } - if(employee.getReactivationDetails() != null){ - employee.getReactivationDetails().stream().forEach(reactivationDetails -> { - if(reactivationDetails.getId() == null){ - reactivationDetails.setId(UUID.randomUUID().toString()); - reactivationDetails.setAuditDetails(auditDetails); - employee.getDocuments().forEach(employeeDocument -> { - employeeDocument.setReferenceId(reactivationDetails.getId()); - }); - } - else{ - if(!existingEmpData.getReactivationDetails().stream() - .filter(reactivationDetails1 -> reactivationDetails1.getId().equals(reactivationDetails.getId())) - .findFirst().orElse(null) - .equals(reactivationDetails)){ - reactivationDetails.getAuditDetails().setLastModifiedBy(requestInfo.getUserInfo().getUserName()); - reactivationDetails.getAuditDetails().setLastModifiedDate(new Date().getTime()); - } - } - }); - - } - - - } - - private EmployeeResponse generateResponse(EmployeeRequest employeeRequest) { - return EmployeeResponse.builder() - .responseInfo(factory.createResponseInfoFromRequestInfo(employeeRequest.getRequestInfo(), true)) - .employees(employeeRequest.getEmployees()).build(); - } - - public Map getEmployeeCountResponse(RequestInfo requestInfo, String tenantId){ - Map response = new HashMap<>(); - Map results = new HashMap<>(); - ResponseInfo responseInfo = factory.createResponseInfoFromRequestInfo(requestInfo, true); - - response.put("ResponseInfo",responseInfo); - results = repository.fetchEmployeeCount(tenantId); - - if(CollectionUtils.isEmpty(results) || results.get("totalEmployee").equalsIgnoreCase("0")){ - Map error = new HashMap<>(); - error.put("NO_RECORDS","No records found for the tenantId: "+tenantId); - throw new CustomException(error); - } - - response.put("EmployeCount",results); - return response; - } - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/IdGenService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/IdGenService.java deleted file mode 100644 index 4e6420247ce..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/IdGenService.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.egov.hrms.service; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collector; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.hrms.config.PropertiesManager; -import org.egov.hrms.model.Employee; -import org.egov.hrms.repository.RestCallRepository; -import org.egov.hrms.utils.ErrorConstants; -import org.egov.hrms.web.contract.EmployeeRequest; -import org.egov.hrms.web.contract.IdGenerationRequest; -import org.egov.hrms.web.contract.IdGenerationResponse; -import org.egov.hrms.web.contract.IdRequest; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class IdGenService { - - @Autowired - private RestCallRepository repository; - - @Autowired - private PropertiesManager properties; - - /** - * Sets ids to all the employee objects - * - * @param employeeRequest - */ - public void setIds(EmployeeRequest employeeRequest) { - String tenantId = employeeRequest.getEmployees().get(0).getTenantId(); - Integer employeesWithCode = employeeRequest.getEmployees().stream() - .filter(employee -> !StringUtils.isEmpty(employee.getCode())).collect(Collectors.toList()).size(); - if(employeesWithCode == employeeRequest.getEmployees().size()) - return; - IdGenerationResponse response = getId(employeeRequest.getRequestInfo(), tenantId, employeeRequest.getEmployees().size() - employeesWithCode, - properties.getHrmsIdGenKey(), properties.getHrmsIdGenFormat()); - if(null != response) { - int i = 0; - for(Employee employee: employeeRequest.getEmployees()) { - if(StringUtils.isEmpty(employee.getCode())) { - employee.setCode(response.getIdResponses().get(i).getId()); - i++; - } - } - } - } - - /** - * Makes call to the idgen service to fetch ids for the employee object. Format of the id configurable. - * - * @param requestInfo - * @param tenantId - * @param count - * @param name - * @param format - * @return - */ - public IdGenerationResponse getId(RequestInfo requestInfo, String tenantId, Integer count, String name, String format) { - StringBuilder uri = new StringBuilder(); - ObjectMapper mapper = new ObjectMapper(); - uri.append(properties.getIdGenHost()).append(properties.getIdGenEndpoint()); - List reqList = new ArrayList<>(); - for (int i = 0; i < count; i++) { - reqList.add(IdRequest.builder().idName(name).format(format).tenantId(tenantId).build()); - } - IdGenerationRequest request = IdGenerationRequest.builder().idRequests(reqList).requestInfo(requestInfo).build(); - IdGenerationResponse response = null; - try { - response = mapper.convertValue(repository.fetchResult(uri, request), IdGenerationResponse.class); - }catch(Exception e) { - log.error("Exception while generating ids: ",e); - log.error("Request: "+request); - throw new CustomException(ErrorConstants.HRMS_GENERATE_ID_ERROR_CODE,ErrorConstants.HRMS_GENERATE_ID_ERROR_MSG); - - } - return response; - } -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/MDMSService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/MDMSService.java deleted file mode 100644 index 9b2d8df55c3..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/MDMSService.java +++ /dev/null @@ -1,189 +0,0 @@ -package org.egov.hrms.service; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.hrms.utils.HRMSConstants; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.MdmsResponse; -import org.egov.mdms.model.ModuleDetail; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.web.client.RestTemplate; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class MDMSService { - - @Autowired - private RestTemplate restTemplate; - - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsEndpoint; - - - /** - * Builds cache for MDMS data, this gets refreshed for every call. - * - * @param requestInfo - * @param tenantId - * @return - */ - public Map> getMDMSData(RequestInfo requestInfo, String tenantId){ - MdmsResponse response = fetchMDMSData(requestInfo, tenantId); - Map> masterData = new HashMap<>(); - Map> eachMasterMap = new HashMap<>(); - if(null != response) { - if(!CollectionUtils.isEmpty(response.getMdmsRes().keySet())) { - if(null != response.getMdmsRes().get(HRMSConstants.HRMS_MDMS_COMMON_MASTERS_CODE)){ - eachMasterMap = (Map) response.getMdmsRes().get(HRMSConstants.HRMS_MDMS_COMMON_MASTERS_CODE); - masterData.put(HRMSConstants.HRMS_MDMS_DEPT_CODE, eachMasterMap.get(HRMSConstants.HRMS_MDMS_DEPT_CODE)); - masterData.put(HRMSConstants.HRMS_MDMS_DESG_CODE, eachMasterMap.get(HRMSConstants.HRMS_MDMS_DESG_CODE)); - } - if(null != response.getMdmsRes().get(HRMSConstants.HRMS_MDMS_HR_MASTERS_CODE)) { - eachMasterMap = (Map) response.getMdmsRes().get(HRMSConstants.HRMS_MDMS_HR_MASTERS_CODE); - masterData.put(HRMSConstants.HRMS_MDMS_EMP_STATUS_CODE, eachMasterMap.get(HRMSConstants.HRMS_MDMS_EMP_STATUS_CODE)); - masterData.put(HRMSConstants.HRMS_MDMS_EMP_TYPE_CODE, eachMasterMap.get(HRMSConstants.HRMS_MDMS_EMP_TYPE_CODE)); - masterData.put(HRMSConstants.HRMS_MDMS_QUALIFICATION_CODE, eachMasterMap.get(HRMSConstants.HRMS_MDMS_QUALIFICATION_CODE)); - masterData.put(HRMSConstants.HRMS_MDMS_STREAMS_CODE, eachMasterMap.get(HRMSConstants.HRMS_MDMS_STREAMS_CODE)); - masterData.put(HRMSConstants.HRMS_MDMS_DEPT_TEST_CODE, eachMasterMap.get(HRMSConstants.HRMS_MDMS_DEPT_TEST_CODE)); - masterData.put(HRMSConstants.HRMS_MDMS_DEACT_REASON_CODE, eachMasterMap.get(HRMSConstants.HRMS_MDMS_DEACT_REASON_CODE)); - } - if(null != response.getMdmsRes().get(HRMSConstants.HRMS_AC_ROLES_MASTERS_CODE)) { - eachMasterMap = (Map) response.getMdmsRes().get(HRMSConstants.HRMS_AC_ROLES_MASTERS_CODE); - masterData.put(HRMSConstants.HRMS_MDMS_ROLES_CODE, eachMasterMap.get(HRMSConstants.HRMS_MDMS_ROLES_CODE)); - } - } - } - - return masterData; - - } - - - - /** - * Makes call to the MDMS service to fetch the MDMS data. - * - * @param requestInfo - * @param tenantId - * @return - */ - public MdmsResponse fetchMDMSData(RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - MdmsCriteriaReq request = prepareMDMSRequest(uri, requestInfo, tenantId); - MdmsResponse response = null; - try { - response = restTemplate.postForObject(uri.toString(), request, MdmsResponse.class); - }catch(Exception e) { - log.info("Exception while fetching from MDMS: ",e); - log.info("Request: "+ request); - } - return response; - } - - /** - * Makes call to the MDMS service to fetch the MDMS Boundary data. - * - * @param requestInfo - * @param tenantId - * @return - */ - public MdmsResponse fetchMDMSDataLoc(RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - MdmsCriteriaReq request = prepareMDMSRequestLoc(uri, requestInfo, tenantId); - MdmsResponse response = null; - try { - response = restTemplate.postForObject(uri.toString(), request, MdmsResponse.class); - }catch(Exception e) { - log.info("Exception while fetching from MDMS: ",e); - log.info("Request: "+ request); - } - return response; - } - - /** - * Prepares request for MDMS in order to fetch all the required masters for HRMS. - * - * @param uri - * @param requestInfo - * @param tenantId - * @return - */ - public MdmsCriteriaReq prepareMDMSRequest(StringBuilder uri, RequestInfo requestInfo, String tenantId) { - Map> mapOfModulesAndMasters = new HashMap<>(); - String[] hrMasters = {HRMSConstants.HRMS_MDMS_EMP_STATUS_CODE, HRMSConstants.HRMS_MDMS_EMP_TYPE_CODE, HRMSConstants.HRMS_MDMS_QUALIFICATION_CODE, - HRMSConstants.HRMS_MDMS_SERVICE_STATUS_CODE, HRMSConstants.HRMS_MDMS_STREAMS_CODE, HRMSConstants.HRMS_MDMS_DEACT_REASON_CODE, HRMSConstants.HRMS_MDMS_DEPT_TEST_CODE}; - String[] commonMasters = {HRMSConstants.HRMS_MDMS_DEPT_CODE, HRMSConstants.HRMS_MDMS_DESG_CODE, HRMSConstants.HRMS_MDMS_YEAR_CODE}; - String[] accessControlRoles = {HRMSConstants.HRMS_MDMS_ROLES_CODE}; - mapOfModulesAndMasters.put(HRMSConstants.HRMS_MDMS_COMMON_MASTERS_CODE, Arrays.asList(commonMasters)); - mapOfModulesAndMasters.put(HRMSConstants.HRMS_MDMS_HR_MASTERS_CODE, Arrays.asList(hrMasters)); - mapOfModulesAndMasters.put(HRMSConstants.HRMS_AC_ROLES_MASTERS_CODE, Arrays.asList(accessControlRoles)); - List moduleDetails = new ArrayList<>(); - for(String module: mapOfModulesAndMasters.keySet()) { - ModuleDetail moduleDetail = new ModuleDetail(); - moduleDetail.setModuleName(module); - List masterDetails = new ArrayList<>(); - for(String master: mapOfModulesAndMasters.get(module)) { - MasterDetail masterDetail=null; - if(module.equals(HRMSConstants.HRMS_AC_ROLES_MASTERS_CODE)) - masterDetail = MasterDetail.builder().name(master).filter(HRMSConstants.HRMS_MDMS_AC_ROLES_FILTER).build(); - else - masterDetail = MasterDetail.builder().name(master).filter("[?(@.active == true)].code").build(); - masterDetails.add(masterDetail); - } - moduleDetail.setMasterDetails(masterDetails); - moduleDetails.add(moduleDetail); - } - uri.append(mdmsHost).append(mdmsEndpoint); - MdmsCriteria mdmsCriteria = MdmsCriteria.builder().tenantId(tenantId).moduleDetails(moduleDetails).build(); - return MdmsCriteriaReq.builder().requestInfo(requestInfo).mdmsCriteria(mdmsCriteria).build(); - - } - - - /** - * Prepares request for MDMS in order to fetch all the required masters for Boundary Data. - * - * @param uri - * @param requestInfo - * @param tenantId - * @return - */ - public MdmsCriteriaReq prepareMDMSRequestLoc(StringBuilder uri, RequestInfo requestInfo, String tenantId) { - Map> mapOfModulesAndMasters = new HashMap<>(); - String[] egovLoccation = {HRMSConstants.HRMS_MDMS_TENANT_BOUNDARY_CODE}; - mapOfModulesAndMasters.put(HRMSConstants.HRMS_MDMS_EGOV_LOCATION_MASTERS_CODE, Arrays.asList(egovLoccation)); - List moduleDetails = new ArrayList<>(); - for(String module: mapOfModulesAndMasters.keySet()) { - ModuleDetail moduleDetail = new ModuleDetail(); - moduleDetail.setModuleName(module); - List masterDetails = new ArrayList<>(); - for(String master: mapOfModulesAndMasters.get(module)) { - MasterDetail masterDetail=null; - masterDetail = MasterDetail.builder().name(master).build(); - masterDetails.add(masterDetail); - } - moduleDetail.setMasterDetails(masterDetails); - moduleDetails.add(moduleDetail); - } - uri.append(mdmsHost).append(mdmsEndpoint); - MdmsCriteria mdmsCriteria = MdmsCriteria.builder().tenantId(tenantId).moduleDetails(moduleDetails).build(); - return MdmsCriteriaReq.builder().requestInfo(requestInfo).mdmsCriteria(mdmsCriteria).build(); - - } - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java deleted file mode 100644 index d51ece513fc..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/NotificationService.java +++ /dev/null @@ -1,207 +0,0 @@ -package org.egov.hrms.service; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.hrms.model.Employee; -import org.egov.hrms.model.SMSRequest; -import org.egov.hrms.producer.HRMSProducer; -import org.egov.hrms.repository.RestCallRepository; -import org.egov.hrms.utils.HRMSConstants; -import org.egov.hrms.web.contract.EmployeeRequest; -import org.egov.hrms.web.contract.RequestInfoWrapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import com.jayway.jsonpath.JsonPath; - -import lombok.extern.slf4j.Slf4j; - -@Service -@Slf4j -public class NotificationService { - - @Autowired - private HRMSProducer producer; - - @Autowired - private RestCallRepository repository; - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Value("${kafka.topics.notification.sms}") - private String smsTopic; - - @Value("${egov.hrms.employee.app.link}") - private String appLink; - - @Value("${egov.localization.host}") - private String localizationHost; - - @Value("${egov.localization.search.endpoint}") - private String localizationSearchEndpoint; - - @Value("${egov.otp.host}") - private String otpHost; - - @Value("${egov.otp.create.endpoint}") - private String otpCreateEndpoint; - - @Value("${egov.environment.domain}") - private String envHost; - - - - /** - * Sends notification by putting the sms content onto the core-sms topic - * - * @param request - * @param pwdMap - */ - public void sendNotification(EmployeeRequest request, Map pwdMap) { - - String message = getMessage(request,HRMSConstants.HRMS_EMP_CREATE_LOCLZN_CODE); - String tenantId = request.getEmployees().get(0).getTenantId(); - - if(StringUtils.isEmpty(message)) { - log.info("SMS content has not been configured for this case"); - return; - } - for(Employee employee: request.getEmployees()) { - - message = buildMessage(employee, message, pwdMap); - SMSRequest smsRequest = SMSRequest.builder().mobileNumber(employee.getUser().getMobileNumber()).message(message).build(); - producer.push(tenantId, smsTopic, smsRequest); - } - } - - public void sendReactivationNotification(EmployeeRequest request){ - - String message = getMessage(request,HRMSConstants.HRMS_EMP_REACTIVATE_LOCLZN_CODE); - String tenantId = request.getEmployees().get(0).getTenantId(); - if(StringUtils.isEmpty(message)) { - log.info("SMS content has not been configured for this case"); - return; - } - RequestInfo requestInfo = request.getRequestInfo(); - for(Employee employee: request.getEmployees()) { - if(employee.getReactivationDetails()!=null && employee.getReActivateEmployee()){ - String OTP = getOTP(employee,requestInfo); - String link = envHost + "employee/user/otp"; - - message = message.replace("{Employee Name}",employee.getUser().getName()).replace("{Username}",employee.getCode()); - message = message.replace("{date}",(employee.getReactivationDetails().get(0).getEffectiveFrom()).toString()); - message = message.replace("{password}",OTP).replace("{link}",link); - - SMSRequest smsRequest = SMSRequest.builder().mobileNumber(employee.getUser().getMobileNumber()).message(message).build(); - log.info(message); - producer.push(tenantId, smsTopic, smsRequest); - } - - } - - } - - public String getOTP(Employee employee,RequestInfo requestInfo){ - Map OTPRequest= new HashMap<>(); - Map otp= new HashMap<>(); - otp.put("mobileNumber",employee.getUser().getMobileNumber()); - otp.put("type","passwordreset"); - otp.put("tenantId",employee.getTenantId()); - otp.put("userType","EMPLOYEE"); - otp.put("identity",employee.getUser().getMobileNumber()); - - OTPRequest.put("RequestInfo",requestInfo); - OTPRequest.put("otp",otp); - - Object response = null; - StringBuilder url = new StringBuilder(); - url.append(otpHost).append(otpCreateEndpoint); - try { - response = restTemplate.postForObject(url.toString(), OTPRequest, Map.class); - }catch(Exception e) { - log.error("Exception while creating user: ", e); - return null; - } - String result = JsonPath.read(response, "$.otp.otp"); - return result; - } - - /** - * Gets the message from localization - * - * @param request - * @return - */ - public String getMessage(EmployeeRequest request,String msgCode) { - String tenantId = request.getEmployees().get(0).getTenantId().split("\\.")[0]; - Map> localizedMessageMap = getLocalisedMessages(request.getRequestInfo(), tenantId, - HRMSConstants.HRMS_LOCALIZATION_ENG_LOCALE_CODE, HRMSConstants.HRMS_LOCALIZATION_MODULE_CODE); - return localizedMessageMap.get(HRMSConstants.HRMS_LOCALIZATION_ENG_LOCALE_CODE +"|"+tenantId).get(msgCode); - } - - /** - * Builds msg based on the format - * - * @param employee - * @param message - * @param pwdMap - * @return - */ - public String buildMessage(Employee employee, String message, Map pwdMap) { - message = message.replace("$username", employee.getCode()).replace("$password", pwdMap.get(employee.getUuid())) - .replace("$employeename", employee.getUser().getName()); - message = message.replace("$applink", appLink); - return message; - } - - /** - * Creates a cache for localization that gets refreshed at every call. - * - * @param requestInfo - * @param tenantId - * @param locale - * @param module - * @return - */ - public Map> getLocalisedMessages(RequestInfo requestInfo, String tenantId, String locale, String module) { - - Map> localizedMessageMap = new HashMap<>(); - Map mapOfCodesAndMessages = new HashMap<>(); - StringBuilder uri = new StringBuilder(); - RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); - requestInfoWrapper.setRequestInfo(requestInfo); - tenantId = centralInstanceUtil.getStateLevelTenant(tenantId); - uri.append(localizationHost).append(localizationSearchEndpoint).append("?tenantId=" + tenantId) - .append("&module=" + module).append("&locale=" + locale); - List codes = null; - List messages = null; - Object result = null; - try { - result = repository.fetchResult(uri, requestInfoWrapper); - codes = JsonPath.read(result, HRMSConstants.HRMS_LOCALIZATION_CODES_JSONPATH); - messages = JsonPath.read(result, HRMSConstants.HRMS_LOCALIZATION_MSGS_JSONPATH); - } catch (Exception e) { - log.error("Exception while fetching from localization: " + e); - } - if (null != result) { - for (int i = 0; i < codes.size(); i++) { - mapOfCodesAndMessages.put(codes.get(i), messages.get(i)); - } - localizedMessageMap.put(locale + "|" + tenantId, mapOfCodesAndMessages); - } - - return localizedMessageMap; - } - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java deleted file mode 100644 index e238925e3b4..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/service/UserService.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.service; - -import static org.egov.hrms.utils.HRMSConstants.INTERNALMICROSERVICEROLE_CODE; -import static org.egov.hrms.utils.HRMSConstants.INTERNALMICROSERVICEROLE_NAME; -import static org.egov.hrms.utils.HRMSConstants.INTERNALMICROSERVICEUSER_MOBILENO; -import static org.egov.hrms.utils.HRMSConstants.INTERNALMICROSERVICEUSER_NAME; -import static org.egov.hrms.utils.HRMSConstants.INTERNALMICROSERVICEUSER_TYPE; -import static org.egov.hrms.utils.HRMSConstants.INTERNALMICROSERVICEUSER_USERNAME; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.PostConstruct; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.common.contract.request.User; -import org.egov.common.utils.MultiStateInstanceUtil; -import org.egov.hrms.config.PropertiesManager; -import org.egov.hrms.repository.RestCallRepository; -import org.egov.hrms.utils.HRMSConstants; -import org.egov.hrms.web.contract.UserRequest; -import org.egov.hrms.web.contract.UserResponse; -import org.egov.tracer.model.CustomException; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class UserService { - - @Autowired - private PropertiesManager propertiesManager; - - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private RestCallRepository restCallRepository; - - @Autowired - private MultiStateInstanceUtil centralInstanceUtil; - - @Value("${egov.user.create.endpoint}") - private String userCreateEndpoint; - - @Value("${egov.user.search.endpoint}") - private String userSearchEndpoint; - - @Value("${egov.user.update.endpoint}") - private String userUpdateEndpoint; - - private String internalMicroserviceRoleUuid = null; - - @Autowired - private MultiStateInstanceUtil multiStateInstanceUtil; - - public static final String TENANTID_MDC_STRING = "TENANTID"; - - - @PostConstruct - void initalizeSystemuser(){ - RequestInfo requestInfo = new RequestInfo(); - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserSearchEndpoint()); // URL for user search call - Map userSearchRequest = new HashMap<>(); - userSearchRequest.put("RequestInfo", requestInfo); - userSearchRequest.put("tenantId", propertiesManager.getStateLevelTenantId()); - userSearchRequest.put("roleCodes", Collections.singletonList(INTERNALMICROSERVICEROLE_CODE)); - if(multiStateInstanceUtil.getIsEnvironmentCentralInstance()){ - MDC.put(TENANTID_MDC_STRING, propertiesManager.getStateLevelTenantId()); - } - try { - LinkedHashMap responseMap = (LinkedHashMap) restCallRepository.fetchResult(uri, userSearchRequest); - List> users = (List>) responseMap.get("user"); - if(users.size()==0) - createInternalMicroserviceUser(requestInfo); - internalMicroserviceRoleUuid = (String) users.get(0).get("uuid"); - }catch (Exception e) { - throw new CustomException("EG_USER_SEARCH_ERROR", "Service returned null while fetching user"); - } - - } - - private void createInternalMicroserviceUser(RequestInfo requestInfo){ - Map userCreateRequest = new HashMap<>(); - //Creating role with INTERNAL_MICROSERVICE_ROLE - Role role = Role.builder() - .name(INTERNALMICROSERVICEROLE_NAME).code(INTERNALMICROSERVICEROLE_CODE) - .tenantId(propertiesManager.getStateLevelTenantId()).build(); - User user = User.builder().userName(INTERNALMICROSERVICEUSER_USERNAME) - .name(INTERNALMICROSERVICEUSER_NAME).mobileNumber(INTERNALMICROSERVICEUSER_MOBILENO) - .type(INTERNALMICROSERVICEUSER_TYPE).tenantId(propertiesManager.getStateLevelTenantId()) - .roles(Collections.singletonList(role)).id(0L).build(); - - userCreateRequest.put("RequestInfo", requestInfo); - userCreateRequest.put("user", user); - - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserCreateEndpoint()); // URL for user create call - - try { - LinkedHashMap responseMap = (LinkedHashMap) restCallRepository.fetchResult(uri, userCreateRequest); - List> users = (List>) responseMap.get("user"); - internalMicroserviceRoleUuid = (String) users.get(0).get("uuid"); - }catch (Exception e) { - throw new CustomException("EG_USER_CRETE_ERROR", "Service returned throws error while creating user"); - } - } - - public UserResponse createUser(UserRequest userRequest) { - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserCreateEndpoint()); - UserResponse userResponse = null; - try { - userResponse = userCall(userRequest,uri); - }catch(Exception e) { - log.error("User created failed: ",e); - } - - return userResponse; - } - - public UserResponse updateUser(UserRequest userRequest) { - StringBuilder uri = new StringBuilder(); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserUpdateEndpoint()); - UserResponse userResponse = null; - try { - userResponse = userCall(userRequest,uri); - }catch(Exception e) { - log.error("User created failed: ",e); - } - - return userResponse; - } - - public UserResponse getUser(RequestInfo requestInfo, Map userSearchCriteria ) { - StringBuilder uri = new StringBuilder(); - Map userSearchReq = new HashMap<>(); - User userInfoCopy = requestInfo.getUserInfo(); - - if(propertiesManager.getIsDecryptionEnable()){ - User enrichedUserInfo = getEncrichedandCopiedUserInfo(String.valueOf(userSearchCriteria.get("tenantId"))); - requestInfo.setUserInfo(enrichedUserInfo); - } - - userSearchReq.put("RequestInfo", requestInfo); - userSearchReq.put(HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE,HRMSConstants.HRMS_USER_SERACH_CRITERIA_USERTYPE); - for( String key: userSearchCriteria.keySet()) - userSearchReq.put(key, userSearchCriteria.get(key)); - uri.append(propertiesManager.getUserHost()).append(propertiesManager.getUserSearchEndpoint()); - UserResponse userResponse = new UserResponse(); - try { - userResponse = userCall(userSearchReq,uri); - }catch(Exception e) { - log.error("User search failed: ",e); - } - if(propertiesManager.getIsDecryptionEnable()) - requestInfo.setUserInfo(userInfoCopy); - - return userResponse; - } - - private User getEncrichedandCopiedUserInfo(String tenantId){ - //Creating role with INTERNAL_MICROSERVICE_ROLE - Role role = Role.builder() - .name(INTERNALMICROSERVICEROLE_NAME).code(INTERNALMICROSERVICEROLE_CODE) - .tenantId(centralInstanceUtil.getStateLevelTenant(tenantId)).build(); - - //Creating userinfo with uuid and role of internal micro service role - User userInfo = User.builder() - .uuid(internalMicroserviceRoleUuid) - .type(INTERNALMICROSERVICEUSER_TYPE) - .roles(Collections.singletonList(role)).id(0L).build(); - - return userInfo; - } - - - /** - * Returns UserDetailResponse by calling user service with given uri and object - * @param userRequest Request object for user service - * @param uri The address of the endpoint - * @return Response from user service as parsed as userDetailResponse - */ - @SuppressWarnings("all") - private UserResponse userCall(Object userRequest, StringBuilder uri) { - String dobFormat = null; - if(uri.toString().contains(userSearchEndpoint) || uri.toString().contains(userUpdateEndpoint)) - dobFormat="yyyy-MM-dd"; - else if(uri.toString().contains(userCreateEndpoint)) - dobFormat = "dd/MM/yyyy"; - try{ - LinkedHashMap responseMap = (LinkedHashMap) restCallRepository.fetchResult(uri, userRequest); - parseResponse(responseMap,dobFormat); - UserResponse userDetailResponse = objectMapper.convertValue(responseMap,UserResponse.class); - return userDetailResponse; - } - catch(IllegalArgumentException e) { - throw new CustomException("IllegalArgumentException","ObjectMapper not able to convertValue in userCall"); - } - } - - - /** - * Parses date formats to long for all users in responseMap - * @param responeMap LinkedHashMap got from user api response - * @param dobFormat dob format (required because dob is returned in different format's in search and create response in user service) - */ - @SuppressWarnings("all") - private void parseResponse(LinkedHashMap responeMap,String dobFormat){ - List users = (List)responeMap.get("user"); - String format1 = "dd-MM-yyyy HH:mm:ss"; - if(users!=null){ - users.forEach( map -> { - map.put("createdDate",dateTolong((String)map.get("createdDate"),format1)); - if((String)map.get("lastModifiedDate")!=null) - map.put("lastModifiedDate",dateTolong((String)map.get("lastModifiedDate"),format1)); - if((String)map.get("dob")!=null) - map.put("dob",dateTolong((String)map.get("dob"),dobFormat)); - if((String)map.get("pwdExpiryDate")!=null) - map.put("pwdExpiryDate",dateTolong((String)map.get("pwdExpiryDate"),format1)); - } - ); - } - } - - /** - * Converts date to long - * @param date date to be parsed - * @param format Format of the date - * @return Long value of date - */ - private Long dateTolong(String date,String format){ - SimpleDateFormat f = new SimpleDateFormat(format); - Date d = null; - try { - d = f.parse(date); - } catch (ParseException e) { - e.printStackTrace(); - } - return d.getTime(); - } - - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ErrorConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ErrorConstants.java deleted file mode 100644 index b50975fa6d1..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ErrorConstants.java +++ /dev/null @@ -1,202 +0,0 @@ -package org.egov.hrms.utils; - -import org.springframework.stereotype.Component; - -@Component -public class ErrorConstants { - - public static final String HRMS_USER_EXIST_MOB_CODE = "ERR_HRMS_USER_EXIST_MOB"; - public static final String HRMS_USER_EXIST_MOB_MSG = "User already exists for the entered mobile number. Use a different mobile number to proceed."; - - public static final String HRMS_USER_EXIST_USERNAME_CODE = "ERR_HRMS_USER_EXIST_USERNAME"; - public static final String HRMS_USER_EXIST_USERNAME_MSG = "User already exists for the entered user name."; - - public static final String HRMS_INVALID_MOB_NO_CODE = "ERR_HRMS_INVALID_MOB_NO"; - public static final String HRMS_INVALID_MOB_NO_MSG = "Invalid mobile number entered."; - - public static final String HRMS_MISSING_ROLES_CODE = "ERR_HRMS_MISSING_ROLES"; - public static final String HRMS_INVALID_ROLES_MSG = "Invalid mobile number entered."; - - public static final String HRMS_INVALID_ROLE_CODE = "ERR_HRMS_INVALID_ROLE"; - public static final String HRMS_INVALID_ROLE_MSG = "Invalid role assigned to the employee."; - - public static final String HRMS_INVALID_EMP_STATUS_CODE = "ERR_HRMS_INVALID_EMP_STATUS_ROLE"; - public static final String HRMS_INVALID_EMP_STATUS_MSG = "Invalid employment status entered."; - - public static final String HRMS_INVALID_EMP_TYPE_CODE = "ERR_HRMS_INVALID_EMP_TYPE"; - public static final String HRMS_INVALID_EMP_TYPE_MSG = "Invalid employee type entered."; - - public static final String HRMS_INVALID_DATE_OF_APPOINTMENT_CODE = "ERR_HRMS_INVALID_DATE_OF_APPOINTMENT"; - public static final String HRMS_INVALID_DATE_OF_APPOINTMENT_MSG = "Invalid employee date of appointment entered by the user."; - - public static final String HRMS_INVALID_DATE_OF_APPOINTMENT_DOB_CODE = "ERR_HRMS_INVALID_DATE_OF_APPOINTMENT_DOB"; - public static final String HRMS_INVALID_DATE_OF_APPOINTMENT_DOB_MSG = "Employee date of appointment can not be before date of birth."; - - public static final String HRMS_INVALID_DOB_CODE = "ERR_HRMS_INVALID_DOB"; - public static final String HRMS_INVALID_DOB_MSG = "Invalid date of birth entered."; - - public static final String HRMS_INVALID_CURRENT_ASSGN_CODE = "ERR_HRMS_INVALID_CURRENT_ASSGN"; - public static final String HRMS_INVALID_CURRENT_ASSGN_MSG = "There should be exactly one current assignment for the employee."; - - public static final String HRMS_OVERLAPPING_ASSGN_CODE = "ERR_HRMS_OVERLAPPING_ASSGN"; - public static final String HRMS_OVERLAPPING_ASSGN_MSG = "There should not be overlapping period of assignments for the employee."; - - public static final String HRMS_OVERLAPPING_ASSGN_CURRENT_CODE = "ERR_HRMS_OVERLAPPING_ASSGN_CURRENT"; - public static final String HRMS_OVERLAPPING_ASSGN_CURRENT_MSG = "Period of assignements of employee should not be after current assignment."; - - public static final String HRMS_INVALID_DEPT_CODE = "ERR_HRMS_INVALID_DEPT"; - public static final String HRMS_INVALID_DEPT_MSG = "Invalid department of employee entered."; - - public static final String HRMS_INVALID_DESG_CODE = "ERR_HRMS_INVALID_DESG"; - public static final String HRMS_INVALID_DESG_MSG = "Invalid designation of employee."; - - public static final String HRMS_INVALID_ASSIGNMENT_PERIOD_CODE = "ERR_HRMS_INVALID_ASSIGNMENT_PERIOD"; - public static final String HRMS_INVALID_ASSIGNMENT_PERIOD_MSG = "Invalid period of assignment (From date - To date)."; - - public static final String HRMS_INVALID_ASSIGNMENT_CURRENT_TO_DATE_CODE = "ERR_HRMS_INVALID_ASSIGNMENT_CURRENT_TO_DATE"; - public static final String HRMS_INVALID_ASSIGNMENT_CURRENT_TO_DATE_MSG = "To Date field should be blank for current assignment of the employee."; - - public static final String HRMS_OVERLAPPING_SERVICEHISTORY_CURRENT_CODE = "ERR_HRMS_OVERLAPPING_SERVICEHISTORY_CURRENT"; - public static final String HRMS_OVERLAPPING_SERVICEHISTORY_CURRENT_MSG = "Period of service details of employee should not be after current assignment!"; - - - public static final String HRMS_INVALID_ASSIGNMENT_NON_CURRENT_TO_DATE_CODE = "ERR_HRMS_INVALID_ASSIGNMENT_NOT_CURRENT_TO_DATE"; - public static final String HRMS_INVALID_ASSIGNMENT_NON_CURRENT_TO_DATE_MSG = "To date field should not be blank for non current assignment of the employee."; - - public static final String HRMS_INVALID_ASSIGNMENT_DATES_CODE = "ERR_HRMS_INVALID_ASSIGNMENT_DATES"; - public static final String HRMS_INVALID_ASSIGNMENT_DATES_MSG = "Employee period of assignment (From Date or To date) can not be before date of birth."; - - public static final String HRMS_INVALID_ASSIGNMENT_DATES_APPOINTMENT_CODE = "ERR_HRMS_INVALID_ASSIGNMENT_DATES_APPOINTMENT"; - public static final String HRMS_INVALID_ASSIGNMENT_DATES_APPOINTMENT_MSG = "Employee period of assignment (From Date or To date) can not be before date of appointment."; - - public static final String HRMS_INVALID_SERVICE_STATUS_CODE = "ERR_HRMS_INVALID_SERVICE_STATUS"; - public static final String HRMS_INVALID_SERVICE_STATUS_MSG = "Service stataus of employee is invalid."; - - public static final String HRMS_INVALID_SERVICE_PERIOD_CODE = "ERR_HRMS_INVALID_SERVICE_PERIOD"; - public static final String HRMS_INVALID_SERVICE_PERIOD_MSG = "Service period (From date or To date) of employee is invalid."; - - public static final String HRMS_INVALID_SERVICE_DATES_CODE = "ERR_HRMS_INVALID_SERVICE_DATES"; - public static final String HRMS_INVALID_SERVICE_DATES_MSG = "Employee service period (From date or To date) can not be before date of birth."; - - public static final String HRMS_INVALID_SERVICE_CURRENT_TO_DATE_CODE = "ERR_HRMS_INVALID_SERVICE_CURRENT_TO_DATE"; - public static final String HRMS_INVALID_SERVICE_CURRENT_TO_DATE_MSG = "To Date of service period should be blank for currently working employees."; - - public static final String HRMS_INVALID_SERVICE_NON_CURRENT_TO_DATE_CODE = "ERR_HRMS_INVALID_SERVICE_NOT_CURRENT_TO_DATE"; - public static final String HRMS_INVALID_SERVICE_NON_CURRENT_TO_DATE_MSG = "To Date of service period should not be blank for currently non working employees."; - - public static final String HRMS_INVALID_CURRENT_SERVICE_CODE = "ERR_HRMS_INVALID_SERVICE_ASSGN"; - public static final String HRMS_INVALID_CURRENT_SERVICE_MSG = "There should be maximum one currently working service for the employee."; - - public static final String HRMS_INVALID_QUALIFICATION_CODE = "ERR_HRMS_INVALID_QUALIFICATION"; - public static final String HRMS_INVALID_QUALIFICATION_MSG = "Qualification of the employee is invalid."; - - public static final String HRMS_INVALID_EDUCATIONAL_STREAM_CODE = "ERR_HRMS_INVALID_EDUCATIONAL_STREAM"; - public static final String HRMS_INVALID_EDUCATIONAL_STREAM_MSG = "Education stream of the employee is invalid."; - - public static final String HRMS_INVALID_EDUCATIONAL_PASSING_YEAR_CODE = "ERR_HRMS_INVALID_EDUCATIONAL_PASSING_YEAR"; - public static final String HRMS_INVALID_EDUCATIONAL_PASSING_YEAR_MSG = "Education year of passing of the employee can not be before date of birth."; - - public static final String HRMS_INVALID_DEPARTMENTAL_TEST_CODE = "ERR_HRMS_INVALID_DEPARTMENTAL_TEST"; - public static final String HRMS_INVALID_DEPARTMENTAL_TEST_MSG = "Departmental evaluation test of the employee is invalid."; - - public static final String HRMS_INVALID_DEPARTMENTAL_TEST_PASSING_YEAR_CODE = "ERR_HRMS_INVALID_DEPARTMENTAL_TEST_PASSING_YEAR"; - public static final String HRMS_INVALID_DEPARTMENTAL_TEST_PASSING_YEAR_MSG = "Departmental evaluation test passing year of the employee can not be before date of birth."; - - public static final String HRMS_INVALID_DEACT_REQUEST_CODE = "ERR_HRMS_INVALID_DEACT_REQUEST"; - public static final String HRMS_INVALID_DEACT_REQUEST_MSG = "Employee active flag should be set as false during deactivation."; - - public static final String HRMS_INVALID_DEACT_REASON_CODE = "ERR_HRMS_INVALID_DEACT_REASON"; - public static final String HRMS_INVALID_DEACT_REASON_MSG = "Employee deactivation reason is invalid."; - - public static final String HRMS_UPDATE_JURISDICTION_INCOSISTENT_CODE = "ERR_HRMS_UPDATE_JURISDICTION_INCOSISTENT"; - public static final String HRMS_UPDATE_JURISDICTION_INCOSISTENT_MSG = "Jurisdiction data in an update request should contain all previously entered data."; - - public static final String HRMS_UPDATE_ASSIGNEMENT_INCOSISTENT_CODE = "ERR_HRMS_UPDATE_ASSIGNEMENT_INCOSISTENT"; - public static final String HRMS_UPDATE_ASSIGNEMENT_INCOSISTENT_MSG = "Assignment data in an update request should contain all previously entered data."; - - public static final String HRMS_UPDATE_TESTS_INCOSISTENT_CODE = "ERR_HRMS_UPDATE_TESTS_INCOSISTENT"; - public static final String HRMS_UPDATE_TESTS_INCOSISTENT_MSG = "Employee evaluation test data in an update request should contain all previously entered data."; - - public static final String HRMS_UPDATE_EDUCATION_INCOSISTENT_CODE = "ERR_HRMS_UPDATE_EDUCATION_INCOSISTENT"; - public static final String HRMS_UPDATE_EDUCATION_INCOSISTENT_MSG = "Education data in an update request should contain all previously entered data."; - - public static final String HRMS_UPDATE_SERVICE_HISTORY_INCOSISTENT_CODE = "ERR_HRMS_UPDATE_SERVICE_HISTORY_INCOSISTENT"; - public static final String HRMS_UPDATE_SERVICE_HISTORY_INCOSISTENT_MSG = "Service history data in an update request should contain all previously entered data."; - - public static final String HRMS_UPDATE_DOCUMENT_INCOSISTENT_CODE = "ERR_HRMS_UPDATE_DOCUMENT_INCOSISTENT"; - public static final String HRMS_UPDATE_DOCUMENT_INCOSISTENT_MSG = "Employee document data in an update request should contain all previously entered data."; - - public static final String HRMS_UPDATE_DEACT_DETAILS_INCOSISTENT_CODE = "ERR_HRMS_UPDATE_DEACT_DETAILS_INCOSISTENT"; - public static final String HRMS_UPDATE_DEACT_DETAILS_INCOSISTENT_MSG = "Employee deactivation data in an update request should contain all previously entered data."; - - public static final String HRMS_UPDATE_NULL_ID_CODE = "ERR_HRMS_UPDATE_NULL_ID"; - public static final String HRMS_UPDATE_NULL_ID_MSG = "Employee ID in an update request should not be null."; - - public static final String HRMS_UPDATE_NULL_CODE_CODE = "ERR_HRMS_UPDATE_NULL"; - public static final String HRMS_UPDATE_NULL_CODE_MSG = "Employee Code in an update request should not be null."; - - public static final String HRMS_UPDATE_NULL_UUID_CODE = "ERR_HRMS_UPDATE_NULL_UUID"; - public static final String HRMS_UPDATE_NULL_UUID_MSG = "Employee UUID in an update request should not be null."; - - public static final String HRMS_USER_CREATION_FAILED_CODE = "ERR_HRMS_USER_CREATION_FAILED"; - public static final String HRMS_USER_CREATION_FAILED_MSG = "User creation failed at the user service."; - - public static final String HRMS_USER_UPDATION_FAILED_CODE = "ERR_HRMS_USER_UPDATION_FAILED"; - public static final String HRMS_USER_UPDATION_FAILED_MSG = "User updation failed at the user service."; - - public static final String HRMS_INVALID_SEARCH_REQ_CODE = "ERR_HRMS_INVALID_SEARCH_REQ"; - public static final String HRMS_INVALID_SEARCH_REQ_MSG = "Open search is disabled for this user."; - - public static final String HRMS_INVALID_JURISDICTION_HEIRARCHY_CODE = "ERR_HRMS_INVALID_JURISDICTION_HEIRARCHY"; - public static final String HRMS_INVALID_JURISDICTION_HEIRARCHY_MSG = "Jurisiction hierarchy value is invalid."; - - public static final String HRMS_INVALID_JURISDICTION_BOUNDARY_TYPE_CODE = "ERR_HRMS_INVALID_BOUNDARY_TYPE_HEIRARCHY"; - public static final String HRMS_INVALID_JURISDICTION_BOUNDARY_TYPE_MSG = "Jurisiction boundary type value is invalid."; - - public static final String HRMS_INVALID_JURISDICTION_BOUNDARY_CODE = "ERR_HRMS_INVALID_JURISDICTION_BOUNDARY"; - public static final String HRMS_INVALID_JURISDICTION_BOUNDARY_MSG = "Jurisiction boundary value is invalid."; - - public static final String HRMS_INVALID_JURISDICTION_ACTIIEV_NULL_CODE = "ERR_HRMS_INVALID_JURISDICTION_ACTIIEV_NULL"; - public static final String HRMS_INVALID_JURISDICTION_ACTIIEV_NULL_MSG = "Jurisiction should have atleast 1 active data"; - - public static final String HRMS_INVALID_SEARCH_AOD_CODE = "ERR_HRMS_INVALID_SEARCH_AOD"; - public static final String HRMS_INVALID_SEARCH_AOD_MSG = "Along with as on date, atleast one department and designation need to be passed as search criteria."; - - public static final String HRMS_INVALID_SEARCH_ROLES_CODE = "ERR_HRMS_INVALID_SEARCH_ROLES"; - public static final String HRMS_INVALID_SEARCH_ROLES_MSG = "For search based on roles, passing of tenant id is mandatory."; - - public static final String HRMS_INVALID_SEARCH_USER_CODE = "ERR_HRMS_INVALID_SEARCH_USER"; - public static final String HRMS_INVALID_SEARCH_USER_MSG = "For search based on phone number and name, passing of tenant id is mandatory."; - - public static final String HRMS_UPDATE_EMPLOYEE_CODE_CHANGE_CODE = "ERR_HRMS_UPDATE_EMPLOYEE_CODE_CHANGE"; - public static final String HRMS_UPDATE_EMPLOYEE_CODE_CHANGE_MSG = "Employee code can not be changed in an update request."; - public static final String HRMS_UPDATE_EMPLOYEE_NOT_EXIST_CODE = "ERR_HRMS_UPDATE_EMPLOYEE_NOT_EXIST_CODE"; - public static final String HRMS_UPDATE_EMPLOYEE_NOT_EXIST_MSG = "No employee found for given UUID."; - - public static final String HRMS_UPDATE_EXISTING_MOBNO_CODE = "ERR_HRMS_UPDATE_EXISTING_MOBNO"; - public static final String HRMS_UPDATE_EXISTING_MOBNO_MSG = "User exist for given mobile no"; - - public static final String HRMS_BULK_CREATE_DUPLICATE_MOBILE_CODE = "ERR_HRMS_BULK_CREATE_DUPLICATE_MOBILE"; - public static final String HRMS_BULK_CREATE_DUPLICATE_MOBILE_MSG = "Bulk request has duplicate mobile number "; - - public static final String HRMS_BULK_CREATE_DUPLICATE_EMPCODE_CODE = "ERR_HRMS_BULK_CREATE_DUPLICATE_EMPCODE"; - public static final String HRMS_BULK_CREATE_DUPLICATE_EMPCODE_MSG = "Bulk request has duplicate employee code "; - - public static final String HRMS_UPDATE_DEACT_DETAILS_INCORRECT_EFFECTIVEFROM_CODE = "ERR_HRMS_UPDATE_DEACT_DETAILS_INCORRECT_EFFECTIVEFROM"; - public static final String HRMS_UPDATE_DEACT_DETAILS_INCORRECT_EFFECTIVEFROM_MSG = "Employee deactivation effective date should be current date only."; - - public static final String HRMS_GENERATE_ID_ERROR_CODE = "ERR_HRMS_GENERATE_ID_ERROR"; - public static final String HRMS_GENERATE_ID_ERROR_MSG = "Unable to create ids " ; - - public static final String HRMS_EMPLOYEE_COUNT_ERROR_CODE = "ERR_HRMS_COUNT_EMP"; - public static final String HRMS_EMPLOYEE_COUNT_ERROR_MSG = "Please provide tenantid to get count of the employee"; - - public static final String HRMS_UPDATE_REACT_DETAILS_INCORRECT_EFFECTIVEFROM_CODE = "ERR_HRMS_UPDATE_REACT_DETAILS_INCORRECT_EFFECTIVEFROM"; - public static final String HRMS_UPDATE_REACT_DETAILS_INCORRECT_EFFECTIVEFROM_MSG = "Employee reactivation effective date should be between deactivation date and current date."; - - public static final String CITIZEN_TYPE_CODE = "CITIZEN"; - - public static final String HRMS_INVALID_SEARCH_CITIZEN_CODE = "ERR_HRMS_INVALID_SEARCH_CITIZEN"; - public static final String HRMS_INVALID_SEARCH_CITIZEN_MSG = "Citizen are not allowed to access employee search with Ids."; - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java deleted file mode 100644 index 878bd5fe52b..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSConstants.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.egov.hrms.utils; - -import org.springframework.stereotype.Component; - -@Component -public class HRMSConstants { - - public static final String HRMS_MDMS_COMMON_MASTERS_CODE = "common-masters"; - public static final String HRMS_MDMS_HR_MASTERS_CODE = "egov-hrms"; - public static final String HRMS_AC_ROLES_MASTERS_CODE = "ACCESSCONTROL-ROLES"; - public static final String HRMS_MDMS_EGOV_LOCATION_MASTERS_CODE = "egov-location"; - - public static final String HRMS_MDMS_DEPT_CODE = "Department"; - public static final String HRMS_MDMS_DESG_CODE = "Designation"; - public static final String HRMS_MDMS_EMP_STATUS_CODE = "EmployeeStatus"; - public static final String HRMS_MDMS_EMP_TYPE_CODE = "EmployeeType"; - public static final String HRMS_MDMS_SERVICE_STATUS_CODE = "ServiceStatus"; - public static final String HRMS_MDMS_ROLES_CODE = "roles"; - public static final String HRMS_MDMS_QUALIFICATION_CODE = "Degree"; - public static final String HRMS_MDMS_STREAMS_CODE = "Specalization"; - public static final String HRMS_MDMS_YEAR_CODE = "Year"; - public static final String HRMS_MDMS_DEPT_TEST_CODE = "EmploymentTest"; - public static final String HRMS_MDMS_DEACT_REASON_CODE = "DeactivationReason"; - public static final String HRMS_MDMS_TENANT_BOUNDARY_CODE = "TenantBoundary"; - - public static final String HRMS_LOCALIZATION_CODES_JSONPATH = "$.messages.*.code"; - public static final String HRMS_LOCALIZATION_MSGS_JSONPATH = "$.messages.*.message"; - - - public static final String HRMS_EMP_CREATE_LOCLZN_CODE = "hrms.employee.create.notification"; - public static final String HRMS_EMP_REACTIVATE_LOCLZN_CODE = "hrms.employee.reactivation.notification"; - public static final String HRMS_LOCALIZATION_MODULE_CODE = "egov-hrms"; - public static final String HRMS_LOCALIZATION_ENG_LOCALE_CODE = "en_IN"; - public static final String HRMS_TENANTBOUNDARY_HIERARCHY_JSONPATH = "$.TenantBoundary[?(@.boundary.code ==\"%s\")].hierarchyType.code"; - public static final String HRMS_TENANTBOUNDARY_BOUNDARY_TYPE_JSONPATH ="$.TenantBoundary[?(@.hierarchyType.name==\"%1$s\" && @.boundary.code ==\"%2$s\")]..label"; - public static final String HRMS_TENANTBOUNDARY_BOUNDARY_VALUE_JSONPATH ="$.TenantBoundary[?(@.hierarchyType.name==\"%1$s\" && @.boundary.code ==\"%2$s\")]..code"; - - public static final String HRMS_MDMS_AC_ROLES_FILTER = "[?(@.code != \"CITIZEN\")].code"; - public static final String HRMS_MDMS_CODE_FLITER = "[?(@.active == true)].code"; - - public static final String HRMS_USER_SEARCH_CRITERA_UUID = "uuid"; - public static final String HRMS_USER_SEARCH_CRITERA_ROLECODES = "roleCodes"; - public static final String HRMS_USER_SEARCH_CRITERA_TENANTID = "tenantId"; - public static final String HRMS_USER_SEARCH_CRITERA_MOBILENO = "mobileNumber"; - public static final String HRMS_USER_SEARCH_CRITERA_NAME = "name"; - public static final String HRMS_USER_SEARCH_CRITERA_USERNAME = "UserName"; - public static final String HRMS_USER_SERACH_CRITERIA_USERTYPE = "EMPLOYEE"; - public static final String HRMS_USER_SERACH_CRITERIA_USERTYPE_CODE = "userType"; - - public static final String INTERNALMICROSERVICEROLE_NAME = "Internal Microservice Role"; - - public static final String INTERNALMICROSERVICEROLE_CODE = "INTERNAL_MICROSERVICE_ROLE"; - - public static final String INTERNALMICROSERVICEUSER_NAME = "Internal Microservice User"; - - public static final String INTERNALMICROSERVICEUSER_USERNAME = "INTERNAL_USER"; - - public static final String INTERNALMICROSERVICEUSER_MOBILENO = "9999999999"; - - public static final String INTERNALMICROSERVICEUSER_TYPE = "SYSTEM"; - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java deleted file mode 100644 index 1064280e1f0..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/HRMSUtils.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.egov.hrms.utils; - -import java.security.SecureRandom; -import java.util.List; - -import org.egov.hrms.web.contract.EmployeeSearchCriteria; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class HRMSUtils { - - @Value("${egov.hrms.default.pwd.length}") - private Integer pwdLength; - - @Value("${egov.pwd.allowed.special.characters}") - private String allowedPasswordSpecialCharacters; - - /** - * Generates random password for the user to login. Process: - * 1. Takes a list of parameters for password - * 2. Applies a random select logic and generates a password of constant length. - * 3. The length of the password is configurable. - * - * @param params - * @return - */ - public String generatePassword(List params) { - StringBuilder password = new StringBuilder(); - SecureRandom random = new SecureRandom(); - params.add(allowedPasswordSpecialCharacters); - try { - for(int i = 0; i < params.size(); i++) { - String param = params.get(i); - String val; - if(param.length() == 1) - val = param; - else - val = param.split("")[random.nextInt(param.length() - 1)]; - if(val.equals(".") || val.equals("-") || val.equals(" ")) - password.append("x"); - else - password.append(val); - if(password.length() == pwdLength) - break; - else { - if(i == params.size() - 1) - i = 0; - } - } - }catch(Exception e) { - password.append("123456"); - } - - return password.toString().replaceAll("\\s+", ""); - } - - public boolean isAssignmentSearchReqd(EmployeeSearchCriteria criteria) { - return (! CollectionUtils.isEmpty(criteria.getPositions()) || null != criteria.getAsOnDate() - || !CollectionUtils.isEmpty(criteria.getDepartments()) || !CollectionUtils.isEmpty(criteria.getDesignations())); - } - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ResponseInfoFactory.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ResponseInfoFactory.java deleted file mode 100644 index e82744a00c0..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/utils/ResponseInfoFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.egov.hrms.utils; - - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.stereotype.Component; - -@Component -public class ResponseInfoFactory { - - public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { - - final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; - final String ver = requestInfo != null ? requestInfo.getVer() : ""; - Long ts = null; - if(requestInfo!=null) - ts= requestInfo.getTs(); - final String resMsgId = "uief87324"; // FIXME : Hard-coded - final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; - final String responseStatus = success ? "successful" : "failed"; - - return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) - .status(responseStatus).build(); - } - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeRequest.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeRequest.java deleted file mode 100644 index 87b2b42d207..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeRequest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.web.contract; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.hrms.model.Employee; -import org.hibernate.validator.constraints.NotEmpty; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Validated -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class EmployeeRequest { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @Valid - @NotEmpty - @JsonProperty("Employees") - private List employees; - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeResponse.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeResponse.java deleted file mode 100644 index 6fb5141aeed..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeResponse.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.web.contract; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; -import org.egov.hrms.model.Employee; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Builder -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -public class EmployeeResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Employees") - private List employees; - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java deleted file mode 100644 index 9cc303bda97..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/EmployeeSearchCriteria.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.egov.hrms.web.contract; - -import java.util.List; - -import javax.validation.constraints.Size; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.util.CollectionUtils; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - - -@AllArgsConstructor -@Getter -@NoArgsConstructor -@Setter -@ToString -@Builder -public class EmployeeSearchCriteria { - - public List codes; - - public List names; - - public List departments; - - public List designations; - - public Long asOnDate; - - public List roles; - - public List ids; - - public List employeestatuses; - - public List employeetypes; - - public List uuids; - - public List positions; - - public Boolean isActive; - - @Size(max = 250) - public String tenantId; - - public String phone; - - public Integer offset; - - public Integer limit; - - public boolean isCriteriaEmpty(EmployeeSearchCriteria criteria) { - if(CollectionUtils.isEmpty(criteria.getCodes()) && CollectionUtils.isEmpty(criteria.getNames()) - && CollectionUtils.isEmpty(criteria.getDepartments()) && CollectionUtils.isEmpty(criteria.getDesignations()) - && CollectionUtils.isEmpty(criteria.getIds()) && CollectionUtils.isEmpty(criteria.getEmployeestatuses()) - && CollectionUtils.isEmpty(criteria.getEmployeetypes()) && CollectionUtils.isEmpty(criteria.getUuids()) - && CollectionUtils.isEmpty(criteria.getPositions()) && StringUtils.isEmpty(criteria.getTenantId()) - && CollectionUtils.isEmpty(criteria.getRoles()) && null == criteria.getAsOnDate()) { - return true; - }else { - return false; - } - } - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdGenerationRequest.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdGenerationRequest.java deleted file mode 100644 index 9116d5835f3..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdGenerationRequest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.hrms.web.contract; - -import java.util.List; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class IdGenerationRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - private List idRequests; - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdGenerationResponse.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdGenerationResponse.java deleted file mode 100644 index 3bcb4d1a7f3..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdGenerationResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.hrms.web.contract; - -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -@AllArgsConstructor -@NoArgsConstructor -public class IdGenerationResponse { - - private ResponseInfo responseInfo; - - private ResponseInfo ResponseInfo; - - private List idResponses; - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdRequest.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdRequest.java deleted file mode 100644 index cc3ac543675..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdRequest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.hrms.web.contract; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class IdRequest { - - @NotNull - private String idName; - - @NotNull - private String tenantId; - - private String format; - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdResponse.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdResponse.java deleted file mode 100644 index ac167a59ddd..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/IdResponse.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.hrms.web.contract; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -@AllArgsConstructor -@NoArgsConstructor -public class IdResponse { - - private String id; - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/RequestInfoWrapper.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/RequestInfoWrapper.java deleted file mode 100644 index ada1794cd4f..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/RequestInfoWrapper.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class RequestInfoWrapper { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/User.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/User.java deleted file mode 100644 index 51d9fcc5226..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/User.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.egov.hrms.web.contract; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; - -import org.egov.hrms.model.Role; -import org.egov.hrms.model.enums.GuardianRelation; -import org.springframework.validation.annotation.Validated; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Validated -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -@Builder -public class User { - - @JsonProperty("id") - private Long id; - - @Size(max=64) - @JsonProperty("uuid") - private String uuid; - - @Size(max=180) - @JsonProperty("userName") - private String userName; - - @Size(max=64) - @JsonProperty("password") - private String password; - - @Size(max = 5) - @JsonProperty("salutation") - private String salutation; - - @NotNull - @Size(max=250) - @Pattern(regexp = "^[a-zA-Z \\-'`\\.]*$", message = "Invalid name. Only alphabets and special characters -, ',`, .") - @JsonProperty("name") - private String name; - - @JsonProperty("gender") - private String gender; - - @NotNull - @Pattern(regexp = "^[0-9]{10}$", message = "MobileNumber should be 10 digit number") - @JsonProperty("mobileNumber") - private String mobileNumber; - - @Size(max=128) - @JsonProperty("emailId") - private String emailId; - - @Size(max=50) - @JsonProperty("altContactNumber") - private String altContactNumber; - - @Size(max=10) - @JsonProperty("pan") - private String pan; - - @Pattern(regexp = "^[0-9]{12}$", message = "AdharNumber should be 12 digit number") - @JsonProperty("aadhaarNumber") - private String aadhaarNumber; - - @Size(max=300) - @JsonProperty("permanentAddress") - private String permanentAddress; - - @Size(max=300) - @JsonProperty("permanentCity") - private String permanentCity; - - @Size(max=10) - @JsonProperty("permanentPinCode") - private String permanentPincode; - - @Size(max=300) - @JsonProperty("correspondenceCity") - private String correspondenceCity; - - @Size(max=10) - @JsonProperty("correspondencePinCode") - private String correspondencePincode; - - @Size(max=300) - @JsonProperty("correspondenceAddress") - private String correspondenceAddress; - - @JsonProperty("active") - private Boolean active; - - @NotNull - @JsonProperty("dob") - private Long dob; - - @JsonProperty("pwdExpiryDate") - private Long pwdExpiryDate; - - @Size(max=16) - @JsonProperty("locale") - private String locale; - - @Size(max=50) - @JsonProperty("type") - private String type; - - @Size(max=36) - @JsonProperty("signature") - private String signature; - - @JsonProperty("accountLocked") - private Boolean accountLocked; - - @JsonProperty("roles") - @Valid - private List roles; - - @Size(max=100) - @JsonProperty("fatherOrHusbandName") - private String fatherOrHusbandName; - - @JsonProperty("relationship") - private GuardianRelation relationship; - - @Size(max=32) - @JsonProperty("bloodGroup") - private String bloodGroup; - - @Size(max=300) - @JsonProperty("identificationMark") - private String identificationMark; - - @Size(max=36) - @JsonProperty("photo") - private String photo; - - @Size(max=64) - @JsonProperty("createdBy") - private String createdBy; - - @JsonProperty("createdDate") - private Long createdDate; - - @Size(max=64) - @JsonProperty("lastModifiedBy") - private String lastModifiedBy; - - @JsonProperty("lastModifiedDate") - private Long lastModifiedDate; - - @JsonProperty("otpReference") - private String otpReference; - - @Size(max=256) - @JsonProperty("tenantId") - private String tenantId; - - -} diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserRequest.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserRequest.java deleted file mode 100644 index 699dc079614..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserRequest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.web.contract; - -import javax.validation.constraints.NotNull; - -import org.egov.common.contract.request.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -@Builder -public class UserRequest { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @JsonProperty("User") - private User user; - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserResponse.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserResponse.java deleted file mode 100644 index 2cd8466501f..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/contract/UserResponse.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.web.contract; - -import java.util.ArrayList; -import java.util.List; - -import org.egov.common.contract.response.ResponseInfo; - -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@AllArgsConstructor -@EqualsAndHashCode -@Getter -@NoArgsConstructor -@Setter -@ToString -public class UserResponse { - - private ResponseInfo responseInfo; - - private List user = new ArrayList(); - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java deleted file mode 100644 index 4e99d601397..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/controller/EmployeeController.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.hrms.web.controller; - -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.RequestInfo; -import org.egov.hrms.service.EmployeeService; -import org.egov.hrms.web.contract.EmployeeRequest; -import org.egov.hrms.web.contract.EmployeeResponse; -import org.egov.hrms.web.contract.EmployeeSearchCriteria; -import org.egov.hrms.web.contract.RequestInfoWrapper; -import org.egov.hrms.web.validator.EmployeeValidator; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.HashMap; -import java.util.Map; - -@Slf4j -@RestController -@RequestMapping("/employees") -public class EmployeeController { - - @Autowired - private EmployeeService employeeService; - - @Autowired - private EmployeeValidator validator; - - - /** - * Maps Post Requests for _create & returns ResponseEntity of either - * EmployeeResponse type or ErrorResponse type - * - * @param employeeRequest - * @param bindingResult - * @return ResponseEntity - */ - @PostMapping(value = "/_create") - @ResponseBody - public ResponseEntity create(@RequestBody @Valid EmployeeRequest employeeRequest) { - validator.validateCreateEmployee(employeeRequest); - EmployeeResponse employeeResponse = employeeService.create(employeeRequest); - return new ResponseEntity<>(employeeResponse, HttpStatus.ACCEPTED); - } - - - /** - * Maps Post Requests for _update & returns ResponseEntity of either - * EmployeeResponse type or ErrorResponse type - * - * @param employeeRequest - * @param bindingResult - * @return ResponseEntity - */ - @PostMapping(value = "/_update") - @ResponseBody - public ResponseEntity update(@RequestBody @Valid EmployeeRequest employeeRequest) { - validator.validateUpdateEmployee(employeeRequest); - EmployeeResponse employeeResponse = employeeService.update(employeeRequest); - return new ResponseEntity<>(employeeResponse, HttpStatus.ACCEPTED); - } - - - /** - * Maps Post Requests for _search & returns ResponseEntity of either - * EmployeeResponse type or ErrorResponse type - * - * @param criteria - * @param bindingResult - * @return ResponseEntity - */ - @PostMapping(value = "/_search") - @ResponseBody - public ResponseEntity search(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper, @ModelAttribute @Valid EmployeeSearchCriteria criteria, @RequestHeader Map headers) { - validator.validateSearchRequest(requestInfoWrapper.getRequestInfo(), criteria); - EmployeeResponse employeeResponse = employeeService.search(criteria, requestInfoWrapper.getRequestInfo()); - return new ResponseEntity<>(employeeResponse,HttpStatus.OK); - } - - @PostMapping("_count") - @ResponseBody - private ResponseEntity count(@RequestParam("tenantId") String tenantId, @RequestBody RequestInfo requestInfo) { - - Map response = new HashMap<>(); - validator.validateEmployeeCountRequest(tenantId); - response = employeeService.getEmployeeCountResponse(requestInfo,tenantId); - return new ResponseEntity<>(response,HttpStatus.OK); - } - - -} \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java b/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java deleted file mode 100644 index a573438c4a0..00000000000 --- a/business-services/egov-hrms/src/main/java/org/egov/hrms/web/validator/EmployeeValidator.java +++ /dev/null @@ -1,773 +0,0 @@ -package org.egov.hrms.web.validator; - -import java.util.*; -import java.util.stream.Collectors; -import java.time.ZoneId; -import java.time.temporal.ChronoUnit; -import java.util.Date; - -import com.jayway.jsonpath.JsonPath; -import org.apache.commons.lang3.StringUtils; -import org.apache.kafka.common.protocol.types.Field; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.hrms.config.PropertiesManager; -import org.egov.hrms.model.*; -import org.egov.hrms.service.EmployeeService; -import org.egov.hrms.service.MDMSService; -import org.egov.hrms.service.UserService; -import org.egov.hrms.utils.ErrorConstants; -import org.egov.hrms.utils.HRMSConstants; -import org.egov.hrms.web.contract.EmployeeRequest; -import org.egov.hrms.web.contract.EmployeeResponse; -import org.egov.hrms.web.contract.EmployeeSearchCriteria; -import org.egov.hrms.web.contract.UserResponse; -import org.egov.mdms.model.MdmsResponse; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import lombok.extern.slf4j.Slf4j; - -import static org.egov.hrms.utils.ErrorConstants.CITIZEN_TYPE_CODE; - -@Service -@Slf4j -public class EmployeeValidator { - - @Autowired - private MDMSService mdmsService; - - @Autowired - private EmployeeService employeeService; - - @Autowired - private UserService userService; - - @Autowired - private PropertiesManager propertiesManager; - - /** - * Validates employee request for create. Validations include: - * 1. Validating MDMS codes - * 2. Performing data sanity checks - * - * @param request - */ - public void validateCreateEmployee(EmployeeRequest request) { - Map errorMap = new HashMap<>(); - validateExistingDuplicates(request ,errorMap); - if(!CollectionUtils.isEmpty(errorMap.keySet())) - throw new CustomException(errorMap); - Map> boundaryMap = getBoundaryList(request.getRequestInfo(),request.getEmployees().get(0)); - Map> mdmsData = mdmsService.getMDMSData(request.getRequestInfo(), request.getEmployees().get(0).getTenantId()); - if(!CollectionUtils.isEmpty(mdmsData.keySet())){ - request.getEmployees().stream().forEach(employee -> validateMdmsData(employee, errorMap, mdmsData,boundaryMap)); - } - if(!CollectionUtils.isEmpty(errorMap.keySet())) - throw new CustomException(errorMap); - } - - public Map> getBoundaryList(RequestInfo requestInfo,Employee employee){ - List boundarytList = new ArrayList<>(); - Map> eachMasterMap = new HashMap<>(); - Map> masterData = new HashMap<>(); - if(!CollectionUtils.isEmpty(employee.getJurisdictions())){ - for(Jurisdiction jurisdiction: employee.getJurisdictions()){ - if(!boundarytList.contains(jurisdiction.getBoundary())) - boundarytList.add(jurisdiction.getBoundary()); - } - if(CollectionUtils.isEmpty(boundarytList)) - boundarytList.add(employee.getTenantId()); - } - - List boundaryResponseList = new ArrayList<>(); - for(String boundary: boundarytList){ - MdmsResponse responseLoc = mdmsService.fetchMDMSDataLoc(requestInfo, boundary); - if(!CollectionUtils.isEmpty(responseLoc.getMdmsRes())) - boundaryResponseList.add(responseLoc); - } - - if(!CollectionUtils.isEmpty(boundaryResponseList)){ - List tenantBoundaryData = new ArrayList<>(); - for(MdmsResponse responseLoc : boundaryResponseList){ - if(!CollectionUtils.isEmpty(responseLoc.getMdmsRes().keySet())) { - if(null != responseLoc.getMdmsRes().get(HRMSConstants.HRMS_MDMS_EGOV_LOCATION_MASTERS_CODE)) { - eachMasterMap = (Map) responseLoc.getMdmsRes().get(HRMSConstants.HRMS_MDMS_EGOV_LOCATION_MASTERS_CODE); - tenantBoundaryData.addAll(eachMasterMap.get(HRMSConstants.HRMS_MDMS_TENANT_BOUNDARY_CODE)); - } - } - } - if(!CollectionUtils.isEmpty(tenantBoundaryData)) - masterData.put(HRMSConstants.HRMS_MDMS_TENANT_BOUNDARY_CODE,tenantBoundaryData); - } - return masterData; - } - - /** - * Validates search request. Checks the following: - * 1. If a user who doesn't have access to open search is making an open search call. - * - * @param requestInfo - * @param criteria - */ - public void validateSearchRequest(RequestInfo requestInfo, EmployeeSearchCriteria criteria) { - Map errorMap = new HashMap<>(); - - if(requestInfo.getUserInfo() != null && requestInfo.getUserInfo().getType().equalsIgnoreCase(CITIZEN_TYPE_CODE) && !CollectionUtils.isEmpty(criteria.getIds())) - errorMap.put(ErrorConstants.HRMS_INVALID_SEARCH_CITIZEN_CODE, ErrorConstants.HRMS_INVALID_SEARCH_CITIZEN_MSG); - - if(criteria.isCriteriaEmpty(criteria)) { - String[] roles = propertiesManager.getOpenSearchEnabledRoles().split(","); - List reqroles = requestInfo.getUserInfo().getRoles().stream().map(Role::getCode).collect(Collectors.toList()); - boolean check = false; - for(String role : reqroles) { - if(Arrays.asList(roles).contains(role)) { - check = true; - break; - } - } - if(!check) { - errorMap.put(ErrorConstants.HRMS_INVALID_SEARCH_REQ_CODE, ErrorConstants.HRMS_INVALID_SEARCH_REQ_MSG); - } - } - if(null != criteria.getAsOnDate()) { - if(CollectionUtils.isEmpty(criteria.getDepartments()) || CollectionUtils.isEmpty(criteria.getDesignations())) - errorMap.put(ErrorConstants.HRMS_INVALID_SEARCH_AOD_CODE, ErrorConstants.HRMS_INVALID_SEARCH_AOD_MSG); - } - - if(!CollectionUtils.isEmpty( criteria.getRoles()) && StringUtils.isEmpty(criteria.getTenantId())) { - errorMap.put(ErrorConstants.HRMS_INVALID_SEARCH_ROLES_CODE, ErrorConstants.HRMS_INVALID_SEARCH_ROLES_MSG); - } - - if((!StringUtils.isEmpty(criteria.getPhone()) || !CollectionUtils.isEmpty(criteria.getNames())) && - StringUtils.isEmpty(criteria.getTenantId())) { - errorMap.put(ErrorConstants.HRMS_INVALID_SEARCH_USER_CODE, ErrorConstants.HRMS_INVALID_SEARCH_USER_MSG); - } - if(!CollectionUtils.isEmpty(errorMap.keySet())) - throw new CustomException(errorMap); - } - - /** - * Checks if the employee being created is duplicate with the following: - * 1. Validating mobile number - * 2. Validating username - * - * @param request - * @param errorMap - */ - private void validateExistingDuplicates(EmployeeRequest request, Map errorMap) { - List employees = request.getEmployees(); - validateDataUniqueness(employees,errorMap); - validateUserMobile(employees,errorMap,request.getRequestInfo()); - validateUserName(employees,errorMap,request.getRequestInfo()); - } - - /** - * Checks duplicate occurance of mobileNumber and code for bulk request - * - * @param employees - * @param errorMap - */ - private void validateDataUniqueness(List employees, Map errorMap) { - HashSet < String> mobileNos = new HashSet<>(); - HashSet < String> codes = new HashSet<>(); - employees.forEach(employee -> { - if(mobileNos.contains(employee.getUser().getMobileNumber())) - errorMap.put(ErrorConstants.HRMS_BULK_CREATE_DUPLICATE_MOBILE_CODE, ErrorConstants.HRMS_BULK_CREATE_DUPLICATE_MOBILE_MSG ); - else - mobileNos.add(employee.getUser().getMobileNumber()); - if(null != employee.getCode()){ - if (codes.contains(employee.getCode())) - errorMap.put(ErrorConstants.HRMS_BULK_CREATE_DUPLICATE_EMPCODE_CODE,ErrorConstants.HRMS_BULK_CREATE_DUPLICATE_EMPCODE_MSG); - else - codes.add(employee.getCode()); - } - }); - } - - /** - * Checks if the mobile number used in the request is duplicate. - * - * @param employees - * @param errorMap - * @param requestInfo - */ - private void validateUserMobile(List employees, Map errorMap, RequestInfo requestInfo) { - employees.forEach(employee -> { - Map userSearchCriteria = new HashMap<>(); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTID,employee.getTenantId()); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_MOBILENO,employee.getUser().getMobileNumber()); - UserResponse userResponse = userService.getUser(requestInfo, userSearchCriteria); - if(!CollectionUtils.isEmpty(userResponse.getUser())){ - errorMap.put(ErrorConstants.HRMS_USER_EXIST_MOB_CODE, - ErrorConstants.HRMS_USER_EXIST_MOB_MSG); - } - }); - } - - /** - * Checks if the username is duplicate - * - * @param employees - * @param errorMap - * @param requestInfo - */ - private void validateUserName(List employees, Map errorMap, RequestInfo requestInfo) { - employees.forEach(employee -> { - if(!StringUtils.isEmpty(employee.getCode())){ - Map userSearchCriteria = new HashMap<>(); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTID,employee.getTenantId()); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_USERNAME,employee.getCode()); - UserResponse userResponse = userService.getUser(requestInfo, userSearchCriteria); - if(!CollectionUtils.isEmpty(userResponse.getUser())){ - errorMap.put(ErrorConstants.HRMS_USER_EXIST_USERNAME_CODE, - ErrorConstants.HRMS_USER_EXIST_USERNAME_MSG); - } - } - }); - } - - /** - * Validates MDMS codes of the request. - * - * @param employee - * @param errorMap - * @param mdmsData - */ - private void validateMdmsData(Employee employee, Map errorMap, Map> mdmsData, Map> boundaryMap) { - validateEmployee(employee, errorMap, mdmsData); - validateAssignments(employee, errorMap, mdmsData); - validateServiceHistory(employee, errorMap, mdmsData); - validateJurisdicton(employee, errorMap, mdmsData, boundaryMap); - validateEducationalDetails(employee, errorMap, mdmsData); - validateDepartmentalTest(employee, errorMap, mdmsData); - } - - - /** - * Performs checks for maintaining data consistency - * @param employee - * @param errorMap - * @param mdmsData - * @param existingEmp - * @param requestInfo - */ - public void validateDataConsistency(Employee employee, Map errorMap, Map> mdmsData, Employee existingEmp, RequestInfo requestInfo) { - validateUserData(existingEmp,employee,errorMap, requestInfo); - validateConsistencyAssignment(existingEmp,employee,errorMap); - validateConsistencyJurisdiction(existingEmp,employee,errorMap); - validateConsistencyDepartmentalTest(existingEmp,employee,errorMap); - validateConsistencyEducationalDetails(existingEmp,employee,errorMap); - validateConsistencyServiceHistory(existingEmp, employee, errorMap); - validateConsistencyEmployeeDocument(existingEmp, employee, errorMap); - validateConsistencyDeactivationDetails(existingEmp, employee, errorMap); - if(!employee.getIsActive()) - validateDeactivationDetails(existingEmp, employee, errorMap, mdmsData); - if(employee.getIsActive() && employee.getReActivateEmployee()) - validateReactivationDetails(existingEmp, employee, errorMap, mdmsData); - } - - /** - * Check whether employee code has changed - * @param existingEmp - * @param employee - * @param errorMap - * @param requestInfo - */ - private void validateUserData(Employee existingEmp, Employee employee, Map errorMap, RequestInfo requestInfo) { - if(!employee.getCode().equals(existingEmp.getCode())) - errorMap.put(ErrorConstants.HRMS_UPDATE_EMPLOYEE_CODE_CHANGE_CODE,ErrorConstants.HRMS_UPDATE_EMPLOYEE_CODE_CHANGE_MSG); - if(!employee.getUser().getMobileNumber().equals(existingEmp.getUser().getMobileNumber())){ - Map userSearchCriteria = new HashMap<>(); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_TENANTID,employee.getTenantId()); - userSearchCriteria.put(HRMSConstants.HRMS_USER_SEARCH_CRITERA_MOBILENO,employee.getUser().getMobileNumber()); - UserResponse userResponse = userService.getUser(requestInfo, userSearchCriteria); - if(!CollectionUtils.isEmpty(userResponse.getUser())){ - if(!employee.getUser().getUuid().equals(userResponse.getUser().get(0).getUuid())){ - errorMap.put(ErrorConstants.HRMS_UPDATE_EXISTING_MOBNO_CODE,ErrorConstants.HRMS_UPDATE_EXISTING_MOBNO_MSG); - } - } - - - } - - } - - /** - * Checks the following: - * 1. Whether the mobile number is valid - * 2. Whether the roles are valid - * 3. Whether the employee status mentioned is valid. - * 4. Whether the employee type mentioned is valid - * 5. Whether the date of appointment of the employee is valid. - * - * @param employee - * @param errorMap - * @param mdmsData - */ - private void validateEmployee(Employee employee, Map errorMap, Map> mdmsData) { - - if(employee.getUser().getMobileNumber().length() != 10) - errorMap.put(ErrorConstants.HRMS_INVALID_MOB_NO_CODE, ErrorConstants.HRMS_INVALID_MOB_NO_MSG); - - if(CollectionUtils.isEmpty(employee.getUser().getRoles())) - errorMap.put(ErrorConstants.HRMS_MISSING_ROLES_CODE, ErrorConstants.HRMS_INVALID_ROLES_MSG); - else { - for(org.egov.hrms.model.Role role: employee.getUser().getRoles()) { - if(!mdmsData.get(HRMSConstants.HRMS_MDMS_ROLES_CODE).contains(role.getCode())) - errorMap.put(ErrorConstants.HRMS_INVALID_ROLE_CODE, ErrorConstants.HRMS_INVALID_ROLE_MSG ); - } - } - /*if(!mdmsData.get(HRMSConstants.HRMS_MDMS_EMP_STATUS_CODE).contains(employee.getEmployeeStatus())) - errorMap.put(ErrorConstants.HRMS_INVALID_EMP_STATUS_CODE, ErrorConstants.HRMS_INVALID_EMP_STATUS_MSG);*/ - if(!mdmsData.get(HRMSConstants.HRMS_MDMS_EMP_TYPE_CODE).contains(employee.getEmployeeType())) - errorMap.put(ErrorConstants.HRMS_INVALID_EMP_TYPE_CODE, ErrorConstants.HRMS_INVALID_EMP_TYPE_MSG); - if(null != employee.getDateOfAppointment() && employee.getDateOfAppointment() > new Date().getTime()) - errorMap.put(ErrorConstants.HRMS_INVALID_DATE_OF_APPOINTMENT_CODE, ErrorConstants.HRMS_INVALID_DATE_OF_APPOINTMENT_MSG); - if(null != employee.getUser().getDob()) { - if(employee.getUser().getDob() >= new Date().getTime()) - errorMap.put(ErrorConstants.HRMS_INVALID_DOB_CODE, ErrorConstants.HRMS_INVALID_DOB_MSG); - if(null != employee.getDateOfAppointment() && employee.getDateOfAppointment() < employee.getUser().getDob()) - errorMap.put(ErrorConstants.HRMS_INVALID_DATE_OF_APPOINTMENT_DOB_CODE, ErrorConstants.HRMS_INVALID_DATE_OF_APPOINTMENT_DOB_MSG); - } - } - - /** - * Checks the following: - * 1. If there is more than one current assignment. - * 2. if period of assignment of any of the assignments overlap with that of others. - * 3. if the Department code is valid - * 4. If the Designation code is valid - * 5. If the assignment dates are valid - * - * @param employee - * @param errorMap - * @param mdmsData - */ - private void validateAssignments(Employee employee, Map errorMap, Map> mdmsData) { - List currentAssignments = employee.getAssignments().stream().filter(assignment -> assignment.getIsCurrentAssignment()).collect(Collectors.toList()); - if(currentAssignments.size() != 1){ - errorMap.put(ErrorConstants.HRMS_INVALID_CURRENT_ASSGN_CODE, ErrorConstants.HRMS_INVALID_CURRENT_ASSGN_MSG); - } - employee.getAssignments().sort(new Comparator() { - @Override - public int compare(Assignment assignment1, Assignment assignment2) { - return assignment1.getFromDate().compareTo(assignment2.getFromDate()); - } - }); - int length = employee.getAssignments().size(); - boolean overlappingCheck =false; - for(int i=0;i employee.getAssignments().get(i+1).getFromDate()) - overlappingCheck=true; - } - if(overlappingCheck) - errorMap.put(ErrorConstants.HRMS_OVERLAPPING_ASSGN_CODE, ErrorConstants.HRMS_OVERLAPPING_ASSGN_MSG); - - for(Assignment assignment: employee.getAssignments()) { - if(!assignment.getIsCurrentAssignment() && !CollectionUtils.isEmpty(currentAssignments) && null != assignment.getToDate()&& currentAssignments.get(0).getFromDate() < assignment.getToDate() ) - errorMap.put(ErrorConstants.HRMS_OVERLAPPING_ASSGN_CURRENT_CODE,ErrorConstants.HRMS_OVERLAPPING_ASSGN_CURRENT_MSG); - if(!mdmsData.get(HRMSConstants.HRMS_MDMS_DEPT_CODE).contains(assignment.getDepartment())) - errorMap.put(ErrorConstants.HRMS_INVALID_DEPT_CODE, ErrorConstants.HRMS_INVALID_DEPT_MSG); - if(!mdmsData.get(HRMSConstants.HRMS_MDMS_DESG_CODE).contains(assignment.getDesignation())) - errorMap.put(ErrorConstants.HRMS_INVALID_DESG_CODE, ErrorConstants.HRMS_INVALID_DESG_MSG); - if( assignment.getIsCurrentAssignment() && null != assignment.getToDate()) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_CURRENT_TO_DATE_CODE,ErrorConstants.HRMS_INVALID_ASSIGNMENT_CURRENT_TO_DATE_MSG); - if(!assignment.getIsCurrentAssignment() && null == assignment.getToDate()) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_NON_CURRENT_TO_DATE_CODE,ErrorConstants.HRMS_INVALID_ASSIGNMENT_NON_CURRENT_TO_DATE_MSG); - if(null != assignment.getToDate() && assignment.getFromDate() > assignment.getToDate()) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_PERIOD_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_PERIOD_MSG); - if(employee.getUser().getDob()!=null ) - if(assignment.getFromDate() < employee.getUser().getDob() || (null != assignment.getToDate() && assignment.getToDate() < employee.getUser().getDob())) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_MSG); - if(null != employee.getDateOfAppointment() && assignment.getFromDate() < employee.getDateOfAppointment()) - errorMap.put(ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_APPOINTMENT_CODE, ErrorConstants.HRMS_INVALID_ASSIGNMENT_DATES_APPOINTMENT_MSG); - - } - - } - - /** - * Checks the follwing: - * 1. If the status of service is valid. - * 2. If the service period is valid. - * 3. If the service dates is valid. - * 4. If there is more than 1 current Positions. - * 5. If service end date is null for current position - * - * @param employee - * @param errorMap - * @param mdmsData - */ - private void validateServiceHistory(Employee employee, Map errorMap, Map> mdmsData) { - if(!CollectionUtils.isEmpty(employee.getServiceHistory())){ - List currentService = employee.getServiceHistory().stream().filter(serviceHistory -> null!= serviceHistory.getIsCurrentPosition() && serviceHistory.getIsCurrentPosition()).collect(Collectors.toList()); - if(currentService.size() > 1){ - errorMap.put(ErrorConstants.HRMS_INVALID_CURRENT_SERVICE_CODE, ErrorConstants.HRMS_INVALID_CURRENT_SERVICE_MSG); - } - for(ServiceHistory history: employee.getServiceHistory()) { - if( (null== history.getIsCurrentPosition() || !history.getIsCurrentPosition()) && !CollectionUtils.isEmpty(currentService) && null != currentService.get(0).getServiceFrom() && null != history.getServiceTo() && currentService.get(0).getServiceFrom() new Date().getTime()) || (null != history.getServiceTo() && history.getServiceTo() > new Date().getTime()) - || (null != history.getServiceFrom() && null != history.getServiceTo() && history.getServiceFrom() > history.getServiceTo())) - errorMap.put(ErrorConstants.HRMS_INVALID_SERVICE_PERIOD_CODE, ErrorConstants.HRMS_INVALID_SERVICE_PERIOD_MSG); - if(employee.getUser().getDob()!=null ) - if((null != history.getServiceFrom() && history.getServiceFrom() < employee.getUser().getDob()) || (null != history.getServiceTo() && history.getServiceTo() < employee.getUser().getDob())) - errorMap.put(ErrorConstants.HRMS_INVALID_SERVICE_DATES_CODE, ErrorConstants.HRMS_INVALID_SERVICE_DATES_MSG); - } - } - } - - /** - * Checks the following: - * 1. If the qualification is valid. - * 2. If the specialization provided is valid. - * 3. If the year of passing is valid. - * - * @param employee - * @param errorMap - * @param mdmsData - */ - private void validateEducationalDetails(Employee employee, Map errorMap, Map> mdmsData) { - if(!CollectionUtils.isEmpty(employee.getEducation())){ - for(EducationalQualification education : employee.getEducation()) { - if(null!= education.getQualification() && !mdmsData.get(HRMSConstants.HRMS_MDMS_QUALIFICATION_CODE).contains(education.getQualification())) - errorMap.put(ErrorConstants.HRMS_INVALID_QUALIFICATION_CODE, ErrorConstants.HRMS_INVALID_QUALIFICATION_MSG); - if(null != education.getStream() && !mdmsData.get(HRMSConstants.HRMS_MDMS_STREAMS_CODE).contains(education.getStream())) - errorMap.put(ErrorConstants.HRMS_INVALID_EDUCATIONAL_STREAM_CODE, ErrorConstants.HRMS_INVALID_EDUCATIONAL_STREAM_MSG); - if(null != education.getYearOfPassing() && education.getYearOfPassing() > new Date().getTime()){ - errorMap.put(ErrorConstants.HRMS_INVALID_EDUCATIONAL_PASSING_YEAR_CODE, ErrorConstants.HRMS_INVALID_EDUCATIONAL_PASSING_YEAR_MSG); - } - } - } - } - - /** - * 1. Checks if there is atleast 1 active jurisdiction - * 2. If hierarchy is valid - * 3. If boundaryType is valid - * 4. If boundary is valid - * - * @param employee - * @param errorMap - * @param mdmsData - */ - private void validateJurisdicton(Employee employee, Map errorMap, Map> mdmsData,Map> boundaryMap) { - if(CollectionUtils.isEmpty(employee.getJurisdictions().stream().filter(jurisdiction -> null == jurisdiction.getIsActive() || jurisdiction.getIsActive() && jurisdiction.getIsActive() ).collect(Collectors.toList()))){ - errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_ACTIIEV_NULL_CODE,ErrorConstants.HRMS_INVALID_JURISDICTION_ACTIIEV_NULL_MSG); - } - for(Jurisdiction jurisdiction: employee.getJurisdictions()) { - String hierarchy_type_path = String.format(HRMSConstants.HRMS_TENANTBOUNDARY_HIERARCHY_JSONPATH,jurisdiction.getBoundary()); - String boundary_type_path = String.format(HRMSConstants.HRMS_TENANTBOUNDARY_BOUNDARY_TYPE_JSONPATH,jurisdiction.getHierarchy(),jurisdiction.getBoundary()); - String boundary_value_path = String.format(HRMSConstants.HRMS_TENANTBOUNDARY_BOUNDARY_VALUE_JSONPATH,jurisdiction.getHierarchy(),jurisdiction.getBoundary()); - List hierarchyTypes = JsonPath.read(boundaryMap,hierarchy_type_path); - List boundaryTypes = JsonPath.read(boundaryMap,boundary_type_path); - List boundaryValues = JsonPath.read(boundaryMap,boundary_value_path); - if(!hierarchyTypes.contains(jurisdiction.getHierarchy())) - errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_HEIRARCHY_CODE, ErrorConstants.HRMS_INVALID_JURISDICTION_HEIRARCHY_MSG); - if(!boundaryTypes.contains(jurisdiction.getBoundaryType())) - errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_TYPE_CODE, ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_TYPE_MSG); - if(!boundaryValues.contains(jurisdiction.getBoundary())) - errorMap.put(ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_CODE, ErrorConstants.HRMS_INVALID_JURISDICTION_BOUNDARY_MSG); - } - - - } - - - /** - * Checks the follwing: - * 1. If the dept test is valid. - * 2. If the year of passing is valid. - * - * @param employee - * @param errorMap - * @param mdmsData - */ - private void validateDepartmentalTest(Employee employee, Map errorMap, Map> mdmsData) { - if(!CollectionUtils.isEmpty(employee.getTests())) { - for (DepartmentalTest test : employee.getTests()) { - if (null!=test.getTest() && !mdmsData.get(HRMSConstants.HRMS_MDMS_DEPT_TEST_CODE).contains(test.getTest())) - errorMap.put(ErrorConstants.HRMS_INVALID_DEPARTMENTAL_TEST_CODE, ErrorConstants.HRMS_INVALID_DEPARTMENTAL_TEST_MSG ); - if (null!= test.getYearOfPassing() && test.getYearOfPassing() > new Date().getTime()) { - errorMap.put(ErrorConstants.HRMS_INVALID_DEPARTMENTAL_TEST_PASSING_YEAR_CODE, ErrorConstants.HRMS_INVALID_DEPARTMENTAL_TEST_PASSING_YEAR_MSG); - } - - } - } - } - - /** - * Validates if the deactivation details are provided every time an employee is deactivated. - * @param existingEmp - * @param updatedEmployeeData - * @param errorMap - * @param mdmsData - */ - private void validateDeactivationDetails(Employee existingEmp, Employee updatedEmployeeData, Map errorMap, Map> mdmsData){ - if(!CollectionUtils.isEmpty(updatedEmployeeData.getDeactivationDetails())) { - Date date = new Date(); - Date currentDateStartTime = Date.from(date.toInstant().atZone(ZoneId.systemDefault()) - .truncatedTo(ChronoUnit.DAYS).toInstant()); - for (DeactivationDetails deactivationDetails : updatedEmployeeData.getDeactivationDetails()) { - if (deactivationDetails.getId()==null){ - if(updatedEmployeeData.getIsActive()){ - errorMap.put(ErrorConstants.HRMS_INVALID_DEACT_REQUEST_CODE, ErrorConstants.HRMS_INVALID_DEACT_REQUEST_MSG); - } - } - if(deactivationDetails.getEffectiveFrom() > new Date().getTime()) - errorMap.put(ErrorConstants.HRMS_UPDATE_DEACT_DETAILS_INCORRECT_EFFECTIVEFROM_CODE, ErrorConstants.HRMS_UPDATE_DEACT_DETAILS_INCORRECT_EFFECTIVEFROM_MSG); - - if(deactivationDetails.getEffectiveFrom() < currentDateStartTime.getTime()) - errorMap.put(ErrorConstants.HRMS_UPDATE_DEACT_DETAILS_INCORRECT_EFFECTIVEFROM_CODE, ErrorConstants.HRMS_UPDATE_DEACT_DETAILS_INCORRECT_EFFECTIVEFROM_MSG); - - if (! mdmsData.get(HRMSConstants.HRMS_MDMS_DEACT_REASON_CODE).contains(deactivationDetails.getReasonForDeactivation())) - errorMap.put(ErrorConstants.HRMS_INVALID_DEACT_REASON_CODE, ErrorConstants.HRMS_INVALID_DEACT_REASON_MSG); - } - } - } - - private void validateReactivationDetails(Employee existingEmp, Employee updatedEmployeeData, Map errorMap, Map> mdmsData){ - if(!CollectionUtils.isEmpty(updatedEmployeeData.getReactivationDetails())) { - for (ReactivationDetails reactivationDetails : updatedEmployeeData.getReactivationDetails()) { - Boolean isValidDetails = existingEmp.getDeactivationDetails().get(0).getEffectiveFrom() <= reactivationDetails.getEffectiveFrom() - && reactivationDetails.getEffectiveFrom() <= new Date().getTime(); - if(!isValidDetails) - errorMap.put(ErrorConstants.HRMS_UPDATE_REACT_DETAILS_INCORRECT_EFFECTIVEFROM_CODE, ErrorConstants.HRMS_UPDATE_REACT_DETAILS_INCORRECT_EFFECTIVEFROM_MSG); - - } - } - } - - /** - * Validates the employee request for update. Validates the following: - * 1. MDMS codes in the request - * 2. Performs data consistency checks. - * - * @param request - */ - public void validateUpdateEmployee(EmployeeRequest request) { - Map errorMap = new HashMap<>(); - Map> boundaryMap = getBoundaryList(request.getRequestInfo(),request.getEmployees().get(0)); - Map> mdmsData = mdmsService.getMDMSData(request.getRequestInfo(), request.getEmployees().get(0).getTenantId()); - List uuidList = request.getEmployees().stream().map(Employee :: getUuid).collect(Collectors.toList()); - EmployeeResponse existingEmployeeResponse = employeeService.search(EmployeeSearchCriteria.builder().uuids(uuidList).tenantId(request.getEmployees().get(0).getTenantId()).build(),request.getRequestInfo()); - List existingEmployees = existingEmployeeResponse.getEmployees(); - for(Employee employee: request.getEmployees()){ - if(validateEmployeeForUpdate(employee, errorMap)){ - if(!existingEmployees.isEmpty()){ - Employee existingEmp = existingEmployees.stream().filter(existingEmployee -> existingEmployee.getUuid().equals(employee.getUuid())).findFirst().get(); - validateDataConsistency(employee, errorMap, mdmsData, existingEmp, request.getRequestInfo()); - } - else - errorMap.put(ErrorConstants.HRMS_UPDATE_EMPLOYEE_NOT_EXIST_CODE, ErrorConstants.HRMS_UPDATE_EMPLOYEE_NOT_EXIST_MSG); - } - validateMdmsData(employee, errorMap, mdmsData,boundaryMap); - } - if(!CollectionUtils.isEmpty(errorMap.keySet())) { - throw new CustomException(errorMap); - } - - - } - - /** - * Checks if the ID, UUID and Code are present in the update request - * - * @param employee - * @param errorMap - * @return - */ - private boolean validateEmployeeForUpdate(Employee employee, Map errorMap) { - boolean isvalid = true; - if(employee.getId() == null){ - errorMap.put(ErrorConstants.HRMS_UPDATE_NULL_ID_CODE, ErrorConstants.HRMS_UPDATE_NULL_ID_MSG); - isvalid=false; - } - if(StringUtils.isEmpty(employee.getCode())){ - errorMap.put(ErrorConstants.HRMS_UPDATE_NULL_CODE_CODE, ErrorConstants.HRMS_UPDATE_NULL_CODE_MSG); - isvalid=false; - } - if(StringUtils.isEmpty(employee.getUuid())){ - errorMap.put(ErrorConstants.HRMS_UPDATE_NULL_UUID_CODE, ErrorConstants.HRMS_UPDATE_NULL_UUID_MSG); - isvalid=false; - } - - return isvalid; - - } - - /** - * Juridictions once created in the system cannot be deleted, they can however be changed. Validates that condition - * - * @param existingEmp - * @param updatedEmployeeData - * @param errorMap - */ - private void validateConsistencyJurisdiction(Employee existingEmp, Employee updatedEmployeeData, Map errorMap) { - boolean check = - updatedEmployeeData.getJurisdictions().stream() - .map(jurisdiction -> jurisdiction.getId()) - .collect(Collectors.toList()) - .containsAll(existingEmp.getJurisdictions().stream() - .map(jurisdiction -> jurisdiction.getId()) - .collect(Collectors.toList())); - if(!check){ - errorMap.put(ErrorConstants.HRMS_UPDATE_JURISDICTION_INCOSISTENT_CODE, ErrorConstants.HRMS_UPDATE_JURISDICTION_INCOSISTENT_MSG); - } - - } - - /** - * Assignments once created in the system cannot be deleted, they can however be changed. Validates that condition - * - * @param existingEmp - * @param updatedEmployeeData - * @param errorMap - */ - private void validateConsistencyAssignment(Employee existingEmp, Employee updatedEmployeeData, Map errorMap) { - boolean check = - updatedEmployeeData.getAssignments().stream() - .map(assignment -> assignment.getId()) - .collect(Collectors.toList()) - .containsAll(existingEmp.getAssignments().stream() - .map(assignment -> assignment.getId()) - .collect(Collectors.toList())); - if(!check){ - errorMap.put(ErrorConstants.HRMS_UPDATE_ASSIGNEMENT_INCOSISTENT_CODE, ErrorConstants.HRMS_UPDATE_ASSIGNEMENT_INCOSISTENT_MSG); - } - } - - /** - * Dept Test details once created in the system cannot be deleted, they can however be changed. Validates that condition - * @param existingEmp - * @param updatedEmployeeData - * @param errorMap - */ - private void validateConsistencyDepartmentalTest(Employee existingEmp, Employee updatedEmployeeData, Map errorMap){ - if(!CollectionUtils.isEmpty(updatedEmployeeData.getTests())){ - boolean check = - updatedEmployeeData.getTests().stream() - .map(test -> test.getId()) - .collect(Collectors.toList()) - .containsAll(existingEmp.getTests().stream() - .map(test -> test.getId()) - .collect(Collectors.toList())); - if(!check){ - errorMap.put(ErrorConstants.HRMS_UPDATE_TESTS_INCOSISTENT_CODE, ErrorConstants.HRMS_UPDATE_TESTS_INCOSISTENT_MSG); - } - } - - } - - /** - * Education Details once created in the system cannot be deleted, they can however be changed. Validates that condition - * - * @param existingEmp - * @param updatedEmployeeData - * @param errorMap - */ - private void validateConsistencyEducationalDetails(Employee existingEmp, Employee updatedEmployeeData, Map errorMap){ - if(!CollectionUtils.isEmpty(updatedEmployeeData.getEducation())){ - boolean check = - updatedEmployeeData.getEducation().stream() - .map(educationalQualification -> educationalQualification.getId()) - .collect(Collectors.toList()) - .containsAll(existingEmp.getEducation().stream() - .map(educationalQualification -> educationalQualification.getId()) - .collect(Collectors.toList())); - if(!check){ - errorMap.put(ErrorConstants.HRMS_UPDATE_EDUCATION_INCOSISTENT_CODE, ErrorConstants.HRMS_UPDATE_EDUCATION_INCOSISTENT_MSG); - } - } - } - - /** - * Service History once created in the system cannot be deleted, they can however be changed. Validates that condition - * - * @param existingEmp - * @param updatedEmployeeData - * @param errorMap - */ - private void validateConsistencyServiceHistory(Employee existingEmp, Employee updatedEmployeeData, Map errorMap){ - if(!CollectionUtils.isEmpty(updatedEmployeeData.getServiceHistory())){ - boolean check = - updatedEmployeeData.getServiceHistory().stream() - .map(serviceHistory -> serviceHistory.getId()) - .collect(Collectors.toList()) - .containsAll(existingEmp.getServiceHistory().stream() - .map(serviceHistory -> serviceHistory.getId()) - .collect(Collectors.toList())); - if(!check){ - errorMap.put(ErrorConstants.HRMS_UPDATE_SERVICE_HISTORY_INCOSISTENT_CODE, ErrorConstants.HRMS_UPDATE_SERVICE_HISTORY_INCOSISTENT_MSG); - } - - } - - } - - /** - * Documents once created in the system cannot be deleted, they can however be changed. Validates that condition - * - * @param existingEmp - * @param updatedEmployeeData - * @param errorMap - */ - private void validateConsistencyEmployeeDocument(Employee existingEmp, Employee updatedEmployeeData, Map errorMap){ - if(!CollectionUtils.isEmpty(updatedEmployeeData.getDocuments())){ - boolean check = - updatedEmployeeData.getDocuments().stream() - .map(employeeDocument -> employeeDocument.getId()) - .collect(Collectors.toList()) - .containsAll(existingEmp.getDocuments().stream() - .map(employeeDocument -> employeeDocument.getId()) - .collect(Collectors.toList())); - if (!check) { - errorMap.put(ErrorConstants.HRMS_UPDATE_DOCUMENT_INCOSISTENT_CODE, ErrorConstants.HRMS_UPDATE_DOCUMENT_INCOSISTENT_MSG); - } - } - - } - - /** - * Deactivation Details once created in the system cannot be deleted, they can however be changed. Validates that condition - * - * @param existingEmp - * @param updatedEmployeeData - * @param errorMap - */ - private void validateConsistencyDeactivationDetails(Employee existingEmp, Employee updatedEmployeeData, Map errorMap){ - if(!CollectionUtils.isEmpty(updatedEmployeeData.getDeactivationDetails())){ - boolean check = - updatedEmployeeData.getDeactivationDetails().stream() - .map(deactivationDetails -> deactivationDetails.getId()) - .collect(Collectors.toList()) - .containsAll(existingEmp.getDeactivationDetails().stream() - .map(employeeDocument -> employeeDocument.getId()) - .collect(Collectors.toList())); - if (!check) { - errorMap.put(ErrorConstants.HRMS_UPDATE_DEACT_DETAILS_INCOSISTENT_CODE, ErrorConstants.HRMS_UPDATE_DEACT_DETAILS_INCOSISTENT_MSG); - } - } - - } - - public void validateEmployeeCountRequest(String tenantId){ - Map errorMap = new HashMap<>(); - if(StringUtils.isEmpty(tenantId)) - errorMap.put(ErrorConstants.HRMS_EMPLOYEE_COUNT_ERROR_CODE, ErrorConstants.HRMS_EMPLOYEE_COUNT_ERROR_MSG); - - if(!CollectionUtils.isEmpty(errorMap.keySet())) { - throw new CustomException(errorMap); - } - } - -} diff --git a/business-services/egov-hrms/src/main/resources/application.properties b/business-services/egov-hrms/src/main/resources/application.properties deleted file mode 100644 index 557f3edfc0b..00000000000 --- a/business-services/egov-hrms/src/main/resources/application.properties +++ /dev/null @@ -1,103 +0,0 @@ -#---------------------------- DATABASE CONFIGURATIONS -----------------------------# -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/egov_hrms -spring.datasource.username=postgres -spring.datasource.password=postgres - -#----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/egov_hrms -spring.flyway.user=postgres -spring.flyway.password=postgres -#spring.flyway.table=hr_employee_schema_version -spring.flyway.baseline-on-migrate=true -spring.flyway.outOfOrder=true -spring.flyway.locations=classpath:/db/migration/main,db/migration/seed -spring.flyway.enabled=true - -#--------------------------- PATH & PORT CONFIGURATIONS ---------------------------# -server.contextPath=/egov-hrms -server.servlet.context-path=/egov-hrms -server.port=9999 - -#---------------------------- TIMEZONE CONFIGURATIONS -----------------------------# -app.timezone=UTC - -#-------------------------- EXTERNAL API CONFIGURATIONS ---------------------------# -egov.services.data_sync_employee.required = false - - -#mdms urls -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search -#egov.mdms.search.endpoint=/egov-mdms-service-test/v1/_search - -#filestore urls -egov.filestore.host=https://dev.digit.org -egov.filestore.url.endpoint=/filestore/v1/files/url - -#localization urls -egov.localization.host=https://dev.digit.org -egov.localization.search.endpoint=/localization/messages/v1/_search - -#egov-otp urls -egov.otp.host=http://egov-otp.egov:8080/ -egov.otp.create.endpoint=otp/v1/_create - -egov.environment.domain=https://dev.digit.org/ - -#user -egov.user.host=https://dev.digit.org -egov.user.search.endpoint=/user/v1/_search -egov.user.create.endpoint=/user/users/_createnovalidate -egov.user.update.endpoint=/user/users/_updatenovalidate - -#idgen configs -#egov.idgen.host=http://egov-idgen:8080/ -egov.idgen.host=https://dev.digit.org/ -egov.idgen.path=egov-idgen/id/_generate -egov.idgen.ack.name=hrms.employeecode -egov.idgen.ack.format=EMP-[city]-[SEQ_EG_HRMS_EMP_CODE] - - -#user -egov.hrms.employee.app.link=https://mseva.lgpunjab.gov.in/employee/user/login - - -#CONFIGS -egov.hrms.default.pagination.limit=200 -egov.hrms.default.pwd.length=8 -open.search.enabled.roles=SUPERUSER -egov.pwd.allowed.special.characters=@#$% -decryption.abac.enable=false - -#------------------------------ KAFKA CONFIGURATIONS ------------------------------# -# KAFKA SERVER CONFIGURATIONS -spring.kafka.bootstrap.servers=localhost:9092 -spring.kafka.consumer.properties.spring.json.use.type.headers=false - -# SPRING KAFKA CONSUMER CONFIGURATIONS -spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=employee-group1 - -# SPRING KAFKA PRODUCER CONFIGURATIONS -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer - -# KAFKA TOPIC CONFIGURATIONS -kafka.topics.save.service=save-hrms-employee -kafka.topics.update.service=update-hrms-employee -kafka.topics.notification.sms=egov.core.notification.sms -kafka.topics.hrms.updateData= egov-hrms-update - -spring.kafka.listener.missing-topics-fatal=false - -#------------------------------ TRACER CONFIGURATIONS -----------------------------# -# tracer.detailed.tracing.enabled=false - -#------------------------------ LOGGER CONFIGURATIONS -----------------------------# -logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} - -log4j.logger.org.springframework.jdbc.core = TRACE - -state.level.tenant.id=pb \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/resources/config/hrm-employee-update-persister.yml b/business-services/egov-hrms/src/main/resources/config/hrm-employee-update-persister.yml deleted file mode 100644 index 1f57cc0719c..00000000000 --- a/business-services/egov-hrms/src/main/resources/config/hrm-employee-update-persister.yml +++ /dev/null @@ -1,265 +0,0 @@ -serviceMaps: - serviceName: HRMS - mappings: - - version: 1.0 - name: hrms - description: Persists employee details in the table - fromTopic: update-hrms-employee - isTransaction: true - queryMaps: - - - query: DELETE from eg_hrms_employee WHERE uuid=? on - - basePath: Employees.* - jsonMaps: - - -jsonPath: $.Employees.*.uuid - - - - - query: INSERT INTO eg_hrms_employee(tenantid, id, uuid, code, phone, name, dateOfAppointment, employeestatus, employeetype, active, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.* - jsonMaps: - - - - jsonPath: $.Employees.*.tenantId - - - jsonPath: $.Employees.*.id - - - jsonPath: $.Employees.*.uuid - - - jsonPath: $.Employees.*.code - - - jsonPath: $.Employees.*.user.mobileNumber - - - jsonPath: $.Employees.*.user.name - - - jsonPath: $.Employees.*.dateOfAppointment - - - jsonPath: $.Employees.*.employeeStatus - - - jsonPath: $.Employees.*.employeeType - - - jsonPath: $.Employees.*.active - - - jsonPath: $.Employees.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.auditDetails.lastModifiedDate - - - - - query: INSERT INTO eg_hrms_assignment(tenantid, uuid, position, department, designation, fromdate, todate, govtordernumber, reportingto, isHOD, employeeid, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.assignments.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.assignments[*].id)].tenantId - - - jsonPath: $.Employees.*.assignments.*.id - - - jsonPath: $.Employees.*.assignments.*.position - - - jsonPath: $.Employees.*.assignments.*.department - - - jsonPath: $.Employees.*.assignments.*.designation - - - jsonPath: $.Employees.*.assignments.*.fromDate - - - jsonPath: $.Employees.*.assignments.*.toDate - - - jsonPath: $.Employees.*.assignments.*.govtOrderNumber - - - jsonPath: $.Employees.*.assignments.*.reportingTo - - - jsonPath: $.Employees.*.assignments.*.isHOD - - - jsonPath: $.Employees[*][?({id} in @.assignments[*].id)].uuid - - - jsonPath: $.Employees.*.assignments.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.assignments.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.assignments.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.assignments.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_educationaldetails(tenantid, uuid, employeeid, qualification, stream, yearofpassing, university, remarks, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.education.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.education[*].id)].tenantId - - - jsonPath: $.Employees.*.education.*.id - - - jsonPath: $.Employees[*][?({id} in @.education[*].id)].uuid - - - jsonPath: $.Employees.*.education.*.qualification - - - jsonPath: $.Employees.*.education.*.stream - - - jsonPath: $.Employees.*.education.*.yearOfPassing - - - jsonPath: $.Employees.*.education.*.university - - - jsonPath: $.Employees.*.education.*.remarks - - - jsonPath: $.Employees.*.education.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.education.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.education.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.education.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_departmentaltests(tenantid, uuid, employeeid, test, yearofpassing, remarks, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.tests.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.tests[*].id)].tenantId - - - jsonPath: $.Employees.*.tests.*.id - - - jsonPath: $.Employees[*][?({id} in @.tests[*].id)].uuid - - - jsonPath: $.Employees.*.tests.*.test - - - jsonPath: $.Employees.*.tests.*.yearOfPassing - - - jsonPath: $.Employees.*.tests.*.remarks - - - jsonPath: $.Employees.*.tests.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.tests.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.tests.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.tests.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_empdocuments(tenantid, uuid, employeeid, documentid, documentname, referencetype, referenceid, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.documents.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.documents[*].id)].tenantId - - - jsonPath: $.Employees.*.documents.*.id - - - jsonPath: $.Employees[*][?({id} in @.documents[*].id)].uuid - - - jsonPath: $.Employees.*.documents.*.documentId - - - jsonPath: $.Employees.*.documents.*.documentName - - - jsonPath: $.Employees.*.documents.*.referenceType - - - jsonPath: $.Employees.*.documents.*.referenceId - - - jsonPath: $.Employees.*.documents.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.documents.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.documents.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.documents.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_servicehistory(tenantid, uuid, employeeid, servicestatus, servicefrom, serviceto, ordernumber, isCurrentPosition, location, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.serviceHistory.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.serviceHistory[*].id)].tenantId - - - jsonPath: $.Employees.*.serviceHistory.*.id - - - jsonPath: $.Employees[*][?({id} in @.serviceHistory[*].id)].uuid - - - jsonPath: $.Employees.*.serviceHistory.*.serviceStatus - - - jsonPath: $.Employees.*.serviceHistory.*.serviceFrom - - - jsonPath: $.Employees.*.serviceHistory.*.serviceTo - - - jsonPath: $.Employees.*.serviceHistory.*.orderNo - - - jsonPath: $.Employees.*.serviceHistory.*.isCurrentPosition - - - jsonPath: $.Employees.*.serviceHistory.*.location - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.lastModifiedDate - - -query: INSERT INTO eg_hrms_jurisdiction (uuid, employeeid, hierarchy, boundarytype, boundary, tenantid, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.jurisdictions.* - jsonMaps: - - - jsonPath: $.Employees.*.jurisdictions.*.id - - - jsonPath: $.Employees[*][?({id} in @.jurisdictions[*].id)].uuid - - - jsonPath: $.Employees.*.jurisdictions.*.hierarchy - - - jsonPath: $.Employees.*.jurisdictions.*.boundaryType - - - jsonPath: $.Employees.*.jurisdictions.*.boundary - - - jsonPath: $.Employees[*][?({id} in @.jurisdictions[*].id)].tenantId - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.lastModifiedDate - - - - - query: INSERT INTO eg_hrms_deactivationdetails(uuid, employeeid, reasonfordeactivation, effectivefrom, ordernumber, typeOfDeactivation, tenantid, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.deactivationDetails.* - jsonMaps: - - - jsonPath: $.Employees.*.deactivationDetails.*.id - - - jsonPath: $.Employees[*][?({id} in @.deactivationDetails[*].id)].uuid - - - jsonPath: $.Employees.*.deactivationDetails.*.reasonForDeactivation - - - jsonPath: $.Employees.*.deactivationDetails.*.effectiveFrom - - - jsonPath: $.Employees.*.deactivationDetails.*.orderNo - - - jsonPath: $.Employees.*.deactivationDetails.*.typeOfDeactivation - - - jsonPath: $.Employees[*][?({id} in @.deactivationDetails[*].id)].tenantId - - - jsonPath: $.Employees.*.deactivationDetails.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.deactivationDetails.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.deactivationDetails.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.deactivationDetails.*.auditDetails.lastModifiedDate - diff --git a/business-services/egov-hrms/src/main/resources/config/hrms-employee-persister.yml b/business-services/egov-hrms/src/main/resources/config/hrms-employee-persister.yml deleted file mode 100644 index 74dbd1940ef..00000000000 --- a/business-services/egov-hrms/src/main/resources/config/hrms-employee-persister.yml +++ /dev/null @@ -1,501 +0,0 @@ -serviceMaps: - serviceName: HRMS - mappings: - - version: 1.0 - name: hrms - description: Persists employee details in the table - fromTopic: save-hrms-employee - isTransaction: true - queryMaps: - - query: INSERT INTO eg_hrms_employee(tenantid, id, uuid, code, dateOfAppointment, employeestatus, employeetype, active, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.* - jsonMaps: - - - - jsonPath: $.Employees.*.tenantId - - - jsonPath: $.Employees.*.id - - - jsonPath: $.Employees.*.uuid - - - jsonPath: $.Employees.*.code - - - jsonPath: $.Employees.*.dateOfAppointment - - - jsonPath: $.Employees.*.employeeStatus - - - jsonPath: $.Employees.*.employeeType - - - jsonPath: $.Employees.*.isActive - - - jsonPath: $.Employees.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.auditDetails.lastModifiedDate - - - - - query: INSERT INTO eg_hrms_assignment(tenantid, uuid, position, department, designation, fromdate, todate, govtordernumber, reportingto, isHOD, iscurrentassignment, employeeid, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.assignments.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.assignments[*].id)].tenantId - - - jsonPath: $.Employees.*.assignments.*.id - - - jsonPath: $.Employees.*.assignments.*.position - - - jsonPath: $.Employees.*.assignments.*.department - - - jsonPath: $.Employees.*.assignments.*.designation - - - jsonPath: $.Employees.*.assignments.*.fromDate - - - jsonPath: $.Employees.*.assignments.*.toDate - - - jsonPath: $.Employees.*.assignments.*.govtOrderNumber - - - jsonPath: $.Employees.*.assignments.*.reportingTo - - - jsonPath: $.Employees.*.assignments.*.isHOD - - - jsonPath: $.Employees.*.assignments.*.isCurrentAssignment - - - jsonPath: $.Employees[*][?({id} in @.assignments[*].id)].uuid - - - jsonPath: $.Employees.*.assignments.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.assignments.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.assignments.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.assignments.*.auditDetails.lastModifiedDate - - - - - - query: INSERT INTO eg_hrms_educationaldetails(tenantid, uuid, employeeid, qualification, stream, yearofpassing, university, remarks, isactive, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.education.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.education[*].id)].tenantId - - - jsonPath: $.Employees.*.education.*.id - - - jsonPath: $.Employees[*][?({id} in @.education[*].id)].uuid - - - jsonPath: $.Employees.*.education.*.qualification - - - jsonPath: $.Employees.*.education.*.stream - - - jsonPath: $.Employees.*.education.*.yearOfPassing - - - jsonPath: $.Employees.*.education.*.university - - - jsonPath: $.Employees.*.education.*.remarks - - - jsonPath: $.Employees.*.education.*.isActive - - - jsonPath: $.Employees.*.education.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.education.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.education.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.education.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_departmentaltests(tenantid, uuid, employeeid, test, yearofpassing, remarks, isactive, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.tests.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.tests[*].id)].tenantId - - - jsonPath: $.Employees.*.tests.*.id - - - jsonPath: $.Employees[*][?({id} in @.tests[*].id)].uuid - - - jsonPath: $.Employees.*.tests.*.test - - - jsonPath: $.Employees.*.tests.*.yearOfPassing - - - jsonPath: $.Employees.*.tests.*.remarks - - - jsonPath: $.Employees.*.tests.*.isActive - - - jsonPath: $.Employees.*.tests.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.tests.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.tests.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.tests.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_empdocuments(tenantid, uuid, employeeid, documentid, documentname, referencetype, referenceid, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.documents.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.documents[*].id)].tenantId - - - jsonPath: $.Employees.*.documents.*.id - - - jsonPath: $.Employees[*][?({id} in @.documents[*].id)].uuid - - - jsonPath: $.Employees.*.documents.*.documentId - - - jsonPath: $.Employees.*.documents.*.documentName - - - jsonPath: $.Employees.*.documents.*.referenceType - - - jsonPath: $.Employees.*.documents.*.referenceId - - - jsonPath: $.Employees.*.documents.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.documents.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.documents.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.documents.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_servicehistory(tenantid, uuid, employeeid, servicestatus, servicefrom, serviceto, ordernumber, isCurrentPosition, location, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.serviceHistory.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.serviceHistory[*].id)].tenantId - - - jsonPath: $.Employees.*.serviceHistory.*.id - - - jsonPath: $.Employees[*][?({id} in @.serviceHistory[*].id)].uuid - - - jsonPath: $.Employees.*.serviceHistory.*.serviceStatus - - - jsonPath: $.Employees.*.serviceHistory.*.serviceFrom - - - jsonPath: $.Employees.*.serviceHistory.*.serviceTo - - - jsonPath: $.Employees.*.serviceHistory.*.orderNo - - - jsonPath: $.Employees.*.serviceHistory.*.isCurrentPosition - - - jsonPath: $.Employees.*.serviceHistory.*.location - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_jurisdiction (uuid, employeeid, hierarchy, boundarytype, boundary, tenantid, isActive, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.jurisdictions.* - jsonMaps: - - - jsonPath: $.Employees.*.jurisdictions.*.id - - - jsonPath: $.Employees[*][?({id} in @.jurisdictions[*].id)].uuid - - - jsonPath: $.Employees.*.jurisdictions.*.hierarchy - - - jsonPath: $.Employees.*.jurisdictions.*.boundaryType - - - jsonPath: $.Employees.*.jurisdictions.*.boundary - - - jsonPath: $.Employees[*][?({id} in @.jurisdictions[*].id)].tenantId - - - jsonPath: $.Employees.*.jurisdictions.*.isActive - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.lastModifiedDate - - - - - - version: 1.0 - name: hrms - description: Persists employee details in the table - fromTopic: update-hrms-employee - isTransaction: true - queryMaps: - - query: DELETE from eg_hrms_employee WHERE uuid=? - - basePath: Employees.* - jsonMaps: - - - jsonPath: $.Employees.*.uuid - - - query: INSERT INTO eg_hrms_employee(tenantid, id, uuid, code, dateOfAppointment, employeestatus, employeetype, active, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.* - jsonMaps: - - - - jsonPath: $.Employees.*.tenantId - - - jsonPath: $.Employees.*.id - - - jsonPath: $.Employees.*.uuid - - - jsonPath: $.Employees.*.code - - - jsonPath: $.Employees.*.dateOfAppointment - - - jsonPath: $.Employees.*.employeeStatus - - - jsonPath: $.Employees.*.employeeType - - - jsonPath: $.Employees.*.isActive - - - jsonPath: $.Employees.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.auditDetails.lastModifiedDate - - - - - query: INSERT INTO eg_hrms_assignment(tenantid, uuid, position, department, designation, fromdate, todate, govtordernumber, reportingto, isHOD, iscurrentassignment, employeeid, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.assignments.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.assignments[*].id)].tenantId - - - jsonPath: $.Employees.*.assignments.*.id - - - jsonPath: $.Employees.*.assignments.*.position - - - jsonPath: $.Employees.*.assignments.*.department - - - jsonPath: $.Employees.*.assignments.*.designation - - - jsonPath: $.Employees.*.assignments.*.fromDate - - - jsonPath: $.Employees.*.assignments.*.toDate - - - jsonPath: $.Employees.*.assignments.*.govtOrderNumber - - - jsonPath: $.Employees.*.assignments.*.reportingTo - - - jsonPath: $.Employees.*.assignments.*.isHOD - - - jsonPath: $.Employees.*.assignments.*.isCurrentAssignment - - - jsonPath: $.Employees[*][?({id} in @.assignments[*].id)].uuid - - - jsonPath: $.Employees.*.assignments.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.assignments.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.assignments.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.assignments.*.auditDetails.lastModifiedDate - - - - - - query: INSERT INTO eg_hrms_educationaldetails(tenantid, uuid, employeeid, qualification, stream, yearofpassing, university, remarks, isactive, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.education.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.education[*].id)].tenantId - - - jsonPath: $.Employees.*.education.*.id - - - jsonPath: $.Employees[*][?({id} in @.education[*].id)].uuid - - - jsonPath: $.Employees.*.education.*.qualification - - - jsonPath: $.Employees.*.education.*.stream - - - jsonPath: $.Employees.*.education.*.yearOfPassing - - - jsonPath: $.Employees.*.education.*.university - - - jsonPath: $.Employees.*.education.*.remarks - - - jsonPath: $.Employees.*.education.*.isActive - - - jsonPath: $.Employees.*.education.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.education.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.education.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.education.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_departmentaltests(tenantid, uuid, employeeid, test, yearofpassing, remarks, isactive, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.tests.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.tests[*].id)].tenantId - - - jsonPath: $.Employees.*.tests.*.id - - - jsonPath: $.Employees[*][?({id} in @.tests[*].id)].uuid - - - jsonPath: $.Employees.*.tests.*.test - - - jsonPath: $.Employees.*.tests.*.yearOfPassing - - - jsonPath: $.Employees.*.tests.*.remarks - - - jsonPath: $.Employees.*.tests.*.isActive - - - jsonPath: $.Employees.*.tests.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.tests.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.tests.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.tests.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_empdocuments(tenantid, uuid, employeeid, documentid, documentname, referencetype, referenceid, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.documents.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.documents[*].id)].tenantId - - - jsonPath: $.Employees.*.documents.*.id - - - jsonPath: $.Employees[*][?({id} in @.documents[*].id)].uuid - - - jsonPath: $.Employees.*.documents.*.documentId - - - jsonPath: $.Employees.*.documents.*.documentName - - - jsonPath: $.Employees.*.documents.*.referenceType - - - jsonPath: $.Employees.*.documents.*.referenceId - - - jsonPath: $.Employees.*.documents.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.documents.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.documents.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.documents.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_servicehistory(tenantid, uuid, employeeid, servicestatus, servicefrom, serviceto, ordernumber, isCurrentPosition, location, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.serviceHistory.* - jsonMaps: - - - - jsonPath: $.Employees[*][?({id} in @.serviceHistory[*].id)].tenantId - - - jsonPath: $.Employees.*.serviceHistory.*.id - - - jsonPath: $.Employees[*][?({id} in @.serviceHistory[*].id)].uuid - - - jsonPath: $.Employees.*.serviceHistory.*.serviceStatus - - - jsonPath: $.Employees.*.serviceHistory.*.serviceFrom - - - jsonPath: $.Employees.*.serviceHistory.*.serviceTo - - - jsonPath: $.Employees.*.serviceHistory.*.orderNo - - - jsonPath: $.Employees.*.serviceHistory.*.isCurrentPosition - - - jsonPath: $.Employees.*.serviceHistory.*.location - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.serviceHistory.*.auditDetails.lastModifiedDate - - - - query: INSERT INTO eg_hrms_jurisdiction (uuid, employeeid, hierarchy, boundarytype, boundary, tenantid, isActive, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.jurisdictions.* - jsonMaps: - - - jsonPath: $.Employees.*.jurisdictions.*.id - - - jsonPath: $.Employees[*][?({id} in @.jurisdictions[*].id)].uuid - - - jsonPath: $.Employees.*.jurisdictions.*.hierarchy - - - jsonPath: $.Employees.*.jurisdictions.*.boundaryType - - - jsonPath: $.Employees.*.jurisdictions.*.boundary - - - jsonPath: $.Employees[*][?({id} in @.jurisdictions[*].id)].tenantId - - - jsonPath: $.Employees.*.jurisdictions.*.isActive - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.jurisdictions.*.auditDetails.lastModifiedDate - - - - - query: INSERT INTO eg_hrms_deactivationdetails(uuid, employeeid, reasonfordeactivation, effectivefrom, ordernumber, remarks, tenantid, createdby, createddate, lastmodifiedby, lastModifiedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - - basePath: Employees.*.deactivationDetails.* - jsonMaps: - - - jsonPath: $.Employees.*.deactivationDetails.*.id - - - jsonPath: $.Employees[*][?({id} in @.deactivationDetails[*].id)].uuid - - - jsonPath: $.Employees.*.deactivationDetails.*.reasonForDeactivation - - - jsonPath: $.Employees.*.deactivationDetails.*.effectiveFrom - - - jsonPath: $.Employees.*.deactivationDetails.*.orderNo - - - jsonPath: $.Employees.*.deactivationDetails.*.remarks - - - jsonPath: $.Employees[*][?({id} in @.deactivationDetails[*].id)].tenantId - - - jsonPath: $.Employees.*.deactivationDetails.*.auditDetails.createdBy - - - jsonPath: $.Employees.*.deactivationDetails.*.auditDetails.createdDate - - - jsonPath: $.Employees.*.deactivationDetails.*.auditDetails.lastModifiedBy - - - jsonPath: $.Employees.*.deactivationDetails.*.auditDetails.lastModifiedDate diff --git a/business-services/egov-hrms/src/main/resources/db/Dockerfile b/business-services/egov-hrms/src/main/resources/db/Dockerfile deleted file mode 100644 index a5699ff7d99..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM egovio/flyway:4.1.2 - -COPY ./migration/main /flyway/sql - -COPY migrate.sh /usr/bin/migrate.sh - -RUN chmod +x /usr/bin/migrate.sh - -CMD ["/usr/bin/migrate.sh"] diff --git a/business-services/egov-hrms/src/main/resources/db/migrate.sh b/business-services/egov-hrms/src/main/resources/db/migrate.sh deleted file mode 100644 index f79b7016299..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migrate.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -baseurl=$DB_URL -echo "the baseurl : $DB_URL" -schemasetter="?currentSchema=" -schemas=$SCHEMA_NAME -echo "the schemas : $schemas" -for schemaname in ${schemas//,/ } -do - echo "the schema name : ${baseurl}${schemasetter}${schemaname}" - flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate -done \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190122152236__create_hrms_employee_table_ddl.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20190122152236__create_hrms_employee_table_ddl.sql deleted file mode 100644 index ea38846f3b3..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190122152236__create_hrms_employee_table_ddl.sql +++ /dev/null @@ -1,159 +0,0 @@ -CREATE TABLE eg_hrms_employee ( - id BIGINT NOT NULL, - uuid CHARACTER VARYING(1024) NOT NULL, - code CHARACTER VARYING(250), - phone CHARACTER VARYING(250), - name CHARACTER VARYING(250), - dateOfAppointment BIGINT, - employeestatus CHARACTER VARYING(250), - employeetype CHARACTER VARYING(250), - active BOOLEAN, - tenantid CHARACTER VARYING(250) NOT NULL, - createdby CHARACTER VARYING(250) NOT NULL, - createddate BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING(250), - lastModifiedDate BIGINT, - - CONSTRAINT pk_eghrms_employee PRIMARY KEY (uuid), - CONSTRAINT uk_eghrms_employee_code UNIQUE (code) -); - - - -CREATE TABLE eg_hrms_assignment ( - uuid CHARACTER VARYING(1024) NOT NULL, - employeeid CHARACTER VARYING(1024) NOT NULL, - position BIGINT, - department CHARACTER VARYING(250), - designation CHARACTER VARYING(250), - fromdate BIGINT, - todate BIGINT, - govtordernumber CHARACTER VARYING(250), - reportingto CHARACTER VARYING(250), - isHOD BOOLEAN, - tenantid CHARACTER VARYING(250) NOT NULL, - createdby CHARACTER VARYING(250) NOT NULL, - createddate BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING(250), - lastModifiedDate BIGINT, - - CONSTRAINT pk_eghrms_assignment PRIMARY KEY (uuid), - CONSTRAINT ck_eghrms_employee_fromTo CHECK (fromdate <= todate), - CONSTRAINT fk_eghrms_assignment_employeeid FOREIGN KEY (employeeid) REFERENCES eg_hrms_employee (uuid) ON DELETE CASCADE - -); - - -CREATE TABLE eg_hrms_educationaldetails ( - uuid CHARACTER VARYING(1024) NOT NULL, - employeeid CHARACTER VARYING(1024) NOT NULL, - qualification CHARACTER VARYING(250), - stream CHARACTER VARYING(250), - yearofpassing BIGINT, - university CHARACTER VARYING(250), - remarks CHARACTER VARYING(250), - tenantid CHARACTER VARYING(250) NOT NULL, - createdby CHARACTER VARYING(250) NOT NULL, - createddate BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING(250), - lastModifiedDate BIGINT, - - CONSTRAINT pk_eghrms_educationaldetails PRIMARY KEY (uuid), - CONSTRAINT fk_eghrms_educationaldetails_employeeid FOREIGN KEY (employeeid) REFERENCES eg_hrms_employee (uuid) ON DELETE CASCADE - -); - - -CREATE TABLE eg_hrms_departmentaltests ( - uuid CHARACTER VARYING(1024) NOT NULL, - employeeid CHARACTER VARYING(1024) NOT NULL, - test CHARACTER VARYING(250), - yearofpassing BIGINT, - remarks CHARACTER VARYING(250), - tenantid CHARACTER VARYING(250) NOT NULL, - createdby CHARACTER VARYING(250) NOT NULL, - createddate BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING(250), - lastModifiedDate BIGINT, - - CONSTRAINT pk_eghrms_departmentaltests PRIMARY KEY (uuid), - CONSTRAINT fk_eghrms_departmentaltests_employeeid FOREIGN KEY (employeeid) REFERENCES eg_hrms_employee (uuid) ON DELETE CASCADE - -); - - -CREATE TABLE eg_hrms_empdocuments ( - uuid CHARACTER VARYING(1024) NOT NULL, - employeeid CHARACTER VARYING(1024) NOT NULL, - documentid CHARACTER VARYING(250) NOT NULL, - documentname CHARACTER VARYING(250), - referencetype CHARACTER VARYING(250), - referenceid CHARACTER VARYING(250) NOT NULL, - tenantid CHARACTER VARYING(250) NOT NULL, - createdby CHARACTER VARYING(250) NOT NULL, - createddate BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING(250), - lastModifiedDate BIGINT, - - CONSTRAINT pk_eghrms_empdocuments PRIMARY KEY (uuid), - CONSTRAINT fk_eghrms_empdocuments_employeeid FOREIGN KEY (employeeid) REFERENCES eg_hrms_employee (uuid) ON DELETE CASCADE - -); - - -CREATE TABLE eg_hrms_servicehistory ( - uuid CHARACTER VARYING(1024) NOT NULL, - employeeid CHARACTER VARYING(1024) NOT NULL, - servicestatus CHARACTER VARYING(250), - servicefrom BIGINT, - serviceto BIGINT, - ordernumber CHARACTER VARYING(250), - isCurrentPosition BOOLEAN, - location CHARACTER VARYING(250), - tenantid CHARACTER VARYING(250) NOT NULL, - createdby CHARACTER VARYING(250) NOT NULL, - createddate BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING(250), - lastModifiedDate BIGINT, - - CONSTRAINT pk_eghrms_servicehistory PRIMARY KEY (uuid), - CONSTRAINT fk_eghrms_servicehistory_employeeid FOREIGN KEY (employeeid) REFERENCES eg_hrms_employee (uuid) ON DELETE CASCADE - -); - -CREATE TABLE eg_hrms_jurisdiction ( - uuid CHARACTER VARYING(1024) NOT NULL, - employeeid CHARACTER VARYING(1024) NOT NULL, - hierarchy CHARACTER VARYING(250) NOT NULL, - boundarytype CHARACTER VARYING(250) NOT NULL, - boundary CHARACTER VARYING(250) NOT NULL, - tenantid CHARACTER VARYING(250) NOT NULL, - createdby CHARACTER VARYING(250) NOT NULL, - createddate BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING(250), - lastModifiedDate BIGINT, - - CONSTRAINT pk_eghrms_jurisdiction PRIMARY KEY (uuid), - CONSTRAINT fk_eghrms_jurisdiction_employeeid FOREIGN KEY (employeeid) REFERENCES eg_hrms_employee (uuid) ON DELETE CASCADE - -); - -CREATE TABLE eg_hrms_deactivationdetails ( - uuid CHARACTER VARYING(1024) NOT NULL, - employeeid CHARACTER VARYING(1024) NOT NULL, - reasonfordeactivation CHARACTER VARYING(250), - effectivefrom BIGINT, - ordernumber CHARACTER VARYING(250), - typeOfDeactivation CHARACTER VARYING(250), - tenantid CHARACTER VARYING(250) NOT NULL, - createdby CHARACTER VARYING(250) NOT NULL, - createddate BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING(250), - lastModifiedDate BIGINT, - - CONSTRAINT pk_eghrms_deactivationdetails PRIMARY KEY (uuid), - CONSTRAINT fk_eghrms_deactivationdetails_employeeid FOREIGN KEY (employeeid) REFERENCES eg_hrms_employee (uuid) ON DELETE CASCADE - -); - - diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190130120650__alter_assgnmt_add_currentassgmt_ddl.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20190130120650__alter_assgnmt_add_currentassgmt_ddl.sql deleted file mode 100644 index cbf835475d0..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190130120650__alter_assgnmt_add_currentassgmt_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE eg_hrms_assignment ADD COLUMN iscurrentassignment BOOLEAN; \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190204154948__create_position_sequence_ddl.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20190204154948__create_position_sequence_ddl.sql deleted file mode 100644 index 9cd94842b9c..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190204154948__create_position_sequence_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE SEQUENCE EG_HRMS_POSITION; diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190204163735__alter_deactivation_rename_remarks_ddl.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20190204163735__alter_deactivation_rename_remarks_ddl.sql deleted file mode 100644 index 48fa186edf2..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190204163735__alter_deactivation_rename_remarks_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE eg_hrms_deactivationdetails RENAME COLUMN typeOfDeactivation TO remarks; diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190204172710__secondary_indexes_ddl.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20190204172710__secondary_indexes_ddl.sql deleted file mode 100644 index ad6f5458476..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190204172710__secondary_indexes_ddl.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE INDEX code_idx ON eg_hrms_employee ("code"); -CREATE INDEX dept_idx ON eg_hrms_assignment ("department"); -CREATE INDEX posn_idx ON eg_hrms_assignment ("position"); -CREATE INDEX desg_idx ON eg_hrms_assignment ("designation"); \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190215120811__alter_uk_constraint_dml.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20190215120811__alter_uk_constraint_dml.sql deleted file mode 100644 index 06a6ebf8635..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190215120811__alter_uk_constraint_dml.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE eg_hrms_employee DROP CONSTRAINT uk_eghrms_employee_code; -ALTER TABLE eg_hrms_employee ADD CONSTRAINT uk_eghrms_employee_code UNIQUE (code, tenantid); \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190219163221__alter_remove_phone_name_clm_dml.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20190219163221__alter_remove_phone_name_clm_dml.sql deleted file mode 100644 index 851d369e121..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190219163221__alter_remove_phone_name_clm_dml.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE eg_hrms_employee DROP COLUMN phone; -ALTER TABLE eg_hrms_employee DROP COLUMN name; \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190301154105__alter_add_isactive_ddl.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20190301154105__alter_add_isactive_ddl.sql deleted file mode 100644 index 9ddb8794f36..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20190301154105__alter_add_isactive_ddl.sql +++ /dev/null @@ -1,6 +0,0 @@ -ALTER TABLE eg_hrms_departmentaltests ADD COLUMN isActive BOOLEAN; -ALTER TABLE eg_hrms_educationaldetails ADD COLUMN isActive BOOLEAN; -ALTER TABLE eg_hrms_jurisdiction ADD COLUMN isActive BOOLEAN; -ALTER TABLE eg_hrms_assignment ADD COLUMN isActive BOOLEAN; -ALTER TABLE eg_hrms_deactivationdetails ADD COLUMN isActive BOOLEAN; -ALTER TABLE eg_hrms_servicehistory ADD COLUMN isActive BOOLEAN; \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20201005230836__eg_hrms_employee_index_ddl.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20201005230836__eg_hrms_employee_index_ddl.sql deleted file mode 100644 index b9b8017f1eb..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20201005230836__eg_hrms_employee_index_ddl.sql +++ /dev/null @@ -1 +0,0 @@ - CREATE index if not exists idx_eg_hrms_employee_tenantid ON eg_hrms_employee USING btree (tenantid); diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20201223230836__eg_hrms_employee_reactivation_details_index_ddl.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20201223230836__eg_hrms_employee_reactivation_details_index_ddl.sql deleted file mode 100644 index 2c4b6633804..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20201223230836__eg_hrms_employee_reactivation_details_index_ddl.sql +++ /dev/null @@ -1,19 +0,0 @@ - ALTER TABLE eg_hrms_employee ADD COLUMN reactivateemployee BOOLEAN; - - CREATE TABLE eg_hrms_reactivationdetails ( - uuid CHARACTER VARYING(1024) NOT NULL, - employeeid CHARACTER VARYING(1024) NOT NULL, - reasonforreactivation CHARACTER VARYING(250), - effectivefrom BIGINT, - ordernumber CHARACTER VARYING(250), - remarks CHARACTER VARYING(250), - tenantid CHARACTER VARYING(250) NOT NULL, - createdby CHARACTER VARYING(250) NOT NULL, - createddate BIGINT NOT NULL, - lastmodifiedby CHARACTER VARYING(250), - lastModifiedDate BIGINT, - - CONSTRAINT pk_eghrms_reactivationdetails PRIMARY KEY (uuid), - CONSTRAINT fk_eghrms_reactivationdetails_employeeid FOREIGN KEY (employeeid) REFERENCES eg_hrms_employee (uuid) ON DELETE CASCADE - - ); diff --git a/business-services/egov-hrms/src/main/resources/db/migration/main/V20201228172710__reactivation_indexes_ddl.sql b/business-services/egov-hrms/src/main/resources/db/migration/main/V20201228172710__reactivation_indexes_ddl.sql deleted file mode 100644 index 96f05aae2ee..00000000000 --- a/business-services/egov-hrms/src/main/resources/db/migration/main/V20201228172710__reactivation_indexes_ddl.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE INDEX reactivation_employeeid_idx ON eg_hrms_reactivationdetails ("employeeid"); \ No newline at end of file diff --git a/business-services/egov-hrms/src/test/resources/application.properties b/business-services/egov-hrms/src/test/resources/application.properties deleted file mode 100644 index f8216b1d92e..00000000000 --- a/business-services/egov-hrms/src/test/resources/application.properties +++ /dev/null @@ -1,108 +0,0 @@ -#---------------------------- DATABASE CONFIGURATIONS -----------------------------# -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/hr_employee_db -spring.datasource.username=postgres -spring.datasource.password=postgres - -#----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -flyway.url=jdbc:postgresql://localhost:5432/hr_employee_db -flyway.user=postgres -flyway.password=postgres -flyway.table=hr_employee_schema_version -flyway.baseline-on-migrate=true -flyway.outOfOrder=true -flyway.locations=db/migration/main,db/migration/seed - -#--------------------------- PATH & PORT CONFIGURATIONS ---------------------------# -server.contextPath=/hr-employee-v2 -server.port=9999 - -#---------------------------- TIMEZONE CONFIGURATIONS -----------------------------# -app.timezone=UTC - -#-------------------------- EXTERNAL API CONFIGURATIONS ---------------------------# -egov.services.data_sync_employee.required = false - -# HR-EMPLOYEE (SELF) SERVICE PATH -egov.services.hr_employee_service.hostname=https://dev.digit.org -egov.services.hr_employee_service.basepath=/hr-employee-v2 -egov.services.hr_employee_service.employee.createpath=/employees/_create -egov.services.hr_employee_service.default.password=abcdefgh - -# USER SERVICE PATH -egov.services.users_service.hostname=https://dev.digit.org -egov.services.users_service.users.basepath=/user -egov.services.users_service.users.searchpath=/v1/_search -egov.services.users_service.users.createpath=/users/_createnovalidate -egov.services.users_service.users.updatepath=/users/_updatenovalidate - -# HR-MASTERS SERVICE PATH -egov.services.hr_masters_service.hostname=https://dev.digit.org -egov.services.hr_masters_service.basepath=/hr-masters-v2 -egov.services.hr_masters_service.positions.searchpath=/positions/_search -egov.services.hr_masters_service.designations.searchpath=/designations/_search -egov.services.hr_masters_service.hr_configurations.searchpath=/hrconfigurations/_search -egov.services.hr_masters_service.vacantpositions.searchpath=/vacantpositions/_search -egov.services.hr_masters_service.empstatus.searchpath=//hrstatuses/_search -egov.services.hr_masters_service.emptype.searchpath=/employeetypes/_search - -# HYBRID-DATA-SYNC SERVICE PATH -egov.services.data_sync_employee_service.hostname=http://dev.digit.org -egov.services.data_sync_employee_service.basepath=/data-sync-employee -egov.services.data_sync_employee_service.createpath=/datasync/_create - -# ID GENERATION SERVICE PATH -egov.services.egov_idgen.hostname=http://dev.digit.org -egov.services.egov_idgen.createpath=/egov-idgen/id/_generate -egov.services.egov_idgen.emp.code.name=employee.code -egov.services.egov_idgen.emp.code.format=EMP_[SEQ_EMPLOYEE_CODE] - -# COMMON-WORKFLOW SERVICE PATH -egov.services.common_workflows_service.hostname=http://dev.digit.org -egov.services.common_workflows_service.searchpath=/egov-common-workflows/tasks/_search - -# MDMS SERVICE PATH -egov.services.egov_mdms.hostname=https://dev.digit.org/ -egov.services.egov_mdms.searchpath=egov-mdms-service/v1/_search - -# ERP SERVICE PATH -egov.services.eis_service.hostname=http://dev.digit.org -egov.municipality.host=http://kurnool-pilot-services.egovernments.org/ -egov.services.eis_service.employeeposition.searchpath=employeepositions/_search - -#------------------------------ KAFKA CONFIGURATIONS ------------------------------# -# KAFKA SERVER CONFIGURATIONS -spring.kafka.bootstrap.servers=localhost:9092 - -# SPRING KAFKA CONSUMER CONFIGURATIONS -spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=employee-group1 - -# SPRING KAFKA PRODUCER CONFIGURATIONS -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer - -# KAFKA TOPIC CONFIGURATIONS -kafka.topics.notification.sms.name=egov.employee -kafka.topics.notification.sms.id=employee -kafka.topics.notification.sms.group=employee-group1 -kafka.topics.employee.savedb.name=egov.employee -kafka.topics.employee.savedb.key=employee-save -kafka.topics.employee.finance.name=egov.employee.finance -kafka.topics.employee.finance.key=employee-finance -kafka.topics.employee.updatedb.name=egov.employee.update -kafka.topics.nominee.savedb.name=hr-employee.nominee.save -kafka.topics.nominee.savedb.key=hr-employee.nominee.save.key -kafka.topics.nominee.updatedb.name=hr-employee.nominee.update -kafka.topics.nominee.updatedb.key=hr-employee.nominee.update.key -kafka.topics.assignment.update.name=hr-employee.assignment.update -kafka.topics.assignment.update.key=hr-employee.assignment.update.key - -#------------------------------ TRACER CONFIGURATIONS -----------------------------# -# tracer.detailed.tracing.enabled=false - -#------------------------------ LOGGER CONFIGURATIONS -----------------------------# -logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} - -log4j.logger.org.springframework.jdbc.core = TRACE \ No newline at end of file diff --git a/business-services/egov-hrms/src/test/resources/db/migrate.sh b/business-services/egov-hrms/src/test/resources/db/migrate.sh deleted file mode 100644 index 54d07c0940a..00000000000 --- a/business-services/egov-hrms/src/test/resources/db/migrate.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate diff --git a/business-services/finance-collections-voucher-consumer/CHANGELOG.md b/business-services/finance-collections-voucher-consumer/CHANGELOG.md deleted file mode 100644 index 79d8880f0a2..00000000000 --- a/business-services/finance-collections-voucher-consumer/CHANGELOG.md +++ /dev/null @@ -1,34 +0,0 @@ -# Changelog -All notable changes to this module will be documented in this file. - -## 1.1.6 - 2022-01-13 -- Updated to log4j2 version 2.17.1 - -## 1.1.5 - 2021-07-27 -- minor bug fixes - -## 1.1.4 - 2021-06-03 -- Passing business service value while consuming view receipt api -- Fixed voucher creation issue in case of advance amount is collected -- Reading authorisation header key from the configuration files - -## 1.1.3 - 2021-05-11 -- Updated config in application.properties - -## 1.1.2 - 2021-02-26 -- Updated domain name in application.properties - -## 1.1.1 - 2020-10-09 -- Ignore and start server even Kafka topic is missing - -## 1.1.0 - 2020-06-22 - -- Handling the Payment Request to persist the vouchers. -- Handled dishonor of instruments to create the reversal voucher. -- Handled back updation of instrument with reversal voucher id. -- Upgraded to `tracer:2.0.0-SNAPSHOT` -- Upgraded to `Spring boot 2.2.6` - -## 1.0.0 - -- Base version diff --git a/business-services/finance-collections-voucher-consumer/LOCALSETUP.md b/business-services/finance-collections-voucher-consumer/LOCALSETUP.md deleted file mode 100644 index 86b059bbbd0..00000000000 --- a/business-services/finance-collections-voucher-consumer/LOCALSETUP.md +++ /dev/null @@ -1,47 +0,0 @@ -# Local Setup - -To setup the finance-collections-voucher-consumer service in your local system, clone the [Business services repository](https://github.com/egovernments/business-services). - -## Dependencies - - -### Infra Dependency - -- [X] Postgres DB -- [ ] Redis -- [ ] Elasticsearch -- [X] Kafka - - [X] Consumer - - [ ] Producer - -## Running Locally - -To run the finance-collections-voucher-consumer service locally, you need to port forward below services. - -```bash -function kgpt(){kubectl get pods -n egov --selector=app=$1 --no-headers=true | head -n1 | awk '{print $1}'} -kubectl port-forward -n egov $(kgpt egov-mdms-service) 8081:8080 -kubectl port-forward -n egov $(kgpt egov-user) 8082:8080 -kubectl port-forward -n egov $(kgpt egov-instrument) 8083:8080 -kubectl port-forward -n egov $(kgpt collection-service) 8084:8080 -kubectl port-forward -n egov $(kgpt egf-master) 8085:8080 -``` - -Update below listed properties in `application.properties` before running the project: - -```ini -# {egov-user service hostname} -egov.services.egov.user.host = http://127.0.0.1:8082 - -# {egov-mdms-service service hostname} -egov.services.mdms.hostname = http://127.0.0.1:8081 - -# {egf-instrument service hostname} -egov.services.egfinstrument.hostname = http://127.0.0.1:8083 - -# {collection-service service hostname} -egov.services.collections.hostname = http://127.0.0.1:8084 - -# {egf-master service hostname} -egov.services.egfmaster.hostname = http://127.0.0.1:8085 -``` diff --git a/business-services/finance-collections-voucher-consumer/README.md b/business-services/finance-collections-voucher-consumer/README.md deleted file mode 100644 index 15fb9ae7b2d..00000000000 --- a/business-services/finance-collections-voucher-consumer/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# finance-collections-voucher-consumer service - -finance-collections-voucher-consumer service creates vouchers and instruments for the receipts collected through the collection service. - -### DB UML Diagram - -NA - -### Service Dependencies - -- egov-mdms-service -- collection-service -- egf-instrument -- egov-user -- egf-master -- Finance co existence service - -### Swagger API Contract - -NA - -## Service Details - -finance-collections-voucher-consumer service creates vouchers and instruments for the receipts collected through the collection service. - -### API Details - -NA - -### Kafka Consumers - -egov.collection.receipt.voucher.save.topic : egov.collection.receipt-create - Creates Collection V1 receipt voucher, updates the voucher number with the corresponding receipt and creates instrument. -egov.collection.receipt.voucher.cancel.topic : egov.collection.receipt-cancel - Cancels Collection V1 receipt voucher and corresponding instrument. -kafka.topics.payment.create.name : egov.collection.payment-create - Creates Collection V2 receipt voucher, updates the voucher number with the corresponding receipt and creates instrument. -kafka.topics.payment.cancel.name : egov.collection.payment-cancel - Cancels Collection V2 receipt voucher and corresponding instrument. - -### Kafka Producers - -NA diff --git a/business-services/finance-collections-voucher-consumer/pom.xml b/business-services/finance-collections-voucher-consumer/pom.xml deleted file mode 100644 index b45b7d01ccd..00000000000 --- a/business-services/finance-collections-voucher-consumer/pom.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - org.egov - finance-collections-voucher-consumer - 1.1.6-SNAPSHOT - finance-collections-voucher-consumer - Service to create the voucher by consuming receipt data from collection service - - - 2.17.1 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-beans - 5.2.20.RELEASE - - - org.springframework.kafka - spring-kafka - - - - org.springframework.boot - spring-boot-devtools - runtime - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.postgresql - postgresql - runtime - - - org.projectlombok - lombok - true - - - - org.springframework.boot - spring-boot-starter-test - test - - - - org.egov.services - tracer - 2.0.0-SNAPSHOT - - - - org.flywaydb - flyway-core - - - - - - repo.egovernments.org - eGov Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - repo.egovernments.org.snapshots - eGov Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - true - - - - org.apache.maven.plugins - maven-jar-plugin - - - - - - diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/FinanceCollectionsVoucherConsumerApplication.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/FinanceCollectionsVoucherConsumerApplication.java deleted file mode 100644 index 320c849fda3..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/FinanceCollectionsVoucherConsumerApplication.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov; - -import java.util.TimeZone; - -import javax.annotation.PostConstruct; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - -@SpringBootApplication -public class FinanceCollectionsVoucherConsumerApplication{ - @Value("${app.timezone}") - private String timeZone; - - @PostConstruct - public void initialize() { - TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); - } - - @Bean - public ObjectMapper getObjectMapper() { - final ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - objectMapper.setTimeZone(TimeZone.getTimeZone(timeZone)); - return objectMapper; - } - - public static void main(String[] args) { - SpringApplication.run(FinanceCollectionsVoucherConsumerApplication.class, args); - } - - - @Bean - public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); - objectMapper.setTimeZone(TimeZone.getTimeZone(timeZone)); - converter.setObjectMapper(objectMapper); - return converter; - } - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/mdms/service/MicroServiceUtil.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/mdms/service/MicroServiceUtil.java deleted file mode 100644 index 1939999e201..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/mdms/service/MicroServiceUtil.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.mdms.service; - -import java.util.List; - -import org.egov.receipt.consumer.model.BusinessService; -import org.egov.receipt.consumer.model.FinanceMdmsModel; -import org.egov.receipt.consumer.model.FinancialStatus; -import org.egov.receipt.consumer.model.InstrumentContract; -import org.egov.receipt.consumer.model.InstrumentSearchContract; -import org.egov.receipt.consumer.model.RequestInfo; -import org.egov.receipt.consumer.model.TaxHeadMaster; -import org.egov.receipt.consumer.model.Tenant; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.egov.tracer.model.CustomException; - -public interface MicroServiceUtil { - public List getTaxHeadMasters(String tenantId, String code, RequestInfo requestInfo, FinanceMdmsModel finSerMdms) throws CustomException, VoucherCustomException; - public List getBusinessService(String tenantId, String code, RequestInfo requestInfo, FinanceMdmsModel finSerMdms) throws CustomException, VoucherCustomException; - String getBusinessServiceName(String tenantId, String code, RequestInfo requestInfo, FinanceMdmsModel finSerMdms) - throws VoucherCustomException; - String getGlcodeByInstrumentType(String tenantId, String businessCode, RequestInfo requestInfo, - FinanceMdmsModel finSerMdms, String instrumentType) throws VoucherCustomException; - FinancialStatus getFinancialStatusByCode(String tenantId, RequestInfo requestInfo, FinanceMdmsModel finSerMdms, - String statusCode) throws VoucherCustomException; - List getFinanceTenantList(String tenantId, String businessCode, RequestInfo requestInfo, FinanceMdmsModel finSerMdms) - throws VoucherCustomException; - List getInstruments(InstrumentSearchContract instrumentSearchContract, RequestInfo requestInfo, - String tenantId) throws VoucherCustomException; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/mdms/service/MicroServiceUtilImpl.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/mdms/service/MicroServiceUtilImpl.java deleted file mode 100644 index e4b5e98cffd..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/mdms/service/MicroServiceUtilImpl.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.mdms.service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.egov.receipt.consumer.model.BusinessService; -import org.egov.receipt.consumer.model.FinanceMdmsModel; -import org.egov.receipt.consumer.model.FinancialStatus; -import org.egov.receipt.consumer.model.InstrumentContract; -import org.egov.receipt.consumer.model.InstrumentGlCodeMapping; -import org.egov.receipt.consumer.model.InstrumentResponse; -import org.egov.receipt.consumer.model.InstrumentSearchContract; -import org.egov.receipt.consumer.model.MasterDetail; -import org.egov.receipt.consumer.model.MdmsCriteria; -import org.egov.receipt.consumer.model.MdmsCriteriaReq; -import org.egov.receipt.consumer.model.ModuleDetail; -import org.egov.receipt.consumer.model.OnlineGLCodeMapping; -import org.egov.receipt.consumer.model.ProcessStatus; -import org.egov.receipt.consumer.model.RequestInfo; -import org.egov.receipt.consumer.model.RequestInfoWrapper; -import org.egov.receipt.consumer.model.TaxHeadMaster; -import org.egov.receipt.consumer.model.Tenant; -import org.egov.receipt.consumer.repository.ServiceRequestRepository; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.egov.reciept.consumer.config.PropertiesManager; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; - -@Service -public class MicroServiceUtilImpl implements MicroServiceUtil{ - private static final String FIN_MODULE_NAME = "FinanceModule"; - private static final String BILLSERVICE_MODULE_NAME = "BillingService"; - private static final String FINANCE_CODE = "Finance"; - private static final Object ONLINE_INSTRUMENT_TYPE = "Online"; - private static final String BUSINESS_SERVICE_MAPP_MASTER = "BusinessServiceMapping"; - private static final String TAX_HEAD_MAPP_MASTER = "TaxHeadMasterGlCodeMapping"; - private static final String INSTRUMENT_GLCODE_MAPP_MASTER = "InstrumentGLcodeMapping"; - private static final String FIN_INSTRUMENT_STATUS_MAPP_MASTER = "FinanceInstrumentStatusMapping"; - private static final String ONLINE_GLCODE_MAPP_MASTER = "OnlineGLCodeMapping"; - private static final String BUSINESS_SERVICE_MASTER = "BusinessService"; - private static final String CITY_MODULE_MASTER = "citymodule"; - private static final String TENANT_MODULE_NAME = "tenant"; - @Autowired - private PropertiesManager manager; - @Autowired - private MdmsCriteria mdmscriteria; - @Autowired - private MdmsCriteriaReq mdmsrequest; - @Autowired - private ObjectMapper mapper; - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Override - public List getBusinessService(String tenantId, String code, RequestInfo requestInfo, FinanceMdmsModel finSerMdms) throws VoucherCustomException{ - if(finSerMdms.getFinanceServiceMdmsData() == null){ - this.getFinanceServiceMdmsData(tenantId, code, requestInfo, finSerMdms); - } - List list = new ArrayList<>(); - try { - if(finSerMdms.getFinanceServiceMdmsData() != null){ - list = mapper.convertValue(JsonPath.read(finSerMdms.getFinanceServiceMdmsData(), "$.MdmsRes.FinanceModule.BusinessServiceMapping"),new TypeReference>(){}); - } - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED,"Error while parsing mdms data. Check the business/account head mapping json file."); - } - return list; - } - - @Override - public List getTaxHeadMasters(String tenantId,String code, RequestInfo requestInfo, FinanceMdmsModel finSerMdms) throws VoucherCustomException { - if(finSerMdms.getFinanceServiceMdmsData() == null){ - this.getFinanceServiceMdmsData(tenantId, code, requestInfo, finSerMdms); - } - List list = new ArrayList<>(); - try { - if(finSerMdms.getFinanceServiceMdmsData() != null){ - list = mapper.convertValue(JsonPath.read(finSerMdms.getFinanceServiceMdmsData(), "$.MdmsRes.FinanceModule.TaxHeadMasterGlCodeMapping"),new TypeReference>(){}); - } - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED,"Error while parsing mdms data for TaxHeadMasterGlCodeMapping master. Check the business/account head mapping json file."); - } - return list; - } - /** - * - * @param tenantId - * @param businessServiceCode - * @return - * @throws VoucherCustomException - * Function which is used to fetch the finance service mdms data based on Business Service code. - */ - public void getFinanceServiceMdmsData(String tenantId,String businessServiceCode, RequestInfo requestInfo, FinanceMdmsModel finSerMdms) throws VoucherCustomException{ - StringBuilder mdmsUrl = new StringBuilder(manager.getMdmsHostUrl()+manager.getMdmsSearchUrl()); - List moduleDetails = new ArrayList<>(); - this.addFinanceModule(moduleDetails, businessServiceCode); - this.addBillingServiceModule(moduleDetails, businessServiceCode); - this.addTenantModule(moduleDetails); - mdmscriteria.setTenantId(tenantId); - mdmscriteria.setModuleDetails(moduleDetails); - mdmsrequest.setRequestInfo(requestInfo); - mdmsrequest.setMdmsCriteria(mdmscriteria); - try { - Map postForObject = mapper.convertValue(serviceRequestRepository.fetchResult(mdmsUrl, mdmsrequest, tenantId), Map.class); - finSerMdms.setFinanceServiceMdmsData(postForObject); - } catch (ServiceCallException e) { - - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED,"Error Occured While calling the URL : "+mdmsUrl); - } - } - - private void addFinanceModule(List moduleDetails,String businessServiceCodes){ - ArrayList masterDetailsList = new ArrayList<>(); - masterDetailsList.add(new MasterDetail(BUSINESS_SERVICE_MAPP_MASTER,businessServiceCodes != null ? "[?(" + prepareFilter(businessServiceCodes,"code") + ")]" : null)); - masterDetailsList.add(new MasterDetail(TAX_HEAD_MAPP_MASTER,businessServiceCodes != null ? "[?(" + prepareFilter(businessServiceCodes,"billingservicecode") + ")]":null)); - masterDetailsList.add(new MasterDetail(INSTRUMENT_GLCODE_MAPP_MASTER,null)); - masterDetailsList.add(new MasterDetail(FIN_INSTRUMENT_STATUS_MAPP_MASTER,null)); - masterDetailsList.add(new MasterDetail(ONLINE_GLCODE_MAPP_MASTER,businessServiceCodes != null ? "[?(" + prepareFilter(businessServiceCodes,"servicecode") + ")]" : null)); - moduleDetails.add(new ModuleDetail(FIN_MODULE_NAME, masterDetailsList)); - } - - private String prepareFilter(String businessServiceCodes, String key) { - StringBuilder builder = new StringBuilder(); - if(businessServiceCodes.split(",").length <= 1){ - return builder.append("@.").append(key).append("=='").append(businessServiceCodes).append("'").toString(); - }else{ - String[] split = businessServiceCodes.split(","); - for(String str:split){ - if(builder.toString().isEmpty()){ - builder.append("@.").append(key).append("=='").append(str).append("'"); - }else { - builder.append(" || ").append("@.").append(key).append("=='").append(str).append("'"); - } - } - } - return builder.toString(); - } - - private void addBillingServiceModule(List moduleDetails,String businessServiceCode){ - ArrayList masterDetailsList = new ArrayList<>(); - masterDetailsList.add(new MasterDetail(BUSINESS_SERVICE_MASTER,businessServiceCode != null ? "[?(@.code=='" + businessServiceCode + "')]" : null)); - moduleDetails.add(new ModuleDetail(BILLSERVICE_MODULE_NAME, masterDetailsList)); - } - - private void addTenantModule(List moduleDetails){ - ArrayList masterDetailsList = new ArrayList<>(); - masterDetailsList.add(new MasterDetail(CITY_MODULE_MASTER,"[?(@.code=='" + FINANCE_CODE + "')]")); - moduleDetails.add(new ModuleDetail(TENANT_MODULE_NAME, masterDetailsList)); - } - - @Override - public String getBusinessServiceName(String tenantId,String code, RequestInfo requestInfo, FinanceMdmsModel finSerMdms) throws VoucherCustomException { - if(finSerMdms.getFinanceServiceMdmsData() == null){ - this.getFinanceServiceMdmsData(tenantId, code, requestInfo, finSerMdms); - } - List list = new ArrayList<>(); - try { - if(finSerMdms.getFinanceServiceMdmsData() != null){ - list = mapper.convertValue(JsonPath.read(finSerMdms.getFinanceServiceMdmsData(), "$.MdmsRes.BillingService.BusinessService"),new TypeReference>(){}); - } - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED,"Error while parsing mdms data for BusinessService master. Check the business/account head mapping json file."); - } - return !list.isEmpty() ? list.get(0).getBusinessService() : code; - } - - @Override - public String getGlcodeByInstrumentType(String tenantId,String businessCode,RequestInfo requestInfo, FinanceMdmsModel finSerMdms,String instrumentType) throws VoucherCustomException { - if(finSerMdms.getFinanceServiceMdmsData() == null){ - this.getFinanceServiceMdmsData(tenantId, businessCode, requestInfo, finSerMdms); - } - try { - if(finSerMdms.getFinanceServiceMdmsData() != null){ - if(ONLINE_INSTRUMENT_TYPE.equals(instrumentType)){ - /* Online instrument type mapped at ULB level*/ - List list = mapper.convertValue(JsonPath.read(finSerMdms.getFinanceServiceMdmsData(), "$.MdmsRes.FinanceModule.OnlineGLCodeMapping"),new TypeReference>(){}); - List collect = list.stream().filter(inst -> inst.getServicecode().equals(businessCode)).collect(Collectors.toList()); - return !collect.isEmpty() ? collect.get(0).getGlcode() : null; - }else{ - List list = mapper.convertValue(JsonPath.read(finSerMdms.getFinanceServiceMdmsData(), "$.MdmsRes.FinanceModule.InstrumentGLcodeMapping"),new TypeReference>(){}); - List collect = list.stream().filter(inst -> inst.getInstrumenttype().equalsIgnoreCase(instrumentType)).collect(Collectors.toList()); - return !collect.isEmpty() ? collect.get(0).getGlcode() : null; - } - } - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED,"Error while parsing mdms data for InstrumentGLcodeMapping/OnlineGLCodeMapping master. Check the business/account head mapping json file."); - } - return null; - } - - @Override - public FinancialStatus getFinancialStatusByCode(String tenantId,RequestInfo requestInfo, FinanceMdmsModel finSerMdms,String statusCode) throws VoucherCustomException { - if(finSerMdms.getFinanceServiceMdmsData() == null){ - this.getFinanceServiceMdmsData(tenantId, null, requestInfo, finSerMdms); - } - List list = new ArrayList<>(); - try { - if(finSerMdms.getFinanceServiceMdmsData() != null){ - list = mapper.convertValue(JsonPath.read(finSerMdms.getFinanceServiceMdmsData(), "$.MdmsRes.FinanceModule.FinanceInstrumentStatusMapping"),new TypeReference>(){}); - } - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED,"Error while parsing mdms data for EgfInstrumentStatusMapping master. Check the EgfInstrumentStatusMapping.json file."); - } - List collect = list.stream().filter(fs -> fs.getCode().equals(statusCode)).collect(Collectors.toList()); - return !collect.isEmpty() ? collect.get(0) : null; - } - - @Override - public List getFinanceTenantList(String tenantId, String businessCode,RequestInfo requestInfo, FinanceMdmsModel finSerMdms) throws VoucherCustomException{ - if(finSerMdms.getFinanceServiceMdmsData() == null){ - this.getFinanceServiceMdmsData(tenantId, businessCode, requestInfo, finSerMdms); - } - List list = null; - try { - if(finSerMdms.getFinanceServiceMdmsData() != null){ - list = mapper.convertValue(JsonPath.read(finSerMdms.getFinanceServiceMdmsData(), "$.MdmsRes.tenant.citymodule[0].tenants"),new TypeReference>(){}); - } - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED,"Error while parsing mdms data for CityModule master. Check the CityModule.json file."); - } - return list; - } - - @Override - public List getInstruments(InstrumentSearchContract instrumentSearchContract, RequestInfo requestInfo, String tenantId) throws VoucherCustomException { - StringBuilder uri = new StringBuilder(manager.getInstrumentHostUrl()).append(manager.getInstrumentSearch()); - uri.append("?tenantId=").append(tenantId); - if(instrumentSearchContract.getReceiptIds() != null && !instrumentSearchContract.getReceiptIds().isEmpty()){ - uri.append("&receiptIds=").append(instrumentSearchContract.getReceiptIds()); - } - InstrumentResponse instrumentResponse = mapper.convertValue(serviceRequestRepository.fetchResult(uri, RequestInfoWrapper.builder().requestInfo(requestInfo).build(), tenantId), InstrumentResponse.class); - return instrumentResponse != null ? instrumentResponse.getInstruments() : null; - } - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/mdms/service/TokenService.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/mdms/service/TokenService.java deleted file mode 100644 index 9af675e3716..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/mdms/service/TokenService.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.mdms.service; - -import java.util.HashMap; - -import org.egov.common.contract.request.User; -import org.egov.reciept.consumer.config.PropertiesManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Service; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import org.springframework.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; - -@Service -public class TokenService { - - public static final Logger LOGGER = LoggerFactory.getLogger(TokenService.class); - - @Autowired - private RestTemplate restTemplate; - - @Autowired - private PropertiesManager propertiesManager; - - @Autowired - private ObjectMapper mapper; - - public String generateAdminToken(String tenantId) { - - HttpHeaders header = new HttpHeaders(); - header.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - header.add("Authorization", propertiesManager.getTokenAuhorizationtKey()); - - MultiValueMap map = new LinkedMultiValueMap<>(); - map.add("username", propertiesManager.getSiUser()); - map.add("scope", propertiesManager.getSiScope()); - map.add("password", propertiesManager.getSiPassword()); - map.add("grant_type", propertiesManager.getSiGrantType()); - map.add("tenantId", tenantId); - map.add("userType", propertiesManager.getSiUserType()); - - HttpEntity> request = new HttpEntity<>(map, header); - - try { - LOGGER.debug("call: {}", propertiesManager.getTokenGenUrl()); - Object response = restTemplate.postForObject(propertiesManager.getUserHostUrl().trim() + propertiesManager.getTokenGenUrl().trim(), - request, Object.class); - if (response != null) { - String authToken = String.valueOf(((HashMap) response).get("access_token")); - User userInfo = mapper.convertValue(JsonPath.read(response, "$.UserRequest"),new TypeReference(){}); - propertiesManager.setSiAuthToken(authToken); - propertiesManager.setSiUserInfo(userInfo); - return authToken; - } - } catch (RestClientException e) { - LOGGER.error("Eror while getting admin authtoken : {}", e); - return null; - } - return null; - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/entity/VoucherIntegrationLog.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/entity/VoucherIntegrationLog.java deleted file mode 100644 index 0f216db24bd..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/entity/VoucherIntegrationLog.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.entity; - -import java.util.Date; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class VoucherIntegrationLog { -private String id; -private String referenceNumber; -private String status; -private String voucherNumber; -private String type; -private String requestJson; -private String description; -private String tenantId; -private Date createdDate; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountCodePurpose.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountCodePurpose.java deleted file mode 100644 index d2000c92595..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountCodePurpose.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class AccountCodePurpose { - private Long id = null; - - private String name = null; -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountCodePurposeContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountCodePurposeContract.java deleted file mode 100644 index 11a37c40415..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountCodePurposeContract.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id","name"}) -public class AccountCodePurposeContract extends AuditableContract { - - private String id; - - @NotNull - @Length(max = 256, min = 3) - private String name; - - public AccountCodePurposeContract(String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountDetail.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountDetail.java deleted file mode 100644 index 3e4493303d7..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountDetail.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import java.util.ArrayList; -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class AccountDetail { - - private Long id; - - private Long orderId; - - private String glcode; - - private Double debitAmount; - - private Double creditAmount; - - private Function function; - - private List subledgerDetails = new ArrayList<>(0); - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountDetailKey.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountDetailKey.java deleted file mode 100644 index 1adc404af28..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountDetailKey.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class AccountDetailKey { - - private Long id; - - private AccountDetailType accountDetailType; - - private Long key; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountDetailType.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountDetailType.java deleted file mode 100644 index 830ae55e84f..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AccountDetailType.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class AccountDetailType { - - private Long id; - - private String name; - - private String description; - - private String tableName; - - private Boolean active; - - private String fullyQualifiedName; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AppConfigValues.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AppConfigValues.java deleted file mode 100644 index 6535427b9b5..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AppConfigValues.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@NoArgsConstructor -@ToString -public class AppConfigValues { -private String id; -private String value; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AuditDetails.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AuditDetails.java deleted file mode 100644 index f13545795a7..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AuditDetails.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Builder -@Setter -@Getter -@ToString -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class AuditDetails { - - @JsonProperty("createdBy") - private String createdBy = null; - - @JsonProperty("createdDate") - private Long createdDate = null; - - @JsonProperty("lastModifiedBy") - private String lastModifiedBy = null; - - @JsonProperty("lastModifiedDate") - private Long lastModifiedDate = null; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AuditableContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AuditableContract.java deleted file mode 100644 index 392bddc208f..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/AuditableContract.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.egov.common.contract.request.User; - -import java.util.Date; - -@Setter -@Getter -@AllArgsConstructor -@NoArgsConstructor -public class AuditableContract { - protected String tenantId; - protected User createdBy; - protected User lastModifiedBy; - protected Date createdDate; - protected Date lastModifiedDate; - protected String deleteReason; - - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Bank.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Bank.java deleted file mode 100644 index 5db011414c4..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Bank.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -@EqualsAndHashCode -public class Bank { - - private Long id; - - private String code; - - private String name; - - private String description; - - private Boolean active; - - private String type; - - private String tenantId; -} - - diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankAccount.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankAccount.java deleted file mode 100644 index 6e777a56ddc..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankAccount.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class BankAccount { - - private Long id; - - private String accountNumber; - - private String accountType; - - private String description; - - private Boolean active; - - private String payTo; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankAccountContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankAccountContract.java deleted file mode 100644 index fd20e604dc5..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankAccountContract.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.NotNull; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonProperty.Access; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "bankBranch", "chartOfAccount", "fund", "accountNumber", "accountType", "description", - "active", "payTo", "type" }) -public class BankAccountContract extends AuditableContract implements java.io.Serializable { - - private Long id; - - private BankBranchContract bankBranch; - - @JsonProperty(access = Access.WRITE_ONLY) - private ChartOfAccount chartOfAccount; - - @JsonProperty(access = Access.WRITE_ONLY) - private FundContract fund; - - @NotNull - @Length(max = 25) - private String accountNumber; - - // is this required ? - private String accountType; - @Length(max = 256) - private String description; - - @NotNull - private Boolean active; - - @Length(max = 100) - private String payTo; - - @NotNull - private BankAccountType type; - - public Long getId() { - return this.id; - } - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankAccountType.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankAccountType.java deleted file mode 100644 index 75e5f1c2368..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankAccountType.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -public enum BankAccountType { - RECEIPTS, PAYMENTS, RECEIPTS_PAYMENTS -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankBranchContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankBranchContract.java deleted file mode 100644 index 8087535131b..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankBranchContract.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "code", "name", "bank", "address", "address2", "city", "state", "pincode", "phone", "fax", - "contactPerson", "active", "description", "micr", "bankAccounts" }) -public class BankBranchContract extends AuditableContract { - - private Long id; - - @NotNull - private BankContract bank; - - @NotNull - @Length(max = 50, min = 1) - private String code; - - @NotNull - @Length(max = 50, min = 1) - @Pattern(regexp = "^[a-zA-Z0-9_]*$") - private String name; - - @NotNull - @Length(max = 50, min = 1) - private String address; - - @Length(max = 50) - private String address2; - - @Length(max = 50) - private String city; - - @Length(max = 50) - private String state; - - @Length(max = 50) - private String pincode; - - @Length(max = 15) - private String phone; - - @Length(max = 15) - private String fax; - - @Length(max = 50) - private String contactPerson; - - @NotNull - private Boolean active; - - @Length(max = 256) - private String description; - - @Length(max = 50) - private String micr; - - public Long getId() { - return this.id; - } - - public BankBranchContract(final String id) { - super(); - this.id = Long.valueOf(id); - } - - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankContract.java deleted file mode 100644 index 0a5641b22c0..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankContract.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonProperty.Access; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class BankContract { - - private Long id; - - @JsonProperty(access = Access.WRITE_ONLY) - private List ids = new ArrayList(); - - @NotNull - @Length(max = 50, min = 1) - private String code; - - @NotNull - @Length(max = 100, min = 2) - private String name; - - @Length(max = 250) - private String description; - - @NotNull - private Boolean active; - // is this required? - - @Length(max = 50) - private String type; - - private String tenantId; - - public Long getId() { - return id; - } - - public BankContract(final String id) { - super(); - this.id = Long.valueOf(id); - } - - public BankContract(Bank bean) { - this.setTenantId(bean.getTenantId()); - this.setId(bean.getId()); - this.setCode(bean.getCode()); - this.setName(bean.getName()); - this.setType(bean.getType()); - this.setActive(bean.getActive()); - this.setDescription(bean.getDescription()); - } - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankDetails.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankDetails.java deleted file mode 100644 index 7a1b6f2ae64..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BankDetails.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@NoArgsConstructor -public class BankDetails { - @JsonProperty("BRANCH") - private String branchName; - @JsonProperty("ADDRESS") - private String address; - @JsonProperty("CONTACT") - private String contact; - @JsonProperty("CITY") - private String city; - @JsonProperty("DISTRICT") - private String district; - @JsonProperty("STATE") - private String state; - @JsonProperty("NEFT") - private boolean neft; - @JsonProperty("RTGS") - private boolean rtgs; - @JsonProperty("IMPS") - private boolean imps; - @JsonProperty("MICR") - private String micr; - @JsonProperty("BANK") - private String bankName; - @JsonProperty("BANKCODE") - private String bankCode; - @JsonProperty("IFSC") - private String ifsc; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Bill.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Bill.java deleted file mode 100644 index eaf1cc2ffd5..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Bill.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class Bill { - - @JsonProperty("id") - private String id = null; - - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @JsonProperty("paidBy") - private String paidBy = null; - - @JsonProperty("payerName") - private String payerName = null; - - @JsonProperty("payerAddress") - private String payerAddress = null; - - @JsonProperty("payerEmail") - private String payerEmail = null; - - @JsonProperty("payerId") - private String payerId = null; - - @JsonProperty("isActive") - private Boolean isActive = null; - - @JsonProperty("isCancelled") - private Boolean isCancelled = null; - - @JsonProperty("additionalDetails") - private Object additionalDetails = null; - - @JsonProperty("taxAndPayments") - @Valid - @NotNull - private List taxAndPayments = null; - - private String businessService; - - @JsonProperty("billDetails") - @Valid - private List billDetails = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BillAccountDetail.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BillAccountDetail.java deleted file mode 100644 index a647018249d..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BillAccountDetail.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.math.BigDecimal; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class BillAccountDetail { - - @JsonProperty("id") - private String id = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("billDetail") - private String billDetail = null; - - @JsonProperty("demandDetailId") - private String demandDetailId = null; - - @JsonProperty("order") - private Integer order = null; - - @JsonProperty("amount") - private BigDecimal amount = null; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount = null; - - @JsonProperty("isActualDemand") - private Boolean isActualDemand = null; - - @JsonProperty("glcode") - private String glcode = null; - - @JsonProperty("taxHeadCode") - private String taxHeadCode = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("purpose") - private Purpose purpose = null; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BillDetail.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BillDetail.java deleted file mode 100644 index 3a3b38404f8..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BillDetail.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class BillDetail { - private String id; - - private String bill; - - private Long billDate; - - private String billDescription; - - private String billNumber; // refNo - - private String consumerCode; - - private String consumerType; - - private BigDecimal minimumAmount; - - private BigDecimal totalAmount; - - private BigDecimal collectedAmount; - - private List collectionModesNotAllowed = new ArrayList<>(); - - private String tenantId; - - private String businessService; // buisnessDetailsCode - - private String displayMessage; - - private Boolean callBackForApportioning; - - private String receiptNumber; - - private Long receiptDate; - - private String receiptType; - - private String channel; - - private String voucherHeader; - - private CollectionType collectionType; - - private String boundary; - - private String reasonForCancellation; - - private BigDecimal amountPaid; - - private String cancellationRemarks; - - private String status; - - @JsonProperty("billAccountDetails") - private List billAccountDetails = new ArrayList<>(); - - private String manualReceiptNumber; - - private Long manualReceiptDate; - - private Long stateId; - - private Boolean partPaymentAllowed; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @NotNull - @JsonProperty("expiryDate") - private Long expiryDate; - - @JsonProperty("demandId") - private String demandId = null; - - @NotNull - @JsonProperty("fromPeriod") - private Long fromPeriod = null; - - @NotNull - @JsonProperty("toPeriod") - private Long toPeriod = null; - - @JsonProperty("isAdvanceAllowed") - private Boolean isAdvanceAllowed; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BusinessService.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BusinessService.java deleted file mode 100644 index 429b272957a..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/BusinessService.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class BusinessService { - private String code; - private boolean voucherCreationEnabled; - private String fund; - private String function; - private String department; - private String functionary; - private String scheme; - private String subscheme; - private Long validFrom; - private Long validTo; - private String businessService; - private boolean serviceAttributeMappingEnabled; - private String serviceAttributeUrl; - private String serviceAttributeKey; - private String serviceAttributeTaxHead; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ChartOfAccount.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ChartOfAccount.java deleted file mode 100644 index 4cddc807160..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ChartOfAccount.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -public class ChartOfAccount { - private Long id; - - private String glcode; - - private String name; - - @JsonProperty("AccountCodePurpose") - private AccountCodePurpose accountCodePurpose; - - private String desciption; - - private Boolean isActiveForPosting; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ChartOfAccountContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ChartOfAccountContract.java deleted file mode 100644 index f7ebc43f885..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ChartOfAccountContract.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.NotNull; - -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "glcode", "name", "accountCodePurpose", "description", "isActiveForPosting", "parentId", - "type", "classification", "functionRequired", "budgetCheckRequired", "majorCode", "isSubLedger" }) -public class ChartOfAccountContract extends AuditableContract { - - private String id; - - @NotNull - @Length(max = 16, min = 1) - private String glcode; - - @NotNull - @Length(max = 128, min = 5) - private String name; - - private AccountCodePurposeContract accountCodePurpose; - - @Length(max = 256) - private String description; - - @NotNull - private Boolean isActiveForPosting; - - private ChartOfAccountContract parentId; - - @NotNull - private Character type; - - @NotNull - private Long classification; - - @NotNull - private Boolean functionRequired; - - @NotNull - private Boolean budgetCheckRequired; - - @Length(max = 16) - private String majorCode; - - private Boolean isSubLedger; - - public ChartOfAccountContract(String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/CityModule.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/CityModule.java deleted file mode 100644 index 2fce5f6a1dd..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/CityModule.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Getter -@Setter -@ToString -@NoArgsConstructor -@AllArgsConstructor -public class CityModule { -private String module; -private String code; -private List tenants; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/CollectionType.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/CollectionType.java deleted file mode 100644 index 601f6dca909..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/CollectionType.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum CollectionType { - COUNTER("COUNTER"), - FIELD("FIELD"), - ONLINE("ONLINE"); - - - private String value; - - CollectionType(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - public String getValue() { - return value; - } - - @JsonCreator - public static CollectionType fromValue(String text) { - for (CollectionType b : CollectionType.values()) { - if (0 ==b.value.compareTo(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/DishonorReasonContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/DishonorReasonContract.java deleted file mode 100644 index 68cf358828f..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/DishonorReasonContract.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.NotBlank; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "reason", "remarks", "instrument", "reversalVoucherId", "dishonorDate" }) -public class DishonorReasonContract extends AuditableContract { - /** - * id is the unique Identifier of the reason - */ - private String id; - /** - * name is the reason of instrument surrender. Example "Damaged cheque","Cheque to be scrapped" etc - */ - @NotBlank - @Size(max = 100, min = 5) - private String reason; - /** - * description is detailed description of the surrender of a instrument - */ - @NotBlank - @Size(max = 250) - private String remarks; - @NotBlank - @Size(max = 250) - private String instrument; - private String reversalVoucherId; - @NotNull - private Long dishonorDate; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/EgModules.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/EgModules.java deleted file mode 100644 index d6cc74cdb86..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/EgModules.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@NoArgsConstructor -@ToString -public class EgModules { - private Integer id; - private String name; - private String description; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/EgwStatus.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/EgwStatus.java deleted file mode 100644 index e7a5318c366..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/EgwStatus.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class EgwStatus { - - private Long id; - - private String moduleType; - - private String code; - - private String description; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FilterRequest.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FilterRequest.java deleted file mode 100644 index 8db3f9b57e0..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FilterRequest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.List; - -import org.springframework.stereotype.Component; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Component -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class FilterRequest { - private List id; - private String code; - private List codes; - private String billingservicecode; - private String taxhead; - private String glcode; - private long validFrom; - private long validTo; - private String voucherCreationEnabled; - private String fund; - private String function; - private String department; - private String functionary; - private String scheme; - private String subscheme; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinanceMdmsModel.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinanceMdmsModel.java deleted file mode 100644 index 097becb3a8a..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinanceMdmsModel.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.Getter; -import lombok.Setter; - -@Setter -@Getter -public class FinanceMdmsModel { - private Object financeServiceMdmsData; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinancialStatus.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinancialStatus.java deleted file mode 100644 index d8d39f35124..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinancialStatus.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "moduleType", "code", "description" }) -public class FinancialStatus { - - private String id; - - private String moduleType; - - private String code; - - private String name; - - private String description; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinancialStatusResponse.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinancialStatusResponse.java deleted file mode 100644 index 344b37eed10..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinancialStatusResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class FinancialStatusResponse { - private List financialStatuses; -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinancialYear.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinancialYear.java deleted file mode 100644 index 525e5f628cc..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FinancialYear.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import java.util.Date; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class FinancialYear { - - private Long id; - - private String finYearRange; - - private Date startingDate; - - private Date endingDate; - - private Boolean active; - - private Boolean isActiveForPosting; - - private Boolean isClosed; - - private Boolean transferClosingBalance; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FiscalPeriod.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FiscalPeriod.java deleted file mode 100644 index bdc1fe94935..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FiscalPeriod.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import java.util.Date; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class FiscalPeriod { - - private Long id; - - private String name; - - private FinancialYear financialYear; - - private Date startingDate; - - private Date endingDate; - - private Boolean active; - - private Boolean isActiveForPosting; - - private Boolean isClosed; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Function.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Function.java deleted file mode 100644 index b86f275bc83..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Function.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class Function { - - private Long id; - - private String name; - - private String code; - - private Long level; - - private Boolean active; - - private Boolean isParent; - - private Long parentId; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Functionary.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Functionary.java deleted file mode 100644 index 88b9e59e90b..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Functionary.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class Functionary { - - private Long id; - - private String code; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Fund.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Fund.java deleted file mode 100644 index 26a3a26ea19..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Fund.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class Fund { - - private Long id; - - private String name; - - private String code; - - private String identifier; - - private Long level; - - private Long parentId; - - private Boolean isParent; - - private Boolean active; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FundContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FundContract.java deleted file mode 100644 index 0108eb84178..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/FundContract.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.NotNull; -import org.hibernate.validator.constraints.Length; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonProperty.Access; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "code", "identifier", "level", "parentId", "isParent", "active" }) -public class FundContract extends AuditableContract { - - private Long id; - - @Length(max = 50, min = 2) - @NotNull - private String name; - - @Length(max = 50, min = 2) - @NotNull - private String code; - @NotNull - private Character identifier; - - @NotNull - private Long level; - - @JsonProperty(access = Access.WRITE_ONLY) - private FundContract parentId; - - private Boolean isParent; - @NotNull - private Boolean active; - - public Long getId() { - return this.id; - } - - public FundContract(final String id) { - super(); - this.id = Long.valueOf(id); - } - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Fundsource.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Fundsource.java deleted file mode 100644 index 11d1ffb62ca..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Fundsource.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class Fundsource { - - private Long id; - - private String code; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Instrument.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Instrument.java deleted file mode 100644 index 3e5ee8ecd54..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Instrument.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@ToString -public class Instrument{ - - /* - * id is the unique reference to Instrument Header entered in the system. - */ - private String id; - - /* - * transactionNumber unique number of the instrument. For cheque type this - * is cheque date. For DD type it is DD number - * - */ - private String transactionNumber; - - /* - * transactionDate is the date of instrument . For cheque type it is cheque - * date. for DD it is DD date - */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy") - private Date transactionDate; - - /** - * Transaction date as long comes from UI in case of cheque and DD - */ - private Long transactionDateInput; - - /* - * amount is the instrument amount. For cheque type it is cheque amount. - */ - @NotNull - @Min(value = 0) - @Max(value = 999999999) - private BigDecimal amount; - - /* - * instrumentType specifies the type of the instrument - The folowing are - * the different types Cash,Cheque,DD,POC - * - */ - @NotNull - private InstrumentType instrumentType; - - private Long instrumentDate; - - private String instrumentNumber; - - /* - * bank references to the bank from which the payment/Receipt is made. - */ - private BankContract bank; - - /* - * branchName is the branch name entered in the collection Receipt. - */ - - @Size(max = 50) - private String branchName; - - /* - * bankAccount is the reference of the Bank account from which the payment - * instrument is assigned - */ - private BankAccountContract bankAccount; - - /** - * IFSC Code of the bank branch - */ - private String ifscCode; - - - /* - * transactionType are of two kinds -Debit and Credit. When its a receipt - * instrument it is Debit and in case of payment instrument its credit. - */ - private TransactionType transactionType; - - /** - * Status of the instrument, newly added - */ - private InstrumentStatusEnum instrumentStatus; - - /* - * payee is the entity who is making the payment via instrument - */ - @Size(max = 50) - private String payee; - - /* - * drawer is the entity to which the payment is made. - */ - @Size(max = 100) - private String drawer; - - /* - * surrenderReason is the reason from the defined list seleted while - * surrendering a payment cheque. Depending on the reason, the cheque can be - * re-used or not is decided. - */ - private SurrenderReason surrenderReason; - - /* - * serialNo is the series of the cheque numbers from which the instrument is - * assigned from. The cheque numbers in an account is defined based on Year, - * Bank account and tagged to a department. - */ - //@NotBlank - @Size(max = 50, min = 2) - private String serialNo; - - /* - * instrumentVouchers is the reference to the payment vouchers for which the - * instrument is attached. - */ - // @DrillDownTable - private Set instrumentVouchers = new HashSet(0); - - private AuditDetails auditDetails; - - private JsonNode additionalDetails; - - @NotNull - private String tenantId; - - private String paymentId; - - public InstrumentContract toContract() { - - InstrumentContract contract = new InstrumentContract(); - - contract.setId(this.getId()); - contract.setAmount(this.getAmount()); - contract.setBank(this.getBank()); - contract.setBankAccount(this.getBankAccount()); - contract.setBranchName(this.getBranchName()); - contract.setDrawer(this.getDrawer()); - contract.setInstrumentType(this.getInstrumentType()); - contract.setSurrenderReason(this.getSurrenderReason()); - if (this.getInstrumentVouchers() != null) { - - List instrumentVouchers = new ArrayList<>(); - - if (this.getInstrumentVouchers() != null) - for (InstrumentVoucher iv : this.getInstrumentVouchers()) - instrumentVouchers - .add(InstrumentVoucherContract.builder().instrument(contract.getId()) - .voucherHeaderId(iv.getVoucherHeaderId()).build()); - - contract.setInstrumentVouchers(instrumentVouchers); - - } - contract.setPayee(this.getPayee()); - contract.setSerialNo(this.getSerialNo()); - contract.setTransactionDate(this.getTransactionDate()); - contract.setTransactionNumber(this.getTransactionNumber()); - contract.setTransactionType(this.getTransactionType()); - contract.setTenantId(this.getTenantId()); - return contract; - } - -} - diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeContract.java deleted file mode 100644 index 87ec6ca3e71..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeContract.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "instrumentType", "accountCode" }) -public class InstrumentAccountCodeContract extends AuditableContract { - - /* - * id is the unique reference to Instrument AccountCodes entered in the system. - */ - private String id; - - /* - * instrumentType specifies the mode/type of transaction that can be made - i.e Cheque,DD,RTGS. For receipt - Cheque,DD,RTGS - */ - private InstrumentTypeContract instrumentType; - - /* - * accountCode is the COA that is tagged to a instrument type used in ledger posting. - */ - private ChartOfAccountContract accountCode; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeReq.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeReq.java deleted file mode 100644 index c71d6984984..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeReq.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.NotNull; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@ToString -public class InstrumentAccountCodeReq { - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("requestInfo") - private RequestInfo requestInfo; - - private InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeResponse.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeResponse.java deleted file mode 100644 index 9832c29a8c4..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.List; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -import lombok.Data; - -@JsonIgnoreProperties(ignoreUnknown=true) -public @Data class InstrumentAccountCodeResponse { - private ResponseInfo responseInfo; - private List instrumentAccountCodes; -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeSearchContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeSearchContract.java deleted file mode 100644 index 318c8116e50..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentAccountCodeSearchContract.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -public class InstrumentAccountCodeSearchContract extends InstrumentAccountCodeContract { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentContract.java deleted file mode 100644 index 59865f19b92..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentContract.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.NotBlank; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@ToString -@JsonPropertyOrder({ "id", "transactionNumber", "transactionDate", "amount", "instrumentType", "bank", "branchName", - "bankAccount", "financialStatus", "remittanceVoucherId", "transactionType", "payee", "drawer", "surrendarReason", - "serialNo", - "instrumentVouchers" }) -public class InstrumentContract { - - /* - * id is the unique reference to InstrumentContract Header entered in the system. - */ - private String id; - - private String tenantId; - - /* - * transactionNumber unique number of the instrument. For cheque type this is cheque date. For DD type it is DD number - */ - @NotBlank - @Size(max = 50, min = 6) - private String transactionNumber; - - /* - * transactionDate is the date of instrument . For cheque type it is cheque date. for DD it is DD date - */ - @NotNull - @JsonFormat(pattern = "dd-MM-yyyy") - private Date transactionDate; - - /* - * amount is the instrument amount. For cheque type it is cheque amount. - */ - @NotNull - @Min(value = 1) - @Max(value = 999999999) - private BigDecimal amount; - - /* - * instrumentType specifies the type of the instrument - The folowing are the different types Cash,Cheque,DD,POC - */ - private InstrumentType instrumentType; - - /* - * bank references to the bank from which the payment/Receipt is made. - */ - private BankContract bank; - - /* - * branchName is the branch name entered in the collection Receipt. - */ - - @Size(max = 50) - private String branchName; - - /* - * bankAccount is the reference of the Bank account from which the payment instrument is assigned - */ - private BankAccountContract bankAccount; - - /* - * instrumentStatus gives the current status of the instrument. - */ - private FinancialStatus financialStatus; - - private String remittanceVoucherId; - - /* - * transactionType are of two kinds -Debit and Credit. When its a receipt instrument it is Debit and in case of payment - * instrument its credit. - */ - @NotNull - private TransactionType transactionType; - - /* - * payee is the entity who is making the payment via instrument - */ - @Size(max = 50) - private String payee; - - /* - * drawer is the entity to which the payment is made. - */ - @Size(max = 100) - private String drawer; - - /* - * surrenderReason is the reason from the defined list seleted while surrendering a payment cheque. Depending on the reason, - * the cheque can be re-used or not is decided. - */ - private SurrenderReason surrenderReason; - - /* - * serialNo is the series of the cheque numbers from which the instrument is assigned from. The cheque numbers in an account - * is defined based on Year, Bank account and tagged to a department. - */ - @NotBlank - @Size(max = 50, min = 2) - private String serialNo; - - private String payinSlipId; - - @Min(value = 1) - @Max(value = 999999999) - private BigDecimal reconciledAmount; - - private Date reconciledOn; - - /* - * instrumentVouchers is the reference to the payment vouchers for which the instrument is attached. - */ - private List instrumentVouchers = new ArrayList<>(); - - private DishonorReasonContract dishonor; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentGlCodeMapping.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentGlCodeMapping.java deleted file mode 100644 index b648d98f402..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentGlCodeMapping.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class InstrumentGlCodeMapping { -private String instrumenttype; -private String glcode; -private Long validFrom; -private Long validTo; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentRequest.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentRequest.java deleted file mode 100644 index 2139a966f9b..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentRequest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.ArrayList; -import java.util.List; - -import lombok.Data; - -public @Data class InstrumentRequest { - private RequestInfo requestInfo = new RequestInfo(); - private List instruments = new ArrayList(); -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentResponse.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentResponse.java deleted file mode 100644 index b587bdb6788..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Data; - -@JsonInclude(value = Include.NON_NULL) -public @Data class InstrumentResponse { - private List instruments; -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentSearchContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentSearchContract.java deleted file mode 100644 index abe5ff36010..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentSearchContract.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.model; - -import java.util.Date; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class InstrumentSearchContract { - private String ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private String instrumentTypes; - private String receiptIds; - private String financialStatuses; - private Date transactionFromDate; - private Date transactionToDate; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentStatus.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentStatus.java deleted file mode 100644 index e8f9a36e038..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentStatus.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@ToString -@Builder -public class InstrumentStatus { - - /** - * Unique Identifier of the status - */ - @NotNull - private String id; - - @NotNull - @Size(min = 3, max = 50) - private String moduleType; - - /** - * name is the status name - */ - @NotNull - @Size(min = 3, max = 20) - private String name; - - /** - * description is the detailed description of the status - */ - @NotNull - @Size(min = 3, max = 250) - private String description; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentStatusEnum.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentStatusEnum.java deleted file mode 100644 index 3ed8c35df64..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentStatusEnum.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.HashSet; -import java.util.Set; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum InstrumentStatusEnum { - APPROVED("APPROVED", InstrumentStatusEnum.Category.OPEN), - APPROVAL_PENDING("APPROVAL_PENDING", InstrumentStatusEnum.Category.OPEN), - TO_BE_SUBMITTED("TO_BE_SUBMITTED", InstrumentStatusEnum.Category.OPEN), - REMITTED("REMITTED", InstrumentStatusEnum.Category.OPEN), - REJECTED("REJECTED", InstrumentStatusEnum.Category.CLOSED), - CANCELLED("CANCELLED", InstrumentStatusEnum.Category.CLOSED), - DISHONOURED("DISHONOURED", InstrumentStatusEnum.Category.CLOSED); - - - private String value; - - private InstrumentStatusEnum.Category category; - - InstrumentStatusEnum(String value, InstrumentStatusEnum.Category category) { - this.value = value; - this.category = category; - } - - public boolean isCategory(InstrumentStatusEnum.Category category) { - return this.category == category; - } - - public static Set statusesByCategory(InstrumentStatusEnum.Category category) { - Set statuses = new HashSet<>(); - for (InstrumentStatusEnum b : InstrumentStatusEnum.values()) { - if (b.category == category) { - statuses.add(b.value); - } - } - - return statuses; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static InstrumentStatusEnum fromValue(String text) { - for (InstrumentStatusEnum b : InstrumentStatusEnum.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } - - public enum Category { - OPEN, - CLOSED; - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentType.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentType.java deleted file mode 100644 index 2457fd2411a..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentType.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.hibernate.validator.constraints.NotBlank; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@ToString -@Builder -public class InstrumentType{ - - /* - * id is the unique reference to instrument type entered in the system. - */ - private String id; - - /* - * type specifies the mode/type of transaction that can be made - i.e - * Cheque,DD,RTGS. For receipt - Cheque,DD,RTGS - */ - @NotNull - @NotBlank - @Size(max = 50, min = 2) - private String name; - - /* - * description specifies details of the instrument type . For example type - * DD description may be Demand Draft - */ - - @Size(max = 100) - private String description; - - /* - * active specifies whether the type is active for transacting. - */ - @NotNull - private Boolean active; - - @Valid - @NotNull - @Size(max = 2, min = 2, message = "") - private List instrumentTypeProperties; - -} - diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentTypeContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentTypeContract.java deleted file mode 100644 index 632996ff423..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentTypeContract.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "id", "name", "description", "active", "instrumentTypeProperties" }) -public class InstrumentTypeContract extends AuditableContract { - - /* - * id is the unique reference to instrument type entered in the system. - */ - private String id; - - /* - * type specifies the mode/type of transaction that can be made - i.e Cheque,DD,RTGS. For receipt - Cheque,DD,RTGS - */ - @NotNull - @Size(max = 50, min = 2) - private String name; - - /* - * description specifies details of the instrument type . For example type DD description may be Demand Draft - */ - - @Size(max = 100) - private String description; - - /* - * active specifies whether the type is active for transacting. - */ - @NotNull - private Boolean active; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentTypeProperty.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentTypeProperty.java deleted file mode 100644 index 2d864dc4525..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentTypeProperty.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class InstrumentTypeProperty{ - - @NotNull - private TransactionType transactionType; - @NotNull - private Boolean reconciledOncreate; - @NotNull - private InstrumentStatus statusOnCreate; - @NotNull - private InstrumentStatus statusOnUpdate; - @NotNull - private InstrumentStatus statusOnReconcile; -} - diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentTypesEnum.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentTypesEnum.java deleted file mode 100644 index d63316ac373..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentTypesEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -public enum InstrumentTypesEnum { - CASH, CHEQUE, DD, ONLINE, CARD; - - public static boolean contains(String test) { - for (InstrumentTypesEnum val : InstrumentTypesEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentVoucher.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentVoucher.java deleted file mode 100644 index deeba41c699..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentVoucher.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -public class InstrumentVoucher { - - /* - * instrumentHeaderId is the reference of the instrument attached to a - * voucher - */ - private Instrument instrument; - - /* - * voucherHeaderId is the reference of the voucher attached to a instrument. - */ - private String voucherHeaderId; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentVoucherContract.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentVoucherContract.java deleted file mode 100644 index 5da70f13139..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/InstrumentVoucherContract.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor - -@JsonPropertyOrder({ "instrument", "voucherHeaderId", "receiptHeaderId" }) -public class InstrumentVoucherContract { - - /* - * instrumentHeaderId is the reference of the instrument attached to a voucher - */ - private String instrument; - - /* - * voucherHeaderId is the reference of the voucher attached to a instrument. - */ - private String voucherHeaderId; - - /* - * receiptHeaderId is the reference of the receipt attached to a instrument. - */ - private String receiptHeaderId; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MasterDetail.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MasterDetail.java deleted file mode 100644 index 02b213501a3..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MasterDetail.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.io.Serializable; - -import org.springframework.stereotype.Component; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Component -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class MasterDetail implements Serializable{ - private String name; - private String filter; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MdmsCriteria.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MdmsCriteria.java deleted file mode 100644 index 5289cd8521b..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MdmsCriteria.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.List; - -import org.springframework.stereotype.Component; -@Component -public class MdmsCriteria { - - private String tenantId; - - private List moduleDetails; - - public MdmsCriteria(String tenantId, List moduleDetails) { - this.tenantId = tenantId; - this.moduleDetails = moduleDetails; - } - - public MdmsCriteria(){} - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public List getModuleDetails() { - return moduleDetails; - } - - public void setModuleDetails(List moduleDetails) { - this.moduleDetails = moduleDetails; - } - - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MdmsCriteriaReq.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MdmsCriteriaReq.java deleted file mode 100644 index 87aa1c2801d..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MdmsCriteriaReq.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import org.springframework.stereotype.Component; -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Component -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class MdmsCriteriaReq { - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - @JsonProperty("MdmsCriteria") - private MdmsCriteria mdmsCriteria; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MdmsResponse.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MdmsResponse.java deleted file mode 100644 index b90f04b7db4..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/MdmsResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.Map; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import net.minidev.json.JSONArray; - -@Component -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class MdmsResponse { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - @JsonProperty("MdmsRes") - private Map> mdmsRes; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ModuleDetail.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ModuleDetail.java deleted file mode 100644 index 5163ca76ec7..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ModuleDetail.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.List; - -import org.springframework.stereotype.Component; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Component -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class ModuleDetail { - private String moduleName; - private List masterDetails; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/OnlineGLCodeMapping.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/OnlineGLCodeMapping.java deleted file mode 100644 index 0db3eefb811..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/OnlineGLCodeMapping.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -@NoArgsConstructor -@AllArgsConstructor -public class OnlineGLCodeMapping { -private String servicecode; -private String glcode; -private Long validFrom; -private Long validTo; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ProcessStatus.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ProcessStatus.java deleted file mode 100644 index 13ecdd50213..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ProcessStatus.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -public enum ProcessStatus { -FAILED,SUCCESS,NA -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Purpose.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Purpose.java deleted file mode 100644 index 2ae48bc1229..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Purpose.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum Purpose { - - ARREAR("ARREAR"), - - CURRENT("CURRENT"), - - ADVANCE("ADVANCE"), - - EXEMPTION("EXEMPTION"), - - ARREAR_LATEPAYMENT_CHARGES("ARREAR_LATEPAYMENT_CHARGES"), - - CURRENT_LATEPAYMENT_CHARGES("CURRENT_LATEPAYMENT_CHARGES"), - - CHEQUE_BOUNCE_PENALTY("CHEQUE_BOUNCE_PENALTY"), - - REBATE("REBATE"), - - OTHERS("OTHERS"); - - private String value; - - Purpose(String value) { - this.value = value; - } - - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Purpose fromValue(String text) { - for (Purpose b : Purpose.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Receipt.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Receipt.java deleted file mode 100644 index fdf4225b5c0..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Receipt.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Setter -@Getter -@ToString -@EqualsAndHashCode(of = {"receiptNumber"}) -public class Receipt { - - @NotNull - private String tenantId; - - private String transactionId; - - // Read only, populated during search - private String receiptNumber; - - // Read only, populated during search - private String consumerCode; - - // Read only, populated during search - private Long receiptDate; - - @NotNull - @Size(min = 1, max = 1) - @Valid - @JsonProperty("Bill") - private List bill = new ArrayList<>(); - - private AuditDetails auditDetails; - - @Valid - private Instrument instrument; - - @JsonIgnore - private String paymentId; - - @JsonIgnore - private String paymentDetailId; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ReceiptReq.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ReceiptReq.java deleted file mode 100644 index c6fd1154392..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ReceiptReq.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.List; - -@Setter -@Getter -@ToString -@Builder -@EqualsAndHashCode -@AllArgsConstructor -@NoArgsConstructor -public class ReceiptReq { - - @NotNull - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @JsonProperty("Receipt") - @Valid - private List receipt = null; - - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ReceiptResponse.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ReceiptResponse.java deleted file mode 100644 index 968b179c4b3..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ReceiptResponse.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Setter -@Getter -@ToString -@Builder -@EqualsAndHashCode -@AllArgsConstructor -@NoArgsConstructor -public class ReceiptResponse { - - @JsonProperty("Receipt") - private List receipts; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/RequestInfo.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/RequestInfo.java deleted file mode 100644 index d60d8e662cc..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/RequestInfo.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import org.egov.common.contract.request.User; -import org.springframework.stereotype.Component; - - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Component -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class RequestInfo { - private String apiId; - private String ver; - private Long ts; - private String action; - private String did; - private String key; - private String msgId; - private String authToken; - private String correlationId; - private User userInfo; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/RequestInfoWrapper.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/RequestInfoWrapper.java deleted file mode 100644 index 08354d8ca94..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/RequestInfoWrapper.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class RequestInfoWrapper { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ResponseInfo.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ResponseInfo.java deleted file mode 100644 index ae205d690e1..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/ResponseInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import org.springframework.stereotype.Component; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Component -@Setter -@Getter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class ResponseInfo { - private String apiId; - private String ver; - private String ts; - private String resMsgId; - private String msgId; - private String status; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Scheme.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Scheme.java deleted file mode 100644 index 2aa5ff9e408..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Scheme.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class Scheme { - - private Long id; - - private String code; - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/SubScheme.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/SubScheme.java deleted file mode 100644 index 6800fda5b86..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/SubScheme.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.util.Date; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class SubScheme { - - private String id; - - private Scheme scheme; - - private String code; - - private String name; - - private Date validFrom; - - private Date validTo; - - private Boolean active; - - private String departmentId; - - public SubScheme(String id) { - this.id = id; - } - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/SubledgerDetail.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/SubledgerDetail.java deleted file mode 100644 index 7730e18aa13..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/SubledgerDetail.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ - -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class SubledgerDetail { - - private Long id; - - private AccountDetailType accountDetailType; - - private AccountDetailKey accountDetailKey; - - private Double amount; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/SurrenderReason.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/SurrenderReason.java deleted file mode 100644 index 67ff62548ef..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/SurrenderReason.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import javax.validation.constraints.Size; -import org.hibernate.validator.constraints.NotBlank; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@NoArgsConstructor -@AllArgsConstructor -@Getter -@Setter -@Builder -@ToString -public class SurrenderReason{ - /** - * id is the unique Identifier of the reason - */ - private String id; - /** - * name is the reason of instrument surrender. Example "Damaged cheque","Cheque to be scrapped" etc - */ - @NotBlank - @Size(max=50,min=5) - private String name; - /** - * description is detailed description of the surrender of a instrument - */ - @NotBlank - @Size(max=250) - private String description; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/TaxAndPayment.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/TaxAndPayment.java deleted file mode 100644 index ad5d4530cc2..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/TaxAndPayment.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import java.math.BigDecimal; - -import javax.validation.constraints.NotNull; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class TaxAndPayment { - - @NotNull - private String businessService; - - private BigDecimal taxAmount; - - @NotNull - private BigDecimal amountPaid; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/TaxHeadMaster.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/TaxHeadMaster.java deleted file mode 100644 index 32040214563..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/TaxHeadMaster.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class TaxHeadMaster { - private String billingservicecode; - private String taxhead; - private String glcode; - private Long validFrom; - private Long validTo; - private String serviceAttribute; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Tenant.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Tenant.java deleted file mode 100644 index 49aa34729fa..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Tenant.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class Tenant { -private String code; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/TransactionType.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/TransactionType.java deleted file mode 100644 index 9a7ba127eb1..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/TransactionType.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.model; - -public enum TransactionType { - Debit,Credit -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Voucher.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Voucher.java deleted file mode 100644 index d6ae427b165..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/Voucher.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import java.util.ArrayList; -import java.util.List; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class Voucher { - - private Long id; - - private String name; - - private String type; - - private String voucherNumber; - - private String description; - - private String voucherDate; - - private Fund fund; - - private Function function; - - private FiscalPeriod fiscalPeriod; - - private EgwStatus status; - - private Long originalVhId; - - private Long refVhId; - - private String cgvn; - - private Long moduleId; - - private String department; - - private String source; - - private Scheme scheme; - - private SubScheme subScheme; - - private Functionary functionary; - - private Fundsource fundsource; - - private List ledgers = new ArrayList<>(0); - - private String tenantId; - - private String referenceDocument; - - private String serviceName; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherRequest.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherRequest.java deleted file mode 100644 index 22c5d704e06..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherRequest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class VoucherRequest { - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("vouchers") - private List vouchers = new ArrayList<>(0); - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherResponse.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherResponse.java deleted file mode 100644 index 1a810d56edf..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherResponse.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Builder -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class VoucherResponse { - - @JsonProperty("Vouchers") - private List vouchers = new ArrayList<>(0); - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherSearchCriteria.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherSearchCriteria.java deleted file mode 100644 index 64a69094b34..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherSearchCriteria.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.egov.receipt.consumer.model; - -import java.util.Set; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Setter -@Getter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class VoucherSearchCriteria { - private Set ids; - private String sortBy; - private Integer pageSize; - private Integer offset; - private Set voucherNumbers; - private Long voucherFromDate; - private Long voucherToDate; - private String voucherType; - private String voucherName; - private String fundId; - private String deptCode; - private String tenantId; -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherSearchRequest.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherSearchRequest.java deleted file mode 100644 index 2184e0f31a2..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/model/VoucherSearchRequest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * eGov SmartCity eGovernance suite aims to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2017 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * Further, all user interfaces, including but not limited to citizen facing interfaces, - * Urban Local Bodies interfaces, dashboards, mobile applications, of the program and any - * derived works should carry eGovernments Foundation logo on the top right corner. - * - * For the logo, please refer http://egovernments.org/html/logo/egov_logo.png. - * For any further queries on attribution, including queries on brand guidelines, - * please contact contact@egovernments.org - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - * - */ -package org.egov.receipt.consumer.model; -import javax.validation.constraints.NotNull; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class VoucherSearchRequest { - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - private String voucherNumbers; - - - - public String getVoucherNumbers() { - return voucherNumbers; - } - - public void setVoucherNumbers(String voucherNumbers) { - this.voucherNumbers = voucherNumbers; - } - - public void setRequestInfo(RequestInfo requestInfo) { - this.requestInfo = requestInfo; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public RequestInfo getRequestInfo() { - return requestInfo; - } - - - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/repository/ServiceRequestRepository.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/repository/ServiceRequestRepository.java deleted file mode 100644 index 9a90503614b..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/repository/ServiceRequestRepository.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.repository; - -import java.lang.reflect.Field; -import java.util.Map; - -import org.egov.mdms.service.TokenService; -import org.egov.receipt.consumer.model.ProcessStatus; -import org.egov.receipt.consumer.model.RequestInfo; -import org.egov.receipt.consumer.model.VoucherRequest; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Repository; -import org.springframework.util.ReflectionUtils; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -import lombok.extern.slf4j.Slf4j; - -@Repository -@Slf4j -public class ServiceRequestRepository { - - private static final String SEARCHER_EXCEPTION_MESSAGE = "Exception while fetching from searcher: "; - - @Autowired - private RestTemplate restTemplate; - @Autowired - private TokenService tokenService; - @Autowired - private ObjectMapper mapper; - - /** - * Fetches results from searcher framework based on the uri and request that define what is to be searched. - * - * @param requestInfo - * @param serviceReqSearchCriteria - * @return Object - * @author atique - */ - public Object fetchResult(StringBuilder uri, Object request, String tenantId) throws VoucherCustomException { - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - Object response = null; - - try { - populateWithAdminToken(uri, request, tenantId); - response = restTemplate.postForObject(uri.toString(), request, Map.class); - } catch (HttpClientErrorException e) { - if (e.getStatusCode().equals(HttpStatus.UNAUTHORIZED)) { - log.error("Unauthorized accessed : Retrying http uri {} with SYSTEM auth token.", uri.toString()); - response = this.retryHttpCallOnUnauthorizedAccess(uri, request, tenantId); - } else { - log.error(SEARCHER_EXCEPTION_MESSAGE, e.getResponseBodyAsString()); - throw new VoucherCustomException(ProcessStatus.FAILED, e.getResponseBodyAsString()); - } - } catch (Exception e) { - log.error(SEARCHER_EXCEPTION_MESSAGE, e); - throw new VoucherCustomException(ProcessStatus.FAILED, "Exception while fetching from searcher."); - } - return response; - } - - private Object retryHttpCallOnUnauthorizedAccess(StringBuilder uri, Object request, String tenantId) - throws VoucherCustomException { - try { - populateWithAdminToken(uri, request, tenantId); - return restTemplate.postForObject(uri.toString(), request, Map.class); - } catch (HttpClientErrorException e) { - if (e.getStatusCode().equals(HttpStatus.UNAUTHORIZED)) { - log.error("Unauthorized accessed : Even after retrying with SYSTEM auth token."); - throw new VoucherCustomException(ProcessStatus.FAILED, - "Error occurred even after retrying uri " + uri.toString() + " with SYSTEM auth token."); - } - } catch (IllegalArgumentException | IllegalAccessException e) { - log.error(e.getMessage()); - } - return null; - } - - private void populateWithAdminToken(StringBuilder uri, Object request, String tenantId) - throws IllegalAccessException, VoucherCustomException { - RequestInfo requestInfo = null; - Class clazz = request.getClass(); - Field field = ReflectionUtils.findField(clazz, "requestInfo"); - if (field != null) { - ReflectionUtils.makeAccessible(field); - requestInfo = (RequestInfo) field.get(request); - if (requestInfo.getAuthToken() == null) - requestInfo.setAuthToken(tokenService.generateAdminToken(tenantId)); - ReflectionUtils.setField(field, request, requestInfo); - } else { - throw new VoucherCustomException(ProcessStatus.FAILED, - "requestInfo properties is not found in uri " + uri.toString()); - } - } - - public Object fetchResultGet(String uri) throws VoucherCustomException { - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - Object response = null; - - try { - response = restTemplate.getForObject(uri, Map.class); - } catch (Exception e) { - log.error(SEARCHER_EXCEPTION_MESSAGE, e); - throw new VoucherCustomException(ProcessStatus.FAILED, "IFSC code is invalid : url : " + uri); - } - return response; - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/repository/VoucherIntegartionLogRepository.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/repository/VoucherIntegartionLogRepository.java deleted file mode 100644 index cc533becb21..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/repository/VoucherIntegartionLogRepository.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.repository; - -import org.egov.receipt.consumer.entity.VoucherIntegrationLog; -import static org.egov.receipt.consumer.repository.builder.VoucherIntegrationLogQueryBuilder.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.stereotype.Repository; - -import lombok.extern.slf4j.Slf4j; -@Repository -@Slf4j -public class VoucherIntegartionLogRepository{ - - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - - public void saveVoucherIntegrationLog(VoucherIntegrationLog vilog){ - try { - namedParameterJdbcTemplate.update(INSERT_VOUCHER_LOG_SQL, getParametersForVoucherIntegartionLog(vilog)); - } catch (Exception e) { - log.error("Failed to save the log record"+e.getCause()); - } - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/repository/builder/VoucherIntegrationLogQueryBuilder.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/repository/builder/VoucherIntegrationLogQueryBuilder.java deleted file mode 100644 index 41d0c06545b..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/repository/builder/VoucherIntegrationLogQueryBuilder.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.repository.builder; - -import java.util.UUID; - -import org.egov.receipt.consumer.entity.VoucherIntegrationLog; -import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; - -public class VoucherIntegrationLogQueryBuilder { - - public static final String INSERT_VOUCHER_LOG_SQL = "INSERT INTO egf_voucher_integration_log(id, referencenumber, status, vouchernumber, TYPE, description, requestjson, tenantid, createddate)" - + "VALUES (:id, :referencenumber, :status, :vouchernumber, :TYPE, :description, cast(:requestjson as jsonb), :tenantid,:createddate)"; - - public static MapSqlParameterSource getParametersForVoucherIntegartionLog(VoucherIntegrationLog log){ - MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); - sqlParameterSource.addValue("id", UUID.randomUUID().toString()); - sqlParameterSource.addValue("referencenumber", log.getReferenceNumber()); - sqlParameterSource.addValue("status", log.getStatus()); - sqlParameterSource.addValue("vouchernumber", log.getVoucherNumber()); - sqlParameterSource.addValue("TYPE", log.getType()); - sqlParameterSource.addValue("description", log.getDescription()); - sqlParameterSource.addValue("requestjson", log.getRequestJson()); - sqlParameterSource.addValue("tenantid", log.getTenantId()); - sqlParameterSource.addValue("createddate", log.getCreatedDate()); - return sqlParameterSource; - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/EgfKafkaListener.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/EgfKafkaListener.java deleted file mode 100644 index 4851cf49e0f..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/EgfKafkaListener.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.service; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import org.apache.kafka.clients.consumer.ConsumerRecord; -import org.egov.receipt.consumer.entity.VoucherIntegrationLog; -import org.egov.receipt.consumer.model.Bill; -import org.egov.receipt.consumer.model.BillDetail; -import org.egov.receipt.consumer.model.EgwStatus; -import org.egov.receipt.consumer.model.FinanceMdmsModel; -import org.egov.receipt.consumer.model.ProcessStatus; -import org.egov.receipt.consumer.model.Receipt; -import org.egov.receipt.consumer.model.ReceiptReq; -import org.egov.receipt.consumer.model.Voucher; -import org.egov.receipt.consumer.model.VoucherResponse; -import org.egov.receipt.consumer.repository.VoucherIntegartionLogRepository; -import org.egov.receipt.consumer.util.PaymentUtils; -import org.egov.receipt.consumer.v2.model.PaymentDetail; -import org.egov.receipt.consumer.v2.model.PaymentRequest; -import org.egov.receipt.consumer.v2.model.PaymentStatusEnum; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.egov.reciept.consumer.config.PropertiesManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class EgfKafkaListener { - @Autowired - private ObjectMapper objectMapper; - @Autowired - private VoucherService voucherService; - @Autowired - private ReceiptService receiptService; - @Autowired - private InstrumentService instrumentService; - @Autowired - private VoucherIntegartionLogRepository voucherIntegartionLogRepository; - @Autowired - private PropertiesManager manager; - @Autowired - private PaymentUtils payUtils; - - public static final Logger LOGGER = LoggerFactory.getLogger(EgfKafkaListener.class); - private static final String RECEIPT_TYPE = "Receipt"; - @Value("${}") - private static final String COLLECTION_VERSION = "V2"; - - @KafkaListener(topics = {"${egov.collection.receipt.voucher.save.topic}","${egov.collection.receipt.voucher.cancel.topic}","${kafka.topics.payment.create.name}","${kafka.topics.payment.cancel.name}"}) - public void process(ConsumerRecord record) { - VoucherResponse voucherResponse = null; - String voucherNumber = ""; - ReceiptReq recRequest = ReceiptReq.builder().build(); - PaymentRequest payRequest = null; - FinanceMdmsModel finSerMdms = new FinanceMdmsModel(); - try { - String topic = record.topic(); - if(topic.equals(manager.getCreatePaymentTopicName()) || topic.equals(manager.getCancelPaymentTopicName())){ - payRequest = objectMapper.readValue(record.value(), PaymentRequest.class); - List receipts = new ArrayList(); - //Wrapper to convert payment request to receipt request - payUtils.getReceiptsFromPayments(Arrays.asList(payRequest.getPayment()), receipts); - recRequest.setRequestInfo(payRequest.getRequestInfo()); - recRequest.setReceipt(receipts); - }else{ - recRequest = objectMapper.readValue(record.value(), ReceiptReq.class); - } - LOGGER.info("topic : {} , request : {}", topic, recRequest); - if(voucherService.isTenantEnabledInFinanceModule(recRequest, finSerMdms)){ - Receipt receipt = recRequest.getReceipt().get(0); - BillDetail billDetail = receipt.getBill().get(0).getBillDetails().get(0); - String description = ""; - ProcessStatus status = ProcessStatus.SUCCESS; - //Fetching the voucher details for the combination of service code and reference document in ERP - if(topic.equals(manager.getVoucherCreateTopic())){ - VoucherResponse voucherByServiceAndRefDoc = voucherService.getVoucherByServiceAndRefDoc(recRequest.getRequestInfo(), receipt.getTenantId(), billDetail.getBusinessService(), billDetail.getReceiptNumber()); - if (voucherService.isVoucherCreationEnabled(recRequest.getReceipt().get(0), recRequest.getRequestInfo(), finSerMdms)) { - /* Checking existed voucher status if any present - * if voucher is present with status != 4 then terminate the process and printing specific log. - */ - if(!voucherByServiceAndRefDoc.getVouchers().isEmpty() && !voucherByServiceAndRefDoc.getVouchers().get(0).getStatus().getCode().equals("4")){ - voucherNumber = voucherByServiceAndRefDoc.getVouchers().get(0).getVoucherNumber(); - throw new VoucherCustomException(ProcessStatus.NA, "Already voucher exists ("+voucherNumber+") for service "+billDetail.getBusinessService()+" with reference number "+billDetail.getReceiptNumber()+"."); - } - voucherResponse = voucherService.createReceiptVoucher(recRequest, finSerMdms, null); - voucherNumber = voucherResponse.getVouchers().get(0).getVoucherNumber(); - receiptService.updateReceipt(recRequest, voucherResponse); - instrumentService.createInstrument(recRequest, voucherResponse, finSerMdms, null); - description = "Voucher created successfully with VoucherNumber : "+voucherNumber; - status = ProcessStatus.SUCCESS; - }else{ - //Todo : Status should be different - description = "Voucher creation is not enabled for business service code : "+recRequest.getReceipt().get(0).getBill().get(0).getBillDetails().get(0).getBusinessService(); - status = ProcessStatus.SUCCESS; - } - this.getBackupToDB(recRequest,status,description,voucherNumber); - }else if(topic.equals(manager.getVoucherCancelTopic())){ - /* Checking voucher existence in ERP for the combination. - * if not found then throwing exception with Not Found - * if voucher found cross checking the request voucher number and erp existed voucher number.if both are same then based on status it will proceed ahead. - * if status!=4 then proceed ahead to cancel the erp existed voucher. - * if status=4 then terminating execution and feeding data to table with specific message. - */ - VoucherResponse voucherByServiceAndRefDoc = voucherService.getVoucherByServiceAndRefDoc(recRequest.getRequestInfo(), receipt.getTenantId(), billDetail.getBusinessService(), billDetail.getReceiptNumber()); - if(!voucherByServiceAndRefDoc.getVouchers().isEmpty()){ - Voucher voucher = voucherByServiceAndRefDoc.getVouchers().get(0); - String erpVoucherNumber = voucher.getVoucherNumber(); - String reqVoucherNumber = recRequest.getReceipt().get(0).getBill().get(0).getBillDetails().get(0).getVoucherHeader(); - if(voucher.getStatus().getCode().equals("4")){ - status = ProcessStatus.NA; - description = "Voucher("+erpVoucherNumber+") associated with service "+billDetail.getBusinessService()+" and reference number "+billDetail.getReceiptNumber() - + " is already in Cancelled status."; - if(!reqVoucherNumber.isEmpty() && !erpVoucherNumber.equals(reqVoucherNumber)){ - description += "However, we found that the mapping voucher reference sent("+reqVoucherNumber+") is incorrect."; - } - }else{ - description = "Voucher number : "+erpVoucherNumber+" is CANCELLED successfully!"; - if(!reqVoucherNumber.isEmpty() && !erpVoucherNumber.equals(reqVoucherNumber)){ - description = "Voucher("+erpVoucherNumber+") associated with service "+billDetail.getBusinessService() - + " and reference number "+billDetail.getReceiptNumber()+" is Cancelled. " - + "However, we found that the mapping voucher reference sent("+reqVoucherNumber+") is incorrect."; - } - recRequest.getReceipt().get(0).getBill().get(0).getBillDetails().get(0).setVoucherHeader(erpVoucherNumber); - voucherService.cancelReceiptVoucher(recRequest, this.getTenantId(recRequest), Collections.singleton(erpVoucherNumber)); - instrumentService.cancelInstrument(recRequest,finSerMdms); - } - this.getBackupToDB(recRequest, status, description, erpVoucherNumber); - }else{ - throw new VoucherCustomException(ProcessStatus.FAILED, "Voucher is not exist for service "+billDetail.getBusinessService()+" with reference number "+billDetail.getReceiptNumber()); - } - } else if (topic.equals(manager.getCreatePaymentTopicName())) { - // create voucher for collection v2 - ReceiptReq recRequestTemp = ReceiptReq.builder().requestInfo(recRequest.getRequestInfo()).build(); - for (Receipt recpt : recRequest.getReceipt()) { - recRequestTemp.setReceipt(Arrays.asList(recpt)); - Bill bill = recpt.getBill().get(0); - VoucherResponse voucherByServiceAndRefDoc = voucherService.getVoucherByServiceAndRefDoc(recRequestTemp.getRequestInfo(), recpt.getTenantId(), null, recpt.getPaymentId()); - if (voucherService.isVoucherCreationEnabled(recpt, recRequestTemp.getRequestInfo(), finSerMdms)) { - if(!voucherByServiceAndRefDoc.getVouchers().isEmpty() && !voucherByServiceAndRefDoc.getVouchers().get(0).getStatus().getCode().equals("4")){ - voucherNumber = voucherByServiceAndRefDoc.getVouchers().get(0).getVoucherNumber(); - throw new VoucherCustomException(ProcessStatus.NA, String.format("Already voucher exists (%1$s) for service %2$s with reference number: %3$s.", voucherNumber, bill.getBusinessService(), recpt.getPaymentId())); - } - VoucherResponse createReceiptVoucher = voucherService.createReceiptVoucher(recRequestTemp, finSerMdms, COLLECTION_VERSION); - if(voucherResponse == null){ - voucherResponse = createReceiptVoucher; - }else{ - voucherResponse.getVouchers().addAll(createReceiptVoucher.getVouchers()); - } - if(voucherNumber.isEmpty()){ - voucherNumber = voucherResponse.getVouchers().get(0).getVoucherNumber(); - }else{ - voucherNumber = ", " + voucherNumber; - } -// receiptService.updateReceipt(recRequest, voucherResponse); - } - } - instrumentService.createInstrument(recRequest, voucherResponse, finSerMdms, COLLECTION_VERSION); - description = String.format("Voucher created successfully with VoucherNumber : %1$s", voucherNumber); - status = ProcessStatus.SUCCESS; - this.getBackupToDB(payRequest,status,description,voucherNumber); - }else if (topic.equals(manager.getCancelPaymentTopicName()) && payRequest.getPayment().getPaymentStatus().equals(PaymentStatusEnum.CANCELLED)) { - String paymentId = payRequest.getPayment().getId(); - VoucherResponse voucherByServiceAndRefDoc = voucherService.getVoucherByServiceAndRefDoc(recRequest.getRequestInfo(), receipt.getTenantId(), null, paymentId); - if(!voucherByServiceAndRefDoc.getVouchers().isEmpty()){ - Set voucherNumbers = voucherByServiceAndRefDoc.getVouchers().stream().map(Voucher::getVoucherNumber).collect(Collectors.toSet()); - if(voucherByServiceAndRefDoc.getVouchers().stream().map(Voucher::getStatus).anyMatch(stat -> Integer.parseInt(stat.getCode())!=4)){ - voucherService.cancelReceiptVoucher(recRequest, this.getTenantId(recRequest), voucherNumbers); - instrumentService.cancelInstrumentForPayment(payRequest, finSerMdms); - description = String.format("Voucher number : %1$s is CANCELLED successfully for Payment id: %2$s", voucherNumbers, paymentId); - this.getBackupToDB(payRequest, ProcessStatus.SUCCESS, description, voucherNumbers.toString()); - }else{ - String format = String.format("One/All of the Vouchers(%1$s) associated with Payment id %2$s is/are already in Cancelled state.",voucherNumbers,paymentId); - throw new VoucherCustomException(ProcessStatus.FAILED, format); - } - }else{ - throw new VoucherCustomException(ProcessStatus.FAILED, String.format("Vouchers is not exist for Payment id: %1$s", paymentId)); - } - } else if (topic.equals(manager.getCancelPaymentTopicName()) - && payRequest.getPayment().getPaymentStatus().equals(PaymentStatusEnum.DISHONOURED)) { - LOGGER.info("Payment dishonoured successfully."); - } - } - }catch(VoucherCustomException e){ - this.getBackupToDB(recRequest,e.getStatus(),e.getMessage(),voucherNumber); - LOGGER.error(e.getMessage()); - }catch (Exception e) { - this.getBackupToDB(recRequest,ProcessStatus.FAILED,e.getMessage(),voucherNumber); - LOGGER.error(e.getMessage()); - } - } - - private String getTenantId(ReceiptReq recRequest) { - return recRequest.getReceipt().get(0).getTenantId(); - } - - /** - * function use to take a backup to DB after success/failure of voucher creation process. - */ - private void getBackupToDB(Object request,ProcessStatus status, String description, String voucherNumber){ - try { - VoucherIntegrationLog voucherIntegrationLog = new VoucherIntegrationLog(); - voucherIntegrationLog.setStatus(status.name()); - voucherIntegrationLog.setDescription(description); - this.prepareVoucherIntegrationLog(voucherIntegrationLog, request, voucherNumber); - voucherIntegartionLogRepository.saveVoucherIntegrationLog(voucherIntegrationLog); - LOGGER.debug(String.format("[Status : %1$s, message : %2$s]",status,description)); - } catch (Exception e) { - LOGGER.error("ERROR occurred while doing a backup to databases. "+e.getMessage()); - } - } - - private void prepareVoucherIntegrationLog(VoucherIntegrationLog voucherIntegrationLog, Object request, String voucherNumber){ - if(request instanceof PaymentRequest){ - PaymentRequest payReq = (PaymentRequest)request; - Set voucherNumbers = payReq.getPayment().getPaymentDetails().stream().map(PaymentDetail::getReceiptNumber).collect(Collectors.toSet()); - voucherIntegrationLog.setReferenceNumber(voucherNumbers.toString()); - voucherIntegrationLog.setTenantId(payReq.getPayment().getTenantId()); - }else{ - ReceiptReq request1 = (ReceiptReq)request; - voucherIntegrationLog.setReferenceNumber(request1.getReceipt().get(0).getBill().get(0).getBillDetails().get(0).getReceiptNumber()); - voucherIntegrationLog.setTenantId(request1.getReceipt().get(0).getTenantId()); - } - ObjectMapper mappper = new ObjectMapper(); - try { - String jsonReq = mappper.writeValueAsString(request); - voucherIntegrationLog.setRequestJson(jsonReq); - } catch (JsonProcessingException e) { - LOGGER.error("ERROR occurred while parsing the ReceiptRequest "+e.getMessage()); - } - voucherIntegrationLog.setVoucherNumber(voucherNumber); - voucherIntegrationLog.setType(RECEIPT_TYPE); - voucherIntegrationLog.setCreatedDate(new Date()); - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/InstrumentService.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/InstrumentService.java deleted file mode 100644 index 44b71ac8f65..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/InstrumentService.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.service; - -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.egov.mdms.service.MicroServiceUtil; -import org.egov.receipt.consumer.model.AccountDetail; -import org.egov.receipt.consumer.model.FinanceMdmsModel; -import org.egov.receipt.consumer.model.FinancialStatus; -import org.egov.receipt.consumer.model.Instrument; -import org.egov.receipt.consumer.model.InstrumentContract; -import org.egov.receipt.consumer.model.InstrumentRequest; -import org.egov.receipt.consumer.model.InstrumentResponse; -import org.egov.receipt.consumer.model.InstrumentSearchContract; -import org.egov.receipt.consumer.model.InstrumentVoucherContract; -import org.egov.receipt.consumer.model.ProcessStatus; -import org.egov.receipt.consumer.model.Receipt; -import org.egov.receipt.consumer.model.ReceiptReq; -import org.egov.receipt.consumer.model.RequestInfo; -import org.egov.receipt.consumer.model.Voucher; -import org.egov.receipt.consumer.model.VoucherResponse; -import org.egov.receipt.consumer.model.VoucherSearchCriteria; -import org.egov.receipt.consumer.repository.ServiceRequestRepository; -import org.egov.receipt.consumer.v2.model.PaymentRequest; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.egov.reciept.consumer.config.PropertiesManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - - -@Service -public class InstrumentService { - - public static final Logger LOGGER = LoggerFactory.getLogger(InstrumentService.class); - - private static final String FINANCE_STATUS_NEW = "New"; - - private static final String FINANCE_STATUS_CANCELLED = "Cancelled"; - - final SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy"); - - @Autowired - private PropertiesManager propertiesManager; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private MicroServiceUtil microServiceUtil; - - @Autowired - private VoucherService voucherService; - - /** - * - * @param receiptRequest - * @param voucherResponse - * @return - * Function is used to create the instrument for created voucher. - * @throws VoucherCustomException - */ - public InstrumentResponse createInstrument(ReceiptReq receiptRequest, VoucherResponse voucherResponse, FinanceMdmsModel finSerMdms, String collectionVersion) throws VoucherCustomException { - - Receipt receipt = receiptRequest.getReceipt().get(0); - - FinancialStatus status = microServiceUtil.getFinancialStatusByCode(receipt.getTenantId(), receiptRequest.getRequestInfo(), finSerMdms, FINANCE_STATUS_NEW); - Instrument instrument = receipt.getInstrument(); - String receiptNumber = collectionVersion != null && collectionVersion.equalsIgnoreCase("V2") ? instrument.getPaymentId() : receipt.getBill().get(0).getBillDetails().get(0).getReceiptNumber(); - InstrumentContract instrumentContract = instrument.toContract(); - instrumentContract.setFinancialStatus(status); - if (voucherResponse != null) { - prepareInstrumentVoucher(instrumentContract, voucherResponse, receiptNumber); - } - StringBuilder url = new StringBuilder(propertiesManager.getInstrumentHostUrl() + propertiesManager.getInstrumentCreate()); - InstrumentRequest request = new InstrumentRequest(); - request.setInstruments(Collections.singletonList(instrumentContract)); - request.setRequestInfo(receiptRequest.getRequestInfo()); - LOGGER.info("request : {}, Instrument : {}", request, instrumentContract); - LOGGER.info("InstrumentType : {}", instrumentContract.getInstrumentType().getName()); - return mapper.convertValue(serviceRequestRepository.fetchResult(url, request, receipt.getTenantId()), InstrumentResponse.class); - - } - - private void prepareInstrumentVoucher(InstrumentContract instrumentContract, VoucherResponse voucherResponse, - String receiptNumber) { - - voucherResponse.getVouchers().stream().forEach(voucher -> { - InstrumentVoucherContract ivContract = new InstrumentVoucherContract(); - ivContract.setReceiptHeaderId(receiptNumber); - ivContract.setVoucherHeaderId(voucher.getVoucherNumber()); - instrumentContract.getInstrumentVouchers().add(ivContract); - }); - } - - /** - * - * @param receipt - * Function is used to cancel the instruments - * @throws VoucherCustomException - */ - public void cancelInstrument(ReceiptReq receiptReq, FinanceMdmsModel finSerMdms) throws VoucherCustomException { - RequestInfo requestInfo = receiptReq.getRequestInfo(); - Receipt receipt = receiptReq.getReceipt().get(0); - FinancialStatus status = microServiceUtil.getFinancialStatusByCode(receipt.getTenantId(), requestInfo , finSerMdms, FINANCE_STATUS_CANCELLED); - Instrument instrument = receipt.getInstrument(); - InstrumentContract instrumentContract = instrument.toContract(); - if(instrument.getTransactionDateInput() != null){ - instrumentContract.setTransactionDate(new Date(instrument.getTransactionDateInput())); - } - instrumentContract.setFinancialStatus(status); - String voucherNumber = receipt.getBill().get(0).getBillDetails().get(0).getVoucherHeader(); - // prepareInstrumentVoucher(instrumentContract, receipt.getBill().get(0).getBillDetails().get(0).getVoucherHeader(), receipt.getReceiptNumber()); - prepareInstrumentVoucher(instrumentContract, VoucherResponse.builder().vouchers(Collections.singletonList(Voucher.builder().voucherNumber(voucherNumber).build())).build(), receipt.getReceiptNumber()); - StringBuilder url = new StringBuilder(propertiesManager.getInstrumentHostUrl() + propertiesManager.getInstrumentCancel()); - InstrumentRequest request = new InstrumentRequest(); - request.setInstruments(Collections.singletonList(instrumentContract)); - request.setRequestInfo(requestInfo); - mapper.convertValue(serviceRequestRepository.fetchResult(url, request, receipt.getTenantId()), InstrumentResponse.class); - } - - public void cancelInstrumentForPayment(PaymentRequest payRequest, FinanceMdmsModel finSerMdms) throws VoucherCustomException { - - RequestInfo requestInfo = payRequest.getRequestInfo(); - String paymentId = payRequest.getPayment().getId(); - String tenantId = payRequest.getPayment().getTenantId(); - FinancialStatus cancelStatus = microServiceUtil.getFinancialStatusByCode(tenantId, requestInfo , finSerMdms, FINANCE_STATUS_CANCELLED); - FinancialStatus newStatus = microServiceUtil.getFinancialStatusByCode(tenantId, requestInfo , finSerMdms, FINANCE_STATUS_NEW); - List instruments = microServiceUtil.getInstruments(InstrumentSearchContract.builder().receiptIds(paymentId).build(), requestInfo, tenantId); - if(instruments != null && !instruments.isEmpty()){ - InstrumentContract instrumentContract = instruments.get(0); - if(instrumentContract.getFinancialStatus().getCode().equalsIgnoreCase(newStatus.getCode())){ - instrumentContract .setFinancialStatus(cancelStatus); - StringBuilder url = new StringBuilder(propertiesManager.getInstrumentHostUrl() + propertiesManager.getInstrumentCancel()); - InstrumentRequest request = new InstrumentRequest(); - request.setInstruments(Collections.singletonList(instrumentContract)); - request.setRequestInfo(requestInfo); - mapper.convertValue(serviceRequestRepository.fetchResult(url, request, tenantId), InstrumentResponse.class); - }else{ - throw new VoucherCustomException(ProcessStatus.FAILED, String.format("Instrument for Payment : %1$s is already in %2$s state. So we can not process further to cancel the payment.", paymentId, instrumentContract.getFinancialStatus().getCode())); - } - }else{ - throw new VoucherCustomException(ProcessStatus.FAILED, String.format("Instrument for Payment : %1$s is not exist", paymentId)); - } - } - - public void processDishonorIntruments(InstrumentRequest request) throws IllegalArgumentException, VoucherCustomException { - List instruments = request.getInstruments(); - VoucherResponse reversalVoucher = voucherService.processReversalVoucher(instruments, request.getRequestInfo()); - instruments.get(0).getDishonor().setReversalVoucherId(reversalVoucher.getVouchers().get(0).getVoucherNumber()); - this.updateInstruments(instruments, request.getRequestInfo()); - } - - private void updateInstruments(List instruments, RequestInfo requestInfo) throws IllegalArgumentException, VoucherCustomException { - StringBuilder url = new StringBuilder(propertiesManager.getInstrumentHostUrl() + propertiesManager.getInstrumentCancel()); - InstrumentRequest request = new InstrumentRequest(); - request.setInstruments(instruments); - request.setRequestInfo(requestInfo); - mapper.convertValue(serviceRequestRepository.fetchResult(url, request, instruments.get(0).getTenantId()), InstrumentResponse.class); - } - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/InstrumentUpdateConsumer.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/InstrumentUpdateConsumer.java deleted file mode 100644 index b045e4c1152..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/InstrumentUpdateConsumer.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.egov.receipt.consumer.service; - -import java.io.IOException; -import java.util.Map; - -import org.apache.kafka.clients.consumer.ConsumerRecord; -import org.egov.receipt.consumer.model.InstrumentContract; -import org.egov.receipt.consumer.model.InstrumentRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class InstrumentUpdateConsumer { - @Autowired - private ObjectMapper objectMapper; - @Autowired - private InstrumentService instrumentService; - - public static final Logger LOGGER = LoggerFactory.getLogger(InstrumentUpdateConsumer.class); - - @KafkaListener(topics = {"${kafka.topics.egf.instrument.completed.topic}"}) - public void process(ConsumerRecord record){ - Map mastersMap; - try { - mastersMap = objectMapper.readValue(record.value(), Map.class); - if(mastersMap.get("instrument_persisted") != null){ - InstrumentRequest request = objectMapper.convertValue(mastersMap.get("instrument_persisted"), InstrumentRequest.class); - InstrumentContract contract = request.getInstruments().get(0); - if(request.getRequestInfo().getAction().equals("update") && - contract.getFinancialStatus().getCode().equals("Dishonored") && - contract.getDishonor() != null && - contract.getDishonor().getReversalVoucherId() == null){ - LOGGER.error("instrument with id {} is got requested to dishonored", contract.getId()); - instrumentService.processDishonorIntruments(request); - } - } - } catch (Exception e) { - // TODO Auto-generated catch block - LOGGER.error("Exception occurred while listening to record: " + e.getMessage()); - } - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/ReceiptService.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/ReceiptService.java deleted file mode 100644 index 598563ebc7d..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/ReceiptService.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.service; -import org.egov.receipt.consumer.model.Receipt; -import org.egov.receipt.consumer.model.ReceiptReq; -import org.egov.receipt.consumer.model.ReceiptResponse; -import org.egov.receipt.consumer.model.VoucherResponse; -import org.egov.receipt.consumer.repository.ServiceRequestRepository; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.egov.reciept.consumer.config.PropertiesManager; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class ReceiptService { - - @Autowired - private PropertiesManager propertiesManager; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Autowired - private ObjectMapper mapper; - - /** - * - * @param receiptRequest - * @param voucherResponse - * @return - * Function is used to send the update of receipt with voucher number to collection service. - * @throws VoucherCustomException - * @throws - */ - public ReceiptResponse updateReceipt(ReceiptReq receiptRequest, VoucherResponse voucherResponse) throws VoucherCustomException { - Receipt receipt = receiptRequest.getReceipt().get(0); - StringBuilder url = new StringBuilder(propertiesManager.getCollectionsHostUrl() + propertiesManager.getReceiptsUpdate()); - receipt.getBill().get(0).getBillDetails().get(0) - .setVoucherHeader(voucherResponse.getVouchers().get(0).getVoucherNumber()); - receiptRequest.getRequestInfo().setUserInfo(propertiesManager.getSiUserInfo()); - return mapper.convertValue(serviceRequestRepository.fetchResult(url, receiptRequest, receipt.getTenantId()), ReceiptResponse.class); - } - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/VoucherService.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/VoucherService.java deleted file mode 100644 index f9b02963260..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/VoucherService.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.service; - -import java.io.UnsupportedEncodingException; -import java.util.List; -import java.util.Set; - -import org.egov.receipt.consumer.model.FinanceMdmsModel; -import org.egov.receipt.consumer.model.InstrumentContract; -import org.egov.receipt.consumer.model.Receipt; -import org.egov.receipt.consumer.model.ReceiptReq; -import org.egov.receipt.consumer.model.RequestInfo; -import org.egov.receipt.consumer.model.Voucher; -import org.egov.receipt.consumer.model.VoucherResponse; -import org.egov.receipt.consumer.model.VoucherSearchCriteria; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.egov.tracer.model.CustomException; - -public interface VoucherService { - public VoucherResponse createReceiptVoucher(ReceiptReq req, FinanceMdmsModel finSerMdms, String collectionVersion) throws CustomException; - public VoucherResponse cancelReceiptVoucher(ReceiptReq req, String tenantId, Set voucherNumbers) throws CustomException, VoucherCustomException; - public boolean isVoucherCreationEnabled(Receipt receipt, RequestInfo req, FinanceMdmsModel finSerMdms) throws CustomException; - public boolean isTenantEnabledInFinanceModule(ReceiptReq req, FinanceMdmsModel finSerMdms) throws VoucherCustomException; - VoucherResponse getVoucherByServiceAndRefDoc(RequestInfo requestInfo, String tenantId, String serviceCode, - String referenceDoc) throws VoucherCustomException, UnsupportedEncodingException; - VoucherResponse getVouchers(VoucherSearchCriteria criteria, RequestInfo requestInfo, String tenantId) - throws VoucherCustomException; - VoucherResponse createVoucher(List vouchers, RequestInfo requestInfo, String tenantId) - throws VoucherCustomException; - VoucherResponse processReversalVoucher(List instruments, RequestInfo requestInfo); -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/VoucherServiceImpl.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/VoucherServiceImpl.java deleted file mode 100644 index 400f89d803c..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/service/VoucherServiceImpl.java +++ /dev/null @@ -1,633 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.consumer.service; - -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.net.URLEncoder; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -import org.egov.mdms.service.MicroServiceUtil; -import org.egov.receipt.consumer.model.AccountDetail; -import org.egov.receipt.consumer.model.AppConfigValues; -import org.egov.receipt.consumer.model.Bill; -import org.egov.receipt.consumer.model.BillAccountDetail; -import org.egov.receipt.consumer.model.BillDetail; -import org.egov.receipt.consumer.model.BusinessService; -import org.egov.receipt.consumer.model.EgModules; -import org.egov.receipt.consumer.model.FinanceMdmsModel; -import org.egov.receipt.consumer.model.Function; -import org.egov.receipt.consumer.model.Functionary; -import org.egov.receipt.consumer.model.Fund; -import org.egov.receipt.consumer.model.InstrumentContract; -import org.egov.receipt.consumer.model.InstrumentVoucherContract; -import org.egov.receipt.consumer.model.ProcessStatus; -import org.egov.receipt.consumer.model.Receipt; -import org.egov.receipt.consumer.model.ReceiptReq; -import org.egov.receipt.consumer.model.RequestInfo; -import org.egov.receipt.consumer.model.Scheme; -import org.egov.receipt.consumer.model.TaxHeadMaster; -import org.egov.receipt.consumer.model.Tenant; -import org.egov.receipt.consumer.model.Voucher; -import org.egov.receipt.consumer.model.VoucherRequest; -import org.egov.receipt.consumer.model.VoucherResponse; -import org.egov.receipt.consumer.model.VoucherSearchCriteria; -import org.egov.receipt.consumer.model.VoucherSearchRequest; -import org.egov.receipt.consumer.repository.ServiceRequestRepository; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.egov.reciept.consumer.config.PropertiesManager; -import org.egov.tracer.model.CustomException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.StringUtils; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class VoucherServiceImpl implements VoucherService { - - private static final String ADVANCE = "advance"; - @Autowired - private PropertiesManager propertiesManager; - @Autowired - private MicroServiceUtil microServiceUtil; - @Autowired - private ServiceRequestRepository serviceRequestRepository; - @Autowired - private ObjectMapper mapper; - - final SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy"); - final SimpleDateFormat ddMMMyyyyFormatter = new SimpleDateFormat("dd-MMM-yyyy"); - - private static final String RECEIPTS_VOUCHER_TYPE = "Receipt"; - private static final String COLLECTIONS_EG_MODULES_ID = "10"; - private static final Logger LOGGER = LoggerFactory.getLogger(VoucherServiceImpl.class); - private static final String COLLECTION_MODULE_NAME = "Collections"; - private LinkedHashMap amountMapwithGlcode; - private static final String REVERSAL_VOUCHER_NAME = "JVGeneral"; - private static final String REVERSAL_VOUCHER_TYPE = "Journal Voucher"; - - @Override - /** - * This method is use to create the voucher specifically for receipt - * request. - */ - public VoucherResponse createReceiptVoucher(ReceiptReq receiptRequest, FinanceMdmsModel finSerMdms, String collectionVersion) - throws CustomException { - Receipt receipt = receiptRequest.getReceipt().get(0); - String tenantId = receipt.getTenantId(); -// final StringBuilder voucher_create_url = new StringBuilder(propertiesManager.getErpURLBytenantId(tenantId) -// + propertiesManager.getVoucherCreateUrl()); -// VoucherRequest voucherRequest = new VoucherRequest(); - Voucher voucher = new Voucher(); - voucher.setTenantId(tenantId); - try { - this.setVoucherDetails(voucher, receipt, tenantId, receiptRequest.getRequestInfo(), finSerMdms, collectionVersion); - } catch (Exception e) { - throw new CustomException(e.toString(),e.toString()); - } -// voucherRequest.setVouchers(Collections.singletonList(voucher)); -// voucherRequest.setRequestInfo(receiptRequest.getRequestInfo()); -// voucherRequest.setTenantId(tenantId); - try { - return createVoucher(Collections.singletonList(voucher), receiptRequest.getRequestInfo(), tenantId); - } catch (VoucherCustomException e) { - throw new CustomException(e.toString(),e.toString()); - } -// return mapper.convertValue(serviceRequestRepository.fetchResult(voucher_create_url, voucherRequest, tenantId), VoucherResponse.class); - } - - @Override - public VoucherResponse createVoucher(List vouchers, RequestInfo requestInfo, String tenantId) throws VoucherCustomException{ - final StringBuilder voucher_create_url = new StringBuilder(propertiesManager.getErpURLBytenantId(tenantId) - + propertiesManager.getVoucherCreateUrl()); - VoucherRequest voucherRequest = new VoucherRequest(); - voucherRequest.setVouchers(vouchers); - voucherRequest.setRequestInfo(requestInfo); - voucherRequest.setTenantId(tenantId); - return mapper.convertValue(serviceRequestRepository.fetchResult(voucher_create_url, voucherRequest, tenantId), VoucherResponse.class); - } - - /** - * Function which is used to check whether the voucher creation is set to - * true or false in business mapping file. - */ - @Override - public boolean isVoucherCreationEnabled(Receipt receipt, RequestInfo req, FinanceMdmsModel finSerMdms) throws CustomException { -// Receipt receipt = req.getReceipt().get(0); - String tenantId = receipt.getTenantId(); - Bill bill = receipt.getBill().get(0); - String bsCode = bill.getBillDetails().get(0).getBusinessService(); - List serviceByCode = null; - try { - serviceByCode = this.getBusinessServiceByCode(tenantId, bsCode, req, finSerMdms); - } catch (Exception e) { - throw new CustomException(e.toString(),e.toString()); - } - return serviceByCode != null && !serviceByCode.isEmpty() ? serviceByCode.get(0).isVoucherCreationEnabled() - : false; - } - - /** - * Function is for cancelling the voucher based on voucher number - */ - @Override - public VoucherResponse cancelReceiptVoucher(ReceiptReq receiptRequest, String tenantId, Set voucherNumbers) throws VoucherCustomException { - final StringBuilder voucher_cancel_url = new StringBuilder(propertiesManager.getErpURLBytenantId(tenantId) - + propertiesManager.getVoucherCancelUrl()); - try { - VoucherSearchRequest vSearchReq = this.getVoucherSearchReq(receiptRequest, voucherNumbers, tenantId); - return mapper.convertValue(serviceRequestRepository.fetchResult(voucher_cancel_url, vSearchReq, tenantId), VoucherResponse.class); - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED, "Failed to cancel voucher"); - } - } - - /** - * - * @param receiptRequest - * @return This function is use to set the voucher search params and return - * the setted request - */ - private VoucherSearchRequest getVoucherSearchReq(ReceiptReq receiptRequest, Set voucherNumbers, String tenantId) { - VoucherSearchRequest vSearchReq = new VoucherSearchRequest(); - StringBuilder vouNumberBuilder = new StringBuilder(); - voucherNumbers.stream().forEach(vn -> vouNumberBuilder.append(vn).append(",")); - vSearchReq.setVoucherNumbers(vouNumberBuilder.toString()); - vSearchReq.setTenantId(tenantId); - RequestInfo requestInfo = receiptRequest.getRequestInfo(); -// requestInfo.setAuthToken(propertiesManager.getSiAuthToken()); - vSearchReq.setRequestInfo(requestInfo); - return vSearchReq; - } - - /** - * - * @param voucher - * @param receipt - * @param tenantId - * @throws Exception - * Function is use to set the specific details of voucher which - * is mendatory to create the voucher. - */ - private void setVoucherDetails(Voucher voucher, Receipt receipt, String tenantId, RequestInfo requestInfo, - FinanceMdmsModel finSerMdms, String collectiobVersion) throws CustomException, VoucherCustomException { - BillDetail billDetail = receipt.getBill().get(0).getBillDetails().get(0); - String receiptNumber = null; - String consumerCode = null; - if (collectiobVersion != null && collectiobVersion.equalsIgnoreCase("V2")) { - receiptNumber = receipt.getPaymentId(); - consumerCode = receipt.getConsumerCode(); - } else { - receiptNumber = billDetail.getReceiptNumber(); - consumerCode= billDetail.getConsumerCode(); - } - String bsCode = billDetail.getBusinessService(); - List serviceByCode = this.getBusinessServiceByCode(tenantId, bsCode, requestInfo, finSerMdms); - List taxHeadMasterByBusinessServiceCode = this.getTaxHeadMasterByBusinessServiceCode(tenantId, - bsCode, requestInfo, finSerMdms); - BusinessService businessService = serviceByCode.get(0); - String businessServiceName = microServiceUtil.getBusinessServiceName(tenantId, bsCode, requestInfo, finSerMdms); - voucher.setName(businessServiceName); - voucher.setType(RECEIPTS_VOUCHER_TYPE); - voucher.setFund(new Fund()); - voucher.getFund().setCode(businessService.getFund()); - voucher.setFunction(new Function()); - voucher.getFunction().setCode(businessService.getFunction()); - voucher.setDepartment(businessService.getDepartment()); - voucher.setFunctionary(new Functionary()); - voucher.setServiceName(bsCode); - voucher.setReferenceDocument(receiptNumber); - String functionaryCode = businessService.getFunctionary() != null - & !StringUtils.isEmpty(businessService.getFunctionary()) ? businessService.getFunctionary() : null; - voucher.getFunctionary().setCode(functionaryCode); - voucher.setScheme(new Scheme()); - String schemeCode = businessService.getScheme() != null & !StringUtils.isEmpty(businessService.getScheme()) - ? businessService.getScheme() : null; - voucher.getScheme().setCode(schemeCode); - voucher.setDescription(businessServiceName + " Receipt"); - // checking Whether manualReceipt date will be consider as - // voucherdate - if (billDetail.getManualReceiptDate() != null && billDetail.getManualReceiptDate().longValue() != 0 - && isManualReceiptDateEnabled(tenantId, requestInfo)) { - voucher.setVoucherDate(dateFormatter.format(new Date(billDetail.getManualReceiptDate()))); - } else { - voucher.setVoucherDate(dateFormatter.format(new Date(billDetail.getReceiptDate()))); - } - EgModules egModules = this.getModuleIdByModuleName(COLLECTION_MODULE_NAME, tenantId, requestInfo); - voucher.setModuleId(Long.valueOf(egModules != null ? egModules.getId().toString() : COLLECTIONS_EG_MODULES_ID)); - - voucher.setSource( - propertiesManager.getReceiptViewSourceUrl() + "?selectedReceipts=" + receiptNumber + "&serviceTypeId=" + bsCode); - - voucher.setLedgers(new ArrayList<>()); - final String serviceAttribute = getServiceAttributeByBusinessService(tenantId, requestInfo, businessService, consumerCode); - LOGGER.info("Service Attribute ::: {}", serviceAttribute); - amountMapwithGlcode = new LinkedHashMap<>(); - // Setting glcode and amount in Map as key value pair. - for (BillAccountDetail bad : billDetail.getBillAccountDetails()) { - BigDecimal adjustedAmount = bad.getAdjustedAmount(); - if (bad.getTaxHeadCode().toLowerCase().contains(ADVANCE)) - adjustedAmount = bad.getAmount().abs(); - if (bad.getTaxHeadCode().toLowerCase().contains(ADVANCE) - || adjustedAmount.compareTo(new BigDecimal(0)) != 0) { - String taxHeadCode = bad.getTaxHeadCode(); - List findFirst = taxHeadMasterByBusinessServiceCode.stream() - .filter(tx -> serviceAttribute != null - && businessService.getServiceAttributeTaxHead().equals(taxHeadCode) - ? tx.getTaxhead().equals(taxHeadCode) - && serviceAttribute.equals(tx.getServiceAttribute()) - : tx.getTaxhead().equals(taxHeadCode)) - .collect(Collectors.toList()); - if (findFirst != null && findFirst.isEmpty()) { - StringBuilder exception = new StringBuilder("Taxhead code ").append(taxHeadCode) - .append(" is not mapped with BusinessServiceCode ").append(bsCode); - if (serviceAttribute != null) - exception.append("and Service Attribute ").append(serviceAttribute); - throw new VoucherCustomException(ProcessStatus.FAILED, exception.toString()); - } - String glcode = findFirst.get(0).getGlcode(); - if (amountMapwithGlcode.get(glcode) != null) { - amountMapwithGlcode.put(glcode, amountMapwithGlcode.get(glcode).add(adjustedAmount)); - } else { - amountMapwithGlcode.put(glcode, adjustedAmount); - } - } - } - - this.setNetReceiptAmount(receipt, requestInfo, tenantId, bsCode, finSerMdms); - LOGGER.debug("amountMapwithGlcode ::: {}", amountMapwithGlcode); - // Iterating map and setting the ledger details to voucher. - if(amountMapwithGlcode.isEmpty()){ - throw new VoucherCustomException(ProcessStatus.NA, "This receipt does not require voucher creation."); - } - amountMapwithGlcode.entrySet().stream().forEach(entry -> { - AccountDetail accountDetail = new AccountDetail(); - accountDetail.setGlcode(entry.getKey()); - if (entry.getValue().compareTo(new BigDecimal(0)) == 1) { - accountDetail.setCreditAmount(entry.getValue().doubleValue()); - accountDetail.setDebitAmount(0d); - } else { - accountDetail.setDebitAmount(-entry.getValue().doubleValue()); - accountDetail.setCreditAmount(0d); - } - accountDetail.setFunction(new Function()); - accountDetail.getFunction().setCode(businessService.getFunction()); - voucher.getLedgers().add(accountDetail); - }); - } - - private String getServiceAttributeByBusinessService(String tenantId, RequestInfo requestInfo, - BusinessService businessService, String consumerCode) throws VoucherCustomException { - if (businessService.isServiceAttributeMappingEnabled()) { - try { - final List list = Arrays.asList(consumerCode.split(":")); - String formattedUrl = null; - if (list.size() > 1) - formattedUrl = String.format(businessService.getServiceAttributeUrl(), tenantId, list.get(0), - list.get(1)); - else - formattedUrl = String.format(businessService.getServiceAttributeUrl(), tenantId, list.get(0)); - - final StringBuilder businessServiceUrl = new StringBuilder( - propertiesManager.getBusinessServiceHostUrl()).append(formattedUrl); - VoucherRequest request = new VoucherRequest(); - request.setRequestInfo(requestInfo); - request.setTenantId(tenantId); - LOGGER.info("Business service :: {}, Consumercode :: {}", businessService, consumerCode); - Map apiResponse = (Map) serviceRequestRepository.fetchResult(businessServiceUrl, request, - tenantId); - LOGGER.info("Business service api response :: {}", apiResponse); - Map responseSource = apiResponse; - Object response = null; - for (String str : Arrays.asList(businessService.getServiceAttributeKey().split("\\."))) { - if (str.contains("~")) - response = getResponse(responseSource, str); - else - response = responseSource.get(str); - if (response instanceof Collection) { - response = ((ArrayList) response).get(0); - responseSource = (Map) response; - } - } - return (String) response; - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED, "Failed to fetch service attribute: " + e.getMessage()); - } - } - return null; - } - - private Object getResponse(Map responseSource, String str) { - Object response; - StringBuilder res = new StringBuilder(); - for (String key : Arrays.asList(str.split("~"))) { - if (responseSource.get(key) != null) { - res.append(responseSource.get(key)).append("."); - } - } - response = res.length() != 0 ? res.deleteCharAt(res.length() - 1).toString() : null; - return response; - } - - /** - * - * @param tenantId - * @return Function is used to check the config value for manual receipt - * date consideration. - * @throws VoucherCustomException - */ - private boolean isManualReceiptDateEnabled(String tenantId, RequestInfo requestInfo) throws VoucherCustomException { -// requestInfo.setAuthToken(propertiesManager.getSiAuthToken()); - VoucherRequest request = new VoucherRequest(tenantId, requestInfo, null); - StringBuilder url = new StringBuilder(propertiesManager.getErpURLBytenantId(tenantId) - + propertiesManager.getManualReceiptDateConfigUrl()); - AppConfigValues convertValue = null; - try { - convertValue = mapper.convertValue(serviceRequestRepository.fetchResult(url, request, tenantId), AppConfigValues.class); - } catch (Exception e) { - if (LOGGER.isErrorEnabled()) - LOGGER.error( - "ERROR while checking the consideration of manual receipt date. So the receipt date will be consider as the voucher date"); - } - return convertValue != null ? convertValue.getValue().equalsIgnoreCase("Yes") : false; - } - - /** - * - * @param receipt - * @param tenantId - * @param businessCode - * @param finSerMdms - * @throws VoucherCustomException - * Function is used to set the paid amount as debit in finance - * system. - */ - private void setNetReceiptAmount(Receipt receipt, RequestInfo requestInfo, String tenantId, String businessCode, FinanceMdmsModel finSerMdms) - throws VoucherCustomException { - BigDecimal amountPaid = receipt.getBill().get(0).getBillDetails().get(0).getAmountPaid(); - if (amountPaid != null && amountPaid.compareTo(new BigDecimal(0)) != 0) { - String instrumentType = receipt.getInstrument().getInstrumentType().getName();; - String glcode = microServiceUtil.getGlcodeByInstrumentType(tenantId, businessCode, requestInfo, finSerMdms, instrumentType); - if(glcode == null){ - throw new VoucherCustomException(ProcessStatus.FAILED, "Account code mapping is missing for Instrument Type " + instrumentType); - } - amountMapwithGlcode.put(glcode, new BigDecimal(-amountPaid.doubleValue())); - } - } - - /** - * - * @param tenantId - * @param bsCode - * @return - * @throws Exception - * Function is used to get the Business Services based on - * business service code which is mapped in json file - */ - private List getBusinessServiceByCode(String tenantId, String bsCode, RequestInfo requestInfo, - FinanceMdmsModel finSerMdms) throws CustomException, VoucherCustomException { - List businessServices = null; - try { - businessServices = microServiceUtil.getBusinessService(tenantId, bsCode, - requestInfo, finSerMdms); - } catch (VoucherCustomException e) { - throw new CustomException(e.toString(),e.toString()); - } - if (businessServices.isEmpty()) { - throw new VoucherCustomException(ProcessStatus.FAILED, "Business service is not mapped with business code : " + bsCode); - } - List collect = businessServices.stream().filter(bs -> bs.getCode().equals(bsCode)) - .collect(Collectors.toList()); - return collect; - } - - /** - * - * @param tenantId - * @param bsCode - * @return - * @throws Exception - * Function is used to get the TaxHeadMaster data which is - * mapped to business service code - */ - private List getTaxHeadMasterByBusinessServiceCode(String tenantId, String bsCode, - RequestInfo requestInfo, FinanceMdmsModel finSerMdms) throws CustomException { - List taxHeadMasters = null; - try { - taxHeadMasters = microServiceUtil.getTaxHeadMasters(tenantId, bsCode, requestInfo, - finSerMdms); - } catch (VoucherCustomException e) { - throw new CustomException(e.toString(),e.toString()); - } - return taxHeadMasters; - } - - /** - * - * @param moduleName - * @param tenantId - * @return Function is used to return the module id which is configure in - * erp setup based on module name - * @throws VoucherCustomException - */ - private EgModules getModuleIdByModuleName(String moduleName, String tenantId, RequestInfo requestInfo) throws VoucherCustomException { -// requestInfo.setAuthToken(propertiesManager.getSiAuthToken()); - VoucherRequest request = new VoucherRequest(tenantId, requestInfo, null); - StringBuilder url = new StringBuilder(propertiesManager.getErpURLBytenantId(tenantId) - + propertiesManager.getModuleIdSearchUrl() + "?moduleName=" + moduleName); - try { - return mapper.convertValue(serviceRequestRepository.fetchResult(url, request, tenantId), EgModules.class); - } catch (Exception e) { - LOGGER.error("ERROR while checking the module id for module name {}, default value 10 is considered.", - moduleName); - } - return null; - } - - /** - * (non-Javadoc) - * @see org.egov.receipt.consumer.service.VoucherService#isTenantEnabledInFinanceModule(org.egov.receipt.consumer.model.ReceiptReq, org.egov.receipt.consumer.model.FinanceMdmsModel) - * Method which is used to check whether Tenant is enabled in Finance module or not. - */ - @Override - public boolean isTenantEnabledInFinanceModule(ReceiptReq req, FinanceMdmsModel finSerMdms) throws VoucherCustomException{ - Receipt receipt = req.getReceipt().get(0); - String tenantId = receipt.getTenantId(); - Bill bill = receipt.getBill().get(0); - String bsCode = req.getReceipt().stream().map(Receipt::getBill).flatMap(List::stream) - .map(Bill::getBusinessService).filter(Objects::nonNull).collect(Collectors.joining(",")); - bsCode = bsCode != null && !bsCode.isEmpty() ? bsCode : bill.getBillDetails().get(0).getBusinessService(); - List tenantList = microServiceUtil.getFinanceTenantList(tenantId, bsCode, req.getRequestInfo(), finSerMdms); - List collect = tenantList.stream().filter(tenant -> tenant.getCode().equals(tenantId)).collect(Collectors.toList()); - if(collect.isEmpty()){ - throw new VoucherCustomException(ProcessStatus.NA, "TenantId "+tenantId+" is not enabled in Finance module."); - } - return true; - } - /** - * (non-Javadoc) - * @see org.egov.receipt.consumer.service.VoucherService#getVoucherByServiceAndRefDoc(org.egov.receipt.consumer.model.RequestInfo, java.lang.String, java.lang.String, java.lang.String) - * Method which is used to fetch the voucher details associated with business service and reference documents. - */ - @Override - public VoucherResponse getVoucherByServiceAndRefDoc(RequestInfo requestInfo, String tenantId, String serviceCode, String referenceDoc) throws VoucherCustomException, UnsupportedEncodingException{ -// requestInfo.setAuthToken(propertiesManager.getSiAuthToken()); - VoucherRequest request = new VoucherRequest(tenantId, requestInfo, null); - StringBuilder url = new StringBuilder(propertiesManager.getErpURLBytenantId(tenantId)) - .append(propertiesManager.getVoucherSearchByRefUrl()).append("?"); - if(serviceCode != null && !serviceCode.isEmpty()){ - url.append("servicecode=").append(serviceCode); - } - if(referenceDoc != null & !referenceDoc.isEmpty()){ - url.append("&referencedocument=").append(URLEncoder.encode(referenceDoc,"UTF-8")); - } - - try { - return mapper.convertValue(serviceRequestRepository.fetchResult(url, request, tenantId), VoucherResponse.class); - } catch (Exception e) { - LOGGER.error("ERROR while fetching the voucher based on Service and Reference document"); - } - return null; - } - - @Override - public VoucherResponse getVouchers(VoucherSearchCriteria criteria, RequestInfo requestInfo, String tenantId) throws VoucherCustomException{ - VoucherSearchRequest request = new VoucherSearchRequest(); - request.setRequestInfo(requestInfo); - request.setTenantId(tenantId); - criteria.setTenantId(tenantId); - StringBuilder url = new StringBuilder(propertiesManager.getErpURLBytenantId(tenantId)).append(propertiesManager.getVoucherSearchUrl()).append("?"); - prepareQueryString(url, criteria); - try { - return mapper.convertValue(serviceRequestRepository.fetchResult(url, request, tenantId), VoucherResponse.class); - } catch (Exception e) { - LOGGER.error("ERROR while fetching the voucher based on Service and Reference document"); - } - return null; - } - - @Override - public VoucherResponse processReversalVoucher(List instruments, RequestInfo requestInfo) { - Set receiptVoucherNumbers = instruments.stream().map(InstrumentContract::getInstrumentVouchers).flatMap(x -> x.stream()).map(InstrumentVoucherContract::getVoucherHeaderId).collect(Collectors.toSet()); - Set payInSlipIds = instruments.stream().map(InstrumentContract::getPayinSlipId).map(Long::parseLong).collect(Collectors.toSet()); - String tenantId = instruments.get(0).getTenantId(); - VoucherResponse reversalVoucherResponse = null; - try { - Long dishonorDate = instruments.get(0).getDishonor().getDishonorDate(); - VoucherResponse rvResponse = this.getVouchers(new VoucherSearchCriteria().builder().voucherNumbers(receiptVoucherNumbers).build(), requestInfo , tenantId ); - VoucherResponse pisResponse = this.getVouchers(new VoucherSearchCriteria().builder().ids(payInSlipIds).build(), requestInfo , tenantId ); - if(!rvResponse.getVouchers().isEmpty() && !pisResponse.getVouchers().isEmpty()){ - Voucher reversalVoucher = rvResponse.getVouchers().get(0); - Map rvGlcodeMap = rvResponse.getVouchers().get(0).getLedgers().stream().collect(Collectors.toMap(AccountDetail::getGlcode, java.util.function.Function.identity())); - Map pisGlCodeMap = pisResponse.getVouchers().get(0).getLedgers().stream().collect(Collectors.toMap(AccountDetail::getGlcode, java.util.function.Function.identity())); - List ledgerForReversalVoucher = this.prepareLedgerForReversalVoucher(rvGlcodeMap, pisGlCodeMap); - reversalVoucher.setLedgers(ledgerForReversalVoucher); - this.prepareVoucherDetailsForReversalVoucher(reversalVoucher, dishonorDate); - reversalVoucherResponse = this.createVoucher(Collections.singletonList(reversalVoucher), requestInfo, tenantId); - LOGGER.error("reversalVoucherResponse :: {}", reversalVoucherResponse.getVouchers()); - } - - } catch (VoucherCustomException e) { - e.printStackTrace(); - } - return reversalVoucherResponse; - } - - private void prepareQueryString(StringBuilder url, VoucherSearchCriteria criteria) { - if (criteria.getTenantId() != null && !criteria.getTenantId().isEmpty()) { - url.append("tenantId=").append(criteria.getTenantId()); - } - if (criteria.getIds() != null && !criteria.getIds().isEmpty()) { - String collect = criteria.getIds().stream().map(id -> id.toString()).collect(Collectors.joining(", ")); - url.append("&ids=").append(collect); - } - if (criteria.getVoucherNumbers() != null && !criteria.getVoucherNumbers().isEmpty()) { - url.append("&voucherNumbers=").append(String.join(", ", criteria.getVoucherNumbers())); - } - } - - private List prepareLedgerForReversalVoucher(Map rvGlcodeMap, - Map pisGlCodeMap) { - Double drMaountToBank = new Double(0); - Double crMaountToBank = new Double(0); - for(String pis : pisGlCodeMap.keySet()){ - if(rvGlcodeMap.get(pis) != null){ - drMaountToBank = rvGlcodeMap.get(pis).getDebitAmount(); - crMaountToBank = rvGlcodeMap.get(pis).getCreditAmount(); - rvGlcodeMap.remove(pis); - }else{ - AccountDetail value = pisGlCodeMap.get(pis); - value.setCreditAmount(crMaountToBank); - value.setDebitAmount(drMaountToBank); - rvGlcodeMap.put(pis, value); - } - } - rvGlcodeMap.values().stream().forEach(ad -> { - Double creditAmount = ad.getCreditAmount(); - Double debitAmount = ad.getDebitAmount(); - ad.setCreditAmount(debitAmount); - ad.setDebitAmount(creditAmount); - }); - - return rvGlcodeMap.values().stream().collect(Collectors.toList()); - } - - private void prepareVoucherDetailsForReversalVoucher(Voucher reversalVoucher, Long dishonorDate) { - reversalVoucher.setName(REVERSAL_VOUCHER_NAME); - reversalVoucher.setType(REVERSAL_VOUCHER_TYPE); - reversalVoucher.setVoucherNumber(""); - reversalVoucher.setVoucherDate(dateFormatter.format(new Date(dishonorDate))); - reversalVoucher.setReferenceDocument(null); - reversalVoucher.setServiceName(null); - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/util/PaymentUtils.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/util/PaymentUtils.java deleted file mode 100644 index d14d4e1772c..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/util/PaymentUtils.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.util; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.Collectors; - -import org.egov.receipt.consumer.model.BankContract; -import org.egov.receipt.consumer.model.BankDetails; -import org.egov.receipt.consumer.model.Bill; -import org.egov.receipt.consumer.model.BillAccountDetail; -import org.egov.receipt.consumer.model.BillDetail; -import org.egov.receipt.consumer.model.Instrument; -import org.egov.receipt.consumer.model.InstrumentType; -import org.egov.receipt.consumer.model.Receipt; -import org.egov.receipt.consumer.model.TransactionType; -import org.egov.receipt.consumer.repository.ServiceRequestRepository; -import org.egov.receipt.consumer.v2.model.BillDetailV2; -import org.egov.receipt.consumer.v2.model.BillV2; -import org.egov.receipt.consumer.v2.model.Payment; -import org.egov.receipt.consumer.v2.model.PaymentDetail; -import org.egov.receipt.consumer.v2.model.PaymentModeEnum; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public class PaymentUtils { - - private static final String HTTPS_IFSC_RAZORPAY_URL = "https://ifsc.razorpay.com/"; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Autowired - private ObjectMapper mapper; - /** - * - * @param payments - * @param receipts - * @throws VoucherCustomException - * Method which is used to transform the Payment payload to Receipt payload for collection version-2 - */ - public void getReceiptsFromPayments(List payments, List receipts) throws VoucherCustomException { - // prepare instrument from payment - // prepare receipt from each paymentdetails - for(Payment payment:payments){ - Instrument instrument = new Instrument(); - this.prepareInstrument(payment, instrument); - payment.getPaymentDetails().stream().forEach(paymentDetail -> { - Receipt receipt = new Receipt(); - receipt.setInstrument(instrument); - this.prepareReceipt(payment, paymentDetail, receipt); - receipts.add(receipt); - }); - - } - // Aggregation of receipt based on Business service - this.aggregateReceiptBasedOnService(receipts); - } -/** - * - * @param receipts - * Method which is used to aggregate the paymentdetils based on the service. it will consolidate the billaccount_details in a single receipt based on business service - */ - private void aggregateReceiptBasedOnService(List receipts) { - Map> businessRecptMap = new HashMap<>(); - receipts.stream().forEach(recpt -> { - recpt.getBill().stream().forEach(bill -> { - if(businessRecptMap.containsKey(bill.getBusinessService())){ - businessRecptMap.get(bill.getBusinessService()).add(recpt); - }else{ - List list = new ArrayList<>(); - list.add(recpt); - businessRecptMap.put(bill.getBusinessService(), list); - } - }); - }); - receipts.clear(); - businessRecptMap.entrySet().forEach(entrySet -> { - Receipt receipt = entrySet.getValue().get(0); - - BigDecimal totalAmountPaid = entrySet.getValue().stream().map(Receipt::getBill).flatMap(List::stream).map(Bill::getBillDetails).flatMap(List::stream).map(BillDetail::getAmountPaid).reduce((x,y)->x.add(y)).orElse(BigDecimal.ZERO); - - List billAccDetailList = entrySet.getValue().stream().map(Receipt::getBill).flatMap(List::stream).map(Bill::getBillDetails).flatMap(List::stream).map(BillDetail::getBillAccountDetails).flatMap(List::stream).collect(Collectors.toList()); - - this.aggregateBillAccounDetails(billAccDetailList); - BillDetail billDetail = receipt.getBill().get(0).getBillDetails().get(0); - billDetail.setAmountPaid(totalAmountPaid); - receipt.getBill().get(0).getBillDetails().clear(); - receipt.getBill().get(0).getBillDetails().add(billDetail); - receipt.getBill().get(0).getBillDetails().get(0).getBillAccountDetails().clear(); - receipt.getBill().get(0).getBillDetails().get(0).setBillAccountDetails(billAccDetailList); - receipts.add(receipt); - }); - - } - - private void aggregateBillAccounDetails(List billAccDetailList) { - Map> taxHeadBillAccDetailsMap = new HashMap<>(); - for(BillAccountDetail bad : billAccDetailList){ - if(taxHeadBillAccDetailsMap.containsKey(bad.getTaxHeadCode())){ - taxHeadBillAccDetailsMap.get(bad.getTaxHeadCode()).add(bad); - }else{ - List list = new ArrayList<>(); - list.add(bad); - taxHeadBillAccDetailsMap.put(bad.getTaxHeadCode(), list); - } - } - billAccDetailList.clear(); - for(Entry> set : taxHeadBillAccDetailsMap.entrySet()){ - List value = set.getValue(); - BillAccountDetail bad = value.get(0); - BigDecimal totalAmount = value.stream().map(BillAccountDetail::getAmount).reduce((prevAmount,currAmount)->prevAmount.add(currAmount)).orElse(BigDecimal.ZERO); - BigDecimal adjustedAmount = value.stream().map(BillAccountDetail::getAdjustedAmount).reduce((prevAmount,currAmount)->prevAmount.add(currAmount)).orElse(BigDecimal.ZERO); - bad.setAmount(totalAmount); - bad.setAdjustedAmount(adjustedAmount); - billAccDetailList.add(bad); - } - } - - private void prepareReceipt(Payment payment, PaymentDetail paymentDetail, Receipt receipt) { - receipt.setPaymentDetailId(paymentDetail.getId()); - receipt.setAuditDetails(paymentDetail.getAuditDetails()); - receipt.setConsumerCode(paymentDetail.getBill().getConsumerCode()); - receipt.setReceiptDate(paymentDetail.getReceiptDate()); - receipt.setReceiptNumber(paymentDetail.getReceiptNumber()); - receipt.setTenantId(paymentDetail.getTenantId()); - receipt.setPaymentId(payment.getId()); -// receipt.setBill(bill); - this.prepareBillData(payment, paymentDetail, receipt); -// receipt.setTransactionId(transactionId); - } - - private void prepareBillData(Payment payment, PaymentDetail paymentDetail, Receipt receipt) { - BillV2 billv2 = paymentDetail.getBill(); - Bill bill = new Bill(); - bill.setAdditionalDetails(billv2.getAdditionalDetails()); - bill.setAuditDetails(billv2.getAuditDetails()); - bill.setId(billv2.getId()); -// bill.setIsActive(isActive); - bill.setIsCancelled(billv2.getIsCancelled()); - bill.setMobileNumber(billv2.getMobileNumber()); - bill.setPaidBy(billv2.getPaidBy() != null ? billv2.getPaidBy() : payment.getPaidBy()); - bill.setPayerAddress(billv2.getPayerAddress()); - bill.setPayerEmail(billv2.getPayerEmail()); - bill.setPayerId(billv2.getPayerId()); - bill.setPayerName(billv2.getPayerName()); -// bill.setTaxAndPayments(taxAndPayments); - bill.setTenantId(billv2.getTenantId()); - bill.setBusinessService(paymentDetail.getBusinessService()); -// bill.setBillDetails(billDetails); - //prepare billdetails - bill.setBillDetails(new ArrayList()); - this.prepareBillDetailsData(paymentDetail,bill); - receipt.getBill().add(bill); - } - - private void prepareBillDetailsData(PaymentDetail paymentDetail, Bill bill) { - // TODO Auto-generated method stub - paymentDetail.getBill().getBillDetails().stream().forEach(bdv1 -> { - BillDetail bd = new BillDetail(); - bd.setAdditionalDetails(bdv1.getAdditionalDetails()); - bd.setAmountPaid(bdv1.getAmountPaid()); -// bd.setBill(bill); - bd.setBillDate(paymentDetail.getBill().getBillDate()); - bd.setBillDescription(bdv1.getBillDescription()); - bd.setBillNumber(paymentDetail.getBill().getBillNumber()); - bd.setBoundary(bdv1.getBoundary()); - bd.setBusinessService(paymentDetail.getBill().getBusinessService()); - bd.setCallBackForApportioning(bdv1.getCallBackForApportioning()); - bd.setCancellationRemarks(bdv1.getCancellationRemarks()); - bd.setChannel(bdv1.getChannel()); -// bd.setCollectedAmount(collectedAmount); - bd.setCollectionModesNotAllowed(paymentDetail.getBill().getCollectionModesNotAllowed()); - bd.setCollectionType(bdv1.getCollectionType()); - bd.setConsumerCode(paymentDetail.getBill().getConsumerCode()); - bd.setDemandId(bdv1.getDemandId()); - bd.setDisplayMessage(bdv1.getDisplayMessage()); - bd.setExpiryDate(bdv1.getExpiryDate()); - bd.setFromPeriod(bdv1.getFromPeriod()); - bd.setId(bdv1.getId()); - bd.setIsAdvanceAllowed(paymentDetail.getBill().getIsAdvanceAllowed()); - bd.setManualReceiptDate(bdv1.getManualReceiptDate()); - bd.setManualReceiptNumber(bdv1.getManualReceiptNumber()); - bd.setMinimumAmount(paymentDetail.getBill().getMinimumAmountToBePaid()); - bd.setPartPaymentAllowed(paymentDetail.getBill().getPartPaymentAllowed()); - bd.setReasonForCancellation(paymentDetail.getBill().getReasonForCancellation()); - bd.setReceiptDate(paymentDetail.getReceiptDate()); - bd.setReceiptNumber(paymentDetail.getReceiptNumber()); - bd.setReceiptType(paymentDetail.getReceiptType()); -// bd.setStateId(stateId); - bd.setStatus(paymentDetail.getBill().getStatus().name()); - bd.setTenantId(bdv1.getTenantId()); - bd.setToPeriod(bdv1.getToPeriod()); - bd.setTotalAmount(paymentDetail.getBill().getTotalAmount()); - bd.setVoucherHeader(bdv1.getVoucherHeader()); - bd.setBillAccountDetails(new ArrayList<>()); - this.preapreBillAccountDetails(bd,bdv1); - bill.getBillDetails().add(bd); - }); - } - - private void preapreBillAccountDetails(BillDetail bd, BillDetailV2 bdv1) { - bd.setBillAccountDetails(bdv1.getBillAccountDetails()); -// bdv1.getBillAccountDetails().stream(). - } - - private void prepareInstrument(Payment payment, Instrument instrument) throws VoucherCustomException { - instrument.setAmount(payment.getTotalAmountPaid()); - instrument.setIfscCode(payment.getIfscCode()); - if(payment.getIfscCode() != null && !payment.getIfscCode().isEmpty()){ - populateBankDetails(instrument,payment.getIfscCode()); - } - instrument.setPaymentId(payment.getId()); - instrument.setInstrumentDate(payment.getInstrumentDate()); - instrument.setInstrumentNumber(payment.getInstrumentNumber()); - instrument.setInstrumentStatus(payment.getInstrumentStatus()); - InstrumentType instrumentType = new InstrumentType(); - if (payment.getPaymentMode().name().equalsIgnoreCase("DD")) - instrumentType.setName(payment.getPaymentMode().name().toUpperCase()); - else - instrumentType.setName(this.toCamelCase(payment.getPaymentMode().name())); - instrument.setInstrumentType(instrumentType); - instrument.setTenantId(payment.getTenantId()); - instrument.setTransactionDate(new Date(payment.getTransactionDate())); - instrument.setTransactionNumber(payment.getTransactionNumber()); - instrument.setTransactionType(TransactionType.Debit); - } - - /** - * Method which is used to populate the Bank Details based on ifsc code - * @param instrument - * @param ifscCode - * @throws VoucherCustomException - */ - private void populateBankDetails(Instrument instrument, String ifscCode) throws VoucherCustomException { - Object resultGet = serviceRequestRepository.fetchResultGet(HTTPS_IFSC_RAZORPAY_URL+ifscCode); - BankDetails bankDetails = mapper.convertValue(resultGet, BankDetails.class); - BankContract bank = BankContract.builder().name(bankDetails.getBankName()).code(bankDetails.getBankCode()).build(); - instrument.setBank(bank ); - instrument.setBranchName(bankDetails.getBranchName()); - } - - private String toCamelCase(String str){ - return new StringBuilder(str.toUpperCase().substring(0,1)).append(str.substring(1).toLowerCase()).toString(); - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/BillAccountDetailV2.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/BillAccountDetailV2.java deleted file mode 100644 index ecadae109c5..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/BillAccountDetailV2.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.v2.model; - -import java.math.BigDecimal; - -import org.egov.receipt.consumer.model.AuditDetails; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * BillAccountDetail - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class BillAccountDetailV2 { - - @JsonProperty("id") - private String id; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("billDetailId") - private String billDetailId; - - @JsonProperty("demandDetailId") - private String demandDetailId; - - @JsonProperty("order") - private Integer order; - - @JsonProperty("amount") - private BigDecimal amount; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount; - - @JsonProperty("taxHeadCode") - private String taxHeadCode; - - @JsonProperty("additionalDetails") - private Object additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; -} - - diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/BillDetailV2.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/BillDetailV2.java deleted file mode 100644 index 133be058199..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/BillDetailV2.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.v2.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.constraints.NotNull; - -import org.egov.receipt.consumer.model.AuditDetails; -import org.egov.receipt.consumer.model.BillAccountDetail; -import org.egov.receipt.consumer.model.CollectionType; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(of = {"id"}) -public class BillDetailV2 { - - @JsonProperty("id") - private String id = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("demandId") - private String demandId = null; - - @JsonProperty("billId") - private String billId = null; - - @JsonProperty("amount") - @NotNull - private BigDecimal amount = null; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid = null; - - @NotNull - @JsonProperty("fromPeriod") - private Long fromPeriod = null; - - @NotNull - @JsonProperty("toPeriod") - private Long toPeriod = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("channel") - private String channel = null; - - @JsonProperty("voucherHeader") - private String voucherHeader = null; - - @JsonProperty("boundary") - private String boundary = null; - - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber = null; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate = null; - - - @JsonProperty("billAccountDetails") - private List billAccountDetails = null; - - @NotNull - @JsonProperty("collectionType") - private CollectionType collectionType = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - - - private String billDescription; - - @NotNull - @JsonProperty("expiryDate") - private Long expiryDate; - - private String displayMessage; - - private Boolean callBackForApportioning; - - private String cancellationRemarks; - - public Boolean addBillAccountDetail(BillAccountDetail billAccountDetail) { - - if (CollectionUtils.isEmpty(billAccountDetails)) { - - billAccountDetails = new ArrayList<>(); - return billAccountDetails.add(billAccountDetail); - } else { - - if (!billAccountDetails.contains(billAccountDetail)) - return billAccountDetails.add(billAccountDetail); - else - return false; - } - } - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/BillV2.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/BillV2.java deleted file mode 100644 index 47fb0bb831f..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/BillV2.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.v2.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; - -import org.egov.receipt.consumer.model.AuditDetails; -import org.springframework.util.CollectionUtils; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -@Getter -@Setter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class BillV2 { - // TODO some of the fields are mandatory in yml, lets discuss billdetail and billaccountdetail also for more clarity - - @JsonProperty("id") - private String id = null; - - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @JsonProperty("paidBy") - private String paidBy = null; - - @JsonProperty("payerName") - private String payerName = null; - - @JsonProperty("payerAddress") - private String payerAddress = null; - - @JsonProperty("payerEmail") - private String payerEmail = null; - - @JsonProperty("payerId") - private String payerId = null; - - @JsonProperty("status") - private StatusEnum status = null; - - @JsonProperty("reasonForCancellation") - private String reasonForCancellation = null; - - @JsonProperty("isCancelled") - private Boolean isCancelled = null; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails = null; - - @JsonProperty("billDetails") - @Valid - private List billDetails = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - - @JsonProperty("collectionModesNotAllowed") - private List collectionModesNotAllowed = null; - - @JsonProperty("partPaymentAllowed") - private Boolean partPaymentAllowed = null; - - @JsonProperty("isAdvanceAllowed") - private Boolean isAdvanceAllowed; - - @JsonProperty("minimumAmountToBePaid") - private BigDecimal minimumAmountToBePaid = null; - - @JsonProperty("businessService") - private String businessService = null; - - @JsonProperty("totalAmount") - private BigDecimal totalAmount = null; - - @JsonProperty("consumerCode") - private String consumerCode = null; - - @JsonProperty("billNumber") - private String billNumber = null; - - @JsonProperty("billDate") - private Long billDate = null; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid; - - - - public enum StatusEnum { - ACTIVE("ACTIVE"), - - CANCELLED("CANCELLED"), - - PAID("PAID"), - - EXPIRED("EXPIRED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - public static boolean contains(String test) { - for (StatusEnum val : StatusEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - - } - - public Boolean addBillDetail(BillDetailV2 billDetail) { - - if (CollectionUtils.isEmpty(billDetails)) { - - billDetails = new ArrayList<>(); - return billDetails.add(billDetail); - } else { - - if (!billDetails.contains(billDetail)) - return billDetails.add(billDetail); - else - return false; - } - } - - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/Payment.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/Payment.java deleted file mode 100644 index aceb67e6700..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/Payment.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.v2.model; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.receipt.consumer.model.AuditDetails; -import org.egov.receipt.consumer.model.InstrumentStatusEnum; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@EqualsAndHashCode -public class Payment { - - @Size(max=64) - @JsonProperty("id") - private String id; - - @NotNull - @Size(max=64) - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("totalDue") - private BigDecimal totalDue; - - @NotNull - @JsonProperty("totalAmountPaid") - private BigDecimal totalAmountPaid; - - @Size(max=128) - @JsonProperty("transactionNumber") - private String transactionNumber; - - @JsonProperty("transactionDate") - private Long transactionDate; - - @NotNull - @JsonProperty("paymentMode") - private PaymentModeEnum paymentMode; - - - @JsonProperty("instrumentDate") - private Long instrumentDate; - - @Size(max=128) - @JsonProperty("instrumentNumber") - private String instrumentNumber; - - @JsonProperty("instrumentStatus") - private InstrumentStatusEnum instrumentStatus; - - @Size(max=64) - @JsonProperty("ifscCode") - private String ifscCode; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("paymentDetails") - @Valid - private List paymentDetails; - - @Size(max=128) - @NotNull - @JsonProperty("paidBy") - private String paidBy = null; - - @Size(max=64) - @NotNull - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @Size(max=128) - @JsonProperty("payerName") - private String payerName = null; - - @Size(max=1024) - @JsonProperty("payerAddress") - private String payerAddress = null; - - @Size(max=64) - @JsonProperty("payerEmail") - private String payerEmail = null; - - @Size(max=64) - @JsonProperty("payerId") - private String payerId = null; - - @JsonProperty("paymentStatus") - private PaymentStatusEnum paymentStatus; - - - public Payment addpaymentDetailsItem(PaymentDetail paymentDetail) { - if (this.paymentDetails == null) { - this.paymentDetails = new ArrayList<>(); - } - this.paymentDetails.add(paymentDetail); - return this; - } - - - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentDetail.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentDetail.java deleted file mode 100644 index dc376fdd1e4..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentDetail.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.v2.model; - -import java.math.BigDecimal; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -import org.egov.receipt.consumer.model.AuditDetails; -import org.egov.receipt.consumer.model.Bill; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@EqualsAndHashCode -public class PaymentDetail { - - @Size(max=64) - @JsonProperty("id") - private String id; - - @Size(max=64) - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("totalDue") - private BigDecimal totalDue; - - @NotNull - @JsonProperty("totalAmountPaid") - private BigDecimal totalAmountPaid; - - @Size(max=64) - @JsonProperty("receiptNumber") - private String receiptNumber; - - @Size(max=64) - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate; - - @JsonProperty("receiptDate") - private Long receiptDate = null; - - @JsonProperty("receiptType") - private String receiptType = null; - - @JsonProperty("businessService") - private String businessService; - - @NotNull - @Size(max=64) - @JsonProperty("billId") - private String billId; - - @JsonProperty("bill") - private BillV2 bill; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - -} - diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentModeEnum.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentModeEnum.java deleted file mode 100644 index a7a60d8259d..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentModeEnum.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.v2.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum PaymentModeEnum { - CASH("CASH"), - CHEQUE("CHEQUE"), - DD("DD"), - ONLINE("ONLINE"), - CARD("CARD"); - - - private String value; - - PaymentModeEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - public static boolean contains(String test) { - for (PaymentModeEnum val : PaymentModeEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } - - @JsonCreator - public static PaymentModeEnum fromValue(String text) { - for (PaymentModeEnum b : PaymentModeEnum.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentRequest.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentRequest.java deleted file mode 100644 index b1ba77804d8..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.v2.model; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -import org.egov.receipt.consumer.model.RequestInfo; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class PaymentRequest { - - @NotNull - @Valid - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @Valid - @JsonProperty("Payment") - private Payment payment; - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentStatusEnum.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentStatusEnum.java deleted file mode 100644 index 1290a524424..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/consumer/v2/model/PaymentStatusEnum.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package org.egov.receipt.consumer.v2.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum PaymentStatusEnum { - NEW("NEW"), - DEPOSITED("DEPOSITED"), - CANCELLED("CANCELLED"), - DISHONOURED("DISHONOURED"), - RECONCILED("RECONCILED"); - - - private String value; - - PaymentStatusEnum(String value) { - this.value = value; - } - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - - @JsonCreator - public static PaymentStatusEnum fromValue(String text) { - for (PaymentStatusEnum b : PaymentStatusEnum.values()) { - if (String.valueOf(b.value).equalsIgnoreCase(text)) { - return b; - } - } - return null; - } - - public static boolean contains(String test) { - for (PaymentStatusEnum val : PaymentStatusEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/custom/exception/VoucherCustomException.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/custom/exception/VoucherCustomException.java deleted file mode 100644 index f9e9250e600..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/receipt/custom/exception/VoucherCustomException.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) <2015> eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any Long of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ -package org.egov.receipt.custom.exception; - -import org.egov.receipt.consumer.model.ProcessStatus; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class VoucherCustomException extends Exception{ - ProcessStatus status; - String message; -public VoucherCustomException(String message) { - super(message); -} -@Override -public String getMessage() { - return "[status : "+status+", message : "+message+"]"; -} - -} diff --git a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/reciept/consumer/config/PropertiesManager.java b/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/reciept/consumer/config/PropertiesManager.java deleted file mode 100644 index bbf07c6d26f..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/java/org/egov/reciept/consumer/config/PropertiesManager.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.empernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@empernments.org. - */ - -package org.egov.reciept.consumer.config; - -import java.util.regex.Pattern; - -import org.egov.common.contract.request.User; -import org.egov.receipt.consumer.model.ProcessStatus; -import org.egov.receipt.custom.exception.VoucherCustomException; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@Component -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -@ToString -public class PropertiesManager { - - @Value("${egov.services.egov.user.host}") - private String userHostUrl; - - @Value("${egov.services.egf.voucher.create}") - private String voucherCreateUrl; - - @Value("${egov.services.egf.voucher.cancel}") - private String voucherCancelUrl; - - @Value("${si.microservice.user}") - private String siUser; - - @Value("${si.microservice.password}") - private String siPassword; - - @Value("${si.microservice.usertype}") - private String siUserType; - - @Value("${si.microservice.scope}") - private String siScope; - - @Value("${si.microservice.granttype}") - private String siGrantType; - - @Value("${egov.services.user.token.url}") - private String tokenGenUrl; - - @Value("${egov.services.egf.master.financialstatuses.search}") - private String financialStatusesSearch; - - @Value("${egov.services.egf.instrument.instruments.create}") - private String instrumentCreate; - - @Value("${egov.services.collection.services.receipts.update}") - private String receiptsUpdate; - - @Value("${egov.services.instrument.search.accountcodes.uri}") - private String instrumentAccountCodeUrl; - - @Value("${egov.services.egf.voucher.search.by.service.reference}") - private String voucherSearchByRefUrl; - - @Value("${egov.services.egf.voucher.search}") - private String voucherSearchUrl; - - @Value("${egov.services.egf.voucher.manualreceiptdate.config.url}") - private String manualReceiptDateConfigUrl; - - @Value("${egov.services.master.mdms.search.url}") - private String mdmsSearchUrl; - - @Value("${egov.services.egf.instrument.instruments.cancel}") - private String instrumentCancel; - - @Value("${fin.coe.erp.domain.name}") - private String finCoeErpDomainName; - - @Value("${fin.coe.erp.environment.name}") - private String finCoeErpEnvName; - - @Value("${fin.coe.erp.http.protocol}") - private String httpProtocol; - - @Value("${egov.services.egf.voucher.moduleid.search}") - private String moduleIdSearchUrl; - - @Value("${egov.services.collection.receipts.view.source.url}") - private String receiptViewSourceUrl; - - @Value("${egov.services.mdms.hostname}") - private String mdmsHostUrl; - - @Value("${egov.services.egfinstrument.hostname}") - private String instrumentHostUrl; - - @Value("${egov.services.collections.hostname}") - private String collectionsHostUrl; - - @Value("${egov.services.businessservice.hostname}") - private String businessServiceHostUrl; - - @Value("${egov.services.egfmaster.hostname}") - private String egfMasterHostUrl; - - @Value("${token.authorization.key}") - private String tokenAuhorizationtKey; - - @Value("${egov.collection.receipt.voucher.save.topic}") - private String voucherCreateTopic; - - @Value("${egov.collection.receipt.voucher.cancel.topic}") - private String voucherCancelTopic; - - @Value("${kafka.topics.payment.create.name}") - private String createPaymentTopicName; - - @Value("${kafka.topics.payment.cancel.name}") - private String cancelPaymentTopicName; - - private String siAuthToken; - private User siUserInfo; - - @Value("${egov.services.egf.instrument.instruments.search}") - private String instrumentSearch; - - public String getErpURLBytenantId(String tenantId) throws VoucherCustomException { - try { - tenantId = tenantId.split(Pattern.quote("."))[1]; - if(finCoeErpEnvName != null && finCoeErpEnvName.equalsIgnoreCase("local")){ - return "http://jalandhar.lgpunjab.com:8080/"; - } - if(finCoeErpEnvName != null && !finCoeErpEnvName.isEmpty()){ - return httpProtocol+"://"+tenantId+"-"+finCoeErpEnvName+"."+finCoeErpDomainName+"/"; - }else{ - //considered as the production url - return httpProtocol+"://"+tenantId+"."+finCoeErpDomainName+"/"; - } - } catch (Exception e) { - throw new VoucherCustomException(ProcessStatus.FAILED,"ERROR occured while generating ERP url to interact with the finance coexistence. Please check the configuration in properties file."); - } - } - -} \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/resources/application.properties b/business-services/finance-collections-voucher-consumer/src/main/resources/application.properties deleted file mode 100644 index 5efb46de782..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/resources/application.properties +++ /dev/null @@ -1,100 +0,0 @@ -app.timezone=UTC - -#datasource configuration -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/egf-collectionvoucher -spring.datasource.username=postgres -spring.datasource.password=psql - -spring.flyway.enabled=true -spring.flyway.user=postgres -spring.flyway.password=psql -spring.flyway.outOfOrder=true -#spring.flyway.table=egf-collectionvoucher_schema_version -spring.flyway.baseline-on-migrate=true -spring.flyway.url=jdbc:postgresql://localhost:5432/egf-collectionvoucher -spring.flyway.locations=classpath:/db/migration/main - -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl -spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl - -spring.jackson.deserialization.fail-on-unknown-properties=false -#Kafka general config -spring.kafka.consumer.properties.spring.json.use.type.headers=false -spring.kafka.listener.missing-topics-fatal=false -management.endpoints.web.base-path=/ -spring.main.allow-bean-definition-overriding=false - -spring.kafka.consumer.group-id=fin-collection-receipt-voucher-consumer -spring.kafka.producer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer - - -#Kafka Topic config for Receipt -egov.collection.receipt.voucher.save.topic=egov.collection.receipt-create -egov.collection.receipt.voucher.save.group=egov.collection.receipt-create.group -egov.collection.receipt.voucher.save.id=egov.collection.receipt-create.id - -egov.collection.receipt.voucher.cancel.topic=egov.collection.receipt-cancel -egov.collection.receipt.voucher.cancel.group=egov.collection.receipt-cancel.group -egov.collection.receipt.voucher.cancel.id=egov.collection.receipt-cancel.id - -kafka.topics.egf.instrument.completed.topic=egov.egf.instrument.completed -kafka.topics.egf.instrument.completed.group=egov.egf.instrument.completed.group - -#Kafka Topic for Payment -kafka.topics.payment.create.name=egov.collection.payment-create -kafka.topics.payment.create.key=payment-create -kafka.topics.payment.cancel.name=egov.collection.payment-cancel -kafka.topics.payment.cancel.key=payment-cancel -kafka.topics.payment.update.name=egov.collection.payment-update -kafka.topics.payment.update.key=payment-update - -#Config key for tenant based url -fin.coe.erp.domain.name=digit.org -#this is not required for production. keep it blank -fin.coe.erp.environment.name=dev -# i.e http or https -fin.coe.erp.http.protocol=https - -token.authorization.key= - -#egov-user -egov.services.egov.user.host = https://dev.digit.org/ -#egov-mdms-service -egov.services.mdms.hostname = https://dev.digit.org/ -#egf-instrument -egov.services.egfinstrument.hostname = https://dev.digit.org/ -#egf-master -egov.services.egfmaster.hostname = https://dev.digit.org/ -#collection-services -egov.services.collections.hostname = https://dev.digit.org/ -#business-services -egov.services.businessservice.hostname = https://dev.digit.org/ - - -egov.services.instrument.search.accountcodes.uri=egf-instrument/instrumentaccountcodes/_search -egov.services.master.mdms.search.url = /egov-mdms-service/v1/_search -egov.services.user.token.url=user/oauth/token -egov.services.egf.voucher.create=services/EGF/rest/voucher/_create -egov.services.egf.voucher.cancel=services/EGF/rest/voucher/_cancel -egov.services.egf.voucher.search=services/EGF/rest/voucher/v2/_search -egov.services.egf.voucher.search.by.service.reference=services/EGF/rest/voucher/_searchbyserviceandreference -egov.services.egf.voucher.moduleid.search=services/EGF/rest/voucher/_getmoduleidbyname -egov.services.egf.voucher.manualreceiptdate.config.url=services/EGF/rest/voucher/_ismanualreceiptdateenabled -egov.services.egf.master.financialstatuses.search=egf-master/financialstatuses/_search -egov.services.egf.instrument.instruments.create=egf-instrument/instruments/_create -egov.services.egf.instrument.instruments.cancel=egf-instrument/instruments/_update -egov.services.egf.instrument.instruments.search=egf-instrument/instruments/_search -egov.services.collection.services.receipts.update=collection-services/receipts/_update -egov.services.collection.receipts.view.source.url=/services/collection/receipts/receipt-viewReceipts.action - - -logging.level.*=DEBUG -logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} -#this credential is overridden in yml file -si.microservice.user= -si.microservice.password= -si.microservice.usertype=SYSTEM -si.microservice.scope=read -si.microservice.granttype=password diff --git a/business-services/finance-collections-voucher-consumer/src/main/resources/db/Dockerfile b/business-services/finance-collections-voucher-consumer/src/main/resources/db/Dockerfile deleted file mode 100644 index a5699ff7d99..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/resources/db/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM egovio/flyway:4.1.2 - -COPY ./migration/main /flyway/sql - -COPY migrate.sh /usr/bin/migrate.sh - -RUN chmod +x /usr/bin/migrate.sh - -CMD ["/usr/bin/migrate.sh"] diff --git a/business-services/finance-collections-voucher-consumer/src/main/resources/db/migrate.sh b/business-services/finance-collections-voucher-consumer/src/main/resources/db/migrate.sh deleted file mode 100644 index 54d07c0940a..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/resources/db/migrate.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate diff --git a/business-services/finance-collections-voucher-consumer/src/main/resources/db/migration/main/V20190513113515__voucher_integration_query.sql b/business-services/finance-collections-voucher-consumer/src/main/resources/db/migration/main/V20190513113515__voucher_integration_query.sql deleted file mode 100644 index 0f236c37186..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/resources/db/migration/main/V20190513113515__voucher_integration_query.sql +++ /dev/null @@ -1,12 +0,0 @@ -DROP TABLE IF EXISTS egf_voucher_integration_log; - -CREATE TABLE egf_voucher_integration_log( -id varchar(250), -referenceNumber varchar(50), -status varchar(20), -voucherNumber varchar(30), -type varchar(50), -description text, -requestJson JSONB, -tenantId varchar(50) -); \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/main/resources/db/migration/main/V20190526203409__voucher_integration_query_modified_table.sql b/business-services/finance-collections-voucher-consumer/src/main/resources/db/migration/main/V20190526203409__voucher_integration_query_modified_table.sql deleted file mode 100644 index bbefc229a46..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/main/resources/db/migration/main/V20190526203409__voucher_integration_query_modified_table.sql +++ /dev/null @@ -1,13 +0,0 @@ -DROP TABLE IF EXISTS egf_voucher_integration_log; - -CREATE TABLE egf_voucher_integration_log( -id varchar(250), -referenceNumber varchar(50), -status varchar(20), -voucherNumber varchar(30), -type varchar(50), -description text, -requestJson JSONB, -tenantId varchar(50), -createddate TIMESTAMP not null default now() -); \ No newline at end of file diff --git a/business-services/finance-collections-voucher-consumer/src/test/java/org/egov/egfcollectionreceiptvoucherconsumer/EgfCollectionReceiptVoucherConsumerApplicationTests.java b/business-services/finance-collections-voucher-consumer/src/test/java/org/egov/egfcollectionreceiptvoucherconsumer/EgfCollectionReceiptVoucherConsumerApplicationTests.java deleted file mode 100644 index 72f0d63a3ee..00000000000 --- a/business-services/finance-collections-voucher-consumer/src/test/java/org/egov/egfcollectionreceiptvoucherconsumer/EgfCollectionReceiptVoucherConsumerApplicationTests.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.egov.egfcollectionreceiptvoucherconsumer; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class EgfCollectionReceiptVoucherConsumerApplicationTests { - - @Ignore - @Test - public void contextLoads() { - } - -} diff --git a/business-services/finance-collections-voucher-consumer/start.sh b/business-services/finance-collections-voucher-consumer/start.sh deleted file mode 100644 index 3b4b97e3199..00000000000 --- a/business-services/finance-collections-voucher-consumer/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -if [[ -z "${JAVA_OPTS}" ]];then - export JAVA_OPTS="-Xmx64m -Xms64m" -fi - -java ${JAVA_OPTS} -jar /opt/egov/finance-collections-voucher-consumer.jar \ No newline at end of file diff --git a/core-services/MDMS-v2/CHANGELOG.md b/core-services/MDMS-v2/CHANGELOG.md new file mode 100644 index 00000000000..91d931292ae --- /dev/null +++ b/core-services/MDMS-v2/CHANGELOG.md @@ -0,0 +1,42 @@ + + +# Changelog +All notable changes to this module will be documented in this file. + +## 1.3.2 - 2022-01-13 +- Updated to log4j2 version 2.17.1 + +## 1.3.1 - 2021-05-11 +- Added finally blocked wherever missing +- Changes to error handling + + +## 1.3.0 - 2020-05-29 + +- Added typescript definition generation plugin +- Upgraded to `tracer:2.0.0-SNAPSHOT` +- Upgraded to spring boot `2.2.6-RELEASE` +- Upgraded to spring-kafka `2.3.7.RELEASE` +- Upgraded to spring-integration-kafka `3.2.0.RELEASE` +- Upgraded to jackson-dataformat-yaml `2.10.0` +- Upgraded to jackson-databind `2.10.0` +- Removed the spring-integration-java-dsl because from Spring Integration 5.0, the + 'spring-integration-java-dsl' dependency is no longer needed. The Java DSL has + been merged into the core project. + +## 1.2.0 + +- Removed reload consumers +- Removed `start.sh` and `Dockerfile` +- Remove reload endpoints +- Remove all unused dependencies +- Migrated to the latest Spring Boot `2.2.6` +- Upgraded to tracer `2.0.0` + +## 1.1.0 + +- Added support for partial files using `isMergeAllowed` flag in the config file. By default, merge is `false` + +## 1.0.0 + +- Base version diff --git a/core-services/MDMS-v2/LOCALSETUP.md b/core-services/MDMS-v2/LOCALSETUP.md new file mode 100644 index 00000000000..5decabe365b --- /dev/null +++ b/core-services/MDMS-v2/LOCALSETUP.md @@ -0,0 +1,30 @@ +# Local Setup + +To setup the MDMS service in your local system, clone the [Core Service repository](https://github.com/egovernments/core-services). + +## Dependencies + +### Infra Dependency + +- [ ] Postgres DB +- [ ] Redis +- [ ] Elasticsearch +- [ ] Kafka + - [ ] Consumer + - [ ] Producer + +## Running Locally + +To run the MDMS services locally, update below listed properties in `application.properties` before running the project: + +```ini +egov.mdms.conf.path = +masters.config.url = +``` +- Update `egov.mdms.conf.path` and `masters.config.url` to point to the folder/file where the master configuration/data is stored. You can put the folder path present in your local system or put the git hub link of MDMS config folder/file [Sample data](https://github.com/egovernments/egov-mdms-data/blob/master/data/pb/) and [Sample config](https://raw.githubusercontent.com/egovernments/egov-mdms-data/master/master-config.json) + +>**Note:** +If you are mentioning local folder path in above mention property, then add `file://` as prefix. +`file://` +egov.mdms.conf.path = file:///home/abc/xyz/egov-mdms-data/data/pb +>If there are multiple file seperate it with `,` . \ No newline at end of file diff --git a/core-services/MDMS-v2/README.md b/core-services/MDMS-v2/README.md new file mode 100644 index 00000000000..b2fc7a24cc1 --- /dev/null +++ b/core-services/MDMS-v2/README.md @@ -0,0 +1,87 @@ +# Master Data Management service + +Master Data Management Service is a core service that is made available on the DIGIT platform. It encapsulates the functionality surrounding Master Data Management. The service fetches Master Data pertaining to different modules. The functionality is exposed via REST API. + +### DB UML Diagram + +- NA + +### Service Dependencies +- NA + +### Swagger API Contract + +Please refer to the below Swagger API contarct for MDMS service to understand the structure of APIs and to have visualization of all internal APIs. +http://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/egov-services/master/docs/mdms/contract/v1-0-0.yml#!/ + + +## Service Details + +The MDM service reads the data from a set of JSON files from a pre-specified location. It can either be an online location (readable JSON files from online) or offline (JSON files stored in local memory). The JSON files should conform to a prescribed format. The data is stored in a map and tenantID of the file serves as a key. +Once the data is stored in the map the same can be retrieved by making an API request to the MDM service. Filters can be applied in the request to retrieve data based on the existing fields of JSON. + +#### Master data management files check in location and details - + +1. Data folder parallel to docs (https://github.com/egovernments/egov-mdms-data/tree/master/data/pb). +2. Under data folder there will be a folder `` which is a state specific master folder. +3. Under `` folder there will `` folders where ulb specific master data will be checked in. for example `pb.testing` +4. Each module will have one file each for statewise and ulb wise master data. Keep the file name as module name itself. + +### Sample Config + +Each master has three key parameters `tenantId`, `moduleName`, `masterName`. A sample master would look like below + +```json +{ + "tenantId": "pb", + "moduleName": "common-masters", + "OwnerType": [ + { + "code": "FREEDOMFIGHTER", + "active": true + }, + { + "code": "WIDOW", + "active": true + }, + { + "code": "HANDICAPPED", + "active": true + } + ] +} +``` +Suppose there are huge data to be store in one config file, the data can be store in seperate files. And these seperated config file data can be use under one master name, if `isMergeAllowed` +flag is `true` in [mdms-masters-config.json](https://raw.githubusercontent.com/egovernments/punjab-mdms-data/UAT/mdms-masters-config.json) +### API Details + +`BasePath` /mdms/v1/[API endpoint] + +##### Method +a) `POST /_search` + +This method fetches a list of masters for a specified module and tenantId. +- `MDMSCriteriaReq (mdms request)` : Request Info + MdmsCriteria — Details of module and master which need to be searched using MDMS. + +- `MdmsCriteria` + + | Input Field | Description | Mandatory | Data Type | + | ----------------------------------------- | ------------------------------------------------------------------| -----------|------------------| + | `tenantId` | Unique id for a tenant. | Yes | String | + | `moduleDetails` | module for which master data is required | Yes | String | + +- `MdmsResponse` Response Info + Mdms + +- `Mdms` + + | Input Field | Description | Mandatory | Data Type | + | ----------------------------------------- | ------------------------------------------------------------------| -----------|------------------| + | `mdms` | Array of modules | Yes | String | + +### Kafka Consumers + +- NA + +### Kafka Producers + +- NA \ No newline at end of file diff --git a/core-services/MDMS-v2/pom.xml b/core-services/MDMS-v2/pom.xml new file mode 100644 index 00000000000..f5cefd7754f --- /dev/null +++ b/core-services/MDMS-v2/pom.xml @@ -0,0 +1,141 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.2 + + + org.egov.mdms + egov-mdms-service-test + 1.3.2-SNAPSHOT + egov-infra-mdms-service + http://maven.apache.org + + 2.17.1 + UTF-8 + 17 + UTF-8 + ${java.version} + ${java.version} + + + + org.projectlombok + lombok + 1.18.22 + provided + + + com.jayway.jsonpath + json-path + + + com.fasterxml.jackson.core + jackson-databind + + + org.egov.services + tracer + 2.9.0-SNAPSHOT + + + + org.everit.json + org.everit.json.schema + 1.5.1 + + + + + + io.swagger + swagger-core + 1.5.18 + + + io.swagger.core.v3 + swagger-annotations + 2.2.8 + + + + net.minidev + json-smart + 2.5.0 + + + + org.flywaydb + flyway-core + 9.22.3 + + + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.postgresql + postgresql + 42.7.1 + + + org.egov.services + services-common + 2.0.0-SNAPSHOT + + + + + + + + org.springframework.boot + spring-boot-devtools + + + org.springframework.boot + spring-boot-starter-aop + + + + + repo.egovernments.org + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + + + repo.egovernments.org.snapshots + eGov ERP Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + org.springframework.boot + spring-boot-devtools + + + + + + + + + diff --git a/core-services/MDMS-v2/sample/data/Level1/Level2/level2Master.json b/core-services/MDMS-v2/sample/data/Level1/Level2/level2Master.json new file mode 100644 index 00000000000..f20cd824103 --- /dev/null +++ b/core-services/MDMS-v2/sample/data/Level1/Level2/level2Master.json @@ -0,0 +1,11 @@ +{ + "tenantId": "Level1.Level2", + "moduleName": "Level2Module", + "masterName": "Level2Master", + "Level2Master": [ + { + "code": "ABC", + "data": "data-ABC" + } + ] +} \ No newline at end of file diff --git a/core-services/MDMS-v2/sample/data/Level1/level1Master.json b/core-services/MDMS-v2/sample/data/Level1/level1Master.json new file mode 100644 index 00000000000..005050baa35 --- /dev/null +++ b/core-services/MDMS-v2/sample/data/Level1/level1Master.json @@ -0,0 +1,11 @@ +{ + "tenantId": "Level1", + "moduleName": "Level1Module", + "masterName": "Level2Master", + "Level2Master": [ + { + "code": "ABC", + "data": "data-ABC" + } + ] +} \ No newline at end of file diff --git a/core-services/MDMS-v2/sample/master-config.json b/core-services/MDMS-v2/sample/master-config.json new file mode 100644 index 00000000000..efa73116b22 --- /dev/null +++ b/core-services/MDMS-v2/sample/master-config.json @@ -0,0 +1,5 @@ +{ + "Level1": { + + } +} \ No newline at end of file diff --git a/core-services/MDMS-v2/src/main/java/org/egov/MDMSApplication.java b/core-services/MDMS-v2/src/main/java/org/egov/MDMSApplication.java new file mode 100644 index 00000000000..de224d8fd25 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/MDMSApplication.java @@ -0,0 +1,16 @@ +package org.egov; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + + +@ComponentScan +@SpringBootApplication +public class MDMSApplication { + + public static void main(String[] args) { + SpringApplication.run(MDMSApplication.class, args); + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/config/ApplicationConfig.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/config/ApplicationConfig.java new file mode 100644 index 00000000000..8cea5ca6da9 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/config/ApplicationConfig.java @@ -0,0 +1,33 @@ +package org.egov.infra.mdms.config; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@ToString +@Setter +@Getter +@Import({MultiStateInstanceUtil.class}) +public class ApplicationConfig { + + @Value("${egov.mdms.schema.definition.save.topic}") + private String saveSchemaDefinitionTopicName; + + @Value("${egov.mdms.data.save.topic}") + private String saveMdmsDataTopicName; + + @Value("${egov.mdms.data.update.topic}") + private String updateMdmsDataTopicName; + + @Value("${mdms.default.offset}") + private Integer defaultOffset; + + @Value("${mdms.default.limit}") + private Integer defaultLimit; + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/constants/SchemaDefinitionConstant.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/constants/SchemaDefinitionConstant.java new file mode 100644 index 00000000000..965b891dea5 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/constants/SchemaDefinitionConstant.java @@ -0,0 +1,4 @@ +package org.egov.infra.mdms.constants; + +public class SchemaDefinitionConstant { +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/controller/MDMSController.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/controller/MDMSController.java new file mode 100644 index 00000000000..9152a7872ea --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/controller/MDMSController.java @@ -0,0 +1,41 @@ +package org.egov.infra.mdms.controller; + +import java.util.Map; + +import jakarta.validation.Valid; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.service.MDMSService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; + +@RestController +@Slf4j +@RequestMapping(value = "/v1") +public class MDMSController { + + private MDMSService mdmsService; + + @Autowired + public MDMSController(MDMSService mdmsService) { + this.mdmsService = mdmsService; + } + + /** + * Request handler for serving v1 search requests. + * @param body + * @return + */ + @RequestMapping(value="_search", method = RequestMethod.POST) + public ResponseEntity search(@Valid @RequestBody MdmsCriteriaReq body) { + Map> moduleMasterMap = mdmsService.search(body); + MdmsResponse mdmsResponse = MdmsResponse.builder() + .mdmsRes(moduleMasterMap) + .build(); + return new ResponseEntity<>(mdmsResponse, HttpStatus.OK); + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/controller/MDMSControllerV2.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/controller/MDMSControllerV2.java new file mode 100644 index 00000000000..43f2edfd678 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/controller/MDMSControllerV2.java @@ -0,0 +1,61 @@ +package org.egov.infra.mdms.controller; + +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.service.MDMSServiceV2; +import org.egov.infra.mdms.utils.ResponseUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import jakarta.validation.Valid; +import java.util.List; + +@RestController +@Slf4j +@RequestMapping(value = "/v2") +public class MDMSControllerV2 { + + private MDMSServiceV2 mdmsServiceV2; + + @Autowired + public MDMSControllerV2(MDMSServiceV2 mdmsServiceV2) { + this.mdmsServiceV2 = mdmsServiceV2; + } + + /** + * Request handler for serving create requests + * @param mdmsRequest + * @param schemaCode + * @return + */ + @RequestMapping(value="_create/{schemaCode}", method = RequestMethod.POST) + public ResponseEntity create(@Valid @RequestBody MdmsRequest mdmsRequest, @PathVariable("schemaCode") String schemaCode) { + List masterDataList = mdmsServiceV2.create(mdmsRequest); + return new ResponseEntity<>(ResponseUtil.getMasterDataV2Response(mdmsRequest.getRequestInfo(), masterDataList), HttpStatus.ACCEPTED); + } + + /** + * Request handler for serving search requests + * @param masterDataSearchCriteria + * @return + */ + @RequestMapping(value="_search", method = RequestMethod.POST) + public ResponseEntity search(@Valid @RequestBody MdmsCriteriaReqV2 masterDataSearchCriteria) { + List masterDataList = mdmsServiceV2.search(masterDataSearchCriteria); + return new ResponseEntity<>(ResponseUtil.getMasterDataV2Response(RequestInfo.builder().build(), masterDataList), HttpStatus.OK); + } + + /** + * Request handler for serving update requests + * @param mdmsRequest + * @param schemaCode + * @return + */ + @RequestMapping(value="_update/{schemaCode}", method = RequestMethod.POST) + public ResponseEntity update(@Valid @RequestBody MdmsRequest mdmsRequest, @PathVariable("schemaCode") String schemaCode) { + List masterDataList = mdmsServiceV2.update(mdmsRequest); + return new ResponseEntity<>(ResponseUtil.getMasterDataV2Response(mdmsRequest.getRequestInfo(), masterDataList), HttpStatus.ACCEPTED); + } +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/controller/SchemaDefinitionController.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/controller/SchemaDefinitionController.java new file mode 100644 index 00000000000..c60f94c66a3 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/controller/SchemaDefinitionController.java @@ -0,0 +1,63 @@ +package org.egov.infra.mdms.controller; + + +import lombok.extern.slf4j.Slf4j; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.service.SchemaDefinitionService; +import org.egov.infra.mdms.utils.ResponseUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import jakarta.validation.Valid; +import java.util.List; + +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Controller +@RequestMapping("schema/v1") +@Slf4j +public class SchemaDefinitionController { + + private SchemaDefinitionService schemaDefinitionService; + + @Autowired + public SchemaDefinitionController(SchemaDefinitionService schemaDefinitionService) { + this.schemaDefinitionService = schemaDefinitionService; + } + + /** + * Request handler for serving schema create requests. + * @param schemaDefinitionRequest + * @return + */ + @RequestMapping(value = "_create", method = RequestMethod.POST) + public ResponseEntity create(@Valid @RequestBody SchemaDefinitionRequest schemaDefinitionRequest) { + List schemaDefinitions = schemaDefinitionService.create(schemaDefinitionRequest); + return new ResponseEntity<>(ResponseUtil.getSchemaDefinitionResponse(schemaDefinitionRequest.getRequestInfo(), schemaDefinitions), HttpStatus.ACCEPTED); + } + + /** + * Request handler for serving schema search requests. + * @param schemaDefinitionSearchRequest + * @return + */ + @RequestMapping(value = "_search", method = RequestMethod.POST) + public ResponseEntity search(@Valid @RequestBody SchemaDefSearchRequest schemaDefinitionSearchRequest) { + List schemaDefinitions = schemaDefinitionService.search(schemaDefinitionSearchRequest); + return new ResponseEntity<>(ResponseUtil.getSchemaDefinitionResponse(schemaDefinitionSearchRequest.getRequestInfo(), schemaDefinitions), HttpStatus.ACCEPTED); + } + + /** + * Request handler for serving schema update requests - NOT implemented as of now. + * @param schemaDefinitionUpdateRequest + * @return + */ + @RequestMapping(value = "_update", method = RequestMethod.POST) + public ResponseEntity update(@Valid @RequestBody SchemaDefinitionRequest schemaDefinitionUpdateRequest) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/errors/ErrorCodes.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/errors/ErrorCodes.java new file mode 100644 index 00000000000..1037b947730 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/errors/ErrorCodes.java @@ -0,0 +1,30 @@ +package org.egov.infra.mdms.errors; + +import org.springframework.stereotype.Component; + +@Component +public class ErrorCodes { + + public static final String DUPLICATE_SCHEMA_CODE = "DUPLICATE_SCHEMA_CODE"; + + public static final String DUPLICATE_SCHEMA_CODE_MSG = "Schema code already exists"; + + public static final String INVALID_REQUEST_JSON = "INVALID_REQUEST_JSON"; + + public static final String INVALID_JSON = "INVALID_JSON"; + + public static final String INVALID_JSON_MSG = "Failed to deserialize json"; + + public static final String REQUIRED_ATTRIBUTE_LIST_ERR_CODE = "REQUIRED_ATTRIBUTE_LIST_ERR"; + + public static final String REQUIRED_ATTRIBUTE_LIST_EMPTY_MSG = "Required attribute list cannot be empty"; + + public static final String UNIQUE_ATTRIBUTE_LIST_ERR_CODE = "UNIQUE_ATTRIBUTE_LIST_ERR"; + + public static final String UNIQUE_ATTRIBUTE_LIST_EMPTY_MSG = "Unique attribute list cannot be empty"; + + public static final String UNIQUE_ATTRIBUTE_LIST_INVALID_MSG = "Fields provided under unique fields must be a subset of required attributes list"; + + + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MasterDetail.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MasterDetail.java new file mode 100644 index 00000000000..67b4a3682bb --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MasterDetail.java @@ -0,0 +1,35 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +/** + * MasterDetail + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MasterDetail { + @JsonProperty("name") + @NotNull + + @Size(min = 1, max = 100) + private String name = null; + + @JsonProperty("filter") + + @Size(min = 1, max = 500) + private String filter = null; + + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/Mdms.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/Mdms.java new file mode 100644 index 00000000000..58c9577a80f --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/Mdms.java @@ -0,0 +1,58 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +/** + * Bind the request meta data(RequestInfo) and Schema defination + */ +@Schema(description = "Bind the request meta data(RequestInfo) and Schema defination") +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Mdms { + + @JsonProperty("id") + @Size(min = 2, max = 64) + private String id; + + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 128) + private String tenantId = null; + + @JsonProperty("schemaCode") + @NotNull + @Size(min = 2, max = 128) + private String schemaCode = null; + + @JsonProperty("uniqueIdentifier") + @Size(min = 1, max = 128) + private String uniqueIdentifier = null; + + @JsonProperty("data") + @NotNull + private JsonNode data = null; + + @JsonProperty("isActive") + private Boolean isActive = true; + + @JsonProperty("auditDetails") + @Valid + private AuditDetails auditDetails = null; + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteria.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteria.java new file mode 100644 index 00000000000..6e0716658c7 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteria.java @@ -0,0 +1,61 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * MdmsCriteria + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsCriteria { + @JsonProperty("tenantId") + @Size(min = 1, max = 100) + @NotNull + private String tenantId = null; + + @JsonProperty("ids") + private Set ids = null; + + @JsonProperty("uniqueIdentifier") + @Size(min = 1, max = 64) + private String uniqueIdentifier = null; + + @JsonProperty("moduleDetails") + @Valid + @NotNull + private List moduleDetails = null; + + @JsonIgnore + private Map schemaCodeFilterMap = null; + + @JsonIgnore + private Boolean isActive = Boolean.TRUE; + + + public MdmsCriteria addModuleDetailsItem(ModuleDetail moduleDetailsItem) { + if (this.moduleDetails == null) { + this.moduleDetails = new ArrayList<>(); + } + this.moduleDetails.add(moduleDetailsItem); + return this; + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReq.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReq.java new file mode 100644 index 00000000000..dc6786f6566 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReq.java @@ -0,0 +1,34 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; + +/** + * MdmsCriteriaReq + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsCriteriaReq { + @JsonProperty("RequestInfo") + + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("MdmsCriteria") + + @Valid + private MdmsCriteria mdmsCriteria = null; + + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReqV2.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReqV2.java new file mode 100644 index 00000000000..bb04aaa8082 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaReqV2.java @@ -0,0 +1,32 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; + +/** + * MdmsCriteriaReq + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsCriteriaReqV2 { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("MdmsCriteria") + @Valid + private MdmsCriteriaV2 mdmsCriteria = null; + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaV2.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaV2.java new file mode 100644 index 00000000000..428a39311ca --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsCriteriaV2.java @@ -0,0 +1,64 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * MdmsCriteria + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsCriteriaV2 { + + @JsonProperty("tenantId") + @Size(min = 1, max = 100) + @NotNull + private String tenantId = null; + + @JsonProperty("ids") + private Set ids = null; + + @JsonProperty("uniqueIdentifiers") + @Size(min = 1, max = 64) + private Set uniqueIdentifiers = null; + + @JsonProperty("schemaCode") + private String schemaCode = null; + + @JsonProperty("filters") + private Map filterMap = null; + + @JsonProperty("isActive") + private Boolean isActive = null; + + @JsonIgnore + private Map schemaCodeFilterMap = null; + + @JsonIgnore + private Set uniqueIdentifiersForRefVerification = null; + + @JsonProperty("offset") + private Integer offset; + + @JsonProperty("limit") + private Integer limit; + + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsDataRedisWrapper.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsDataRedisWrapper.java new file mode 100644 index 00000000000..0e67592d9ff --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsDataRedisWrapper.java @@ -0,0 +1,22 @@ +package org.egov.infra.mdms.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import net.minidev.json.JSONArray; +import org.springframework.validation.annotation.Validated; + +import java.util.Map; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsDataRedisWrapper { + + private String tenantSchemaCode; + + private Map schemaCodeData; +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsRequest.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsRequest.java new file mode 100644 index 00000000000..587a6b64cd3 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsRequest.java @@ -0,0 +1,40 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import java.util.Map; + +/** + * MdmsRequest + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsRequest { + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("Mdms") + @Valid + @NotNull + private Mdms mdms = null; + + /*@JsonProperty("Workflow") + + @Valid + private Workflow workflow = null;*/ + + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponse.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponse.java new file mode 100644 index 00000000000..538bfde9827 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponse.java @@ -0,0 +1,33 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import net.minidev.json.JSONArray; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import java.util.Map; + +/** + * MdmsResponse + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsResponse { + + @JsonProperty("ResponseInfo") + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("MdmsRes") + private Map> mdmsRes = null; + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponseV2.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponseV2.java new file mode 100644 index 00000000000..8f7ac8a4ca1 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsResponseV2.java @@ -0,0 +1,25 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.response.ResponseInfo; + +import jakarta.validation.Valid; +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsResponseV2 { + + @JsonProperty("ResponseInfo") + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("mdms") + private List mdms = null; +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsTenantMasterCriteria.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsTenantMasterCriteria.java new file mode 100644 index 00000000000..ee11473e303 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/MdmsTenantMasterCriteria.java @@ -0,0 +1,17 @@ +package org.egov.infra.mdms.model; + +import lombok.*; + +@Setter +@Getter +@ToString +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MdmsTenantMasterCriteria { + + private String tenantId; + + private String schemaCode; + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/ModuleDetail.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/ModuleDetail.java new file mode 100644 index 00000000000..ed20fb76179 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/ModuleDetail.java @@ -0,0 +1,43 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +/** + * ModuleDetail + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ModuleDetail { + @JsonProperty("moduleName") + @NotNull + + @Size(min = 1, max = 100) + private String moduleName = null; + + @JsonProperty("masterDetails") + @NotNull + @Valid + private List masterDetails = new ArrayList<>(); + + + public ModuleDetail addMasterDetailsItem(MasterDetail masterDetailsItem) { + this.masterDetails.add(masterDetailsItem); + return this; + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefCriteria.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefCriteria.java new file mode 100644 index 00000000000..2ea2148f1ea --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefCriteria.java @@ -0,0 +1,49 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +/** + * SchemaDefCriteria + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaDefCriteria { + + @JsonProperty("tenantId") + @Size(min = 1, max = 100) + @NotNull + private String tenantId = null; + + @JsonProperty("codes") + private List codes = null; + + @JsonProperty("offset") + private Integer offset; + + @JsonProperty("limit") + private Integer limit; + + + public SchemaDefCriteria addCodesItem(String codesItem) { + if (this.codes == null) { + this.codes = new ArrayList<>(); + } + this.codes.add(codesItem); + return this; + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefSearchRequest.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefSearchRequest.java new file mode 100644 index 00000000000..d722980be74 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefSearchRequest.java @@ -0,0 +1,35 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; + +/** + * Bind the request meta data(RequestInfo) and Schema defination + */ +@Schema(description = "Bind the request meta data(RequestInfo) and Schema defination") +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefSearchRequest { + @JsonProperty("RequestInfo") + @NotNull + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("SchemaDefCriteria") + @NotNull + @Valid + private SchemaDefCriteria schemaDefCriteria = null; + + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinition.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinition.java new file mode 100644 index 00000000000..adcfd9bcc78 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinition.java @@ -0,0 +1,58 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import java.io.Serializable; + +/** + * Bind the request meta data(RequestInfo) and Schema defination + */ +@Schema(description = "Bind the request meta data(RequestInfo) and Schema defination") +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefinition implements Serializable{ + + @JsonProperty("id") + @Size(min = 2, max = 128) + private String id = null; + + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 128) + private String tenantId = null; + + @JsonProperty("code") + @NotNull + @Size(min = 2, max = 128) + private String code = null; + + @JsonProperty("description") + + @Size(min = 2, max = 512) + private String description = null; + + @JsonProperty("definition") + @NotNull + private JsonNode definition = null; + + @JsonProperty("isActive") + private Boolean isActive = true; + + @JsonProperty("auditDetails") + @Valid + private AuditDetails auditDetails = null; + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionRequest.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionRequest.java new file mode 100644 index 00000000000..a58893fcb20 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionRequest.java @@ -0,0 +1,35 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; + +/** + * Bind the request meta data(RequestInfo) and Schema defination + */ +@Schema(description = "Bind the request meta data(RequestInfo) and Schema defination") +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefinitionRequest { + @JsonProperty("RequestInfo") + @NotNull + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("SchemaDefinition") + @NotNull + @Valid + private SchemaDefinition schemaDefinition = null; + + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionResponse.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionResponse.java new file mode 100644 index 00000000000..4f7f1afa4a7 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/model/SchemaDefinitionResponse.java @@ -0,0 +1,45 @@ +package org.egov.infra.mdms.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +/** + * Response from server + */ +@Schema(description = "Response from server") +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaDefinitionResponse { + @JsonProperty("ResponseInfo") + + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("SchemaDefinitions") + @Valid + private List schemaDefinitions = null; + + + public SchemaDefinitionResponse addSchemaDefinitionsItem(SchemaDefinition schemaDefinitionsItem) { + if (this.schemaDefinitions == null) { + this.schemaDefinitions = new ArrayList<>(); + } + this.schemaDefinitions.add(schemaDefinitionsItem); + return this; + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/producer/Producer.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/producer/Producer.java new file mode 100644 index 00000000000..9ea28d25c6c --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/producer/Producer.java @@ -0,0 +1,17 @@ +package org.egov.infra.mdms.producer; + +import org.egov.tracer.kafka.CustomKafkaTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class Producer { + + @Autowired + private CustomKafkaTemplate kafkaTemplate; + + public void push(String topic, Object value) { + kafkaTemplate.send(topic, value); + } + +} \ No newline at end of file diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/MdmsDataRepository.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/MdmsDataRepository.java new file mode 100644 index 00000000000..aebeb3aa9bf --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/MdmsDataRepository.java @@ -0,0 +1,19 @@ +package org.egov.infra.mdms.repository; + +import net.minidev.json.JSONArray; +import org.egov.infra.mdms.model.*; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +@Repository +public interface MdmsDataRepository { + public void create(MdmsRequest mdmsRequest); + + public void update(MdmsRequest mdmsRequest); + + public List searchV2(MdmsCriteriaV2 mdmsCriteriaV2); + + public Map> search(MdmsCriteria mdmsCriteria); +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/SchemaDefinitionRepository.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/SchemaDefinitionRepository.java new file mode 100644 index 00000000000..cf09ebd9fd7 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/SchemaDefinitionRepository.java @@ -0,0 +1,18 @@ +package org.egov.infra.mdms.repository; + +import org.egov.infra.mdms.model.SchemaDefCriteria; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.infra.mdms.model.SchemaDefinitionRequest; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface SchemaDefinitionRepository { + public void create(SchemaDefinitionRequest schemaDefinitionRequest); + + public void update(SchemaDefinitionRequest schemaDefinitionRequest); + + public List search(SchemaDefCriteria schemaDefCriteria); + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/impl/MdmsDataRepositoryImpl.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/impl/MdmsDataRepositoryImpl.java new file mode 100644 index 00000000000..ce126197922 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/impl/MdmsDataRepositoryImpl.java @@ -0,0 +1,90 @@ +package org.egov.infra.mdms.repository.impl; + +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.Mdms; +import org.egov.infra.mdms.model.MdmsCriteria; +import org.egov.infra.mdms.model.MdmsCriteriaV2; +import org.egov.infra.mdms.model.MdmsRequest; +import org.egov.infra.mdms.producer.Producer; +import org.egov.infra.mdms.repository.MdmsDataRepository; +import org.egov.infra.mdms.repository.querybuilder.MdmsDataQueryBuilder; +import org.egov.infra.mdms.repository.querybuilder.MdmsDataQueryBuilderV2; +import org.egov.infra.mdms.repository.rowmapper.MdmsDataRowMapper; +import org.egov.infra.mdms.repository.rowmapper.MdmsDataRowMapperV2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Repository +@Slf4j +public class MdmsDataRepositoryImpl implements MdmsDataRepository { + + private Producer producer; + private JdbcTemplate jdbcTemplate; + private ApplicationConfig applicationConfig; + private MdmsDataQueryBuilder mdmsDataQueryBuilder; + private MdmsDataQueryBuilderV2 mdmsDataQueryBuilderV2; + private MdmsDataRowMapperV2 mdmsDataRowMapperV2; + private MdmsDataRowMapper mdmsDataRowMapper; + + @Autowired + public MdmsDataRepositoryImpl(Producer producer, JdbcTemplate jdbcTemplate, + ApplicationConfig applicationConfig, MdmsDataQueryBuilder mdmsDataQueryBuilder, + MdmsDataRowMapperV2 mdmsDataRowMapperV2, + MdmsDataQueryBuilderV2 mdmsDataQueryBuilderV2, + MdmsDataRowMapper mdmsDataRowMapper) { + this.producer = producer; + this.jdbcTemplate = jdbcTemplate; + this.applicationConfig = applicationConfig; + this.mdmsDataQueryBuilder = mdmsDataQueryBuilder; + this.mdmsDataRowMapper = mdmsDataRowMapper; + this.mdmsDataRowMapperV2 = mdmsDataRowMapperV2; + this.mdmsDataQueryBuilderV2 = mdmsDataQueryBuilderV2; + } + + /** + * @param mdmsRequest + */ + @Override + public void create(MdmsRequest mdmsRequest) { + producer.push(applicationConfig.getSaveMdmsDataTopicName(), mdmsRequest); + } + + /** + * @param mdmsRequest + */ + @Override + public void update(MdmsRequest mdmsRequest) { + producer.push(applicationConfig.getUpdateMdmsDataTopicName(), mdmsRequest); + } + + /** + * @param mdmsCriteriaV2 + * @return + */ + @Override + public List searchV2(MdmsCriteriaV2 mdmsCriteriaV2) { + List preparedStmtList = new ArrayList<>(); + String query = mdmsDataQueryBuilderV2.getMdmsDataSearchQuery(mdmsCriteriaV2, preparedStmtList); + log.info(query); + return jdbcTemplate.query(query, preparedStmtList.toArray(), mdmsDataRowMapperV2); + } + + /** + * @param mdmsCriteria + * @return + */ + @Override + public Map> search(MdmsCriteria mdmsCriteria) { + List preparedStmtList = new ArrayList<>(); + String query = mdmsDataQueryBuilder.getMdmsDataSearchQuery(mdmsCriteria, preparedStmtList); + log.info(query); + return jdbcTemplate.query(query, preparedStmtList.toArray(), mdmsDataRowMapper); + } +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/impl/SchemaDefinitionDbRepositoryImpl.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/impl/SchemaDefinitionDbRepositoryImpl.java new file mode 100644 index 00000000000..a4f265f25af --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/impl/SchemaDefinitionDbRepositoryImpl.java @@ -0,0 +1,77 @@ +package org.egov.infra.mdms.repository.impl; + +import lombok.extern.slf4j.Slf4j; +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.SchemaDefCriteria; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.infra.mdms.model.SchemaDefinitionRequest; +import org.egov.infra.mdms.producer.Producer; +import org.egov.infra.mdms.repository.SchemaDefinitionRepository; +import org.egov.infra.mdms.repository.querybuilder.SchemaDefinitionQueryBuilder; +import org.egov.infra.mdms.repository.rowmapper.SchemaDefinitionRowMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; +import java.util.ArrayList; +import java.util.List; + +@Repository +@Slf4j +public class SchemaDefinitionDbRepositoryImpl implements SchemaDefinitionRepository { + + private Producer producer; + + private JdbcTemplate jdbcTemplate; + + private ApplicationConfig applicationConfig; + + private SchemaDefinitionQueryBuilder schemaDefinitionQueryBuilder; + + private SchemaDefinitionRowMapper rowMapper; + + @Autowired + public SchemaDefinitionDbRepositoryImpl(Producer producer, JdbcTemplate jdbcTemplate, + ApplicationConfig applicationConfig, SchemaDefinitionRowMapper rowMapper, SchemaDefinitionQueryBuilder schemaDefinitionQueryBuilder){ + this.producer = producer; + this.jdbcTemplate = jdbcTemplate; + this.applicationConfig = applicationConfig; + this.rowMapper = rowMapper; + this.schemaDefinitionQueryBuilder = schemaDefinitionQueryBuilder; + } + + + /** + * This method emits schema definition create request on kafka for async persistence + * @param schemaDefinitionRequest + */ + @Override + public void create(SchemaDefinitionRequest schemaDefinitionRequest) { + producer.push(applicationConfig.getSaveSchemaDefinitionTopicName(), schemaDefinitionRequest); + } + + /** + * This method queries the database and returns schema definition search response based on + * the provided criteria. + * @param schemaDefCriteria + */ + @Override + public List search(SchemaDefCriteria schemaDefCriteria) { + List preparedStatementList = new ArrayList<>(); + + // Invoke query builder to generate query based on the provided criteria + String query = schemaDefinitionQueryBuilder.getSchemaSearchQuery(schemaDefCriteria, preparedStatementList); + log.info("Schema definition search query: " + query); + + // Query the database to fetch schema definitions + return jdbcTemplate.query(query, preparedStatementList.toArray(), rowMapper); + } + + /** + * Skeleton method for update as update API has not been implemented + * @param schemaDefinitionRequest + */ + @Override + public void update(SchemaDefinitionRequest schemaDefinitionRequest) { + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilder.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilder.java new file mode 100644 index 00000000000..05c91a10690 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilder.java @@ -0,0 +1,66 @@ +package org.egov.infra.mdms.repository.querybuilder; + +import org.egov.infra.mdms.model.MdmsCriteria; +import org.egov.infra.mdms.utils.QueryUtil; +import org.springframework.stereotype.Component; + +import java.util.*; + +@Component +public class MdmsDataQueryBuilder { + + private static String SEARCH_MDMS_DATA_QUERY = "SELECT data.tenantid, data.uniqueidentifier, data.schemacode, data.data, data.isactive, data.createdby, data.lastmodifiedby, data.createdtime, data.lastmodifiedtime" + + " FROM eg_mdms_data data "; + + private static final String MDMS_DATA_QUERY_ORDER_BY_CLAUSE = " order by data.createdtime desc "; + + /** + * Method to handle request for fetching MDMS data search query + * @param mdmsCriteria + * @param preparedStmtList + * @return + */ + public String getMdmsDataSearchQuery(MdmsCriteria mdmsCriteria, List preparedStmtList) { + String query = buildQuery(mdmsCriteria, preparedStmtList); + query = QueryUtil.addOrderByClause(query, MDMS_DATA_QUERY_ORDER_BY_CLAUSE); + return query; + } + + /** + * Method to build query dynamically based on the criteria passed to the method + * @param mdmsCriteria + * @param preparedStmtList + * @return + */ + private String buildQuery(MdmsCriteria mdmsCriteria, List preparedStmtList) { + StringBuilder builder = new StringBuilder(SEARCH_MDMS_DATA_QUERY); + Map schemaCodeFilterMap = mdmsCriteria.getSchemaCodeFilterMap(); + if (!Objects.isNull(mdmsCriteria.getTenantId())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.tenantid LIKE ? "); + preparedStmtList.add(mdmsCriteria.getTenantId() + "%"); + } + if (!Objects.isNull(mdmsCriteria.getIds())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.id IN ( ").append(QueryUtil.createQuery(mdmsCriteria.getIds().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, mdmsCriteria.getIds()); + } + if (!Objects.isNull(mdmsCriteria.getUniqueIdentifier())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.uniqueidentifier = ? "); + preparedStmtList.add(mdmsCriteria.getUniqueIdentifier()); + } + if (!Objects.isNull(mdmsCriteria.getSchemaCodeFilterMap())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.schemacode IN ( ").append(QueryUtil.createQuery(schemaCodeFilterMap.keySet().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, schemaCodeFilterMap.keySet()); + } + if(!Objects.isNull(mdmsCriteria.getIsActive())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.isactive = ? "); + preparedStmtList.add(mdmsCriteria.getIsActive()); + } + return builder.toString(); + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilderV2.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilderV2.java new file mode 100644 index 00000000000..5985ba44883 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/MdmsDataQueryBuilderV2.java @@ -0,0 +1,104 @@ +package org.egov.infra.mdms.repository.querybuilder; + +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.MdmsCriteriaV2; +import org.egov.infra.mdms.utils.QueryUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; + +import java.util.*; + +@Component +public class MdmsDataQueryBuilderV2 { + + @Autowired + private ApplicationConfig config; + + private static final String SEARCH_MDMS_DATA_QUERY = "SELECT data.id, data.tenantid, data.uniqueidentifier, data.schemacode, data.data, data.isactive, data.createdby, data.lastmodifiedby, data.createdtime, data.lastmodifiedtime" + + " FROM eg_mdms_data data "; + + private static final String MDMS_DATA_QUERY_ORDER_BY_CLAUSE = " order by data.createdtime desc "; + + /** + * Method to handle request for fetching MDMS data search query + * @param mdmsCriteriaV2 + * @param preparedStmtList + * @return + */ + public String getMdmsDataSearchQuery(MdmsCriteriaV2 mdmsCriteriaV2, List preparedStmtList) { + String query = buildQuery(mdmsCriteriaV2, preparedStmtList); + query = QueryUtil.addOrderByClause(query, MDMS_DATA_QUERY_ORDER_BY_CLAUSE); + query = getPaginatedQuery(query, mdmsCriteriaV2, preparedStmtList); + return query; + } + + /** + * Method to build query dynamically based on the criteria passed to the method + * @param mdmsCriteriaV2 + * @param preparedStmtList + * @return + */ + private String buildQuery(MdmsCriteriaV2 mdmsCriteriaV2, List preparedStmtList) { + StringBuilder builder = new StringBuilder(SEARCH_MDMS_DATA_QUERY); + Map schemaCodeFilterMap = mdmsCriteriaV2.getSchemaCodeFilterMap(); + if (!Objects.isNull(mdmsCriteriaV2.getTenantId())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.tenantid = ? "); + preparedStmtList.add(mdmsCriteriaV2.getTenantId()); + } + if (!Objects.isNull(mdmsCriteriaV2.getIds())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.id IN ( ").append(QueryUtil.createQuery(mdmsCriteriaV2.getIds().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, mdmsCriteriaV2.getIds()); + } + if (!Objects.isNull(mdmsCriteriaV2.getUniqueIdentifiers())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.uniqueidentifier IN ( ").append(QueryUtil.createQuery(mdmsCriteriaV2.getUniqueIdentifiers().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, mdmsCriteriaV2.getUniqueIdentifiers()); + } + if (!Objects.isNull(mdmsCriteriaV2.getSchemaCodeFilterMap())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.schemacode IN ( ").append(QueryUtil.createQuery(schemaCodeFilterMap.keySet().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, schemaCodeFilterMap.keySet()); + } + if(!Objects.isNull(mdmsCriteriaV2.getSchemaCode())){ + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.schemacode = ? "); + preparedStmtList.add(mdmsCriteriaV2.getSchemaCode()); + } + if(!CollectionUtils.isEmpty(mdmsCriteriaV2.getFilterMap())){ + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.data @> CAST( ? AS jsonb )"); + String partialQueryJsonString = QueryUtil.preparePartialJsonStringFromFilterMap(mdmsCriteriaV2.getFilterMap()); + preparedStmtList.add(partialQueryJsonString); + } + if(!CollectionUtils.isEmpty(mdmsCriteriaV2.getUniqueIdentifiersForRefVerification())){ + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.uniqueidentifier IN ( ").append(QueryUtil.createQuery(mdmsCriteriaV2.getUniqueIdentifiersForRefVerification().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, mdmsCriteriaV2.getUniqueIdentifiersForRefVerification()); + } + if(!Objects.isNull(mdmsCriteriaV2.getIsActive())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" data.isactive = ? "); + preparedStmtList.add(mdmsCriteriaV2.getIsActive()); + } + return builder.toString(); + } + + private String getPaginatedQuery(String query, MdmsCriteriaV2 mdmsCriteriaV2, List preparedStmtList) { + StringBuilder paginatedQuery = new StringBuilder(query); + + // Append offset + paginatedQuery.append(" OFFSET ? "); + preparedStmtList.add(ObjectUtils.isEmpty(mdmsCriteriaV2.getOffset()) ? config.getDefaultOffset() : mdmsCriteriaV2.getOffset()); + + // Append limit + paginatedQuery.append(" LIMIT ? "); + preparedStmtList.add(ObjectUtils.isEmpty(mdmsCriteriaV2.getLimit()) ? config.getDefaultLimit() : mdmsCriteriaV2.getLimit()); + + return paginatedQuery.toString(); + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/SchemaDefinitionQueryBuilder.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/SchemaDefinitionQueryBuilder.java new file mode 100644 index 00000000000..43e29366ba4 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/querybuilder/SchemaDefinitionQueryBuilder.java @@ -0,0 +1,74 @@ +package org.egov.infra.mdms.repository.querybuilder; + +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.SchemaDefCriteria; +import org.egov.infra.mdms.utils.QueryUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +import java.util.*; + +@Component +public class SchemaDefinitionQueryBuilder { + + @Autowired + private ApplicationConfig config; + + private static final String SEARCH_SCHEMA_DEF_QUERY = "SELECT schema.id,schema.tenantid, schema.code, schema.description, schema.definition, schema.isactive, " + + "schema.createdby, schema.lastmodifiedby, schema.createdtime, schema.lastmodifiedtime FROM " + + "eg_mdms_schema_definition schema "; + + private static final String SEARCH_SCHEMA_DEF_ORDER_BY_CLAUSE = " order by schema.createdtime desc "; + + /** + * Method to handle request for fetching schema search query + * @param schemaDefCriteria + * @param preparedStmtList + * @return + */ + public String getSchemaSearchQuery(SchemaDefCriteria schemaDefCriteria, List preparedStmtList) { + String query = buildQuery(schemaDefCriteria, preparedStmtList); + query = QueryUtil.addOrderByClause(query, SEARCH_SCHEMA_DEF_ORDER_BY_CLAUSE); + query = getPaginatedQuery(query, schemaDefCriteria, preparedStmtList); + return query; + } + + /** + * Method to build query dynamically based on the criteria passed to the method + * @param schemaDefCriteria + * @param preparedStmtList + * @return + */ + private String buildQuery(SchemaDefCriteria schemaDefCriteria, List preparedStmtList) { + StringBuilder builder = new StringBuilder(SchemaDefinitionQueryBuilder.SEARCH_SCHEMA_DEF_QUERY); + + if (!Objects.isNull(schemaDefCriteria.getTenantId())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" schema.tenantid = ? "); + preparedStmtList.add(schemaDefCriteria.getTenantId()); + } + if (!Objects.isNull(schemaDefCriteria.getCodes())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" schema.code IN ( ").append(QueryUtil.createQuery(schemaDefCriteria.getCodes().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, new HashSet<>(schemaDefCriteria.getCodes())); + } + + return builder.toString(); + } + + private String getPaginatedQuery(String query, SchemaDefCriteria schemaDefCriteria, List preparedStmtList) { + StringBuilder paginatedQuery = new StringBuilder(query); + + // Append offset + paginatedQuery.append(" OFFSET ? "); + preparedStmtList.add(ObjectUtils.isEmpty(schemaDefCriteria.getOffset()) ? config.getDefaultOffset() : schemaDefCriteria.getOffset()); + + // Append limit + paginatedQuery.append(" LIMIT ? "); + preparedStmtList.add(ObjectUtils.isEmpty(schemaDefCriteria.getLimit()) ? config.getDefaultLimit() : schemaDefCriteria.getLimit()); + + return paginatedQuery.toString(); + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapper.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapper.java new file mode 100644 index 00000000000..d5829ac662a --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapper.java @@ -0,0 +1,70 @@ +package org.egov.infra.mdms.repository.rowmapper; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; +import org.egov.common.contract.models.AuditDetails; +import org.egov.infra.mdms.model.Mdms; +import org.egov.infra.mdms.model.SchemaDefinition; +import static org.egov.infra.mdms.errors.ErrorCodes.*; +import org.egov.tracer.model.CustomException; +import org.postgresql.util.PGobject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.*; + +import static java.util.Objects.isNull; + +@Component +@Slf4j +public class MdmsDataRowMapper implements ResultSetExtractor>> { + + @Autowired + private ObjectMapper objectMapper; + + /** + * This method accepts a resultSet and extracts master data in JSONArray format + * and creates a map of schemaCode vs master data + * @param resultSet + * @return + * @throws SQLException + * @throws DataAccessException + */ + @Override + public Map> extractData(ResultSet resultSet) throws SQLException, DataAccessException { + Map> tenantMasterMap = new HashMap<>(); + + while(resultSet.next()){ + JSONArray jsonArray = null; + Map masterMap = new HashMap<>(); + LinkedHashMap data = null; + if( ! isNull(resultSet.getObject("data"))){ + String dataStr = ((PGobject) resultSet.getObject("data")).getValue(); + try { + data = objectMapper.readValue(dataStr, LinkedHashMap.class); + } catch (IOException e) { + throw new CustomException(INVALID_JSON, INVALID_JSON_MSG); + } + } + String schemaCode = resultSet.getString("schemacode"); + String tenantId = resultSet.getString("tenantid"); + jsonArray = tenantMasterMap.getOrDefault(tenantId, new HashMap<>()).getOrDefault(schemaCode, new JSONArray()); + jsonArray.add(data); + masterMap.put(schemaCode, jsonArray); + if(tenantMasterMap.containsKey(tenantId)) { + tenantMasterMap.get(tenantId).put(schemaCode, jsonArray); + } else { + tenantMasterMap.put(tenantId, masterMap); + } + } + + return tenantMasterMap; + } +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapperV2.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapperV2.java new file mode 100644 index 00000000000..c1a4d355d2e --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/MdmsDataRowMapperV2.java @@ -0,0 +1,75 @@ +package org.egov.infra.mdms.repository.rowmapper; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.models.AuditDetails; +import org.egov.infra.mdms.model.Mdms; +import org.egov.tracer.model.CustomException; +import org.postgresql.util.PGobject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import static java.util.Objects.isNull; +import static org.egov.infra.mdms.errors.ErrorCodes.INVALID_JSON; +import static org.egov.infra.mdms.errors.ErrorCodes.INVALID_JSON_MSG; + +@Component +@Slf4j +public class MdmsDataRowMapperV2 implements ResultSetExtractor> { + + @Autowired + private ObjectMapper objectMapper; + + /** + * This method accepts resultSet from the executed search query and extracts data out + * of the result set and maps it into master data POJO + * @param resultSet + * @return + * @throws SQLException + * @throws DataAccessException + */ + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + + List mdmsList = new ArrayList<>(); + + while (resultSet.next()) { + AuditDetails auditDetails = AuditDetails.builder().createdBy(resultSet.getString("createdby")). + createdTime(resultSet.getLong("createdtime")). + lastModifiedBy(resultSet.getString("lastmodifiedby")). + lastModifiedTime(resultSet.getLong("lastmodifiedtime")).build(); + + JsonNode data = null; + if (!isNull(resultSet.getObject("data"))) { + String dataStr = ((PGobject) resultSet.getObject("data")).getValue(); + try { + data = objectMapper.readTree(dataStr); + } catch (IOException e) { + throw new CustomException(INVALID_JSON, INVALID_JSON_MSG); + } + } + + Mdms mdms = Mdms.builder() + .id(resultSet.getString("id")) + .tenantId(resultSet.getString("tenantid")) + .schemaCode(resultSet.getString("schemacode")) + .uniqueIdentifier(resultSet.getString("uniqueidentifier")) + .data(data) + .isActive(resultSet.getBoolean("isactive")) + .auditDetails(auditDetails).build(); + + mdmsList.add(mdms); + } + + return mdmsList; + } +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/SchemaDefinitionRowMapper.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/SchemaDefinitionRowMapper.java new file mode 100644 index 00000000000..b2a3f947c7f --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/repository/rowmapper/SchemaDefinitionRowMapper.java @@ -0,0 +1,78 @@ +package org.egov.infra.mdms.repository.rowmapper; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.common.contract.models.AuditDetails; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.tracer.model.CustomException; +import org.postgresql.util.PGobject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@Component +public class SchemaDefinitionRowMapper implements ResultSetExtractor> { + + @Autowired + private ObjectMapper objectMapper; + + /** + * This method accepts resultSet from query execution, extracts the respective fields + * and maps it into SchemaDefinition POJO. + * @param resultSet + * @return + * @throws SQLException + * @throws DataAccessException + */ + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + List schemaDefinitions = new ArrayList<>(); + while(resultSet.next()){ + + AuditDetails auditDetails = AuditDetails.builder().createdBy(resultSet.getString("createdby")). + createdTime(resultSet.getLong("createdtime")). + lastModifiedBy(resultSet.getString("lastmodifiedby")). + lastModifiedTime(resultSet.getLong("lastmodifiedtime")).build(); + + SchemaDefinition schemaDefinition = SchemaDefinition.builder() + .tenantId(resultSet.getString("tenantid")) + .id(resultSet.getString("id")) + .code(resultSet.getString("code")) + .description(resultSet.getString("description")) + .definition(getJsonValue((PGobject) resultSet.getObject("definition"))) + .isActive(resultSet.getBoolean("isactive")) + .auditDetails(auditDetails) + .build(); + + schemaDefinitions.add(schemaDefinition); + } + + return schemaDefinitions; + } + + /** + * This method accepts a PGobject and converts it into JsonNode. + * @param pGobject + * @return + */ + private JsonNode getJsonValue(PGobject pGobject) { + try { + if (Objects.isNull(pGobject) || Objects.isNull(pGobject.getValue())) + return null; + else + return objectMapper.readTree(pGobject.getValue()); + } catch (IOException e) { + throw new CustomException("SERVER_ERROR", "Exception occurred while parsing the additionalDetail json : " + e + .getMessage()); + } + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/MDMSService.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/MDMSService.java new file mode 100644 index 00000000000..227e8f629b2 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/MDMSService.java @@ -0,0 +1,150 @@ +package org.egov.infra.mdms.service; + +import java.util.*; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.jayway.jsonpath.JsonPath; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.MdmsDataRepository; +import org.egov.infra.mdms.service.enrichment.MdmsDataEnricher; +import org.egov.infra.mdms.service.validator.MdmsDataValidator; +import org.egov.infra.mdms.utils.FallbackUtil; +import org.egov.infra.mdms.utils.SchemaUtil; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; +import org.springframework.util.ObjectUtils; + +import static org.egov.infra.mdms.utils.MDMSConstants.*; + +@Service +@Slf4j +public class MDMSService { + + private MdmsDataValidator mdmsDataValidator; + + private MdmsDataEnricher mdmsDataEnricher; + + private MdmsDataRepository mdmsDataRepository; + + private SchemaUtil schemaUtil; + + private MultiStateInstanceUtil multiStateInstanceUtil; + + @Autowired + public MDMSService(MdmsDataValidator mdmsDataValidator, MdmsDataEnricher mdmsDataEnricher, + MdmsDataRepository mdmsDataRepository, SchemaUtil schemaUtil, MultiStateInstanceUtil multiStateInstanceUtil) { + this.mdmsDataValidator = mdmsDataValidator; + this.mdmsDataEnricher = mdmsDataEnricher; + this.mdmsDataRepository = mdmsDataRepository; + this.schemaUtil = schemaUtil; + this.multiStateInstanceUtil = multiStateInstanceUtil; + } + + /** + * This method processes the requests that come for master data creation. + * @param mdmsRequest + * @return + */ + public List create(MdmsRequest mdmsRequest) { + + // Fetch schema against which data is getting created + JSONObject schemaObject = schemaUtil.getSchema(mdmsRequest); + + // Validate incoming request + mdmsDataValidator.validateCreateRequest(mdmsRequest, schemaObject); + + // Enrich incoming request + mdmsDataEnricher.enrichCreateRequest(mdmsRequest, schemaObject); + + // Emit mdms creation request event + mdmsDataRepository.create(mdmsRequest); + + return Arrays.asList(mdmsRequest.getMdms()); + } + + /** + * This method processes the requests that come for master data search. + * @param mdmsCriteriaReq + * @return + */ + public Map> search(MdmsCriteriaReq mdmsCriteriaReq) { + Map> tenantMasterMap = new HashMap<>(); + + /* + * Set incoming tenantId as state level tenantId for fallback in case master data for + * concrete tenantId does not exist. + */ + String tenantId = new StringBuilder(mdmsCriteriaReq.getMdmsCriteria().getTenantId()).toString(); + mdmsCriteriaReq.getMdmsCriteria().setTenantId(multiStateInstanceUtil.getStateLevelTenant(tenantId)); + + Map schemaCodes = getSchemaCodes(mdmsCriteriaReq.getMdmsCriteria()); + mdmsCriteriaReq.getMdmsCriteria().setSchemaCodeFilterMap(schemaCodes); + + // Make a call to the repository layer to fetch data as per given criteria + tenantMasterMap = mdmsDataRepository.search(mdmsCriteriaReq.getMdmsCriteria()); + + // Apply filters to incoming data + tenantMasterMap = applyFilterToData(tenantMasterMap, mdmsCriteriaReq.getMdmsCriteria().getSchemaCodeFilterMap()); + + // Perform fallback + Map masterDataMap = FallbackUtil.backTrackTenantMasterDataMap(tenantMasterMap, tenantId); + + // Return response in MDMS v1 search response format for backward compatibility + return getModuleMasterMap(masterDataMap); + } + + private Map> applyFilterToData(Map> tenantMasterMap, Map schemaCodeFilterMap) { + Map> tenantMasterMapPostFiltering = new HashMap<>(); + + tenantMasterMap.keySet().forEach(tenantId -> { + Map schemaCodeVsFilteredMasters = new HashMap<>(); + tenantMasterMap.get(tenantId).keySet().forEach(schemaCode -> { + JSONArray masters = tenantMasterMap.get(tenantId).get(schemaCode); + if(!ObjectUtils.isEmpty(schemaCodeFilterMap.get(schemaCode))) { + schemaCodeVsFilteredMasters.put(schemaCode, filterMasters(masters, schemaCodeFilterMap.get(schemaCode))); + } else { + schemaCodeVsFilteredMasters.put(schemaCode, masters); + } + }); + tenantMasterMapPostFiltering.put(tenantId, schemaCodeVsFilteredMasters); + }); + + return tenantMasterMapPostFiltering; + } + + private JSONArray filterMasters(JSONArray masters, String filterExp) { + JSONArray filteredMasters = JsonPath.read(masters, filterExp); + return filteredMasters; + } + + private Map> getModuleMasterMap(Map masterMap) { + Map> moduleMasterMap = new HashMap<>(); + + for (Map.Entry entry : masterMap.entrySet()) { + String[] moduleMaster = entry.getKey().split(DOT_REGEX); + String moduleName = moduleMaster[0]; + String masterName = moduleMaster[1]; + + moduleMasterMap.computeIfAbsent(moduleName, k -> new HashMap<>()) + .put(masterName, entry.getValue()); + } + return moduleMasterMap; + } + + private Map getSchemaCodes(MdmsCriteria mdmsCriteria) { + Map schemaCodesFilterMap = new HashMap<>(); + for (ModuleDetail moduleDetail : mdmsCriteria.getModuleDetails()) { + for (MasterDetail masterDetail : moduleDetail.getMasterDetails()) { + String key = moduleDetail.getModuleName().concat(DOT_SEPARATOR).concat(masterDetail.getName()); + String value = masterDetail.getFilter(); + schemaCodesFilterMap.put(key, value); + } + } + return schemaCodesFilterMap; + } +} \ No newline at end of file diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/MDMSServiceV2.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/MDMSServiceV2.java new file mode 100644 index 00000000000..4c77ec4ee4c --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/MDMSServiceV2.java @@ -0,0 +1,116 @@ +package org.egov.infra.mdms.service; + +import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.MdmsDataRepository; +import org.egov.infra.mdms.service.enrichment.MdmsDataEnricher; +import org.egov.infra.mdms.service.validator.MdmsDataValidator; +import org.egov.infra.mdms.utils.FallbackUtil; +import org.egov.infra.mdms.utils.SchemaUtil; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +@Slf4j +@Service +public class MDMSServiceV2 { + + private MdmsDataValidator mdmsDataValidator; + + private MdmsDataEnricher mdmsDataEnricher; + + private MdmsDataRepository mdmsDataRepository; + + private SchemaUtil schemaUtil; + + private MultiStateInstanceUtil multiStateInstanceUtil; + + @Autowired + public MDMSServiceV2(MdmsDataValidator mdmsDataValidator, MdmsDataEnricher mdmsDataEnricher, + MdmsDataRepository mdmsDataRepository, SchemaUtil schemaUtil, MultiStateInstanceUtil multiStateInstanceUtil) { + this.mdmsDataValidator = mdmsDataValidator; + this.mdmsDataEnricher = mdmsDataEnricher; + this.mdmsDataRepository = mdmsDataRepository; + this.schemaUtil = schemaUtil; + this.multiStateInstanceUtil = multiStateInstanceUtil; + } + + /** + * This method processes the requests that come for master data creation. + * @param mdmsRequest + * @return + */ + public List create(MdmsRequest mdmsRequest) { + + // Fetch schema against which data is getting created + JSONObject schemaObject = schemaUtil.getSchema(mdmsRequest); + + // Perform validations on incoming request + mdmsDataValidator.validateCreateRequest(mdmsRequest, schemaObject); + + // Enrich incoming master data + mdmsDataEnricher.enrichCreateRequest(mdmsRequest, schemaObject); + + // Emit MDMS create event to be listened by persister + mdmsDataRepository.create(mdmsRequest); + + return Arrays.asList(mdmsRequest.getMdms()); + } + + /** + * This method processes the requests that come for master data search. + * @param mdmsCriteriaReqV2 + * @return + */ + public List search(MdmsCriteriaReqV2 mdmsCriteriaReqV2) { + + /* + * Set incoming tenantId as state level tenantId for fallback in case master data for + * concrete tenantId does not exist. + */ + String tenantId = mdmsCriteriaReqV2.getMdmsCriteria().getTenantId(); + + List masterDataList = new ArrayList<>(); + List subTenantListForFallback = FallbackUtil.getSubTenantListForFallBack(tenantId); + + // Make a call to repository and get list of master data + for(String subTenantId : subTenantListForFallback) { + mdmsCriteriaReqV2.getMdmsCriteria().setTenantId(subTenantId); + masterDataList = mdmsDataRepository.searchV2(mdmsCriteriaReqV2.getMdmsCriteria()); + + if(!CollectionUtils.isEmpty(masterDataList)) + break; + } + + return masterDataList; + } + + /** + * This method processes the requests that come for master data update. + * @param mdmsRequest + * @return + */ + public List update(MdmsRequest mdmsRequest) { + + // Fetch schema against which data is getting created + JSONObject schemaObject = schemaUtil.getSchema(mdmsRequest); + + // Validate master data update request + mdmsDataValidator.validateUpdateRequest(mdmsRequest, schemaObject); + + // Enrich master data update request + mdmsDataEnricher.enrichUpdateRequest(mdmsRequest); + + // Emit MDMS update event to be listened by persister + mdmsDataRepository.update(mdmsRequest); + + return Arrays.asList(mdmsRequest.getMdms()); + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/SchemaDefinitionService.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/SchemaDefinitionService.java new file mode 100644 index 00000000000..dbde2ff784e --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/SchemaDefinitionService.java @@ -0,0 +1,78 @@ +package org.egov.infra.mdms.service; + +import lombok.Builder; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.infra.mdms.config.ApplicationConfig; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.SchemaDefinitionRepository; +import org.egov.infra.mdms.service.enrichment.SchemaDefinitionEnricher; +import org.egov.infra.mdms.service.validator.SchemaDefinitionValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; + +@Service +@Builder +@Slf4j +public class SchemaDefinitionService { + + private SchemaDefinitionRepository schemaDefinitionRepository; + private ApplicationConfig applicationConfig; + private SchemaDefinitionEnricher schemaDefinitionEnricher; + private SchemaDefinitionValidator schemaDefinitionValidator; + private MultiStateInstanceUtil multiStateInstanceUtil; + + @Autowired + public SchemaDefinitionService(SchemaDefinitionRepository schemaDefinitionRepository, ApplicationConfig applicationConfig, + SchemaDefinitionEnricher schemaDefinitionEnricher, SchemaDefinitionValidator schemaDefinitionValidator, MultiStateInstanceUtil multiStateInstanceUtil){ + this.schemaDefinitionRepository = schemaDefinitionRepository; + this.applicationConfig = applicationConfig; + this.schemaDefinitionEnricher = schemaDefinitionEnricher; + this.schemaDefinitionValidator = schemaDefinitionValidator; + this.multiStateInstanceUtil = multiStateInstanceUtil; + } + + /** + * This method processes requests for schema definition creation. + * @param schemaDefinitionRequest + * @return + */ + public List create(SchemaDefinitionRequest schemaDefinitionRequest) { + + // Set incoming tenantId as state level tenantId as schema is always created at state level + String tenantId = schemaDefinitionRequest.getSchemaDefinition().getTenantId(); + schemaDefinitionRequest.getSchemaDefinition().setTenantId(multiStateInstanceUtil.getStateLevelTenant(tenantId)); + + // Validate schema create request + schemaDefinitionValidator.validateCreateRequest(schemaDefinitionRequest); + + // Enrich schema create request + schemaDefinitionEnricher.enrichCreateRequest(schemaDefinitionRequest); + + // Invoke repository method to emit schema creation event + schemaDefinitionRepository.create(schemaDefinitionRequest); + + return Arrays.asList(schemaDefinitionRequest.getSchemaDefinition()); + } + + /** + * This method processes the requests for schema definition search. + * @param schemaDefSearchRequest + * @return + */ + public List search(SchemaDefSearchRequest schemaDefSearchRequest) { + + // Set incoming tenantId as state level tenantId as schema is created at state level + String tenantId = schemaDefSearchRequest.getSchemaDefCriteria().getTenantId(); + schemaDefSearchRequest.getSchemaDefCriteria().setTenantId(multiStateInstanceUtil.getStateLevelTenant(tenantId)); + + // Fetch schema definitions based on the given criteria + List schemaDefinitions = schemaDefinitionRepository.search(schemaDefSearchRequest.getSchemaDefCriteria()); + + return schemaDefinitions; + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/enrichment/MdmsDataEnricher.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/enrichment/MdmsDataEnricher.java new file mode 100644 index 00000000000..bc20d3a8924 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/enrichment/MdmsDataEnricher.java @@ -0,0 +1,50 @@ +package org.egov.infra.mdms.service.enrichment; + +import org.egov.common.contract.models.AuditDetails; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.egov.common.utils.UUIDEnrichmentUtil; +import org.egov.infra.mdms.model.Mdms; +import org.egov.infra.mdms.model.MdmsRequest; +import org.egov.infra.mdms.utils.CompositeUniqueIdentifierGenerationUtil; +import org.egov.tracer.model.CustomException; +import org.json.JSONObject; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +@Component +public class MdmsDataEnricher { + + public void enrichCreateRequest(MdmsRequest mdmsRequest, JSONObject schemaObject) { + Mdms mdms = mdmsRequest.getMdms(); + UUIDEnrichmentUtil.enrichRandomUuid(mdms, "id"); + mdms.setAuditDetails(AuditDetailsEnrichmentUtil.prepareAuditDetails(mdms.getAuditDetails(), mdmsRequest.getRequestInfo(), Boolean.TRUE)); + mdms.setUniqueIdentifier(CompositeUniqueIdentifierGenerationUtil.getUniqueIdentifier(schemaObject, mdmsRequest)); + } + + public AuditDetails getAuditDetails(RequestInfo requestInfo, AuditDetails auditDetails, Boolean isCreateRequest) { + if(isCreateRequest) { + auditDetails = AuditDetails.builder().createdBy(requestInfo.getUserInfo().getUuid()). + createdTime(System.currentTimeMillis()).lastModifiedBy(requestInfo.getUserInfo().getUuid()). + lastModifiedTime(System.currentTimeMillis()).build(); + } else { + if(auditDetails != null) { + auditDetails = AuditDetails.builder().createdBy(auditDetails.getCreatedBy()). + createdTime(auditDetails.getCreatedTime()).lastModifiedBy(requestInfo.getUserInfo().getUuid()). + lastModifiedTime(System.currentTimeMillis()).build(); + } else { + throw new CustomException("AUDIT_DETAILS_NULL_FOR_UPDATE_REQ","Audit details can not be null for update request"); + } + } + return auditDetails; + } + + public void enrichUpdateRequest(MdmsRequest mdmsRequest) { + Mdms mdms = mdmsRequest.getMdms(); + + if(ObjectUtils.isEmpty(mdms.getAuditDetails())) + throw new CustomException("AUDIT_DETAILS_ABSENT_ERR", "Audit details cannot be absent for update request"); + + mdms.setAuditDetails(getAuditDetails(mdmsRequest.getRequestInfo(), mdms.getAuditDetails(), Boolean.FALSE)); + } +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/enrichment/SchemaDefinitionEnricher.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/enrichment/SchemaDefinitionEnricher.java new file mode 100644 index 00000000000..9d2c12dd9cd --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/enrichment/SchemaDefinitionEnricher.java @@ -0,0 +1,48 @@ +package org.egov.infra.mdms.service.enrichment; + +import org.egov.common.contract.models.AuditDetails; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.egov.common.utils.UUIDEnrichmentUtil; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.infra.mdms.model.SchemaDefinitionRequest; +import org.egov.tracer.model.CustomException; +import org.springframework.stereotype.Component; + +import java.util.UUID; + +@Component +public class SchemaDefinitionEnricher { + + /** + * This method enriches schemaDefinitionRequest + * @param schemaDefinitionRequest + */ + public void enrichCreateRequest(SchemaDefinitionRequest schemaDefinitionRequest) { + SchemaDefinition schemaDefinition = schemaDefinitionRequest.getSchemaDefinition(); + + // Invoke enrichment of uuid on id field of schemaDefinition + UUIDEnrichmentUtil.enrichRandomUuid(schemaDefinition, "id"); + + // Populate auditDetails + schemaDefinition.setAuditDetails(getAuditDetail(schemaDefinitionRequest.getRequestInfo(),schemaDefinition.getAuditDetails(), true)); + } + + public AuditDetails getAuditDetail(RequestInfo requestInfo, AuditDetails auditDetails, Boolean isCreateRequest) { + if(isCreateRequest) { + auditDetails = AuditDetails.builder().createdBy(requestInfo.getUserInfo().getUuid()). + createdTime(System.currentTimeMillis()).lastModifiedBy(requestInfo.getUserInfo().getUuid()). + lastModifiedTime(System.currentTimeMillis()).build(); + } else { + if(auditDetails != null ) { + auditDetails = AuditDetails.builder().createdBy(auditDetails.getCreatedBy()). + createdTime(auditDetails.getCreatedTime()).lastModifiedBy(requestInfo.getUserInfo().getUuid()). + lastModifiedTime(System.currentTimeMillis()).build(); + } else { + throw new CustomException("AUDIT_DETAILS_NULL_FOR_UPDATE_REQ","Audit details can not be null for update request"); + } + } + return auditDetails; + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/validator/MdmsDataValidator.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/validator/MdmsDataValidator.java new file mode 100644 index 00000000000..5b909f7a5a5 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/validator/MdmsDataValidator.java @@ -0,0 +1,257 @@ +package org.egov.infra.mdms.service.validator; + +import com.fasterxml.jackson.databind.JsonNode; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.TypeRef; +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.MdmsDataRepository; +import org.egov.infra.mdms.service.SchemaDefinitionService; +import org.egov.infra.mdms.utils.CompositeUniqueIdentifierGenerationUtil; +import org.egov.infra.mdms.utils.ErrorUtil; +import org.egov.infra.mdms.utils.FallbackUtil; +import org.egov.tracer.model.CustomException; +import org.everit.json.schema.Schema; +import org.everit.json.schema.ValidationException; +import org.everit.json.schema.loader.SchemaLoader; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.StreamSupport; + +import static org.egov.infra.mdms.utils.MDMSConstants.*; + +@Component +@Slf4j +public class MdmsDataValidator { + + private final SchemaDefinitionService schemaDefinitionService; + + private final MdmsDataRepository mdmsDataRepository; + + @Autowired + public MdmsDataValidator(SchemaDefinitionService schemaDefinitionService, MdmsDataRepository mdmsDataRepository) { + this.schemaDefinitionService = schemaDefinitionService; + this.mdmsDataRepository = mdmsDataRepository; + } + + /** + * This method performs business validations on create master data request. + * @param mdmsRequest + * @param schemaObject + */ + public void validateCreateRequest(MdmsRequest mdmsRequest, JSONObject schemaObject) { + // Initialize error map and fetch schema + Map errors = new HashMap<>(); + + // Validations are performed here on the incoming data + validateDataWithSchemaDefinition(mdmsRequest, schemaObject, errors); + checkDuplicate(schemaObject, mdmsRequest); + validateReference(schemaObject, mdmsRequest.getMdms()); + + // Throw validation errors + ErrorUtil.throwCustomExceptions(errors); + } + + /** + * This method validates the incoming master data against the schema for which the master + * data is being created and populates violations(if any) in errors map. + * @param mdmsRequest + * @param schemaObject + * @param errors + */ + private void validateDataWithSchemaDefinition(MdmsRequest mdmsRequest, JSONObject schemaObject,Map errors) { + try { + // Load incoming master data as a json object + JSONObject dataObject = new JSONObject(mdmsRequest.getMdms().getData().toString()); + + // Load schema + Schema schema = SchemaLoader.load(schemaObject); + + // Validate data against the schema + schema.validate(dataObject); + } catch (ValidationException e) { + // Populate errors map for all the validation errors + Integer count = 0; + if (!e.getCausingExceptions().isEmpty()) { + for (ValidationException validationException : e.getCausingExceptions()) { + ++count; + errors.put("INVALID_REQUEST_".concat(validationException.getKeyword().toUpperCase()).concat(count.toString()), validationException.getErrorMessage()); + } + } else { + errors.put("INVALID_REQUEST", e.getErrorMessage()); + } + } catch (Exception e) { + throw new CustomException("MASTER_DATA_VALIDATION_ERR", "An unknown error occurred while validating provided master data against the schema - " + e.getMessage()); + } + } + + /** + * This method checks whether the master data which is being created already + * exists in the database or not. + * @param schemaObject + * @param mdmsRequest + */ + private void checkDuplicate(JSONObject schemaObject, MdmsRequest mdmsRequest) { + // Get the uniqueIdentifier for the incoming master data request + String uniqueIdentifier = CompositeUniqueIdentifierGenerationUtil.getUniqueIdentifier(schemaObject, mdmsRequest); + + // Fetch master data + List masterData = fetchMasterData(MdmsCriteriaV2.builder() + .tenantId(mdmsRequest.getMdms().getTenantId()) + .uniqueIdentifiers(Collections.singleton(uniqueIdentifier)) + .schemaCode(mdmsRequest.getMdms().getSchemaCode()) + .isActive(Boolean.TRUE) + .build()); + + // Throw error if the provided master data already exists + if (masterData != null && masterData.size() != 0) { + throw new CustomException("DUPLICATE_RECORD", "Duplicate record"); + } + + } + + /** + * This method fetches master data from the database depending on the criteria + * being passed. + * @param mdmsCriteria + * @return + */ + private List fetchMasterData(MdmsCriteriaV2 mdmsCriteria) { + // Make a call to the repository to check if the provided master data already exists + List moduleMasterData = mdmsDataRepository.searchV2(mdmsCriteria); + + return moduleMasterData; + + } + + /** + * This method validates whether the provided reference exists in the database. + * @param schemaObject + * @param mdms + */ + private void validateReference(JSONObject schemaObject, Mdms mdms) { + if (schemaObject.has(X_REFERENCE_SCHEMA_KEY)) { + org.json.JSONArray referenceSchema = (org.json.JSONArray) schemaObject.get(X_REFERENCE_SCHEMA_KEY); + + if (referenceSchema != null && referenceSchema.length() > 0) { + JsonNode mdmsData = mdms.getData(); + + IntStream.range(0, referenceSchema.length()).forEach(i -> { + Set uniqueIdentifiersForRefVerification = new HashSet<>(); + + JSONObject jsonObject = referenceSchema.getJSONObject(i); + String refFieldPath = jsonObject.getString(FIELD_PATH_KEY); + String schemaCode = jsonObject.getString(SCHEMA_CODE_KEY); + Object refResult = JsonPath.read(mdmsData.toString(), CompositeUniqueIdentifierGenerationUtil.getJsonPathExpressionFromDotSeparatedPath(refFieldPath)); + + addTypeCastedUniqueIdentifiersToVerificationSet(refResult, uniqueIdentifiersForRefVerification); + List subTenantListForFallback = FallbackUtil.getSubTenantListForFallBack(mdms.getTenantId()); + + Boolean isRefDataFound = Boolean.FALSE; + + for(String subTenant : subTenantListForFallback) { + List moduleMasterData = mdmsDataRepository.searchV2( + MdmsCriteriaV2.builder() + .tenantId(subTenant) + .uniqueIdentifiersForRefVerification(uniqueIdentifiersForRefVerification) + .isActive(Boolean.TRUE) + .schemaCode(schemaCode) + .build()); + + if (moduleMasterData.size() == uniqueIdentifiersForRefVerification.size()) { + isRefDataFound = Boolean.TRUE; + break; + } + } + + if(!isRefDataFound) { + throw new CustomException("REFERENCE_VALIDATION_ERR", "Provided reference value does not exist in database"); + } + + }); + } + } + } + + /** + * This method takes the reference object provided in the data create request, type casts it into String + * and adds it to the uniqueIdentifiers set for performing search. + * @param refResult + * @param uniqueIdentifiersForRefVerification + */ + private void addTypeCastedUniqueIdentifiersToVerificationSet(Object refResult, Set uniqueIdentifiersForRefVerification) { + if (refResult instanceof String) { + uniqueIdentifiersForRefVerification.add((String) refResult); + } else if(refResult instanceof Number){ + uniqueIdentifiersForRefVerification.add(String.valueOf(refResult)); + } else if (refResult instanceof List) { + uniqueIdentifiersForRefVerification.addAll((Collection) refResult); + } else { + throw new CustomException("REFERENCE_VALIDATION_ERR", "Reference must only be of the type string, number or a list of strings/numbers"); + } + } + + /** + * This method performs business validations on create master data request. + * @param mdmsRequest + * @param schemaObject + */ + public void validateUpdateRequest(MdmsRequest mdmsRequest, JSONObject schemaObject) { + // Initialize error map and fetch schema + Map errors = new HashMap<>(); + + // Validations are performed here on the incoming data + String uniqueIdentifierOfExistingRecord = fetchUniqueIdentifier(mdmsRequest); + validateIfUniqueFieldsAreNotBeingUpdated(uniqueIdentifierOfExistingRecord, CompositeUniqueIdentifierGenerationUtil.getUniqueIdentifier(schemaObject, mdmsRequest)); + validateDataWithSchemaDefinition(mdmsRequest, schemaObject, errors); + validateReference(schemaObject, mdmsRequest.getMdms()); + + // Throw validation errors + ErrorUtil.throwCustomExceptions(errors); + + } + + /** + * This method validates if any fields defined under unique field list are being updated. + * @param uniqueIdentifierOfExistingRecord + * @param uniqueIdentifier + */ + private void validateIfUniqueFieldsAreNotBeingUpdated(String uniqueIdentifierOfExistingRecord, String uniqueIdentifier) { + if(!uniqueIdentifierOfExistingRecord.equalsIgnoreCase(uniqueIdentifier)) { + throw new CustomException("UNIQUE_KEY_UPDATE_ERR", "Updating fields defined as unique is not allowed."); + } + } + + /** + * This method checks if the master that is being created already exists or not. + * @param mdmsRequest + * @return + */ + private String fetchUniqueIdentifier(MdmsRequest mdmsRequest) { + if(ObjectUtils.isEmpty(mdmsRequest.getMdms().getId())) + throw new CustomException("MASTER_DATA_ID_ABSENT_ERR", "Providing master data id is mandatory for update operation."); + + Set idForSearch = new HashSet<>(); + idForSearch.add(mdmsRequest.getMdms().getId()); + + // Fetch master data from database + List masterData = fetchMasterData(MdmsCriteriaV2.builder() + .tenantId(mdmsRequest.getMdms().getTenantId()) + .ids(idForSearch) + .build()); + + // Throw error if the provided master data does not exist + if (masterData == null || masterData.size() == 0) { + throw new CustomException("MASTER_DATA_NOT_FOUND", "Master data not found for update operation."); + } // Return unique identifier if the master data exists + else { + return masterData.get(0).getUniqueIdentifier(); + } + } +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/validator/SchemaDefinitionValidator.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/validator/SchemaDefinitionValidator.java new file mode 100644 index 00000000000..c7fa9c8e44a --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/service/validator/SchemaDefinitionValidator.java @@ -0,0 +1,99 @@ +package org.egov.infra.mdms.service.validator; + +import com.fasterxml.jackson.databind.JsonNode; +import org.egov.common.contract.request.RequestInfo; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.repository.SchemaDefinitionRepository; +import static org.egov.infra.mdms.errors.ErrorCodes.*; +import static org.egov.infra.mdms.utils.MDMSConstants.*; +import org.egov.infra.mdms.utils.ErrorUtil; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import java.util.*; + +@Component +public class SchemaDefinitionValidator { + + private SchemaDefinitionRepository schemaDefinitionRepository; + + @Autowired + public SchemaDefinitionValidator(SchemaDefinitionRepository schemaDefinitionRepository) { + this.schemaDefinitionRepository = schemaDefinitionRepository; + } + + /** + * This method performs business validations on schemaDefinitionRequest. + * @param schemaDefinitionRequest + */ + public void validateCreateRequest(SchemaDefinitionRequest schemaDefinitionRequest) { + + SchemaDefinition schemaDefinition = schemaDefinitionRequest.getSchemaDefinition(); + Map errors = new HashMap<>(); + + // Validate schema attributes + validateSchemaAttributes(schemaDefinition.getDefinition(), errors); + + // Check schema code uniqueness + checkSchemaCode(schemaDefinition.getTenantId(), Arrays.asList(schemaDefinition.getCode()), errors); + + // Throw errors if any + ErrorUtil.throwCustomExceptions(errors); + } + + /** + * This method performs validations on the schema definition attributes namely - + * 1. validate that required fields list is not empty + * 2. validate that unique fields list is not empty + * 3. validate that list of unique attributes is a subset of list of required attributes + * @param definition + * @param errorMap + */ + private void validateSchemaAttributes(JsonNode definition, Map errorMap) { + JSONObject schemaObject = new JSONObject(definition.toString()); + + // Check if the incoming schema definition has "required" key and at least one value against it + if(!schemaObject.has(REQUIRED_KEY) || ((org.json.JSONArray) schemaObject.get(REQUIRED_KEY)).length() == 0){ + errorMap.put(REQUIRED_ATTRIBUTE_LIST_ERR_CODE, REQUIRED_ATTRIBUTE_LIST_EMPTY_MSG); + } + + // Check if the incoming schema definition has "x-unique" key and at least one value against it + if(!schemaObject.has(X_UNIQUE_KEY) || ((org.json.JSONArray) schemaObject.get(X_UNIQUE_KEY)).length() == 0) { + errorMap.put(UNIQUE_ATTRIBUTE_LIST_ERR_CODE, UNIQUE_ATTRIBUTE_LIST_EMPTY_MSG); + } + + // Perform further validations iff both "required" and "x-unique" keys are present + if(CollectionUtils.isEmpty(errorMap)) { + List requiredAttributesList = ((org.json.JSONArray) schemaObject.get(REQUIRED_KEY)).toList(); + + List uniqueAttributesList = ((org.json.JSONArray) schemaObject.get(X_UNIQUE_KEY)).toList(); + + // Check if values against unique attributes are a subset of required fields + if (uniqueAttributesList.size() > requiredAttributesList.size() || !requiredAttributesList.containsAll(uniqueAttributesList)) { + errorMap.put(UNIQUE_ATTRIBUTE_LIST_ERR_CODE, UNIQUE_ATTRIBUTE_LIST_INVALID_MSG); + } + } + } + + /** + * This method checks whether a schema definition with the provided tenantId and code already exists. + * @param tenantId + * @param codes + * @param errorMap + */ + private void checkSchemaCode(String tenantId, List codes, Map errorMap) { + + // Build schema definition search criteria + SchemaDefCriteria schemaDefCriteria = SchemaDefCriteria.builder().tenantId(tenantId).codes(codes).build(); + + // Search for schema definitions with the incoming tenantId and codes + List schemaDefinitions = schemaDefinitionRepository.search(schemaDefCriteria); + + // If schema definition already exists for tenantId and code combination, populate error map + if(!schemaDefinitions.isEmpty()){ + errorMap.put(DUPLICATE_SCHEMA_CODE, DUPLICATE_SCHEMA_CODE_MSG); + } + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/CompositeUniqueIdentifierGenerationUtil.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/CompositeUniqueIdentifierGenerationUtil.java new file mode 100644 index 00000000000..cad46a2f946 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/CompositeUniqueIdentifierGenerationUtil.java @@ -0,0 +1,65 @@ +package org.egov.infra.mdms.utils; + +import com.fasterxml.jackson.databind.JsonNode; +import org.egov.infra.mdms.model.MdmsRequest; +import org.egov.tracer.model.CustomException; +import org.json.JSONObject; +import org.springframework.util.StringUtils; + +import java.util.stream.IntStream; +import static org.egov.infra.mdms.utils.MDMSConstants.*; + +public class CompositeUniqueIdentifierGenerationUtil { + + private CompositeUniqueIdentifierGenerationUtil(){} + + /** + * This method creates composite unique identifier based on the attributes provided + * in x-unique-key param. + * @param schemaObject + * @param mdmsRequest + * @return + */ + public static String getUniqueIdentifier(JSONObject schemaObject, MdmsRequest mdmsRequest) { + org.json.JSONArray uniqueFieldPaths = (org.json.JSONArray) schemaObject.get(X_UNIQUE_KEY); + + JsonNode data = mdmsRequest.getMdms().getData(); + StringBuilder compositeUniqueIdentifier = new StringBuilder(); + + // Build composite unique identifier + IntStream.range(0, uniqueFieldPaths.length()).forEach(i -> { + String uniqueIdentifierChunk = data.at(getJsonPointerExpressionFromDotSeparatedPath(uniqueFieldPaths.getString(i))).asText(); + + // Throw error in case value against unique identifier is empty + if(StringUtils.isEmpty(uniqueIdentifierChunk)) { + throw new CustomException("UNIQUE_IDENTIFIER_EMPTY_ERR", "Values defined against unique fields cannot be empty."); + } + + compositeUniqueIdentifier.append(uniqueIdentifierChunk); + + if (i != (uniqueFieldPaths.length() - 1)) + compositeUniqueIdentifier.append(DOT_SEPARATOR); + }); + + return compositeUniqueIdentifier.toString(); + } + + /** + * This method creates a JSON pointer expression from dot separated path. + * @param dotSeparatedPath + * @return + */ + public static String getJsonPointerExpressionFromDotSeparatedPath(String dotSeparatedPath) { + return FORWARD_SLASH + dotSeparatedPath.replaceAll(DOT_REGEX, FORWARD_SLASH); + } + + /** + * This method creates JSON path expression from dot separated path. + * @param dotSeparatedPath + * @return + */ + public static String getJsonPathExpressionFromDotSeparatedPath(String dotSeparatedPath) { + return DOLLAR_DOT + dotSeparatedPath; + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/ErrorUtil.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/ErrorUtil.java new file mode 100644 index 00000000000..f10d45503ae --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/ErrorUtil.java @@ -0,0 +1,21 @@ +package org.egov.infra.mdms.utils; + +import org.egov.tracer.model.CustomException; + +import java.util.Map; + +public class ErrorUtil { + + private ErrorUtil(){} + + /** + * This method throws custom exception for a map of exceptions + * @param exceptions + */ + public static void throwCustomExceptions(Map exceptions) { + if (!exceptions.isEmpty()) { + throw new CustomException(exceptions); + } + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/FallbackUtil.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/FallbackUtil.java new file mode 100644 index 00000000000..f3f0d69bb30 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/FallbackUtil.java @@ -0,0 +1,71 @@ +package org.egov.infra.mdms.utils; + +import net.minidev.json.JSONArray; +import org.egov.infra.mdms.model.Mdms; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.egov.infra.mdms.utils.MDMSConstants.DOT_SEPARATOR; + +public class FallbackUtil { + + private FallbackUtil() {} + + public static List getSubTenantListForFallBack(String tenantId) { + List subTenantList = new ArrayList<>(); + + subTenantList.add(tenantId); + + while(tenantId.contains(DOT_SEPARATOR)){ + tenantId = tenantId.substring(0, tenantId.lastIndexOf(DOT_SEPARATOR)); + subTenantList.add(tenantId); + } + + return subTenantList; + } + + public static Map backTrackTenantMasterDataMap(Map> tenantMasterMap, String tenantId) { + List subTenantListForFallback = FallbackUtil.getSubTenantListForFallBack(tenantId); + Map masterDataPostFallBack = new HashMap<>(); + for (String subTenant : subTenantListForFallback) { + if(tenantMasterMap.containsKey(subTenant)) { + for (Map.Entry entry : tenantMasterMap.get(subTenant).entrySet()) { + String schemaCode = entry.getKey(); + if(!masterDataPostFallBack.containsKey(schemaCode)) { + masterDataPostFallBack.put(schemaCode, entry.getValue()); + } + } + } + } + + return masterDataPostFallBack; + } + + public static List backTrackTenantMasterDataList(List masterDataList, String tenantId) { + List masterDataListAfterFallback = new ArrayList<>(); + List subTenantListForFallback = FallbackUtil.getSubTenantListForFallBack(tenantId); + + Map> schemaMasterMap = masterDataList.parallelStream().collect(Collectors.groupingBy(Mdms::getSchemaCode)); + + Map>> schemaGroupedTenantMasterMap = new HashMap<>(); + schemaMasterMap.keySet().forEach(schemaCode -> { + Map> tenantMasterMap = schemaMasterMap.get(schemaCode).stream().collect(Collectors.groupingBy(Mdms::getTenantId)); + schemaGroupedTenantMasterMap.put(schemaCode, tenantMasterMap); + }); + + for (String schemaCode : schemaGroupedTenantMasterMap.keySet()) { + Map> tenantMasterMap = schemaGroupedTenantMasterMap.get(schemaCode); + + for (String subTenant : subTenantListForFallback) { + if (tenantMasterMap.containsKey(subTenant)) + masterDataListAfterFallback.addAll(tenantMasterMap.get(subTenant)); + } + } + + return masterDataListAfterFallback; + } +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/MDMSConstants.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/MDMSConstants.java new file mode 100644 index 00000000000..3e58074fc76 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/MDMSConstants.java @@ -0,0 +1,19 @@ +package org.egov.infra.mdms.utils; + +import org.springframework.stereotype.Component; + + +@Component +public class MDMSConstants { + + public static final String X_UNIQUE_KEY = "x-unique"; + public static final String X_REFERENCE_SCHEMA_KEY = "x-ref-schema"; + public static final String REQUIRED_KEY = "required"; + public static final String DOT_SEPARATOR = "."; + public static final String DOT_REGEX = "\\."; + public static final String FORWARD_SLASH = "/"; + public static final String DOLLAR_DOT = "$."; + public static final String FIELD_PATH_KEY = "fieldPath"; + public static final String SCHEMA_CODE_KEY = "schemaCode"; + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/QueryUtil.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/QueryUtil.java new file mode 100644 index 00000000000..7d06cd8e68d --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/QueryUtil.java @@ -0,0 +1,124 @@ +package org.egov.infra.mdms.utils; + +import com.google.gson.Gson; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.IntStream; + +import static org.egov.infra.mdms.utils.MDMSConstants.*; + +public class QueryUtil { + + private QueryUtil(){} + + private static final Gson gson = new Gson(); + + /** + * This method aids in adding "WHERE" clause and "AND" condition depending on preparedStatementList i.e., + * if preparedStatementList is empty, it will understand that it is the first clause being added so it + * will add "WHERE" to the query and otherwise it will + * @param query + * @param preparedStmtList + */ + public static void addClauseIfRequired(StringBuilder query, List preparedStmtList){ + if(preparedStmtList.isEmpty()){ + query.append(" WHERE "); + }else{ + query.append(" AND "); + } + } + + /** + * This method returns a string with placeholders equal to the number of values that need to be put inside + * "IN" clause + * @param size + * @return + */ + public static String createQuery(Integer size) { + StringBuilder builder = new StringBuilder(); + + IntStream.range(0, size).forEach(i -> { + builder.append(" ?"); + if (i != size - 1) + builder.append(","); + }); + + return builder.toString(); + } + + /** + * This method adds a set of String values into preparedStatementList + * @param preparedStmtList + * @param ids + */ + public static void addToPreparedStatement(List preparedStmtList, Set ids) { + ids.forEach(id -> { + preparedStmtList.add(id); + }); + } + + /** + * This method appends order by clause to the query + * @param query + * @param orderByClause + * @return + */ + public static String addOrderByClause(String query, String orderByClause){ + return query + orderByClause; + } + + /** + * This method prepares partial json string from the filter map to query on jsonb column + * @param filterMap + * @return + */ + public static String preparePartialJsonStringFromFilterMap(Map filterMap) { + Map queryMap = new HashMap<>(); + + filterMap.keySet().forEach(key -> { + if(key.contains(DOT_SEPARATOR)){ + String[] keyArray = key.split(DOT_REGEX); + Map nestedQueryMap = new HashMap<>(); + prepareNestedQueryMap(0, keyArray, nestedQueryMap, filterMap.get(key)); + queryMap.put(keyArray[0], nestedQueryMap.get(keyArray[0])); + } else{ + queryMap.put(key, filterMap.get(key)); + } + }); + + String partialJsonQueryString = gson.toJson(queryMap); + + return partialJsonQueryString; + } + + /** + * Tail recursive method to prepare n-level nested partial json for queries on nested data in + * master data. For e.g. , if the key is in the format a.b.c, it will construct a nested json + * object of the form - {"a":{"b":{"c": "value"}}} + * @param index + * @param nestedKeyArray + * @param currentQueryMap + * @param value + */ + private static void prepareNestedQueryMap(int index, String[] nestedKeyArray, Map currentQueryMap, String value) { + // Return when all levels have been reached. + if(index == nestedKeyArray.length) + return; + + // For the final level simply put the value in the map. + else if (index == nestedKeyArray.length - 1) { + currentQueryMap.put(nestedKeyArray[index], value); + return; + } + + // For non terminal levels, add a child map. + currentQueryMap.put(nestedKeyArray[index], new HashMap<>()); + + // Make a recursive call to enrich data in next level. + prepareNestedQueryMap(index + 1, nestedKeyArray, (Map) currentQueryMap.get(nestedKeyArray[index]), value); + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/ResponseUtil.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/ResponseUtil.java new file mode 100644 index 00000000000..5a662882310 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/ResponseUtil.java @@ -0,0 +1,29 @@ +package org.egov.infra.mdms.utils; + +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.egov.common.utils.ResponseInfoUtil; +import org.egov.infra.mdms.model.Mdms; +import org.egov.infra.mdms.model.MdmsResponseV2; +import org.egov.infra.mdms.model.SchemaDefinition; +import org.egov.infra.mdms.model.SchemaDefinitionResponse; + +import java.util.List; + +public class ResponseUtil { + + private ResponseUtil(){} + + public static SchemaDefinitionResponse getSchemaDefinitionResponse(RequestInfo requestInfo , List schemaDefinitions){ + ResponseInfo responseInfo = ResponseInfoUtil.createResponseInfoFromRequestInfo(requestInfo, Boolean.TRUE); + SchemaDefinitionResponse schemaDefinitionResponse = SchemaDefinitionResponse.builder().schemaDefinitions(schemaDefinitions).responseInfo(responseInfo).build(); + return schemaDefinitionResponse; + } + + public static MdmsResponseV2 getMasterDataV2Response(RequestInfo requestInfo, List masterDataList){ + ResponseInfo responseInfo = ResponseInfoUtil.createResponseInfoFromRequestInfo(requestInfo, Boolean.TRUE); + MdmsResponseV2 response = MdmsResponseV2.builder().mdms(masterDataList).responseInfo(responseInfo).build(); + return response; + } + +} diff --git a/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/SchemaUtil.java b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/SchemaUtil.java new file mode 100644 index 00000000000..80a8294c389 --- /dev/null +++ b/core-services/MDMS-v2/src/main/java/org/egov/infra/mdms/utils/SchemaUtil.java @@ -0,0 +1,52 @@ +package org.egov.infra.mdms.utils; + +import lombok.extern.slf4j.Slf4j; +import org.egov.infra.mdms.model.*; +import org.egov.infra.mdms.service.SchemaDefinitionService; +import org.egov.tracer.model.CustomException; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.Arrays; +import java.util.List; + +@Component +@Slf4j +public class SchemaUtil { + + private SchemaDefinitionService schemaDefinitionService; + + @Autowired + public SchemaUtil(SchemaDefinitionService schemaDefinitionService){ + this.schemaDefinitionService = schemaDefinitionService; + } + + /** + * This method fetches the schema definition object for the master data being created. + * @param mdmsRequest + * @return + */ + public JSONObject getSchema(MdmsRequest mdmsRequest) { + + Mdms mdms = mdmsRequest.getMdms(); + + SchemaDefCriteria schemaDefCriteria = SchemaDefCriteria.builder() + .tenantId(mdms.getTenantId()) + .codes(Arrays.asList(mdms.getSchemaCode())) + .build(); + + List schemaDefinitions = schemaDefinitionService.search(SchemaDefSearchRequest.builder() + .requestInfo(mdmsRequest.getRequestInfo()) + .schemaDefCriteria(schemaDefCriteria).build()); + + if(CollectionUtils.isEmpty(schemaDefinitions)) + throw new CustomException("SCHEMA_DEFINITION_NOT_FOUND_ERR", "Schema definition against which data is being created is not found"); + + JSONObject schemaObject = new JSONObject(schemaDefinitions.get(0).getDefinition().toString()); + + return schemaObject; + } + +} diff --git a/core-services/MDMS-v2/src/main/resources/application.properties b/core-services/MDMS-v2/src/main/resources/application.properties new file mode 100644 index 00000000000..acdf13b0d6c --- /dev/null +++ b/core-services/MDMS-v2/src/main/resources/application.properties @@ -0,0 +1,41 @@ +server.port=8094 + +server.context-path=/mdms-v2 +server.servlet.context-path=/mdms-v2 +management.endpoints.web.base-path=/ +app.timezone=UTC + +#DATABASE CONFIGURATION +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/postgres +spring.datasource.username=postgres +spring.datasource.password=postgres + +#FLYWAY CONFIGURATION +spring.flyway.url=jdbc:postgresql://localhost:5432/postgres +spring.flyway.user=postgres +spring.flyway.password=postgres +spring.flyway.table=public +spring.flyway.baseline-on-migrate=true +spring.flyway.outOfOrder=true +spring.flyway.locations=classpath:/db/migration/main +spring.flyway.enabled=false + +# KAFKA SERVER CONFIGURATIONS +kafka.config.bootstrap_server_config=localhost:9092 +spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.group-id=mdms +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.listener.missing-topics-fatal=false +spring.kafka.consumer.properties.spring.json.use.type.headers=false + +# TOPICS +egov.mdms.schema.definition.save.topic=save-mdms-schema-definition +egov.mdms.data.save.topic=save-mdms-data +egov.mdms.data.update.topic=update-mdms-data +mdms.default.offset=0 +mdms.default.limit=10 + +logging.level.org.springframework.aop=DEBUG \ No newline at end of file diff --git a/core-services/MDMS-v2/src/main/resources/db/Dockerfile b/core-services/MDMS-v2/src/main/resources/db/Dockerfile new file mode 100644 index 00000000000..f38638a269f --- /dev/null +++ b/core-services/MDMS-v2/src/main/resources/db/Dockerfile @@ -0,0 +1,9 @@ +FROM egovio/flyway:10.7.1 + +COPY ./migration/main /flyway/sql + +COPY migrate.sh /usr/bin/migrate.sh + +RUN chmod +x /usr/bin/migrate.sh + +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/MDMS-v2/src/main/resources/db/migrate.sh b/core-services/MDMS-v2/src/main/resources/db/migrate.sh new file mode 100644 index 00000000000..f9d6617822c --- /dev/null +++ b/core-services/MDMS-v2/src/main/resources/db/migrate.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate diff --git a/core-services/MDMS-v2/src/main/resources/db/migration/main/V20230531114515__schema_definition_ddl.sql b/core-services/MDMS-v2/src/main/resources/db/migration/main/V20230531114515__schema_definition_ddl.sql new file mode 100644 index 00000000000..95eeef0306d --- /dev/null +++ b/core-services/MDMS-v2/src/main/resources/db/migration/main/V20230531114515__schema_definition_ddl.sql @@ -0,0 +1,13 @@ +CREATE TABLE eg_mdms_schema_definition ( + id VARCHAR(64) NOT NULL, + tenantid VARCHAR(255) NOT NULL, + code VARCHAR(255) NOT NULL, + description VARCHAR(512), + definition JSONB NOT NULL, + isactive BOOLEAN NOT NULL, + createdBy character varying(64), + lastModifiedBy character varying(64), + createdTime bigint, + lastModifiedTime bigint, + CONSTRAINT pk_eg_schema_definition PRIMARY KEY (tenantId,code) +); diff --git a/core-services/MDMS-v2/src/main/resources/db/migration/main/V20230531144020__mdms_data_create_ddl.sql b/core-services/MDMS-v2/src/main/resources/db/migration/main/V20230531144020__mdms_data_create_ddl.sql new file mode 100644 index 00000000000..191ee9e0259 --- /dev/null +++ b/core-services/MDMS-v2/src/main/resources/db/migration/main/V20230531144020__mdms_data_create_ddl.sql @@ -0,0 +1,14 @@ +CREATE TABLE eg_mdms_data ( + id VARCHAR(64) NOT NULL, + tenantid VARCHAR(255) NOT NULL, + uniqueidentifier VARCHAR(255), + schemacode VARCHAR(255) NOT NULL, + data JSONB NOT NULL, + isactive BOOLEAN NOT NULL, + createdBy character varying(64), + lastModifiedBy character varying(64), + createdTime bigint, + lastModifiedTime bigint, + CONSTRAINT pk_eg_mdms_data PRIMARY KEY (tenantId,schemacode,uniqueidentifier), + CONSTRAINT uk_eg_mdms_data UNIQUE(id) +); diff --git a/core-services/MDMS-v2/src/main/resources/mdms-persister.yml b/core-services/MDMS-v2/src/main/resources/mdms-persister.yml new file mode 100644 index 00000000000..6771da75718 --- /dev/null +++ b/core-services/MDMS-v2/src/main/resources/mdms-persister.yml @@ -0,0 +1,63 @@ +serviceMaps: + serviceName: Mdms-Service + mappings: + - version: 1.0 + description: Persists the schema definition + fromTopic: save-mdms-schema-definition + isTransaction: true + queryMaps: + - query: INSERT INTO eg_mdms_schema_definition (id ,tenantid, code, description, definition, isactive, createdby, lastmodifiedby, createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + basePath: $.SchemaDefinition + jsonMaps: + - jsonPath: $.SchemaDefinition.id + + - jsonPath: $.SchemaDefinition.tenantId + + - jsonPath: $.SchemaDefinition.code + + - jsonPath: $.SchemaDefinition.description + + - jsonPath: $.SchemaDefinition.definition + type: JSON + dbType: JSONB + + - jsonPath: $.SchemaDefinition.isActive + + - jsonPath: $.SchemaDefinition.auditDetails.createdBy + + - jsonPath: $.SchemaDefinition.auditDetails.lastModifiedBy + + - jsonPath: $.SchemaDefinition.auditDetails.createdTime + + - jsonPath: $.SchemaDefinition.auditDetails.lastModifiedTime + + + - version: 1.0 + description: Persists the mdms data + fromTopic: save-mdms-data + isTransaction: true + queryMaps: + - query: INSERT INTO eg_mdms_data (tenantid, uniqueidentifier, schemacode, data, isactive, createdby, lastmodifiedby, createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?); + basePath: $.Mdms + jsonMaps: + - jsonPath: $.Mdms.tenantId + + - jsonPath: $.Mdms.uniqueIdentifier + + - jsonPath: $.Mdms.schemaCode + + - jsonPath: $.Mdms.data + type: JSON + dbType: JSONB + + - jsonPath: $.Mdms.isActive + + - jsonPath: $.Mdms.auditDetails.createdBy + + - jsonPath: $.Mdms.auditDetails.lastModifiedBy + + - jsonPath: $.Mdms.auditDetails.createdTime + + - jsonPath: $.Mdms.auditDetails.lastModifiedTime + + diff --git a/core-services/audit-service/CHANGELOG.md b/core-services/audit-service/CHANGELOG.md index c1617786e42..f10c76e7716 100644 --- a/core-services/audit-service/CHANGELOG.md +++ b/core-services/audit-service/CHANGELOG.md @@ -1,5 +1,7 @@ -Changelog +# Changelog All notable changes to this module will be documented in this file. -1.0.0 -Base version \ No newline at end of file +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.6.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version from 42.2.2.jre7 to 42.7.1 diff --git a/core-services/audit-service/pom.xml b/core-services/audit-service/pom.xml index c8345c79ba9..200cd21886a 100644 --- a/core-services/audit-service/pom.xml +++ b/core-services/audit-service/pom.xml @@ -5,22 +5,25 @@ org.springframework.boot spring-boot-starter-parent - 2.2.6.RELEASE - + 3.2.2 org.egov audit-service - 1.0.0-SNAPSHOT + 2.9.0-SNAPSHOT audit-service Service to handle audit logs - 1.8 + 17 org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-jdbc @@ -35,20 +38,21 @@ spring-boot-starter-test test - - org.egov.services - services-common - 1.0.1-SNAPSHOT - commons-io commons-io 2.6 + + + net.minidev + json-smart + 2.5.0 + org.egov.services tracer - 2.1.1-SNAPSHOT + 2.9.0-SNAPSHOT org.bouncycastle @@ -58,16 +62,17 @@ org.egov mdms-client - 0.0.2-SNAPSHOT + 2.9.0-SNAPSHOT org.flywaydb flyway-core + 9.22.3 org.postgresql postgresql - 42.2.2.jre7 + 42.7.1 com.github.zafarkhaja @@ -94,14 +99,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/config/AuditServiceConfiguration.java b/core-services/audit-service/src/main/java/org/egov/auditservice/config/AuditServiceConfiguration.java index ff3b6ae5f5a..3895b0329b2 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/config/AuditServiceConfiguration.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/config/AuditServiceConfiguration.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import jakarta.annotation.PostConstruct; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -13,7 +14,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; import java.util.TimeZone; @Component diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/persisterauditclient/PersisterConfigInit.java b/core-services/audit-service/src/main/java/org/egov/auditservice/persisterauditclient/PersisterConfigInit.java index 74199777923..09a38323f75 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/persisterauditclient/PersisterConfigInit.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/persisterauditclient/PersisterConfigInit.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.egov.auditservice.persisterauditclient.models.contract.Mapping; @@ -18,7 +19,6 @@ import org.springframework.core.io.ResourceLoader; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; import java.io.File; import java.io.IOException; import java.io.InputStream; diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/persisterauditclient/utils/AuditUtil.java b/core-services/audit-service/src/main/java/org/egov/auditservice/persisterauditclient/utils/AuditUtil.java index 7ea220096ba..dc4b57c88a5 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/persisterauditclient/utils/AuditUtil.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/persisterauditclient/utils/AuditUtil.java @@ -2,6 +2,7 @@ import com.github.zafarkhaja.semver.UnexpectedCharacterException; import com.github.zafarkhaja.semver.Version; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.egov.auditservice.persisterauditclient.models.contract.AuditAttributes; import org.egov.auditservice.persisterauditclient.models.contract.RowData; @@ -10,7 +11,6 @@ import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; import java.util.LinkedList; import java.util.List; import java.util.UUID; diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/service/ChooseSignerAndVerifier.java b/core-services/audit-service/src/main/java/org/egov/auditservice/service/ChooseSignerAndVerifier.java index bb0d3cfa7fa..daecc546304 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/service/ChooseSignerAndVerifier.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/service/ChooseSignerAndVerifier.java @@ -1,5 +1,6 @@ package org.egov.auditservice.service; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.egov.auditservice.repository.AuditServiceRepository; import org.egov.auditservice.web.models.AuditLog; @@ -10,7 +11,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; import java.util.List; import java.util.Map; import java.util.function.Function; diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/validator/AuditServiceValidator.java b/core-services/audit-service/src/main/java/org/egov/auditservice/validator/AuditServiceValidator.java index f0a519b17e7..0449401146e 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/validator/AuditServiceValidator.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/validator/AuditServiceValidator.java @@ -1,5 +1,6 @@ package org.egov.auditservice.validator; +import jakarta.annotation.PostConstruct; import org.egov.auditservice.web.models.AuditLog; import org.egov.auditservice.web.models.AuditLogSearchCriteria; import org.egov.auditservice.web.models.enums.OperationType; @@ -9,7 +10,6 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; -import javax.annotation.PostConstruct; import java.util.HashSet; import java.util.List; import java.util.Set; diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/web/controllers/AuditServiceController.java b/core-services/audit-service/src/main/java/org/egov/auditservice/web/controllers/AuditServiceController.java index e340134564c..9f17b778931 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/web/controllers/AuditServiceController.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/web/controllers/AuditServiceController.java @@ -1,6 +1,7 @@ package org.egov.auditservice.web.controllers; import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.egov.auditservice.persisterauditclient.PersisterAuditClientService; import org.egov.auditservice.persisterauditclient.models.contract.PersisterClientInput; @@ -12,7 +13,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; import java.util.List; import java.util.Map; diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLog.java b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLog.java index a998c85a5c3..cc28923d4da 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLog.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLog.java @@ -1,15 +1,14 @@ package org.egov.auditservice.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import lombok.*; import org.egov.auditservice.web.models.enums.OperationType; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.NotNull; import java.util.Map; @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-03-30T07:20:03.639Z[GMT]") @Getter @Setter @AllArgsConstructor diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLogRequest.java b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLogRequest.java index a3f6a5c3b0f..266375fd52b 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLogRequest.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLogRequest.java @@ -2,16 +2,15 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.common.contract.request.RequestInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; /** * Data object containing static master data to be ingested for DSS Dashboards */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-03-30T07:20:03.639Z[GMT]") @Getter @Setter @AllArgsConstructor diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLogResponse.java b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLogResponse.java index 51a5b3f341b..2942f2a09d5 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLogResponse.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/AuditLogResponse.java @@ -2,16 +2,15 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.common.contract.response.ResponseInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; /** * Data object containing static master data to be ingested for DSS Dashboards */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-03-30T07:20:03.639Z[GMT]") @Getter @Setter @AllArgsConstructor diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/RequestInfoWrapper.java b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/RequestInfoWrapper.java index c2d9a75fe67..730d8a17621 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/RequestInfoWrapper.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/RequestInfoWrapper.java @@ -9,7 +9,6 @@ * Data object containing static master data to be ingested for DSS Dashboards */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2022-03-30T07:20:03.639Z[GMT]") @Getter @Setter @AllArgsConstructor diff --git a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/encryptionclient/SignRequest.java b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/encryptionclient/SignRequest.java index 4eb6273c4aa..68098517d77 100644 --- a/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/encryptionclient/SignRequest.java +++ b/core-services/audit-service/src/main/java/org/egov/auditservice/web/models/encryptionclient/SignRequest.java @@ -1,9 +1,9 @@ package org.egov.auditservice.web.models.encryptionclient; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import lombok.*; -import javax.validation.constraints.NotNull; @Getter @Setter diff --git a/core-services/audit-service/src/main/resources/db/Dockerfile b/core-services/audit-service/src/main/resources/db/Dockerfile index 60fc07ce69f..e7da01d7f0b 100644 --- a/core-services/audit-service/src/main/resources/db/Dockerfile +++ b/core-services/audit-service/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql @@ -6,4 +6,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] \ No newline at end of file +ENTRYPOINT ["/usr/bin/migrate.sh"] \ No newline at end of file diff --git a/core-services/audit-service/src/main/resources/db/migrate.sh b/core-services/audit-service/src/main/resources/db/migrate.sh index 43960b25cdb..5593a173eba 100644 --- a/core-services/audit-service/src/main/resources/db/migrate.sh +++ b/core-services/audit-service/src/main/resources/db/migrate.sh @@ -1,3 +1,3 @@ #!/bin/sh -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate \ No newline at end of file diff --git a/core-services/boundary-service/README.md b/core-services/boundary-service/README.md new file mode 100644 index 00000000000..a2e8a9f7b84 --- /dev/null +++ b/core-services/boundary-service/README.md @@ -0,0 +1,18 @@ +# Swagger generated server + +Spring Boot Server + + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. +This is an example of building a swagger-enabled server in Java using the SpringBoot framework. + +The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) + +Start your server as an simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/ + +Change default port value in application.properties \ No newline at end of file diff --git a/core-services/boundary-service/pom.xml b/core-services/boundary-service/pom.xml new file mode 100644 index 00000000000..867135c9aec --- /dev/null +++ b/core-services/boundary-service/pom.xml @@ -0,0 +1,118 @@ + + 4.0.0 + org.egov + boundary-service + jar + boundary-service + 1.0.0 + + 17 + ${java.version} + ${java.version} + + + org.springframework.boot + spring-boot-starter-parent + 3.2.2 + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.flywaydb + flyway-core + + + org.postgresql + postgresql + 42.7.1 + + + org.springframework.boot + spring-boot-starter-test + test + + + + io.swagger + swagger-core + 1.5.18 + + + io.swagger.core.v3 + swagger-annotations + 2.2.8 + + + + + org.egov.services + tracer + 2.9.0-SNAPSHOT + + + org.egov.services + digit-models + 1.0.0-SNAPSHOT + + + org.egov + mdms-client + 2.9.0-SNAPSHOT + compile + + + org.projectlombok + lombok + true + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + + repo.egovernments.org + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + + + repo.egovernments.org.snapshots + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ + + + repo.egovernments.org.public + eGov Public Repository Group + https://nexus-repo.egovernments.org/nexus/content/groups/public/ + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + diff --git a/core-services/boundary-service/src/main/java/digit/Main.java b/core-services/boundary-service/src/main/java/digit/Main.java new file mode 100644 index 00000000000..6e3d79db11c --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/Main.java @@ -0,0 +1,20 @@ +package digit; + + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Import; + +@Import({ TracerConfiguration.class }) +@SpringBootApplication +@ComponentScan(basePackages = { "digit", "digit.web.controllers" , "digit.config"}) +public class Main { + + + public static void main(String[] args) throws Exception { + SpringApplication.run(Main.class, args); + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/config/ApplicationProperties.java b/core-services/boundary-service/src/main/java/digit/config/ApplicationProperties.java new file mode 100644 index 00000000000..82ef53dcf36 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/config/ApplicationProperties.java @@ -0,0 +1,110 @@ +package digit.config; + +import lombok.*; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +@Data +@NoArgsConstructor +@AllArgsConstructor +@Setter +@Getter +public class ApplicationProperties { + + + // User Config + @Value("${egov.user.host}") + private String userHost; + + @Value("${egov.user.context.path}") + private String userContextPath; + + @Value("${egov.user.create.path}") + private String userCreateEndpoint; + + @Value("${egov.user.search.path}") + private String userSearchEndpoint; + + @Value("${egov.user.update.path}") + private String userUpdateEndpoint; + + + //Idgen Config + @Value("${egov.idgen.host}") + private String idGenHost; + + @Value("${egov.idgen.path}") + private String idGenPath; + + + //Workflow Config + @Value("${egov.workflow.host}") + private String wfHost; + + @Value("${egov.workflow.transition.path}") + private String wfTransitionPath; + + @Value("${egov.workflow.businessservice.search.path}") + private String wfBusinessServiceSearchPath; + + @Value("${egov.workflow.processinstance.search.path}") + private String wfProcessInstanceSearchPath; + + + //MDMS + @Value("${egov.mdms.host}") + private String mdmsHost; + + @Value("${egov.mdms.search.endpoint}") + private String mdmsEndPoint; + + + //HRMS + @Value("${egov.hrms.host}") + private String hrmsHost; + + @Value("${egov.hrms.search.endpoint}") + private String hrmsEndPoint; + + + //URLShortening + @Value("${egov.url.shortner.host}") + private String urlShortnerHost; + + @Value("${egov.url.shortner.endpoint}") + private String urlShortnerEndpoint; + + + //SMSNotification + @Value("${egov.sms.notification.topic}") + private String smsNotificationTopic; + + // Kafka Config + @Value("${kafka.topics.create.boundary}") + private String createBoundaryTopic; + + @Value("${kafka.topics.update.boundary}") + private String updateBoundaryTopic; + + @Value("${kafka.topics.create.boundary.hierarchy}") + private String createBoundaryHierarchyTopic; + + @Value("${kafka.topics.update.boundary.hierarchy}") + private String updateBoundaryHierarchyTopic; + + @Value("${kafka.topics.create.boundary.relationship}") + private String createBoundaryRelationshipTopic; + + @Value("${kafka.topics.update.boundary.relationship}") + private String updateBoundaryRelationshipTopic; + + @Value("${boundary.default.offset}") + private Integer defaultOffset; + + @Value("${boundary.default.limit}") + private Integer defaultLimit; + + @Value("${boundary.max.default.limit}") + private Integer maxDefaultLimit; +} diff --git a/core-services/boundary-service/src/main/java/digit/config/MainConfiguration.java b/core-services/boundary-service/src/main/java/digit/config/MainConfiguration.java new file mode 100644 index 00000000000..3ccf47e694b --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/config/MainConfiguration.java @@ -0,0 +1,39 @@ +package digit.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import java.util.TimeZone; +import jakarta.annotation.PostConstruct; + import com.fasterxml.jackson.databind.DeserializationFeature; + import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.tracer.config.TracerConfiguration; + + +@Import({TracerConfiguration.class}) +public class MainConfiguration { + + @Value("${app.timezone}") + private String timeZone; + + @PostConstruct + public void initialize() { + TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); + } + + @Bean + public ObjectMapper objectMapper(){ + return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).setTimeZone(TimeZone.getTimeZone(timeZone)); + } + + @Bean + @Autowired + public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setObjectMapper(objectMapper); + return converter; + } +} \ No newline at end of file diff --git a/core-services/boundary-service/src/main/java/digit/constants/BoundaryConstants.java b/core-services/boundary-service/src/main/java/digit/constants/BoundaryConstants.java new file mode 100644 index 00000000000..c8a69120c7e --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/constants/BoundaryConstants.java @@ -0,0 +1,17 @@ +package digit.constants; + + +import org.springframework.stereotype.Component; + + +@Component +public class BoundaryConstants { + public static final String RES_MSG_ID = "uief87324"; + public static final String SUCCESSFUL = "successful"; + public static final String FAILED = "failed"; + public static final String TYPE = "type"; + public static final String POINT = "Point"; + public static final String POLYGON = "Polygon"; + public static final String OPENING_BRACKET = " {"; + public static final String CLOSING_BRACKET = "} "; +} diff --git a/core-services/boundary-service/src/main/java/digit/errors/ErrorCodes.java b/core-services/boundary-service/src/main/java/digit/errors/ErrorCodes.java new file mode 100644 index 00000000000..6418b51f88f --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/errors/ErrorCodes.java @@ -0,0 +1,34 @@ +package digit.errors; + +import org.springframework.stereotype.Component; + +public class ErrorCodes { + + public static final String INVALID_GEOMETRY_TYPE_CODE = "INVALID_GEOMETRY_TYPE"; + public static final String INVALID_GEOMETRY_TYPE_MSG = "Provided geometry type is not supported. Supported geometry types are Point and Polygon."; + public static final String INVALID_GEOJSON_CODE = "INVALID_GEOJSON"; + public static final String INVALID_GEOJSON_MSG = "Provided geometry object contains invalid JSON."; + public static final String DUPLICATE_CODE_CODE = "DUPLICATE_CODE"; + public static final String DUPLICATE_CODE_MSG = "Boundary entity with same code and tenantId already exists."; + public static final String NOT_FOUND_CODE_AND_TENANT_ID_CODE = "NOT_FOUND_CODE_AND_TENANT_ID_CODE"; + public static final String NOT_FOUND_CODE_AND_TENANT_ID_MSG = "Tenant Id and Code combination not found."; + public static final String INVALID_POSITION_CODE = "INVALID_POSITION"; + public static final String INVALID_POSITION_MSG = "Position array must contain 2 values"; + public static final String INVALID_POLYGON_CODE = "INVALID_POLYGON"; + public static final String INVALID_POLYGON_MSG = "Polygon must not be empty neither should it contain any holes."; + public static final String INVALID_POLYGON_COORDINATES_DEFINITION_CODE = "INVALID_POLYGON_COORDINATES_DEFINITION"; + public static final String INVALID_POLYGON_COORDINATES_DEFINITION_MSG = "Polygon must be defined with minimum 4 coordinates."; + public static final String INVALID_POLYGON_DEFINITION_CODE = "INVALID_POLYGON_DEFINITION"; + public static final String INVALID_POLYGON_DEFINITION_MSG = "Polygon coordinates must begin and end with the same coordinate according to RFC 7946 standard."; + public static final String INVALID_HIERARCHY_DEFINITION_CODE = "INVALID_HIERARCHY_DEFINITION"; + public static final String INVALID_HIERARCHY_DEFINITION_MSG = "Given parent type is not part of boundary hierarchy definition - "; + public static final String INVALID_HIERARCHY_ENTITY_DEFINITION_CODE = "INVALID_HIERARCHY_DEFINITION"; + public static final String INVALID_HIERARCHY_ENTITY_DEFINITION_MSG = "Hierarchy entities must not form a cycle."; + public static final String DUPLICATE_RECORD_CODE = "DUPLICATE_RECORD"; + public static final String DUPLICATE_RECORD_MSG = "Boundary hierarchy with the provided tenantId and hierarchy type already exists."; + public static final String MULTIPLE_ROOT_NODES_ERR_CODE = "MULTIPLE_ROOT_NODES_ERR"; + public static final String MULTIPLE_ROOT_NODES_ERR_MSG = "Hierarchy definition must have only one root node."; + public static final String DUPLICATE_BOUNDARY_CODE = "DUPLICATE_BOUNDARY"; + public static final String DUPLICATE_BOUNDARY_MSG = "Duplicate boundary entities found in the request."; + +} diff --git a/core-services/boundary-service/src/main/java/digit/kafka/Consumer.java b/core-services/boundary-service/src/main/java/digit/kafka/Consumer.java new file mode 100644 index 00000000000..557ffe5d7bb --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/kafka/Consumer.java @@ -0,0 +1,21 @@ +package digit.kafka; + +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +import java.util.HashMap; + +@Component +public class Consumer { + + /* + * Uncomment the below line to start consuming record from kafka.topics.consumer + * Value of the variable kafka.topics.consumer should be overwritten in application.properties + */ + //@KafkaListener(topics = {"kafka.topics.consumer"}) + public void listen(final HashMap record) { + + //TODO + + } +} diff --git a/core-services/boundary-service/src/main/java/digit/kafka/Producer.java b/core-services/boundary-service/src/main/java/digit/kafka/Producer.java new file mode 100644 index 00000000000..542f4f686c0 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/kafka/Producer.java @@ -0,0 +1,20 @@ +package digit.kafka; + +import lombok.extern.slf4j.Slf4j; +import org.egov.tracer.kafka.CustomKafkaTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +// NOTE: If tracer is disabled change CustomKafkaTemplate to KafkaTemplate in autowiring + +@Service +@Slf4j +public class Producer { + + @Autowired + private CustomKafkaTemplate kafkaTemplate; + + public void push(String topic, Object value) { + kafkaTemplate.send(topic, value); + } +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/BoundaryHierarchyRepository.java b/core-services/boundary-service/src/main/java/digit/repository/BoundaryHierarchyRepository.java new file mode 100644 index 00000000000..a333bcd6be8 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/BoundaryHierarchyRepository.java @@ -0,0 +1,14 @@ +package digit.repository; + +import digit.web.models.*; +import java.util.List; + +public interface BoundaryHierarchyRepository { + + public void create(BoundaryTypeHierarchyRequest boundaryTypeHierarchyRequest); + + public void update(BoundaryTypeHierarchyRequest boundaryTypeHierarchyRequest); + + public List search(BoundaryTypeHierarchySearchCriteria boundaryTypeHierarchySearchCriteria); + +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/BoundaryRelationshipRepository.java b/core-services/boundary-service/src/main/java/digit/repository/BoundaryRelationshipRepository.java new file mode 100644 index 00000000000..353c2e1c2d1 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/BoundaryRelationshipRepository.java @@ -0,0 +1,17 @@ +package digit.repository; + +import digit.web.models.BoundaryRelationshipDTO; +import digit.web.models.BoundaryRelationshipRequest; +import digit.web.models.BoundaryRelationshipRequestDTO; +import digit.web.models.BoundaryRelationshipSearchCriteria; +import java.util.List; + +public interface BoundaryRelationshipRepository { + + public void create(BoundaryRelationshipRequest boundaryRelationshipRequest); + + public void update(BoundaryRelationshipRequestDTO boundaryRelationshipRequest); + + public List search(BoundaryRelationshipSearchCriteria boundaryRelationshipSearchCriteria); + +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/BoundaryRepository.java b/core-services/boundary-service/src/main/java/digit/repository/BoundaryRepository.java new file mode 100644 index 00000000000..456c41d9b62 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/BoundaryRepository.java @@ -0,0 +1,16 @@ +package digit.repository; + +import digit.web.models.Boundary; +import digit.web.models.BoundaryRequest; +import digit.web.models.BoundarySearchCriteria; +import java.util.List; + +public interface BoundaryRepository { + + public void create(BoundaryRequest boundaryRequest); + + public List search(BoundarySearchCriteria boundarySearchCriteria); + + public void update(BoundaryRequest boundaryRequest); + +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/impl/BoundaryHierarchyRepositoryImpl.java b/core-services/boundary-service/src/main/java/digit/repository/impl/BoundaryHierarchyRepositoryImpl.java new file mode 100644 index 00000000000..a5d2c1dea8a --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/impl/BoundaryHierarchyRepositoryImpl.java @@ -0,0 +1,75 @@ +package digit.repository.impl; + +import digit.config.ApplicationProperties; +import digit.kafka.Producer; +import digit.repository.BoundaryHierarchyRepository; +import digit.repository.querybuilder.BoundaryHierarchyTypeQueryBuilder; +import digit.repository.rowmapper.BoundaryHierarchyTypeRowMapper; +import digit.web.models.BoundaryTypeHierarchyDefinition; +import digit.web.models.BoundaryTypeHierarchyRequest; +import digit.web.models.BoundaryTypeHierarchySearchCriteria; +import lombok.extern.slf4j.Slf4j; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Repository +public class BoundaryHierarchyRepositoryImpl implements BoundaryHierarchyRepository { + + private Producer producer; + + private BoundaryHierarchyTypeQueryBuilder boundaryHierarchyTypeQueryBuilder; + + private JdbcTemplate jdbcTemplate; + + private BoundaryHierarchyTypeRowMapper boundaryHierarchyTypeRowMapper; + + private ApplicationProperties applicationProperties; + + public BoundaryHierarchyRepositoryImpl(Producer producer, BoundaryHierarchyTypeQueryBuilder boundaryHierarchyTypeQueryBuilder, + JdbcTemplate jdbcTemplate, BoundaryHierarchyTypeRowMapper boundaryHierarchyTypeRowMapper, ApplicationProperties applicationProperties) { + this.producer = producer; + this.boundaryHierarchyTypeQueryBuilder = boundaryHierarchyTypeQueryBuilder; + this.jdbcTemplate = jdbcTemplate; + this.boundaryHierarchyTypeRowMapper = boundaryHierarchyTypeRowMapper; + this.applicationProperties = applicationProperties; + } + + /** + * This method implements boundary type hierarchy repository interface. In this implementation + * it pushes the request to kafka for persister to pick it up and perform insert. + * @param boundaryTypeHierarchyRequest + */ + @Override + public void create(BoundaryTypeHierarchyRequest boundaryTypeHierarchyRequest) { + producer.push(applicationProperties.getCreateBoundaryHierarchyTopic(), boundaryTypeHierarchyRequest); + } + + /** + * This method implements boundary type hierarchy repository interface. In this implementation + * it pushes the request to kafka for persister to pick it up and perform update. + * @param boundaryTypeHierarchyRequest + */ + @Override + public void update(BoundaryTypeHierarchyRequest boundaryTypeHierarchyRequest) { + producer.push(applicationProperties.getUpdateBoundaryHierarchyTopic(), boundaryTypeHierarchyRequest); + } + + /** + * This method implements boundary type hierarchy repository interface. In this implementation + * it creates query to search data in PostgreSQL database and returns the search response back + * to the caller. + * @param boundaryTypeHierarchySearchCriteria + * @return + */ + @Override + public List search(BoundaryTypeHierarchySearchCriteria boundaryTypeHierarchySearchCriteria) { + List preparedStmtList = new ArrayList<>(); + String query = boundaryHierarchyTypeQueryBuilder.getBoundaryHierarchyTypeSearchQuery(boundaryTypeHierarchySearchCriteria, preparedStmtList); + return jdbcTemplate.query(query, preparedStmtList.toArray(), boundaryHierarchyTypeRowMapper); + } + +} \ No newline at end of file diff --git a/core-services/boundary-service/src/main/java/digit/repository/impl/BoundaryRelationshipRepositoryImpl.java b/core-services/boundary-service/src/main/java/digit/repository/impl/BoundaryRelationshipRepositoryImpl.java new file mode 100644 index 00000000000..bd78c589827 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/impl/BoundaryRelationshipRepositoryImpl.java @@ -0,0 +1,104 @@ +package digit.repository.impl; + +import digit.config.ApplicationProperties; +import digit.kafka.Producer; +import digit.repository.BoundaryRelationshipRepository; +import digit.repository.querybuilder.BoundaryRelationshipQueryBuilder; +import digit.repository.rowmapper.BoundaryRelationshipRowMapper; +import digit.web.models.*; +import org.springframework.beans.BeanUtils; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; + +import java.util.ArrayList; +import java.util.List; + +@Repository +public class BoundaryRelationshipRepositoryImpl implements BoundaryRelationshipRepository { + + private Producer producer; + + private JdbcTemplate jdbcTemplate; + + private BoundaryRelationshipQueryBuilder boundaryRelationshipQueryBuilder; + + private BoundaryRelationshipRowMapper boundaryRelationshipRowMapper; + + private ApplicationProperties applicationProperties; + + public BoundaryRelationshipRepositoryImpl(Producer producer, JdbcTemplate jdbcTemplate, + BoundaryRelationshipQueryBuilder boundaryRelationshipQueryBuilder, BoundaryRelationshipRowMapper boundaryRelationshipRowMapper, ApplicationProperties applicationProperties) { + this.producer = producer; + this.jdbcTemplate = jdbcTemplate; + this.boundaryRelationshipQueryBuilder = boundaryRelationshipQueryBuilder; + this.boundaryRelationshipRowMapper = boundaryRelationshipRowMapper; + this.applicationProperties = applicationProperties; + } + + /** + * This method implements boundary relationship interface. In this implementation + * it pushes the request to kafka for persister to pick it up and perform create. + * @param boundaryRelationshipRequest + */ + @Override + public void create(BoundaryRelationshipRequest boundaryRelationshipRequest) { + // Transform boundary relationship request + BoundaryRelationshipRequestDTO boundaryRelationshipRequestDTO = convertContractPOJOToDTO(boundaryRelationshipRequest); + + // Push to event bus for creating asynchronously + producer.push(applicationProperties.getCreateBoundaryRelationshipTopic(), boundaryRelationshipRequestDTO); + } + + /** + * This method implements boundary relationship interface's update method. In this implementation + * it pushes the request to kafka for persister to pick it up and perform update. + * @param boundaryRelationshipRequestDTO + */ + @Override + public void update(BoundaryRelationshipRequestDTO boundaryRelationshipRequestDTO) { + // Push to event bus for updating asynchronously + producer.push(applicationProperties.getUpdateBoundaryRelationshipTopic(), boundaryRelationshipRequestDTO); + } + + /** + * This method implements boundary relationship repository interface. In this implementation + * it creates query to search data in PostgreSQL database and returns the search response back + * to the caller. + * @param boundaryRelationshipSearchCriteria + * @return + */ + @Override + public List search(BoundaryRelationshipSearchCriteria boundaryRelationshipSearchCriteria) { + // Declare prepared statement list + List preparedStmtList = new ArrayList<>(); + + // Get query for searching boundary relationship + String query = boundaryRelationshipQueryBuilder.getBoundaryRelationshipSearchQuery(boundaryRelationshipSearchCriteria, preparedStmtList); + + // Return search response based on provided search criteria + return jdbcTemplate.query(query, preparedStmtList.toArray(), boundaryRelationshipRowMapper); + } + + /** + * Helper method to convert boundary relationship POJOs into boundary relationship DTOs + * @param contractBean + * @return + */ + private BoundaryRelationshipRequestDTO convertContractPOJOToDTO(BoundaryRelationshipRequest contractBean) { + // Declare boundary relationship request DTO + BoundaryRelationshipRequestDTO boundaryRelationshipRequestDTO = new BoundaryRelationshipRequestDTO(); + + // Copy boundary relationship properties + BoundaryRelationshipDTO boundaryRelationshipDTO = new BoundaryRelationshipDTO(); + BeanUtils.copyProperties(contractBean.getBoundaryRelationship(), boundaryRelationshipDTO); + BeanUtils.copyProperties(contractBean, boundaryRelationshipRequestDTO); + + // Enrich ancestral materialized path + boundaryRelationshipDTO.setAncestralMaterializedPath(contractBean.getBoundaryRelationship().getAncestralMaterializedPath()); + + // Enrich boundary relationship DTO in request + boundaryRelationshipRequestDTO.setBoundaryRelationshipDTO(boundaryRelationshipDTO); + + return boundaryRelationshipRequestDTO; + } +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/impl/BoundaryRepositoryImpl.java b/core-services/boundary-service/src/main/java/digit/repository/impl/BoundaryRepositoryImpl.java new file mode 100644 index 00000000000..462a9c775eb --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/impl/BoundaryRepositoryImpl.java @@ -0,0 +1,107 @@ +package digit.repository.impl; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.config.ApplicationProperties; +import digit.kafka.Producer; +import digit.repository.BoundaryRepository; +import digit.repository.querybuilder.BoundaryEntityQueryBuilder; +import digit.repository.rowmapper.BoundaryEntityRowMapper; +import digit.web.models.Boundary; +import digit.web.models.BoundaryRequest; +import digit.web.models.BoundarySearchCriteria; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.RestTemplate; + +import java.util.*; +import java.util.stream.Collectors; + +@Repository +@Slf4j +public class BoundaryRepositoryImpl implements BoundaryRepository { + + private final ObjectMapper mapper; + + private final RestTemplate restTemplate; + + private final JdbcTemplate jdbcTemplate; + + private final BoundaryEntityRowMapper boundaryEntityRowMapper; + + private final BoundaryEntityQueryBuilder boundaryEntityQueryBuilder; + + private final Producer producer; + + private final ApplicationProperties applicationProperties; + + public BoundaryRepositoryImpl(ObjectMapper mapper , RestTemplate restTemplate , JdbcTemplate jdbcTemplate , BoundaryEntityRowMapper boundaryEntityRowMapper + , BoundaryEntityQueryBuilder boundaryEntityQueryBuilder , Producer producer , ApplicationProperties applicationProperties) { + this.mapper = mapper; + this.restTemplate = restTemplate; + this.jdbcTemplate = jdbcTemplate; + this.boundaryEntityRowMapper = boundaryEntityRowMapper; + this.boundaryEntityQueryBuilder = boundaryEntityQueryBuilder; + this.producer = producer; + this.applicationProperties = applicationProperties; + } + + /** + * This method implements boundary entity repository interface. In this implementation + * it pushes the request to kafka for persister to pick it up and perform insert. + * @param boundaryRequest + */ + @Override + public void create(BoundaryRequest boundaryRequest) { + producer.push(applicationProperties.getCreateBoundaryTopic() , boundaryRequest); + } + + /** + * This method is used to search for boundary entity + * @param boundarySearchCriteria + * @return + */ + @Override + public List search(BoundarySearchCriteria boundarySearchCriteria) { + + List preparedStmtList = new ArrayList<>(); + + String query = boundaryEntityQueryBuilder.getBoundaryDataSearchQuery(boundarySearchCriteria , preparedStmtList); + + List boundaryList = jdbcTemplate.query(query , preparedStmtList.toArray() , boundaryEntityRowMapper); + + return boundaryList; + } + + /** + * This method implements boundary type hierarchy repository interface. In this implementation + * it pushes the request to kafka for persister to pick it up and perform update. + * @param boundaryRequest + */ + @Override + public void update(BoundaryRequest boundaryRequest) { + producer.push(applicationProperties.getUpdateBoundaryTopic() , boundaryRequest); + } + + /** + * This method returns the set of codes for a given tenantId + * @param tenantId + * @return + */ + public Set getCodeListByTenantId(String tenantId) { + + // create a boundary search criteria object with the given tenantId + BoundarySearchCriteria boundarySearchCriteria = new BoundarySearchCriteria(); + boundarySearchCriteria.setTenantId(tenantId); + + // get all the boundary entities for the given tenantId from the database + List boundaryList = search(boundarySearchCriteria); + + // return the set of codes from the boundary entities + return boundaryList.stream().map(Boundary::getCode).collect(Collectors.toSet()); + + } + +} \ No newline at end of file diff --git a/core-services/boundary-service/src/main/java/digit/repository/querybuilder/BoundaryEntityQueryBuilder.java b/core-services/boundary-service/src/main/java/digit/repository/querybuilder/BoundaryEntityQueryBuilder.java new file mode 100644 index 00000000000..f04eaf9a779 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/querybuilder/BoundaryEntityQueryBuilder.java @@ -0,0 +1,82 @@ +package digit.repository.querybuilder; + +import digit.config.ApplicationProperties; +import digit.util.QueryUtil; +import digit.web.models.BoundarySearchCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +import java.util.*; + +@Component +public class BoundaryEntityQueryBuilder { + + private ApplicationProperties config; + + private static final String SEARCH_BOUNDARY_ENTITY_QUERY = "SELECT boundary.id , boundary.tenantid , boundary.createdtime , boundary.createdby , boundary.lastmodifiedby , boundary.lastmodifiedtime, boundary.code, boundary.geometry, boundary.additionaldetails FROM boundary"; + + private static final String BOUNDARY_DATA_QUERY_ORDER_BY_CLAUSE = " order by createdtime desc "; + + public BoundaryEntityQueryBuilder(ApplicationProperties config) { + this.config = config; + } + + /** + * Method to build query dynamically based on the criteria passed to the method + * @param boundarySearchCriteria + * @param preparedStmtList + * @return + */ + public String getBoundaryDataSearchQuery(BoundarySearchCriteria boundarySearchCriteria, List preparedStmtList) { + String query = buildQuery(boundarySearchCriteria , preparedStmtList); + query = QueryUtil.addOrderByClause(query , BOUNDARY_DATA_QUERY_ORDER_BY_CLAUSE); + query = getPaginatedQuery(query , boundarySearchCriteria , preparedStmtList); + return query; + } + + /** + * Method to build query dynamically based on the criteria passed to the method + * @param boundarySearchCriteria + * @param preparedStmtList + * @return + */ + private String buildQuery(BoundarySearchCriteria boundarySearchCriteria , List preparedStmtList) { + StringBuilder builder = new StringBuilder(SEARCH_BOUNDARY_ENTITY_QUERY); + + if (!Objects.isNull(boundarySearchCriteria.getTenantId())) { + QueryUtil.addClauseIfRequired(builder , preparedStmtList); + builder.append(" boundary.tenantid = ? "); + preparedStmtList.add(boundarySearchCriteria.getTenantId()); + } + if (!Objects.isNull(boundarySearchCriteria.getCodes())) { + QueryUtil.addClauseIfRequired(builder , preparedStmtList); + builder.append(" boundary.code IN ( ").append(QueryUtil.createQuery(boundarySearchCriteria.getCodes().size())).append(" )"); + Set codes = new HashSet<>(boundarySearchCriteria.getCodes()); + QueryUtil.addToPreparedStatement(preparedStmtList , codes); + } + return builder.toString(); + } + + /** + * Method to add pagination to the query + * @param query + * @param boundarySearchCriteria + * @param preparedStmtList + * @return + */ + private String getPaginatedQuery(String query, BoundarySearchCriteria boundarySearchCriteria , List preparedStmtList) { + StringBuilder paginatedQuery = new StringBuilder(query); + + // Append offset + paginatedQuery.append(" OFFSET ? "); + preparedStmtList.add(ObjectUtils.isEmpty(boundarySearchCriteria.getOffset()) ? config.getDefaultOffset() : boundarySearchCriteria.getOffset()); + + // Append limit + paginatedQuery.append(" LIMIT ? "); + preparedStmtList.add(ObjectUtils.isEmpty(boundarySearchCriteria.getLimit()) ? config.getDefaultLimit() : (boundarySearchCriteria.getLimit() > config.getMaxDefaultLimit() ? config.getMaxDefaultLimit() : boundarySearchCriteria.getLimit()) ); + + return paginatedQuery.toString(); + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/querybuilder/BoundaryHierarchyTypeQueryBuilder.java b/core-services/boundary-service/src/main/java/digit/repository/querybuilder/BoundaryHierarchyTypeQueryBuilder.java new file mode 100644 index 00000000000..f195036fa37 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/querybuilder/BoundaryHierarchyTypeQueryBuilder.java @@ -0,0 +1,77 @@ +package digit.repository.querybuilder; + +import digit.config.ApplicationProperties; +import digit.util.QueryUtil; +import digit.web.models.BoundarySearchCriteria; +import digit.web.models.BoundaryTypeHierarchyDefinition; +import digit.web.models.BoundaryTypeHierarchySearchCriteria; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; +import java.util.List; + +@Component +public class BoundaryHierarchyTypeQueryBuilder { + + private ApplicationProperties config; + + public BoundaryHierarchyTypeQueryBuilder(ApplicationProperties config) { + this.config = config; + } + + private static String BOUNDARY_HIERARCHY_TYPE_BASE_SEARCH_QUERY = "SELECT id, tenantid, hierarchytype, boundaryhierarchy, createdtime, lastmodifiedtime, createdby, lastmodifiedby" + + " FROM boundary_hierarchy "; + + private static String ORDER_BY_CLAUSE = " order by createdtime desc "; + + private static String BOUNDARY_HIERARCHY_TYPE_COUNT_QUERY = "SELECT count(*) FROM boundary_hierarchy "; + + public String getBoundaryHierarchyTypeSearchQuery(BoundaryTypeHierarchySearchCriteria boundaryTypeHierarchySearchCriteria, List preparedStmtList) { + String query = buildQuery(boundaryTypeHierarchySearchCriteria, preparedStmtList, BOUNDARY_HIERARCHY_TYPE_BASE_SEARCH_QUERY); + query = QueryUtil.addOrderByClause(query, ORDER_BY_CLAUSE); + query = getPaginatedQuery(query , boundaryTypeHierarchySearchCriteria , preparedStmtList); + return query; + } + + public String getBoundaryHierarchyTypeCountQuery(BoundaryTypeHierarchySearchCriteria boundaryTypeHierarchySearchCriteria, List preparedStmtList) { + String query = buildQuery(boundaryTypeHierarchySearchCriteria, preparedStmtList, BOUNDARY_HIERARCHY_TYPE_COUNT_QUERY); + return query; + } + private String buildQuery(BoundaryTypeHierarchySearchCriteria boundaryTypeHierarchySearchCriteria, List preparedStmtList, String Query) { + StringBuilder builder = new StringBuilder(Query); + + if (!ObjectUtils.isEmpty(boundaryTypeHierarchySearchCriteria.getTenantId())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" tenantid = ? "); + preparedStmtList.add(boundaryTypeHierarchySearchCriteria.getTenantId()); + } + + if (!ObjectUtils.isEmpty(boundaryTypeHierarchySearchCriteria.getHierarchyType())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" hierarchytype = ? "); + preparedStmtList.add(boundaryTypeHierarchySearchCriteria.getHierarchyType()); + } + + return builder.toString(); + } + + /** + * Method to add pagination to the query + * @param query + * @param boundaryTypeHierarchySearchCriteria + * @param preparedStmtList + * @return + */ + private String getPaginatedQuery(String query, BoundaryTypeHierarchySearchCriteria boundaryTypeHierarchySearchCriteria , List preparedStmtList) { + StringBuilder paginatedQuery = new StringBuilder(query); + + // Append offset + paginatedQuery.append(" OFFSET ? "); + preparedStmtList.add(ObjectUtils.isEmpty(boundaryTypeHierarchySearchCriteria.getOffset()) ? config.getDefaultOffset() : boundaryTypeHierarchySearchCriteria.getOffset()); + + // Append limit + paginatedQuery.append(" LIMIT ? "); + preparedStmtList.add(ObjectUtils.isEmpty(boundaryTypeHierarchySearchCriteria.getLimit()) ? config.getDefaultLimit() : (boundaryTypeHierarchySearchCriteria.getLimit() > config.getMaxDefaultLimit() ? config.getMaxDefaultLimit() : boundaryTypeHierarchySearchCriteria.getLimit()) ); + + return paginatedQuery.toString(); + } +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/querybuilder/BoundaryRelationshipQueryBuilder.java b/core-services/boundary-service/src/main/java/digit/repository/querybuilder/BoundaryRelationshipQueryBuilder.java new file mode 100644 index 00000000000..2bf04106ecc --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/querybuilder/BoundaryRelationshipQueryBuilder.java @@ -0,0 +1,75 @@ +package digit.repository.querybuilder; + +import digit.util.QueryUtil; +import digit.web.models.BoundaryRelationshipSearchCriteria; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; +import java.util.HashSet; +import java.util.List; + +@Component +public class BoundaryRelationshipQueryBuilder { + + private static String BOUNDARY_RELATIONSHIP_BASE_SEARCH_QUERY = "SELECT id, tenantid, code, hierarchytype, boundarytype, parent, ancestralmaterializedpath, createdtime, createdby, lastmodifiedtime, lastmodifiedby" + + " FROM boundary_relationship "; + + private static String ORDER_BY_CLAUSE = " order by createdtime desc "; + + public String getBoundaryRelationshipSearchQuery(BoundaryRelationshipSearchCriteria boundaryRelationshipSearchCriteria, List preparedStmtList) { + String query = buildQuery(boundaryRelationshipSearchCriteria, preparedStmtList); + query += ORDER_BY_CLAUSE; + return query; + } + + private String buildQuery(BoundaryRelationshipSearchCriteria boundaryRelationshipSearchCriteria, List preparedStmtList) { + StringBuilder builder = new StringBuilder(BOUNDARY_RELATIONSHIP_BASE_SEARCH_QUERY); + + if (!ObjectUtils.isEmpty(boundaryRelationshipSearchCriteria.getTenantId())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" tenantid = ? "); + preparedStmtList.add(boundaryRelationshipSearchCriteria.getTenantId()); + } + + if (!ObjectUtils.isEmpty(boundaryRelationshipSearchCriteria.getHierarchyType())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" hierarchytype = ? "); + preparedStmtList.add(boundaryRelationshipSearchCriteria.getHierarchyType()); + } + + if(!ObjectUtils.isEmpty(boundaryRelationshipSearchCriteria.getParent())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" parent = ? "); + preparedStmtList.add(boundaryRelationshipSearchCriteria.getParent()); + } + + if(!boundaryRelationshipSearchCriteria.getIsSearchForRootNode()) { + if (!ObjectUtils.isEmpty(boundaryRelationshipSearchCriteria.getBoundaryType())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" boundarytype = ? "); + preparedStmtList.add(boundaryRelationshipSearchCriteria.getBoundaryType()); + } + + if (!CollectionUtils.isEmpty(boundaryRelationshipSearchCriteria.getCodes())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" code IN ( ").append(QueryUtil.createQuery(boundaryRelationshipSearchCriteria.getCodes().size())).append(" )"); + QueryUtil.addToPreparedStatement(preparedStmtList, new HashSet<>(boundaryRelationshipSearchCriteria.getCodes())); + } + } + + if(boundaryRelationshipSearchCriteria.getIsSearchForRootNode()) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" parent IS NULL "); + } + + if(!CollectionUtils.isEmpty(boundaryRelationshipSearchCriteria.getCurrentBoundaryCodes())) { + QueryUtil.addClauseIfRequired(builder, preparedStmtList); + builder.append(" ARRAY [ ").append(QueryUtil.createQuery(boundaryRelationshipSearchCriteria.getCurrentBoundaryCodes().size())).append(" ]").append("::text[] "); + builder.append(" && string_to_array(ancestralmaterializedpath, '|') "); + QueryUtil.addToPreparedStatement(preparedStmtList, new HashSet<>(boundaryRelationshipSearchCriteria.getCurrentBoundaryCodes())); + } + + return builder.toString(); + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/rowmapper/BoundaryEntityRowMapper.java b/core-services/boundary-service/src/main/java/digit/repository/rowmapper/BoundaryEntityRowMapper.java new file mode 100644 index 00000000000..66698f871ae --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/rowmapper/BoundaryEntityRowMapper.java @@ -0,0 +1,56 @@ +package digit.repository.rowmapper; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.web.models.Boundary; +import org.egov.common.contract.models.AuditDetails; +import org.egov.tracer.model.CustomException; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +@Component +public class BoundaryEntityRowMapper implements ResultSetExtractor> { + + private ObjectMapper mapper; + + public BoundaryEntityRowMapper(ObjectMapper mapper) { + this.mapper = mapper; + } + + @Override + public List extractData(ResultSet resultSet) throws SQLException , DataAccessException { + + List boundaryList = new ArrayList<>(); + + while (resultSet.next()) { + + AuditDetails auditDetails = AuditDetails.builder().createdBy(resultSet.getString("createdby")). + createdTime(resultSet.getLong("createdtime")). + lastModifiedBy(resultSet.getString("lastmodifiedby")). + lastModifiedTime(resultSet.getLong("lastmodifiedtime")).build(); + + Boundary boundary; + try { + boundary = Boundary.builder() + .id(resultSet.getString("id")) + .code(resultSet.getString("code")) + .auditDetails(auditDetails) + .geometry(mapper.readTree(resultSet.getString("geometry"))) + .additionalDetails(mapper.readTree(resultSet.getString("additionaldetails"))) + .tenantId(resultSet.getString("tenantid")) + .build(); + } catch (JsonProcessingException e) { + throw new CustomException("JSON_PARSE_ERROR" , "Failed to parse either additional details or geometry json"); + } + + boundaryList.add(boundary); + } + return boundaryList; + } +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/rowmapper/BoundaryHierarchyTypeRowMapper.java b/core-services/boundary-service/src/main/java/digit/repository/rowmapper/BoundaryHierarchyTypeRowMapper.java new file mode 100644 index 00000000000..ec9152fee09 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/rowmapper/BoundaryHierarchyTypeRowMapper.java @@ -0,0 +1,66 @@ +package digit.repository.rowmapper; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.web.models.BoundaryTypeHierarchy; +import digit.web.models.BoundaryTypeHierarchyDefinition; +import org.egov.common.contract.models.AuditDetails; +import org.egov.tracer.model.CustomException; +import org.postgresql.util.PGobject; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +@Component +public class BoundaryHierarchyTypeRowMapper implements ResultSetExtractor> { + + private ObjectMapper objectMapper; + + public BoundaryHierarchyTypeRowMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + List boundaryTypeHierarchyDefinitionList = new ArrayList<>(); + + while(resultSet.next()) { + AuditDetails auditDetails = AuditDetails.builder() + .createdBy(resultSet.getString("createdby")) + .createdTime(resultSet.getLong("createdtime")) + .lastModifiedBy(resultSet.getString("lastmodifiedby")) + .lastModifiedTime(resultSet.getLong("lastmodifiedtime")) + .build(); + + List boundaryTypeHierarchyList = getBoundaryHierarchyList(((PGobject) resultSet.getObject("boundaryhierarchy")).getValue()); + + BoundaryTypeHierarchyDefinition boundaryTypeHierarchyDefinition = BoundaryTypeHierarchyDefinition.builder() + .id(resultSet.getString("id")) + .tenantId(resultSet.getString("tenantid")) + .hierarchyType(resultSet.getString("hierarchytype")) + .boundaryHierarchy(boundaryTypeHierarchyList) + .auditDetails(auditDetails) + .build(); + + boundaryTypeHierarchyDefinitionList.add(boundaryTypeHierarchyDefinition); + } + + return boundaryTypeHierarchyDefinitionList; + } + + private List getBoundaryHierarchyList(String boundaryHierarchyJsonString) { + List boundaryHierarchyList; + + try { + boundaryHierarchyList = objectMapper.readValue(boundaryHierarchyJsonString, new TypeReference>() {}); + } catch (Exception e) { + throw new CustomException("PARSING_ERR", "Could not parse boundary type hierarchy from PSQL result set."); + } + + return boundaryHierarchyList; + } +} diff --git a/core-services/boundary-service/src/main/java/digit/repository/rowmapper/BoundaryRelationshipRowMapper.java b/core-services/boundary-service/src/main/java/digit/repository/rowmapper/BoundaryRelationshipRowMapper.java new file mode 100644 index 00000000000..898019daa82 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/repository/rowmapper/BoundaryRelationshipRowMapper.java @@ -0,0 +1,44 @@ +package digit.repository.rowmapper; + +import digit.web.models.*; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +@Component +public class BoundaryRelationshipRowMapper implements ResultSetExtractor> { + + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + List boundaryRelationshipDTOList = new ArrayList<>(); + + while(resultSet.next()) { + AuditDetails auditDetails = AuditDetails.builder() + .createdBy(resultSet.getString("createdby")) + .createdTime(resultSet.getLong("createdtime")) + .lastModifiedBy(resultSet.getString("lastmodifiedby")) + .lastModifiedTime(resultSet.getLong("lastmodifiedtime")) + .build(); + + BoundaryRelationshipDTO boundaryRelationshipDTO = BoundaryRelationshipDTO.builder() + .id(resultSet.getString("id")) + .tenantId(resultSet.getString("tenantid")) + .hierarchyType(resultSet.getString("hierarchytype")) + .boundaryType(resultSet.getString("boundarytype")) + .code(resultSet.getString("code")) + .parent(resultSet.getString("parent")) + .ancestralMaterializedPath(resultSet.getString("ancestralmaterializedpath")) + .auditDetails(auditDetails) + .build(); + + boundaryRelationshipDTOList.add(boundaryRelationshipDTO); + } + + return boundaryRelationshipDTOList; + } +} diff --git a/core-services/boundary-service/src/main/java/digit/service/BoundaryHierarchyDefinitionService.java b/core-services/boundary-service/src/main/java/digit/service/BoundaryHierarchyDefinitionService.java new file mode 100644 index 00000000000..468b2d3e406 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/service/BoundaryHierarchyDefinitionService.java @@ -0,0 +1,82 @@ +package digit.service; + +import digit.repository.BoundaryHierarchyRepository; +import digit.service.enrichment.BoundaryHierarchyEnricher; +import digit.service.validator.BoundaryHierarchyValidator; +import digit.util.HierarchyUtil; +import digit.web.models.*; +import org.egov.common.utils.ResponseInfoUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.Collections; +import java.util.List; + +@Service +public class BoundaryHierarchyDefinitionService { + + private BoundaryHierarchyValidator boundaryHierarchyValidator; + + private BoundaryHierarchyEnricher boundaryHierarchyEnricher; + + private BoundaryHierarchyRepository boundaryHierarchyRepository; + + private HierarchyUtil hierarchyUtil; + + @Autowired + public BoundaryHierarchyDefinitionService(BoundaryHierarchyValidator boundaryHierarchyValidator, BoundaryHierarchyEnricher boundaryHierarchyEnricher, + BoundaryHierarchyRepository boundaryHierarchyRepository, HierarchyUtil hierarchyUtil) { + this.boundaryHierarchyValidator = boundaryHierarchyValidator; + this.boundaryHierarchyEnricher = boundaryHierarchyEnricher; + this.boundaryHierarchyRepository = boundaryHierarchyRepository; + this.hierarchyUtil = hierarchyUtil; + } + + /** + * Method for processing boundary hierarchy create requests. + * @param body + * @return + */ + public BoundaryTypeHierarchyResponse createBoundaryHierarchyDefinition(BoundaryTypeHierarchyRequest body) { + + // Validate boundary hierarchy + boundaryHierarchyValidator.validateBoundaryTypeHierarchy(body); + + // Enrich boundary hierarchy + boundaryHierarchyEnricher.enrichBoundaryHierarchyDefinition(body); + + // Delegate request to boundary repository + boundaryHierarchyRepository.create(body); + + // Build response and return + return BoundaryTypeHierarchyResponse.builder() + .boundaryHierarchy(Collections.singletonList(body.getBoundaryHierarchy())) + .responseInfo(ResponseInfoUtil.createResponseInfoFromRequestInfo(body.getRequestInfo(), Boolean.TRUE)) + .build(); + } + + /** + * Method for processing boundary hierarchy definition search requests. + * @param body + * @return + */ + public BoundaryTypeHierarchyResponse searchBoundaryHierarchyDefinition(BoundaryTypeHierarchySearchRequest body) { + + // Search for boundary hierarchy depending on the provided search criteria + List boundaryTypeHierarchyDefinitionList = boundaryHierarchyRepository.search(body.getBoundaryTypeHierarchySearchCriteria()); + + Integer totalCount = hierarchyUtil.getBoundaryTypeHierarchyDefinitionCount(body.getBoundaryTypeHierarchySearchCriteria()); + + // Set boundary hierarchy definition as null if not found + List boundaryTypeHierarchyDefinition = CollectionUtils.isEmpty(boundaryTypeHierarchyDefinitionList) ? null : boundaryTypeHierarchyDefinitionList; + + // Build response and return + return BoundaryTypeHierarchyResponse.builder() + .boundaryHierarchy(boundaryTypeHierarchyDefinition) + .responseInfo(ResponseInfoUtil.createResponseInfoFromRequestInfo(body.getRequestInfo(), Boolean.TRUE)) + .totalCount(totalCount) + .build(); + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/service/BoundaryRelationshipService.java b/core-services/boundary-service/src/main/java/digit/service/BoundaryRelationshipService.java new file mode 100644 index 00000000000..2a2b81459d3 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/service/BoundaryRelationshipService.java @@ -0,0 +1,210 @@ +package digit.service; + +import digit.repository.BoundaryRelationshipRepository; +import digit.service.enrichment.BoundaryRelationshipEnricher; +import digit.service.validator.BoundaryRelationshipValidator; +import digit.util.HierarchyUtil; +import digit.web.models.*; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.ResponseInfoUtil; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class BoundaryRelationshipService { + + private BoundaryRelationshipValidator boundaryRelationshipValidator; + + private BoundaryRelationshipEnricher boundaryRelationshipEnricher; + + private BoundaryRelationshipRepository boundaryRelationshipRepository; + + private HierarchyUtil hierarchyUtil; + + public BoundaryRelationshipService(BoundaryRelationshipValidator boundaryRelationshipValidator, BoundaryRelationshipEnricher boundaryRelationshipEnricher, + BoundaryRelationshipRepository boundaryRelationshipRepository, HierarchyUtil hierarchyUtil) { + this.boundaryRelationshipValidator = boundaryRelationshipValidator; + this.boundaryRelationshipEnricher = boundaryRelationshipEnricher; + this.boundaryRelationshipRepository = boundaryRelationshipRepository; + this.hierarchyUtil = hierarchyUtil; + } + + /** + * Request handler for processing boundary relationship create requests. + * @param body + * @return + */ + public BoundaryRelationshipResponse createBoundaryRelationship(BoundaryRelationshipRequest body) { + + // Validate boundary relationship and get ancestral materialized path if successfully validated + String ancestralMaterializedPath = boundaryRelationshipValidator.validateBoundaryRelationshipCreateRequest(body); + + // Enrich boundary relationship + boundaryRelationshipEnricher.enrichBoundaryRelationshipCreateRequest(body, ancestralMaterializedPath); + + // Delegate request to repository + boundaryRelationshipRepository.create(body); + + // Create boundary relationship response and return + return BoundaryRelationshipResponse.builder() + .responseInfo(ResponseInfoUtil.createResponseInfoFromRequestInfo(body.getRequestInfo(), Boolean.TRUE)) + .tenantBoundary(Collections.singletonList(body.getBoundaryRelationship())) + .build(); + + } + + /** + * Request handler for processing boundary relationship search requests. + * @param boundaryRelationshipSearchCriteria + * @return + */ + public BoundarySearchResponse getBoundaryRelationships(BoundaryRelationshipSearchCriteria boundaryRelationshipSearchCriteria, RequestInfo requestInfo) { + + // Enrich search criteria + boundaryRelationshipEnricher.enrichSearchCriteria(boundaryRelationshipSearchCriteria); + + // Get list of boundary relationships based on provided search criteria + List boundaries = boundaryRelationshipRepository.search(boundaryRelationshipSearchCriteria); + + // Get parent boundaries if includeParents flag is checked + List parentBoundaries = getParentBoundaries(boundaries, boundaryRelationshipSearchCriteria); + + // Get children boundaries if includeChildren flag is checked + List childrenBoundaries = getChildrenBoundaries(boundaries, boundaryRelationshipSearchCriteria); + + // Add parents and children boundaries to main boundary search list + addParentsAndChildrenToBoundariesList(boundaries, parentBoundaries, childrenBoundaries); + + // Prepare search response for boundary search + BoundarySearchResponse boundarySearchResponse = boundaryRelationshipEnricher.createBoundaryRelationshipSearchResponse(boundaries, boundaryRelationshipSearchCriteria.getTenantId(), boundaryRelationshipSearchCriteria.getHierarchyType(), requestInfo); + + // Return boundary search response + return boundarySearchResponse; + } + + /** + * Service method to fetch children boundary DTOs. + * @param boundaries + * @param boundaryRelationshipSearchCriteria + * @return + */ + private List getChildrenBoundaries(List boundaries, BoundaryRelationshipSearchCriteria boundaryRelationshipSearchCriteria) { + List childrenBoundaries = new ArrayList<>(); + + // Fetch children boundary DTOs if includeChildren flag is set to true. + if (!CollectionUtils.isEmpty(boundaries) && boundaryRelationshipSearchCriteria.getIncludeChildren()) { + List currentBoundaryCodes = boundaries.stream() + .map(BoundaryRelationshipDTO::getCode) + .collect(Collectors.toList()); + + childrenBoundaries = boundaryRelationshipRepository.search(BoundaryRelationshipSearchCriteria.builder() + .tenantId(boundaryRelationshipSearchCriteria.getTenantId()) + .hierarchyType(boundaryRelationshipSearchCriteria.getHierarchyType()) + .currentBoundaryCodes(currentBoundaryCodes) + .build()); + } + + return childrenBoundaries; + } + + /** + * Service method to fetch parent boundary DTOs. + * @param boundaries + * @param boundaryRelationshipSearchCriteria + * @return + */ + private List getParentBoundaries(List boundaries, BoundaryRelationshipSearchCriteria boundaryRelationshipSearchCriteria) { + List parentBoundaries = new ArrayList<>(); + + // Fetch parent boundaries if includeParents flag is true. + if (!CollectionUtils.isEmpty(boundaries) && boundaryRelationshipSearchCriteria.getIncludeParents()) { + Set allAncestorCodes = boundaries.stream() + .map(dto -> dto.getAncestralMaterializedPath().split("\\|")) + .flatMap(Arrays::stream) + .collect(Collectors.toSet()); + + parentBoundaries = boundaryRelationshipRepository.search(BoundaryRelationshipSearchCriteria.builder() + .tenantId(boundaryRelationshipSearchCriteria.getTenantId()) + .hierarchyType(boundaryRelationshipSearchCriteria.getHierarchyType()) + .codes(new ArrayList<>(allAncestorCodes)) + .build()); + } + + return parentBoundaries; + } + + /** + * Request handler for processing boundary relationship update requests. + * @param body + * @return + */ + public BoundaryRelationshipResponse updateBoundaryRelationship(BoundaryRelationshipRequest body) { + + // Validate update request + BoundaryRelationshipRequestDTO validatedRelationshipDTORequest = boundaryRelationshipValidator.validateBoundaryRelationshipUpdateRequest(body); + + // Enrich update request + String oldParentCode = boundaryRelationshipEnricher.enrichBoundaryRelationshipUpdateRequest(body, validatedRelationshipDTORequest); + + // Fetch children boundaries + List childrenBoundaryRelationships = getChildrenBoundaries(Collections + .singletonList(validatedRelationshipDTORequest.getBoundaryRelationshipDTO()), BoundaryRelationshipSearchCriteria.builder() + .tenantId(validatedRelationshipDTORequest.getBoundaryRelationshipDTO().getTenantId()) + .hierarchyType(validatedRelationshipDTORequest.getBoundaryRelationshipDTO().getHierarchyType()) + .includeChildren(Boolean.TRUE) + .build()); + + // Update ancestral materialized path of children boundary relationships + preProcessNodesForUpdate(validatedRelationshipDTORequest, childrenBoundaryRelationships, oldParentCode); + + // Delegate request to repository + boundaryRelationshipRepository.update(validatedRelationshipDTORequest); + + // Return response + return BoundaryRelationshipResponse.builder() + .responseInfo(ResponseInfoUtil.createResponseInfoFromRequestInfo(body.getRequestInfo(), Boolean.TRUE)) + .tenantBoundary(Collections.singletonList(body.getBoundaryRelationship())) + .build(); + } + + /** + * This method updates ancestral materialized path in the node being updated along with its + * children nodes. + * @param validatedRelationshipDTORequest + * @param childrenBoundaryRelationships + * @param oldParentCode + */ + private void preProcessNodesForUpdate(BoundaryRelationshipRequestDTO validatedRelationshipDTORequest, List childrenBoundaryRelationships, String oldParentCode) { + // Add children boundary relationships to the list of nodes to be updated + List allNodesToBeUpdated = new ArrayList<>(childrenBoundaryRelationships); + + // Add the concerned boundary relationship which is being updated + allNodesToBeUpdated.add(validatedRelationshipDTORequest.getBoundaryRelationshipDTO()); + + // For each node, update ancestral materialized path - replace old parent code with new parent code + allNodesToBeUpdated.forEach(boundaryRelationship -> { + boundaryRelationship.setAncestralMaterializedPath(boundaryRelationship.getAncestralMaterializedPath() + .replace(oldParentCode, + validatedRelationshipDTORequest.getBoundaryRelationshipDTO().getParent())); + }); + + // Set list of nodes to be updated + validatedRelationshipDTORequest.setBoundaryRelationshipDTOList(allNodesToBeUpdated); + + } + + /** + * Add parent and children boundaries to searched boundaries list. + * @param boundaries + * @param parentBoundaries + * @param childrenBoundaries + */ + private void addParentsAndChildrenToBoundariesList(List boundaries, List parentBoundaries, List childrenBoundaries) { + boundaries.addAll(parentBoundaries); + boundaries.addAll(childrenBoundaries); + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/service/BoundaryService.java b/core-services/boundary-service/src/main/java/digit/service/BoundaryService.java new file mode 100644 index 00000000000..d8af57f5b7e --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/service/BoundaryService.java @@ -0,0 +1,104 @@ +package digit.service; + +import digit.config.ApplicationProperties; +import digit.repository.impl.BoundaryRepositoryImpl; +import digit.service.enrichment.BoundaryEntityEnricher; +import digit.service.validator.BoundaryEntityValidator; +import digit.util.ResponseUtil; +import digit.web.models.Boundary; +import digit.web.models.BoundaryRequest; +import digit.web.models.BoundaryResponse; +import digit.web.models.BoundarySearchCriteria; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.egov.common.utils.ResponseInfoUtil; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class BoundaryService { + + private BoundaryEntityValidator boundaryEntityValidator; + + private ResponseUtil responseUtil; + + private ApplicationProperties configuration; + + private BoundaryRepositoryImpl repository; + + public BoundaryService(BoundaryEntityValidator boundaryEntityValidator , ResponseUtil responseUtil, + ApplicationProperties configuration , BoundaryRepositoryImpl repository) { + + this.boundaryEntityValidator = boundaryEntityValidator; + this.responseUtil = responseUtil; + this.configuration = configuration; + this.repository = repository; + } + + /** + * This method is used to process a boundary entity creation request + * @param boundaryRequest is the request object + * @return boundaryResponse + */ + public BoundaryResponse createBoundary(BoundaryRequest boundaryRequest) { + + // validate the request + boundaryEntityValidator.validateCreateBoundaryRequest(boundaryRequest); + + // enrich the request + BoundaryEntityEnricher.enrichCreateBoundaryRequest(boundaryRequest); + + // create response + BoundaryResponse boundaryResponse = responseUtil.createBoundaryResponse(boundaryRequest); + + // delegating the request to repository to further persist in db + repository.create(boundaryRequest); + + return boundaryResponse; + } + + /** + * This method is used to search for boundary entity + * @param boundarySearchCriteria + * @return + */ + public BoundaryResponse searchBoundary(BoundarySearchCriteria boundarySearchCriteria , RequestInfo requestInfo) { + + // Search for boundary entity + List boundaryList = repository.search(boundarySearchCriteria); + + // create response info + ResponseInfo responseInfo = ResponseInfoUtil.createResponseInfoFromRequestInfo(requestInfo , Boolean.TRUE); + + // create response + BoundaryResponse boundaryResponse = BoundaryResponse.builder() + .boundary(boundaryList) + .responseInfo(responseInfo) + .build(); + + return boundaryResponse; + + } + + /** This method is used to process the update boundary entity request + * @param boundaryRequest is the request object + * @return boundaryResponse + */ + public BoundaryResponse updateBoundary(BoundaryRequest boundaryRequest) { + + // validate the request + boundaryEntityValidator.validateUpdateBoundaryRequest(boundaryRequest); + + // enrich the request + BoundaryEntityEnricher.enrichUpdateBoundaryRequest(boundaryRequest); + + // create response + BoundaryResponse boundaryResponse = responseUtil.createBoundaryResponse(boundaryRequest); + + // delegating the request to repository to update the record in db + repository.update(boundaryRequest); + + return boundaryResponse; + } +} diff --git a/core-services/boundary-service/src/main/java/digit/service/enrichment/BoundaryEntityEnricher.java b/core-services/boundary-service/src/main/java/digit/service/enrichment/BoundaryEntityEnricher.java new file mode 100644 index 00000000000..7eb28613f2e --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/service/enrichment/BoundaryEntityEnricher.java @@ -0,0 +1,35 @@ +package digit.service.enrichment; + +import digit.web.models.BoundaryRequest; +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.egov.common.utils.UUIDEnrichmentUtil; +import org.springframework.stereotype.Component; + +import java.util.UUID; + + +public class BoundaryEntityEnricher { + + private BoundaryEntityEnricher() {} + + /** + * Enrich the create boundary request + * param boundaryRequest + */ + public static void enrichCreateBoundaryRequest(BoundaryRequest boundaryRequest) { + boundaryRequest.getBoundary().forEach(boundary -> { + UUIDEnrichmentUtil.enrichRandomUuid(boundary,"id"); + boundary.setAuditDetails(AuditDetailsEnrichmentUtil.prepareAuditDetails(boundary.getAuditDetails(),boundaryRequest.getRequestInfo(),Boolean.TRUE)); + }); + } + + /** + * Enrich the update boundary request + * @param boundaryRequest + */ + public static void enrichUpdateBoundaryRequest(BoundaryRequest boundaryRequest) { + boundaryRequest.getBoundary().forEach(boundary -> { + boundary.setAuditDetails(AuditDetailsEnrichmentUtil.prepareAuditDetails(boundary.getAuditDetails(),boundaryRequest.getRequestInfo(),Boolean.FALSE)); + }); + } +} diff --git a/core-services/boundary-service/src/main/java/digit/service/enrichment/BoundaryHierarchyEnricher.java b/core-services/boundary-service/src/main/java/digit/service/enrichment/BoundaryHierarchyEnricher.java new file mode 100644 index 00000000000..c0b044b592e --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/service/enrichment/BoundaryHierarchyEnricher.java @@ -0,0 +1,48 @@ +package digit.service.enrichment; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.web.models.BoundaryTypeHierarchy; +import digit.web.models.BoundaryTypeHierarchyRequest; +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.egov.common.utils.UUIDEnrichmentUtil; +import org.egov.tracer.model.CustomException; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class BoundaryHierarchyEnricher { + + private ObjectMapper objectMapper; + + public BoundaryHierarchyEnricher(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + /** + * Method to enrich id, audit details and boundary hierarchy json node. + * @param body + */ + public void enrichBoundaryHierarchyDefinition(BoundaryTypeHierarchyRequest body) { + UUIDEnrichmentUtil.enrichRandomUuid(body.getBoundaryHierarchy(), "id"); + body.getBoundaryHierarchy().setAuditDetails(AuditDetailsEnrichmentUtil.prepareAuditDetails(body.getBoundaryHierarchy().getAuditDetails(), body.getRequestInfo(), Boolean.TRUE)); + body.getBoundaryHierarchy().setBoundaryHierarchyJsonNode(getBoundaryHierarchyJsonNode(body.getBoundaryHierarchy().getBoundaryHierarchy())); + } + + /** + * Method to convert list of boundary hierarchy POJOs to JsonNode for persisting. + * @param boundaryHierarchyList + * @return + */ + private JsonNode getBoundaryHierarchyJsonNode(List boundaryHierarchyList) { + try { + String jsonString = objectMapper.writeValueAsString(boundaryHierarchyList); + JsonNode jsonNode = objectMapper.readTree(jsonString); + return jsonNode; + } catch (Exception e) { + throw new CustomException("JSON_PARSING_ERROR", "Error in converting boundary hierarchy list to JSON"); + } + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/service/enrichment/BoundaryRelationshipEnricher.java b/core-services/boundary-service/src/main/java/digit/service/enrichment/BoundaryRelationshipEnricher.java new file mode 100644 index 00000000000..38856b81210 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/service/enrichment/BoundaryRelationshipEnricher.java @@ -0,0 +1,208 @@ +package digit.service.enrichment; + +import digit.util.HierarchyUtil; +import digit.web.models.*; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.egov.common.utils.ResponseInfoUtil; +import org.egov.common.utils.UUIDEnrichmentUtil; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; + +import java.util.*; +import java.util.stream.Collectors; + +@Component +public class BoundaryRelationshipEnricher { + + private HierarchyUtil hierarchyUtil; + + public BoundaryRelationshipEnricher(HierarchyUtil hierarchyUtil) { + this.hierarchyUtil = hierarchyUtil; + } + + /** + * Request handler for enriching boundary relationship request for id, auditDetails and ancestralMaterializedPath + * @param body + * @param ancestralMaterializedPath + */ + public void enrichBoundaryRelationshipCreateRequest(BoundaryRelationshipRequest body, String ancestralMaterializedPath) { + // Enrich uuid + UUIDEnrichmentUtil.enrichRandomUuid(body.getBoundaryRelationship(), "id"); + + // Enrich auditDetails + body.getBoundaryRelationship().setAuditDetails(AuditDetailsEnrichmentUtil.prepareAuditDetails(body.getBoundaryRelationship().getAuditDetails(), + body.getRequestInfo(), + Boolean.TRUE)); + + // Enrich ancestral materialized path + enrichAncestralMaterializedPath(body.getBoundaryRelationship(), ancestralMaterializedPath); + } + + /** + * Method for creating and setting ancestralMaterializedPath. + * @param boundaryRelationship + * @param ancestralMaterializedPath + */ + private void enrichAncestralMaterializedPath(BoundaryRelation boundaryRelationship, String ancestralMaterializedPath) { + // Enrich ancestral materialized path if current node is non-parent node + if(!ObjectUtils.isEmpty(boundaryRelationship.getParent())) { + if(ObjectUtils.isEmpty(ancestralMaterializedPath)) { + boundaryRelationship.setAncestralMaterializedPath(boundaryRelationship.getParent()); + } else { + boundaryRelationship.setAncestralMaterializedPath(ancestralMaterializedPath + "|" + boundaryRelationship.getParent()); + } + } + } + + /** + * Enrich root node search flag based on whether the search is for tenantId and hierarchyType. + * @param boundaryRelationshipSearchCriteria + */ + public void enrichSearchCriteria(BoundaryRelationshipSearchCriteria boundaryRelationshipSearchCriteria) { + if(!ObjectUtils.isEmpty(boundaryRelationshipSearchCriteria.getTenantId()) + && !ObjectUtils.isEmpty(boundaryRelationshipSearchCriteria.getHierarchyType()) + && (ObjectUtils.isEmpty(boundaryRelationshipSearchCriteria.getBoundaryType()) + && CollectionUtils.isEmpty(boundaryRelationshipSearchCriteria.getCodes()))) { + // Set flag for parent node search + boundaryRelationshipSearchCriteria.setIsSearchForRootNode(Boolean.TRUE); + } + } + + /** + * Method to create boundary relationship search response recursively from list of boundary relationships. + * @param boundaryRelationships + * @param tenantId + * @param hierarchyType + * @return boundarySearchResponse + */ + public BoundarySearchResponse createBoundaryRelationshipSearchResponse(List boundaryRelationships, String tenantId, String hierarchyType, RequestInfo requestInfo) { + + // Get hierarchy order + List hierarchyOrder = hierarchyUtil.getHierarchyOrder(tenantId, hierarchyType); + + // Convert DTO to EnrichedBoundary POJOs + List enrichedBoundaryList = convertBoundaryRelationshipToResponsePOJO(boundaryRelationships); + + // Create map of boundary type vs enriched boundaries + Map> boundaryTypeVsEnrichedBoundaries = enrichedBoundaryList.stream() + .collect(Collectors.groupingBy(EnrichedBoundary::getBoundaryType)); + + // Create map of parent vs children enriched boundaries + Map> parentVsChildrenEnrichedBoundaries = enrichedBoundaryList.stream() + .filter(boundaryRelationship -> Objects.nonNull(boundaryRelationship.getParent())) + .collect(Collectors.groupingBy(EnrichedBoundary::getParent)); + + // Get seed boundaries based on hierarchy order + List seedResponseBoundaries = getSeedBoundaryList(boundaryTypeVsEnrichedBoundaries, hierarchyOrder); + + // Create nested boundary structure recursively + mergeBoundariesRecursively(seedResponseBoundaries, parentVsChildrenEnrichedBoundaries); + + // Create HierarchyRelation POJO + HierarchyRelation hierarchyRelation = HierarchyRelation.builder() + .tenantId(tenantId) + .hierarchyType(hierarchyType) + .boundary(seedResponseBoundaries) + .build(); + + // Return response + return BoundarySearchResponse.builder() + .responseInfo(ResponseInfoUtil.createResponseInfoFromRequestInfo(requestInfo, Boolean.TRUE)) + .tenantBoundary(Collections.singletonList(hierarchyRelation)) + .build(); + } + + /** + * Method to recursive merge list of boundaries to form hierarchical boundary response. + * @param seedResponseBoundaries + * @param parentVsChildrenEnrichedBoundaries + */ + private void mergeBoundariesRecursively(List seedResponseBoundaries, Map> parentVsChildrenEnrichedBoundaries) { + // Base case + if(CollectionUtils.isEmpty(seedResponseBoundaries)) + return; + + // Traverse boundaries and add children to each boundary + seedResponseBoundaries.forEach(parentBoundary -> { + parentBoundary.setChildren(new ArrayList<>()); + + if(!CollectionUtils.isEmpty(parentVsChildrenEnrichedBoundaries.get(parentBoundary.getCode()))) { + parentBoundary.getChildren().addAll(parentVsChildrenEnrichedBoundaries.get(parentBoundary.getCode())); + mergeBoundariesRecursively(parentBoundary.getChildren(), parentVsChildrenEnrichedBoundaries); + } + }); + + } + + /** + * This method gets the boundaries based on hierarchy order, returning the list + * of boundaries belonging to the first boundary hierarchy type that it finds. + * @param boundaryTypeVsEnrichedBoundaries + * @param hierarchyOrder + * @return + */ + private List getSeedBoundaryList(Map> boundaryTypeVsEnrichedBoundaries, List hierarchyOrder) { + List seedBoundaryList = new ArrayList<>(); + + for(String boundaryType : hierarchyOrder) { + if(boundaryTypeVsEnrichedBoundaries.containsKey(boundaryType)) { + seedBoundaryList = boundaryTypeVsEnrichedBoundaries.get(boundaryType); + break; + } + } + + return seedBoundaryList; + } + + /** + * This method converts list of boundary relationship DTOs into response POJO i.e. EnrichedBoundary. + * @param boundaryRelationships + * @return + */ + private List convertBoundaryRelationshipToResponsePOJO(List boundaryRelationships) { + List enrichedBoundaryList = new ArrayList<>(); + + boundaryRelationships.forEach(boundaryRelationshipDTO -> { + enrichedBoundaryList.add(EnrichedBoundary.builder() + .id(boundaryRelationshipDTO.getId()) + .boundaryType(boundaryRelationshipDTO.getBoundaryType()) + .code(boundaryRelationshipDTO.getCode()) + .parent(boundaryRelationshipDTO.getParent()) + .children(new ArrayList<>()) + .build()); + }); + + return enrichedBoundaryList; + } + + /** + * This method enriches boundary relationship update request and returns back old parent + * of the boundary relationship being updated. + * @param body + * @param validatedBoundaryRelationshipDTOFromDB + * @return + */ + public String enrichBoundaryRelationshipUpdateRequest(BoundaryRelationshipRequest body, BoundaryRelationshipRequestDTO validatedBoundaryRelationshipDTOFromDB) { + // Capture old parent code + StringBuilder oldParentCode = new StringBuilder(validatedBoundaryRelationshipDTOFromDB + .getBoundaryRelationshipDTO() + .getParent()); + + // Set parent for update + validatedBoundaryRelationshipDTOFromDB.getBoundaryRelationshipDTO() + .setParent(body.getBoundaryRelationship().getParent()); + + // Enrich audit details for update + validatedBoundaryRelationshipDTOFromDB.getBoundaryRelationshipDTO() + .setAuditDetails(AuditDetailsEnrichmentUtil.prepareAuditDetails(validatedBoundaryRelationshipDTOFromDB + .getBoundaryRelationshipDTO().getAuditDetails(), body.getRequestInfo(), Boolean.FALSE)); + + // Enrich id and audit details back into the incoming request + body.getBoundaryRelationship().setId(validatedBoundaryRelationshipDTOFromDB.getBoundaryRelationshipDTO().getId()); + body.getBoundaryRelationship().setAuditDetails(validatedBoundaryRelationshipDTOFromDB.getBoundaryRelationshipDTO().getAuditDetails()); + + return oldParentCode.toString(); + } +} diff --git a/core-services/boundary-service/src/main/java/digit/service/validator/BoundaryEntityValidator.java b/core-services/boundary-service/src/main/java/digit/service/validator/BoundaryEntityValidator.java new file mode 100644 index 00000000000..5adb9ce51a1 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/service/validator/BoundaryEntityValidator.java @@ -0,0 +1,166 @@ +package digit.service.validator; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.constants.BoundaryConstants; +import digit.errors.ErrorCodes; +import digit.repository.impl.BoundaryRepositoryImpl; +import digit.util.GeoUtil; +import digit.web.models.*; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; + +import java.util.*; +import java.util.stream.Collectors; + +@Component +public class BoundaryEntityValidator { + + private final ObjectMapper objectMapper; + + private final BoundaryRepositoryImpl boundaryRepository; + + public BoundaryEntityValidator(ObjectMapper objectMapper, BoundaryRepositoryImpl boundaryRepository) { + this.objectMapper = objectMapper; + this.boundaryRepository = boundaryRepository; + } + + /** + * This method performs various validation for the boundary entity create request + * @1. Validate for valid geometry + * @2. Validate for unique tenantId and code + * @3. Validate for unique boundaries in the request + * @param boundaryRequest + */ + public void validateCreateBoundaryRequest(BoundaryRequest boundaryRequest) { + + // validate the geometry + validateBoundaryGeometry(boundaryRequest.getBoundary()); + + // validate for duplicate tenantId and code in the request + checkForDuplicatesInDB(boundaryRequest); + + // validate for unique boundaries in the request + checkForDuplicatesInRequest(boundaryRequest); + } + + /** + * This method is used to validate the update boundary entity request + * @param boundaryRequest + */ + public void validateUpdateBoundaryRequest(BoundaryRequest boundaryRequest) { + + // validate for code and tenantId to exist + validateIfBoundaryEntityExist(boundaryRequest); + + // validate for valid geometry + validateBoundaryGeometry(boundaryRequest.getBoundary()); + } + + /** + * This method takes a list of boundary entities and validates geometry of + * the boundary depending on its type. + * @param boundaryList + */ + private void validateBoundaryGeometry(List boundaryList) { + + boundaryList.forEach(boundary -> { + // Only execute if geometry is present + if (!boundary.getGeometry().isNull()) { + try { + if (boundary.getGeometry().get(BoundaryConstants.TYPE).asText().equals(BoundaryConstants.POINT)) { + GeoUtil.validatePointGeometry(objectMapper.treeToValue(boundary.getGeometry(), PointGeometry.class)); + + } else if (boundary.getGeometry().get(BoundaryConstants.TYPE).asText().equals(BoundaryConstants.POLYGON)) { + GeoUtil.validatePolygonGeometry(objectMapper.treeToValue(boundary.getGeometry(), PolygonGeometry.class)); + + } else { + throw new CustomException(ErrorCodes.INVALID_GEOMETRY_TYPE_CODE, ErrorCodes.INVALID_GEOMETRY_TYPE_MSG); + + } + } catch (JsonProcessingException e) { + + throw new CustomException(ErrorCodes.INVALID_GEOJSON_CODE, ErrorCodes.INVALID_GEOJSON_MSG); + } + } + }); + + } + + /** + * This method is used to create a map of tenantId to code from the request + * @param boundaryRequest + * @return + */ + public Map> createTenantIdtoCodeMap(BoundaryRequest boundaryRequest) { + return boundaryRequest.getBoundary().stream() + .collect(Collectors.groupingBy(Boundary::getTenantId, Collectors.mapping(Boundary::getCode, Collectors.toSet()))); + } + + /** + * This method is used to validate the uniqueness of tenantId and code in the request + * @param boundaryRequest + */ + public void checkForDuplicatesInDB(BoundaryRequest boundaryRequest) { + + // create a map of tenantId to code from request + Map> tenantIdToCodeMap = createTenantIdtoCodeMap(boundaryRequest); + + tenantIdToCodeMap.forEach((tenantId, codes) -> { + + // get the list of boundaries with the given tenantId and codes + List boundaryList = boundaryRepository.search( BoundarySearchCriteria.builder() + .tenantId(tenantId) + .codes(new ArrayList<>(codes)) + .limit(codes.size()) + .build()); + + // check if the code already exists in db + if (!CollectionUtils.isEmpty(boundaryList)) { + throw new CustomException(ErrorCodes.DUPLICATE_CODE_CODE , ErrorCodes.DUPLICATE_CODE_MSG + BoundaryConstants.OPENING_BRACKET + tenantId + "," + codes + BoundaryConstants.CLOSING_BRACKET); + } + }); + } + + /** + * This method is used to validate if the code and tenantId exist in the db before updating + * @param boundaryRequest + */ + public void validateIfBoundaryEntityExist(BoundaryRequest boundaryRequest) { + + // create a map of tenantId to code from request + Map> tenantIdToCodeMap = createTenantIdtoCodeMap(boundaryRequest); + + tenantIdToCodeMap.forEach((tenantId, codes) -> { + + // get the list of boundaries for a given tenantId and codes from db + List boundaryList = boundaryRepository.search(BoundarySearchCriteria.builder() + .tenantId(tenantId) + .codes(new ArrayList<>(codes)) + .limit(codes.size()) + .build()); + + // check if the code does not exists in db + if (boundaryList.size() != codes.size()) { + throw new CustomException(ErrorCodes.NOT_FOUND_CODE_AND_TENANT_ID_CODE , ErrorCodes.NOT_FOUND_CODE_AND_TENANT_ID_MSG + BoundaryConstants.OPENING_BRACKET + tenantId + "," + codes + BoundaryConstants.CLOSING_BRACKET ); + } + }); + } + + /** + * This method checks for unique boundaries in the request + * @param boundaryRequest + */ + public void checkForDuplicatesInRequest(BoundaryRequest boundaryRequest) { + + Set boundarySet = new HashSet<>(boundaryRequest.getBoundary()); + + // check if the size of the set is not equal to the size of the list then there are duplicates + if (boundarySet.size() != boundaryRequest.getBoundary().size()) { + throw new CustomException(ErrorCodes.DUPLICATE_BOUNDARY_CODE, ErrorCodes.DUPLICATE_BOUNDARY_MSG); + } + } +} diff --git a/core-services/boundary-service/src/main/java/digit/service/validator/BoundaryHierarchyValidator.java b/core-services/boundary-service/src/main/java/digit/service/validator/BoundaryHierarchyValidator.java new file mode 100644 index 00000000000..460799ddfa0 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/service/validator/BoundaryHierarchyValidator.java @@ -0,0 +1,109 @@ +package digit.service.validator; + +import digit.errors.ErrorCodes; +import digit.repository.BoundaryHierarchyRepository; +import digit.web.models.BoundaryTypeHierarchyRequest; +import digit.web.models.BoundaryTypeHierarchySearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.stream.Collectors; + +@Component +public class BoundaryHierarchyValidator { + + private BoundaryHierarchyRepository boundaryHierarchyRepository; + + @Autowired + public BoundaryHierarchyValidator(BoundaryHierarchyRepository boundaryHierarchyRepository) { + this.boundaryHierarchyRepository = boundaryHierarchyRepository; + } + + /** + * Parent method for handling boundary hierarchy request validation. + * @param body + */ + public void validateBoundaryTypeHierarchy(BoundaryTypeHierarchyRequest body) { + + // Validate if only single root node exists + validateIfSingleRootNodeExists(body); + + // Validate if provided boundary hierarchy forms a directed acyclic graph dependency + validateIfBoundaryHierarchyFormsDAG(body); + + // Validate if provided boundary hierarchy already exists + validateIfBoundaryHierarchyAlreadyExists(body); + + } + + /** + * This method receives boundary type hierarchy request and ensures that the + * provided hierarchy definition forms a directed acyclic dependency graph. + * @param body + */ + private void validateIfBoundaryHierarchyFormsDAG(BoundaryTypeHierarchyRequest body) { + + Map parentToChildMap = new LinkedHashMap<>(); + + // Populate parent boundaries + body.getBoundaryHierarchy().getBoundaryHierarchy().forEach(boundaryTypeHierarchy -> { + parentToChildMap.put(boundaryTypeHierarchy.getBoundaryType(), null); + }); + + // Check if the the hierarchy definition forms a directed acyclic graph + body.getBoundaryHierarchy().getBoundaryHierarchy().forEach(boundaryTypeHierarchy -> { + if(!ObjectUtils.isEmpty(boundaryTypeHierarchy.getParentBoundaryType())) { + + if(!parentToChildMap.containsKey(boundaryTypeHierarchy.getParentBoundaryType())) { + throw new CustomException(ErrorCodes.INVALID_HIERARCHY_DEFINITION_CODE , ErrorCodes.INVALID_HIERARCHY_DEFINITION_MSG + boundaryTypeHierarchy.getParentBoundaryType()); + } + + if(!ObjectUtils.isEmpty(parentToChildMap.get(boundaryTypeHierarchy.getParentBoundaryType()))) { + throw new CustomException(ErrorCodes.INVALID_HIERARCHY_ENTITY_DEFINITION_CODE, ErrorCodes.INVALID_HIERARCHY_ENTITY_DEFINITION_MSG); + } + + parentToChildMap.put(boundaryTypeHierarchy.getParentBoundaryType(), boundaryTypeHierarchy.getBoundaryType()); + } + }); + } + + /** + * This method validates if only a single root node has been defined in hierarchy definition. + * @param body + */ + private void validateIfSingleRootNodeExists(BoundaryTypeHierarchyRequest body) { + // Get number of nodes whose parent is null + Long nullParentCount = body.getBoundaryHierarchy().getBoundaryHierarchy().stream() + .filter(boundaryTypeHierarchy -> ObjectUtils.isEmpty(boundaryTypeHierarchy.getParentBoundaryType())) + .count(); + + if(nullParentCount > 1) { + throw new CustomException(ErrorCodes.MULTIPLE_ROOT_NODES_ERR_CODE, ErrorCodes.MULTIPLE_ROOT_NODES_ERR_MSG); + } + } + + /** + * This method validates if the provided boundary hierarchy is already created or not. + * @param body + */ + private void validateIfBoundaryHierarchyAlreadyExists(BoundaryTypeHierarchyRequest body) { + // Prepare boundary type hierarchy search criteria + BoundaryTypeHierarchySearchCriteria boundaryTypeHierarchySearchCriteria = BoundaryTypeHierarchySearchCriteria + .builder() + .tenantId(body.getBoundaryHierarchy().getTenantId()) + .hierarchyType(body.getBoundaryHierarchy().getHierarchyType()) + .build(); + + // Check if boundary type with the provided tenantId and hierarchy type already exists + if(!CollectionUtils.isEmpty(boundaryHierarchyRepository.search(boundaryTypeHierarchySearchCriteria))) { + throw new CustomException(ErrorCodes.DUPLICATE_RECORD_CODE, ErrorCodes.DUPLICATE_RECORD_MSG); + } + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/service/validator/BoundaryRelationshipValidator.java b/core-services/boundary-service/src/main/java/digit/service/validator/BoundaryRelationshipValidator.java new file mode 100644 index 00000000000..b5c3a15e888 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/service/validator/BoundaryRelationshipValidator.java @@ -0,0 +1,211 @@ +package digit.service.validator; + +import digit.repository.BoundaryRelationshipRepository; +import digit.repository.BoundaryRepository; +import digit.util.HierarchyUtil; +import digit.web.models.*; +import org.egov.tracer.model.CustomException; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +@Component +public class BoundaryRelationshipValidator { + + private BoundaryRelationshipRepository boundaryRelationshipRepository; + + private BoundaryRepository boundaryRepository; + + private HierarchyUtil hierarchyUtil; + + public BoundaryRelationshipValidator(BoundaryRelationshipRepository boundaryRelationshipRepository, BoundaryRepository boundaryRepository, + HierarchyUtil hierarchyUtil) { + this.boundaryRelationshipRepository = boundaryRelationshipRepository; + this.boundaryRepository = boundaryRepository; + this.hierarchyUtil = hierarchyUtil; + } + + /** + * This method performs business validations on boundary relationship create request. + * @param body + * @return + */ + public String validateBoundaryRelationshipCreateRequest(BoundaryRelationshipRequest body) { + // Check if boundary entity exists + validateIfBoundaryEntityExists(body); + + // Check for duplicates + checkDuplicates(body); + + // Check if parent boundary entity exists and return its materialized path and boundary type + GenericPair parentAttributes = validateParentAndReturnAttributes(body); + + // Check if the relationship being created has proper hierarchy + validateRelationshipForProperHierarchy(body, parentAttributes.getSecond()); + + // Return ancestralMaterializedPath of parent + return parentAttributes.getFirst(); + } + + /** + * This method performs validations on boundary relationship update request. + * @param body + */ + public BoundaryRelationshipRequestDTO validateBoundaryRelationshipUpdateRequest(BoundaryRelationshipRequest body) { + + // Validate existence of boundary relationship being updated + BoundaryRelationshipDTO boundaryRelationshipDTO = validateExistence(body); + + // Validate existence of parent and whether hierarchy is not disturbed + validateParentAndHierarchy(boundaryRelationshipDTO, body.getBoundaryRelationship()); + + // Return response + return BoundaryRelationshipRequestDTO.builder() + .boundaryRelationshipDTO(boundaryRelationshipDTO) + .requestInfo(body.getRequestInfo()) + .build(); + } + + /** + * This method validates existence of parent and ensures that hierarchy is not being disturbed by update. + * @param boundaryRelationshipDTO + * @param boundaryRelationship + */ + private void validateParentAndHierarchy(BoundaryRelationshipDTO boundaryRelationshipDTO, BoundaryRelation boundaryRelationship) { + // Validate root node hierarchy in case of update in root node + if(ObjectUtils.isEmpty(boundaryRelationshipDTO.getParent()) && !ObjectUtils.isEmpty(boundaryRelationship.getParent())) { + throw new CustomException("HIERARCHY_DISTURBED_ERR", "If a boundary relationship is created with root boundary type, it can't be made a child of any other boundary"); + } + + // Validate parent's existence and hierarchy + if(!ObjectUtils.isEmpty(boundaryRelationship.getParent())) { + List boundaryRelationshipDTOList = boundaryRelationshipRepository.search( + BoundaryRelationshipSearchCriteria.builder() + .hierarchyType(boundaryRelationship.getHierarchyType()) + .tenantId(boundaryRelationship.getTenantId()) + .codes(Collections.singletonList(boundaryRelationship.getParent())) + .build()); + + if(CollectionUtils.isEmpty(boundaryRelationshipDTOList)) { + throw new CustomException("BOUNDARY_RELATIONSHIP_DOES_NOT_EXIST", "Parent boundary relationship provided in update request does not exist"); + } + + if(!Objects.equals(boundaryRelationshipDTO.getBoundaryType(), boundaryRelationship.getBoundaryType())) { + throw new CustomException("HIERARCHY_DISTURBED_ERR", "Parent updates are only allowed horizontally."); + } + + } + + } + + /** + * This method validates existence of boundary relationship. + * @param body + */ + private BoundaryRelationshipDTO validateExistence(BoundaryRelationshipRequest body) { + List boundaryRelationshipDTOList = boundaryRelationshipRepository.search(BoundaryRelationshipSearchCriteria.builder() + .tenantId(body.getBoundaryRelationship().getTenantId()) + .hierarchyType(body.getBoundaryRelationship().getHierarchyType()) + .codes(Collections.singletonList(body.getBoundaryRelationship().getCode())) + .build()); + + if(CollectionUtils.isEmpty(boundaryRelationshipDTOList)) { + throw new CustomException("BOUNDARY_RELATIONSHIP_DOES_NOT_EXIST", "Provided boundary relationship for update does not exist"); + } + + return boundaryRelationshipDTOList.get(0); + } + + /** + * This method checks if the given boundary relationship already exists. + * @param body + */ + private void checkDuplicates(BoundaryRelationshipRequest body) { + List boundaryRelationshipDTOList = boundaryRelationshipRepository.search(BoundaryRelationshipSearchCriteria.builder() + .tenantId(body.getBoundaryRelationship().getTenantId()) + .hierarchyType(body.getBoundaryRelationship().getHierarchyType()) + .codes(Collections.singletonList(body.getBoundaryRelationship().getCode())) + .build()); + + if(!CollectionUtils.isEmpty(boundaryRelationshipDTOList)) { + throw new CustomException("DUPLICATE_RECORD", "Provided boundary relationship already exists"); + } + } + + /** + * This method validates if parent boundary exists and returns its attributes namely its + * materialized path and boundary type if it is found. + * @param body + * @return + */ + private GenericPair validateParentAndReturnAttributes(BoundaryRelationshipRequest body) { + String ancestralMaterializedPath = ""; + String boundaryType = body.getBoundaryRelationship().getBoundaryType(); + + if(!ObjectUtils.isEmpty(body.getBoundaryRelationship().getParent())) { + List resultSet = boundaryRelationshipRepository.search(BoundaryRelationshipSearchCriteria.builder() + .tenantId(body.getBoundaryRelationship().getTenantId()) + .hierarchyType(body.getBoundaryRelationship().getHierarchyType()) + .codes(Collections.singletonList(body.getBoundaryRelationship().getParent())) + .build()); + + if(CollectionUtils.isEmpty(resultSet)) { + throw new CustomException("PARENT_NOT_FOUND", "Parent entity for current boundary relationship does not exist."); + } else { + ancestralMaterializedPath = resultSet.get(0).getAncestralMaterializedPath(); + boundaryType = resultSet.get(0).getBoundaryType(); + } + } + + GenericPair ancestralMaterializedPathAndBoundaryTypePair = GenericPair.builder() + .first(ancestralMaterializedPath) + .second(boundaryType) + .build(); + + return ancestralMaterializedPathAndBoundaryTypePair; + } + + /** + * This helper method validates boundary relationship for proper hierarchy. + * @param body + * @param parentBoundaryType + */ + private void validateRelationshipForProperHierarchy(BoundaryRelationshipRequest body, String parentBoundaryType) { + List hierarchyOrder = hierarchyUtil.getHierarchyOrder(body.getBoundaryRelationship().getTenantId(), + body.getBoundaryRelationship().getHierarchyType()); + + if(!hierarchyOrder.contains(body.getBoundaryRelationship().getBoundaryType())) { + throw new CustomException("BOUNDARY_TYPE_ERROR", "The provided boundary type is not a part of provided hierarchy definition."); + } + + if(ObjectUtils.isEmpty(body.getBoundaryRelationship().getParent())) { + if(!Objects.equals(body.getBoundaryRelationship().getBoundaryType(), hierarchyOrder.get(0))) { + throw new CustomException("HIERARCHY_ERROR", "Boundary relationship without defined parent should have root boundary hierarchy type."); + } + } else{ + if(!body.getBoundaryRelationship().getBoundaryType().equals(hierarchyOrder.get(hierarchyOrder.indexOf(parentBoundaryType) + 1))) { + throw new CustomException("HIERARCHY_ERROR", "Hierarchy of child should be the direct descendant of parent's boundary hierarchy type."); + } + } + } + + /** + * This method validates if boundary entity exists. + * @param body + */ + private void validateIfBoundaryEntityExists(BoundaryRelationshipRequest body) { + List boundaryList = boundaryRepository.search(BoundarySearchCriteria.builder() + .tenantId(body.getBoundaryRelationship().getTenantId()) + .codes(Collections.singletonList(body.getBoundaryRelationship().getCode())) + .build()); + + if(CollectionUtils.isEmpty(boundaryList)) { + throw new CustomException("BOUNDARY_ENTITY_DOES_NOT_EXIST", "Boundary entity does not exist."); + } + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/util/BoundaryConstants.java b/core-services/boundary-service/src/main/java/digit/util/BoundaryConstants.java new file mode 100644 index 00000000000..649deffe28a --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/util/BoundaryConstants.java @@ -0,0 +1,14 @@ +package digit.util; + +public class BoundaryConstants { + public static final String X_UNIQUE_KEY = "x-unique"; + public static final String X_REFERENCE_SCHEMA_KEY = "x-ref-schema"; + public static final String REQUIRED_KEY = "required"; + public static final String DOT_SEPARATOR = "."; + public static final String DOT_REGEX = "\\."; + public static final String FORWARD_SLASH = "/"; + public static final String DOLLAR_DOT = "$."; + public static final String FIELD_PATH_KEY = "fieldPath"; + public static final String SCHEMA_CODE_KEY = "schemaCode"; + +} diff --git a/core-services/boundary-service/src/main/java/digit/util/ErrorUtil.java b/core-services/boundary-service/src/main/java/digit/util/ErrorUtil.java new file mode 100644 index 00000000000..1e3c95a85cc --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/util/ErrorUtil.java @@ -0,0 +1,21 @@ +package digit.util; + +import org.egov.tracer.model.CustomException; + +import java.util.Map; + +public class ErrorUtil { + + private ErrorUtil(){} + + /** + * This method throws custom exception for a map of exceptions + * @param exceptions + */ + public static void throwCustomExceptions(Map exceptions) { + if (!exceptions.isEmpty()) { + throw new CustomException(exceptions); + } + } + +} \ No newline at end of file diff --git a/core-services/boundary-service/src/main/java/digit/util/GeoUtil.java b/core-services/boundary-service/src/main/java/digit/util/GeoUtil.java new file mode 100644 index 00000000000..f1e58c368ec --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/util/GeoUtil.java @@ -0,0 +1,55 @@ +package digit.util; + +import digit.errors.ErrorCodes; +import digit.web.models.PointGeometry; +import digit.web.models.PolygonGeometry; +import org.egov.tracer.model.CustomException; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public class GeoUtil { + + private GeoUtil() {} + + public static void validatePointGeometry(PointGeometry pointGeometry) { + validatePositions(Collections.singletonList(pointGeometry.getCoordinates())); + } + + public static void validatePolygonGeometry(PolygonGeometry polygonGeometry) { + validateIfPolygonIsSimple(polygonGeometry.getCoordinates()); + validatePositions(polygonGeometry.getCoordinates().get(0)); + validateIfPolygonIsClosed(polygonGeometry.getCoordinates().get(0)); + } + + private static void validateIfPolygonIsSimple(List>> coordinates) { + if(coordinates.size() != 1) { + throw new CustomException(ErrorCodes.INVALID_POLYGON_CODE,ErrorCodes.INVALID_POLYGON_MSG); + } + + if(coordinates.get(0).size() < 5) { + throw new CustomException(ErrorCodes.INVALID_POLYGON_COORDINATES_DEFINITION_CODE, ErrorCodes.INVALID_POLYGON_COORDINATES_DEFINITION_MSG); + } + } + + private static void validatePositions(List> coordinatesList) { + coordinatesList.forEach(coordinate -> { + if(coordinate.size() != 2) { + throw new CustomException(ErrorCodes.INVALID_POSITION_CODE, ErrorCodes.INVALID_POSITION_MSG); + } + }); + } + + private static void validateIfPolygonIsClosed(List> coordinatesList) { + if(coordinatesList.size() >= 5) { + List startCoordinate = coordinatesList.get(0); + List endCoordinate = coordinatesList.get(coordinatesList.size() - 1); + if(!Objects.equals(startCoordinate.get(0), endCoordinate.get(0)) || !Objects.equals(startCoordinate.get(1), endCoordinate.get(1))) { + throw new CustomException(ErrorCodes.INVALID_POLYGON_DEFINITION_CODE, ErrorCodes.INVALID_POLYGON_DEFINITION_MSG); + } + } + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/util/HierarchyUtil.java b/core-services/boundary-service/src/main/java/digit/util/HierarchyUtil.java new file mode 100644 index 00000000000..fec2ed5214d --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/util/HierarchyUtil.java @@ -0,0 +1,95 @@ +package digit.util; + +import digit.repository.BoundaryHierarchyRepository; +import digit.repository.querybuilder.BoundaryHierarchyTypeQueryBuilder; +import digit.web.models.BoundaryTypeHierarchy; +import digit.web.models.BoundaryTypeHierarchyDefinition; +import digit.web.models.BoundaryTypeHierarchySearchCriteria; +import org.egov.tracer.model.CustomException; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.IntStream; + +@Component +public class HierarchyUtil { + + private BoundaryHierarchyRepository boundaryHierarchyRepository; + + private BoundaryHierarchyTypeQueryBuilder boundaryHierarchyTypeQueryBuilder; + + private JdbcTemplate jdbcTemplate; + + public HierarchyUtil(BoundaryHierarchyRepository boundaryHierarchyRepository, BoundaryHierarchyTypeQueryBuilder boundaryHierarchyTypeQueryBuilder, JdbcTemplate jdbcTemplate) { + this.boundaryHierarchyRepository = boundaryHierarchyRepository; + this.boundaryHierarchyTypeQueryBuilder = boundaryHierarchyTypeQueryBuilder; + this.jdbcTemplate = jdbcTemplate; + } + + /** + * This method gives the hierarchy order from hierarchy definition. + * @param tenantId + * @param hierarchyType + * @return + */ + public List getHierarchyOrder(String tenantId, String hierarchyType) { + List boundaryTypeHierarchyDefinitionList = boundaryHierarchyRepository.search(BoundaryTypeHierarchySearchCriteria.builder() + .tenantId(tenantId) + .hierarchyType(hierarchyType) + .build()); + + if(CollectionUtils.isEmpty(boundaryTypeHierarchyDefinitionList)) { + throw new CustomException("HIERARCHY_DEFINITION_DOES_NOT_EXIST_ERR", "Hierarchy definition does not exist"); + } + + List boundaryTypeHierarchyList = boundaryTypeHierarchyDefinitionList.get(0).getBoundaryHierarchy(); + + Map parentToChildMap = prepareParentToChildMap(boundaryTypeHierarchyList); + + List hierarchyOrder = new ArrayList<>(); + + String rootHierarchyNode = boundaryTypeHierarchyList + .stream() + .filter(hierarchyNode -> ObjectUtils.isEmpty(hierarchyNode.getParentBoundaryType())) + .findFirst() + .get() + .getBoundaryType(); + + hierarchyOrder.add(rootHierarchyNode); + + IntStream.range(0, boundaryTypeHierarchyList.size() - 1).forEach(i -> { + hierarchyOrder.add(parentToChildMap.get(hierarchyOrder.get(i))); + }); + + return hierarchyOrder; + } + + private Map prepareParentToChildMap(List boundaryTypeHierarchyList) { + Map parentToChildMap = new HashMap<>(); + + boundaryTypeHierarchyList.forEach(boundaryTypeHierarchy -> { + if(!ObjectUtils.isEmpty(boundaryTypeHierarchy.getParentBoundaryType())) { + parentToChildMap.put(boundaryTypeHierarchy.getParentBoundaryType(), boundaryTypeHierarchy.getBoundaryType()); + } + }); + + return parentToChildMap; + } + + /** + * This method gives the total count of hierarchy definition based on the search criteria. + * @param boundaryTypeHierarchySearchCriteria + * @return + */ + public Integer getBoundaryTypeHierarchyDefinitionCount(BoundaryTypeHierarchySearchCriteria boundaryTypeHierarchySearchCriteria) { + List preparedStmtList = new ArrayList<>(); + String query = boundaryHierarchyTypeQueryBuilder.getBoundaryHierarchyTypeCountQuery(boundaryTypeHierarchySearchCriteria, preparedStmtList); + return jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); + } +} diff --git a/core-services/boundary-service/src/main/java/digit/util/QueryUtil.java b/core-services/boundary-service/src/main/java/digit/util/QueryUtil.java new file mode 100644 index 00000000000..64a1b33a3bd --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/util/QueryUtil.java @@ -0,0 +1,131 @@ +package digit.util; + +import com.google.gson.Gson; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.IntStream; + +import static digit.util.BoundaryConstants.*; + +public class QueryUtil { + + private QueryUtil() { + } + + private static final Gson gson = new Gson(); + + /** + * This method aids in adding "WHERE" clause and "AND" condition depending on preparedStatementList i.e., + * if preparedStatementList is empty, it will understand that it is the first clause being added so it + * will add "WHERE" to the query and otherwise it will + * + * @param query + * @param preparedStmtList + */ + public static void addClauseIfRequired(StringBuilder query, List preparedStmtList) { + if (preparedStmtList.isEmpty()) { + query.append(" WHERE "); + } else { + query.append(" AND "); + } + } + + /** + * This method returns a string with placeholders equal to the number of values that need to be put inside + * "IN" clause + * + * @param size + * @return + */ + public static String createQuery(Integer size) { + StringBuilder builder = new StringBuilder(); + + IntStream.range(0, size).forEach(i -> { + builder.append(" ?"); + if (i != size - 1) + builder.append(","); + }); + + return builder.toString(); + } + + /** + * This method adds a set of String values into preparedStatementList + * + * @param preparedStmtList + * @param ids + */ + public static void addToPreparedStatement(List preparedStmtList, Set ids) { + ids.forEach(id -> { + preparedStmtList.add(id); + }); + } + + /** + * This method appends order by clause to the query + * + * @param query + * @param orderByClause + * @return + */ + public static String addOrderByClause(String query, String orderByClause) { + return query + orderByClause; + } + + /** + * This method prepares partial json string from the filter map to query on jsonb column + * + * @param filterMap + * @return + */ + public static String preparePartialJsonStringFromFilterMap(Map filterMap) { + Map queryMap = new HashMap<>(); + + filterMap.keySet().forEach(key -> { + if (key.contains(DOT_SEPARATOR)) { + String[] keyArray = key.split(DOT_REGEX); + Map nestedQueryMap = new HashMap<>(); + prepareNestedQueryMap(0, keyArray, nestedQueryMap, filterMap.get(key)); + queryMap.put(keyArray[0], nestedQueryMap.get(keyArray[0])); + } else { + queryMap.put(key, filterMap.get(key)); + } + }); + + String partialJsonQueryString = gson.toJson(queryMap); + + return partialJsonQueryString; + } + + /** + * Tail recursive method to prepare n-level nested partial json for queries on nested data in + * master data. For e.g. , if the key is in the format a.b.c, it will construct a nested json + * object of the form - {"a":{"b":{"c": "value"}}} + * + * @param index + * @param nestedKeyArray + * @param currentQueryMap + * @param value + */ + private static void prepareNestedQueryMap(int index, String[] nestedKeyArray, Map currentQueryMap, String value) { + // Return when all levels have been reached. + if (index == nestedKeyArray.length) + return; + + // For the final level simply put the value in the map. + else if (index == nestedKeyArray.length - 1) { + currentQueryMap.put(nestedKeyArray[index], value); + return; + } + + // For non terminal levels, add a child map. + currentQueryMap.put(nestedKeyArray[index], new HashMap<>()); + + // Make a recursive call to enrich data in next level. + prepareNestedQueryMap(index + 1, nestedKeyArray, (Map) currentQueryMap.get(nestedKeyArray[index]), value); + } + +} \ No newline at end of file diff --git a/core-services/boundary-service/src/main/java/digit/util/ResponseInfoFactory.java b/core-services/boundary-service/src/main/java/digit/util/ResponseInfoFactory.java new file mode 100644 index 00000000000..2e8de331cbe --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/util/ResponseInfoFactory.java @@ -0,0 +1,27 @@ +package digit.util; + +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.stereotype.Component; + +import static digit.constants.BoundaryConstants.*; + +@Component +public class ResponseInfoFactory { + + public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { + + final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; + final String ver = requestInfo != null ? requestInfo.getVer() : ""; + Long ts = null; + if(requestInfo!=null) + ts = requestInfo.getTs(); + final String resMsgId = RES_MSG_ID; // FIXME : Hard-coded + final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; + final String responseStatus = success ? SUCCESSFUL : FAILED; + + return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) + .status(responseStatus).build(); + } + +} \ No newline at end of file diff --git a/core-services/boundary-service/src/main/java/digit/util/ResponseUtil.java b/core-services/boundary-service/src/main/java/digit/util/ResponseUtil.java new file mode 100644 index 00000000000..797abaa1ff7 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/util/ResponseUtil.java @@ -0,0 +1,20 @@ +package digit.util; + +import digit.web.models.BoundaryRequest; +import digit.web.models.BoundaryResponse; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class ResponseUtil { + + @Autowired + private ResponseInfoFactory responseInfoFactory; + + public BoundaryResponse createBoundaryResponse(BoundaryRequest boundaryRequest) { + ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(boundaryRequest.getRequestInfo(), true); + BoundaryResponse boundaryResponse = BoundaryResponse.builder().responseInfo(responseInfo).boundary(boundaryRequest.getBoundary()).build(); + return boundaryResponse; + } +} diff --git a/core-services/boundary-service/src/main/java/digit/web/controllers/BoundaryController.java b/core-services/boundary-service/src/main/java/digit/web/controllers/BoundaryController.java new file mode 100644 index 00000000000..502a35a8d12 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/controllers/BoundaryController.java @@ -0,0 +1,58 @@ +package digit.web.controllers; + +import digit.service.BoundaryService; +import digit.web.models.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import jakarta.validation.Valid; + +@Controller +@RequestMapping("/boundary") +public class BoundaryController { + + private BoundaryService boundaryService; + + @Autowired + public BoundaryController(BoundaryService boundaryService) { + this.boundaryService = boundaryService; + } + + /** + * Request handler for serving boundary entities create request. + * @param body + * @return + */ + @RequestMapping(value = "/_create", method = RequestMethod.POST) + public ResponseEntity create(@Valid @RequestBody BoundaryRequest body) { + BoundaryResponse boundaryResponse = boundaryService.createBoundary(body); + return new ResponseEntity<>(boundaryResponse, HttpStatus.ACCEPTED); + } + + /** + * Request handler for serving boundary entities search request. + * @param boundarySearchCriteria + * @param requestInfo + * @return + */ + @RequestMapping(value = "/_search", method = RequestMethod.POST) + public ResponseEntity search(@Valid @ModelAttribute BoundarySearchCriteria boundarySearchCriteria, @RequestBody RequestInfo requestInfo) { + BoundaryResponse boundaryResponse = boundaryService.searchBoundary(boundarySearchCriteria,requestInfo); + return new ResponseEntity<>(boundaryResponse, HttpStatus.OK); + } + + /** + * Request handler for serving boundary entities update request. + * @param body + * @return + */ + @RequestMapping(value = "/_update", method = RequestMethod.POST) + public ResponseEntity update(@Valid @RequestBody BoundaryRequest body) { + BoundaryResponse boundaryResponse = boundaryService.updateBoundary(body); + return new ResponseEntity<>(boundaryResponse,HttpStatus.ACCEPTED); + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/controllers/BoundaryRelationshipController.java b/core-services/boundary-service/src/main/java/digit/web/controllers/BoundaryRelationshipController.java new file mode 100644 index 00000000000..836ba8f4007 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/controllers/BoundaryRelationshipController.java @@ -0,0 +1,59 @@ +package digit.web.controllers; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import digit.service.BoundaryRelationshipService; +import digit.web.models.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import jakarta.validation.Valid; + +@Controller +@RequestMapping("/boundary-relationships") +public class BoundaryRelationshipController { + + private BoundaryRelationshipService boundaryRelationshipService; + + @Autowired + public BoundaryRelationshipController(BoundaryRelationshipService boundaryRelationshipService) { + this.boundaryRelationshipService = boundaryRelationshipService; + } + + /** + * Request handler for serving boundary relationships create request. + * @param body + * @return + */ + @RequestMapping(value = "/_create", method = RequestMethod.POST) + public ResponseEntity create(@Valid @RequestBody BoundaryRelationshipRequest body) { + BoundaryRelationshipResponse boundaryRelationshipResponse = boundaryRelationshipService.createBoundaryRelationship(body); + return new ResponseEntity<>(boundaryRelationshipResponse, HttpStatus.ACCEPTED); + } + + /** + * Request handler for serving boundary relationships search request. + * @param boundaryRelationshipSearchCriteria + * @param requestInfo + * @return + */ + @RequestMapping(value = "/_search", method = RequestMethod.POST) + public ResponseEntity search(@Valid @ModelAttribute BoundaryRelationshipSearchCriteria boundaryRelationshipSearchCriteria, @RequestBody RequestInfo requestInfo) { + BoundarySearchResponse boundarySearchResponse = boundaryRelationshipService.getBoundaryRelationships(boundaryRelationshipSearchCriteria, requestInfo); + return new ResponseEntity<>(boundarySearchResponse, HttpStatus.OK); + } + + /** + * Request handler for serving boundary relationships update request. + * @param body + * @return + */ + @RequestMapping(value = "/_update", method = RequestMethod.POST) + public ResponseEntity update(@Valid @RequestBody BoundaryRelationshipRequest body) { + BoundaryRelationshipResponse boundaryRelationshipResponse = boundaryRelationshipService.updateBoundaryRelationship(body); + return new ResponseEntity<>(boundaryRelationshipResponse, HttpStatus.ACCEPTED); + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/controllers/HierarchyDefinitionController.java b/core-services/boundary-service/src/main/java/digit/web/controllers/HierarchyDefinitionController.java new file mode 100644 index 00000000000..852b59be391 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/controllers/HierarchyDefinitionController.java @@ -0,0 +1,45 @@ +package digit.web.controllers; + +import digit.service.BoundaryHierarchyDefinitionService; +import digit.web.models.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import jakarta.validation.Valid; + +@Controller +@RequestMapping("/boundary-hierarchy-definition") +public class HierarchyDefinitionController { + + private BoundaryHierarchyDefinitionService boundaryHierarchyDefinitionService; + + @Autowired + public HierarchyDefinitionController(BoundaryHierarchyDefinitionService boundaryHierarchyDefinitionService) { + this.boundaryHierarchyDefinitionService = boundaryHierarchyDefinitionService; + } + + /** + * Request handler for serving hierarchy definition create requests. + * @param body + * @return + */ + @RequestMapping(value = "/_create", method = RequestMethod.POST) + public ResponseEntity create(@Valid @RequestBody BoundaryTypeHierarchyRequest body) { + BoundaryTypeHierarchyResponse boundaryTypeHierarchyResponse = boundaryHierarchyDefinitionService.createBoundaryHierarchyDefinition(body); + return new ResponseEntity<>(boundaryTypeHierarchyResponse, HttpStatus.ACCEPTED); + } + + /** + * Request handler for serving hierarchy definition search requests. + * @param body + * @return + */ + @RequestMapping(value = "/_search", method = RequestMethod.POST) + public ResponseEntity search(@Valid @RequestBody BoundaryTypeHierarchySearchRequest body) { + BoundaryTypeHierarchyResponse boundaryTypeHierarchyResponse = boundaryHierarchyDefinitionService.searchBoundaryHierarchyDefinition(body); + return new ResponseEntity<>(boundaryTypeHierarchyResponse, HttpStatus.OK); + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/Boundary.java b/core-services/boundary-service/src/main/java/digit/web/models/Boundary.java new file mode 100644 index 00000000000..2f9de8bd825 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/Boundary.java @@ -0,0 +1,46 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * Boundary + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Boundary { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("code") + @NotNull + private String code = null; + + @JsonProperty("geometry") + @Valid + private JsonNode geometry = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + @JsonProperty("additionalDetails") + private JsonNode additionalDetails = null; +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelation.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelation.java new file mode 100644 index 00000000000..6081b599281 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelation.java @@ -0,0 +1,52 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.constraints.*; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryRelation + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRelation { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("code") + @NotNull + private String code = null; + + @JsonProperty("tenantId") + @NotNull + private String tenantId = null; + + @JsonProperty("hierarchyType") + @NotNull + private String hierarchyType = null; + + @JsonProperty("boundaryType") + @NotNull + private String boundaryType = null; + + @JsonProperty("parent") + private String parent = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + @JsonIgnore + private String ancestralMaterializedPath = ""; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipDTO.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipDTO.java new file mode 100644 index 00000000000..21ed90d685e --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipDTO.java @@ -0,0 +1,48 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.constraints.NotNull; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRelationshipDTO { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("code") + @NotNull + private String code = null; + + @JsonProperty("tenantId") + @NotNull + private String tenantId = null; + + @JsonProperty("hierarchyType") + @NotNull + private String hierarchyType = null; + + @JsonProperty("boundaryType") + @NotNull + private String boundaryType = null; + + @JsonProperty("parent") + private String parent = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + @JsonProperty("ancestralMaterializedPath") + private String ancestralMaterializedPath = null; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipRequest.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipRequest.java new file mode 100644 index 00000000000..fa020d9665f --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipRequest.java @@ -0,0 +1,34 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryRelationshipRequest + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRelationshipRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("BoundaryRelationship") + @Valid + private BoundaryRelation boundaryRelationship = null; + + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipRequestDTO.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipRequestDTO.java new file mode 100644 index 00000000000..012535bf8e1 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipRequestDTO.java @@ -0,0 +1,27 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRelationshipRequestDTO { + + @JsonProperty("BoundaryRelationship") + private BoundaryRelationshipDTO boundaryRelationshipDTO; + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @JsonProperty("BoundaryRelationshipList") + private List boundaryRelationshipDTOList; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipResponse.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipResponse.java new file mode 100644 index 00000000000..73aff33b2ef --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipResponse.java @@ -0,0 +1,37 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; + +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryRelationshipResponse + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRelationshipResponse { + + @JsonProperty("ResponseInfo") + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("TenantBoundary") + @Valid + private List tenantBoundary = null; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipSearchCriteria.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipSearchCriteria.java new file mode 100644 index 00000000000..ba6548ceea6 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRelationshipSearchCriteria.java @@ -0,0 +1,61 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRelationshipSearchCriteria { + + @NotNull + @Size(max = 64) + @JsonProperty("tenantId") + private String tenantId = null; + + @NotNull + @Size(max = 64) + @JsonProperty("hierarchyType") + private String hierarchyType = null; + + @Size(max = 64) + @JsonProperty("boundaryType") + private String boundaryType = null; + + @JsonProperty("codes") + private List codes = null; + + @Size(max = 64) + @JsonProperty("parent") + private String parent = null; + + + @JsonProperty("includeChildren") + @Builder.Default + private Boolean includeChildren = Boolean.FALSE; + + @JsonProperty("includeParents") + @Builder.Default + private Boolean includeParents = Boolean.FALSE; + + @JsonIgnore + @Builder.Default + private Boolean isSearchForRootNode = Boolean.FALSE; + + @JsonIgnore + @Builder.Default + private List currentBoundaryCodes = new ArrayList<>(); + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRequest.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRequest.java new file mode 100644 index 00000000000..f650a57bba1 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryRequest.java @@ -0,0 +1,45 @@ +package digit.web.models; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import digit.web.models.Boundary; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.ArrayList; +import java.util.List; + +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryRequest + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @Valid + @NotNull + @JsonProperty("Boundary") + @Size(min = 1, max = 300) + private List boundary = null; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryResponse.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryResponse.java new file mode 100644 index 00000000000..e9fb53149f5 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryResponse.java @@ -0,0 +1,52 @@ +package digit.web.models; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import digit.web.models.Boundary; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.ArrayList; +import java.util.List; + +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryResponse + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryResponse { + + @JsonProperty("ResponseInfo") + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("Boundary") + @Valid + private List boundary = null; + + + public BoundaryResponse addBoundaryItem(Boundary boundaryItem) { + if (this.boundary == null) { + this.boundary = new ArrayList<>(); + } + this.boundary.add(boundaryItem); + return this; + } + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundarySearchCriteria.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundarySearchCriteria.java new file mode 100644 index 00000000000..3743b94ab46 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundarySearchCriteria.java @@ -0,0 +1,36 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import java.util.List; + +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundarySearchCriteria { + + @NotNull + @Size(min = 1) + @JsonProperty("codes") + private List codes; + + @NotNull + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("offset") + private Integer offset; + + @JsonProperty("limit") + private Integer limit; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundarySearchResponse.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundarySearchResponse.java new file mode 100644 index 00000000000..b0bf868e659 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundarySearchResponse.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.Valid; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundarySearchResponse + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundarySearchResponse { + + @JsonProperty("ResponseInfo") + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("TenantBoundary") + @Valid + private List tenantBoundary = null; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryType.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryType.java new file mode 100644 index 00000000000..cb3e17ef10f --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryType.java @@ -0,0 +1,43 @@ +package digit.web.models; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryType + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryType { + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("id") + private String id = null; + + @JsonProperty("code") + @NotNull + private String code = null; + + @JsonProperty("active") + private Boolean active = null; + + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchy.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchy.java new file mode 100644 index 00000000000..44921b97568 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchy.java @@ -0,0 +1,38 @@ +package digit.web.models; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryTypeHierarchy + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchy { + + @JsonProperty("boundaryType") + private String boundaryType = null; + + @JsonProperty("parentBoundaryType") + private String parentBoundaryType = null; + + @JsonProperty("active") + private Boolean active = null; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchyDefinition.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchyDefinition.java new file mode 100644 index 00000000000..0181350f746 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchyDefinition.java @@ -0,0 +1,55 @@ +package digit.web.models; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.databind.JsonNode; +import digit.web.models.BoundaryTypeHierarchy; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.ArrayList; +import java.util.List; + +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryTypeHierarchyDefinition + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchyDefinition { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("hierarchyType") + private String hierarchyType = null; + + @JsonProperty("boundaryHierarchy") + @Valid + private List boundaryHierarchy = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + @JsonProperty("boundaryHierarchyJsonNode") + private JsonNode boundaryHierarchyJsonNode = null; + +} \ No newline at end of file diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchyRequest.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchyRequest.java new file mode 100644 index 00000000000..984ce8428b8 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchyRequest.java @@ -0,0 +1,31 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.Valid; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryTypeHierarchyRequest + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchyRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("BoundaryHierarchy") + @Valid + private BoundaryTypeHierarchyDefinition boundaryHierarchy = null; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchyResponse.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchyResponse.java new file mode 100644 index 00000000000..e52bf7ce2ef --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchyResponse.java @@ -0,0 +1,39 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +import java.util.List; + +/** + * BoundaryTypeHierarchyResponse + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchyResponse { + + @JsonProperty("ResponseInfo") + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("totalCount") + private Integer totalCount = null; + + @JsonProperty("BoundaryHierarchy") + @Valid + private List boundaryHierarchy = null; + +} \ No newline at end of file diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchySearchCriteria.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchySearchCriteria.java new file mode 100644 index 00000000000..a278d78b657 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchySearchCriteria.java @@ -0,0 +1,37 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.constraints.*; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryTypeHierarchySearchCriteria + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchySearchCriteria { + + @JsonProperty("tenantId") + @Size(min = 1, max = 100) + @NotNull + private String tenantId = null; + + @JsonProperty("hierarchyType") + @Size(min = 1, max = 100) + private String hierarchyType = null; + + @JsonProperty("offset") + private Integer offset; + + @JsonProperty("limit") + private Integer limit; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchySearchRequest.java b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchySearchRequest.java new file mode 100644 index 00000000000..29c1ff5234b --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/BoundaryTypeHierarchySearchRequest.java @@ -0,0 +1,33 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BoundaryTypeHierarchySearchRequest + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchySearchRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("BoundaryTypeHierarchySearchCriteria") + @Valid + private BoundaryTypeHierarchySearchCriteria boundaryTypeHierarchySearchCriteria = null; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/EnrichedBoundary.java b/core-services/boundary-service/src/main/java/digit/web/models/EnrichedBoundary.java new file mode 100644 index 00000000000..e078a3d5763 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/EnrichedBoundary.java @@ -0,0 +1,52 @@ +package digit.web.models; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import digit.web.models.EnrichedBoundary; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * EnrichedBoundary + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class EnrichedBoundary { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("code") + @NotNull + private String code = null; + + @JsonProperty("boundaryType") + private String boundaryType = null; + + @JsonProperty("children") + @Valid + private List children = null; + + @JsonIgnore + private String parent = null; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/GenericPair.java b/core-services/boundary-service/src/main/java/digit/web/models/GenericPair.java new file mode 100644 index 00000000000..4769d5959ac --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/GenericPair.java @@ -0,0 +1,20 @@ +package digit.web.models; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class GenericPair { + + private T first; + + private U second; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/HierarchyRelation.java b/core-services/boundary-service/src/main/java/digit/web/models/HierarchyRelation.java new file mode 100644 index 00000000000..f35fe5a23f6 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/HierarchyRelation.java @@ -0,0 +1,41 @@ +package digit.web.models; + +import java.util.List; +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import digit.web.models.EnrichedBoundary; +import io.swagger.v3.oas.annotations.media.Schema; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * HierarchyRelation + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class HierarchyRelation { + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("hierarchyType") + private String hierarchyType = null; + + @JsonProperty("boundary") + @Valid + private List boundary = null; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/HierarchyType.java b/core-services/boundary-service/src/main/java/digit/web/models/HierarchyType.java new file mode 100644 index 00000000000..76dd886740e --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/HierarchyType.java @@ -0,0 +1,43 @@ +package digit.web.models; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import org.springframework.validation.annotation.Validated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; + +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * HierarchyType + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class HierarchyType { + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("id") + private String id = null; + + @JsonProperty("code") + @NotNull + private String code = null; + + @JsonProperty("active") + private Boolean active = null; + + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/PointGeometry.java b/core-services/boundary-service/src/main/java/digit/web/models/PointGeometry.java new file mode 100644 index 00000000000..a4a592aeba1 --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/PointGeometry.java @@ -0,0 +1,25 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import java.util.List; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class PointGeometry { + + @JsonProperty("type") + private String type; + + @JsonProperty("coordinates") + private List coordinates; + +} diff --git a/core-services/boundary-service/src/main/java/digit/web/models/PolygonGeometry.java b/core-services/boundary-service/src/main/java/digit/web/models/PolygonGeometry.java new file mode 100644 index 00000000000..bdd5610377e --- /dev/null +++ b/core-services/boundary-service/src/main/java/digit/web/models/PolygonGeometry.java @@ -0,0 +1,25 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import java.util.List; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class PolygonGeometry { + + @JsonProperty("type") + private String type; + + @JsonProperty("coordinates") + private List>> coordinates; + +} diff --git a/core-services/boundary-service/src/main/resources/application.properties b/core-services/boundary-service/src/main/resources/application.properties new file mode 100644 index 00000000000..fcb93e377bb --- /dev/null +++ b/core-services/boundary-service/src/main/resources/application.properties @@ -0,0 +1,94 @@ +server.contextPath=/boundary-service +server.servlet.context-path=/boundary-service +server.port=8081 +app.timezone=UTC +logging.level.org.springframework=INFO + +#DATABASE CONFIGURATION +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/postgres +spring.datasource.username=postgres +spring.datasource.password=postgres + +#FLYWAY CONFIGURATION +spring.flyway.url=jdbc:postgresql://localhost:5432/postgres +spring.flyway.user=postgres +spring.flyway.password=postgres +spring.flyway.table=public +spring.flyway.baseline-on-migrate=true +spring.flyway.outOfOrder=true +spring.flyway.locations=classpath:/db/migration/main +spring.flyway.enabled=false + +# KAFKA SERVER CONFIGURATIONS +kafka.config.bootstrap_server_config=localhost:9092 +spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.group-id=boundary-service +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.listener.missing-topics-fatal=false +spring.kafka.consumer.properties.spring.json.use.type.headers=false + +# KAFKA CONSUMER CONFIGURATIONS +kafka.consumer.config.auto_commit=true +kafka.consumer.config.auto_commit_interval=100 +kafka.consumer.config.session_timeout=15000 +kafka.consumer.config.auto_offset_reset=earliest +# KAFKA PRODUCER CONFIGURATIONS +kafka.producer.config.retries_config=0 +kafka.producer.config.batch_size_config=16384 +kafka.producer.config.linger_ms_config=1 +kafka.producer.config.buffer_memory_config=33554432 + +#Localization config +egov.localization.host=https://dev.digit.org +egov.localization.workDir.path=/localization/messages/v1 +egov.localization.context.path=/localization/messages/v1 +egov.localization.search.endpoint=/_search +egov.localization.statelevel=true + +#mdms urls +egov.mdms.host=https://dev.digit.org +egov.mdms.search.endpoint=/egov-mdms-service/v1/_search + +#hrms urls +egov.hrms.host=https://dev.digit.org +egov.hrms.search.endpoint=/egov-hrms/employees/_search + +#User config +egov.user.host=https://dev.digit.org +egov.user.context.path=/user/users +egov.user.create.path=/_createnovalidate +egov.user.search.path=/user/_search +egov.user.update.path=/_updatenovalidate + +#Idgen Config +egov.idgen.host=https://dev.digit.org/ +egov.idgen.path=egov-idgen/id/_generate + +#Workflow config +is.workflow.enabled=true +egov.workflow.host=https://dev.digit.org +egov.workflow.transition.path=/egov-workflow-v2/egov-wf/process/_transition +egov.workflow.businessservice.search.path=/egov-workflow-v2/egov-wf/businessservice/_search +egov.workflow.processinstance.search.path=/egov-workflow-v2/egov-wf/process/_search + +#url shortner +egov.url.shortner.host=https://dev.digit.org +egov.url.shortner.endpoint=/egov-url-shortening/shortener + +egov.sms.notification.topic=egov.core.notification.sms +kafka.topics.receipt.create=dss-collection + +# Topics +kafka.topics.consumer=service-consumer-topic +kafka.topics.create.boundary = create-boundary-entity +kafka.topics.update.boundary = update-boundary-entity +kafka.topics.create.boundary.hierarchy = save-boundary-hierarchy-definition +kafka.topics.update.boundary.hierarchy = update-boundary-hierarchy-definition +kafka.topics.create.boundary.relationship = save-boundary-relationship +kafka.topics.update.boundary.relationship = update-boundary-relationship +boundary.default.offset=0 +boundary.default.limit=50 +boundary.max.default.limit=300 \ No newline at end of file diff --git a/core-services/boundary-service/src/main/resources/boundary-persister.yml b/core-services/boundary-service/src/main/resources/boundary-persister.yml new file mode 100644 index 00000000000..b40ae9b17bb --- /dev/null +++ b/core-services/boundary-service/src/main/resources/boundary-persister.yml @@ -0,0 +1,122 @@ +serviceMaps: + serviceName: boundary-Service + mappings: + - version: 1.0 + description: Persists the boundary entity data + fromTopic: create-boundary-entity + isTransaction: true + queryMaps: + - query: INSERT INTO boundary (id, tenantId, code, geometry, additionalDetails, createdBy, lastModifiedBy, createdTime, lastModifiedTime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?); + basePath: $.Boundary.* + jsonMaps: + - jsonPath: $.Boundary.*.id + + - jsonPath: $.Boundary.*.tenantId + + - jsonPath: $.Boundary.*.code + + - jsonPath: $.Boundary.*.geometry + type: JSON + dbType: JSONB + + - jsonPath: $.Boundary.*.additionalDetails + type: JSON + dbType: JSONB + + - jsonPath: $.Boundary.*.auditDetails.createdBy + + - jsonPath: $.Boundary.*.auditDetails.lastModifiedBy + + - jsonPath: $.Boundary.*.auditDetails.createdTime + + - jsonPath: $.Boundary.*.auditDetails.lastModifiedTime + - version: 1.0 + description: Persists the boundary entity data + fromTopic: update-boundary-entity + isTransaction: true + queryMaps: + - query: UPDATE boundary SET geometry = ? , lastModifiedBy = ? , lastModifiedTime = ? WHERE code = ? AND tenantId = ?; + basePath: $.Boundary.* + jsonMaps: + - jsonPath: $.Boundary.*.geometry + type: JSON + dbType: JSONB + + - jsonPath: $.Boundary.*.auditDetails.lastModifiedBy + + - jsonPath: $.Boundary.*.auditDetails.lastModifiedTime + + - jsonPath: $.Boundary.*.code + + - jsonPath: $.Boundary.*.tenantId + - version: 1.0 + description: Persists the boundary hierarchy definition data + fromTopic: save-boundary-hierarchy-definition + isTransaction: true + queryMaps: + - query: INSERT INTO boundary_hierarchy (id, tenantId, hierarchyType, boundaryHierarchy, createdTime, createdBy, lastModifiedTime, lastModifiedBy) VALUES (?, ?, ?, ?, ?, ?, ?, ?); + basePath: $.BoundaryHierarchy + jsonMaps: + - jsonPath: $.BoundaryHierarchy.id + + - jsonPath: $.BoundaryHierarchy.tenantId + + - jsonPath: $.BoundaryHierarchy.hierarchyType + + - jsonPath: $.BoundaryHierarchy.boundaryHierarchyJsonNode + type: JSON + dbType: JSONB + + - jsonPath: $.BoundaryHierarchy.auditDetails.createdTime + + - jsonPath: $.BoundaryHierarchy.auditDetails.createdBy + + - jsonPath: $.BoundaryHierarchy.auditDetails.lastModifiedTime + + - jsonPath: $.BoundaryHierarchy.auditDetails.lastModifiedBy + - version: 1.0 + description: Persists the boundary relationship data + fromTopic: save-boundary-relationship + isTransaction: true + queryMaps: + - query: INSERT INTO boundary_relationship (id, tenantId, code, hierarchyType, boundaryType, parent, ancestralMaterializedPath, createdTime, createdBy, lastModifiedTime, lastModifiedBy) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + basePath: $.BoundaryRelationship + jsonMaps: + - jsonPath: $.BoundaryRelationship.id + + - jsonPath: $.BoundaryRelationship.tenantId + + - jsonPath: $.BoundaryRelationship.code + + - jsonPath: $.BoundaryRelationship.hierarchyType + + - jsonPath: $.BoundaryRelationship.boundaryType + + - jsonPath: $.BoundaryRelationship.parent + + - jsonPath: $.BoundaryRelationship.ancestralMaterializedPath + + - jsonPath: $.BoundaryRelationship.auditDetails.createdTime + + - jsonPath: $.BoundaryRelationship.auditDetails.createdBy + + - jsonPath: $.BoundaryRelationship.auditDetails.lastModifiedTime + + - jsonPath: $.BoundaryRelationship.auditDetails.lastModifiedBy + - version: 1.0 + description: Updates boundary relationship data + fromTopic: update-boundary-relationship + isTransaction: true + queryMaps: + - query: UPDATE boundary_relationship SET parent = ?, ancestralmaterializedpath = ?, lastmodifiedtime = ?, lastmodifiedby = ? WHERE id = ?; + basePath: $.BoundaryRelationshipList.* + jsonMaps: + - jsonPath: $.BoundaryRelationshipList.*.parent + + - jsonPath: $.BoundaryRelationshipList.*.ancestralMaterializedPath + + - jsonPath: $.BoundaryRelationshipList.*.auditDetails.lastModifiedTime + + - jsonPath: $.BoundaryRelationshipList.*.auditDetails.lastModifiedBy + + - jsonPath: $.BoundaryRelationshipList.*.id \ No newline at end of file diff --git a/core-services/boundary-service/src/main/resources/db/Dockerfile b/core-services/boundary-service/src/main/resources/db/Dockerfile new file mode 100644 index 00000000000..f38638a269f --- /dev/null +++ b/core-services/boundary-service/src/main/resources/db/Dockerfile @@ -0,0 +1,9 @@ +FROM egovio/flyway:10.7.1 + +COPY ./migration/main /flyway/sql + +COPY migrate.sh /usr/bin/migrate.sh + +RUN chmod +x /usr/bin/migrate.sh + +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/boundary-service/src/main/resources/db/migrate.sh b/core-services/boundary-service/src/main/resources/db/migrate.sh new file mode 100644 index 00000000000..00914f6ff97 --- /dev/null +++ b/core-services/boundary-service/src/main/resources/db/migrate.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate diff --git a/core-services/boundary-service/src/main/resources/db/migration/main/V20230728110535__boundary-service_ddl.sql b/core-services/boundary-service/src/main/resources/db/migration/main/V20230728110535__boundary-service_ddl.sql new file mode 100644 index 00000000000..c2b3d3c7444 --- /dev/null +++ b/core-services/boundary-service/src/main/resources/db/migration/main/V20230728110535__boundary-service_ddl.sql @@ -0,0 +1,17 @@ + +CREATE TABLE boundary ( + id VARCHAR (64), + tenantId VARCHAR (64) NOT NULL, + code VARCHAR (64) NOT NULL, + geometry JSONB, + additionalDetails JSONB, + createdtime BIGINT NOT NULL, + createdby VARCHAR (64) NOT NULL, + lastmodifiedtime BIGINT, + lastmodifiedby VARCHAR (64), + + CONSTRAINT unique_code_tenantId UNIQUE (code, tenantId), + PRIMARY KEY (id) +); +-- Create an index on tenantId and code +CREATE INDEX idx_boundary_tenantId_code ON boundary (tenantId, code); diff --git a/core-services/boundary-service/src/main/resources/db/migration/main/V20231025110679__boundary_hierarchy_ddl.sql b/core-services/boundary-service/src/main/resources/db/migration/main/V20231025110679__boundary_hierarchy_ddl.sql new file mode 100644 index 00000000000..c2a8b9cb5fa --- /dev/null +++ b/core-services/boundary-service/src/main/resources/db/migration/main/V20231025110679__boundary_hierarchy_ddl.sql @@ -0,0 +1,14 @@ +CREATE TABLE boundary_hierarchy ( + id VARCHAR(64), + tenantId VARCHAR(64) NOT NULL, + hierarchyType VARCHAR(64) NOT NULL, + boundaryHierarchy JSONB NOT NULL, + createdtime BIGINT, + createdby VARCHAR(64), + lastmodifiedtime BIGINT, + lastmodifiedby VARCHAR(64), + CONSTRAINT pk_boundary_hierarchy PRIMARY KEY (id), + CONSTRAINT uk_boundary_hierarchy UNIQUE (tenantId , hierarchyType) +); +-- Create an index on tenantId and hierarchyType +CREATE INDEX idx_boundary_hierarchy_tenantId_hierarchyType ON boundary_hierarchy (tenantId , hierarchyType); diff --git a/core-services/boundary-service/src/main/resources/db/migration/main/V20231031120752__boundary_relationship_ddl.sql b/core-services/boundary-service/src/main/resources/db/migration/main/V20231031120752__boundary_relationship_ddl.sql new file mode 100644 index 00000000000..d9fdf53c89d --- /dev/null +++ b/core-services/boundary-service/src/main/resources/db/migration/main/V20231031120752__boundary_relationship_ddl.sql @@ -0,0 +1,15 @@ +CREATE TABLE boundary_relationship ( + id VARCHAR(64), + tenantId VARCHAR(64) NOT NULL, + code VARCHAR(64) NOT NULL, + hierarchyType VARCHAR(64) NOT NULL, + boundaryType VARCHAR(64) NOT NULL, + parent VARCHAR(64), + ancestralMaterializedPath TEXT, + createdtime BIGINT, + createdby VARCHAR(64), + lastmodifiedtime BIGINT, + lastmodifiedby VARCHAR(64), + CONSTRAINT uk_boundary_relationship UNIQUE (id), + CONSTRAINT pk_boundary_relationship PRIMARY KEY (tenantId, code, hierarchyType) +); \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/test/java/digit/TestConfiguration.java b/core-services/boundary-service/src/test/java/digit/TestConfiguration.java similarity index 100% rename from tutorials/backend-developer-guide/btr-services/src/test/java/digit/TestConfiguration.java rename to core-services/boundary-service/src/test/java/digit/TestConfiguration.java diff --git a/core-services/boundary-service/src/test/java/digit/web/controllers/BoundaryApiControllerTest.java b/core-services/boundary-service/src/test/java/digit/web/controllers/BoundaryApiControllerTest.java new file mode 100644 index 00000000000..480da975fa6 --- /dev/null +++ b/core-services/boundary-service/src/test/java/digit/web/controllers/BoundaryApiControllerTest.java @@ -0,0 +1,142 @@ +//package digit.web.controllers; +// +//import org.junit.Test; +//import org.junit.Ignore; +//import org.junit.runner.RunWith; +//import org.springframework.test.context.junit4.SpringRunner; +//import org.springframework.test.web.servlet.MockMvc; +//import org.springframework.context.annotation.Import; +//import org.springframework.http.MediaType; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +//import digit.TestConfiguration; +// +//import static org.mockito.Matchers.any; +//import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +// +///** +//* API tests for BoundaryApiController +//*/ +//@Ignore +//@RunWith(SpringRunner.class) +//@WebMvcTest(BoundaryController.class) +//@Import(TestConfiguration.class) +//public class BoundaryApiControllerTest { +// +// @Autowired +// private MockMvc mockMvc; +// +// @Test +// public void boundaryBoundaryRelationshipsCreatePostSuccess() throws Exception { +// mockMvc.perform(post("/boundary/boundary-relationships/_create").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isOk()); +// } +// +// @Test +// public void boundaryBoundaryRelationshipsCreatePostFailure() throws Exception { +// mockMvc.perform(post("/boundary/boundary-relationships/_create").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isBadRequest()); +// } +// +// @Test +// public void boundaryBoundaryRelationshipsSearchPostSuccess() throws Exception { +// mockMvc.perform(post("/boundary/boundary-relationships/_search").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isOk()); +// } +// +// @Test +// public void boundaryBoundaryRelationshipsSearchPostFailure() throws Exception { +// mockMvc.perform(post("/boundary/boundary-relationships/_search").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isBadRequest()); +// } +// +// @Test +// public void boundaryBoundaryRelationshipsUpdatePostSuccess() throws Exception { +// mockMvc.perform(post("/boundary/boundary-relationships/_update").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isOk()); +// } +// +// @Test +// public void boundaryBoundaryRelationshipsUpdatePostFailure() throws Exception { +// mockMvc.perform(post("/boundary/boundary-relationships/_update").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isBadRequest()); +// } +// +// @Test +// public void boundaryCreatePostSuccess() throws Exception { +// mockMvc.perform(post("/boundary/_create").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isOk()); +// } +// +// @Test +// public void boundaryCreatePostFailure() throws Exception { +// mockMvc.perform(post("/boundary/_create").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isBadRequest()); +// } +// +// @Test +// public void boundaryHierarchyDefinitionCreatePostSuccess() throws Exception { +// mockMvc.perform(post("/boundary/hierarchy-definition/_create").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isOk()); +// } +// +// @Test +// public void boundaryHierarchyDefinitionCreatePostFailure() throws Exception { +// mockMvc.perform(post("/boundary/hierarchy-definition/_create").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isBadRequest()); +// } +// +// @Test +// public void boundaryHierarchyDefinitionSearchPostSuccess() throws Exception { +// mockMvc.perform(post("/boundary/hierarchy-definition/_search").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isOk()); +// } +// +// @Test +// public void boundaryHierarchyDefinitionSearchPostFailure() throws Exception { +// mockMvc.perform(post("/boundary/hierarchy-definition/_search").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isBadRequest()); +// } +// +// @Test +// public void boundarySearchPostSuccess() throws Exception { +// mockMvc.perform(post("/boundary/_search").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isOk()); +// } +// +// @Test +// public void boundarySearchPostFailure() throws Exception { +// mockMvc.perform(post("/boundary/_search").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isBadRequest()); +// } +// +// @Test +// public void boundaryUpdatePostSuccess() throws Exception { +// mockMvc.perform(post("/boundary/_update").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isOk()); +// } +// +// @Test +// public void boundaryUpdatePostFailure() throws Exception { +// mockMvc.perform(post("/boundary/_update").contentType(MediaType +// .APPLICATION_JSON_UTF8)) +// .andExpect(status().isBadRequest()); +// } +// +//} diff --git a/core-services/egov-accesscontrol/CHANGELOG.md b/core-services/egov-accesscontrol/CHANGELOG.md index 518c7b45ba3..653f2665cd8 100644 --- a/core-services/egov-accesscontrol/CHANGELOG.md +++ b/core-services/egov-accesscontrol/CHANGELOG.md @@ -2,6 +2,12 @@ # Changelog All notable changes to this module will be documented in this file. + +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version from 9.4.1212 to 42.7.1 + ## 1.1.3 - 2022-01-13 - Updated to log4j2 version 2.17.1 diff --git a/core-services/egov-accesscontrol/pom.xml b/core-services/egov-accesscontrol/pom.xml index b80cfaa22d4..82042129423 100644 --- a/core-services/egov-accesscontrol/pom.xml +++ b/core-services/egov-accesscontrol/pom.xml @@ -5,7 +5,7 @@ org.egov egov-accesscontrol - 1.1.3-SNAPSHOT + 2.9.0-SNAPSHOT jar egov-accesscontrol @@ -14,32 +14,29 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE - - + 3.2.2 2.17.1 UTF-8 UTF-8 - 1.8 + 17 2.9.6 1.2.0.Final - - org.egov.services - tracer - 2.1.1-SNAPSHOT + org.springframework.boot + spring-boot-starter-validation + 3.2.3 org.egov.services - services-common - 1.1.1-SNAPSHOT + tracer + 2.9.0-SNAPSHOT @@ -52,12 +49,6 @@ spring-boot-starter-jdbc - - org.springframework - spring-beans - 5.2.20.RELEASE - - org.springframework.boot spring-boot-starter-web @@ -66,7 +57,7 @@ org.postgresql postgresql - 9.4.1212 + 42.7.1 @@ -115,20 +106,19 @@ org.springframework.boot spring-boot-starter-test - 2.2.6.RELEASE test - org.junit.jupiter - junit-jupiter-engine - 5.6.2 + junit + junit + 4.13.2 test org.flywaydb flyway-core - 6.4.4 + 9.22.3 @@ -151,21 +141,15 @@ org.egov mdms-client - 0.0.2-SNAPSHOT - - - org.springframework.boot - spring-boot-devtools - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - - + 2.9.0-SNAPSHOT + + + org.mockito + mockito-core + test - repo.digit.org @@ -191,59 +175,9 @@ - org.springframework.boot spring-boot-maven-plugin - - - - repackage - - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.access.domain.model.authorize.AuthorizationRequestWrapper - org.egov.access.web.contract.action.ActionRequest - org.egov.access.web.contract.action.ActionResponse - org.egov.access.web.contract.action.ActionSearchResponse - org.egov.access.web.contract.action.RoleActionsRequest - org.egov.access.web.contract.action.RoleActionsResponse - org.egov.access.web.contract.role.RoleRequest - org.egov.access.web.contract.role.RoleResponse - org.egov.access.web.contract.validateaction.ValidateActionRequest - org.egov.access.web.contract.validateaction.ValidateActionResponse - org.egov.access.web.errorhandlers.ErrorResponse - - - org.egov.access.domain.model.authorize.Role:AuthorizeRole - - - org.egov.common.contract.request.User:User - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - true - module - diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/EgovAccesscontrolApplication.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/EgovAccesscontrolApplication.java index 8d0c3d0d2a6..7a299e64c04 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/EgovAccesscontrolApplication.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/EgovAccesscontrolApplication.java @@ -5,8 +5,8 @@ import java.util.TimeZone; import java.util.concurrent.TimeUnit; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.cache2k.extra.spring.SpringCache2kCacheManager; import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.config.TracerConfiguration; @@ -21,10 +21,10 @@ import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @SpringBootApplication @EnableCaching @@ -67,8 +67,8 @@ public ObjectMapper getObjectMapper() { } @Bean - public WebMvcConfigurerAdapter webMvcConfigurerAdapter() { - return new WebMvcConfigurerAdapter() { + public WebMvcConfigurer webMvcConfigurer() { + return new WebMvcConfigurer() { @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/Action.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/Action.java index 1ff6ee6aa1e..615ee3ec57a 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/Action.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/Action.java @@ -1,5 +1,6 @@ package org.egov.access.domain.model; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; @@ -7,7 +8,6 @@ import lombok.NoArgsConstructor; import lombok.Setter; -import javax.validation.constraints.Size; import java.util.Date; @Getter diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/Role.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/Role.java index 684d6f902f6..2162dacad61 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/Role.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/Role.java @@ -2,6 +2,7 @@ import java.util.Date; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; @@ -9,7 +10,6 @@ import lombok.NoArgsConstructor; import lombok.Setter; -import javax.validation.constraints.Size; @Getter @Setter diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/AuthorizationRequest.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/AuthorizationRequest.java index 1e441fd5d8e..e273068bb10 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/AuthorizationRequest.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/AuthorizationRequest.java @@ -1,11 +1,11 @@ package org.egov.access.domain.model.authorize; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import java.util.Set; @NoArgsConstructor diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/AuthorizationRequestWrapper.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/AuthorizationRequestWrapper.java index 600d4e1186a..e1c3f34f2d2 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/AuthorizationRequestWrapper.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/AuthorizationRequestWrapper.java @@ -1,12 +1,12 @@ package org.egov.access.domain.model.authorize; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.egov.common.contract.request.RequestInfo; -import javax.validation.Valid; @NoArgsConstructor @AllArgsConstructor diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/Role.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/Role.java index 6c420c258b2..ac992dd1452 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/Role.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/domain/model/authorize/Role.java @@ -2,12 +2,12 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import javax.validation.constraints.Size; @JsonIgnoreProperties(ignoreUnknown = true) @Data diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/action/ActionRequest.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/action/ActionRequest.java index ac0d955ae99..695720dce8c 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/action/ActionRequest.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/action/ActionRequest.java @@ -2,9 +2,8 @@ import java.util.List; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; import org.egov.access.domain.criteria.ActionSearchCriteria; import org.egov.access.domain.model.Action; import org.egov.common.contract.request.RequestInfo; @@ -23,7 +22,6 @@ public class ActionRequest { - @NotNull @JsonProperty("RequestInfo") private RequestInfo requestInfo; private List roleCodes; diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/action/RoleActionsRequest.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/action/RoleActionsRequest.java index 3d8344ebc8c..bfd90cad473 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/action/RoleActionsRequest.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/action/RoleActionsRequest.java @@ -2,10 +2,9 @@ import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import org.egov.access.domain.model.Action; import org.egov.access.domain.model.Role; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/role/RoleContract.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/role/RoleContract.java index 9655eaa2370..d58a7a1323d 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/role/RoleContract.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/role/RoleContract.java @@ -1,9 +1,9 @@ package org.egov.access.web.contract.role; +import jakarta.validation.constraints.Size; import lombok.*; import org.egov.access.domain.model.Role; -import javax.validation.constraints.Size; import java.util.ArrayList; import java.util.List; diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/role/RoleRequest.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/role/RoleRequest.java index 2b6808661fb..d3d1e079707 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/role/RoleRequest.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/role/RoleRequest.java @@ -2,8 +2,8 @@ import java.util.List; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import org.egov.access.domain.model.Role; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/validateaction/ValidateActionContract.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/validateaction/ValidateActionContract.java index 03680e7ade7..2f8b96840e8 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/validateaction/ValidateActionContract.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/validateaction/ValidateActionContract.java @@ -1,8 +1,8 @@ package org.egov.access.web.contract.validateaction; +import jakarta.validation.Valid; import lombok.*; -import javax.validation.Valid; @Getter @Builder diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/validateaction/ValidateActionRequest.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/validateaction/ValidateActionRequest.java index 885abc87b2a..2e21d6fac7c 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/validateaction/ValidateActionRequest.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/contract/validateaction/ValidateActionRequest.java @@ -1,11 +1,11 @@ package org.egov.access.web.contract.validateaction; +import jakarta.validation.Valid; import lombok.*; import org.egov.access.domain.criteria.ValidateActionCriteria; import org.egov.access.web.contract.role.RoleContract; import org.egov.common.contract.request.RequestInfo; -import javax.validation.Valid; import java.util.stream.Collectors; @Getter diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/ActionController.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/ActionController.java index 634766aaa28..7c3897be95b 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/ActionController.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/ActionController.java @@ -1,5 +1,6 @@ package org.egov.access.web.controller; +import jakarta.validation.Valid; import org.egov.access.domain.model.Action; import org.egov.access.domain.model.ActionValidation; import org.egov.access.domain.model.authorize.AuthorizationRequestWrapper; @@ -26,7 +27,6 @@ import org.springframework.web.bind.annotation.*; import org.egov.access.web.contract.action.Module; -import javax.validation.Valid; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/RoleActionController.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/RoleActionController.java index 98411b87bcf..3b07f94a0fe 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/RoleActionController.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/RoleActionController.java @@ -3,8 +3,8 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.access.domain.model.RoleAction; import org.egov.access.domain.service.RoleActionService; import org.egov.access.util.AccessControlConstants; diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/RoleController.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/RoleController.java index b75a787be5d..50766fc92bc 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/RoleController.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/controller/RoleController.java @@ -6,9 +6,9 @@ import java.util.List; import java.util.stream.Collectors; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import org.egov.access.domain.criteria.RoleSearchCriteria; import org.egov.access.domain.model.Role; import org.egov.access.domain.service.RoleService; diff --git a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/errorhandlers/Error.java b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/errorhandlers/Error.java index bddc17f40bc..050812f9c39 100644 --- a/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/errorhandlers/Error.java +++ b/core-services/egov-accesscontrol/src/main/java/org/egov/access/web/errorhandlers/Error.java @@ -44,8 +44,8 @@ import java.util.List; import java.util.Map; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import org.egov.common.contract.response.ErrorField; import lombok.AllArgsConstructor; diff --git a/core-services/egov-accesscontrol/src/main/resources/db/Dockerfile b/core-services/egov-accesscontrol/src/main/resources/db/Dockerfile index cf4fc9583ae..317ab48a139 100644 --- a/core-services/egov-accesscontrol/src/main/resources/db/Dockerfile +++ b/core-services/egov-accesscontrol/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/ddl /flyway/sql @@ -12,4 +12,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-accesscontrol/src/main/resources/db/migrate.sh b/core-services/egov-accesscontrol/src/main/resources/db/migrate.sh index 43960b25cdb..5593a173eba 100644 --- a/core-services/egov-accesscontrol/src/main/resources/db/migrate.sh +++ b/core-services/egov-accesscontrol/src/main/resources/db/migrate.sh @@ -1,3 +1,3 @@ #!/bin/sh -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate \ No newline at end of file diff --git a/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/ActionServiceTest.java b/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/ActionServiceTest.java index d776e597e9a..bd804645152 100644 --- a/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/ActionServiceTest.java +++ b/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/ActionServiceTest.java @@ -29,7 +29,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; diff --git a/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/RoleActionServiceTest.java b/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/RoleActionServiceTest.java index 7f892a88181..401588460ed 100644 --- a/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/RoleActionServiceTest.java +++ b/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/RoleActionServiceTest.java @@ -1,7 +1,7 @@ package org.egov.access.domain.service; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.when; @@ -16,7 +16,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; @RunWith(MockitoJUnitRunner.class) diff --git a/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/RoleServiceTest.java b/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/RoleServiceTest.java index 2e39a0d2727..4e33acac672 100644 --- a/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/RoleServiceTest.java +++ b/core-services/egov-accesscontrol/src/test/java/org/egov/access/domain/service/RoleServiceTest.java @@ -21,7 +21,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; diff --git a/core-services/egov-accesscontrol/src/test/java/org/egov/access/persistence/repository/rowmapper/ActionValidationRowMapperTest.java b/core-services/egov-accesscontrol/src/test/java/org/egov/access/persistence/repository/rowmapper/ActionValidationRowMapperTest.java index 4fcd9e34420..5add69d5aa6 100644 --- a/core-services/egov-accesscontrol/src/test/java/org/egov/access/persistence/repository/rowmapper/ActionValidationRowMapperTest.java +++ b/core-services/egov-accesscontrol/src/test/java/org/egov/access/persistence/repository/rowmapper/ActionValidationRowMapperTest.java @@ -3,14 +3,13 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import java.sql.ResultSet; import java.sql.SQLException; import static org.junit.Assert.assertFalse; import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class ActionValidationRowMapperTest { @Mock diff --git a/core-services/egov-accesscontrol/src/test/java/org/egov/access/web/controller/RoleActionsControllerTest.java b/core-services/egov-accesscontrol/src/test/java/org/egov/access/web/controller/RoleActionsControllerTest.java index 190ebea3bc7..4efe852dd52 100644 --- a/core-services/egov-accesscontrol/src/test/java/org/egov/access/web/controller/RoleActionsControllerTest.java +++ b/core-services/egov-accesscontrol/src/test/java/org/egov/access/web/controller/RoleActionsControllerTest.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; diff --git a/core-services/egov-enc-service/CHANGELOG.md b/core-services/egov-enc-service/CHANGELOG.md index 6676c58e587..a1baf4057a2 100644 --- a/core-services/egov-enc-service/CHANGELOG.md +++ b/core-services/egov-enc-service/CHANGELOG.md @@ -3,6 +3,12 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version to 42.7.1 +- Upgraded lombok version from 1.18.8 to 1.18.22 + ## 1.1.4 - 2023-08-11 - Central Instance Library Integration diff --git a/core-services/egov-enc-service/pom.xml b/core-services/egov-enc-service/pom.xml index aaf63674197..dc26b40f1f9 100644 --- a/core-services/egov-enc-service/pom.xml +++ b/core-services/egov-enc-service/pom.xml @@ -5,24 +5,28 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 3.2.2 org.egov egov-enc-service - 1.1.4 + 2.9.0-SNAPSHOT egov-enc-service 2.17.1 - 1.8 + 17 ${java.version} ${java.version} - 1.18.8 + 1.18.22 + + org.springframework.boot + spring-boot-starter-validation + 3.2.3 + org.springframework spring-beans - 5.2.20.RELEASE org.springframework.boot @@ -45,7 +49,7 @@ org.egov.services tracer - 2.1.0-SNAPSHOT + 2.9.0-SNAPSHOT org.projectlombok @@ -61,18 +65,21 @@ json 20180813 - - javax.validation - validation-api - org.postgresql postgresql + 42.7.1 org.flywaydb flyway-core - 6.4.3 + 9.22.3 + + + junit + junit + 4.13.2 + test org.bouncycastle @@ -104,58 +111,10 @@ - src/main/java org.springframework.boot spring-boot-maven-plugin - - - - repackage - - - - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.enc.web.models.EncryptionRequest - org.egov.enc.web.models.SignRequest - org.egov.enc.web.models.VerifyRequest - org.egov.enc.web.models.RotateKeyRequest - org.egov.enc.web.models.RotateKeyResponse - org.egov.enc.web.models.VerifyResponse - org.egov.enc.web.models.SignResponse - - Digit - module - diff --git a/core-services/egov-enc-service/src/main/java/org/egov/enc/config/MainConfiguration.java b/core-services/egov-enc-service/src/main/java/org/egov/enc/config/MainConfiguration.java index 3c66d6f9ac8..7f3dcdb5a02 100644 --- a/core-services/egov-enc-service/src/main/java/org/egov/enc/config/MainConfiguration.java +++ b/core-services/egov-enc-service/src/main/java/org/egov/enc/config/MainConfiguration.java @@ -9,7 +9,7 @@ import org.springframework.context.annotation.Import; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.util.TimeZone; diff --git a/core-services/egov-enc-service/src/main/java/org/egov/enc/keymanagement/masterkey/providers/AwsKmsMasterKey.java b/core-services/egov-enc-service/src/main/java/org/egov/enc/keymanagement/masterkey/providers/AwsKmsMasterKey.java index dacdf47f386..0e79702b951 100644 --- a/core-services/egov-enc-service/src/main/java/org/egov/enc/keymanagement/masterkey/providers/AwsKmsMasterKey.java +++ b/core-services/egov-enc-service/src/main/java/org/egov/enc/keymanagement/masterkey/providers/AwsKmsMasterKey.java @@ -14,7 +14,7 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Base64; diff --git a/core-services/egov-enc-service/src/main/java/org/egov/enc/keymanagement/masterkey/providers/SoftwareBasedMasterKey.java b/core-services/egov-enc-service/src/main/java/org/egov/enc/keymanagement/masterkey/providers/SoftwareBasedMasterKey.java index e303e2beab2..70fe69ad5e0 100644 --- a/core-services/egov-enc-service/src/main/java/org/egov/enc/keymanagement/masterkey/providers/SoftwareBasedMasterKey.java +++ b/core-services/egov-enc-service/src/main/java/org/egov/enc/keymanagement/masterkey/providers/SoftwareBasedMasterKey.java @@ -10,7 +10,7 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; diff --git a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/controllers/CryptoApiController.java b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/controllers/CryptoApiController.java index 23d85091a54..e4885ce61ac 100644 --- a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/controllers/CryptoApiController.java +++ b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/controllers/CryptoApiController.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; import org.egov.enc.services.KeyManagementService; import org.egov.enc.services.EncryptionService; @@ -15,8 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import javax.servlet.http.HttpServletRequest; -import javax.validation.Valid; +import jakarta.validation.Valid; @Slf4j @Controller diff --git a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/EncReqObject.java b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/EncReqObject.java index 42c1a4bc195..980021a8880 100644 --- a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/EncReqObject.java +++ b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/EncReqObject.java @@ -5,15 +5,15 @@ import lombok.*; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; /** * Encryption / Decryption Request Meta-data and Values */ @ApiModel(description = "Encryption / Decryption Request Meta-data and Values") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-10-11T17:31:52.360+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-10-11T17:31:52.360+05:30") @Getter @Setter diff --git a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/EncryptionRequest.java b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/EncryptionRequest.java index 76b1e170578..a61de86ce31 100644 --- a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/EncryptionRequest.java +++ b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/EncryptionRequest.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.*; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import java.util.List; @Getter diff --git a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/RotateKeyRequest.java b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/RotateKeyRequest.java index 8a4f35d373d..e00c4cd40ae 100644 --- a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/RotateKeyRequest.java +++ b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/RotateKeyRequest.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.*; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; @Getter @Setter diff --git a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/SignRequest.java b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/SignRequest.java index 84de5d19d29..6aecdda7a4b 100644 --- a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/SignRequest.java +++ b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/SignRequest.java @@ -5,14 +5,14 @@ import lombok.*; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; /** * Object with the value to be signed */ @ApiModel(description = "Object with the value to be signed") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-10-11T17:31:52.360+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-10-11T17:31:52.360+05:30") @Getter @Setter diff --git a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/VerifyRequest.java b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/VerifyRequest.java index 6999faaa3ed..1e504dfdac7 100644 --- a/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/VerifyRequest.java +++ b/core-services/egov-enc-service/src/main/java/org/egov/enc/web/models/VerifyRequest.java @@ -6,14 +6,14 @@ import org.egov.enc.models.Signature; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; /** * Object with the value and signature to be verified */ @ApiModel(description = "Object with the value and signature to be verified") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-10-11T17:31:52.360+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-10-11T17:31:52.360+05:30") @Getter @Setter diff --git a/core-services/egov-enc-service/src/main/resources/db/Dockerfile b/core-services/egov-enc-service/src/main/resources/db/Dockerfile index a5699ff7d99..e7da01d7f0b 100644 --- a/core-services/egov-enc-service/src/main/resources/db/Dockerfile +++ b/core-services/egov-enc-service/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql @@ -6,4 +6,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] \ No newline at end of file diff --git a/core-services/egov-enc-service/src/main/resources/db/migrate.sh b/core-services/egov-enc-service/src/main/resources/db/migrate.sh index 5593a173eba..275ca387ffc 100644 --- a/core-services/egov-enc-service/src/main/resources/db/migrate.sh +++ b/core-services/egov-enc-service/src/main/resources/db/migrate.sh @@ -1,3 +1,8 @@ #!/bin/sh - +echo "Running Flyway with the following parameters:" +echo "URL: $DB_URL" +echo "Table: $SCHEMA_TABLE" +echo "User: $FLYWAY_USER" +echo "Password: $FLYWAY_PASSWORD" +echo "Locations: $FLYWAY_LOCATIONS" flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate \ No newline at end of file diff --git a/core-services/egov-enc-service/src/test/java/org/egov/enc/web/controllers/CryptoApiControllerTest.java b/core-services/egov-enc-service/src/test/java/org/egov/enc/web/controllers/CryptoApiControllerTest.java index 163f02d4dc4..b550ff5b680 100644 --- a/core-services/egov-enc-service/src/test/java/org/egov/enc/web/controllers/CryptoApiControllerTest.java +++ b/core-services/egov-enc-service/src/test/java/org/egov/enc/web/controllers/CryptoApiControllerTest.java @@ -11,7 +11,6 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.egov.enc.TestConfiguration; -import static org.mockito.Matchers.any; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; diff --git a/core-services/egov-filestore/CHANGELOG.md b/core-services/egov-filestore/CHANGELOG.md index 21324e5b362..5a8d2d15b1f 100644 --- a/core-services/egov-filestore/CHANGELOG.md +++ b/core-services/egov-filestore/CHANGELOG.md @@ -1,4 +1,12 @@ # Changelog +All notable changes to this module will be documented in this file. + +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version to 42.7.1 +- Upgraded lombok version from 1.18.8 to 1.18.22 +- Upgraded minio library version from 7.0.2 to 7.1.4 ## 1.3.0 - 2023-03-15 - Fixes flow to store and retrieve files from `Azure blob storage`. diff --git a/core-services/egov-filestore/pom.xml b/core-services/egov-filestore/pom.xml index 73b980be054..8eee215cdcd 100644 --- a/core-services/egov-filestore/pom.xml +++ b/core-services/egov-filestore/pom.xml @@ -7,31 +7,31 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 3.2.2 org.egov egov-filestore - 1.3.0-SNAPSHOT + 2.9.0-SNAPSHOT egov-filestore eGov File store project for eGov services 2.17.1 UTF-8 - 1.8 + 17 UTF-8 - 1.18.8 + 1.18.22 - org.springframework - spring-beans - 5.2.20.RELEASE + org.springframework.boot + spring-boot-starter-validation + 3.2.3 org.egov.services tracer - 2.0.0-SNAPSHOT + 2.9.0-SNAPSHOT org.springframework.boot @@ -44,11 +44,12 @@ io.minio minio - 7.0.2 + 7.1.4 org.postgresql postgresql + 42.7.1 org.projectlombok @@ -68,8 +69,14 @@ org.apache.tika tika-core - 1.23 + 2.9.1 + + commons-io + commons-io + 2.11.0 + + org.springframework.boot spring-boot-starter-test @@ -83,6 +90,7 @@ org.flywaydb flyway-core + 9.22.3 com.amazonaws @@ -99,11 +107,6 @@ imgscalr-lib 4.2 - - org.egov.services - services-common - 0.9.0 - org.springframework.boot spring-boot-devtools @@ -132,84 +135,7 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.filestore.web.contract.FileStoreResponse - org.egov.filestore.web.contract.StorageResponse - - - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - module - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - cz.habarta.typescript-generator - - - typescript-generator-maven-plugin - - - [2.22.595,) - - - generate - - - - - - - - - - - - diff --git a/core-services/egov-filestore/src/main/java/org/egov/filestore/FileStoreApplication.java b/core-services/egov-filestore/src/main/java/org/egov/filestore/FileStoreApplication.java index 3a17bcda1fa..fe662e0d482 100644 --- a/core-services/egov-filestore/src/main/java/org/egov/filestore/FileStoreApplication.java +++ b/core-services/egov-filestore/src/main/java/org/egov/filestore/FileStoreApplication.java @@ -1,5 +1,6 @@ package org.egov.filestore; +import jakarta.annotation.PostConstruct; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -16,7 +17,6 @@ import java.util.Locale; import java.util.TimeZone; -import javax.annotation.PostConstruct; @SpringBootApplication @Import({ TracerConfiguration.class }) diff --git a/core-services/egov-filestore/src/main/java/org/egov/filestore/config/FileStoreConfig.java b/core-services/egov-filestore/src/main/java/org/egov/filestore/config/FileStoreConfig.java index 4998fe6dbfe..dc7d7f06ef7 100644 --- a/core-services/egov-filestore/src/main/java/org/egov/filestore/config/FileStoreConfig.java +++ b/core-services/egov-filestore/src/main/java/org/egov/filestore/config/FileStoreConfig.java @@ -4,8 +4,8 @@ import java.util.Map; import java.util.Set; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; diff --git a/core-services/egov-filestore/src/main/java/org/egov/filestore/domain/service/StorageService.java b/core-services/egov-filestore/src/main/java/org/egov/filestore/domain/service/StorageService.java index 28004a4ba96..6d01e2e3c8e 100644 --- a/core-services/egov-filestore/src/main/java/org/egov/filestore/domain/service/StorageService.java +++ b/core-services/egov-filestore/src/main/java/org/egov/filestore/domain/service/StorageService.java @@ -136,7 +136,7 @@ private void setThumbnailImages(Artifact artifact) { artifact.setThumbnailImages(mapOfImagesAndPaths); } - } catch (IOException e) { + } catch (Exception e) { // TODO Auto-generated catch block log.error("EG_FILESTORE_INPUT_ERROR", e); throw new CustomException("EG_FILESTORE_INPUT_ERROR", "Failed to read input stream from multipart file"); diff --git a/core-services/egov-filestore/src/main/java/org/egov/filestore/persistence/entity/AbstractPersistable.java b/core-services/egov-filestore/src/main/java/org/egov/filestore/persistence/entity/AbstractPersistable.java index f55c6f45a35..c7ea165e42f 100644 --- a/core-services/egov-filestore/src/main/java/org/egov/filestore/persistence/entity/AbstractPersistable.java +++ b/core-services/egov-filestore/src/main/java/org/egov/filestore/persistence/entity/AbstractPersistable.java @@ -40,8 +40,9 @@ package org.egov.filestore.persistence.entity; -import javax.persistence.MappedSuperclass; -import javax.persistence.Version; +import jakarta.persistence.MappedSuperclass; +import jakarta.persistence.Version; + import java.io.Serializable; @MappedSuperclass diff --git a/core-services/egov-filestore/src/main/java/org/egov/filestore/persistence/entity/Artifact.java b/core-services/egov-filestore/src/main/java/org/egov/filestore/persistence/entity/Artifact.java index 5f52d2ade2e..7d934bb19c0 100644 --- a/core-services/egov-filestore/src/main/java/org/egov/filestore/persistence/entity/Artifact.java +++ b/core-services/egov-filestore/src/main/java/org/egov/filestore/persistence/entity/Artifact.java @@ -41,15 +41,15 @@ package org.egov.filestore.persistence.entity; +import jakarta.persistence.*; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.egov.filestore.domain.model.FileLocation; -import org.hibernate.validator.constraints.NotBlank; -import javax.persistence.*; import static org.egov.filestore.persistence.entity.Artifact.SEQ_FILESTOREMAP; diff --git a/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioClientFacade.java b/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioClientFacade.java index d5962debcc2..c389726ef40 100644 --- a/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioClientFacade.java +++ b/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioClientFacade.java @@ -23,16 +23,16 @@ public class MinioClientFacade { @Bean private MinioClient getMinioClient() { log.info("Initializing the minio "); - MinioClient minioClient = null; - try { - - minioClient = new MinioClient(minioConfig.getEndPoint(), minioConfig.getAccessKey(), - minioConfig.getSecretKey()); - - } catch (InvalidEndpointException | InvalidPortException e) { - log.error(e.getMessage(), e); - throw new CustomException("ERROR_FILESTORE_MINIO_INSTANCE","Failed to create minio instance"); - } - return minioClient; + /*MinioClient minioClient = null; + + minioClient = new MinioClient(minioConfig.getEndPoint(), minioConfig.getAccessKey(), + minioConfig.getSecretKey());*/ + MinioClient minioClient = MinioClient.builder() + .endpoint(minioConfig.getEndPoint()) + .credentials(minioConfig.getAccessKey(), minioConfig.getSecretKey()) + .region(minioConfig.getRegion()) + .build(); + + return minioClient; } } diff --git a/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioConfig.java b/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioConfig.java index 70b295efbf1..57cf6a9990f 100644 --- a/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioConfig.java +++ b/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioConfig.java @@ -20,6 +20,9 @@ public class MinioConfig { @Value("${fixed.bucketname}") private String bucketName; + + @Value("${fixed.bucket.region}") + private String region; @Value("${minio.source}") private String source; diff --git a/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioRepository.java b/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioRepository.java index 8e774edea68..d08a88ed935 100644 --- a/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioRepository.java +++ b/core-services/egov-filestore/src/main/java/org/egov/filestore/repository/impl/minio/MinioRepository.java @@ -17,6 +17,8 @@ import javax.imageio.ImageIO; +import io.minio.PutObjectArgs; +import io.minio.errors.*; import org.apache.commons.io.FilenameUtils; import org.egov.filestore.config.FileStoreConfig; import org.egov.filestore.domain.model.FileLocation; @@ -33,14 +35,6 @@ import io.minio.MinioClient; import io.minio.PutObjectOptions; -import io.minio.errors.ErrorResponseException; -import io.minio.errors.InsufficientDataException; -import io.minio.errors.InternalException; -import io.minio.errors.InvalidBucketNameException; -import io.minio.errors.InvalidExpiresRangeException; -import io.minio.errors.InvalidResponseException; -import io.minio.errors.MinioException; -import io.minio.errors.XmlParserException; import lombok.extern.slf4j.Slf4j; @Slf4j @@ -88,9 +82,27 @@ private void push(MultipartFile multipartFile, String fileNameWithPath) { try { InputStream is = multipartFile.getInputStream(); long contentLength = multipartFile.getSize(); - PutObjectOptions putObjectOptions = new PutObjectOptions(contentLength, PutObjectOptions.MAX_PART_SIZE); + + /*PutObjectOptions putObjectOptions = new PutObjectOptions(contentLength, PutObjectOptions.MAX_PART_SIZE); putObjectOptions.setContentType(multipartFile.getContentType()); - minioClient.putObject(minioConfig.getBucketName(), fileNameWithPath, is, putObjectOptions); + minioClient.putObject(minioConfig.getBucketName(), fileNameWithPath, is, putObjectOptions);*/ + + long fileSize = is.available(); + PutObjectArgs.Builder putObjectArgsBuilder = PutObjectArgs.builder() + .bucket(minioConfig.getBucketName()) + .object(fileNameWithPath) + .stream(is, fileSize, -1) // Set part size to -1 for auto detection + .contentType(multipartFile.getContentType()); // Change this as per your file's content type + + // If the file is larger than 5 MB, set the part size explicitly (5 * 1024 * 1024 bytes) + /*if (fileSize > 5 * 1024 * 1024) { + putObjectArgsBuilder. .partSize(5 * 1024 * 1024); + }*/ + + minioClient.putObject(putObjectArgsBuilder.build()); + + + log.debug("Upload Successful"); } catch (MinioException | InvalidKeyException | IllegalArgumentException | NoSuchAlgorithmException @@ -103,9 +115,17 @@ private void push(MultipartFile multipartFile, String fileNameWithPath) { private void push(InputStream is, long contentLength, String contentType, String fileNameWithPath) { try { - PutObjectOptions putObjectOptions = new PutObjectOptions(contentLength, PutObjectOptions.MAX_PART_SIZE); + /*PutObjectOptions putObjectOptions = new PutObjectOptions(contentLength, PutObjectOptions.MAX_PART_SIZE); putObjectOptions.setContentType(contentType); - minioClient.putObject(minioConfig.getBucketName(), fileNameWithPath, is, putObjectOptions); + minioClient.putObject(minioConfig.getBucketName(), fileNameWithPath, is, putObjectOptions);*/ + + long fileSize = is.available(); + PutObjectArgs.Builder putObjectArgsBuilder = PutObjectArgs.builder() + .bucket(minioConfig.getBucketName()) + .object(fileNameWithPath) + .stream(is, fileSize, -1) // Set part size to -1 for auto detection + .contentType(contentType); // Change this as per your file's content type + minioClient.putObject(putObjectArgsBuilder.build()); } catch (MinioException | InvalidKeyException | IllegalArgumentException | NoSuchAlgorithmException | IOException e) { @@ -186,11 +206,11 @@ private String getSignedUrl(String fileName) { fileStoreConfig.getPreSignedUrlTimeOut(), new HashMap()); } catch (InvalidKeyException | ErrorResponseException | IllegalArgumentException | InsufficientDataException | InternalException | InvalidBucketNameException | InvalidExpiresRangeException - | InvalidResponseException | NoSuchAlgorithmException | XmlParserException | IOException e) { + | InvalidResponseException | NoSuchAlgorithmException | XmlParserException | ServerException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } - return signedUrl; + return signedUrl; } public Resource read(FileLocation fileLocation) { @@ -204,9 +224,10 @@ public Resource read(FileLocation fileLocation) { try { minioClient.getObject(minioConfig.getBucketName(), fileName, f.getName()); - } catch (InvalidKeyException | ErrorResponseException | IllegalArgumentException | InsufficientDataException - | InternalException | InvalidBucketNameException | InvalidResponseException - | NoSuchAlgorithmException | XmlParserException | IOException e) { + } catch (InvalidKeyException | ErrorResponseException | IllegalArgumentException | + InsufficientDataException | InternalException | InvalidBucketNameException | + InvalidResponseException | NoSuchAlgorithmException | XmlParserException | IOException | + ServerException e) { log.error("Error while downloading the file ", e); Map map = new HashMap<>(); map.put("ERROR_MINIO_DOWNLOAD", diff --git a/core-services/egov-filestore/src/main/resources/application.properties b/core-services/egov-filestore/src/main/resources/application.properties index 5e4a4f2cee9..2b8eb2e50ab 100644 --- a/core-services/egov-filestore/src/main/resources/application.properties +++ b/core-services/egov-filestore/src/main/resources/application.properties @@ -62,11 +62,11 @@ azure.api.version=2018-03-28 #minio and S3 config minio.url=https://s3.amazonaws.com isS3Enabled=true -aws.secretkey=minioadmin -aws.key=minioadmin +aws.secretkey=awssecret +aws.key=awskey fixed.bucketname=egov-rainmaker-1 minio.source=minio - +fixed.bucket.region=ap-south-1 spring.servlet.multipart.max-file-size=5MB spring.servlet.multipart.max-request-size=30MB diff --git a/core-services/egov-filestore/src/main/resources/db/Dockerfile b/core-services/egov-filestore/src/main/resources/db/Dockerfile index 32accf0b295..101f5240b81 100644 --- a/core-services/egov-filestore/src/main/resources/db/Dockerfile +++ b/core-services/egov-filestore/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/ddl /flyway/sql @@ -10,4 +10,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-filestore/src/main/resources/db/migrate.sh b/core-services/egov-filestore/src/main/resources/db/migrate.sh index 43960b25cdb..5593a173eba 100644 --- a/core-services/egov-filestore/src/main/resources/db/migrate.sh +++ b/core-services/egov-filestore/src/main/resources/db/migrate.sh @@ -1,3 +1,3 @@ #!/bin/sh -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate \ No newline at end of file diff --git a/core-services/egov-filestore/src/test/java/org/egov/filestore/web/contract/ResponseFactoryTest.java b/core-services/egov-filestore/src/test/java/org/egov/filestore/web/contract/ResponseFactoryTest.java index f8ce584cb76..7a6a6457707 100644 --- a/core-services/egov-filestore/src/test/java/org/egov/filestore/web/contract/ResponseFactoryTest.java +++ b/core-services/egov-filestore/src/test/java/org/egov/filestore/web/contract/ResponseFactoryTest.java @@ -2,8 +2,8 @@ import org.egov.filestore.domain.model.FileInfo; import org.egov.filestore.domain.model.FileLocation; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.List; @@ -25,7 +25,7 @@ public class ResponseFactoryTest { private final String FILENAME = "fileName"; private final String FILE_SOURCE = "diskFileStorage"; - @Before + @BeforeEach public void setUp() throws Exception { responseFactory = new ResponseFactory("/fileStore"); } diff --git a/core-services/egov-idgen/CHANGELOG.md b/core-services/egov-idgen/CHANGELOG.md index 23c78729bc3..84ecc880d40 100644 --- a/core-services/egov-idgen/CHANGELOG.md +++ b/core-services/egov-idgen/CHANGELOG.md @@ -1,5 +1,13 @@ +# Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version to 42.7.1 +- Upgraded lombok version from 1.18.8 to 1.18.22 +- Upgraded org.flywaydb:flyway-core version from 6.4.3 to 9.22.3 + ## 1.2.3 - 2022-01-13 - Updated to log4j2 version 2.17.1 diff --git a/core-services/egov-idgen/pom.xml b/core-services/egov-idgen/pom.xml index 6843c74452b..d4a2e1e8f9e 100644 --- a/core-services/egov-idgen/pom.xml +++ b/core-services/egov-idgen/pom.xml @@ -5,26 +5,25 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 3.2.2 org.egov egov-idgen - 1.2.3-SNAPSHOT + 2.9.0-SNAPSHOT egov-idgen Id generation service 2.17.1 UTF-8 - 1.8 + 17 UTF-8 - 1.18.8 + 1.18.22 org.springframework spring-beans - 5.2.20.RELEASE org.projectlombok @@ -37,6 +36,7 @@ org.postgresql postgresql + 42.7.1 org.springframework.boot @@ -62,23 +62,33 @@ org.flywaydb flyway-core - 6.4.3 + 9.22.3 org.egov.services tracer - 2.1.0-SNAPSHOT + 2.9.0-SNAPSHOT org.egov mdms-client - 0.0.3-SNAPSHOT + 2.9.0-SNAPSHOT com.jayway.jsonpath json-path 2.2.0 + + org.springframework.boot + spring-boot-starter-validation + + + junit + junit + 4.13.2 + test + @@ -97,51 +107,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.id.model.IdRequest - org.egov.id.model.IdResponse - - - org.egov.id.model.ResponseStatusEnum$ResponseStatusEnum:ResponseStatus - - - org.egov.id.model.Error:Error - org.egov.id.model.ErrorRes:ErrorRes - org.egov.id.model.Role:Role - org.egov.id.model.UserInfo:UserInfo - - Digit - true - module - diff --git a/core-services/egov-idgen/src/main/java/org/egov/id/api/IdGenerationController.java b/core-services/egov-idgen/src/main/java/org/egov/id/api/IdGenerationController.java index 171ababf6bd..b351527772c 100644 --- a/core-services/egov-idgen/src/main/java/org/egov/id/api/IdGenerationController.java +++ b/core-services/egov-idgen/src/main/java/org/egov/id/api/IdGenerationController.java @@ -1,5 +1,6 @@ package org.egov.id.api; +import jakarta.validation.Valid; import org.egov.id.model.IdGenerationRequest; import org.egov.id.model.IdGenerationResponse; import org.egov.id.service.IdGenerationService; @@ -9,7 +10,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import javax.validation.Valid; /** * api's related to the IdGeneration Controller diff --git a/core-services/egov-idgen/src/main/java/org/egov/id/model/Error.java b/core-services/egov-idgen/src/main/java/org/egov/id/model/Error.java index da3242fd452..76795bbeabc 100644 --- a/core-services/egov-idgen/src/main/java/org/egov/id/model/Error.java +++ b/core-services/egov-idgen/src/main/java/org/egov/id/model/Error.java @@ -3,10 +3,10 @@ import java.util.HashMap; import java.util.Map; -import javax.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/core-services/egov-idgen/src/main/java/org/egov/id/model/IdGenerationRequest.java b/core-services/egov-idgen/src/main/java/org/egov/id/model/IdGenerationRequest.java index 8a68d097d31..49ae5917cf1 100644 --- a/core-services/egov-idgen/src/main/java/org/egov/id/model/IdGenerationRequest.java +++ b/core-services/egov-idgen/src/main/java/org/egov/id/model/IdGenerationRequest.java @@ -4,13 +4,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; -import javax.validation.Valid; /** *

IdGenerationRequest

diff --git a/core-services/egov-idgen/src/main/java/org/egov/id/model/IdRequest.java b/core-services/egov-idgen/src/main/java/org/egov/id/model/IdRequest.java index 54e7402744a..dfff0ba0496 100644 --- a/core-services/egov-idgen/src/main/java/org/egov/id/model/IdRequest.java +++ b/core-services/egov-idgen/src/main/java/org/egov/id/model/IdRequest.java @@ -1,11 +1,10 @@ package org.egov.id.model; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; /** diff --git a/core-services/egov-idgen/src/main/java/org/egov/id/model/RequestInfo.java b/core-services/egov-idgen/src/main/java/org/egov/id/model/RequestInfo.java index efb445c11b4..97d3871b8b7 100644 --- a/core-services/egov-idgen/src/main/java/org/egov/id/model/RequestInfo.java +++ b/core-services/egov-idgen/src/main/java/org/egov/id/model/RequestInfo.java @@ -2,13 +2,13 @@ import java.io.IOException; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/core-services/egov-idgen/src/main/java/org/egov/id/model/ResponseInfo.java b/core-services/egov-idgen/src/main/java/org/egov/id/model/ResponseInfo.java index 3334c03260c..3d67eb727e6 100644 --- a/core-services/egov-idgen/src/main/java/org/egov/id/model/ResponseInfo.java +++ b/core-services/egov-idgen/src/main/java/org/egov/id/model/ResponseInfo.java @@ -1,10 +1,10 @@ package org.egov.id.model; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/core-services/egov-idgen/src/main/java/org/egov/id/model/Role.java b/core-services/egov-idgen/src/main/java/org/egov/id/model/Role.java index fc62d3eb0c0..d5722b044dd 100644 --- a/core-services/egov-idgen/src/main/java/org/egov/id/model/Role.java +++ b/core-services/egov-idgen/src/main/java/org/egov/id/model/Role.java @@ -1,10 +1,10 @@ package org.egov.id.model; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/core-services/egov-idgen/src/main/java/org/egov/id/model/TenantRole.java b/core-services/egov-idgen/src/main/java/org/egov/id/model/TenantRole.java index da647d6a8ed..2fa8cd2162e 100644 --- a/core-services/egov-idgen/src/main/java/org/egov/id/model/TenantRole.java +++ b/core-services/egov-idgen/src/main/java/org/egov/id/model/TenantRole.java @@ -3,10 +3,10 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/core-services/egov-idgen/src/main/java/org/egov/id/model/UserInfo.java b/core-services/egov-idgen/src/main/java/org/egov/id/model/UserInfo.java index 8615ee79f5a..9b045adfbb2 100644 --- a/core-services/egov-idgen/src/main/java/org/egov/id/model/UserInfo.java +++ b/core-services/egov-idgen/src/main/java/org/egov/id/model/UserInfo.java @@ -3,12 +3,12 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/core-services/egov-idgen/src/main/resources/db/Dockerfile b/core-services/egov-idgen/src/main/resources/db/Dockerfile index 70b5046615d..9fc9e02882e 100644 --- a/core-services/egov-idgen/src/main/resources/db/Dockerfile +++ b/core-services/egov-idgen/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql @@ -10,4 +10,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-indexer/CHANGELOG.md b/core-services/egov-indexer/CHANGELOG.md index 2732c86ae10..eb1b235312a 100644 --- a/core-services/egov-indexer/CHANGELOG.md +++ b/core-services/egov-indexer/CHANGELOG.md @@ -3,6 +3,16 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version to 42.7.1 +- Upgraded elasticsearch to 8.11.3 +- Upgraded org.egov.services:tracer version from 2.1.2-SNAPSHOT to 2.9.0-SNAPSHOT +- Upgraded org.egov:mdms-client version from 0.0.4-SNAPSHOT to 2.9.0-SNAPSHOT +- Upgraded lombok version from 1.18.8 to 1.18.22 +- Upgraded org.flywaydb:flyway-core version from 6.4.3 to 9.22.3 + ## 1.1.8 - 2023-08-11 - Central Instance Library Integration diff --git a/core-services/egov-indexer/pom.xml b/core-services/egov-indexer/pom.xml index a8051bd12e6..a0a36c23b52 100644 --- a/core-services/egov-indexer/pom.xml +++ b/core-services/egov-indexer/pom.xml @@ -5,44 +5,34 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 3.2.2 org.egov egov-indexer - 1.1.8-SNAPSHOT + 2.9.0-SNAPSHOT egov-indexer egov indexer framework http://maven.apache.org 2.17.1 UTF-8 - 1.8 + 17 UTF-8 - 1.18.8 + 1.18.22 1.2.0.Final - - org.springframework - spring-beans - 5.2.20.RELEASE - junit junit 3.8.1 test - - org.egov.services - services-common - 1.1.1-SNAPSHOT - org.egov.services tracer - 2.1.2-SNAPSHOT + 2.9.0-SNAPSHOT org.springframework.boot @@ -54,9 +44,13 @@ test - org.apache.commons - commons-lang3 - 3.4 + org.springframework.boot + spring-boot-starter-validation + + + commons-io + commons-io + 2.15.1 org.projectlombok @@ -88,7 +82,7 @@ org.flywaydb flyway-core - 6.4.3 + 9.22.3 org.postgresql @@ -101,7 +95,7 @@ org.egov mdms-client - 0.0.4-SNAPSHOT + 2.9.0-SNAPSHOT org.springframework.boot @@ -147,47 +141,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.infra.indexer.web.contract.ReindexRequest - org.egov.infra.indexer.web.contract.LegacyIndexRequest - org.egov.infra.indexer.web.contract.ReindexResponse - org.egov.infra.indexer.web.contract.LegacyIndexResponse - - - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - module - diff --git a/core-services/egov-indexer/src/main/java/org/egov/IndexerInfraApplication.java b/core-services/egov-indexer/src/main/java/org/egov/IndexerInfraApplication.java index b7d2f9d3835..638ce92d0bd 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/IndexerInfraApplication.java +++ b/core-services/egov-indexer/src/main/java/org/egov/IndexerInfraApplication.java @@ -15,6 +15,9 @@ import org.springframework.core.env.Environment; import org.springframework.web.client.RestTemplate; import org.springframework.context.annotation.EnableAspectJAutoProxy; +import javax.net.ssl.*; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; import java.util.concurrent.TimeUnit; @@ -29,6 +32,40 @@ public class IndexerInfraApplication { @Value("${cache.expiry.mdms.masters.minutes}") private int mdmsMasterExpiry; + + /** + ES8 cluster default configuration with security enabled forces the use of https for communication to the ES cluster. + This function is used to accept the self signed certificates from the ES8 cluster so SSLCertificateException is not t hrown. + The ideal way to solve this is to import the self signed certificates into the JKS. + */ + + public static void trustSelfSignedSSL() { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } + }; + ctx.init(null, new TrustManager[]{tm}, null); + SSLContext.setDefault(ctx); + + // Disable hostname verification + HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { + public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { + return true; + } + }); + } catch (Exception ex) { + ex.printStackTrace(); + } + } public static void main(String[] args) { SpringApplication.run(IndexerInfraApplication.class, args); @@ -36,7 +73,8 @@ public static void main(String[] args) { @Bean public RestTemplate restTemplate() { - return new RestTemplate(); + trustSelfSignedSSL(); + return new RestTemplate(); } @Bean diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/bulkindexer/BulkIndexer.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/bulkindexer/BulkIndexer.java index f51da64022d..080796fcfdf 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/bulkindexer/BulkIndexer.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/bulkindexer/BulkIndexer.java @@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; import org.springframework.web.client.ResourceAccessException; import org.springframework.web.client.RestTemplate; +import org.springframework.http.HttpMethod; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; @@ -42,6 +43,7 @@ public void indexJsonOntoES(String url, String indexJson, Index index) throws Ex log.debug("Record being indexed: " + indexJson); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); + headers.add("Authorization", indexerUtils.getESEncodedCredentials()); final HttpEntity entity = new HttpEntity<>(indexJson, headers); Object response = restTemplate.postForObject(url.toString(), entity, Map.class); if (url.contains("_bulk")) { @@ -93,15 +95,18 @@ public Object getIndexMappingfromES(String url) { public Object getESResponse(String url, Object body, String httpMethod) { Object response = null; if (null != body) { + final HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", indexerUtils.getESEncodedCredentials()); + final HttpEntity entity = new HttpEntity<>(body, headers); if (httpMethod.equals("POST")) { try { - response = restTemplate.postForObject(url, body, Map.class); + response = restTemplate.postForObject(url, entity, Map.class); } catch (Exception e) { log.error("POST: Exception while fetching from es: " + e); } } else if (httpMethod.equals("PUT")) { try { - restTemplate.put(url, body); + restTemplate.put(url, entity); response = "OK"; } catch (Exception e) { log.error("PUT: Exception while updating settings on es: " + e); @@ -109,7 +114,10 @@ public Object getESResponse(String url, Object body, String httpMethod) { } } else { try { - response = restTemplate.getForObject(url, Map.class); + final HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", indexerUtils.getESEncodedCredentials()); + final HttpEntity entity = new HttpEntity(headers); + response = restTemplate.exchange(url, HttpMethod.GET, entity, Map.class); } catch (Exception e) { log.error("GET: Exception while fetching from es: " + e); } diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/BPACustomIndexConsumerConfig.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/BPACustomIndexConsumerConfig.java index a13e4e35fcf..c621356f0d8 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/BPACustomIndexConsumerConfig.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/BPACustomIndexConsumerConfig.java @@ -6,6 +6,7 @@ import org.egov.IndexerApplicationRunnerImpl; import org.egov.infra.indexer.consumer.BPACustomIndexMessageListener; import org.egov.infra.indexer.consumer.PTCustomIndexMessageListener; +import org.egov.tracer.KafkaConsumerErrorHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; @@ -52,6 +53,9 @@ public class BPACustomIndexConsumerConfig implements ApplicationRunner { @Autowired private StoppingErrorHandler stoppingErrorHandler; + @Autowired + private KafkaConsumerErrorHandler kafkaConsumerErrorHandler; + @Autowired private BPACustomIndexMessageListener indexerMessageListener; @@ -104,7 +108,7 @@ public ConsumerFactory consumerFactory() { public KafkaListenerContainerFactory> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); - factory.setErrorHandler(stoppingErrorHandler); + factory.setCommonErrorHandler(kafkaConsumerErrorHandler); factory.setConcurrency(3); factory.getContainerProperties().setPollTimeout(30000); diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/CoreIndexConsumerConfig.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/CoreIndexConsumerConfig.java index 793bd2d5f2b..2ad685dc352 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/CoreIndexConsumerConfig.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/CoreIndexConsumerConfig.java @@ -5,13 +5,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.common.serialization.StringDeserializer; import org.egov.IndexerApplicationRunnerImpl; import org.egov.infra.indexer.consumer.CoreIndexMessageListener; import org.egov.infra.indexer.web.contract.Mapping; import org.egov.infra.indexer.web.contract.Mapping.ConfigKeyEnum; +import org.egov.tracer.KafkaConsumerErrorHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; @@ -31,7 +31,6 @@ import lombok.extern.slf4j.Slf4j; - @Configuration @EnableKafka @PropertySource("classpath:application.properties") @@ -77,8 +76,11 @@ public class CoreIndexConsumerConfig implements ApplicationRunner { @Value("${egov.indexer.bpa.update.workflow.topic.name}") private String bpaUpdateWorkflowTopic; - @Autowired - private StoppingErrorHandler stoppingErrorHandler; +// @Autowired +// private StoppingErrorHandler stoppingErrorHandler; + + @Autowired + private KafkaConsumerErrorHandler kafkaConsumerErrorHandler; @Autowired private CoreIndexMessageListener indexerMessageListener; @@ -93,7 +95,7 @@ public class CoreIndexConsumerConfig implements ApplicationRunner { public void run(final ApplicationArguments arg0) throws Exception { try { log.info("Starting kafka listener container......"); - startContainer(); + initializeContainer(); }catch(Exception e){ log.error("Exception while Starting kafka listener container: ",e); } @@ -102,7 +104,7 @@ public void run(final ApplicationArguments arg0) throws Exception { public String setTopics(){ String[] excludeArray = {pgrCreateTopic, pgrUpdateTopic, ptCreateTopic, ptUpdateTopic, pgrServicesCreateTopic, pgrServicesBatchCreateTopic,bpaCreateTopic,bpaUpdateTopic,bpaUpdateWorkflowTopic}; int noOfExculdedTopics = 0; - List topicsList = runner.getTopicMaps().get(ConfigKeyEnum.INDEX.toString()); + List topicsList = runner.getTopicMaps().get(ConfigKeyEnum.INDEX.toString()); for(String excludeTopic: excludeArray) { if(topicsList.contains(excludeTopic)) noOfExculdedTopics++; } @@ -140,7 +142,7 @@ public ConsumerFactory consumerFactory() { public KafkaListenerContainerFactory> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); - factory.setErrorHandler(stoppingErrorHandler); + factory.setCommonErrorHandler(kafkaConsumerErrorHandler); factory.setConcurrency(3); factory.getContainerProperties().setPollTimeout(30000); @@ -162,7 +164,7 @@ public KafkaMessageListenerContainer container() throws Exceptio return new KafkaMessageListenerContainer<>(consumerFactory(), properties); } - public boolean startContainer(){ + public boolean initializeContainer(){ KafkaMessageListenerContainer container = null; try { container = container(); @@ -177,11 +179,11 @@ public boolean startContainer(){ } - public boolean pauseContainer(){ + public static boolean pauseContainer(){ try { kafkContainer.stop(); } catch (Exception e) { - log.error("Container couldn't be started: ",e); + log.error("Container couldn't be stopped: ", e); return false; } log.info("Custom KakfaListenerContainer STOPPED..."); @@ -189,4 +191,16 @@ public boolean pauseContainer(){ return true; } + public static boolean resumeContainer(){ + try { + kafkContainer.start(); + } catch (Exception e) { + log.error("Container couldn't be started: ", e); + return false; + } + log.info("Custom KakfaListenerContainer STARTED..."); + + return true; + } + } diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/LegacyIndexConsumerConfig.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/LegacyIndexConsumerConfig.java index 516f09dfd1b..1fba06b9225 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/LegacyIndexConsumerConfig.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/LegacyIndexConsumerConfig.java @@ -11,6 +11,7 @@ import org.egov.IndexerApplicationRunnerImpl; import org.egov.infra.indexer.consumer.LegacyIndexMessageListener; import org.egov.infra.indexer.web.contract.Mapping.ConfigKeyEnum; +import org.egov.tracer.KafkaConsumerErrorHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; @@ -30,7 +31,6 @@ import lombok.extern.slf4j.Slf4j; - @Configuration @EnableKafka @PropertySource("classpath:application.properties") @@ -54,11 +54,11 @@ public class LegacyIndexConsumerConfig implements ApplicationRunner { @Value("${egov.indexer.pgr.legacyindex.topic.name}") private String pgrLegacyTopic; - - @Autowired - private StoppingErrorHandler stoppingErrorHandler; - - @Autowired + + @Autowired + private KafkaConsumerErrorHandler kafkaConsumerErrorHandler; + + @Autowired private LegacyIndexMessageListener indexerMessageListener; @Autowired @@ -80,7 +80,7 @@ public void run(final ApplicationArguments arg0) throws Exception { public String setTopics(){ String[] excludeArray = {ptLegacyTopic, pgrLegacyTopic}; int noOfExculdedTopics = 0; - List topicsList = runner.getTopicMaps().get(ConfigKeyEnum.LEGACYINDEX.toString()); + List topicsList = runner.getTopicMaps().get(ConfigKeyEnum.LEGACYINDEX.toString()); topicsList.add(legacyIndexTopic); for(String excludeTopic: excludeArray) { if(topicsList.contains(excludeTopic)) noOfExculdedTopics++; @@ -118,7 +118,7 @@ public ConsumerFactory consumerFactory() { public KafkaListenerContainerFactory> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); - factory.setErrorHandler(stoppingErrorHandler); + factory.setCommonErrorHandler(kafkaConsumerErrorHandler); factory.setConcurrency(3); factory.getContainerProperties().setPollTimeout(30000); @@ -155,16 +155,27 @@ public boolean startContainer(){ } - public boolean pauseContainer(){ + public static boolean pauseContainer(){ try { kafkContainer.stop(); } catch (Exception e) { - log.error("Container couldn't be started: ",e); + log.error("Container couldn't be paused: ", e); return false; } - log.info("Custom KakfaListenerContainer STOPPED..."); + log.info("Custom KakfaListenerContainer PAUSED..."); return true; } + public static boolean resumeContainer(){ + try { + kafkContainer.start(); + } catch (Exception e) { + log.error("Container couldn't be started: ", e); + return false; + } + log.info("Custom KakfaListenerContainer STARTED..."); + + return true; + } } diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/PGRCustomIndexConsumerConfig.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/PGRCustomIndexConsumerConfig.java index 21bbbeb0340..bb9a35e543c 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/PGRCustomIndexConsumerConfig.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/PGRCustomIndexConsumerConfig.java @@ -7,6 +7,7 @@ import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.common.serialization.StringDeserializer; import org.egov.infra.indexer.consumer.PGRCustomIndexMessageListener; +import org.egov.tracer.KafkaConsumerErrorHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; @@ -63,9 +64,12 @@ public class PGRCustomIndexConsumerConfig implements ApplicationRunner { @Value("${pgr.batch.create.topic.name}") private String pgrServicesBatchCreateTopic; +// @Autowired +// private StoppingErrorHandler stoppingErrorHandler; + @Autowired - private StoppingErrorHandler stoppingErrorHandler; - + private KafkaConsumerErrorHandler kafkaConsumerErrorHandler; + @Autowired private PGRCustomIndexMessageListener indexerMessageListener; @@ -118,7 +122,7 @@ public ConsumerFactory consumerFactory() { public KafkaListenerContainerFactory> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); - factory.setErrorHandler(stoppingErrorHandler); + factory.setCommonErrorHandler(kafkaConsumerErrorHandler); factory.setConcurrency(3); factory.getContainerProperties().setPollTimeout(30000); diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/PTCustomIndexConsumerConfig.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/PTCustomIndexConsumerConfig.java index 0468eda31d6..a0a932fb822 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/PTCustomIndexConsumerConfig.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/PTCustomIndexConsumerConfig.java @@ -8,6 +8,7 @@ import org.apache.kafka.common.serialization.StringDeserializer; import org.egov.IndexerApplicationRunnerImpl; import org.egov.infra.indexer.consumer.PTCustomIndexMessageListener; +import org.egov.tracer.KafkaConsumerErrorHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; @@ -52,8 +53,11 @@ public class PTCustomIndexConsumerConfig implements ApplicationRunner { @Value("${egov.indexer.pt.legacyindex.topic.name}") private String ptLegacyTopic; - @Autowired - private StoppingErrorHandler stoppingErrorHandler; +// @Autowired +// private StoppingErrorHandler stoppingErrorHandler; + + @Autowired + private KafkaConsumerErrorHandler kafkaConsumerErrorHandler; @Autowired private PTCustomIndexMessageListener indexerMessageListener; @@ -107,7 +111,7 @@ public ConsumerFactory consumerFactory() { public KafkaListenerContainerFactory> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); - factory.setErrorHandler(stoppingErrorHandler); + factory.setCommonErrorHandler(kafkaConsumerErrorHandler); factory.setConcurrency(3); factory.getContainerProperties().setPollTimeout(30000); diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/ReindexConsumerConfig.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/ReindexConsumerConfig.java index a8d6eccbc3d..ab8fc5f295f 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/ReindexConsumerConfig.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/ReindexConsumerConfig.java @@ -5,12 +5,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.common.serialization.StringDeserializer; import org.egov.IndexerApplicationRunnerImpl; import org.egov.infra.indexer.consumer.ReindexMessageListener; import org.egov.infra.indexer.web.contract.Mapping.ConfigKeyEnum; +import org.egov.tracer.KafkaConsumerErrorHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; @@ -30,7 +30,6 @@ import lombok.extern.slf4j.Slf4j; - @Configuration @EnableKafka @PropertySource("classpath:application.properties") @@ -48,9 +47,9 @@ public class ReindexConsumerConfig implements ApplicationRunner { @Value("${egov.core.reindex.topic.name}") private String reindexTopic; - - @Autowired - private StoppingErrorHandler stoppingErrorHandler; + + @Autowired + private KafkaConsumerErrorHandler kafkaConsumerErrorHandler; @Autowired private ReindexMessageListener indexerMessageListener; @@ -66,7 +65,7 @@ public class ReindexConsumerConfig implements ApplicationRunner { public void run(final ApplicationArguments arg0) throws Exception { try { log.info("Starting kafka listener container......"); - startContainer(); + initializeContainer(); }catch(Exception e){ log.error("Exception while Starting kafka listener container: ",e); } @@ -74,9 +73,9 @@ public void run(final ApplicationArguments arg0) throws Exception { public String setTopics(){ Map> topicsMap = runner.getTopicMaps(); - List topicsList = topicsMap.get(ConfigKeyEnum.REINDEX.toString()); + List topicsList = topicsMap.get(ConfigKeyEnum.REINDEX.toString()); topicsList.add(reindexTopic); - String[] topicsArray = new String[topicsMap.get(ConfigKeyEnum.REINDEX.toString()).size()]; + String[] topicsArray = new String[topicsMap.get(ConfigKeyEnum.REINDEX.toString()).size()]; int i = 0; for(String topic : topicsMap.get(ConfigKeyEnum.REINDEX.toString())){ topicsArray[i] = topic; i++; @@ -108,7 +107,7 @@ public ConsumerFactory consumerFactory() { public KafkaListenerContainerFactory> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); - factory.setErrorHandler(stoppingErrorHandler); + factory.setCommonErrorHandler(kafkaConsumerErrorHandler); factory.setConcurrency(3); factory.getContainerProperties().setPollTimeout(30000); @@ -130,7 +129,7 @@ public KafkaMessageListenerContainer container() throws Exceptio return new KafkaMessageListenerContainer<>(consumerFactory(), properties); } - public boolean startContainer(){ + public boolean initializeContainer(){ KafkaMessageListenerContainer container = null; try { container = container(); @@ -145,11 +144,11 @@ public boolean startContainer(){ } - public boolean pauseContainer(){ + public static boolean pauseContainer(){ try { kafkContainer.stop(); } catch (Exception e) { - log.error("Container couldn't be started: ",e); + log.error("Container couldn't be stopped: ",e); return false; } log.info("Custom KakfaListenerContainer STOPPED..."); @@ -157,4 +156,16 @@ public boolean pauseContainer(){ return true; } + public static boolean resumeContainer(){ + try { + kafkContainer.start(); + } catch (Exception e) { + log.error("Container couldn't be started: ",e); + return false; + } + log.info("Custom KakfaListenerContainer STARTED AGAIN..."); + + return true; + } + } diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/StoppingErrorHandler.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/StoppingErrorHandler.java index ce9ee6ba7d5..2d3e8a5dd52 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/StoppingErrorHandler.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/consumer/config/StoppingErrorHandler.java @@ -1,20 +1,22 @@ package org.egov.infra.indexer.consumer.config; -import org.apache.kafka.clients.consumer.ConsumerRecord; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.config.KafkaListenerEndpointRegistry; -import org.springframework.kafka.listener.ErrorHandler; +import org.springframework.kafka.listener.CommonErrorHandler; import org.springframework.stereotype.Component; @Component -public class StoppingErrorHandler implements ErrorHandler { +public class StoppingErrorHandler implements CommonErrorHandler { @Autowired private KafkaListenerEndpointRegistry kafkaListenerEndpointRegistry; - @Override - public void handle(Exception thrownException, ConsumerRecord record) { - kafkaListenerEndpointRegistry.stop(); - } +// @Override +// public void handle(Exception thrownException, ConsumerRecord record) { +// kafkaListenerEndpointRegistry.stop(); +// } + + + } diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/controller/IndexerController.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/controller/IndexerController.java index 4a5b9fc5a7a..6b6464707c1 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/controller/IndexerController.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/controller/IndexerController.java @@ -1,6 +1,6 @@ package org.egov.infra.indexer.controller; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.infra.indexer.producer.IndexerProducer; import org.egov.infra.indexer.service.LegacyIndexService; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/AuditDetails.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/AuditDetails.java index 10e65875c84..d24fbdc2e98 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/AuditDetails.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/AuditDetails.java @@ -12,7 +12,6 @@ * Collection of audit related fields used by most models */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPA.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPA.java index 44e3fb7a57e..d95c90e09d8 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPA.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPA.java @@ -6,9 +6,9 @@ import org.egov.infra.indexer.custom.bpa.landInfo.LandInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -17,7 +17,7 @@ * BPA application object to capture the details of land, land owners, and address of the land. */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @Getter @Setter @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPARequest.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPARequest.java index b606269a336..29b8b2e0db1 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPARequest.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPARequest.java @@ -3,18 +3,17 @@ import com.fasterxml.jackson.annotation.JsonProperty; //import io.swagger.annotations.ApiModel; //import io.swagger.annotations.ApiModelProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.common.contract.request.RequestInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; import java.util.Objects; /** * Contract class to receive request. Array of Property items are used in case of create . Where as single Property item is used for update */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @Getter @Setter @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPAResponse.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPAResponse.java index b3e9071d4a1..07945ebe689 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPAResponse.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/BPAResponse.java @@ -5,7 +5,7 @@ import org.egov.common.contract.response.ResponseInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; +import jakarta.validation.Valid; import java.util.List; import java.util.Objects; @@ -13,7 +13,7 @@ * Contains the ResponseHeader and the created/updated property */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @Getter @Setter @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/Document.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/Document.java index 329695c7ce1..976ad8aa892 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/Document.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/Document.java @@ -6,15 +6,15 @@ import lombok.NoArgsConstructor; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import java.util.Objects; /** * This object holds list of documents attached during the transaciton for a property */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:54:07.373Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:54:07.373Z[GMT]") @Builder @NoArgsConstructor @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/EnrichedBPA.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/EnrichedBPA.java index 9fab06c36bc..d950aa66528 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/EnrichedBPA.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/EnrichedBPA.java @@ -5,9 +5,9 @@ import org.egov.infra.indexer.custom.bpa.landInfo.EnrichedLandInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -16,7 +16,7 @@ * BPA application object to capture the details of land, land owners, and address of the land. */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @Getter @Setter @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/EnrichedBPARequest.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/EnrichedBPARequest.java index 3d79d6c522a..bb3e86161f8 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/EnrichedBPARequest.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/EnrichedBPARequest.java @@ -1,18 +1,17 @@ package org.egov.infra.indexer.custom.bpa; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.common.contract.request.RequestInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; import java.util.Objects; /** * Contract class to receive request. Array of Property items are used in case of create . Where as single Property item is used for update */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @Getter @Setter @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/Workflow.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/Workflow.java index 26565ae17d4..514be1f0f45 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/Workflow.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/Workflow.java @@ -6,8 +6,8 @@ import lombok.NoArgsConstructor; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -16,7 +16,7 @@ * BPA application object to capture the details of land, land owners, and address of the land. */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Address.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Address.java index 3f6a4c263ee..69555bf581b 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Address.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Address.java @@ -2,22 +2,21 @@ import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.NoArgsConstructor; import org.egov.infra.indexer.custom.bpa.AuditDetails; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import java.util.Objects; /** * Representation of a address. Indiavidual APIs may choose to extend from this using allOf if more details needed to be added in their case. */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:54:07.373Z[GMT]") @Builder @NoArgsConstructor @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Boundary.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Boundary.java index 055aa859193..cae62576828 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Boundary.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Boundary.java @@ -1,13 +1,13 @@ package org.egov.infra.indexer.custom.bpa.landInfo; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.NoArgsConstructor; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -16,7 +16,6 @@ * Boundary */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/EnrichedLandInfo.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/EnrichedLandInfo.java index 3b7210b98c3..a5195b9461e 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/EnrichedLandInfo.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/EnrichedLandInfo.java @@ -6,9 +6,9 @@ import org.egov.infra.indexer.custom.bpa.Document; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import java.util.ArrayList; import java.util.List; import java.util.Objects; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/EnrichedUnit.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/EnrichedUnit.java index e102eee7cfd..2e1eda7b38f 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/EnrichedUnit.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/EnrichedUnit.java @@ -7,8 +7,8 @@ import org.egov.infra.indexer.custom.bpa.AuditDetails; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import java.util.List; import java.util.Objects; import java.util.Set; @@ -17,7 +17,7 @@ * Unit */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:54:07.373Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:54:07.373Z[GMT]") @Builder @NoArgsConstructor @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/GeoLocation.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/GeoLocation.java index 2a638a0b002..ed2b44046d5 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/GeoLocation.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/GeoLocation.java @@ -12,7 +12,7 @@ * GeoLocation */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Institution.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Institution.java index 56d2fe62d4b..1cbef51f708 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Institution.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Institution.java @@ -6,14 +6,14 @@ import lombok.NoArgsConstructor; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; import java.util.Objects; /** * Institution */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfo.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfo.java index 65a85c310fb..a99179e3ad0 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfo.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfo.java @@ -8,9 +8,9 @@ import org.egov.infra.indexer.custom.bpa.Document; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -19,7 +19,7 @@ * LandInfo */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfoRequest.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfoRequest.java index 2dcb6f75007..8c76fe550ba 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfoRequest.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfoRequest.java @@ -7,14 +7,14 @@ import org.egov.common.contract.request.RequestInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; +import jakarta.validation.Valid; import java.util.Objects; /** * Contract class to receive request. Array of Property items are used in case of create . Where as single Property item is used for update */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfoResponse.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfoResponse.java index 0442cc167ab..186f95971aa 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfoResponse.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandInfoResponse.java @@ -7,7 +7,7 @@ import org.egov.common.contract.response.ResponseInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; +import jakarta.validation.Valid; import java.util.List; import java.util.Objects; @@ -15,7 +15,7 @@ * Contains the ResponseHeader and the created/updated property */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandSearchCriteria.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandSearchCriteria.java index c90e4e84fc4..72e82366d4a 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandSearchCriteria.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/LandSearchCriteria.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.*; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import java.util.List; @Getter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/OwnerInfo.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/OwnerInfo.java index e46ffcda7c8..48a4f46f14d 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/OwnerInfo.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/OwnerInfo.java @@ -9,10 +9,10 @@ import org.egov.infra.indexer.custom.bpa.Document; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import jakarta.validation.constraints.Size; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -22,7 +22,7 @@ * OwnerInfo */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:54:07.373Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:54:07.373Z[GMT]") @Builder @NoArgsConstructor @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Role.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Role.java index 043a81f0958..4ec2058b181 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Role.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Role.java @@ -6,15 +6,15 @@ import lombok.NoArgsConstructor; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import java.util.Objects; /** * minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/TenantRole.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/TenantRole.java index 0f4c24ca738..7b67f11e68c 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/TenantRole.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/TenantRole.java @@ -8,8 +8,8 @@ import org.egov.common.contract.request.Role; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -18,7 +18,7 @@ * User role carries the tenant related role information for the user. A user can have multiple roles per tenant based on the need of the tenant. A user may also have multiple roles for multiple tenants. */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Unit.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Unit.java index cd18b9a0055..b38084267f2 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Unit.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/Unit.java @@ -7,15 +7,15 @@ import org.egov.infra.indexer.custom.bpa.AuditDetails; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import java.util.Objects; /** * Unit */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:54:07.373Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:54:07.373Z[GMT]") @Builder @NoArgsConstructor @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/UserInfo.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/UserInfo.java index ab2542584fa..79b7a149b93 100755 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/UserInfo.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/bpa/landInfo/UserInfo.java @@ -7,8 +7,8 @@ import org.egov.common.contract.request.Role; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -17,7 +17,7 @@ * This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server. */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-06-23T05:52:32.717Z[GMT]") @NoArgsConstructor @AllArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ActionHistory.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ActionHistory.java index 914e4c9a42e..52c5690472b 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ActionHistory.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ActionHistory.java @@ -4,7 +4,7 @@ import java.util.List; import java.util.Objects; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.springframework.validation.annotation.Validated; @@ -20,7 +20,7 @@ * Each Object of action History will point to the Service. */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-03-23T08:00:37.661Z") +@jakarta.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-03-23T08:00:37.661Z") @AllArgsConstructor @NoArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ActionInfo.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ActionInfo.java index 6b1a8b43b52..3583b2778a1 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ActionInfo.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ActionInfo.java @@ -4,8 +4,8 @@ import java.util.List; import java.util.Objects; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import org.springframework.validation.annotation.Validated; @@ -21,7 +21,7 @@ * Capture the details of action on service request. */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-03-23T08:00:37.661Z") +@jakarta.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-03-23T08:00:37.661Z") @AllArgsConstructor @NoArgsConstructor @Builder diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/Address.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/Address.java index 0cb23a5b2e7..25698302c72 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/Address.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/Address.java @@ -1,6 +1,6 @@ package org.egov.infra.indexer.custom.pgr; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/AuditDetails.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/AuditDetails.java index 1f2df92edc1..16242775124 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/AuditDetails.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/AuditDetails.java @@ -12,7 +12,7 @@ /** * Collection of audit related fields used by most models */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-02-23T09:30:28.401Z") +@jakarta.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-02-23T09:30:28.401Z") @AllArgsConstructor @NoArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/Service.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/Service.java index c68ed82f937..da9890f4a04 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/Service.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/Service.java @@ -1,9 +1,9 @@ package org.egov.infra.indexer.custom.pgr; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotEmpty; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ServiceIndexObject.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ServiceIndexObject.java index e7468eab236..a0c0a66b5df 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ServiceIndexObject.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ServiceIndexObject.java @@ -1,6 +1,6 @@ package org.egov.infra.indexer.custom.pgr; -import javax.validation.Valid; +import jakarta.validation.Valid; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ServiceResponse.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ServiceResponse.java index 90458d8a0e0..d5c06375aa8 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ServiceResponse.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pgr/ServiceResponse.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.common.contract.response.ResponseInfo; import org.springframework.validation.annotation.Validated; @@ -21,7 +21,7 @@ * Response to the service request */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-03-23T08:00:37.661Z") +@jakarta.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-03-23T08:00:37.661Z") @Data @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Address.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Address.java index 8d99a3a7490..c89a12a8043 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Address.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Address.java @@ -10,9 +10,9 @@ import lombok.NoArgsConstructor; import lombok.Setter; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; /** * Address diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/AuditDetails.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/AuditDetails.java index 3e361265d37..caf06d27460 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/AuditDetails.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/AuditDetails.java @@ -11,13 +11,13 @@ import lombok.Setter; import lombok.ToString; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; /** * Collection of audit related fields used by most models */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Boundary.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Boundary.java index b0b1494c5a3..da01408412c 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Boundary.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Boundary.java @@ -3,9 +3,9 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import org.springframework.validation.annotation.Validated; @@ -21,7 +21,7 @@ * Boundary */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Document.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Document.java index 04ddcd3652c..045b2b4ef92 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Document.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Document.java @@ -10,13 +10,13 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; /** * This object holds list of documents attached during the transaciton for a property */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @Data @AllArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Institution.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Institution.java index b00274ea941..040b62532f4 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Institution.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Institution.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import lombok.*; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/OwnerInfo.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/OwnerInfo.java index afd72327dd4..16d0a026ae6 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/OwnerInfo.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/OwnerInfo.java @@ -2,8 +2,8 @@ import java.util.*; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; @@ -16,7 +16,7 @@ * OwnerInfo */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Property.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Property.java index 65f36e74b52..c9279246ab2 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Property.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Property.java @@ -5,9 +5,9 @@ import java.util.List; import java.util.Set; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import org.springframework.validation.annotation.Validated; @@ -27,7 +27,7 @@ * Property */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @ToString @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyDetail.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyDetail.java index d7aebb0c3bd..f867ccb9100 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyDetail.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyDetail.java @@ -3,9 +3,9 @@ import java.math.BigDecimal; import java.util.*; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import org.egov.common.contract.request.User; import org.springframework.validation.annotation.Validated; @@ -26,7 +26,7 @@ * PropertyDetail */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyInfo.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyInfo.java index e26f23652bc..ae10131def0 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyInfo.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyInfo.java @@ -5,10 +5,10 @@ import java.util.List; import java.util.Set; -import javax.validation.Valid; -import javax.validation.constraints.Max; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Pattern; +import jakarta.validation.constraints.Size; import lombok.*; import org.springframework.validation.annotation.Validated; @@ -21,7 +21,7 @@ * This is lightweight property object that can be used as reference by definitions needing property linking. Actual Property Object extends this to include more elaborate attributes of the property. */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyRequest.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyRequest.java index 022148bb4c0..262a5548dc3 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyRequest.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyRequest.java @@ -3,9 +3,9 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; import org.egov.common.contract.request.RequestInfo; @@ -17,7 +17,7 @@ * Contract class to receive request. Array of Property items are used in case of create . Where as single Property item is used for update */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @ToString @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyResponse.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyResponse.java index 11053773bbd..d325d6d9302 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyResponse.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/PropertyResponse.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.common.contract.response.ResponseInfo; import org.springframework.validation.annotation.Validated; @@ -21,7 +21,7 @@ * Contract class to send response. Array of Property items are used in case of search results or response for create. Where as single Property item is used for update */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Unit.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Unit.java index 8ff4fae2367..65f0ffd1ebc 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Unit.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/Unit.java @@ -5,9 +5,9 @@ import java.util.HashSet; import java.util.Set; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; @@ -26,7 +26,7 @@ * Unit */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-05-11T14:12:44.497+05:30") @Getter @Setter diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/User.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/User.java index f8ded00abd2..9546588fc37 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/User.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/custom/pt/User.java @@ -5,11 +5,11 @@ import java.util.List; import java.util.Objects; -import javax.validation.Valid; -import javax.validation.constraints.Digits; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import jakarta.validation.constraints.Size; import lombok.*; import org.springframework.validation.annotation.Validated; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/models/AuditDetails.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/models/AuditDetails.java index 8bb757639c9..d3ce1ddeaff 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/models/AuditDetails.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/models/AuditDetails.java @@ -12,7 +12,6 @@ /** * Collection of audit related fields used by most models */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-02-23T09:30:28.401Z") @AllArgsConstructor @NoArgsConstructor diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/DataTransformationService.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/DataTransformationService.java index db38fa71673..64e0911c4fc 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/DataTransformationService.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/DataTransformationService.java @@ -1,5 +1,6 @@ package org.egov.infra.indexer.service; +import java.io.Serializable; import java.util.List; import java.util.Map; import java.util.regex.Matcher; @@ -9,6 +10,7 @@ import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.StringUtils; import org.egov.infra.indexer.util.IndexerConstants; import org.egov.infra.indexer.util.IndexerUtils; @@ -203,17 +205,19 @@ public DocumentContext enrichDataUsingExternalServices(DocumentContext documentC for (UriMapping uriMapping : customJsonMappings.getExternalUriMapping()) { Object response = null; String uri = null; - try { - uri = indexerUtils.buildUri(uriMapping, kafkaJson); - String jsonContent = serviceRequestRepository.fetchResult(uri, uriMapping.getRequest(), stateLevelTenantId); - response = mapper.readValue(jsonContent, Map.class); - if (null == response) + try { + uri = indexerUtils.buildUri(uriMapping, kafkaJson); + Object deepReq = SerializationUtils.clone((Serializable) uriMapping.getRequest()); + indexerUtils.fillJsonPath(deepReq,kafkaJson); + String jsonContent = serviceRequestRepository.fetchResult(uri, deepReq, stateLevelTenantId); + response = mapper.readValue(jsonContent, Map.class); + if (null == response) + continue; + } catch (Exception e) { + log.error("Exception while making external call: ", e); + log.error("URI: " + uri); continue; - } catch (Exception e) { - log.error("Exception while making external call: ", e); - log.error("URI: " + uri); - continue; - } + } log.debug("Response: " + response + " from the URI: " + uriMapping.getPath()); for (FieldMapping fieldMapping : uriMapping.getUriResponseMapping()) { String[] expressionArray = (fieldMapping.getOutJsonPath()).split("[.]"); diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/IndexerService.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/IndexerService.java index 8419866c88d..ae23bbca01a 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/IndexerService.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/IndexerService.java @@ -123,7 +123,7 @@ public void indexProccessor(Index index, Mapping.ConfigKeyEnum configkey, String Long startTime = null; log.debug("index: " + index.getCustomJsonMapping()); StringBuilder url = new StringBuilder(); - url.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/").append("_bulk"); + url.append(esHostUrl).append(index.getName()).append("/").append("_bulk"); startTime = new Date().getTime(); String jsonToBeIndexed; if (null != index.getCustomJsonMapping()) { @@ -171,9 +171,8 @@ public void validateAndIndex(String finalJson, String url, Index index) throws E */ public void indexWithESId(Index index, String finalJson) throws Exception { StringBuilder urlForNonBulk = new StringBuilder(); - urlForNonBulk.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/") - .append("_index"); + urlForNonBulk.append(esHostUrl).append(index.getName()).append("/").append(index.getType()); bulkIndexer.indexJsonOntoES(urlForNonBulk.toString(), finalJson, index); } -} \ No newline at end of file +} diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/LegacyIndexService.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/LegacyIndexService.java index 5e0f6560b01..4d762832295 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/LegacyIndexService.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/LegacyIndexService.java @@ -109,7 +109,7 @@ public LegacyIndexResponse createLegacyindexJob(LegacyIndexRequest legacyindexRe LegacyIndexResponse legacyindexResponse = null; StringBuilder url = new StringBuilder(); Index index = mappingsMap.get(legacyindexRequest.getLegacyIndexTopic()).getIndexes().get(0); - url.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/_search"); + url.append(esHostUrl).append(index.getName()).append("/_search"); legacyindexResponse = LegacyIndexResponse.builder() .message("Please hit the 'url' after the legacy index job is complete.").url(url.toString()) .responseInfo(factory.createResponseInfoFromRequestInfo(legacyindexRequest.getRequestInfo(), true)) diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ReindexService.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ReindexService.java index a6184bb0e19..a19ae2f0272 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ReindexService.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ReindexService.java @@ -94,7 +94,7 @@ public ReindexResponse createReindexJob(ReindexRequest reindexRequest) { Integer total = JsonPath.read(response, "$.hits.total"); StringBuilder url = new StringBuilder(); Index index = mappingsMap.get(reindexRequest.getReindexTopic()).getIndexes().get(0); - url.append(esHostUrl).append(index.getName()).append("/").append(index.getType()).append("/_search"); + url.append(esHostUrl).append(index.getName()).append("/_search"); reindexResponse = ReindexResponse.builder().totalRecordsToBeIndexed(total) .estimatedTime(indexerUtils.fetchEstimatedTime(total)) .message("Please hit the 'url' for the newly indexed data after the mentioned 'estimated time'.") diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ServiceRequestRepository.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ServiceRequestRepository.java index 2cd8fce1f6e..2d68da0d068 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ServiceRequestRepository.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/service/ServiceRequestRepository.java @@ -71,4 +71,5 @@ public String fetchResult(String uri, Object request, String tenantId) { return response; } + } diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/util/IndexerUtils.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/util/IndexerUtils.java index fe18000f03e..3d0547f5d92 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/util/IndexerUtils.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/util/IndexerUtils.java @@ -8,9 +8,12 @@ import com.github.zafarkhaja.semver.Version; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; +import org.egov.infra.indexer.consumer.config.CoreIndexConsumerConfig; +import org.egov.infra.indexer.consumer.config.LegacyIndexConsumerConfig; import org.egov.infra.indexer.consumer.config.ReindexConsumerConfig; import org.egov.infra.indexer.models.AuditDetails; import org.egov.infra.indexer.producer.IndexerProducer; @@ -29,8 +32,11 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import java.util.Base64; -import javax.annotation.PostConstruct; import java.io.IOException; import java.text.DecimalFormat; import java.text.SimpleDateFormat; @@ -46,8 +52,8 @@ public class IndexerUtils { @Autowired private RestTemplate restTemplate; - @Autowired - private ReindexConsumerConfig kafkaConsumerConfig; +// @Autowired +// private ReindexConsumerConfig kafkaConsumerConfig; private Version defaultSemVer; @@ -79,6 +85,12 @@ public class IndexerUtils { @Value("${topic.push.enabled}") private Boolean topicPushEnable; + @Value("${egov.indexer.es.username}") + private String esUsername; + + @Value("${egov.indexer.es.password}") + private String esPassword; + @Value("${id.timezone}") private String timezone; @@ -99,7 +111,9 @@ public class IndexerUtils { * */ public void orchestrateListenerOnESHealth() { - kafkaConsumerConfig.pauseContainer(); + ReindexConsumerConfig.pauseContainer(); + CoreIndexConsumerConfig.pauseContainer(); + LegacyIndexConsumerConfig.pauseContainer(); log.info("Polling ES...."); final Runnable esPoller = new Runnable() { boolean threadRun = true; @@ -110,13 +124,18 @@ public void run() { try { StringBuilder url = new StringBuilder(); url.append(esHostUrl).append("/_search"); - response = restTemplate.getForObject(url.toString(), Map.class); + final HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization", getESEncodedCredentials()); + final HttpEntity entity = new HttpEntity( headers); + response = restTemplate.exchange(url.toString(), HttpMethod.GET, entity, Map.class); } catch (Exception e) { log.error("ES is DOWN.."); } if (response != null) { log.info("ES is UP!"); - kafkaConsumerConfig.startContainer(); + ReindexConsumerConfig.resumeContainer(); + CoreIndexConsumerConfig.resumeContainer(); + LegacyIndexConsumerConfig.resumeContainer(); threadRun = false; } } @@ -239,6 +258,49 @@ public String buildUri(UriMapping uriMapping, String kafkaJson) { return serviceCallUri.toString(); } + public void fillJsonPath(Object request, String kafkaJson) { + try { + if (request instanceof Map) { + Map searchParamObject = (Map) request; + for (Map.Entry entry : searchParamObject.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + if (value instanceof String && ((String) value).contains("$.")) { + Object filledValue = JsonPath.read(kafkaJson, (String) value); + if(filledValue instanceof String){ + searchParamObject.put(key,filledValue.toString()); + } + else{ + searchParamObject.put(key, filledValue); + } + } else if (value instanceof Map) { + fillJsonPath(value, kafkaJson); // Recursive call for nested map + } else if (value instanceof List) { + List valueList = (List) value; + for (int i = 0; i < valueList.size(); i++) { + Object arrayItem = valueList.get(i); + if (arrayItem instanceof String && ((String) arrayItem).contains("$.")) { + Object filledArrayItem = JsonPath.read(kafkaJson, (String) arrayItem); + if(filledArrayItem instanceof String){ + valueList.set(i,filledArrayItem.toString()); + } + else{ + valueList.set(i, filledArrayItem); + } + } else if (arrayItem instanceof Map) { + fillJsonPath(arrayItem, kafkaJson); // Recursive call for nested map within array + } + } + } + } + } + } catch (Exception e) { + log.error("Error while filling JSONPath in searchParam: " + e.getMessage()); + } + } + + + @Cacheable(value = "masterData", sync = true) public Object fetchMdmsData(String uri, String tenantId, String moduleName, String masterName, String filter) { @@ -754,4 +816,11 @@ public Version getSemVer(String version) { return defaultSemVer; } } + + public String getESEncodedCredentials() { + String credentials = esUsername + ":" + esPassword; + byte[] credentialsBytes = credentials.getBytes(); + byte[] base64CredentialsBytes = Base64.getEncoder().encode(credentialsBytes); + return "Basic " + new String(base64CredentialsBytes); + } } diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/APIDetails.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/APIDetails.java index 16d520ee802..22622edca81 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/APIDetails.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/APIDetails.java @@ -1,9 +1,9 @@ package org.egov.infra.indexer.web.contract; -import javax.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/ESSearchCriteria.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/ESSearchCriteria.java index 568a2fbed88..dfdbbe92493 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/ESSearchCriteria.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/ESSearchCriteria.java @@ -2,7 +2,7 @@ import java.util.List; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/LegacyIndexRequest.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/LegacyIndexRequest.java index 3348ea98788..543e98b1483 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/LegacyIndexRequest.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/LegacyIndexRequest.java @@ -1,6 +1,6 @@ package org.egov.infra.indexer.web.contract; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/PaginationDetails.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/PaginationDetails.java index f1a17db168b..6afdb88ca9c 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/PaginationDetails.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/PaginationDetails.java @@ -1,9 +1,9 @@ package org.egov.infra.indexer.web.contract; -import javax.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/ReindexRequest.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/ReindexRequest.java index 38e6ace850c..e7946be9a44 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/ReindexRequest.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/ReindexRequest.java @@ -1,7 +1,7 @@ package org.egov.infra.indexer.web.contract; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import org.egov.common.contract.request.RequestInfo; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/UriMapping.java b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/UriMapping.java index 8d6744a5b5d..890cc42c8ba 100644 --- a/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/UriMapping.java +++ b/core-services/egov-indexer/src/main/java/org/egov/infra/indexer/web/contract/UriMapping.java @@ -25,7 +25,7 @@ public class UriMapping { @JsonProperty("apiRequest") private Object request; - + @JsonProperty("queryParam") private String queryParam; diff --git a/core-services/egov-indexer/src/main/resources/application.properties b/core-services/egov-indexer/src/main/resources/application.properties index ba2a6099a7e..d5a282e2c73 100644 --- a/core-services/egov-indexer/src/main/resources/application.properties +++ b/core-services/egov-indexer/src/main/resources/application.properties @@ -5,19 +5,19 @@ server.servlet.context-path=/egov-indexer app.timezone=UTC #elasticSearch index api -egov.infra.indexer.host=https://dev.digit.org/elasticsearch +egov.infra.indexer.host=https://localhost:9200/ egov.infra.indexer.name=/egov-indexer/index spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/devdb +spring.datasource.url=jdbc:postgresql://localhost:5432/postgres spring.datasource.username=postgres -spring.datasource.password=postgres +spring.datasource.password=1234 #----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/devdb +spring.flyway.url=jdbc:postgresql://localhost:5432/postgres spring.flyway.user=postgres -spring.flyway.password=postgres +spring.flyway.password=1234 spring.flyway.baseline-on-migrate=true spring.flyway.outOfOrder=true spring.flyway.locations=classpath:/db/migration/main @@ -75,6 +75,8 @@ kafka.topics=save-service-db,update-service-db egov.indexer.es.cluster.name=elasticsearch egov.indexer.es.host.name=127.0.0.1 egov.indexer.es.port.no=9200 +egov.indexer.es.username=elastic +egov.indexer.es.password=8fwbD6HbJh6HU0oddsHm8TEI #....................................................................................# #.................................Internal Variables..................................# @@ -111,7 +113,7 @@ cache.expiry.mdms.masters.minutes=15 # file path for loading yamls #egov.indexer.yml.repo.path=https://raw.githubusercontent.com/egovernments/egov-services/master/core/egov-indexer/src/main/resources/watercharges-indexer.yml,https://raw.githubusercontent.com/egovernments/egov-services/master/core/egov-indexer/src/main/resources/swm-service-indexer.yml,https://raw.githubusercontent.com/egovernments/egov-services/master/core/egov-indexer/src/main/resources/asset-service-maha.yml,https://raw.githubusercontent.com/egovernments/egov-services/master/core/egov-indexer/src/main/resources/lcms-indexer.yml,https://raw.githubusercontent.com/egovernments/egov-services/master/core/egov-indexer/src/main/resources/inventory-service-indexer.yml,https://raw.githubusercontent.com/egovernments/egov-services/master/core/egov-indexer/src/main/resources/rainmaker-pgr-indexer.yml -egov.indexer.yml.repo.path=file:///Users/nithin/Documents/eGov/egov-repos/core-services/egov-indexer/src/main/resources/collection-indexer.yml +egov.indexer.yml.repo.path=file:///home/admin1/upgraded-indexer/Digit-Core/core-services/egov-indexer/src/main/resources/search-body.yml logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} diff --git a/core-services/egov-indexer/src/main/resources/db/Dockerfile b/core-services/egov-indexer/src/main/resources/db/Dockerfile index 60fc07ce69f..f38638a269f 100644 --- a/core-services/egov-indexer/src/main/resources/db/Dockerfile +++ b/core-services/egov-indexer/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql @@ -6,4 +6,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] \ No newline at end of file +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-indexer/src/main/resources/db/migrate.sh b/core-services/egov-indexer/src/main/resources/db/migrate.sh index 43960b25cdb..892ac2d8862 100644 --- a/core-services/egov-indexer/src/main/resources/db/migrate.sh +++ b/core-services/egov-indexer/src/main/resources/db/migrate.sh @@ -1,3 +1,3 @@ #!/bin/sh -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate \ No newline at end of file diff --git a/core-services/egov-indexer/src/main/resources/search-body-sample.yml b/core-services/egov-indexer/src/main/resources/search-body-sample.yml new file mode 100644 index 00000000000..2c0b583c1f6 --- /dev/null +++ b/core-services/egov-indexer/src/main/resources/search-body-sample.yml @@ -0,0 +1,24 @@ +ServiceMaps: + serviceName: sample + version: 1.0.0 + mappings: + - topic: sample-data-poc-1 + configKey: INDEX + indexes: + - name: sample-data-poc + type: _doc + id: $.id + isBulk: false + jsonPath: $.request + timeStampField: $.time + customJsonMapping: + indexMapping: {"Data":{"a":"","b":""}} + fieldMapping: + - inJsonPath: $.billNumber + outJsonPath: $.Data.a + externalUriMapping: + - path: https://unified-dev.digit.org/expense/bill/v1/_search + apiRequest: {"RequestInfo":{"apiId":"org.egov.pt","ver":"1.0","ts":1502890899493,"action":"asd","did":"4354648646","key":"xyz","msgId":"654654","requesterId":"61","authToken":"e6434d96-f962-4840-9c2a-621619c62c39","userInfo":{"id":73}},"billCriteria":{"tenantId":"pg.citya","businessService":"EXPENSE.PURCHASE","ids":[],"billNumbers":["$.billNumber"],"status":null},"pagination":{"limit":10,"offSet":0,"sortBy":"string","order":null}} + uriResponseMapping: + - inJsonPath: $.bills[0].referenceId + outJsonPath: $.Data.b diff --git a/core-services/egov-localization/CHANGELOG.md b/core-services/egov-localization/CHANGELOG.md index 599c53c2894..d260f722003 100644 --- a/core-services/egov-localization/CHANGELOG.md +++ b/core-services/egov-localization/CHANGELOG.md @@ -1,6 +1,16 @@ +# Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version to 42.7.1 +- Upgraded redis version to 3.2 +- Upgraded org.egov.services:tracer version from 2.1.0-SNAPSHOT to 2.9.0-SNAPSHOT +- Upgraded org.flywaydb:flyway-core version from 4.1.0 to 9.22.3 +- Upgraded lombok version from 1.18.8 to 1.18.22 + ## 1.1.3 - 2022-01-13 - Updated to log4j2 version 2.17.1 diff --git a/core-services/egov-localization/pom.xml b/core-services/egov-localization/pom.xml index 980ca91a930..8f2557931d5 100644 --- a/core-services/egov-localization/pom.xml +++ b/core-services/egov-localization/pom.xml @@ -2,35 +2,24 @@ 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.13.RELEASE - - + + org.springframework.boot + spring-boot-starter-parent + 3.2.2 + org.egov egov-localization - 1.1.3-SNAPSHOT + 2.9.0-SNAPSHOT egov-localization Localization for messages 2.17.1 UTF-8 - 1.8 + 17 UTF-8 - 1.18.8 + 1.18.22 - - org.springframework - spring-beans - 5.2.20.RELEASE - - - org.egov.services - services-common - 0.11.1 - commons-io commons-io @@ -51,22 +40,22 @@ org.springframework.boot spring-boot-starter-data-redis - - - org.postgresql - postgresql - runtime org.jsoup jsoup 1.10.2 - - org.flywaydb - flyway-core - 4.1.0 - + + org.postgresql + postgresql + 42.7.1 + + + org.flywaydb + flyway-core + 9.22.3 + org.projectlombok lombok @@ -80,13 +69,29 @@ org.egov.services tracer - 2.1.0-SNAPSHOT + 2.9.0-SNAPSHOT + + org.springframework.boot + spring-boot-starter-validation + 3.2.3 + org.springframework.boot spring-boot-starter-test test + + org.mockito + mockito-core + test + + + junit + junit + 4.13.2 + test + @@ -107,104 +112,10 @@ - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - maven-pmd-plugin - 3.7 - - - verify - - check - - - - - false - false - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.web.contract.UpdateMessageRequest - org.egov.web.contract.MessagesResponse - org.egov.web.contract.DeleteMessagesResponse - org.egov.web.contract.DeleteMessagesRequest - org.egov.web.contract.CreateMessagesRequest - org.egov.web.contract.CacheBustResponse - - - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - module - - + + org.springframework.boot + spring-boot-maven-plugin + - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - cz.habarta.typescript-generator - - - typescript-generator-maven-plugin - - - [2.22.595,) - - - generate - - - - - - - - - - - - diff --git a/core-services/egov-localization/src/main/java/org/egov/LocalizationServiceApplication.java b/core-services/egov-localization/src/main/java/org/egov/LocalizationServiceApplication.java index 3126124e593..884ec2e760a 100644 --- a/core-services/egov-localization/src/main/java/org/egov/LocalizationServiceApplication.java +++ b/core-services/egov-localization/src/main/java/org/egov/LocalizationServiceApplication.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.annotation.PostConstruct; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -11,9 +12,8 @@ import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import javax.annotation.PostConstruct; import java.util.TimeZone; @SpringBootApplication @@ -29,8 +29,8 @@ public void initialize() { } @Bean - public WebMvcConfigurerAdapter webMvcConfigurerAdapter() { - return new WebMvcConfigurerAdapter() { + public WebMvcConfigurer webMvcConfigurer() { + return new WebMvcConfigurer() { @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { diff --git a/core-services/egov-localization/src/main/java/org/egov/config/RedisConfig.java b/core-services/egov-localization/src/main/java/org/egov/config/RedisConfig.java new file mode 100644 index 00000000000..fa0e3b37569 --- /dev/null +++ b/core-services/egov-localization/src/main/java/org/egov/config/RedisConfig.java @@ -0,0 +1,33 @@ +package org.egov.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConfiguration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.RedisStandaloneConfiguration; +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.data.redis.core.StringRedisTemplate; + +@Configuration +public class RedisConfig { + + @Value("${spring.redis.host}") + private String redisHost; + + @Value("${spring.redis.port}") + private int redisPort; + + @Bean + public RedisConnectionFactory redisConnectionFactory() { + RedisConfiguration redisConfiguration = new RedisStandaloneConfiguration(redisHost, redisPort); + return new LettuceConnectionFactory(redisConfiguration); + } + + @Bean + public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory) { + return new StringRedisTemplate(redisConnectionFactory); + } + +} diff --git a/core-services/egov-localization/src/main/java/org/egov/domain/model/Message.java b/core-services/egov-localization/src/main/java/org/egov/domain/model/Message.java index 4c64de0c89b..4d7642063e5 100644 --- a/core-services/egov-localization/src/main/java/org/egov/domain/model/Message.java +++ b/core-services/egov-localization/src/main/java/org/egov/domain/model/Message.java @@ -1,11 +1,11 @@ package org.egov.domain.model; +import jakarta.validation.constraints.Null; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; -import javax.validation.constraints.Null; @Builder @Getter diff --git a/core-services/egov-localization/src/main/java/org/egov/domain/model/MessageSearchCriteria.java b/core-services/egov-localization/src/main/java/org/egov/domain/model/MessageSearchCriteria.java index 2bd06879f9b..98b670ea01c 100644 --- a/core-services/egov-localization/src/main/java/org/egov/domain/model/MessageSearchCriteria.java +++ b/core-services/egov-localization/src/main/java/org/egov/domain/model/MessageSearchCriteria.java @@ -4,13 +4,13 @@ import java.util.Set; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; -import javax.validation.constraints.Size; @Getter @Builder diff --git a/core-services/egov-localization/src/main/java/org/egov/domain/service/MessageService.java b/core-services/egov-localization/src/main/java/org/egov/domain/service/MessageService.java index 63ccda535e5..ccbd95d2fd6 100644 --- a/core-services/egov-localization/src/main/java/org/egov/domain/service/MessageService.java +++ b/core-services/egov-localization/src/main/java/org/egov/domain/service/MessageService.java @@ -11,7 +11,6 @@ import org.egov.domain.model.Tenant; import org.egov.persistence.repository.MessageCacheRepository; import org.egov.persistence.repository.MessageRepository; -import org.egov.tracer.model.CustomException; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; diff --git a/core-services/egov-localization/src/main/java/org/egov/persistence/entity/Message.java b/core-services/egov-localization/src/main/java/org/egov/persistence/entity/Message.java index a78fdea9cf5..5af8f3f36e2 100644 --- a/core-services/egov-localization/src/main/java/org/egov/persistence/entity/Message.java +++ b/core-services/egov-localization/src/main/java/org/egov/persistence/entity/Message.java @@ -1,10 +1,10 @@ package org.egov.persistence.entity; +import jakarta.persistence.*; import lombok.*; import org.egov.domain.model.MessageIdentity; import org.egov.domain.model.Tenant; -import javax.persistence.*; import java.util.Date; @Entity diff --git a/core-services/egov-localization/src/main/java/org/egov/web/contract/CreateMessagesRequest.java b/core-services/egov-localization/src/main/java/org/egov/web/contract/CreateMessagesRequest.java index 92b60b0042b..b3749e29352 100644 --- a/core-services/egov-localization/src/main/java/org/egov/web/contract/CreateMessagesRequest.java +++ b/core-services/egov-localization/src/main/java/org/egov/web/contract/CreateMessagesRequest.java @@ -1,6 +1,9 @@ package org.egov.web.contract; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -8,11 +11,7 @@ import org.egov.domain.model.AuthenticatedUser; import org.egov.domain.model.NotAuthenticatedException; import org.egov.domain.model.Tenant; -import org.hibernate.validator.constraints.NotEmpty; -import org.hibernate.validator.constraints.SafeHtml; -import javax.validation.Valid; -import javax.validation.constraints.Size; import java.util.List; import java.util.stream.Collectors; @@ -23,8 +22,7 @@ public class CreateMessagesRequest { @JsonProperty("RequestInfo") private RequestInfo requestInfo; - @NotEmpty - @SafeHtml + @NotEmpty @Size(max = 256) private String tenantId; diff --git a/core-services/egov-localization/src/main/java/org/egov/web/contract/DeleteMessage.java b/core-services/egov-localization/src/main/java/org/egov/web/contract/DeleteMessage.java index 7c37ddc286a..ab76dd7771c 100644 --- a/core-services/egov-localization/src/main/java/org/egov/web/contract/DeleteMessage.java +++ b/core-services/egov-localization/src/main/java/org/egov/web/contract/DeleteMessage.java @@ -4,21 +4,20 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.hibernate.validator.constraints.NotEmpty; -import org.hibernate.validator.constraints.SafeHtml; +import jakarta.validation.constraints.NotEmpty; @Builder @Getter @AllArgsConstructor @NoArgsConstructor public class DeleteMessage { + + @NotEmpty + private String code; + @NotEmpty - @SafeHtml - private String code; - @NotEmpty - @SafeHtml - private String module; + private String module; + @NotEmpty - @SafeHtml private String locale; } diff --git a/core-services/egov-localization/src/main/java/org/egov/web/contract/DeleteMessagesRequest.java b/core-services/egov-localization/src/main/java/org/egov/web/contract/DeleteMessagesRequest.java index cf314a97139..95b7f7b0ce0 100644 --- a/core-services/egov-localization/src/main/java/org/egov/web/contract/DeleteMessagesRequest.java +++ b/core-services/egov-localization/src/main/java/org/egov/web/contract/DeleteMessagesRequest.java @@ -1,17 +1,16 @@ package org.egov.web.contract; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import org.egov.common.contract.request.RequestInfo; import org.egov.domain.model.MessageIdentity; import org.egov.domain.model.Tenant; -import org.hibernate.validator.constraints.SafeHtml; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import java.util.List; import java.util.stream.Collectors; @@ -24,7 +23,6 @@ public class DeleteMessagesRequest { private RequestInfo requestInfo; @NotNull - @SafeHtml @Size(max = 256) private String tenantId; diff --git a/core-services/egov-localization/src/main/java/org/egov/web/contract/Message.java b/core-services/egov-localization/src/main/java/org/egov/web/contract/Message.java index d17cf2c1aef..a0e1c97536f 100644 --- a/core-services/egov-localization/src/main/java/org/egov/web/contract/Message.java +++ b/core-services/egov-localization/src/main/java/org/egov/web/contract/Message.java @@ -7,8 +7,7 @@ import lombok.NoArgsConstructor; import org.egov.domain.model.MessageIdentity; import org.egov.domain.model.Tenant; -import org.hibernate.validator.constraints.NotEmpty; -import org.hibernate.validator.constraints.SafeHtml; +import jakarta.validation.constraints.NotEmpty; @Builder @Getter @@ -16,17 +15,13 @@ @NoArgsConstructor public class Message { @NotEmpty - @SafeHtml - private String code; + private String code; @NotEmpty - @SafeHtml - private String message; + private String message; @NotEmpty - @SafeHtml - private String module; + private String module; @NotEmpty - @SafeHtml - private String locale; + private String locale; public Message(org.egov.domain.model.Message domainMessage) { this.code = domainMessage.getCode(); diff --git a/core-services/egov-localization/src/main/java/org/egov/web/contract/UpdateMessage.java b/core-services/egov-localization/src/main/java/org/egov/web/contract/UpdateMessage.java index 09b4166ca65..b015afac7f2 100644 --- a/core-services/egov-localization/src/main/java/org/egov/web/contract/UpdateMessage.java +++ b/core-services/egov-localization/src/main/java/org/egov/web/contract/UpdateMessage.java @@ -4,8 +4,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.hibernate.validator.constraints.NotEmpty; -import org.hibernate.validator.constraints.SafeHtml; +import jakarta.validation.constraints.NotEmpty; @Builder @Getter @@ -13,9 +12,7 @@ @NoArgsConstructor public class UpdateMessage { @NotEmpty - @SafeHtml - private String code; + private String code; @NotEmpty - @SafeHtml - private String message; + private String message; } diff --git a/core-services/egov-localization/src/main/java/org/egov/web/contract/UpdateMessageRequest.java b/core-services/egov-localization/src/main/java/org/egov/web/contract/UpdateMessageRequest.java index 40cb2189e4e..00e74e57dab 100644 --- a/core-services/egov-localization/src/main/java/org/egov/web/contract/UpdateMessageRequest.java +++ b/core-services/egov-localization/src/main/java/org/egov/web/contract/UpdateMessageRequest.java @@ -1,6 +1,8 @@ package org.egov.web.contract; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -9,11 +11,8 @@ import org.egov.domain.model.MessageIdentity; import org.egov.domain.model.NotAuthenticatedException; import org.egov.domain.model.Tenant; -import org.hibernate.validator.constraints.NotEmpty; -import org.hibernate.validator.constraints.SafeHtml; +import jakarta.validation.constraints.NotEmpty; -import javax.validation.Valid; -import javax.validation.constraints.Size; import java.util.List; import java.util.stream.Collectors; @@ -24,15 +23,12 @@ public class UpdateMessageRequest { @JsonProperty("RequestInfo") private RequestInfo requestInfo; @NotEmpty - @SafeHtml @Size(max = 256) private String tenantId; @NotEmpty - @SafeHtml @Size(max = 255) private String locale; @NotEmpty - @SafeHtml @Size(max = 255) private String module; @Size(min = 1) diff --git a/core-services/egov-localization/src/main/java/org/egov/web/controller/MessageController.java b/core-services/egov-localization/src/main/java/org/egov/web/controller/MessageController.java index e6976971023..db5f7d52b10 100644 --- a/core-services/egov-localization/src/main/java/org/egov/web/controller/MessageController.java +++ b/core-services/egov-localization/src/main/java/org/egov/web/controller/MessageController.java @@ -1,5 +1,7 @@ package org.egov.web.controller; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import org.egov.domain.model.MessageRequest; import org.egov.domain.model.MessageSearchCriteria; import org.egov.domain.model.Tenant; @@ -10,8 +12,6 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; -import javax.validation.constraints.Size; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -36,8 +36,8 @@ public MessagesResponse getMessagesForLocale(@RequestParam("locale") String loca @PostMapping("/v1/_search") public MessagesResponse getMessages(@RequestParam("locale") String locale, - @RequestParam(value = "module", required = false) String module, - @RequestParam("tenantId") @Size(max = 256) String tenantId,@RequestParam(value = "codes",required = false) Set codes) { + @RequestParam(value = "module", required = false) String module, + @RequestParam("tenantId") @Size(max = 256) String tenantId, @RequestParam(value = "codes",required = false) Set codes) { final MessageSearchCriteria searchCriteria = MessageSearchCriteria.builder().locale(locale) .tenantId(new Tenant(tenantId)).codes(codes).module(module).build(); List domainMessages = messageService.getFilteredMessages(searchCriteria); diff --git a/core-services/egov-localization/src/main/resources/db/Dockerfile b/core-services/egov-localization/src/main/resources/db/Dockerfile index 6ab314150d0..5213e0052c0 100644 --- a/core-services/egov-localization/src/main/resources/db/Dockerfile +++ b/core-services/egov-localization/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/ddl /flyway/sql @@ -8,4 +8,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-localization/src/main/resources/db/migrate.sh b/core-services/egov-localization/src/main/resources/db/migrate.sh index 43960b25cdb..5593a173eba 100644 --- a/core-services/egov-localization/src/main/resources/db/migrate.sh +++ b/core-services/egov-localization/src/main/resources/db/migrate.sh @@ -1,3 +1,3 @@ #!/bin/sh -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate \ No newline at end of file diff --git a/core-services/egov-localization/src/test/java/org/egov/domain/service/MessageServiceTest.java b/core-services/egov-localization/src/test/java/org/egov/domain/service/MessageServiceTest.java index b5a9eefa66e..733be96d626 100644 --- a/core-services/egov-localization/src/test/java/org/egov/domain/service/MessageServiceTest.java +++ b/core-services/egov-localization/src/test/java/org/egov/domain/service/MessageServiceTest.java @@ -8,15 +8,15 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import java.util.Arrays; import java.util.Collections; import java.util.List; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/core-services/egov-localization/src/test/java/org/egov/persistence/repository/MessageCacheRepositoryTest.java b/core-services/egov-localization/src/test/java/org/egov/persistence/repository/MessageCacheRepositoryTest.java index c11337600e8..d08dfff1e01 100644 --- a/core-services/egov-localization/src/test/java/org/egov/persistence/repository/MessageCacheRepositoryTest.java +++ b/core-services/egov-localization/src/test/java/org/egov/persistence/repository/MessageCacheRepositoryTest.java @@ -5,9 +5,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; + import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.StringRedisTemplate; diff --git a/core-services/egov-localization/src/test/java/org/egov/persistence/repository/MessageRepositoryTest.java b/core-services/egov-localization/src/test/java/org/egov/persistence/repository/MessageRepositoryTest.java index ceab8882b74..08d28a058af 100644 --- a/core-services/egov-localization/src/test/java/org/egov/persistence/repository/MessageRepositoryTest.java +++ b/core-services/egov-localization/src/test/java/org/egov/persistence/repository/MessageRepositoryTest.java @@ -8,12 +8,14 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import java.util.Arrays; import java.util.List; -import static org.mockito.Matchers.anyListOf; +//import static org.mockito.Matchers.anyListOf; + +import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.Mockito.verify; @@ -36,7 +38,7 @@ public void test_should_save_messages() { messageRepository.save(domainMessages, user); - verify(messageJpaRepository).saveAll(anyListOf(Message.class)); + verify(messageJpaRepository).saveAll(anyList()); } List getDomainMessages() { diff --git a/core-services/egov-localization/src/test/java/org/egov/web/controller/MessageControllerTest.java b/core-services/egov-localization/src/test/java/org/egov/web/controller/MessageControllerTest.java index d212d7b4769..8d0a3f934a7 100644 --- a/core-services/egov-localization/src/test/java/org/egov/web/controller/MessageControllerTest.java +++ b/core-services/egov-localization/src/test/java/org/egov/web/controller/MessageControllerTest.java @@ -19,9 +19,8 @@ import java.util.List; import static org.hamcrest.Matchers.containsString; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.anyListOf; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -109,7 +108,7 @@ public void test_should_save_new_messages() throws Exception { .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(content().json(getFileContents("messagesResponse.json"))); - verify(messageService).create(eq(defaultTenant), anyListOf(Message.class), eq(new AuthenticatedUser(1L))); + verify(messageService).create(eq(defaultTenant), anyList(), eq(new AuthenticatedUser(1L))); } @Test @@ -136,7 +135,7 @@ public void test_should_update_messages() throws Exception { .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(content().json(getFileContents("createNewMessageResponse.json"))); verify(messageService) - .updateMessagesForModule(eq(new Tenant("default")), anyListOf(Message.class), + .updateMessagesForModule(eq(new Tenant("default")), anyList(), eq(new AuthenticatedUser(1L))); } diff --git a/core-services/egov-location/CHANGELOG.md b/core-services/egov-location/CHANGELOG.md index 35303affeab..c126e1e3074 100644 --- a/core-services/egov-location/CHANGELOG.md +++ b/core-services/egov-location/CHANGELOG.md @@ -3,6 +3,13 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version from 9.4.1212 to 42.7.1 +- Upgraded org.flywaydb:flyway-core version from 6.4.4 to 9.22.3 +- Upgraded lombok version from 1.18.8 to 1.18.22 + ## 1.1.5 - 2023-03-16 - Fixed bug where search on root level boundary type yields empty search response. diff --git a/core-services/egov-location/pom.xml b/core-services/egov-location/pom.xml index c7560a6ec82..48d437c7a50 100644 --- a/core-services/egov-location/pom.xml +++ b/core-services/egov-location/pom.xml @@ -5,35 +5,33 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE - + 3.2.2 org.egov egov-location - 1.1.5-SNAPSHOT + 2.9.0-SNAPSHOT egov-location boundary service for egov applications 2.17.1 UTF-8 - 1.8 + 17 UTF-8 - 1.18.8 + 1.18.22 org.springframework spring-beans - 5.2.20.RELEASE org.springframework.boot spring-boot-starter-actuator - org.egov.services - services-common - 0.4.0 + net.minidev + json-smart + 2.5.0 commons-io @@ -56,17 +54,21 @@ org.egov.services tracer - 2.1.0-SNAPSHOT + 2.9.0-SNAPSHOT + + + org.postgresql + postgresql + 42.7.1 org.flywaydb flyway-core - 6.4.4 + 9.22.3 - org.postgresql - postgresql - 9.4.1212 + org.springframework.boot + spring-boot-starter-validation com.h2database @@ -78,6 +80,12 @@ spring-boot-starter-test test + + junit + junit + 4.13.2 + test + org.opengis geoapi @@ -144,10 +152,6 @@ vecmath 1.3.1 - - joda-time - joda-time - org.projectlombok lombok @@ -176,72 +180,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.boundary.web.contract.BoundaryRequest - org.egov.boundary.web.contract.BoundaryResponse - org.egov.boundary.web.contract.BoundaryMdmsResponse - org.egov.boundary.web.contract.BoundarySearchRequest - org.egov.boundary.web.contract.BoundaryTypeRequest - org.egov.boundary.web.contract.BoundaryTypeResponse - org.egov.boundary.web.contract.BoundaryTypeSearchRequest - org.egov.boundary.web.contract.CityRequest - org.egov.boundary.web.contract.CityResponse - org.egov.boundary.web.contract.CrossHierarchyRequest - org.egov.boundary.web.contract.CrossHierarchyResponse - org.egov.boundary.web.contract.CrossHierarchySearchRequest - org.egov.boundary.web.contract.GeographicalResponse - org.egov.boundary.web.contract.HierarchyTypeRequest - org.egov.boundary.web.contract.HierarchyTypeResponse - org.egov.boundary.web.contract.HierarchyTypeSearchRequest - org.egov.boundary.web.contract.MdmsRequest - org.egov.boundary.web.contract.MdmsResponse - org.egov.boundary.web.contract.ShapeFileResponse - org.egov.boundary.web.contract.TenantResponse - - - org.egov.boundary.domain.model.Boundary:BoundaryLocation - org.egov.boundary.domain.model.BoundaryType:BoundaryLocationType - org.egov.boundary.web.contract.tenant.model.City:TenantCity - org.egov.boundary.domain.model.CrossHierarchy:CrossHierarchySearchModel - org.egov.boundary.domain.model.HierarchyType:HierarchyTypeSearchModel - - - org.egov.common.contract.request.User:User - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - true - module - diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/BoundaryApplication.java b/core-services/egov-location/src/main/java/org/egov/boundary/BoundaryApplication.java index 1f21b179a01..630f6f50b67 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/BoundaryApplication.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/BoundaryApplication.java @@ -13,9 +13,10 @@ import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + import java.util.TimeZone; @SpringBootApplication @@ -43,8 +44,8 @@ public static void main(String[] args) { @Bean - public WebMvcConfigurerAdapter webMvcConfigurerAdapter() { - return new WebMvcConfigurerAdapter() { + public WebMvcConfigurer webMvcConfigurer() { + return new WebMvcConfigurer() { @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/Boundary.java b/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/Boundary.java index f20ed305e79..c28220721ee 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/Boundary.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/Boundary.java @@ -46,7 +46,6 @@ import org.egov.boundary.web.contract.BoundaryType; import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.SafeHtml; import org.springframework.format.annotation.DateTimeFormat; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -57,7 +56,7 @@ import lombok.NoArgsConstructor; import lombok.Setter; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; @Getter @Setter @@ -85,7 +84,6 @@ public class Boundary { private Date toDate; private boolean isHistory; private Long bndryId; - @SafeHtml private String localName; private Float longitude; private Float latitude; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/BoundaryType.java b/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/BoundaryType.java index 6f7f4ee1041..cce41b5c000 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/BoundaryType.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/BoundaryType.java @@ -42,8 +42,8 @@ import java.util.Set; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import org.egov.boundary.web.contract.HierarchyType; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/CrossHierarchy.java b/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/CrossHierarchy.java index fccc515d14e..814fa9d099d 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/CrossHierarchy.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/CrossHierarchy.java @@ -40,8 +40,8 @@ package org.egov.boundary.domain.model; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/HierarchyType.java b/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/HierarchyType.java index 702661b774d..f8c020eaaaa 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/HierarchyType.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/domain/model/HierarchyType.java @@ -40,8 +40,8 @@ package org.egov.boundary.domain.model; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryType.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryType.java index 6109e476caa..f0653eb8091 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryType.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryType.java @@ -50,8 +50,8 @@ import lombok.NoArgsConstructor; import lombok.Setter; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; @Getter @Setter diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryTypeRequest.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryTypeRequest.java index 6c5c313c871..ff254bad42c 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryTypeRequest.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryTypeRequest.java @@ -1,6 +1,6 @@ package org.egov.boundary.web.contract; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.boundary.web.contract.BoundaryType; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryTypeSearchRequest.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryTypeSearchRequest.java index 401419f30f3..2dc9996d583 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryTypeSearchRequest.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/BoundaryTypeSearchRequest.java @@ -1,6 +1,6 @@ package org.egov.boundary.web.contract; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import org.egov.boundary.domain.model.BoundaryType; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/City.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/City.java index 9e405b82fe5..7154193c715 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/City.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/City.java @@ -10,7 +10,7 @@ import lombok.NoArgsConstructor; import lombok.Setter; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; @Getter @Setter diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CityRequest.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CityRequest.java index f7a1210fb03..908ed49725e 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CityRequest.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CityRequest.java @@ -1,6 +1,6 @@ package org.egov.boundary.web.contract; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchy.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchy.java index 44451a15a18..608cd8bb865 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchy.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchy.java @@ -11,7 +11,7 @@ import lombok.Getter; import lombok.Setter; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; @Getter @Setter diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchyRequest.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchyRequest.java index b46db06748e..f90d282b05f 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchyRequest.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchyRequest.java @@ -1,6 +1,6 @@ package org.egov.boundary.web.contract; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.boundary.web.contract.CrossHierarchy; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchySearchRequest.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchySearchRequest.java index 33a46827994..973ad749a99 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchySearchRequest.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/CrossHierarchySearchRequest.java @@ -1,6 +1,6 @@ package org.egov.boundary.web.contract; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.boundary.domain.model.CrossHierarchy; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyType.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyType.java index 24d9ed94d0f..e94de2e17b9 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyType.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyType.java @@ -5,7 +5,7 @@ import lombok.Getter; import lombok.Setter; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; @Getter @Setter diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyTypeRequest.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyTypeRequest.java index 7b20be172b7..adc8290f6a4 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyTypeRequest.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyTypeRequest.java @@ -1,6 +1,6 @@ package org.egov.boundary.web.contract; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.boundary.web.contract.HierarchyType; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyTypeSearchRequest.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyTypeSearchRequest.java index 916036c7af5..f2e3b8a0765 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyTypeSearchRequest.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/HierarchyTypeSearchRequest.java @@ -1,6 +1,6 @@ package org.egov.boundary.web.contract; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.egov.boundary.domain.model.HierarchyType; import org.egov.common.contract.request.RequestInfo; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/factory/ResponseInfoFactory.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/factory/ResponseInfoFactory.java index 17f6ffcbb6b..48e98fe29aa 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/factory/ResponseInfoFactory.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/contract/factory/ResponseInfoFactory.java @@ -51,7 +51,7 @@ public class ResponseInfoFactory { public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { final String apiId = requestInfo != null ? "org.egov.boundary" : ""; final String ver = requestInfo != null ? requestInfo.getVer() : ""; - final String ts = requestInfo != null && requestInfo.getTs()!=null ? requestInfo.getTs().toString() : ""; + final Long ts = requestInfo != null && requestInfo.getTs()!=null ? requestInfo.getTs() : null; final String resMsgId = "uief87324"; // FIXME : Hard-coded final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; final String responseStatus = success ? "successful" : "failed"; @@ -61,7 +61,7 @@ public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestI public static ResponseInfo createResponseFromRequest(final RequestInfo requestInfo, final Boolean success) { final String apiId = requestInfo != null ? "org.egov.boundary" : ""; final String ver = requestInfo != null ? requestInfo.getVer() : ""; - final String ts = requestInfo != null && requestInfo.getTs() != null ? requestInfo.getTs().toString() : ""; + final Long ts = requestInfo != null && requestInfo.getTs() != null ? requestInfo.getTs() : null; final String resMsgId = "uief87324"; // FIXME : Hard-coded final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; final String responseStatus = success ? "successful" : "failed"; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/BoundaryController.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/BoundaryController.java index 48dc440fb31..4513b6c4d9d 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/BoundaryController.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/BoundaryController.java @@ -46,8 +46,8 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import org.egov.boundary.domain.model.BoundarySearchRequest; import org.egov.boundary.domain.service.BoundaryService; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/BoundaryTypeController.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/BoundaryTypeController.java index aeff1414325..47d0309019f 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/BoundaryTypeController.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/BoundaryTypeController.java @@ -43,8 +43,8 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import org.egov.boundary.domain.service.BoundaryTypeService; import org.egov.boundary.domain.service.HierarchyTypeService; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CityController.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CityController.java index 4419d2d295f..58d846ba2c7 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CityController.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CityController.java @@ -71,8 +71,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; @Validated @RestController diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CreateBoundaryTypeController.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CreateBoundaryTypeController.java index fdff377f0fd..ed5c89a807b 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CreateBoundaryTypeController.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CreateBoundaryTypeController.java @@ -57,8 +57,8 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; @Validated @Controller diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CrossHierarchyController.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CrossHierarchyController.java index d8e6df69f4a..707457a48d1 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CrossHierarchyController.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/CrossHierarchyController.java @@ -43,8 +43,8 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import org.egov.boundary.domain.service.BoundaryService; import org.egov.boundary.domain.service.BoundaryTypeService; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/GeographicalController.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/GeographicalController.java index 9f28236882d..54fb2d0e307 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/GeographicalController.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/GeographicalController.java @@ -15,8 +15,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import java.util.Collections; import java.util.List; import java.util.Optional; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/HierarchyTypeController.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/HierarchyTypeController.java index 21030fc40e5..026a57b89d4 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/HierarchyTypeController.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/HierarchyTypeController.java @@ -43,8 +43,8 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import org.egov.boundary.domain.service.HierarchyTypeService; import org.egov.boundary.exception.CustomException; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/LocationBoundaryController.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/LocationBoundaryController.java index 99c55092076..33dfe5c4264 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/LocationBoundaryController.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/LocationBoundaryController.java @@ -43,8 +43,8 @@ import java.util.Date; import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import org.egov.boundary.domain.model.BoundarySearchRequest; import org.egov.boundary.domain.service.BoundaryService; diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/TenantController.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/TenantController.java index 7572ee7ca73..0d03b33f94d 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/TenantController.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/controller/TenantController.java @@ -15,8 +15,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; @Validated @RestController diff --git a/core-services/egov-location/src/main/java/org/egov/boundary/web/errorhandlers/Error.java b/core-services/egov-location/src/main/java/org/egov/boundary/web/errorhandlers/Error.java index 8e9a1001930..477b8ba182e 100644 --- a/core-services/egov-location/src/main/java/org/egov/boundary/web/errorhandlers/Error.java +++ b/core-services/egov-location/src/main/java/org/egov/boundary/web/errorhandlers/Error.java @@ -44,7 +44,7 @@ import java.util.List; import java.util.Map; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import org.egov.common.contract.response.ErrorField; diff --git a/core-services/egov-location/src/main/resources/db/Dockerfile b/core-services/egov-location/src/main/resources/db/Dockerfile index bb0039c3f3f..32c49076473 100644 --- a/core-services/egov-location/src/main/resources/db/Dockerfile +++ b/core-services/egov-location/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql @@ -12,4 +12,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-location/src/main/resources/db/migrate.sh b/core-services/egov-location/src/main/resources/db/migrate.sh index 43960b25cdb..5593a173eba 100644 --- a/core-services/egov-location/src/main/resources/db/migrate.sh +++ b/core-services/egov-location/src/main/resources/db/migrate.sh @@ -1,3 +1,3 @@ #!/bin/sh -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate \ No newline at end of file diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/BoundaryServiceTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/BoundaryServiceTest.java index db8766c0ca0..baffe491f3a 100644 --- a/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/BoundaryServiceTest.java +++ b/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/BoundaryServiceTest.java @@ -14,7 +14,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.transaction.annotation.Transactional; @RunWith(MockitoJUnitRunner.class) diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/BoundaryTypeServiceTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/BoundaryTypeServiceTest.java index 33df02afe99..bd5e3a06e23 100644 --- a/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/BoundaryTypeServiceTest.java +++ b/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/BoundaryTypeServiceTest.java @@ -2,7 +2,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import java.util.ArrayList; @@ -14,7 +14,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class BoundaryTypeServiceTest { diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/CityServiceTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/CityServiceTest.java index 2beac3ce5af..decfb8358ca 100644 --- a/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/CityServiceTest.java +++ b/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/CityServiceTest.java @@ -10,7 +10,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class CityServiceTest { diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/MDMSServiceTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/MDMSServiceTest.java index 88137e5241b..ff60c7cdf32 100644 --- a/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/MDMSServiceTest.java +++ b/core-services/egov-location/src/test/java/org/egov/boundary/domain/service/MDMSServiceTest.java @@ -5,7 +5,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class MDMSServiceTest { diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/persistence/repository/BoundaryRepositoryTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/persistence/repository/BoundaryRepositoryTest.java deleted file mode 100644 index 504a6afd5d6..00000000000 --- a/core-services/egov-location/src/test/java/org/egov/boundary/persistence/repository/BoundaryRepositoryTest.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.egov.boundary.persistence.repository; - -import org.egov.boundary.TestConfiguration; -import org.egov.boundary.domain.model.Boundary; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Import(TestConfiguration.class) -public class BoundaryRepositoryTest { - - private BoundaryRepository boundaryRepository; - @Autowired - private NamedParameterJdbcTemplate namedParameterJdbcTemplate; - @Autowired - private JdbcTemplate jdbcTemplate; - - @Autowired - private MdmsRepository mdmsRepository; - - - @Before - public void before() { - boundaryRepository = new BoundaryRepository(namedParameterJdbcTemplate,jdbcTemplate,mdmsRepository); - } - - @Test - @Sql(scripts = { "/sql/clearBoundary.sql", "/sql/createBoundary.sql" }) - public void test_should_fetch_boundaries_for_boundarytype_and_hierarchytype_name() { - final List boundarys = boundaryRepository - .getBoundariesByBndryTypeNameAndHierarchyTypeNameAndTenantId("City", "ADMINISTRATION", "default"); - assertEquals("Srikakulam Municipality", boundarys.get(0).getName()); - } - -/* @Test - @Sql(scripts = { "/sql/clearBoundary.sql", "/sql/createBoundary.sql" }) - public void test_should_fetch_boundaries_for_boundarytype_and_tenantid() { - final List boundarys = boundaryRepository.getAllBoundariesByBoundaryTypeIdAndTenantId(1l, "default"); - assertEquals("Srikakulam Municipality", boundarys.get(0).getName()); - }*/ - -/* @Test - @Sql(scripts = { "/sql/clearBoundary.sql", "/sql/createBoundary.sql" }) - @Transactional - public void test_should_fetch_boundaries_for_id_and_tenantid() { - final List boundarys = boundaryRepository.getBoundariesByIdAndTenantId(1l, "default"); - assertEquals("Srikakulam Municipality", boundarys.get(0).getName()); - }*/ - - @Test - @Sql(scripts = { "/sql/clearBoundary.sql", "/sql/createBoundary.sql" }) - public void testShouldFetchAllBoundariesByTenantIdAndBoundaryIds(){ - - List list = new ArrayList(); - list.add(1l); - List boundarys = boundaryRepository.findAllBoundariesByIdsAndTenant("default", list); - - assertTrue(boundarys.size() == 1); - assertTrue(boundarys!=null); - assertTrue(boundarys.get(0).getId() == 1); - assertTrue(boundarys.get(0).getName().equals("Srikakulam Municipality")); - assertTrue(boundarys.get(0).getBoundaryNum().equals(1l)); - assertTrue(boundarys.get(0).getBoundaryType().getId().equals("1")); - assertTrue(boundarys.get(0).getLocalName().equals("Srikakulam Municipality")); - assertTrue(boundarys.get(0).isHistory() == false); - } - - @Test - @Sql(scripts = { "/sql/clearBoundary.sql", "/sql/createBoundary.sql" }) - public void testShouldGetAllBoundaryByTenantIdAndTypeIds(){ - - List list = new ArrayList(); - list.add(1l); - List boundarys = boundaryRepository.getAllBoundaryByTenantIdAndTypeIds("default",list); - - assertTrue(boundarys.size() == 1); - assertTrue(boundarys!=null); - assertTrue(boundarys.get(0).getId() == 1); - assertTrue(boundarys.get(0).getName().equals("Srikakulam Municipality")); - assertTrue(boundarys.get(0).getBoundaryNum().equals(1l)); - assertTrue(boundarys.get(0).getBoundaryType().getId().equals("1")); - assertTrue(boundarys.get(0).getLocalName().equals("Srikakulam Municipality")); - assertTrue(boundarys.get(0).isHistory() == false); - } - - @Test - @Sql(scripts = { "/sql/clearBoundary.sql", "/sql/createBoundary.sql" }) - public void testShouldGetAllBoundaryByTenantAndNumAndTypeAndTypeIds(){ - - List list = new ArrayList(); - list.add(1l); - //List boundarys = boundaryRepository.getAllBoundaryByTenantAndNumAndTypeAndTypeIds("default",list,list,list); - - /*assertTrue(boundarys.size() == 1); - assertTrue(boundarys!=null); - assertTrue(boundarys.get(0).getId() == 1); - assertTrue(boundarys.get(0).getName().equals("Srikakulam Municipality")); - assertTrue(boundarys.get(0).getBoundaryNum().equals(1l)); - assertTrue(boundarys.get(0).getBoundaryType().getId().equals(1l)); - assertTrue(boundarys.get(0).getLocalName().equals("Srikakulam Municipality")); - assertTrue(boundarys.get(0).isHistory() == false); - assertTrue(boundarys.get(0).getBoundaryType().getId() == "1l"); - assertTrue(boundarys.get(0).getBoundaryType().getName().equals("City")); - assertTrue(boundarys.get(0).getBoundaryType().getHierarchy() == 1l);*/ - } - -} diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/BoundaryControllerTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/BoundaryControllerTest.java index 1db3d054b68..4c48f51f41a 100644 --- a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/BoundaryControllerTest.java +++ b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/BoundaryControllerTest.java @@ -27,7 +27,7 @@ import java.nio.charset.Charset; import java.util.*; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/BoundaryTypeControllerTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/BoundaryTypeControllerTest.java index 30b0685f9ab..9dcc0341bfa 100644 --- a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/BoundaryTypeControllerTest.java +++ b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/BoundaryTypeControllerTest.java @@ -26,7 +26,7 @@ import java.util.Collections; import java.util.List; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/CityControllerTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/CityControllerTest.java index 9c09a5c4f49..c79da7e87ba 100644 --- a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/CityControllerTest.java +++ b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/CityControllerTest.java @@ -17,7 +17,7 @@ import java.io.IOException; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/GeographicalControllerTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/GeographicalControllerTest.java index 97a22aa95d6..a61377b6116 100644 --- a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/GeographicalControllerTest.java +++ b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/GeographicalControllerTest.java @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.Optional; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; diff --git a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/HierarchyTypeControllerTest.java b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/HierarchyTypeControllerTest.java index e078dac5872..ebfdab69fda 100644 --- a/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/HierarchyTypeControllerTest.java +++ b/core-services/egov-location/src/test/java/org/egov/boundary/web/controller/HierarchyTypeControllerTest.java @@ -19,7 +19,7 @@ import java.io.IOException; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; diff --git a/core-services/egov-mdms-service/CHANGELOG.md b/core-services/egov-mdms-service/CHANGELOG.md index e133ce3f222..932ae2f650c 100644 --- a/core-services/egov-mdms-service/CHANGELOG.md +++ b/core-services/egov-mdms-service/CHANGELOG.md @@ -3,6 +3,13 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded lombok version from 1.18.8 to 1.18.22 +- Upgraded org.egov.services:tracer version from 2.1.0-SNAPSHOT to 2.9.0-SNAPSHOT +- Upgraded org.egov:mdms-client version from 0.0.2-SNAPSHOT to 2.9.0-SNAPSHOT + ## 1.3.3 - 2023-08-11 - Central Instance Library Integration diff --git a/core-services/egov-mdms-service/pom.xml b/core-services/egov-mdms-service/pom.xml index 06f5c5ea8ba..1268679e381 100644 --- a/core-services/egov-mdms-service/pom.xml +++ b/core-services/egov-mdms-service/pom.xml @@ -5,43 +5,59 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE - + 3.2.2 org.egov.mdms egov-mdms-service-test - 1.3.3-SNAPSHOT + 2.9.0-SNAPSHOT egov-infra-mdms-service http://maven.apache.org 2.17.1 UTF-8 - 1.8 + 17 UTF-8 - 1.18.8 + 1.18.22 org.projectlombok lombok + + org.springframework.boot + spring-boot-starter-validation + com.jayway.jsonpath json-path + + net.minidev + json-smart + 2.5.0 + + com.fasterxml.jackson.core jackson-databind + + + commons-io + commons-io + 2.15.1 + + org.egov.services tracer - 2.1.0-SNAPSHOT + 2.9.0-SNAPSHOT org.egov mdms-client - 0.0.2-SNAPSHOT + 2.9.0-SNAPSHOT @@ -61,47 +77,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.mdms.model.MdmsCriteriaReq - org.egov.mdms.model.MdmsResponse - - - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - true - module - diff --git a/core-services/egov-mdms-service/src/main/java/org/egov/MDMSApplicationRunnerImpl.java b/core-services/egov-mdms-service/src/main/java/org/egov/MDMSApplicationRunnerImpl.java index f287f84a2d5..964ea128ba2 100644 --- a/core-services/egov-mdms-service/src/main/java/org/egov/MDMSApplicationRunnerImpl.java +++ b/core-services/egov-mdms-service/src/main/java/org/egov/MDMSApplicationRunnerImpl.java @@ -14,9 +14,10 @@ import java.util.Set; -import javax.annotation.PostConstruct; import com.fasterxml.jackson.core.type.*; +import jakarta.annotation.PostConstruct; +import net.minidev.json.JSONArray; import org.apache.commons.io.*; import org.egov.infra.mdms.utils.MDMSConstants; import org.springframework.beans.factory.annotation.Autowired; @@ -31,7 +32,6 @@ import com.jayway.jsonpath.JsonPath; import lombok.extern.slf4j.Slf4j; -import net.minidev.json.JSONArray; @Component diff --git a/core-services/egov-mdms-service/src/main/java/org/egov/infra/mdms/controller/MDMSController.java b/core-services/egov-mdms-service/src/main/java/org/egov/infra/mdms/controller/MDMSController.java index 8563fff3f90..be909d97145 100644 --- a/core-services/egov-mdms-service/src/main/java/org/egov/infra/mdms/controller/MDMSController.java +++ b/core-services/egov-mdms-service/src/main/java/org/egov/infra/mdms/controller/MDMSController.java @@ -3,8 +3,9 @@ import java.util.ArrayList; import java.util.Map; -import javax.validation.Valid; +import jakarta.validation.Valid; +import net.minidev.json.JSONArray; import org.egov.common.contract.request.RequestInfo; import org.egov.infra.mdms.service.MDMSService; import org.egov.mdms.model.*; @@ -14,7 +15,6 @@ import org.springframework.web.bind.annotation.*; import lombok.extern.slf4j.Slf4j; -import net.minidev.json.JSONArray; @RestController @Slf4j diff --git a/core-services/egov-mdms-service/src/main/java/org/egov/infra/mdms/service/MDMSService.java b/core-services/egov-mdms-service/src/main/java/org/egov/infra/mdms/service/MDMSService.java index cf8192d3f86..6d969915db9 100644 --- a/core-services/egov-mdms-service/src/main/java/org/egov/infra/mdms/service/MDMSService.java +++ b/core-services/egov-mdms-service/src/main/java/org/egov/infra/mdms/service/MDMSService.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; +import net.minidev.json.JSONArray; import org.egov.MDMSApplicationRunnerImpl; import org.egov.mdms.model.MasterDetail; import org.egov.mdms.model.MdmsCriteriaReq; @@ -14,7 +15,6 @@ import com.jayway.jsonpath.JsonPath; import lombok.extern.slf4j.Slf4j; -import net.minidev.json.JSONArray; @Service @Slf4j diff --git a/core-services/egov-notification-mail/CHANGELOG.md b/core-services/egov-notification-mail/CHANGELOG.md index 0ca7ff5e540..582573edac6 100644 --- a/core-services/egov-notification-mail/CHANGELOG.md +++ b/core-services/egov-notification-mail/CHANGELOG.md @@ -1,5 +1,11 @@ +# Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded lombok version from 1.18.8 to 1.18.22 + ## 1.2.0 - 2023-03-15 - Removed reading from sms topic to send every sms as email. - Added support for attachments in email. diff --git a/core-services/egov-notification-mail/pom.xml b/core-services/egov-notification-mail/pom.xml index 0d3ef3a0de7..a64288fd7e1 100644 --- a/core-services/egov-notification-mail/pom.xml +++ b/core-services/egov-notification-mail/pom.xml @@ -5,26 +5,24 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE - + 3.2.2 org.egov egov-notification-mail - 1.2.0-SNAPSHOT + 2.9.0-SNAPSHOT egov-notification-mail egov notification mail project 2.17.1 UTF-8 - 1.8 + 17 UTF-8 - 1.18.8 + 1.18.22 org.springframework spring-beans - 5.2.20.RELEASE org.springframework.boot @@ -62,12 +60,7 @@ org.egov.services tracer - 2.1.0-SNAPSHOT - - - org.egov.services - services-common - 1.1.1-SNAPSHOT + 2.9.0-SNAPSHOT @@ -92,93 +85,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - maven-pmd-plugin - 3.7 - - - verify - - check - - - - - false - false - - - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - - default-prepare-agent - - prepare-agent - - - - default-report - prepare-package - - report - - - - default-check - - check - - - - - CLASS - - org.egov.web.notification.mail.config.* - org.egov.web.notification.mail.model.* - org.egov.web.notification.mail.service.ExternalEmailService - org.egov.web.notification.mail.consumer.contract.EmailRequestDeserializer - org.egov.web.notification.mail.consumer.contract.EmailRequest - org.egov.web.notification.mail.EgovNotificationMailApplication - org.egov.web.notification.mail.service.ConsoleEmailService - - - - LINE - COVEREDRATIO - 0.90 - - - - - BUNDLE - - - COMPLEXITY - COVEREDRATIO - 0.2 - - - - - - - diff --git a/core-services/egov-notification-mail/src/main/java/org/egov/web/notification/mail/repository/UserRepository.java b/core-services/egov-notification-mail/src/main/java/org/egov/web/notification/mail/repository/UserRepository.java index 61984f6adfc..c4e7249d349 100644 --- a/core-services/egov-notification-mail/src/main/java/org/egov/web/notification/mail/repository/UserRepository.java +++ b/core-services/egov-notification-mail/src/main/java/org/egov/web/notification/mail/repository/UserRepository.java @@ -1,8 +1,7 @@ package org.egov.web.notification.mail.repository; -import java.util.HashSet; import java.util.List; -import java.util.Set; + import org.egov.tracer.model.CustomException; import org.egov.web.notification.mail.config.ApplicationConfiguration; diff --git a/core-services/egov-notification-mail/src/main/java/org/egov/web/notification/mail/service/ExternalEmailService.java b/core-services/egov-notification-mail/src/main/java/org/egov/web/notification/mail/service/ExternalEmailService.java index e9420f98e55..85eff024255 100644 --- a/core-services/egov-notification-mail/src/main/java/org/egov/web/notification/mail/service/ExternalEmailService.java +++ b/core-services/egov-notification-mail/src/main/java/org/egov/web/notification/mail/service/ExternalEmailService.java @@ -1,6 +1,5 @@ package org.egov.web.notification.mail.service; -import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import org.egov.tracer.model.CustomException; @@ -8,7 +7,6 @@ import org.egov.web.notification.mail.consumer.contract.Email; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.mail.MailException; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.MimeMessageHelper; @@ -20,7 +18,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.nio.channels.Channels; diff --git a/core-services/egov-notification-sms/CHANGELOG.md b/core-services/egov-notification-sms/CHANGELOG.md index 3f67f7439cc..128ee5884f7 100644 --- a/core-services/egov-notification-sms/CHANGELOG.md +++ b/core-services/egov-notification-sms/CHANGELOG.md @@ -1,3 +1,12 @@ + +# Changelog +All notable changes to this module will be documented in this file. + +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded lombok version from 1.18.8 to 1.18.22 + ## 1.2.0 - 15-03-2023 - Added new API for sms bounce-back tracking diff --git a/core-services/egov-notification-sms/pom.xml b/core-services/egov-notification-sms/pom.xml index d8d671bebd4..f9dab3734c8 100644 --- a/core-services/egov-notification-sms/pom.xml +++ b/core-services/egov-notification-sms/pom.xml @@ -1,10 +1,10 @@ - + 4.0.0 - org.egov egov-notification-sms - 1.2.0-SNAPSHOT + 2.9.0-SNAPSHOT jar egov-notification-sms @@ -13,22 +13,25 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 3.2.2 2.17.1 UTF-8 UTF-8 - 1.8 - 1.18.8 + 17 + 1.18.22 + + org.springframework.boot + spring-boot-starter-validation + org.springframework spring-beans - 5.2.20.RELEASE org.springframework.boot @@ -38,12 +41,17 @@ org.springframework.kafka spring-kafka - 2.4.5.RELEASE org.springframework.boot spring-boot-starter-web + + + org.apache.httpcomponents.client5 + httpclient5 + 5.3.1 + org.apache.commons commons-lang3 @@ -63,7 +71,7 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.9.0-SNAPSHOT @@ -79,7 +87,7 @@ org.egov enc-client - 1.1.0-SNAPSHOT + 2.9.0-SNAPSHOT @@ -97,94 +105,10 @@ - org.springframework.boot spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-pmd-plugin - 3.7 - - false - false - - - - verify - - check - - - - - - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - - default-prepare-agent - - prepare-agent - - - - default-report - prepare-package - - report - - - - default-check - - check - - - - - CLASS - - org.egov.web.notification.sms.consumer.contract.* - org.egov.web.notification.sms.EgovNotificationSmsApplication - org.egov.web.notification.sms.consumer.KafkaListenerLoggingAspect - - - org.egov.web.notification.sms.consumer.KakfaListenerLoggingConfiguration - - org.egov.pgr.model.RequestContext - org.egov.web.notification.sms.services.ConsoleSMSService - org.egov.web.notification.sms.config.SmsProperties - org.egov.web.notification.sms.models.RequestContext - - - - LINE - COVEREDRATIO - 0.90 - - - - - BUNDLE - - - COMPLEXITY - COVEREDRATIO - 0.3 - - - - - - - - - diff --git a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/EgovNotificationSmsApplication.java b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/EgovNotificationSmsApplication.java index d8c174d3f58..c0c48405cb4 100644 --- a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/EgovNotificationSmsApplication.java +++ b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/EgovNotificationSmsApplication.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.*; import org.egov.hash.HashService; import org.egov.tracer.config.TracerConfiguration; @@ -20,7 +21,6 @@ import org.springframework.util.*; import org.springframework.web.client.RestTemplate; -import javax.annotation.*; @SpringBootApplication @Import(TracerConfiguration.class) diff --git a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/SmsNotificationListener.java b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/SmsNotificationListener.java index 3b74edf94ce..b92ef68a0a1 100644 --- a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/SmsNotificationListener.java +++ b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/SmsNotificationListener.java @@ -16,7 +16,6 @@ import org.springframework.kafka.config.*; import org.springframework.kafka.core.*; import org.springframework.kafka.listener.*; -import org.springframework.kafka.listener.ErrorHandler; import org.springframework.stereotype.Service; import org.springframework.util.*; import org.springframework.web.client.RestClientException; diff --git a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/contract/SMSRequest.java b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/contract/SMSRequest.java index 29640a89f9f..d64d9f55ee6 100644 --- a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/contract/SMSRequest.java +++ b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/consumer/contract/SMSRequest.java @@ -1,5 +1,7 @@ package org.egov.web.notification.sms.consumer.contract; +import jakarta.validation.constraints.Pattern; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -8,8 +10,6 @@ import org.egov.web.notification.sms.models.Category; import org.egov.web.notification.sms.models.Sms; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; @Slf4j @Getter diff --git a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/models/Report.java b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/models/Report.java index e73b833531b..83010db2674 100644 --- a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/models/Report.java +++ b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/models/Report.java @@ -2,7 +2,6 @@ import lombok.*; -import org.hibernate.validator.constraints.SafeHtml; import java.util.Date; @@ -12,15 +11,12 @@ @Getter @ToString public class Report { - @SafeHtml + private String jobno; - @SafeHtml private int messagestatus; - @SafeHtml private String DoneTime; - @SafeHtml private String usernameHash; } diff --git a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/service/BaseSMSService.java b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/service/BaseSMSService.java index 38c62380bb2..ca10b5ef2b9 100644 --- a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/service/BaseSMSService.java +++ b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/service/BaseSMSService.java @@ -2,9 +2,16 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.jayway.jsonpath.*; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.*; -import org.apache.http.conn.ssl.*; -import org.apache.http.impl.client.*; +import org.apache.hc.client5.http.classic.HttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager; +import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; +import org.apache.hc.client5.http.io.HttpClientConnectionManager; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; import org.egov.web.notification.sms.config.*; import org.egov.web.notification.sms.models.*; import org.springframework.asm.*; @@ -18,7 +25,6 @@ import org.springframework.util.*; import org.springframework.web.client.*; -import javax.annotation.*; import javax.net.ssl.*; import java.io.*; import java.lang.reflect.Type; @@ -193,8 +199,20 @@ protected void setupSSL() { } catch (KeyManagementException e) { e.printStackTrace(); } + + // Create socket factory from SSLContext object SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(ctx, new NoopHostnameVerifier()); - CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build(); + + // Create a connection manager with custom configuration to enable SSL. + HttpClientConnectionManager ccm = PoolingHttpClientConnectionManagerBuilder.create() + .setSSLSocketFactory(csf) + .build(); + + // Create HttpClient that uses pool manager. + CloseableHttpClient httpClient = HttpClients.custom() + .setConnectionManager(ccm) + .build(); + HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setHttpClient(httpClient); restTemplate.setRequestFactory(requestFactory); diff --git a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/service/impl/MSDGSMSServiceImpl.java b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/service/impl/MSDGSMSServiceImpl.java index a18c4a74a5b..1ac6c2160c2 100644 --- a/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/service/impl/MSDGSMSServiceImpl.java +++ b/core-services/egov-notification-sms/src/main/java/org/egov/web/notification/sms/service/impl/MSDGSMSServiceImpl.java @@ -29,10 +29,6 @@ public class MSDGSMSServiceImpl extends BaseSMSService { @Autowired private SMSProperties smsProperties; - @Autowired - private SMSBodyBuilder bodyBuilder; - - /** * MD5 encryption algorithm * @@ -83,7 +79,7 @@ protected void submitToExternalSmsService(Sms sms) { } sms.setMessage(finalmessage); String url = smsProperties.getUrl(); - final MultiValueMap requestBody = bodyBuilder.getSmsRequestBody(sms); + final MultiValueMap requestBody = getSmsRequestBody(sms); postProcessor(requestBody); HttpEntity> request = new HttpEntity<>(requestBody, getHttpHeaders()); executeAPI(URI.create(url), HttpMethod.POST, request, String.class); diff --git a/core-services/egov-notification-sms/src/main/resources/application.properties b/core-services/egov-notification-sms/src/main/resources/application.properties index ff5505e31a9..ca9ca0b7b9d 100644 --- a/core-services/egov-notification-sms/src/main/resources/application.properties +++ b/core-services/egov-notification-sms/src/main/resources/application.properties @@ -84,7 +84,7 @@ spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.Strin #spring.kafka.producer.properties.spring.json.type.mapping=transaction:io.confluent.solutions.microservices.transaction.Transaction spring.kafka.producer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer -spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2 +spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.ErrorHandlingDeserializer spring.kafka.consumer.properties.spring.deserializer.value.delegate.class=org.egov.tracer.kafka.deserializer.HashMapDeserializer #spring.kafka.consumer.properties.spring.deserializer.value.delegate.class=org.springframework.kafka.support.serializer.JsonDeserializer spring.kafka.consumer.properties.spring.json.trusted.packages=org.egov diff --git a/core-services/egov-otp/CHANGELOG.md b/core-services/egov-otp/CHANGELOG.md index a6b863824ea..004946a1749 100644 --- a/core-services/egov-otp/CHANGELOG.md +++ b/core-services/egov-otp/CHANGELOG.md @@ -1,6 +1,14 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version from 9.4.1212 to 42.7.1 +- Upgraded lombok version from 1.18.8 to 1.18.22 +- Upgraded org.flywaydb:flyway-core version from 6.4.3 to 9.22.3 +- Upgraded org.egov.services:tracer version from 2.0.0-SNAPSHOT to 2.9.0-SNAPSHOT + ## 1.2.3 - 2023-03-15 - Removed Database timezone dependency diff --git a/core-services/egov-otp/pom.xml b/core-services/egov-otp/pom.xml index 20f404aa7fe..27ca44e126b 100644 --- a/core-services/egov-otp/pom.xml +++ b/core-services/egov-otp/pom.xml @@ -6,28 +6,30 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE - + 3.2.2 org.egov egov-otp - 1.2.3-SNAPSHOT + 2.9.0-SNAPSHOT otp OTP generator and validation 2.17.1 UTF-8 - 1.8 + 17 2.9.6 UTF-8 - 1.18.8 + 1.18.22 2.6 org.springframework spring-beans - 5.2.20.RELEASE + + + org.springframework.boot + spring-boot-starter-validation org.springframework.boot @@ -45,15 +47,21 @@ org.springframework.security spring-security-core + + junit + junit + 4.13.2 + test + org.flywaydb flyway-core - 6.4.3 + 9.22.3 org.postgresql postgresql - 9.4.1212 + 42.7.1 org.projectlombok @@ -80,11 +88,6 @@ commons-io 2.5 - - org.egov.services - services-common - 0.11.1 - com.h2database h2 @@ -93,7 +96,7 @@ org.egov.services tracer - 2.0.0-SNAPSHOT + 2.9.0-SNAPSHOT org.springframework.boot @@ -118,121 +121,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - maven-pmd-plugin - 3.7 - - - verify - - check - - - - - false - false - - - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - - default-prepare-agent - - prepare-agent - - - - default-report - prepare-package - - report - - - - default-check - - check - - - - - CLASS - - org.egov.OtpApplication - org.egov.web.contract.* - org.egov.domain.service.LocalDateTimeFactory - org.egov.domain.model.Token - org.egov.persistence.repository.TokenRepository - - - - LINE - COVEREDRATIO - 0.0 - - - - - BUNDLE - - - COMPLEXITY - COVEREDRATIO - 0.0 - - - - - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.web.contract.OtpResponse - org.egov.web.contract.Otp - org.egov.web.contract.OtpRequest - org.egov.web.contract.OtpValidateRequest - org.egov.web.contract.OtpValidationResponse - org.egov.web.controller.CustomControllerAdvice - org.egov.web.controller.OtpController - org.egov.web.util.OtpConfiguration - - Digit - true - module - diff --git a/core-services/egov-otp/src/main/java/org/egov/OtpApplication.java b/core-services/egov-otp/src/main/java/org/egov/OtpApplication.java index 1793b101830..35b1774416d 100644 --- a/core-services/egov-otp/src/main/java/org/egov/OtpApplication.java +++ b/core-services/egov-otp/src/main/java/org/egov/OtpApplication.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.annotation.PostConstruct; import org.egov.tracer.config.*; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -14,13 +15,12 @@ import org.springframework.security.crypto.bcrypt.*; import org.springframework.security.crypto.password.*; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.text.SimpleDateFormat; import java.util.Locale; import java.util.TimeZone; -import javax.annotation.PostConstruct; @SpringBootApplication @Import(TracerConfiguration.class) @@ -37,8 +37,8 @@ public void initialize() { } @Bean - public WebMvcConfigurerAdapter webMvcConfigurerAdapter() { - return new WebMvcConfigurerAdapter() { + public WebMvcConfigurer webMvcConfigurer() { + return new WebMvcConfigurer() { @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { diff --git a/core-services/egov-otp/src/main/java/org/egov/domain/model/Token.java b/core-services/egov-otp/src/main/java/org/egov/domain/model/Token.java index ac8a868a012..2f3f0906e86 100644 --- a/core-services/egov-otp/src/main/java/org/egov/domain/model/Token.java +++ b/core-services/egov-otp/src/main/java/org/egov/domain/model/Token.java @@ -3,6 +3,7 @@ import java.time.LocalDateTime; import java.util.Date; +import jakarta.validation.constraints.Size; import org.hibernate.validator.constraints.NotEmpty; import lombok.AllArgsConstructor; @@ -11,7 +12,6 @@ import lombok.Getter; import lombok.Setter; -import javax.validation.constraints.Size; @AllArgsConstructor @Builder diff --git a/core-services/egov-otp/src/main/java/org/egov/web/contract/Otp.java b/core-services/egov-otp/src/main/java/org/egov/web/contract/Otp.java index fab539fee0a..2636a22a4ca 100644 --- a/core-services/egov-otp/src/main/java/org/egov/web/contract/Otp.java +++ b/core-services/egov-otp/src/main/java/org/egov/web/contract/Otp.java @@ -1,13 +1,13 @@ package org.egov.web.contract; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import org.egov.domain.model.Token; -import javax.validation.constraints.Size; @Getter @AllArgsConstructor diff --git a/core-services/egov-otp/src/main/java/org/egov/web/contract/OtpRequest.java b/core-services/egov-otp/src/main/java/org/egov/web/contract/OtpRequest.java index c6a51f3df02..15f2aa12cb9 100644 --- a/core-services/egov-otp/src/main/java/org/egov/web/contract/OtpRequest.java +++ b/core-services/egov-otp/src/main/java/org/egov/web/contract/OtpRequest.java @@ -1,6 +1,7 @@ package org.egov.web.contract; import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.validation.Valid; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -8,7 +9,6 @@ import org.egov.domain.model.TokenRequest; import org.egov.domain.model.TokenSearchCriteria; -import javax.validation.Valid; @Getter @AllArgsConstructor diff --git a/core-services/egov-otp/src/main/java/org/egov/web/contract/OtpValidateRequest.java b/core-services/egov-otp/src/main/java/org/egov/web/contract/OtpValidateRequest.java index d723850d22a..d035f4c3ad1 100644 --- a/core-services/egov-otp/src/main/java/org/egov/web/contract/OtpValidateRequest.java +++ b/core-services/egov-otp/src/main/java/org/egov/web/contract/OtpValidateRequest.java @@ -2,12 +2,12 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.common.contract.request.RequestInfo; import org.egov.domain.model.ValidateRequest; -import javax.validation.Valid; @Getter @AllArgsConstructor diff --git a/core-services/egov-otp/src/main/java/org/egov/web/controller/OtpController.java b/core-services/egov-otp/src/main/java/org/egov/web/controller/OtpController.java index 52e5efa790f..806d477f2e1 100644 --- a/core-services/egov-otp/src/main/java/org/egov/web/controller/OtpController.java +++ b/core-services/egov-otp/src/main/java/org/egov/web/controller/OtpController.java @@ -1,5 +1,6 @@ package org.egov.web.controller; +import jakarta.validation.Valid; import org.egov.domain.model.Token; import org.egov.domain.service.TokenService; import org.egov.web.contract.OtpRequest; @@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import javax.validation.Valid; @RestController public class OtpController { diff --git a/core-services/egov-otp/src/main/resources/db/Dockerfile b/core-services/egov-otp/src/main/resources/db/Dockerfile index aa911735f99..7eb375b7245 100644 --- a/core-services/egov-otp/src/main/resources/db/Dockerfile +++ b/core-services/egov-otp/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql @@ -8,4 +8,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-otp/src/test/java/org/egov/domain/service/TokenServiceTest.java b/core-services/egov-otp/src/test/java/org/egov/domain/service/TokenServiceTest.java index 66ea8314e90..639b67a4523 100644 --- a/core-services/egov-otp/src/test/java/org/egov/domain/service/TokenServiceTest.java +++ b/core-services/egov-otp/src/test/java/org/egov/domain/service/TokenServiceTest.java @@ -2,7 +2,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -27,7 +26,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.beans.factory.annotation.*; import org.springframework.boot.test.context.*; import org.springframework.security.crypto.bcrypt.*; diff --git a/core-services/egov-otp/src/test/java/org/egov/web/controller/OtpControllerTest.java b/core-services/egov-otp/src/test/java/org/egov/web/controller/OtpControllerTest.java index 0f6f0c86ae6..75708a34104 100644 --- a/core-services/egov-otp/src/test/java/org/egov/web/controller/OtpControllerTest.java +++ b/core-services/egov-otp/src/test/java/org/egov/web/controller/OtpControllerTest.java @@ -12,7 +12,7 @@ import org.junit.*; import org.junit.runner.RunWith; import org.mockito.*; -import org.mockito.runners.*; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; diff --git a/core-services/egov-persister/CHANGELOG.md b/core-services/egov-persister/CHANGELOG.md index 314b0f29c13..e556ee0546f 100644 --- a/core-services/egov-persister/CHANGELOG.md +++ b/core-services/egov-persister/CHANGELOG.md @@ -1,6 +1,14 @@ +# Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version to 42.7.1 +- Upgraded lombok version from 1.18.8 to 1.18.22 +- Upgraded org.flywaydb:flyway-core version from 6.4.3 to 9.22.3 + ## 1.1.6 - 2023-08-11 - Central Instance Library Integration diff --git a/core-services/egov-persister/pom.xml b/core-services/egov-persister/pom.xml index aaa95e48109..ad23c6d917a 100644 --- a/core-services/egov-persister/pom.xml +++ b/core-services/egov-persister/pom.xml @@ -5,37 +5,32 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 3.2.2 org.egov egov-persister - 1.1.6-SNAPSHOT + 2.9.0-SNAPSHOT egov-persister egov persister framework 2.17.1 UTF-8 - 1.8 + 17 UTF-8 3.3.9 - 1.18.8 + 1.18.22 2.6 - - org.springframework - spring-beans - 5.2.20.RELEASE - org.springframework.boot spring-boot-starter-web - + org.apache.commons commons-lang3 @@ -45,10 +40,10 @@ org.springframework.boot spring-boot-starter-jdbc - + org.springframework.boot spring-boot-devtools @@ -57,6 +52,7 @@ org.postgresql postgresql + 42.7.1 org.projectlombok @@ -68,20 +64,15 @@ spring-boot-starter-test test - - org.egov.services - services-common - 0.9.0 - org.egov.services tracer - 2.1.0-SNAPSHOT + 2.9.0-SNAPSHOT org.flywaydb flyway-core - 6.4.3 + 9.22.3 com.jayway.jsonpath @@ -96,9 +87,8 @@ com.fasterxml.jackson.dataformat jackson-dataformat-yaml - 2.10.3 - + com.github.zafarkhaja java-semver @@ -136,44 +126,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.infra.persist.web.contract.Mapping - - - org.egov.infra.persist.web.contract.TypeEnum$TypeEnum:Type - - Digit - true - module - diff --git a/core-services/egov-persister/src/main/java/org/egov/EgovPersistApplication.java b/core-services/egov-persister/src/main/java/org/egov/EgovPersistApplication.java index 3138adfecee..7bf25a4a617 100644 --- a/core-services/egov-persister/src/main/java/org/egov/EgovPersistApplication.java +++ b/core-services/egov-persister/src/main/java/org/egov/EgovPersistApplication.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.io.IOUtils; import org.egov.infra.persist.web.contract.Mapping; import org.egov.infra.persist.web.contract.Service; import org.egov.infra.persist.web.contract.TopicMap; @@ -19,7 +18,7 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -85,7 +84,7 @@ public List getFilesInFolder(String baseFolderPath,List fileType return configFolderList; } - @PostConstruct + //@PostConstruct @Bean public TopicMap loadConfigs() { TopicMap topicMap = new TopicMap(); @@ -136,7 +135,9 @@ public TopicMap loadConfigs() { failed = true; } finally { - IOUtils.closeQuietly(inputStream); + if (inputStream != null) { + inputStream.close(); + } } } diff --git a/core-services/egov-persister/src/main/java/org/egov/infra/persist/consumer/PersisterBatchConsumerConfig.java b/core-services/egov-persister/src/main/java/org/egov/infra/persist/consumer/PersisterBatchConsumerConfig.java index 6d82446fc14..32f6bc90585 100644 --- a/core-services/egov-persister/src/main/java/org/egov/infra/persist/consumer/PersisterBatchConsumerConfig.java +++ b/core-services/egov-persister/src/main/java/org/egov/infra/persist/consumer/PersisterBatchConsumerConfig.java @@ -22,10 +22,10 @@ import org.springframework.kafka.core.DefaultKafkaConsumerFactory; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.listener.*; -import org.springframework.kafka.support.serializer.ErrorHandlingDeserializer2; +import org.springframework.kafka.support.serializer.ErrorHandlingDeserializer; import org.springframework.kafka.support.serializer.JsonDeserializer; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -40,8 +40,8 @@ matchIfMissing = false) public class PersisterBatchConsumerConfig { - @Autowired - private StoppingErrorHandler stoppingErrorHandler; + /*@Autowired + private StoppingErrorHandler stoppingErrorHandler;*/ @Autowired private BatchMessageListener indexerMessageListener; @@ -81,8 +81,8 @@ public ConsumerFactory consumerFactory() { JsonDeserializer jsonDeserializer = new JsonDeserializer<>(Object.class,false); - ErrorHandlingDeserializer2 errorHandlingDeserializer - = new ErrorHandlingDeserializer2<>(jsonDeserializer); + ErrorHandlingDeserializer errorHandlingDeserializer + = new ErrorHandlingDeserializer<>(jsonDeserializer); return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), errorHandlingDeserializer); @@ -95,7 +95,7 @@ public KafkaListenerContainerFactory consumerFactory() { JsonDeserializer jsonDeserializer = new JsonDeserializer<>(Object.class,false); - ErrorHandlingDeserializer2 errorHandlingDeserializer - = new ErrorHandlingDeserializer2<>(jsonDeserializer); + ErrorHandlingDeserializer errorHandlingDeserializer + = new ErrorHandlingDeserializer<>(jsonDeserializer); return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), errorHandlingDeserializer); } @@ -83,7 +83,7 @@ public KafkaListenerContainerFactory record) { } } +*/ diff --git a/core-services/egov-persister/src/main/java/org/egov/infra/persist/utils/Utils.java b/core-services/egov-persister/src/main/java/org/egov/infra/persist/utils/Utils.java index bcfe502a030..cc21f767d03 100644 --- a/core-services/egov-persister/src/main/java/org/egov/infra/persist/utils/Utils.java +++ b/core-services/egov-persister/src/main/java/org/egov/infra/persist/utils/Utils.java @@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; @Slf4j @Component diff --git a/core-services/egov-persister/src/main/resources/application.properties b/core-services/egov-persister/src/main/resources/application.properties index 434a527fea4..3a66cf46478 100644 --- a/core-services/egov-persister/src/main/resources/application.properties +++ b/core-services/egov-persister/src/main/resources/application.properties @@ -42,7 +42,7 @@ spring.kafka.producer.value-serializer=org.springframework.kafka.support.seriali kafka.topics.create.message=egov-message-create #-------------------------------------------------------------- #egov.persist.yml.repo.path=classpath:pg-service-persister.yml -egov.persist.yml.repo.path=D:/eGov/configs/egov-persister +egov.persist.yml.repo.path=https://raw.githubusercontent.com/egovernments/configs/DEV/egov-persister/tradelicense-persister.yml #logging.level.org.egov.infra.persist.repository=DEBUG tracer.kafkaMessageLoggingEnabled=true tracer.errorsTopic=egov-persister-deadletter diff --git a/core-services/egov-persister/src/test/java/org/egov/infra/persist/consumer/StoppingErrorHandlerTest.java b/core-services/egov-persister/src/test/java/org/egov/infra/persist/consumer/StoppingErrorHandlerTest.java index 2acea015efd..73d2d6dbeea 100644 --- a/core-services/egov-persister/src/test/java/org/egov/infra/persist/consumer/StoppingErrorHandlerTest.java +++ b/core-services/egov-persister/src/test/java/org/egov/infra/persist/consumer/StoppingErrorHandlerTest.java @@ -1,3 +1,4 @@ +/* package org.egov.infra.persist.consumer; import static org.mockito.Mockito.doNothing; @@ -30,3 +31,4 @@ void testHandle() { } } +*/ diff --git a/core-services/egov-pg-service/CHANGELOG.md b/core-services/egov-pg-service/CHANGELOG.md index 59c15cb8abd..1158ee36b3e 100644 --- a/core-services/egov-pg-service/CHANGELOG.md +++ b/core-services/egov-pg-service/CHANGELOG.md @@ -3,6 +3,18 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version to 42.7.1 +- Upgraded org.flywaydb:flyway-core version from 5.2.3 to 9.22.3 +- Upgraded org.quartz-scheduler:quartz version from 2.3.0 to 2.3.2 +- Upgraded org.quartz-scheduler:quartz-jobs from 2.3.0 to 2.3.2 +- Upgraded com.paytm:paytm-checksum from 2.0.0 to 1.2.1 +- Upgraded lombok version from 1.18.8 to 1.18.22 +- Upgraded javax.validation:validation-api version to 3.0.2 +- Upgraded org.egov.services:tracer version from 2.1.1-SNAPSHOT to 2.9.0-SNAPSHOT + ## 1.2.3 - 2022-01-13 - Updated to log4j2 version 2.17.1 diff --git a/core-services/egov-pg-service/pom.xml b/core-services/egov-pg-service/pom.xml index 0a1cd649684..a35ab839edf 100644 --- a/core-services/egov-pg-service/pom.xml +++ b/core-services/egov-pg-service/pom.xml @@ -5,22 +5,17 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 3.2.2 org.egov egov-pg-service - 1.2.3-SNAPSHOT + 2.9.0-SNAPSHOT 2.17.1 - 1.8 - 1.18.8 + 17 + 1.18.22 - - org.springframework - spring-beans - 5.2.20.RELEASE - org.springframework.boot spring-boot-starter-test @@ -34,34 +29,40 @@ org.springframework.boot spring-boot-starter-jdbc - + org.postgresql postgresql + 42.7.1 org.flywaydb flyway-core - 5.2.3 + 9.22.3 + + + + + - com.paytm + com.paytm.pg paytm-checksum - 2.0.0 + 1.2.1 org.quartz-scheduler quartz - 2.3.0 + 2.3.2 org.quartz-scheduler quartz-jobs - 2.3.0 + 2.3.2 org.springframework @@ -70,7 +71,7 @@ org.egov.services tracer - 2.1.1-SNAPSHOT + 2.9.0-SNAPSHOT org.projectlombok @@ -87,18 +88,25 @@ jackson-datatype-jsr310 - javax.validation - validation-api - - - org.egov.services - services-common - 1.1.1-SNAPSHOT + jakarta.validation + jakarta.validation-api + 3.0.2 - + + + net.minidev + json-smart + 2.5.0 + + + junit + junit + 4.13.2 + test @@ -123,81 +131,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - repackage - - - - - - - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.pg.models.BankAccountResponse - org.egov.pg.models.BillRequest - org.egov.pg.models.BillResponse - org.egov.pg.models.BusinessDetailsRequest - org.egov.pg.models.BusinessDetailsRequest - org.egov.pg.models.BusinessDetailsResponse - org.egov.pg.models.CollectionPaymentRequest - org.egov.pg.models.CollectionPaymentResponse - org.egov.pg.models.IdGenerationRequest - org.egov.pg.models.IdGenerationResponse - org.egov.pg.models.ReceiptReq - org.egov.pg.models.ReceiptRes - org.egov.pg.models.TransactionDumpRequest - org.egov.pg.models.TransactionRequest - org.egov.pg.models.WorkflowDetailsRequest - org.egov.pg.models.WorkFlowDetailsResponse - org.egov.pg.web.models.ErrorRes - org.egov.pg.web.models.PaymentSearchResponse - org.egov.pg.web.models.TransactionCreateResponse - org.egov.pg.web.models.TransactionRequest - org.egov.pg.web.models.TransactionResponse - org.egov.pg.web.models.TransactionSearchResponse - - - org.egov.pg.models.TransactionRequest:TransactionRequestModel - org.egov.pg.models.Bill$StatusEnum:BillStatus - - - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - true - module - diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/config/scheduler/QuartzConfig.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/config/scheduler/QuartzConfig.java index b61d86bb44b..562a0158ce3 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/config/scheduler/QuartzConfig.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/config/scheduler/QuartzConfig.java @@ -1,5 +1,6 @@ package org.egov.pg.config.scheduler; +import jakarta.annotation.PostConstruct; import org.quartz.Trigger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -12,7 +13,6 @@ import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.transaction.PlatformTransactionManager; -import javax.annotation.PostConstruct; import javax.sql.DataSource; import java.io.IOException; import java.util.List; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AccountCodePurposeContract.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AccountCodePurposeContract.java index 548d072041b..454030144a6 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AccountCodePurposeContract.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AccountCodePurposeContract.java @@ -40,10 +40,11 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; -import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; @Builder @Getter @@ -57,7 +58,7 @@ public class AccountCodePurposeContract extends AuditableContract { private Long id; @NotNull - @Length(max = 256, min = 3) + @Size(max = 256, min = 3) private String name; public AccountCodePurposeContract(final String id) { diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AccountDetailTypeContract.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AccountDetailTypeContract.java index c59403fdde6..62ab901b0c9 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AccountDetailTypeContract.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AccountDetailTypeContract.java @@ -43,10 +43,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty.Access; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; @@ -66,20 +65,20 @@ public class AccountDetailTypeContract extends AuditableContract implements java private List ids = new ArrayList(); @NotNull - @Length(max = 50, min = 1) + @Size(max = 50, min = 1) private String name; @NotNull - @Length(max = 50, min = 1) + @Size(max = 50, min = 1) private String description; - @Length(max = 25) + @Size(max = 25) private String tableName; @NotNull private Boolean active; - @Length(max = 250, min = 1) + @Size(max = 250, min = 1) private String fullyQualifiedName; public AccountDetailTypeContract(final String id) { diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AuditableContract.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AuditableContract.java index 228b03ba654..57b883c16a4 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AuditableContract.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/AuditableContract.java @@ -40,9 +40,8 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.NotNull; import lombok.Data; - -import javax.validation.constraints.NotNull; import java.util.Date; @Data diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankAccountContract.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankAccountContract.java index 6ba931f3730..62767d8eefe 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankAccountContract.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankAccountContract.java @@ -43,11 +43,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty.Access; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; import org.egov.pg.models.enums.BankAccountType; -import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.NotNull; @Builder @Getter @@ -70,18 +70,18 @@ public class BankAccountContract extends AuditableContract implements java.io.Se private FundContract fund; @NotNull - @Length(max = 25) + @Size(max = 25) private String accountNumber; // is this required ? private String accountType; - @Length(max = 256) + @Size(max = 256) private String description; @NotNull private Boolean active; - @Length(max = 100) + @Size(max = 100) private String payTo; @NotNull diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankBranchContract.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankBranchContract.java index 0a34d59c917..058ea7006ad 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankBranchContract.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankBranchContract.java @@ -40,11 +40,10 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import jakarta.validation.constraints.Size; import lombok.*; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; @Builder @Getter @@ -62,46 +61,46 @@ public class BankBranchContract extends AuditableContract { private BankContract bank; @NotNull - @Length(max = 50, min = 1) + @Size(max = 50, min = 1) private String code; @NotNull - @Length(max = 50, min = 1) + @Size(max = 50, min = 1) @Pattern(regexp = "^[a-zA-Z0-9_]*$") private String name; @NotNull - @Length(max = 50, min = 1) + @Size(max = 50, min = 1) private String address; - @Length(max = 50) + @Size(max = 50) private String address2; - @Length(max = 50) + @Size(max = 50) private String city; - @Length(max = 50) + @Size(max = 50) private String state; - @Length(max = 50) + @Size(max = 50) private String pincode; - @Length(max = 15) + @Size(max = 15) private String phone; - @Length(max = 15) + @Size(max = 15) private String fax; - @Length(max = 50) + @Size(max = 50) private String contactPerson; @NotNull private Boolean active; - @Length(max = 256) + @Size(max = 256) private String description; - @Length(max = 50) + @Size(max = 50) private String micr; public BankBranchContract(final String id) { diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankContract.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankContract.java index be563e4da48..53872e8ec73 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankContract.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BankContract.java @@ -41,10 +41,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty.Access; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; -import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; @@ -61,21 +61,21 @@ public class BankContract { private List ids = new ArrayList(); @NotNull - @Length(max = 50, min = 1) + @Size(max = 50, min = 1) private String code; @NotNull - @Length(max = 100, min = 2) + @Size(max = 100, min = 2) private String name; - @Length(max = 250) + @Size(max = 250) private String description; @NotNull private Boolean active; // is this required? - @Length(max = 50) + @Size(max = 50) private String type; public BankContract(final String id) { diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Bill.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Bill.java index 2102d8ee583..722382eebf5 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Bill.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Bill.java @@ -3,10 +3,6 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; -import java.util.Map; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; @@ -14,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BillAccountDetail.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BillAccountDetail.java index 9e1fb4f4c64..dbe7c427f69 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BillAccountDetail.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BillAccountDetail.java @@ -14,7 +14,7 @@ import lombok.Setter; import lombok.ToString; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; @Setter @Getter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BillDetail.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BillDetail.java index bb6ecb63648..19b84fb72b3 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BillDetail.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/BillDetail.java @@ -43,8 +43,7 @@ import java.util.ArrayList; import java.util.List; -import javax.validation.constraints.NotNull; - +import jakarta.validation.constraints.NotNull; import org.springframework.util.CollectionUtils; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/ChartOfAccountDetailContract.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/ChartOfAccountDetailContract.java index 3bc33bd9630..5175824ceb9 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/ChartOfAccountDetailContract.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/ChartOfAccountDetailContract.java @@ -41,9 +41,9 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.NotNull; import lombok.*; -import javax.validation.constraints.NotNull; @Builder @Getter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPayment.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPayment.java index 061a365eaaf..3102479a05a 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPayment.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPayment.java @@ -2,12 +2,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - import org.egov.pg.models.enums.InstrumentStatusEnum; import org.egov.pg.models.enums.CollectionPaymentModeEnum; import org.egov.pg.models.enums.PaymentStatusEnum; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPaymentDetail.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPaymentDetail.java index 2ce2dfb20b6..dee7025722e 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPaymentDetail.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPaymentDetail.java @@ -2,10 +2,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import java.math.BigDecimal; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPaymentRequest.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPaymentRequest.java index 1631abed39d..58212f7864c 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPaymentRequest.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/CollectionPaymentRequest.java @@ -2,14 +2,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - import org.egov.common.contract.request.RequestInfo; @Data diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/FundContract.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/FundContract.java index 70da87684ab..ef731f6e38d 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/FundContract.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/FundContract.java @@ -43,10 +43,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty.Access; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; -import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.NotNull; @Builder @Getter @@ -59,11 +59,11 @@ public class FundContract extends AuditableContract { private Long id; - @Length(max = 50, min = 2) + @Size(max = 50, min = 2) @NotNull private String name; - @Length(max = 50, min = 2) + @Size(max = 50, min = 2) @NotNull private String code; @NotNull diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/IdRequest.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/IdRequest.java index 4101f10e335..053f577a1d9 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/IdRequest.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/IdRequest.java @@ -1,10 +1,10 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Getter; -import javax.validation.constraints.NotNull; @Getter @AllArgsConstructor diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Instrument.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Instrument.java index 2d018d0e7d5..730125db579 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Instrument.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Instrument.java @@ -40,13 +40,10 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.*; import lombok.*; -import org.hibernate.validator.constraints.NotBlank; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; + import java.math.BigDecimal; import java.util.Date; import java.util.HashSet; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentStatus.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentStatus.java index 64f6ec9bad4..6c313d3ae7d 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentStatus.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentStatus.java @@ -40,10 +40,10 @@ package org.egov.pg.models; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; @NoArgsConstructor @AllArgsConstructor diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentType.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentType.java index aa6b966a8f1..a5e8de704c2 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentType.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentType.java @@ -39,12 +39,11 @@ */ package org.egov.pg.models; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; -import org.hibernate.validator.constraints.NotBlank; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import java.util.List; @NoArgsConstructor diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentTypeProperty.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentTypeProperty.java index abf067087eb..13c05c3ea2a 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentTypeProperty.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/InstrumentTypeProperty.java @@ -1,9 +1,8 @@ package org.egov.pg.models; +import jakarta.validation.constraints.NotNull; import lombok.*; -import javax.validation.constraints.NotNull; - @NoArgsConstructor @AllArgsConstructor @Getter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Pagination.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Pagination.java index dc797d78650..78deb615925 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Pagination.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Pagination.java @@ -41,9 +41,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty.Access; +import jakarta.validation.constraints.Max; import lombok.Data; - -import javax.validation.constraints.Max; import java.util.List; @Data diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/PaginationContract.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/PaginationContract.java index 9f3c67711cb..0e4d860fb43 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/PaginationContract.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/PaginationContract.java @@ -39,11 +39,11 @@ */ package org.egov.pg.models; +import jakarta.validation.constraints.Max; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.constraints.Max; @AllArgsConstructor @NoArgsConstructor diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Receipt.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Receipt.java index 4dcbeb35fa9..fbb388389a5 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Receipt.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Receipt.java @@ -1,11 +1,10 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; import java.util.ArrayList; import java.util.List; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/ReceiptReq.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/ReceiptReq.java index 39eb19051a2..f35632164e5 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/ReceiptReq.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/ReceiptReq.java @@ -1,11 +1,10 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.*; import org.egov.common.contract.request.RequestInfo; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import java.util.List; @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/SurrenderReason.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/SurrenderReason.java index 19c63bbb70e..a67bcde48b4 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/SurrenderReason.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/SurrenderReason.java @@ -1,9 +1,9 @@ package org.egov.pg.models; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; import lombok.*; -import org.hibernate.validator.constraints.NotBlank; -import javax.validation.constraints.Size; @NoArgsConstructor @AllArgsConstructor diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/TaxAndPayment.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/TaxAndPayment.java index 167ab5e5f2a..16f42637211 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/TaxAndPayment.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/TaxAndPayment.java @@ -1,9 +1,7 @@ package org.egov.pg.models; +import jakarta.validation.constraints.NotNull; import lombok.*; -import org.hibernate.validator.constraints.SafeHtml; - -import javax.validation.constraints.NotNull; import java.math.BigDecimal; @Getter @@ -20,7 +18,7 @@ public class TaxAndPayment { @NotNull private BigDecimal amountPaid; - @SafeHtml + //@SafeHtml @NotNull private String billId; } diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Transaction.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Transaction.java index 39c15bd3a61..fb1a6d5f5a3 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Transaction.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/Transaction.java @@ -7,11 +7,10 @@ import lombok.*; import org.egov.pg.constants.TransactionAdditionalFields; import org.egov.pg.web.models.User; -import org.hibernate.validator.constraints.SafeHtml; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import java.util.List; import java.util.Map; @@ -27,7 +26,7 @@ @ToString public class Transaction { - @SafeHtml + //@SafeHtml @JsonProperty("tenantId") @NotNull @Size(min = 2, max = 50) @@ -36,7 +35,7 @@ public class Transaction { /** * Transaction Amount, preferably rounded off to two decimal places */ - @SafeHtml + //@SafeHtml @JsonProperty("txnAmount") @NotNull @Size(min = 1) @@ -45,7 +44,7 @@ public class Transaction { /** * Unique bill ID associated with the transaction */ - @SafeHtml + //@SafeHtml @JsonProperty("billId") @NotNull @Size(min = 1) @@ -55,7 +54,7 @@ public class Transaction { /** * Backward compatibility */ - @SafeHtml + //@SafeHtml @JsonProperty("module") @Size(min = 1) private String module; @@ -63,7 +62,7 @@ public class Transaction { /** * Backward compatibility */ - @SafeHtml + //@SafeHtml @JsonProperty("consumerCode") @NotNull @Size(min = 1, max = 128) @@ -83,7 +82,7 @@ public class Transaction { * Brief description for which the payment is being made * ex, Property Tax Payment for FY-YYYY */ - @SafeHtml + //@SafeHtml @JsonProperty("productInfo") @NotNull @Size(min = 1, max = 512) @@ -93,7 +92,7 @@ public class Transaction { * Gateway to be used to perform this transaction * Should be among the list of valid & active gateways returned by API */ - @SafeHtml + //@SafeHtml @JsonProperty("gateway") @NotNull @Size(min = 2) diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/WorkFlowDetailsResponse.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/WorkFlowDetailsResponse.java index 551cb4bbd35..ae5631d9326 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/WorkFlowDetailsResponse.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/WorkFlowDetailsResponse.java @@ -1,11 +1,11 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.egov.common.contract.response.ResponseInfo; -import javax.validation.constraints.NotNull; @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/WorkflowDetailsRequest.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/WorkflowDetailsRequest.java index 2def4d08bb2..c5d5bb4724f 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/models/WorkflowDetailsRequest.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/models/WorkflowDetailsRequest.java @@ -40,10 +40,10 @@ package org.egov.pg.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import lombok.*; import org.egov.common.contract.request.RequestInfo; -import javax.validation.constraints.NotNull; @AllArgsConstructor @EqualsAndHashCode diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/service/gateways/paytm/PaytmGateway.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/service/gateways/paytm/PaytmGateway.java index c7cb9f0ed1a..7b2ce14c580 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/service/gateways/paytm/PaytmGateway.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/service/gateways/paytm/PaytmGateway.java @@ -1,6 +1,6 @@ package org.egov.pg.service.gateways.paytm; -import com.paytm.pg.merchant.CheckSumServiceHelper; +import com.paytm.pg.merchant.*; import lombok.extern.slf4j.Slf4j; import org.egov.pg.models.Transaction; import org.egov.pg.service.Gateway; @@ -73,7 +73,7 @@ public URI generateRedirectURI(Transaction transaction) { try { - String checkSum = CheckSumServiceHelper.getCheckSumServiceHelper().genrateCheckSum(MERCHANT_KEY, paramMap); + String checkSum = PaytmChecksum.generateSignature(paramMap, MERCHANT_KEY); paramMap.put("CHECKSUMHASH", checkSum); MultiValueMap params = new LinkedMultiValueMap<>(); @@ -97,7 +97,7 @@ public Transaction fetchStatus(Transaction currentStatus, Map pa treeMap.put("ORDER_ID", currentStatus.getTxnId()); try { - String checkSum = CheckSumServiceHelper.getCheckSumServiceHelper().genrateCheckSum(MERCHANT_KEY, treeMap); + String checkSum = PaytmChecksum.generateSignature(treeMap, MERCHANT_KEY); treeMap.put("CHECKSUMHASH", checkSum); HttpHeaders httpHeaders = new HttpHeaders(); diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/service/jobs/dailyReconciliation/DailyReconciliationJob.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/service/jobs/dailyReconciliation/DailyReconciliationJob.java index d004d223e00..ba0256154a2 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/service/jobs/dailyReconciliation/DailyReconciliationJob.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/service/jobs/dailyReconciliation/DailyReconciliationJob.java @@ -1,5 +1,6 @@ package org.egov.pg.service.jobs.dailyReconciliation; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.PlainAccessRequest; import org.egov.common.contract.request.RequestInfo; @@ -15,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/service/jobs/earlyReconciliation/EarlyReconciliationJob.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/service/jobs/earlyReconciliation/EarlyReconciliationJob.java index 1ee5c7e14c8..9704e19d560 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/service/jobs/earlyReconciliation/EarlyReconciliationJob.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/service/jobs/earlyReconciliation/EarlyReconciliationJob.java @@ -1,5 +1,6 @@ package org.egov.pg.service.jobs.earlyReconciliation; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.egov.common.contract.request.PlainAccessRequest; import org.egov.common.contract.request.RequestInfo; @@ -16,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/controllers/TransactionsApiController.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/controllers/TransactionsApiController.java index 9a3cad3006c..66074e525bf 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/controllers/TransactionsApiController.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/controllers/TransactionsApiController.java @@ -13,7 +13,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; +import jakarta.validation.Valid; import java.util.List; import java.util.Map; import java.util.Set; diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Error.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Error.java index f23103ed7a8..1d48c8b02a0 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Error.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Error.java @@ -1,18 +1,17 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.*; import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import java.util.List; /** * Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400. */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/ErrorRes.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/ErrorRes.java index b363aaf3560..5cfffcc24a8 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/ErrorRes.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/ErrorRes.java @@ -1,18 +1,17 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.*; import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import java.util.List; /** * All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure. */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Payment.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Payment.java index 81a69e0caa7..4874859fe34 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Payment.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Payment.java @@ -2,17 +2,18 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; + /** * Details of the payment object. */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/PaymentSearchResponse.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/PaymentSearchResponse.java index b4f77e3348e..dc31047bbd1 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/PaymentSearchResponse.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/PaymentSearchResponse.java @@ -1,18 +1,17 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.pg.models.Transaction; import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; import java.util.List; /** * The payment seatch response object, representing the status of the payment */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/RequestInfo.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/RequestInfo.java index 51be8597cb1..8e16ef94152 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/RequestInfo.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/RequestInfo.java @@ -1,18 +1,17 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - /** * RequestInfo should be used to carry meta information about the requests to the server as described in the fields below. All eGov APIs will use requestinfo as a part of the request body to carry this meta information. Some of this information will be returned back from the server as part of the ResponseInfo in the response body to ensure correlation. */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/ResponseInfo.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/ResponseInfo.java index 0f56a8950be..b267ca032ec 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/ResponseInfo.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/ResponseInfo.java @@ -3,17 +3,17 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; /** * ResponseInfo should be used to carry metadata information about the response from the server. apiId, ver and msgId in ResponseInfo should always correspond to the same values in respective request's RequestInfo. */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Role.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Role.java index e6066b4a42e..604767fb89b 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Role.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/Role.java @@ -1,17 +1,17 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.*; import org.springframework.validation.annotation.Validated; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; /** * minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TenantRole.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TenantRole.java index 635dfa5c367..796c473d1df 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TenantRole.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TenantRole.java @@ -1,11 +1,12 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.*; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; + import java.util.ArrayList; import java.util.List; @@ -13,7 +14,7 @@ * User role carries the tenant related role information for the user. A user can have multiple roles per tenant based on the need of the tenant. A user may also have multiple roles for multiple tenants. */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionCreateResponse.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionCreateResponse.java index e0d357a6d74..cd653889b94 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionCreateResponse.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionCreateResponse.java @@ -1,11 +1,10 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.pg.models.Transaction; -import javax.validation.Valid; - @Getter @Setter @AllArgsConstructor diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionRequest.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionRequest.java index 39cbcb6a021..c700719359d 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionRequest.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionRequest.java @@ -1,18 +1,17 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.common.contract.request.RequestInfo; import org.egov.pg.models.Transaction; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; - /** * The payment object, containing all necessary information for initiating a payment and the request body metadata */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionResponse.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionResponse.java index 7ed8e795ee2..3c587d5e8ab 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionResponse.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionResponse.java @@ -1,18 +1,17 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.pg.models.Transaction; import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; import java.util.List; /** * The payment response object, representing the status of the payment */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionSearchResponse.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionSearchResponse.java index e7305917161..08f062dc445 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionSearchResponse.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/TransactionSearchResponse.java @@ -1,10 +1,9 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; import lombok.*; import org.egov.pg.models.Transaction; - -import javax.validation.Valid; import java.util.List; @Getter diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/User.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/User.java index e59f95968cb..e891e9f5813 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/User.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/User.java @@ -1,9 +1,8 @@ package org.egov.pg.web.models; +import jakarta.validation.constraints.NotNull; import lombok.*; -import javax.validation.constraints.NotNull; - @Setter @Getter @Builder diff --git a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/UserInfo.java b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/UserInfo.java index 8e530ba683d..526dc27a6b0 100644 --- a/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/UserInfo.java +++ b/core-services/egov-pg-service/src/main/java/org/egov/pg/web/models/UserInfo.java @@ -1,11 +1,10 @@ package org.egov.pg.web.models; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import lombok.*; import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; @@ -13,7 +12,7 @@ * This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server. */ @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-06-05T12:58:12.679+05:30") @Getter @Setter diff --git a/core-services/egov-pg-service/src/main/resources/db/Dockerfile b/core-services/egov-pg-service/src/main/resources/db/Dockerfile index 70b5046615d..f38638a269f 100644 --- a/core-services/egov-pg-service/src/main/resources/db/Dockerfile +++ b/core-services/egov-pg-service/src/main/resources/db/Dockerfile @@ -1,13 +1,9 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql -COPY ./migration/dev /flyway/dev - -COPY ./migration/seed /flyway/seed - COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-pg-service/src/main/resources/quartz.properties b/core-services/egov-pg-service/src/main/resources/quartz.properties index 5d3d15f049c..7586f724d69 100644 --- a/core-services/egov-pg-service/src/main/resources/quartz.properties +++ b/core-services/egov-pg-service/src/main/resources/quartz.properties @@ -11,7 +11,8 @@ org.quartz.threadPool.threadCount:2 #============================================================================ # Configure JobStore #============================================================================ -org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX +#org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX +org.quartz.jobStore.class=org.springframework.scheduling.quartz.LocalDataSourceJobStore org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate org.quartz.jobStore.tablePrefix=eg_pg_qrtz_ org.quartz.jobStore.isClustered=true diff --git a/core-services/egov-pg-service/src/test/java/org/egov/pg/service/TransactionServiceTest.java b/core-services/egov-pg-service/src/test/java/org/egov/pg/service/TransactionServiceTest.java index 813100cd0ee..a6bdcbc19ae 100644 --- a/core-services/egov-pg-service/src/test/java/org/egov/pg/service/TransactionServiceTest.java +++ b/core-services/egov-pg-service/src/test/java/org/egov/pg/service/TransactionServiceTest.java @@ -20,7 +20,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.dao.TransientDataAccessResourceException; import lombok.extern.slf4j.Slf4j; @@ -32,7 +32,7 @@ import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.when; diff --git a/core-services/egov-pg-service/src/test/java/org/egov/pg/validator/TransactionValidatorTest.java b/core-services/egov-pg-service/src/test/java/org/egov/pg/validator/TransactionValidatorTest.java index 14ed80b8d84..272987a37b0 100644 --- a/core-services/egov-pg-service/src/test/java/org/egov/pg/validator/TransactionValidatorTest.java +++ b/core-services/egov-pg-service/src/test/java/org/egov/pg/validator/TransactionValidatorTest.java @@ -1,6 +1,6 @@ package org.egov.pg.validator; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import java.math.BigDecimal; @@ -26,7 +26,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class TransactionValidatorTest { diff --git a/core-services/egov-pg-service/src/test/java/org/egov/pg/web/controllers/TransactionsApiControllerTest.java b/core-services/egov-pg-service/src/test/java/org/egov/pg/web/controllers/TransactionsApiControllerTest.java index 816bd36320e..fb73404c81e 100644 --- a/core-services/egov-pg-service/src/test/java/org/egov/pg/web/controllers/TransactionsApiControllerTest.java +++ b/core-services/egov-pg-service/src/test/java/org/egov/pg/web/controllers/TransactionsApiControllerTest.java @@ -26,7 +26,7 @@ import java.util.Collections; import java.util.Map; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; diff --git a/core-services/egov-url-shortening/CHANGELOG.md b/core-services/egov-url-shortening/CHANGELOG.md index 4c7013f498b..2482663652b 100644 --- a/core-services/egov-url-shortening/CHANGELOG.md +++ b/core-services/egov-url-shortening/CHANGELOG.md @@ -3,6 +3,14 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version to 42.7.1 +- Upgraded org.flywaydb:flyway-core version to 9.22.3 +- Upgraded org.egov.services:tracer version from 2.1.2-SNAPSHOT to 2.9.0-SNAPSHOT +- Upgraded redis.clients:jedis version to 5.0.0 + ## 1.1.2 - 2022-03-03 -Added support for randomized short url generation diff --git a/core-services/egov-url-shortening/pom.xml b/core-services/egov-url-shortening/pom.xml index 6f7c071700f..d566ae42bf6 100644 --- a/core-services/egov-url-shortening/pom.xml +++ b/core-services/egov-url-shortening/pom.xml @@ -2,67 +2,39 @@ 4.0.0 org.egov egov-url-shortening - 1.1.2-SNAPSHOT - + 2.9.0-SNAPSHOT + org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 3.2.2 2.17.1 UTF-8 UTF-8 - 1.8 + 17 2.6 - 3.3.9 - src/main/java org.springframework.boot spring-boot-maven-plugin - - - - repackage - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.url.shortening.model.ShortenRequest - - Digit - module - - + + + org.springframework.boot + spring-boot-starter-validation org.springframework.boot @@ -78,11 +50,13 @@ org.egov.services tracer - 2.1.2-SNAPSHOT + 2.9.0-SNAPSHOT + redis.clients jedis + 5.0.0 org.projectlombok @@ -90,22 +64,15 @@ true - org.flywaydb - flyway-core - + org.flywaydb + flyway-core + 9.22.3 + com.fasterxml.jackson.datatype jackson-datatype-jsr310 - - javax.validation - validation-api - - - org.springframework.boot - spring-boot-starter-data-redis - org.springframework.boot spring-boot-starter-jdbc @@ -113,6 +80,7 @@ org.postgresql postgresql + 42.7.1 com.vaadin.external.google diff --git a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/controller/ShortenController.java b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/controller/ShortenController.java index 65167455eba..cd41479f7fb 100644 --- a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/controller/ShortenController.java +++ b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/controller/ShortenController.java @@ -4,10 +4,9 @@ import java.net.URISyntaxException; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.model.CustomException; diff --git a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/model/ShortenRequest.java b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/model/ShortenRequest.java index d36ee6ab7d2..dbd1c711dfe 100644 --- a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/model/ShortenRequest.java +++ b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/model/ShortenRequest.java @@ -1,7 +1,7 @@ package org.egov.url.shortening.model; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; diff --git a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/repository/URLRedisRepository.java b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/repository/URLRedisRepository.java index 458545f09be..b4f8390e577 100644 --- a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/repository/URLRedisRepository.java +++ b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/repository/URLRedisRepository.java @@ -1,24 +1,33 @@ package org.egov.url.shortening.repository; +import jakarta.annotation.PostConstruct; import org.egov.url.shortening.model.ShortenRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Repository; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import redis.clients.jedis.HostAndPort; import redis.clients.jedis.Jedis; @Repository @Order(2) public class URLRedisRepository implements URLRepository { - private final Jedis jedis; - private final String idKey; - private final String urlKey; + private Jedis jedis; + private String idKey; + private String urlKey; private static final Logger LOGGER = LoggerFactory.getLogger(URLRedisRepository.class); + + @Value("${spring.redis.host}") + private String redisHost; + + @Value("${spring.redis.port}") + private String redisPort; @Autowired private ObjectMapper objectMapper; @@ -35,6 +44,12 @@ public URLRedisRepository(Jedis jedis, String idKey, String urlKey) { this.urlKey = urlKey; } + @PostConstruct + private void init() { + HostAndPort hostAndPort = new HostAndPort(redisHost, Integer.valueOf(redisPort)); + this.jedis = new Jedis(hostAndPort); + } + @Override public Long incrementID() { Long id = jedis.incr(idKey); diff --git a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/repository/UrlDBRepository.java b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/repository/UrlDBRepository.java index 9397e931401..5062a0ce32e 100644 --- a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/repository/UrlDBRepository.java +++ b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/repository/UrlDBRepository.java @@ -30,7 +30,8 @@ public UrlDBRepository(JdbcTemplate jdbcTemplate){ @Override public Long incrementID() { String query = "SELECT nextval('eg_url_shorter_id')"; - Long id = jdbcTemplate.queryForObject(query, new Object[] {}, Long.class); + //Long id = jdbcTemplate.queryForObject(query, new Object[] {}, Long.class); + Long id = jdbcTemplate.queryForObject(query, Long.class); log.info("Incrementing ID: {}", id-1); return id - 1; } @@ -62,7 +63,9 @@ public String getUrl(Long id) throws Exception { String query = "SELECT url FROM EG_URL_SHORTENER WHERE id=?"; String strprepStmtArgs = "url:"+id; - String url = jdbcTemplate.queryForObject(query, new Object[] {strprepStmtArgs}, String.class); + //String url = jdbcTemplate.queryForObject(query, new Object[] {strprepStmtArgs}, String.class); + String url = jdbcTemplate.queryForObject(query, String.class, strprepStmtArgs); + log.info("Retrieved {} at {}", url ,id); if (url == null) { throw new Exception("URL at key" + id + " does not exist"); diff --git a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/service/URLConverterService.java b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/service/URLConverterService.java index f67c5aa78d1..da999fc14e3 100644 --- a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/service/URLConverterService.java +++ b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/service/URLConverterService.java @@ -5,7 +5,7 @@ import java.util.Map; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.egov.url.shortening.utils.HashIdConverter; diff --git a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/utils/HashIdConverter.java b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/utils/HashIdConverter.java index ab28cb79eff..84f02392b07 100644 --- a/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/utils/HashIdConverter.java +++ b/core-services/egov-url-shortening/src/main/java/org/egov/url/shortening/utils/HashIdConverter.java @@ -4,7 +4,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; @Component public class HashIdConverter { diff --git a/core-services/egov-url-shortening/src/main/resources/application.properties b/core-services/egov-url-shortening/src/main/resources/application.properties index 2f6c8d11ea7..3772b0425a0 100644 --- a/core-services/egov-url-shortening/src/main/resources/application.properties +++ b/core-services/egov-url-shortening/src/main/resources/application.properties @@ -9,12 +9,12 @@ spring.redis.port=6379 app.timezone=UTC spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/urlshortening +spring.datasource.url=jdbc:postgresql://localhost:5432/devdb spring.datasource.username=postgres spring.datasource.password=postgres #----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/urlshortening +spring.flyway.url=jdbc:postgresql://localhost:5432/devdb spring.flyway.user=postgres spring.flyway.password=postgres spring.flyway.table=public diff --git a/core-services/egov-url-shortening/src/main/resources/db/Dockerfile b/core-services/egov-url-shortening/src/main/resources/db/Dockerfile index a5699ff7d99..f38638a269f 100644 --- a/core-services/egov-url-shortening/src/main/resources/db/Dockerfile +++ b/core-services/egov-url-shortening/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql @@ -6,4 +6,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/repository/URLRedisRepositoryTest.java b/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/repository/URLRedisRepositoryTest.java index 9d21d50c0de..859e0746342 100644 --- a/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/repository/URLRedisRepositoryTest.java +++ b/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/repository/URLRedisRepositoryTest.java @@ -1,65 +1,65 @@ -package org.egov.url.shortening.repository; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.url.shortening.model.ShortenRequest; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import redis.clients.jedis.Jedis; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.*; - -@ContextConfiguration(classes = {URLRedisRepository.class}) -@ExtendWith(SpringExtension.class) -public class URLRedisRepositoryTest { - - @MockBean - private JdbcTemplate jdbcTemplate; - - @MockBean - private ObjectMapper objectMapper; - - @Autowired - private URLRedisRepository uRLRedisRepository; - - @MockBean - private Jedis jedis; - - - @Test - @DisplayName("Should throw an exception when the id does not exist") - public void testGetUrlWhenIdDoesNotExistThenThrowException() { - - when(jedis.hget(anyString(), anyString())).thenReturn(null); - assertThrows(Exception.class, () -> uRLRedisRepository.getUrl(1L)); - } - - - - @Test - @DisplayName("Should throws an exception when the key is already taken") - public void testSaveUrlWhenKeyIsAlreadyTakenThenThrowsException() { - - when(jedis.hget(anyString(), anyString())).thenReturn("{\"url\":\"http://www.google.com\"}"); - assertThrows(Exception.class, () -> uRLRedisRepository.saveUrl("url:1", new ShortenRequest())); - } - - @Test - void IncrementID() { - Jedis jedis = mock(Jedis.class); - when(jedis.incr((String) any())).thenReturn(1L); - assertEquals(0L, - (new URLRedisRepository(jedis, "https://example.org/example", "https://example.org/example")).incrementID() - .longValue()); - verify(jedis).incr((String) any()); - } -} - +//package org.egov.url.shortening.repository; +// +//import com.fasterxml.jackson.core.JsonProcessingException; +//import com.fasterxml.jackson.databind.ObjectMapper; +//import org.egov.url.shortening.model.ShortenRequest; +//import org.junit.jupiter.api.DisplayName; +//import org.junit.jupiter.api.Test; +//import org.junit.jupiter.api.extension.ExtendWith; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.test.mock.mockito.MockBean; +//import org.springframework.jdbc.core.JdbcTemplate; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.junit.jupiter.SpringExtension; +//import redis.clients.jedis.Jedis; +// +//import static org.junit.jupiter.api.Assertions.assertEquals; +//import static org.junit.jupiter.api.Assertions.assertThrows; +//import static org.mockito.Mockito.*; +// +//@ContextConfiguration(classes = {URLRedisRepository.class}) +//@ExtendWith(SpringExtension.class) +//public class URLRedisRepositoryTest { +// +// @MockBean +// private JdbcTemplate jdbcTemplate; +// +// @MockBean +// private ObjectMapper objectMapper; +// +// @Autowired +// private URLRedisRepository uRLRedisRepository; +// +// @MockBean +// private Jedis jedis; +// +// +// @Test +// @DisplayName("Should throw an exception when the id does not exist") +// public void testGetUrlWhenIdDoesNotExistThenThrowException() { +// +// when(jedis.hget(anyString(), anyString())).thenReturn(null); +// assertThrows(Exception.class, () -> uRLRedisRepository.getUrl(1L)); +// } +// +// +// +// @Test +// @DisplayName("Should throws an exception when the key is already taken") +// public void testSaveUrlWhenKeyIsAlreadyTakenThenThrowsException() { +// +// when(jedis.hget(anyString(), anyString())).thenReturn("{\"url\":\"http://www.google.com\"}"); +// assertThrows(Exception.class, () -> uRLRedisRepository.saveUrl("url:1", new ShortenRequest())); +// } +// +// @Test +// void IncrementID() { +// Jedis jedis = mock(Jedis.class); +// when(jedis.incr((String) any())).thenReturn(1L); +// assertEquals(0L, +// (new URLRedisRepository(jedis, "https://example.org/example", "https://example.org/example")).incrementID() +// .longValue()); +// verify(jedis).incr((String) any()); +// } +//} +// diff --git a/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/repository/UrlDBRepositoryTest.java b/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/repository/UrlDBRepositoryTest.java index 3c436bbf25c..386417851fa 100644 --- a/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/repository/UrlDBRepositoryTest.java +++ b/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/repository/UrlDBRepositoryTest.java @@ -1,61 +1,61 @@ -package org.egov.url.shortening.repository; - -import org.egov.url.shortening.model.ShortenRequest; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.*; - -@ContextConfiguration(classes = {UrlDBRepository.class}) -@ExtendWith(SpringExtension.class) -class UrlDBRepositoryTest { - @MockBean - private JdbcTemplate jdbcTemplate; - - @Autowired - private UrlDBRepository urlDBRepository; - - private ShortenRequest shortenRequest; - - @Test - void IncrementID() throws DataAccessException { - when(this.jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1L); - assertEquals(0L, this.urlDBRepository.incrementID().longValue()); - verify(this.jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); - } - - - @Test - void SaveUrl() throws DataAccessException { - when(this.jdbcTemplate.execute((String) any(), - (org.springframework.jdbc.core.PreparedStatementCallback) any())).thenReturn(true); - this.urlDBRepository.saveUrl("https://example.org/example", new ShortenRequest()); - verify(this.jdbcTemplate).execute((String) any(), - (org.springframework.jdbc.core.PreparedStatementCallback) any()); - } - - @Test - void GetUrlsuccess() throws Exception { - when(this.jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())) - .thenReturn("Query For Object"); - assertEquals("Query For Object", this.urlDBRepository.getUrl(123L)); - verify(this.jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); - } - - - @Test - void GetUrlfail() throws Exception { - when(this.jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(null); - assertThrows(Exception.class, () -> this.urlDBRepository.getUrl(123L)); - verify(this.jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); - } -} - +//package org.egov.url.shortening.repository; +// +//import org.egov.url.shortening.model.ShortenRequest; +//import org.junit.jupiter.api.Test; +//import org.junit.jupiter.api.extension.ExtendWith; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.test.mock.mockito.MockBean; +//import org.springframework.dao.DataAccessException; +//import org.springframework.jdbc.core.JdbcTemplate; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.junit.jupiter.SpringExtension; +// +//import static org.junit.jupiter.api.Assertions.assertEquals; +//import static org.junit.jupiter.api.Assertions.assertThrows; +//import static org.mockito.Mockito.*; +// +//@ContextConfiguration(classes = {UrlDBRepository.class}) +//@ExtendWith(SpringExtension.class) +//class UrlDBRepositoryTest { +// @MockBean +// private JdbcTemplate jdbcTemplate; +// +// @Autowired +// private UrlDBRepository urlDBRepository; +// +// private ShortenRequest shortenRequest; +// +// @Test +// void IncrementID() throws DataAccessException { +// when(this.jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1L); +// assertEquals(0L, this.urlDBRepository.incrementID().longValue()); +// verify(this.jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); +// } +// +// +// @Test +// void SaveUrl() throws DataAccessException { +// when(this.jdbcTemplate.execute((String) any(), +// (org.springframework.jdbc.core.PreparedStatementCallback) any())).thenReturn(true); +// this.urlDBRepository.saveUrl("https://example.org/example", new ShortenRequest()); +// verify(this.jdbcTemplate).execute((String) any(), +// (org.springframework.jdbc.core.PreparedStatementCallback) any()); +// } +// +// @Test +// void GetUrlsuccess() throws Exception { +// when(this.jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())) +// .thenReturn("Query For Object"); +// assertEquals("Query For Object", this.urlDBRepository.getUrl(123L)); +// verify(this.jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); +// } +// +// +// @Test +// void GetUrlfail() throws Exception { +// when(this.jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(null); +// assertThrows(Exception.class, () -> this.urlDBRepository.getUrl(123L)); +// verify(this.jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); +// } +//} +// diff --git a/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/service/URLConverterServiceTest.java b/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/service/URLConverterServiceTest.java index e9a2adcec0e..70ed40be3b9 100644 --- a/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/service/URLConverterServiceTest.java +++ b/core-services/egov-url-shortening/src/test/java/org/egov/url/shortening/service/URLConverterServiceTest.java @@ -1,227 +1,226 @@ -package org.egov.url.shortening.service; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.tracer.model.CustomException; -import org.egov.url.shortening.model.ShortenRequest; -import org.egov.url.shortening.producer.Producer; -import org.egov.url.shortening.repository.URLRepository; -import org.egov.url.shortening.utils.HashIdConverter; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; - -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.UUID; - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; - - -@ExtendWith(SpringExtension.class) -public class URLConverterServiceTest { - - @Mock - private URLRepository urlRepository; - - @Mock - private HashIdConverter hashIdConverter; - - @InjectMocks - private URLConverterService uRLConverterService; - - @Mock - private URLConverterService urlConverterService; - - @BeforeEach - public void setUp() { - MockitoAnnotations.initMocks(this); - } - +//package org.egov.url.shortening.service; +// +//import com.fasterxml.jackson.databind.ObjectMapper; +//import org.egov.tracer.model.CustomException; +//import org.egov.url.shortening.model.ShortenRequest; +//import org.egov.url.shortening.producer.Producer; +//import org.egov.url.shortening.repository.URLRepository; +//import org.egov.url.shortening.utils.HashIdConverter; +//import org.junit.jupiter.api.BeforeEach; +//import org.junit.jupiter.api.DisplayName; +//import org.junit.jupiter.api.Test; +//import org.junit.jupiter.api.extension.ExtendWith; +//import org.mockito.InjectMocks; +//import org.mockito.Mock; +//import org.mockito.MockitoAnnotations; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.test.context.SpringBootTest; +//import org.springframework.boot.test.mock.mockito.MockBean; +//import org.springframework.test.context.junit.jupiter.SpringExtension; +//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +//import org.springframework.web.client.RestClientException; +//import org.springframework.web.client.RestTemplate; +// +//import java.net.MalformedURLException; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.UUID; +// +//import static org.junit.jupiter.api.Assertions.*; +//import static org.mockito.Mockito.*; +// +// +//@ExtendWith(SpringExtension.class) +//public class URLConverterServiceTest { +// +// @Mock +// private URLRepository urlRepository; +// +// @Mock +// private HashIdConverter hashIdConverter; +// +// @InjectMocks +// private URLConverterService uRLConverterService; +// +// @Mock +// private URLConverterService urlConverterService; +// +// @BeforeEach +// public void setUp() { +// MockitoAnnotations.initMocks(this); +// } +// +//// @Test +//// @DisplayName("Should return a shortened URL when the url is valid") +//// public void testShortenURLWhenUrlIsValidThenReturnShortenedUrl() { +//// +//// ShortenRequest shortenRequest = ShortenRequest.builder() +//// .url("http://www.google.com") +//// .build(); +//// +//// when(urlRepository.incrementID()).thenReturn(1L); +//// when(hashIdConverter.createHashStringForId(1L)).thenReturn("abc"); +//// +//// String shortenedUrl = urlConverterService.shortenURL(shortenRequest); +//// +//// assertEquals(null, shortenedUrl); +//// } +// +//// @Test +//// @DisplayName("Should throws an exception when the url is invalid") +//// public void testShortenURLWhenUrlIsInvalidThenThrowsException() { +//// +//// ShortenRequest shortenRequest = ShortenRequest.builder() +//// .url("invalid url") +//// .build(); +//// +//// String shortenedUrl = urlConverterService.shortenURL(shortenRequest); +//// assertEquals(null, shortenedUrl); +//// +//// } +// +// @Test +// @DisplayName("Should return the long url when the unique id is valid") +// public void testGetLongURLFromIDWhenUniqueIdIsValidThenReturnLongUrl() throws Exception { +// +// String uniqueID = "uniqueID"; +// String longUrl = "longUrl"; +// when(hashIdConverter.getIdForString(uniqueID)).thenReturn(1L); +// when(urlRepository.getUrl(1L)).thenReturn(longUrl); +// +// String actualLongUrl = uRLConverterService.getLongURLFromID(uniqueID); +// +// assertEquals(longUrl, actualLongUrl); +// } +// +// @Test +// @DisplayName("Should throw an exception when the unique id is invalid") +// public void testGetLongURLFromIDWhenUniqueIdIsInvalidThenThrowException() { +// +// when(hashIdConverter.getIdForString("invalidUniqueId")).thenReturn(null); +// assertThrows(Exception.class, () -> uRLConverterService.getLongURLFromID("invalidUniqueId")); +// } +// +// @Test +// void testGetUserUUIDMapUser() throws RestClientException { +// +// RestTemplate restTemplate = mock(RestTemplate.class); +// when(restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) +// .thenReturn(new HashMap<>()); +// ArrayList urlRepositories = new ArrayList<>(); +// ObjectMapper objectMapper = new ObjectMapper(); +// assertNull( +// (new URLConverterService(urlRepositories, objectMapper, restTemplate, new Producer())).getUserUUID("foo")); +// verify(restTemplate).postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any()); +// } +// // @Test -// @DisplayName("Should return a shortened URL when the url is valid") -// public void testShortenURLWhenUrlIsValidThenReturnShortenedUrl() { +// void testGetUserUUIDNull() throws RestClientException { // -// ShortenRequest shortenRequest = ShortenRequest.builder() -// .url("http://www.google.com") -// .build(); +// RestTemplate restTemplate = mock(RestTemplate.class); +// when(restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) +// .thenReturn(null); +// ArrayList urlRepositories = new ArrayList<>(); +// ObjectMapper objectMapper = new ObjectMapper(); +// assertNull( +// (new URLConverterService(urlRepositories, objectMapper, restTemplate, new Producer())).getUserUUID("foo")); +// verify(restTemplate).postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any()); +// } // -// when(urlRepository.incrementID()).thenReturn(1L); -// when(hashIdConverter.createHashStringForId(1L)).thenReturn("abc"); +// @Test +// void testGetUserUUIDErrorOccur() throws RestClientException { +// RestTemplate restTemplate = mock(RestTemplate.class); +// when(restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) +// .thenThrow(new CustomException("type", "An error occurred")); +// ArrayList urlRepositories = new ArrayList<>(); +// ObjectMapper objectMapper = new ObjectMapper(); +// assertNull( +// (new URLConverterService(urlRepositories, objectMapper, restTemplate, new Producer())).getUserUUID("foo")); +// verify(restTemplate).postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any()); +// } // -// String shortenedUrl = urlConverterService.shortenURL(shortenRequest); +// @Test +// void testGetUserUUIDUserNotFound() throws RestClientException { +// HashMap objectObjectMap = new HashMap<>(); +// objectObjectMap.put("Key", "Value"); +// RestTemplate restTemplate = mock(RestTemplate.class); +// when(restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) +// .thenReturn(objectObjectMap); +// ArrayList urlRepositories = new ArrayList<>(); +// ObjectMapper objectMapper = new ObjectMapper(); +// assertNull( +// (new URLConverterService(urlRepositories, objectMapper, restTemplate, new Producer())).getUserUUID("foo")); +// verify(restTemplate).postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any()); +// } +// +// @Test +// void testIndexData() { +// RestTemplate restTemplate = mock(RestTemplate.class); +// ArrayList urlRepositories = new ArrayList<>(); +// ObjectMapper objectMapper = new ObjectMapper(); // -// assertEquals(null, shortenedUrl); // } - +// // @Test -// @DisplayName("Should throws an exception when the url is invalid") -// public void testShortenURLWhenUrlIsInvalidThenThrowsException() { +// @DisplayName("Should index the data when the channel is whatsapp or sms") +// public void testIndexDataWhenChannelIsWhatsappOrSms() throws Exception { // -// ShortenRequest shortenRequest = ShortenRequest.builder() -// .url("invalid url") -// .build(); +// String longUrl = "http://localhost:8080/url/shorten?channel=whatsapp&mobileNumber=1234567890&tag=billPayment&businessService=PT"; +// String uniqueID = "12345"; +// when(urlRepository.getUrl(anyLong())).thenReturn(longUrl); +// when(hashIdConverter.getIdForString(anyString())).thenReturn(12345L); +// +// } +// +//// @Test +//// @DisplayName("Should not index the data when the channel is not whatsapp or sms") +//// public void testIndexDataWhenChannelIsNotWhatsappOrSms() throws Exception { +//// +//// String longUrl = "http://localhost:8080/url/shorten?channel=web&tag=billPayment&businessService=PT&tenantId=pb.amritsar&consumerCode=123456789"; +//// String uniqueID = "123456789"; +//// when(urlRepository.getUrl(anyLong())).thenReturn(longUrl); +//// when(hashIdConverter.getIdForString(anyString())).thenReturn(123456789L); +//// uRLConverterService.indexData(longUrl, uniqueID); +//// +//// } +// +// @Test +// @DisplayName("Should index the data when the channel is whatsapp or sms") +// public void testIndexDataWhenChannelIsWhatsappOrSms1() throws Exception { +// +// String longUrl = "http://localhost:8080/url/shorten?channel=whatsapp&mobileNumber=1234567890&tag=billPayment&businessService=PT"; +// String uniqueID = "12345"; +// HashMap data = new HashMap(); +// data.put("id", UUID.randomUUID()); +// data.put("timestamp", System.currentTimeMillis()); +// data.put("shortenUrl", "http://localhost:8080/url/12345"); +// data.put("actualUrl", longUrl); +// data.put("user", "12345"); +// data.put("tag", "Property Bill Payment"); +// +// when(hashIdConverter.getIdForString(uniqueID)).thenReturn(1L); +// when(urlRepository.getUrl(1L)).thenReturn(longUrl); // -// String shortenedUrl = urlConverterService.shortenURL(shortenRequest); -// assertEquals(null, shortenedUrl); // // } - - @Test - @DisplayName("Should return the long url when the unique id is valid") - public void testGetLongURLFromIDWhenUniqueIdIsValidThenReturnLongUrl() throws Exception { - - String uniqueID = "uniqueID"; - String longUrl = "longUrl"; - when(hashIdConverter.getIdForString(uniqueID)).thenReturn(1L); - when(urlRepository.getUrl(1L)).thenReturn(longUrl); - - String actualLongUrl = uRLConverterService.getLongURLFromID(uniqueID); - - assertEquals(longUrl, actualLongUrl); - } - - @Test - @DisplayName("Should throw an exception when the unique id is invalid") - public void testGetLongURLFromIDWhenUniqueIdIsInvalidThenThrowException() { - - when(hashIdConverter.getIdForString("invalidUniqueId")).thenReturn(null); - assertThrows(Exception.class, () -> uRLConverterService.getLongURLFromID("invalidUniqueId")); - } - - @Test - void testGetUserUUIDMapUser() throws RestClientException { - - RestTemplate restTemplate = mock(RestTemplate.class); - when(restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) - .thenReturn(new HashMap<>()); - ArrayList urlRepositories = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); - assertNull( - (new URLConverterService(urlRepositories, objectMapper, restTemplate, new Producer())).getUserUUID("foo")); - verify(restTemplate).postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any()); - } - - @Test - void testGetUserUUIDNull() throws RestClientException { - - RestTemplate restTemplate = mock(RestTemplate.class); - when(restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) - .thenReturn(null); - ArrayList urlRepositories = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); - assertNull( - (new URLConverterService(urlRepositories, objectMapper, restTemplate, new Producer())).getUserUUID("foo")); - verify(restTemplate).postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any()); - } - - @Test - void testGetUserUUIDErrorOccur() throws RestClientException { - RestTemplate restTemplate = mock(RestTemplate.class); - when(restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) - .thenThrow(new CustomException("type", "An error occurred")); - ArrayList urlRepositories = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); - assertNull( - (new URLConverterService(urlRepositories, objectMapper, restTemplate, new Producer())).getUserUUID("foo")); - verify(restTemplate).postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any()); - } - - @Test - void testGetUserUUIDUserNotFound() throws RestClientException { - HashMap objectObjectMap = new HashMap<>(); - objectObjectMap.put("Key", "Value"); - RestTemplate restTemplate = mock(RestTemplate.class); - when(restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) - .thenReturn(objectObjectMap); - ArrayList urlRepositories = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); - assertNull( - (new URLConverterService(urlRepositories, objectMapper, restTemplate, new Producer())).getUserUUID("foo")); - verify(restTemplate).postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any()); - } - - @Test - void testIndexData() { - RestTemplate restTemplate = mock(RestTemplate.class); - ArrayList urlRepositories = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); - - } - - @Test - @DisplayName("Should index the data when the channel is whatsapp or sms") - public void testIndexDataWhenChannelIsWhatsappOrSms() throws Exception { - - String longUrl = "http://localhost:8080/url/shorten?channel=whatsapp&mobileNumber=1234567890&tag=billPayment&businessService=PT"; - String uniqueID = "12345"; - when(urlRepository.getUrl(anyLong())).thenReturn(longUrl); - when(hashIdConverter.getIdForString(anyString())).thenReturn(12345L); - - } - +// // @Test // @DisplayName("Should not index the data when the channel is not whatsapp or sms") -// public void testIndexDataWhenChannelIsNotWhatsappOrSms() throws Exception { +// public void testIndexDataWhenChannelIsNotWhatsappOrSms2() throws Exception { // -// String longUrl = "http://localhost:8080/url/shorten?channel=web&tag=billPayment&businessService=PT&tenantId=pb.amritsar&consumerCode=123456789"; -// String uniqueID = "123456789"; +// String longUrl = "http://localhost:8080/url/shorten?channel=email&mobileNumber=1234567890&tag=billPayment&businessService=PT"; +// String uniqueID = "12345"; // when(urlRepository.getUrl(anyLong())).thenReturn(longUrl); -// when(hashIdConverter.getIdForString(anyString())).thenReturn(123456789L); -// uRLConverterService.indexData(longUrl, uniqueID); +// when(hashIdConverter.getIdForString(anyString())).thenReturn(12345L); +// +// } +// +// @Test +// @DisplayName("Should throw an exception when the URL is invalid") +// public void testShortenURLWhenUrlIsInvalidThenThrowException1() { +// ShortenRequest shortenRequest = new ShortenRequest(); +// shortenRequest.setUrl(""); // // } - - @Test - @DisplayName("Should index the data when the channel is whatsapp or sms") - public void testIndexDataWhenChannelIsWhatsappOrSms1() throws Exception { - - String longUrl = "http://localhost:8080/url/shorten?channel=whatsapp&mobileNumber=1234567890&tag=billPayment&businessService=PT"; - String uniqueID = "12345"; - HashMap data = new HashMap(); - data.put("id", UUID.randomUUID()); - data.put("timestamp", System.currentTimeMillis()); - data.put("shortenUrl", "http://localhost:8080/url/12345"); - data.put("actualUrl", longUrl); - data.put("user", "12345"); - data.put("tag", "Property Bill Payment"); - - when(hashIdConverter.getIdForString(uniqueID)).thenReturn(1L); - when(urlRepository.getUrl(1L)).thenReturn(longUrl); - - - } - - @Test - @DisplayName("Should not index the data when the channel is not whatsapp or sms") - public void testIndexDataWhenChannelIsNotWhatsappOrSms2() throws Exception { - - String longUrl = "http://localhost:8080/url/shorten?channel=email&mobileNumber=1234567890&tag=billPayment&businessService=PT"; - String uniqueID = "12345"; - when(urlRepository.getUrl(anyLong())).thenReturn(longUrl); - when(hashIdConverter.getIdForString(anyString())).thenReturn(12345L); - - } - - @Test - @DisplayName("Should throw an exception when the URL is invalid") - public void testShortenURLWhenUrlIsInvalidThenThrowException1() { - ShortenRequest shortenRequest = new ShortenRequest(); - shortenRequest.setUrl(""); - - } -} - +//} +// diff --git a/core-services/egov-user-event/CHANGELOG.md b/core-services/egov-user-event/CHANGELOG.md new file mode 100644 index 00000000000..3de0592bd6f --- /dev/null +++ b/core-services/egov-user-event/CHANGELOG.md @@ -0,0 +1,39 @@ +# Changelog +All notable changes to this module will be documented in this file. + +## 1.2.0-beta - 2022-05-12 + +- Enhanced the search API to support date filter + +## 1.1.4 - 2022-01-13 + +- Updated to log4j2 version 2.17.1 + +## 1.1.4 - 2021-12-15 + +- Enchance the search API to give filtered result for open search request. + + +## 1.1.3 - 2021-05-11 + +- Fixed security issue of untrusted data pass as user input. + +## 1.1.2 - 2021-02-26 + +- Updated domain name in application.properties +- Fixed security issue for throwable statement. + +## 1.1.1 - 2020-10-1 + +- Added Index to achieve performance benefits. + +## 1.1.0 - 2020-06-17 + +- Added typescript definition generation plugin +- Upgraded to `tracer:2.0.0-SNAPSHOT` +- Upgraded to spring boot `2.2.6-RELEASE` +- Upgraded to flyway-core `6.4.3 version` + +## 1.0.0 + +- Base version diff --git a/core-services/egov-user-event/Dockerfile b/core-services/egov-user-event/Dockerfile new file mode 100644 index 00000000000..59da04ad5a6 --- /dev/null +++ b/core-services/egov-user-event/Dockerfile @@ -0,0 +1,20 @@ +FROM egovio/apline-jre:8u121 + +MAINTAINER Senthil + + +# INSTRUCTIONS ON HOW TO BUILD JAR: +# Move to the location where pom.xml is exist in project and build project using below command +# "mvn clean package" +COPY /target/egov-user-event-0.0.1-SNAPSHOT.jar /opt/egov/egov-user-event.jar + +COPY start.sh /usr/bin/start.sh + +RUN chmod +x /usr/bin/start.sh + +CMD ["/usr/bin/start.sh"] + +# NOTE: the two 'RUN' commands can probably be combined inside of a single +# script (i.e. RUN build-and-install-app.sh) so that we can also clean up the +# extra files created during the `mvn package' command. that step inflates the +# resultant image by almost 1.0GB. \ No newline at end of file diff --git a/core-services/egov-user-event/LOCALSETUP.md b/core-services/egov-user-event/LOCALSETUP.md new file mode 100644 index 00000000000..4c543ffd31b --- /dev/null +++ b/core-services/egov-user-event/LOCALSETUP.md @@ -0,0 +1,32 @@ +# Local Setup + +To setup the egov-user-event in your local system, clone the [Muncipal Service repository](https://github.com/egovernments/core-services). + +## Dependencies + +### Infra Dependency + +- [X] Postgres DB +- [ ] Redis +- [X] Elastic search +- [X] Kafka + - [X] Consumer + - [X] Producer + +## Running Locally + +To run the egov-user-event locally, you need to port forward below services locally + +```bash +function kgpt(){kubectl get pods -n egov --selector=app=$1 --no-headers=true | head -n1 | awk '{print $1}'} +kubectl port-forward -n egov $(kgpt egov-localisation) 8084:8080 & +kubectl port-forward -n egov $(kgpt egov-mdms-service) 8085:8080 +``` + +To run the th-services locally, update below listed properties in `application.properties` prior to running the project: + +```ini +egov.mdms.host = http://localhost:8084 +egov.localisation.host = http://localhost:8085 +``` + diff --git a/core-services/egov-user-event/README.md b/core-services/egov-user-event/README.md new file mode 100644 index 00000000000..7f188a1f1ac --- /dev/null +++ b/core-services/egov-user-event/README.md @@ -0,0 +1,64 @@ +# egov-user-event + +The objective of this service is to create a common point to manage all the events generated for the user in the system. +Events include updates from multiple applications like PT, PGR, TL etc, events created by the employee addressing the citizen etc. +This service provides APIs to create , update and search such events for the user. + +### DB UML Diagram + +- TBD + +### Service Dependencies + +- egov-mdms-service +- egov-localization + +### Swagger API Contract + +Link to the swagger API contract yaml and editor link like below + +https://github.com/egovernments/DIGIT-Dev/blob/master/municipal-services/docs/user-events.yml + + +## Service Details + +This service manages user events on the egov-platform, which means all the events about which the user (essentially citizen) has to be notified are stored and retrieved through this service. +Events can be created either by an API call or through pushing records to the Kafka Queue. + +**Configurable Properties:** + +Following are the properties in application.properties file in egov-user-events service which are configurable. + +| Property | Value | Remarks | +| -----------------------------| ---------| ---------------------------| +| `mseva.notif.search.offset` | 0 | Default pagination offset. | +| `mseva.notif.search.limit` | 200 | Default pagination limit. | + + +### API Details + +`/_create` : API to create events in the system. + +`/_update` : API to update events in the system. + +`/_search` : API to search events in the system. + +`/notification/_count` : API to fetch the count of total, unread, read notifications. + +`/lat/_update` : API to update the last-login-time of the user. We store last-login-time of the user through this API thereby deciding which notifications have been read. + + +### Reference Document + +All the details and configurations on the services are explained in the document `https://digit-discuss.atlassian.net/l/c/rMA1ukFc` + +### Kafka Consumers + +`persist-user-events-async` : Topic to which the user-events consumer is subscribed. Producers willing to create events must push records to this topic. +`update-user-events-async` : Topic to which the user-events consumer is subscribed. Producers willing to update events must push records to this topic. + +### Kafka Producers + +`kafka.topics.persister.save.events` : This is the persister topic onto which user-events pushes records for persistence. This is for creating events. +`kafka.topics.persister.update.events` : This is the persister topic onto which user-events pushes records for persistence. This is for updating events. +`kafka.topics.lat.details` : This is the persister topic onto which user-events pushes records for persistence. This is for storing last-access-time / last-login-time of the user. \ No newline at end of file diff --git a/core-services/egov-user-event/pom.xml b/core-services/egov-user-event/pom.xml new file mode 100644 index 00000000000..40e8b2c5d3e --- /dev/null +++ b/core-services/egov-user-event/pom.xml @@ -0,0 +1,192 @@ + + 4.0.0 + org.egov + egov-user-event + jar + egov-user-event + 1.2.0_beta-SNAPSHOT + Service to send out notifications to user based on the events + + + org.springframework.boot + spring-boot-starter-parent + 3.2.2 + + + + + 2.17.1 + UTF-8 + UTF-8 + + 17 + 2.6 + 2.9.6 + ${java.version} + ${java.version} + 3.3.9 + + + + + org.springframework.boot + spring-boot-starter-web + + + + + + + + org.springframework.boot + spring-boot-starter-jdbc + + + + org.flywaydb + flyway-core + 9.22.3 + + + + org.postgresql + postgresql + 42.7.1 + + + + org.egov.services + tracer + 2.9.0-SNAPSHOT + + + + + + + + + + commons-lang + commons-lang + ${commons-lang-version} + + + + org.projectlombok + lombok + + + + org.springframework.boot + spring-boot-devtools + + + + org.springframework + spring-test + test + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.google.code.gson + gson + 2.8.0 + + + + org.egov + mdms-client + 2.9.0-SNAPSHOT + compile + + + + + + + + + org.jsoup + jsoup + 1.10.2 + + + + + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + repo.egovernments.org + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + + + repo.egovernments.org.snapshots + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + cz.habarta.typescript-generator + typescript-generator-maven-plugin + 2.22.595 + + + generate + + generate + + process-classes + + + + jackson2 + + org.egov.userevent.web.contract.Event + org.egov.userevent.web.contract.EventDetails + org.egov.userevent.web.contract.EventRequest + org.egov.userevent.web.contract.EventResponse + org.egov.userevent.web.contract.EventSearchCriteria + org.egov.userevent.web.contract.NotificationCountResponse + org.egov.userevent.web.contract.Recepient + org.egov.userevent.web.contract.ActionItem + org.egov.userevent.web.controller.UserEventsController + org.egov.userevent.web.validator.UserEventsValidator + + + org.egov.userevent.model.enums.Status$StatusEnum:Status + org.egov.userevent.model.enums.Source$SourceEnum:Source + + + org.egov.userevent.web.contract.Action:Action + org.egov.userevent.web.contract.Event:Event + + Digit + true + module + + + + + diff --git a/core-services/egov-user-event/src/main/java/org/egov/UserEventsApp.java b/core-services/egov-user-event/src/main/java/org/egov/UserEventsApp.java new file mode 100644 index 00000000000..0b7ae87dd7e --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/UserEventsApp.java @@ -0,0 +1,84 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov; + +import java.util.TimeZone; + +import jakarta.annotation.PostConstruct; + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@SpringBootApplication +@Import(TracerConfiguration.class) +public class UserEventsApp { + + @Value("${app.timezone}") + private String timeZone; + + @PostConstruct + public void initialize() { + TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); + } + + @Bean + public ObjectMapper getObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + + return mapper; + } + + public static void main(String[] args) { + SpringApplication.run(UserEventsApp.class, args); + } +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/config/PropertiesManager.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/config/PropertiesManager.java new file mode 100644 index 00000000000..a43c10b28bd --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/config/PropertiesManager.java @@ -0,0 +1,97 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.empernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@empernments.org. + */ + +package org.egov.userevent.config; + +import lombok.*; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class PropertiesManager { + + //Hosts and Endpoints + @Value("${egov.mdms.host}") + public String mdmsHost; + + @Value("${egov.mdms.search.endpoint}") + public String mdmsSearchEndpoint; + + @Value("${egov.localisation.host}") + public String localisationHost; + + @Value("${egov.localisation.search.endpoint}") + public String localisationSearchEndpoint; + + + + + //Kafka Topics + @Value("${kafka.topics.persister.save.events}") + public String saveEventsPersisterTopic; + + @Value("${kafka.topics.persister.update.events}") + public String updateEventsPersisterTopic; + + @Value("${kafka.topics.lat.details}") + public String latDetailsTopic; + + @Value("${kafka.topics.save.events}") + public String saveEventsTopic; + + @Value("${kafka.topics.update.events}") + public String updateEventsTopic; + + + //Variables + @Value("${mseva.notif.search.offset}") + public Long defaultOffset; + + @Value("${mseva.notif.search.limit}") + public Long defaultLimit; + + @Value("${egov.localisation.is.statelevel}") + public Boolean isLocalizationStateLevel; +} \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/consumer/UserEventsConsumer.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/consumer/UserEventsConsumer.java new file mode 100644 index 00000000000..f74f3066692 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/consumer/UserEventsConsumer.java @@ -0,0 +1,53 @@ +package org.egov.userevent.consumer; + +import java.util.HashMap; + +import org.egov.userevent.config.PropertiesManager; +import org.egov.userevent.service.UserEventsService; +import org.egov.userevent.web.contract.EventRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.kafka.support.KafkaHeaders; +import org.springframework.messaging.handler.annotation.Header; +import org.springframework.stereotype.Service; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import lombok.extern.slf4j.Slf4j; + +@Service +@Slf4j +public class UserEventsConsumer { + + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private UserEventsService service; + + @Autowired + private PropertiesManager props; + + + /** + * Kafka consumer + * + * @param record + * @param topic + */ + @KafkaListener(topics = { "${kafka.topics.save.events}", "${kafka.topics.update.events}" }) + public void listen(HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { + try { + EventRequest eventReq = objectMapper.convertValue(record, EventRequest.class); + if(topic.contains(props.getSaveEventsTopic())) { + service.createEvents(eventReq, false); + }else if(topic.contains(props.getUpdateEventsTopic())) { + service.updateEvents(eventReq); + } + }catch(Exception e) { + log.error("Exception while reading from the queue: ", e); + } + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/model/AuditDetails.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/AuditDetails.java new file mode 100644 index 00000000000..39d3e5d8b90 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/AuditDetails.java @@ -0,0 +1,26 @@ +package org.egov.userevent.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + + +@AllArgsConstructor +@Builder +@Getter +@NoArgsConstructor +@Setter +@ToString +public class AuditDetails { + + private String createdBy; + + private Long createdTime; + + private String lastModifiedBy; + + private Long lastModifiedTime; +} \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/model/Document.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/Document.java new file mode 100644 index 00000000000..c5821926533 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/Document.java @@ -0,0 +1,42 @@ +package org.egov.userevent.model; + +import java.util.List; + +import org.egov.userevent.model.enums.Source; +import org.egov.userevent.model.enums.Status; +import org.egov.userevent.web.contract.Action; +import org.egov.userevent.web.contract.Event; +import org.egov.userevent.web.contract.EventDetails; +import org.egov.userevent.web.contract.Recepient; +import org.egov.userevent.web.contract.Event.EventBuilder; +import org.egov.tracer.annotations.CustomSafeHtml; +import org.springframework.validation.annotation.Validated; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class Document { + + @CustomSafeHtml + private String documentType; + + @CustomSafeHtml + private String fileName; + + @CustomSafeHtml + private String fileStoreId; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/model/LATWrapper.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/LATWrapper.java new file mode 100644 index 00000000000..59dddb9a746 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/LATWrapper.java @@ -0,0 +1,25 @@ +package org.egov.userevent.model; + +import org.springframework.validation.annotation.Validated; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class LATWrapper { + + private LastAccesDetails lastAccessDetails; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/model/LastAccesDetails.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/LastAccesDetails.java new file mode 100644 index 00000000000..e91c9db2b39 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/LastAccesDetails.java @@ -0,0 +1,27 @@ +package org.egov.userevent.model; + +import org.springframework.validation.annotation.Validated; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class LastAccesDetails { + + private String userId; + + private Long lastAccessTime; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/model/RecepientEvent.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/RecepientEvent.java new file mode 100644 index 00000000000..a084df6ab28 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/RecepientEvent.java @@ -0,0 +1,30 @@ +package org.egov.userevent.model; + +import org.egov.tracer.annotations.CustomSafeHtml; +import org.springframework.validation.annotation.Validated; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class RecepientEvent { + + @CustomSafeHtml + private String recepient; + + @CustomSafeHtml + private String eventId; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/model/RequestInfoWrapper.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/RequestInfoWrapper.java new file mode 100644 index 00000000000..c630641d8b0 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/RequestInfoWrapper.java @@ -0,0 +1,27 @@ +package org.egov.userevent.model; + +import org.egov.common.contract.request.RequestInfo; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + + +@Getter +@Setter +@ToString +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class RequestInfoWrapper { + + @JsonProperty("RequestInfo") + public RequestInfo requestInfo; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/model/enums/Source.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/enums/Source.java new file mode 100644 index 00000000000..529cee51d14 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/enums/Source.java @@ -0,0 +1,31 @@ +package org.egov.userevent.model.enums; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public enum Source { + WEBAPP("WEBAPP"), MOBILEAPP("MOBILEAPP"); + + private String value; + + Source(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return name(); + } + + @JsonCreator + public static Source fromValue(String passedValue) { + for (Source obj : Source.values()) { + if (String.valueOf(obj.value).equals(passedValue.toUpperCase())) { + return obj; + } + } + return null; + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/model/enums/Status.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/enums/Status.java new file mode 100644 index 00000000000..87cd892f13d --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/model/enums/Status.java @@ -0,0 +1,70 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov.userevent.model.enums; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public enum Status { + ACTIVE("ACTIVE"), INACTIVE("INACTIVE"), CANCELLED("CANCELLED"); + + private String value; + + Status(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return name(); + } + + @JsonCreator + public static Status fromValue(String passedValue) { + for (Status obj : Status.values()) { + if (String.valueOf(obj.value).equals(passedValue.toUpperCase())) { + return obj; + } + } + return null; + } +} \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/producer/UserEventsProducer.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/producer/UserEventsProducer.java new file mode 100644 index 00000000000..d61359e70a4 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/producer/UserEventsProducer.java @@ -0,0 +1,25 @@ +package org.egov.userevent.producer; + +import lombok.extern.slf4j.Slf4j; +import org.egov.tracer.kafka.CustomKafkaTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class UserEventsProducer { + + @Autowired + private CustomKafkaTemplate kafkaTemplate; + + /** + * Kafka Producer. + * + * @param topic + * @param value + */ + public void push(String topic, Object value) { + log.info("Topic: "+topic); + kafkaTemplate.send(topic, value); + } +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/RestCallRepository.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/RestCallRepository.java new file mode 100644 index 00000000000..d8d0f0af16c --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/RestCallRepository.java @@ -0,0 +1,48 @@ +package org.egov.userevent.repository; + +import java.util.Map; +import java.util.Optional; + +import org.egov.tracer.model.ServiceCallException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +import lombok.extern.slf4j.Slf4j; + +@Repository +@Slf4j +public class RestCallRepository { + + @Autowired + private RestTemplate restTemplate; + + /** + * Fetches results from a REST service using the uri and object + * + * @param requestInfo + * @param serviceReqSearchCriteria + * @return Optional + * @author vishal + */ + public Optional fetchResult(StringBuilder uri, Object request) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + Object response = null; + try { + response = restTemplate.postForObject(uri.toString(), request, Map.class); + }catch(HttpClientErrorException e) { + log.error("External Service threw an Exception: ",e); + throw new ServiceCallException(e.getResponseBodyAsString()); + }catch(Exception e) { + log.error("Exception while fetching data: ",e); + } + return Optional.ofNullable(response); + + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/UserEventRepository.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/UserEventRepository.java new file mode 100644 index 00000000000..1ad1ad83683 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/UserEventRepository.java @@ -0,0 +1,97 @@ +package org.egov.userevent.repository; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.egov.userevent.repository.querybuilder.UserEventsQueryBuilder; +import org.egov.userevent.repository.rowmappers.UserEventRowMapper; +import org.egov.userevent.repository.rowmappers.NotificationCountRowMapper; +import org.egov.userevent.web.contract.Event; +import org.egov.userevent.web.contract.EventSearchCriteria; +import org.egov.userevent.web.contract.NotificationCountResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.stereotype.Repository; + +import lombok.extern.slf4j.Slf4j; + +@Repository +@Slf4j +public class UserEventRepository { + + @Autowired + private UserEventsQueryBuilder queryBuilder; + + @Autowired + private UserEventRowMapper rowMapper; + + @Autowired + private NotificationCountRowMapper countRowMapper; + + @Autowired + private NamedParameterJdbcTemplate namedParameterJdbcTemplate; + + /** + * Repository method to fetch events + * + * @param criteria + * @return + */ + public List fetchEvents(EventSearchCriteria criteria){ + Map preparedStatementValues = new HashMap<>(); + String query = queryBuilder.getSearchQuery(criteria, preparedStatementValues); + log.info("Query: "+query); + log.info("Search preparedStatementValues: "+preparedStatementValues.toString()); + List events = new ArrayList<>(); + try { + events = namedParameterJdbcTemplate.query(query, preparedStatementValues, rowMapper); + }catch(Exception e) { + log.error("Error while fetching results from db: ", e); + } + + return events; + } + + /** + * Repository method to fetch count of events + * + * @param criteria + * @return + */ + public NotificationCountResponse fetchCount(EventSearchCriteria criteria){ + Map preparedStatementValues = new HashMap<>(); + String insertQuery = queryBuilder.getInserIfNotExistsQuery(criteria, preparedStatementValues); + String query = queryBuilder.getCountQuery(criteria, preparedStatementValues); + log.info("Query: "+query); + log.info("Notification count preparedStatementValues: "+preparedStatementValues.toString()); + NotificationCountResponse response = null; + try { + namedParameterJdbcTemplate.update(insertQuery, preparedStatementValues); + response = namedParameterJdbcTemplate.query(query, preparedStatementValues, countRowMapper); + }catch(Exception e) { + log.error("Error while fetching count from db: ", e); + } + return response; + } + + + public Integer fetchTotalEventCount(EventSearchCriteria criteria) { + Map preparedStatementValues = new HashMap<>(); + criteria.setIsEventsCountCall(Boolean.TRUE); + String query = queryBuilder.getSearchQuery(criteria, preparedStatementValues); + query = queryBuilder.addCountWrapper(query); + criteria.setIsEventsCountCall(Boolean.FALSE); + log.info("Count Query: " + query); + log.info("Count preparedStatementValues: "+preparedStatementValues.toString()); + Integer totalCount = 0; + try { + totalCount = namedParameterJdbcTemplate.queryForObject(query, preparedStatementValues, Integer.class); + }catch(Exception e) { + log.error("Error while fetching total event count from db: ", e); + } + + return totalCount; + } +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/querybuilder/UserEventsQueryBuilder.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/querybuilder/UserEventsQueryBuilder.java new file mode 100644 index 00000000000..b1f4dad240c --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/querybuilder/UserEventsQueryBuilder.java @@ -0,0 +1,240 @@ +package org.egov.userevent.repository.querybuilder; + +import java.time.Instant; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.egov.tracer.model.CustomException; +import org.egov.userevent.config.PropertiesManager; +import org.egov.userevent.model.enums.Status; +import org.egov.userevent.web.contract.EventSearchCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.egov.userevent.model.enums.Status; + +@Component +public class UserEventsQueryBuilder { + + @Autowired + private PropertiesManager properties; + + public static final String EVENT_COUNT_WRAPPER = " SELECT COUNT(id) FROM ({INTERNAL_QUERY}) AS count "; + + public static final String EVENT_SEARCH_QUERY = "SELECT id, tenantid, source, eventtype, category, description, status, referenceid, name, postedby," + + " eventdetails, actions, recepient, createdby, createdtime, lastmodifiedby, lastmodifiedtime FROM eg_usrevents_events "; + + public static final String EVENT_INNER_SEARCH_QUERY = "id IN (SELECT eventid FROM eg_usrevents_recepnt_event_registry WHERE "; + + public static final String INSERT_USERLAT_IFNOT_EXISTS = "INSERT INTO eg_usrevents_user_lat VALUES (:userid, 0) ON CONFLICT DO NOTHING"; + + public static final String COUNT_OF_NOTIFICATION_QUERY = "SELECT (SELECT COUNT(*) as total FROM eg_usrevents_events WHERE id IN (SELECT eventid FROM eg_usrevents_recepnt_event_registry WHERE recepient IN (:recepients))), " + + "COUNT(*) as unread FROM eg_usrevents_events WHERE id IN (SELECT eventid FROM eg_usrevents_recepnt_event_registry WHERE recepient IN (:recepients)) " + + "AND id NOT IN (SELECT referenceid FROM eg_usrevents_events WHERE referenceid NOTNULL) AND " + + "lastmodifiedtime > (SELECT lastaccesstime FROM eg_usrevents_user_lat WHERE userid IN (:userid))"; + + /** + * Returns query for search events + * + * @param criteria + * @param preparedStatementValues + * @return + */ + public String getSearchQuery(EventSearchCriteria criteria, Map preparedStatementValues) { + String query = EVENT_SEARCH_QUERY; + return addWhereClause(query, criteria, preparedStatementValues); + } + + + /** + * Returns query for inserting user-lat value in the table. + * + * @param criteria + * @param preparedStatementValues + * @return + */ + public String getInserIfNotExistsQuery(EventSearchCriteria criteria, Map preparedStatementValues) { + String query = INSERT_USERLAT_IFNOT_EXISTS; + preparedStatementValues.put("userid", criteria.getUserids().get(0)); //will always have one user. + + return query; + + } + /** + * Returns query for count of events + * + * @param criteria + * @param preparedStatementValues + * @return + */ + public String getCountQuery(EventSearchCriteria criteria, Map preparedStatementValues) { + String query = COUNT_OF_NOTIFICATION_QUERY; + return addWhereClauseForCountQuery(query, criteria, preparedStatementValues); + } + + /** + * Appends where clause to the query. + * + * @param query + * @param criteria + * @param preparedStatementValues + * @return + */ + private String addWhereClauseForCountQuery(String query, EventSearchCriteria criteria, Map preparedStatementValues) { + StringBuilder queryBuilder = new StringBuilder(); + queryBuilder.append(query); + preparedStatementValues.put("recepients", criteria.getRecepients()); + preparedStatementValues.put("userid", criteria.getUserids()); + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append(" status IN (:status)"); + if(!CollectionUtils.isEmpty(criteria.getStatus())) + preparedStatementValues.put("status", criteria.getStatus()); + + else + preparedStatementValues.put("status", "ACTIVE"); + + + if (criteria.getFromDate() != null) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + + //If user does not specify toDate, take today's date as toDate by default. + if (criteria.getToDate() == null) { + criteria.setToDate(Instant.now().toEpochMilli()); + } + + queryBuilder.append(" lastmodifiedtime BETWEEN :fromdate AND :todate"); + preparedStatementValues.put("fromdate",criteria.getFromDate()); + preparedStatementValues.put("todate",criteria.getToDate()); + + } else { + //if only toDate is provided as parameter without fromDate parameter + if (criteria.getToDate() != null) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append(" lastmodifiedtime <= :todate"); + preparedStatementValues.put("todate",criteria.getToDate()); + } + } + + return queryBuilder.toString(); + + } + + /** + * Builds the where clause for the query based on the criteria. + * + * @param query + * @param criteria + * @param preparedStatementValues + * @return + */ + private String addWhereClause(String query, EventSearchCriteria criteria, Map preparedStatementValues) { + StringBuilder queryBuilder = new StringBuilder(); + queryBuilder.append(query); + if(!CollectionUtils.isEmpty(criteria.getIds())) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append("id IN (:id)"); + preparedStatementValues.put("id", criteria.getIds()); + } + if(!CollectionUtils.isEmpty(criteria.getStatus())) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append("status IN (:status)"); + preparedStatementValues.put("status", criteria.getStatus()); + } + + if (criteria.getFromDate() != null) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + + //If user does not specify toDate, take today's date as toDate by default. + if (criteria.getToDate() == null) { + criteria.setToDate(Instant.now().toEpochMilli()); + } + + queryBuilder.append(" lastmodifiedtime BETWEEN :fromdate AND :todate"); + preparedStatementValues.put("fromdate",criteria.getFromDate()); + preparedStatementValues.put("todate",criteria.getToDate()); + + } else { + //if only toDate is provided as parameter without fromDate parameter, throw an exception. + if (criteria.getToDate() != null) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append(" lastmodifiedtime <= :todate"); + preparedStatementValues.put("todate",criteria.getToDate()); + } + } + if(!CollectionUtils.isEmpty(criteria.getSource())) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append("source IN (:source)"); + preparedStatementValues.put("source", criteria.getSource()); + } + + if(!CollectionUtils.isEmpty(criteria.getPostedBy())) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append("postedby IN (:postedby)"); + preparedStatementValues.put("postedby", criteria.getPostedBy()); + } + + if(!CollectionUtils.isEmpty(criteria.getEventTypes())) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append("eventtype IN (:eventtype)"); + preparedStatementValues.put("eventtype", criteria.getEventTypes()); + } + + if(!CollectionUtils.isEmpty(criteria.getName())) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append("name IN (:name)"); + preparedStatementValues.put("name", criteria.getName()); + } + + if(!CollectionUtils.isEmpty(criteria.getReferenceIds())) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append("referenceid IN (:referenceid)"); + preparedStatementValues.put("referenceid", criteria.getReferenceIds()); + } + + if(null != criteria.getIsCitizenSearch()) { + if(!criteria.getIsCitizenSearch()) { + if(!StringUtils.isEmpty(criteria.getTenantId())) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append("tenantid = :tenantid"); + preparedStatementValues.put("tenantid", criteria.getTenantId()); + + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append("referenceid IS NULL"); //counter events shouldn't be returned in employee search. + } + } + + } + + if(!CollectionUtils.isEmpty(criteria.getRecepients())) { + addClauseIfRequired(preparedStatementValues, queryBuilder); + queryBuilder.append(EVENT_INNER_SEARCH_QUERY); + queryBuilder.append("recepient IN (:recepients)"); + preparedStatementValues.put("recepients", criteria.getRecepients()); + queryBuilder.append(" )"); + } + + queryBuilder.append(" ORDER BY createdtime DESC"); //default ordering on the platform. + // Do NOT paginate in case of building count query + if(!criteria.getIsEventsCountCall()) { + queryBuilder.append(" OFFSET :offset"); + preparedStatementValues.put("offset", null == criteria.getOffset() ? properties.getDefaultOffset() : criteria.getOffset()); + queryBuilder.append(" LIMIT :limit"); + preparedStatementValues.put("limit", null == criteria.getLimit() ? properties.getDefaultLimit() : criteria.getLimit()); + } + + return queryBuilder.toString(); + + } + + private static void addClauseIfRequired(Map values, StringBuilder queryString) { + if (values.isEmpty()) + queryString.append(" WHERE "); + else { + queryString.append(" AND "); + } + } + + public String addCountWrapper(String query) { + return EVENT_COUNT_WRAPPER.replace("{INTERNAL_QUERY}", query); + } +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/rowmappers/NotificationCountRowMapper.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/rowmappers/NotificationCountRowMapper.java new file mode 100644 index 00000000000..452fa057b7b --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/rowmappers/NotificationCountRowMapper.java @@ -0,0 +1,26 @@ +package org.egov.userevent.repository.rowmappers; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.egov.userevent.web.contract.NotificationCountResponse; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Service; + +@Service +public class NotificationCountRowMapper implements ResultSetExtractor { + + @Override + public NotificationCountResponse extractData(ResultSet rs) throws SQLException, DataAccessException { + NotificationCountResponse response = null; + while(rs.next()) { + response = NotificationCountResponse.builder() + .totalCount(rs.getLong("total")) + .unreadCount(rs.getLong("unread")).build(); + } + return response; + } + + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/rowmappers/UserEventRowMapper.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/rowmappers/UserEventRowMapper.java new file mode 100644 index 00000000000..b1dc8affe85 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/repository/rowmappers/UserEventRowMapper.java @@ -0,0 +1,94 @@ +package org.egov.userevent.repository.rowmappers; + +import java.lang.reflect.Type; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.egov.userevent.model.AuditDetails; +import org.egov.userevent.model.enums.Source; +import org.egov.userevent.model.enums.Status; +import org.egov.userevent.web.contract.Action; +import org.egov.userevent.web.contract.Event; +import org.egov.userevent.web.contract.EventDetails; +import org.egov.userevent.web.contract.Recepient; +import org.postgresql.util.PGobject; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Service; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import lombok.extern.slf4j.Slf4j; + +@Service +@Slf4j +public class UserEventRowMapper implements ResultSetExtractor > { + + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + List events = new ArrayList<>(); + while(resultSet.next()) { + Event event = Event.builder() + .id(resultSet.getString("id")) + .tenantId(resultSet.getString("tenantid")) + .eventType(resultSet.getString("eventtype")) + .eventCategory(resultSet.getString("category")) + .source(Source.valueOf(resultSet.getString("source"))) + .description(resultSet.getString("description")) + .name(resultSet.getString("name")) + .referenceId(resultSet.getString("referenceid")) + .postedBy(resultSet.getString("postedby")) + .status(Status.valueOf(resultSet.getString("status"))).build(); + try { + PGobject obj = (PGobject) resultSet.getObject("eventdetails"); + if(null != obj) { + if(!obj.getValue().equalsIgnoreCase("null")) { + Type type = new TypeToken() {}.getType(); + Gson gson = new Gson(); + EventDetails data = gson.fromJson(obj.getValue(), type); + event.setEventDetails(data); + } + } + + obj = (PGobject) resultSet.getObject("actions"); + if(null != obj) { + if(!obj.getValue().equalsIgnoreCase("null")) { + Type type = new TypeToken() {}.getType(); + Gson gson = new Gson(); + Action data = gson.fromJson(obj.getValue(), type); + event.setActions(data); + } + } + + obj = (PGobject) resultSet.getObject("recepient"); + if(null != obj) { + if(!obj.getValue().equalsIgnoreCase("null")) { + Type type = new TypeToken() {}.getType(); + Gson gson = new Gson(); + Recepient data = gson.fromJson(obj.getValue(), type); + event.setRecepient(data); + } + } + + }catch(Exception e) { + log.error("Error while adding jsonb fields: ", e); + continue; + } + AuditDetails audit = AuditDetails.builder() + .createdBy(resultSet.getString("createdby")) + .createdTime(resultSet.getLong("createdtime")) + .lastModifiedBy(resultSet.getString("lastmodifiedby")) + .lastModifiedTime(resultSet.getLong("lastmodifiedtime")).build(); + + event.setAuditDetails(audit); + + events.add(event); + } + + return events; + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/service/LocalizationService.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/service/LocalizationService.java new file mode 100644 index 00000000000..ddc26bc0e15 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/service/LocalizationService.java @@ -0,0 +1,70 @@ +package org.egov.userevent.service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.egov.common.contract.request.RequestInfo; +import org.egov.userevent.config.PropertiesManager; +import org.egov.userevent.repository.RestCallRepository; +import org.egov.userevent.utils.UserEventsConstants; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import com.jayway.jsonpath.JsonPath; + +import lombok.extern.slf4j.Slf4j; + +@Service +@Slf4j +public class LocalizationService { + + @Autowired + private RestCallRepository repository; + + @Autowired + private PropertiesManager props; + + /** + * Populates the localized msg cache + * + * @param requestInfo + * @param tenantId + * @param locale + * @param module + */ + public Map getLocalisedMessages(RequestInfo requestInfo, String tenantId, String locale, String module) { + Map mapOfCodesAndMessages = new HashMap<>(); + StringBuilder uri = new StringBuilder(); + Map request = new HashMap<>(); + request.put("RequestInfo", requestInfo); + uri.append(props.getLocalisationHost()).append(props.getLocalisationSearchEndpoint()) + .append("?tenantId=" + tenantId).append("&module=" + module).append("&locale=" + locale); + List codes = null; + List messages = null; + Optional response = repository.fetchResult(uri, request); + try { + if (response.isPresent()) { + codes = JsonPath.read(response.get(), UserEventsConstants.LOCALIZATION_CODES_JSONPATH); + messages = JsonPath.read(response.get(), UserEventsConstants.LOCALIZATION_MSGS_JSONPATH); + } + } catch (Exception e) { + log.error("Exception while fetching from localization: " + e); + } + if (!CollectionUtils.isEmpty(codes) && !CollectionUtils.isEmpty(messages)) { + for (int i = 0; i < codes.size(); i++) { + mapOfCodesAndMessages.put(codes.get(i), messages.get(i)); + } + } else { + mapOfCodesAndMessages.put(UserEventsConstants.LOCALIZATION_COUNTEREVENT_ONDELETE_CODE, + UserEventsConstants.LOCALIZATION_COUNTEREVENT_ONDELETE_DEF_MSG); + mapOfCodesAndMessages.put(UserEventsConstants.LOCALIZATION_COUNTEREVENT_ONUPDATE_CODE, + UserEventsConstants.LOCALIZATION_COUNTEREVENT_ONUPDATE_DEF_MSG); + } + + return mapOfCodesAndMessages; + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/service/MDMSService.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/service/MDMSService.java new file mode 100644 index 00000000000..c306151386f --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/service/MDMSService.java @@ -0,0 +1,91 @@ +package org.egov.userevent.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.egov.common.contract.request.RequestInfo; +import org.egov.mdms.model.MasterDetail; +import org.egov.mdms.model.MdmsCriteria; +import org.egov.mdms.model.MdmsCriteriaReq; +import org.egov.mdms.model.ModuleDetail; +import org.egov.userevent.config.PropertiesManager; +import org.egov.userevent.repository.RestCallRepository; +import org.egov.userevent.utils.ErrorConstants; +import org.egov.userevent.utils.UserEventsConstants; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.jayway.jsonpath.JsonPath; + +import lombok.extern.slf4j.Slf4j; + +@Service +@Slf4j +public class MDMSService { + + @Autowired + private RestCallRepository repository; + + @Autowired + private PropertiesManager props; + + + /** + * Method to fetch event types from MDMS + * + * @param requestInfo + * @param tenantId + * @return + */ + public Map> fetchEventMasters(RequestInfo requestInfo, String tenantId) { + StringBuilder uri = new StringBuilder(); + Map> eventMasters = new HashMap<>(); + uri.append(props.getMdmsHost()).append(props.getMdmsSearchEndpoint()); + Optional response = repository.fetchResult(uri, getRequestForEvents(requestInfo, tenantId)); + List codes = new ArrayList<>(); + try { + if(response.isPresent()) { + codes = JsonPath.read(response.get(), UserEventsConstants.MEN_MDMS_EVENTMASTER_CODES_JSONPATH); + eventMasters.put(UserEventsConstants.MEN_MDMS_EVENTMASTER_CODE, codes); + codes = JsonPath.read(response.get(), UserEventsConstants.MEN_MDMS_EVENTCATEGORY_MASTER_CODES_JSONPATH); + eventMasters.put(UserEventsConstants.MEN_MDMS_EVENTCATEGORY_MASTER_CODE, codes); + } + else + throw new Exception(); + }catch(Exception e) { + throw new CustomException(ErrorConstants.MEN_ERROR_FROM_MDMS_CODE, ErrorConstants.MEN_ERROR_FROM_MDMS_MSG); + } + return eventMasters; + } + + /** + * Method to build the body for MDMS request + * + * @param requestInfo + * @param tenantId + * @return + */ + private MdmsCriteriaReq getRequestForEvents(RequestInfo requestInfo, String tenantId) { + List masterDetails = new ArrayList<>(); + MasterDetail masterDetail = org.egov.mdms.model.MasterDetail.builder() + .name(UserEventsConstants.MEN_MDMS_EVENTMASTER_CODE) + .filter(UserEventsConstants.MEN_MDMS_EVENTMASTER_FILTER).build(); + masterDetails.add(masterDetail); + masterDetail = org.egov.mdms.model.MasterDetail.builder() + .name(UserEventsConstants.MEN_MDMS_EVENTCATEGORY_MASTER_CODE) + .filter(UserEventsConstants.MEN_MDMS_EVENTCATEGORY_MASTER_FILTER).build(); + masterDetails.add(masterDetail); + ModuleDetail moduleDetail = ModuleDetail.builder().moduleName(UserEventsConstants.MEN_MDMS_MODULE_CODE) + .masterDetails(masterDetails).build(); + List moduleDetails = new ArrayList<>(); + moduleDetails.add(moduleDetail); + tenantId = tenantId.split("\\.")[0]; //state-level master + MdmsCriteria mdmsCriteria = MdmsCriteria.builder().tenantId(tenantId).moduleDetails(moduleDetails).build(); + return MdmsCriteriaReq.builder().requestInfo(requestInfo).mdmsCriteria(mdmsCriteria).build(); + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/service/UserEventsService.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/service/UserEventsService.java new file mode 100644 index 00000000000..70192cced96 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/service/UserEventsService.java @@ -0,0 +1,627 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov.userevent.service; + +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.Role; +import org.egov.common.contract.response.ResponseInfo; +import org.egov.tracer.model.CustomException; +import org.egov.userevent.config.PropertiesManager; +import org.egov.userevent.model.AuditDetails; +import org.egov.userevent.model.LATWrapper; +import org.egov.userevent.model.LastAccesDetails; +import org.egov.userevent.model.RecepientEvent; +import org.egov.userevent.model.enums.Status; +import org.egov.userevent.producer.UserEventsProducer; +import org.egov.userevent.repository.UserEventRepository; +import org.egov.userevent.utils.ErrorConstants; +import org.egov.userevent.utils.ResponseInfoFactory; +import org.egov.userevent.utils.UserEventsConstants; +import org.egov.userevent.utils.UserEventsUtils; +import org.egov.userevent.web.contract.Event; +import org.egov.userevent.web.contract.EventRequest; +import org.egov.userevent.web.contract.EventResponse; +import org.egov.userevent.web.contract.EventSearchCriteria; +import org.egov.userevent.web.contract.NotificationCountResponse; +import org.egov.userevent.web.validator.UserEventsValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import lombok.Data; +import lombok.extern.slf4j.Slf4j; + +@Data +@Slf4j +@Service +public class UserEventsService { + + @Autowired + private PropertiesManager properties; + + @Autowired + private UserEventsProducer producer; + + @Autowired + private ResponseInfoFactory responseInfo; + + @Autowired + private UserEventsValidator validator; + + @Autowired + private UserEventRepository repository; + + @Autowired + private UserEventsUtils utils; + + @Autowired + private LocalizationService localizationService; + + /** + * Service method to create events Enriches the request and produces it on the + * queue for persister to pick. + * + * @param request + * @return + */ + public EventResponse createEvents(EventRequest request, Boolean isCounterEvent) { + if (!isCounterEvent) + validator.validateCreateEvent(request, true); + log.info("enriching and storing the event......"); + enrichCreateEvent(request); + producer.push(properties.getSaveEventsPersisterTopic(), request); + request.getEvents().forEach(event -> event.setRecepientEventMap(null)); + return EventResponse.builder() + .responseInfo(responseInfo.createResponseInfoFromRequestInfo(request.getRequestInfo(), true)) + .events(request.getEvents()).build(); + } + + /** + * Service method to update the events. Enriches the request and produces it on + * the queue for persister to pick. This method also creates counter events the + * following scenario: 1. When an ACTIVE event is made INACTIVE or CANCELLED. + * (Counter event on delete) 2. When details an event irrespective of what + * status does it have, are updated. (Counter event on update) + * + * @param request + * @return + */ + public EventResponse updateEvents(EventRequest request) { + validateUpdateEvent(request); + log.info("enriching and updating the event......"); + enrichUpdateEvent(request); + List counterEvents = new ArrayList<>(); + request.getEvents().forEach(event -> { + Boolean isCounterEventReq = true; + if (event.getEventType().equals(UserEventsConstants.MEN_MDMS_EVENTSONGROUND_CODE) + && (null == event.getGenerateCounterEvent() || event.getGenerateCounterEvent())) { + Event counterEvent = buildCounterEvents(request.getRequestInfo(), event, isCounterEventReq); + if (null != counterEvent) { + counterEvents.add(counterEvent); + } + } + }); + if (!CollectionUtils.isEmpty(counterEvents)) { + EventRequest req = EventRequest.builder().requestInfo(request.getRequestInfo()).events(counterEvents) + .build(); + log.info("Generating counter events....."); + createEvents(req, true); + } + producer.push(properties.getUpdateEventsPersisterTopic(), request); + request.getEvents().forEach(event -> { + event.setRecepientEventMap(null); + event.setGenerateCounterEvent(null); + }); + + return EventResponse.builder() + .responseInfo(responseInfo.createResponseInfoFromRequestInfo(request.getRequestInfo(), true)) + .events(request.getEvents()).build(); + } + + /** + * Validator to validate the update event request + * + * @param request + */ + public void validateUpdateEvent(EventRequest request) { + Map errorMap = new HashMap<>(); + validateForUpdate(request, errorMap); + validator.validateCreateEvent(request, false); + } + + /** + * Helper method that checks if the events to be updated are existing in the system. + * + * @param request + * @param errorMap + */ + private void validateForUpdate(EventRequest request, Map errorMap) { + EventSearchCriteria criteria = new EventSearchCriteria(); + List ids = request.getEvents().stream().map(Event::getId).collect(Collectors.toList()); + criteria.setIds(ids); + List responseFromDB = searchEvents(request.getRequestInfo(), criteria, true).getEvents(); + if (responseFromDB.size() != request.getEvents().size()) { + log.info("responseFromDB: "+responseFromDB.stream().map(Event::getId).collect(Collectors.toList())); + log.info("request.getEvents(): "+request.getEvents().stream().map(Event::getId).collect(Collectors.toList())); + + errorMap.put(ErrorConstants.MEN_UPDATE_MISSING_EVENTS_CODE, ErrorConstants.MEN_UPDATE_MISSING_EVENTS_MSG); + } + Map dBEventsMap = responseFromDB.stream().collect(Collectors.toMap(Event::getId, Function.identity())); + for (Event event : request.getEvents()) { + if (null == event.getStatus()) { + errorMap.put(ErrorConstants.MEN_UPDATE_STATUS_NOTNULL_CODE, ErrorConstants.MEN_UPDATE_STATUS_NOTNULL_MSG); + } + if(null != event.getEventDetails()) { + if(null != dBEventsMap.get(event.getId()).getEventDetails()) { + if(!event.getEventDetails().getFromDate().equals(dBEventsMap.get(event.getId()).getEventDetails().getFromDate())) { + if(event.getEventDetails().getFromDate() < new Date().getTime()) { + errorMap.put(ErrorConstants.INVALID_FROM_DATE_CODE, ErrorConstants.INVALID_FROM_DATE_MSG); + } + } + if(!event.getEventDetails().getToDate().equals(dBEventsMap.get(event.getId()).getEventDetails().getToDate())) { + if(event.getEventDetails().getToDate() < new Date().getTime()) { + errorMap.put(ErrorConstants.INVALID_TO_DATE_CODE, ErrorConstants.INVALID_TO_DATE_MSG); + } + } + }else { + if(event.getEventDetails().getFromDate() < new Date().getTime() + || event.getEventDetails().getToDate() < new Date().getTime()) { + errorMap.put(ErrorConstants.INVALID_FROM_TO_DATE_CODE, ErrorConstants.INVALID_FROM_TO_DATE_MSG); + } + } + } + } + validator.validateActions(request.getEvents(), responseFromDB, errorMap); + + if (!CollectionUtils.isEmpty(errorMap.keySet())) { + throw new CustomException(errorMap); + } + + } + + /** + * Builds counter event on update or delete of an event. + * + * + * @param requestInfo + * @param event + * @param isCounterEventReq + * @return + */ + private Event buildCounterEvents(RequestInfo requestInfo, Event event, Boolean isCounterEventReq) { + String description = null; + Event counterEvent = new Event(); + String tenanId = properties.getIsLocalizationStateLevel() ? event.getTenantId().split("\\.")[0] + : event.getTenantId(); + Map localisedMsgs = localizationService.getLocalisedMessages(requestInfo, tenanId, "en_IN", + UserEventsConstants.LOCALIZATION_MODULE_NAME); + if (event.getStatus().equals(Status.INACTIVE) || event.getStatus().equals(Status.CANCELLED)) { + if (null != event.getEventDetails().getFromDate() + && new Date().getTime() < event.getEventDetails().getFromDate()) { + description = localisedMsgs.get(UserEventsConstants.LOCALIZATION_COUNTEREVENT_ONDELETE_CODE) + .replace("", event.getName()); + } else { + isCounterEventReq = false; + } + } else { + description = localisedMsgs.get(UserEventsConstants.LOCALIZATION_COUNTEREVENT_ONUPDATE_CODE) + .replace("", event.getName()); + } + if (isCounterEventReq) { + counterEvent.setActions(event.getActions()); + counterEvent.setEventCategory(event.getEventCategory()); + counterEvent.setEventDetails(event.getEventDetails()); + counterEvent.setReferenceId(event.getId()); + counterEvent.setName(description); + counterEvent.setEventType(event.getEventType()); + counterEvent.setRecepient(event.getRecepient()); + counterEvent.setSource(event.getSource()); + counterEvent.setTenantId(event.getTenantId()); + counterEvent.setRecepientEventMap(event.getRecepientEventMap()); + counterEvent.setDescription(event.getDescription()); + } else { + counterEvent = null; + } + + return counterEvent; + } + + /** + * Service method to search all the events. This method is used to perform + * normal search and also as a helper method during validation of the upate + * flow. + * + * @param requestInfo + * @param criteria + * @param isUpdate + * @return + */ + public EventResponse searchEvents(RequestInfo requestInfo, EventSearchCriteria criteria, Boolean isUpdate) { + validator.validateSearch(requestInfo, criteria); + log.info("Searching events......"); + List events = new ArrayList<>(); + Integer totalCount = 0; + if (!isUpdate) { + enrichSearchCriteria(requestInfo, criteria); + events = repository.fetchEvents(criteria); + totalCount = repository.fetchTotalEventCount(criteria); + searchPostProcessor(requestInfo, events); + if (null != criteria.getIsCitizenSearch()) { + if (criteria.getIsCitizenSearch()) + events = citizenSearchPostProcessor(events, criteria); + } + } else { + events = repository.fetchEvents(criteria); + totalCount = repository.fetchTotalEventCount(criteria); + } + + + if(requestInfo.getUserInfo().getType().equalsIgnoreCase("SYSTEM")){ + events = getFilterEventsforOpenSearch(events); + totalCount = events.size(); + } + + + return EventResponse.builder().responseInfo(responseInfo.createResponseInfoFromRequestInfo(requestInfo, true)) + .events(events).totalCount(totalCount).build(); + } + + public List getFilterEventsforOpenSearch(List events){ + List filterEvents = new ArrayList<>(); + for(Event event: events){ + if(event.getEventType().equalsIgnoreCase(UserEventsConstants.MEN_MDMS_EVENTSONGROUND_CODE)) + filterEvents.add(event); + else if(event.getEventType().equalsIgnoreCase(UserEventsConstants.MEN_MDMS_BROADCAST_CODE)) + filterEvents.add(event); + else if(event.getEventType().equalsIgnoreCase(UserEventsConstants.MEN_MDMS_SYSTEMGENERATED_CODE)){ + if(event.getName().equalsIgnoreCase(UserEventsConstants.SURVEY_EVENT_NAME) || event.getName().equalsIgnoreCase(UserEventsConstants.DOCUMENT_EVENT_NAME)) + filterEvents.add(event); + } + else + continue; + } + return filterEvents; + } + + /** + * Deduplicates all the EVENTSONGROUND which have a counter event generated. + * However, if the request is specifically for EVENTSONGROUND, then all the + * events and counter-events are returned. Sort on fromDate for EVENTSONGROUND, + * for others sort on createddate. + * + * @param events + * @param criteria + */ + public List citizenSearchPostProcessor(List events, EventSearchCriteria criteria) { + events = events.stream() + .filter(obj -> (obj.getEventType().equals(UserEventsConstants.MEN_MDMS_BROADCAST_CODE) + && obj.getStatus().equals(Status.ACTIVE)) + || (obj.getEventType().equals(UserEventsConstants.MEN_MDMS_EVENTSONGROUND_CODE) + || obj.getEventType().equals(UserEventsConstants.MEN_MDMS_SYSTEMGENERATED_CODE))) + .collect(Collectors.toList()); // Everything except inactive BROADCASTs by default. + + if (!CollectionUtils.isEmpty(criteria.getEventTypes())) { + Set types = criteria.getEventTypes().stream().collect(Collectors.toSet()); + if (types.size() == 1 && types.contains(UserEventsConstants.MEN_MDMS_EVENTSONGROUND_CODE)) { + Collections.sort(events, Event.getFromDateComparatorForEvents()); // on fromDate - custom comparator. + } // searching for only EVENTSONGROUND which returns events and their + // counter-events with a different sorted order. + } else { + List counterEvents = events.stream().filter(obj -> !StringUtils.isEmpty(obj.getReferenceId())) + .collect(Collectors.toList()); + List refIds = counterEvents.stream().map(Event::getReferenceId).collect(Collectors.toList()); + events.forEach(event -> { + if (!refIds.contains(event.getId())) + counterEvents.add(event); + }); + events = counterEvents; + Collections.sort(events, Event.getCreatedDateComparator()); // on createdDate - custom comparator. + } // default CITIZEN search which de-duplicates and returns in default sort order. + + return events; + + } + + /** + * This method performs certain post processing activities on the searc result: + * 1. Finds all the events in the search result that have toDate prior to currentDate and marks them inactive + * 2. The inactive marking is done through an update call just before returning the search result. + * 3. Uses lazy update logic instead of a cron job to set events to inactive when they have already occured. + * + * @param requestInfo + * @param events + * @return + */ + public void searchPostProcessor(RequestInfo requestInfo, List events){ + List eventsTobeUpdated = new ArrayList<>(); + events.forEach(event -> { + Boolean tobeAdded = false; + if(null != event.getEventDetails() && !event.getStatus().equals(Status.CANCELLED)) { + if(event.getEventType().equals(UserEventsConstants.MEN_MDMS_BROADCAST_CODE)) { + if(null != event.getEventDetails().getFromDate()) { + if((event.getEventDetails().getFromDate() <= utils.getTomorrowsEpoch()) && event.getStatus().equals(Status.INACTIVE)) { + event.setStatus(Status.ACTIVE); + tobeAdded = true; + } + } + if(null != event.getEventDetails().getToDate() ) { + if((event.getEventDetails().getToDate() < utils.getTomorrowsEpoch() && event.getStatus().equals(Status.ACTIVE))) { + event.setStatus(Status.INACTIVE); + tobeAdded = true; + } + } + + if((null != event.getEventDetails().getFromDate()) && (null != event.getEventDetails().getToDate())) { + if(event.getEventDetails().getFromDate().equals(event.getEventDetails().getToDate())) { + Long dateInSecs = event.getEventDetails().getFromDate() / 1000; + Long currDateInSecs = new Date().getTime() / 1000; + if((((dateInSecs - 86400) < currDateInSecs) && (currDateInSecs < dateInSecs)) && event.getStatus().equals(Status.INACTIVE)) { + event.setStatus(Status.ACTIVE); + tobeAdded = true; + }else { + if(event.getStatus().equals(Status.ACTIVE)) { + event.setStatus(Status.INACTIVE); + tobeAdded = true; + } + } + }// UI sends EOD epoch, which makes fromDate and toDate same incase of 1 day event, which is why the range is manually calculated. Fix at UI needed. + } + }// BROADCASTs are ACTIVE only between the given from and to date, they're INACTIVE beyond that. + + else { + if(null != event.getEventDetails().getToDate()) { + if((event.getEventDetails().getToDate() < new Date().getTime())) { + event.setStatus(Status.INACTIVE); + tobeAdded = true; + } + } + } + + if(tobeAdded) { + event.setInternallyUpdted(true); + eventsTobeUpdated.add(event); + } + } + }); + if(!CollectionUtils.isEmpty(eventsTobeUpdated)) { + EventRequest request = EventRequest.builder().requestInfo(requestInfo).events(eventsTobeUpdated).build(); + try { + log.info("Updating events..."); + updateEvents(request); + }catch(Exception e) { + log.error("There was an error while lazy-updating the events: ", e); + } + } + } + + /** + * Service method to fetch count of events as per criteria. + * + * @param requestInfo + * @param criteria + * @return + */ + public NotificationCountResponse fetchCount(RequestInfo requestInfo, EventSearchCriteria criteria) { + validator.validateSearch(requestInfo, criteria); + enrichSearchCriteria(requestInfo, criteria); + NotificationCountResponse response = repository.fetchCount(criteria); + response.setResponseInfo(responseInfo.createResponseInfoFromRequestInfo(requestInfo, true)); + return response; + } + + /** + * Service method used to persist the lastaccesstime of the user. + * + * @param requestInfo + * @return + */ + public ResponseInfo persistLastAccessTime(RequestInfo requestInfo) { + LastAccesDetails loginDetails = LastAccesDetails.builder().userId(requestInfo.getUserInfo().getUuid()) + .lastAccessTime(new Date().getTime()).build(); + LATWrapper wrapper = LATWrapper.builder().lastAccessDetails(loginDetails).build(); + producer.push(properties.getLatDetailsTopic(), wrapper); + + return responseInfo.createResponseInfoFromRequestInfo(requestInfo, true); + + } + + /** + * Method to enrich the create request by setting ids, status, auditDetails etc. + * This method also populates a field called recepientEventMap, which is a + * mapping between the particular event and its recipients in a specific format. + * + * @param request + */ + private void enrichCreateEvent(EventRequest request) { + request.getEvents().forEach(event -> { + event.setId(UUID.randomUUID().toString()); + if (null != event.getActions()) { + event.getActions().setId(UUID.randomUUID().toString()); + event.getActions().setEventId(event.getId()); + event.getActions().setTenantId(event.getTenantId()); + } + if (null == event.getStatus()) + event.setStatus(Status.ACTIVE); + + if (null != event.getEventDetails()) { + event.getEventDetails().setId(UUID.randomUUID().toString()); + event.getEventDetails().setEventId(event.getId()); + if (event.getEventType().equals(UserEventsConstants.MEN_MDMS_BROADCAST_CODE)) { + if (null != event.getEventDetails().getFromDate()) { + if (event.getEventDetails().getFromDate() > utils.getTomorrowsEpoch()) { + event.setStatus(Status.INACTIVE); + } + } + } // BROADCASTs are ACTIVE only between the given from and to date, they're INACTIVE beyond that. + } + + List recepientEventList = new ArrayList<>(); + utils.manageRecepients(event, recepientEventList); + event.setRecepientEventMap(recepientEventList); + + if (!StringUtils.isEmpty(event.getPostedBy())) { + if (!Arrays.asList(UserEventsConstants.INTEGRATED_MODULES).contains(event.getPostedBy())) { + event.setPostedBy(request.getRequestInfo().getUserInfo().getUuid()); + } + } else { + event.setPostedBy(request.getRequestInfo().getUserInfo().getUuid()); + } + + AuditDetails auditDetails = AuditDetails.builder() + .createdBy(request.getRequestInfo().getUserInfo().getUuid()).createdTime(new Date().getTime()) + .lastModifiedBy(request.getRequestInfo().getUserInfo().getUuid()) + .lastModifiedTime(new Date().getTime()).build(); + + event.setAuditDetails(auditDetails); + + }); + } + + /** + * Method to enrich the update request by setting ids, status, auditDetails etc. + * This method also populates a field called recepientEventMap, which is a + * mapping between the particular event and its recipients in a specific format. + * + * @param request + */ + private void enrichUpdateEvent(EventRequest request) { + request.getEvents().forEach(event -> { + if (null != event.getActions()) { + if (StringUtils.isEmpty(event.getActions().getId())) { + event.setId(UUID.randomUUID().toString()); + event.getActions().setId(UUID.randomUUID().toString()); + event.getActions().setEventId(event.getId()); + event.getActions().setTenantId(event.getTenantId()); + } + } + if (null != event.getEventDetails()) { + if (StringUtils.isEmpty(event.getEventDetails().getId())) { + event.getEventDetails().setId(UUID.randomUUID().toString()); + event.getEventDetails().setEventId(event.getId()); + } + if (event.getEventType().equals(UserEventsConstants.MEN_MDMS_BROADCAST_CODE)) { + if (null != event.getEventDetails().getFromDate()) { + if (event.getEventDetails().getFromDate() > utils.getTomorrowsEpoch()) { + event.setStatus(Status.INACTIVE); + } + } + } // BROADCASTs are ACTIVE only between the given from and to date, they're INACTIVE beyond that. + } + List recepientEventList = new ArrayList<>(); + utils.manageRecepients(event, recepientEventList); + event.setRecepientEventMap(recepientEventList); + + AuditDetails auditDetails = event.getAuditDetails(); + if(null != event.getInternallyUpdted()) { + if(event.getInternallyUpdted()) { + auditDetails = event.getAuditDetails(); + }else { + auditDetails.setLastModifiedBy(request.getRequestInfo().getUserInfo().getUuid()); + auditDetails.setLastModifiedTime(new Date().getTime()); + } + }else { + auditDetails.setLastModifiedBy(request.getRequestInfo().getUserInfo().getUuid()); + auditDetails.setLastModifiedTime(new Date().getTime()); + } + + + event.setAuditDetails(auditDetails); + + }); + } + + /** + * Method to enrich search criteria based on role as follows: 1. Incase of + * CITIZEN, criteria is enriched using the userInfo present in RI. 2. For + * EMPLOYEE, events posted in his tenant will be returned by default. Note - the + * filter on tenantId will mean as: 'Events addressed to this tenant' in case of + * CITIZEN search. 'Events created through this tenant' in case of EMPLOYEE + * search. + * + * This method also derives a list of recipients in a specified format from the + * criteria to build search clause for the query. + * + * + * @param requestInfo + * @param criteria + */ + private void enrichSearchCriteria(RequestInfo requestInfo, EventSearchCriteria criteria) { + List statuses = new ArrayList<>(); + if ( requestInfo.getUserInfo() != null && requestInfo.getUserInfo().getType().equals("CITIZEN")) { + if (!CollectionUtils.isEmpty(criteria.getUserids())) + criteria.getUserids().clear(); + if (!CollectionUtils.isEmpty(criteria.getRoles())) + criteria.getRoles().clear(); + + List userIds = new ArrayList<>(); + List roles = new ArrayList<>(); + userIds.add(requestInfo.getUserInfo().getUuid()); + roles.add("CITIZEN.CITIZEN"); + criteria.setUserids(userIds); + criteria.setRoles(roles); + criteria.setIsCitizenSearch(true); + } else { + criteria.setIsCitizenSearch(false); + } + if (CollectionUtils.isEmpty(criteria.getStatus())) { + statuses.add("ACTIVE"); + statuses.add("INACTIVE"); + criteria.setStatus(statuses); + + } + + if (criteria.getIsCitizenSearch()) { + if (!CollectionUtils.isEmpty(criteria.getUserids()) || !CollectionUtils.isEmpty(criteria.getRoles()) + || !StringUtils.isEmpty(criteria.getTenantId())) { + utils.buildRecepientListForSearch(criteria); + } + } + + log.info("recepeients: " + criteria.getRecepients()); + log.info("Search Criteria: " + criteria); + } + +} \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/ErrorConstants.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/ErrorConstants.java new file mode 100644 index 00000000000..11014c5f89c --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/ErrorConstants.java @@ -0,0 +1,87 @@ +package org.egov.userevent.utils; + +import org.springframework.stereotype.Component; + +@Component +public class ErrorConstants { + + public static final String MISSING_ROLE_USERID_CODE = "MEN_USERID_ROLECODE_MISSING"; + public static final String MISSING_ROLE_USERID_MSG = "User id, tenantid and rolecode are mandatory in the request info"; + + public static final String MISSING_REQ_INFO_CODE = "MEN_REQ_INFO_MISSING"; + public static final String MISSING_REQ_INFO_MSG = "RequestInfo is mandatory in the request."; + + public static final String MISSING_USR_INFO_CODE = "MEN_USR_INFO_MISSING"; + public static final String MISSING_USR_INFO_MSG = "UserIndfo is mandatory within the RequestInfo."; + + public static final String EMPTY_RECEPIENT_CODE = "MEN_EMPTY_RECEPIENT"; + public static final String EMPTY_RECEPIENT_MSG = "toRoles and toUsers both cannot be empty, provide atleast one of them. " + + "Incase the event is addressed to everyone, send 'All' in toRoles"; + + public static final String INVALID_EVENT_DATE_CODE = "MEN_INVALID_EVENT_DATE"; + public static final String INVALID_EVENT_DATE_MSG = "Date invalid, fromDate cannot be greater than toDate"; + + public static final String INVALID_FROM_DATE_CODE = "MEN_INVALID_FROM_DATE"; + public static final String INVALID_FROM_DATE_MSG = "Date invalid, fromDate cannot be prior to the currentDate"; + + public static final String INVALID_TO_DATE_CODE = "MEN_INVALID_TO_DATE"; + public static final String INVALID_TO_DATE_MSG = "Date invalid, toDate cannot be prior to the currentDate"; + + public static final String INVALID_FROM_TO_DATE_CODE = "MEN_INVALID_FROM_TO_DATE"; + public static final String INVALID_FROM_TO_DATE_MSG = "Date invalid, fromDate and toDate cannot be prior to the currentDate"; + + public static final String MEN_ERROR_FROM_MDMS_CODE = "MEN_ERROR_FROM_MDMS"; + public static final String MEN_ERROR_FROM_MDMS_MSG = "There was an error while fetching event masters from MDMS"; + + public static final String MEN_NO_DATA_MDMS_CODE = "MEN_NO_DATA_MDMS"; + public static final String MEN_NO_DATA_MDMS_MSG = "MDMS data for eventTypes is missing!"; + + public static final String MEN_INVALID_EVENTTYPE_CODE = "MEN_INVALID_EVENTTYPE"; + public static final String MEN_INVALID_EVENTTYPE_MSG = "The provided eventType is not valid."; + + public static final String MEN_UPDATE_MISSING_EVENTS_CODE = "MEN_UPDATE_MISSING_EVENTS"; + public static final String MEN_UPDATE_MISSING_EVENTS_MSG = "The events you're trying update are missing in the system."; + + public static final String MEN_INVALID_SEARCH_CRITERIA_CODE = "MEN_INVALID_SEARCH_CRITERIA"; + public static final String MEN_INVALID_SEARCH_CRITERIA_MSG = "Atleast one of the parameters is mandatory for searching events."; + + public static final String MEN_INVALID_SEARCH_COUNT_CRITERIA_CODE = "MEN_INVALID_SEARCH_COUNT_CRITERIA"; + public static final String MEN_INVALID_SEARCH_COUNT_CRITERIA_MSG = "Atleast one of the parameters is mandatory for fetching events or count of unread notifications."; + + public static final String MEN_UPDATE_EVENTDETAILS_MANDATORY_CODE = "MEN_UPDATE_EVENTDETAILS_MANDATORY"; + public static final String MEN_UPDATE_EVENTDETAILS_MANDATORY_MSG = "EventDetails are mandatory for this type of event."; + + public static final String MEN_UPDATE_COUNTEREVENT_CODE = "MEN_UPDATE_COUNTEREVENT"; + public static final String MEN_UPDATE_COUNTEREVENT_MSG = "You're trying to update a system generated counter event, which is not allowed."; + + public static final String MEN_CREATE_NAMEMANDATORY_CODE = "MEN_CREATE_NAMEMANDATORY"; + public static final String MEN_CREATE_NAMEMANDATOR_MSG = "Name of the event is mandatory."; + + public static final String MEN_CREATE_CATEGORYMANDATORY_CODE = "MEN_CREATE_CATEGORYMANDATORY"; + public static final String MEN_CREATE_CATEGORYMANDATORY_MSG = "Category of the event is mandatory."; + + public static final String MEN_INVALID_CATEGORYMANDATORY_CODE = "MEN_INVALID_CATEGORYMANDATORY"; + public static final String MEN_INVALID_CATEGORYMANDATORY_MSG = "Category of the event is invalid."; + + public static final String MEN_CREATE_BROADCAST_CODE = "MEN_CREATE_BROADCAST"; + public static final String MEN_CREATE_BROADCAST_MSG = "Broadcast messages should not contain any event details"; + + public static final String MEN_INVALID_TOROLE_CODE = "MEN_INVALID_TOROLE"; + public static final String MEN_INVALID_TOROLE_MSG = "toRoles cannot contain special characters. format - USERTYPE.USERROLE"; + + public static final String MEN_INVALID_TOROLE_ALL_CODE = "MEN_INVALID_TOROLE_ALL"; + public static final String MEN_INVALID_TOROLE_ALL_MSG = "toRoles cannot contain other values alongwith 'All', toUsers should be empty"; + + public static final String MEN_INVALID_TOUSER_CODE = "MEN_INVALID_TOUSER"; + public static final String MEN_INVALID_TOUSER_MSG = "toUsers should only contain ids with the UUID type."; + + public static final String MEN_INVALID_ACTION_CANCEL_CODE = "MEN_INVALID_ACTION_CANCEL"; + public static final String MEN_INVALID_ACTION_CANCEL_MSG = "Cancelled events cannot be made ACTIVE or INACTIVE."; + + public static final String MEN_UPDATE_STATUS_NOTNULL_CODE = "MEN_UPDATE_STATUS_NOTNULL"; + public static final String MEN_UPDATE_STATUS_NOTNULL_MSG = "Status cannot be null while updating the event."; + + public static final String MEN_BROADCAST_ED_FD_MANDATORY_CODE = "MEN_BROADCAST_ED_FD_MANDATORY"; + public static final String MEN_BROADCAST_ED_FD_MANDATORY_MSG = "fromDate is mandatory for this type of event."; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/ResponseInfoFactory.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/ResponseInfoFactory.java new file mode 100644 index 00000000000..7f00ccc9e6c --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/ResponseInfoFactory.java @@ -0,0 +1,26 @@ +package org.egov.userevent.utils; + + +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.stereotype.Component; + +@Component +public class ResponseInfoFactory { + + public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { + + final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; + final String ver = requestInfo != null ? requestInfo.getVer() : ""; + Long ts = null; + if(requestInfo!=null) + ts= requestInfo.getTs(); + final String resMsgId = "uief87324"; // FIXME : Hard-coded + final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; + final String responseStatus = success ? "successful" : "failed"; + + return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) + .status(responseStatus).build(); + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/UserEventsConstants.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/UserEventsConstants.java new file mode 100644 index 00000000000..f412af08733 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/UserEventsConstants.java @@ -0,0 +1,49 @@ +package org.egov.userevent.utils; + +import org.springframework.stereotype.Component; + +@Component +public class UserEventsConstants { + + public static final String MEN_MDMS_MODULE_CODE = "mseva"; + public static final String MEN_MDMS_EVENTMASTER_CODE = "EventTypes"; + public static final String MEN_MDMS_EVENTCATEGORY_MASTER_CODE = "EventCategories"; + public static final String MEN_MDMS_EVENTMASTER_FILTER = "$.[?(@.active==true)].code"; + public static final String MEN_MDMS_EVENTCATEGORY_MASTER_FILTER = "$.[?(@.active==true)].code"; + public static final String MEN_MDMS_EVENTMASTER_CODES_JSONPATH = "$.MdmsRes." + MEN_MDMS_MODULE_CODE + "." + MEN_MDMS_EVENTMASTER_CODE; + public static final String MEN_MDMS_EVENTCATEGORY_MASTER_CODES_JSONPATH = "$.MdmsRes." + MEN_MDMS_MODULE_CODE + "." + MEN_MDMS_EVENTCATEGORY_MASTER_CODE; + + + public static final String MEN_MDMS_EVENTSONGROUND_CODE = "EVENTSONGROUND"; + public static final String MEN_MDMS_BROADCAST_CODE = "BROADCAST"; + public static final String MEN_MDMS_SYSTEMGENERATED_CODE = "SYSTEMGENERATED"; + + public static final String SURVEY_EVENT_NAME = "New Survey"; + public static final String DOCUMENT_EVENT_NAME = "New Document"; + + public static final String[] VALID_ROLES_FOR_SEARCH = {"EMPLOYEE"}; + + public static final String REGEX_FOR_SPCHARS_EXCEPT_DOT = "[$&+,:;=\\\\\\\\?@#|/'<>^()%!-]"; + public static final String REGEX_FOR_UUID = "[/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/]"; + public static final String ALL_KEYWORD = "All"; + + public static final String[] INTEGRATED_MODULES = {"SYSTEM-PT", "SYSTEM-PGR", "SYSTEM-TL", "SYSTEM-FIRENOC"}; + + public static final String LOCALIZATION_MODULE_NAME = "egov-user-events"; + public static final String LOCALIZATION_CODES_JSONPATH = "$.messages.*.code"; + public static final String LOCALIZATION_MSGS_JSONPATH = "$.messages.*.message"; + public static final String LOCALIZATION_COUNTEREVENT_ONDELETE_CODE = "egovuserevents.notification.counterevent.ondelete"; + public static final String LOCALIZATION_COUNTEREVENT_ONDELETE_DEF_MSG = " has been deleted. Please remove from your calendar."; + public static final String LOCALIZATION_COUNTEREVENT_ONUPDATE_CODE = "egovuserevents.notification.counterevent.onupdate"; + public static final String LOCALIZATION_COUNTEREVENT_ONUPDATE_DEF_MSG = "Details of have been updated."; + + + + + + + + + + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/UserEventsUtils.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/UserEventsUtils.java new file mode 100644 index 00000000000..e5ed5155366 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/utils/UserEventsUtils.java @@ -0,0 +1,154 @@ +package org.egov.userevent.utils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.stream.Collector; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.egov.common.contract.request.Role; +import org.egov.common.contract.request.User; +import org.egov.userevent.model.RecepientEvent; +import org.egov.userevent.web.contract.Event; +import org.egov.userevent.web.contract.EventSearchCriteria; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +@Service +public class UserEventsUtils { + + + + /** + * This method is very crucial for searching events. From the available search criteria, this method builds all possible combinations of recepients + * so that the events addressed to all those can be retrieved. + * For instance, a CITIZEN with id: 10 belonging to amritsar trying to search for events should get all the events in the system addressed to: + * CITIZEN|*|*, *|CITIZEN|*, *|*|pb.amritsar, CITIZEN|CITIZEN|*, *|CITIZEN|pb.amritsar, CITIZEN|*|pb.amritsar, CITIZEN|CITIZEN|pb.amritsar, userId - 10, All. + * + * The format being - TYPE|ROLE|TENANTID, * is used to indicate 'Any'. A keyword 'All' indicates that the event is addressed to everyone. + * + * + * @param criteria + */ + public void buildRecepientListForSearch(EventSearchCriteria criteria) { + List recepients = new ArrayList<>(); + if (!CollectionUtils.isEmpty(criteria.getUserids())) + criteria.getUserids().forEach(user -> recepients.add(user)); + + if (!CollectionUtils.isEmpty(criteria.getRoles())) { + criteria.getRoles().forEach(role -> { + role = role.replaceAll("\\.", "|"); //delimiter in the input is a dot, we convert it to pipe internally. + String[] typeAndRole = role.split("[|]"); + recepients.add(typeAndRole[0] + "|*|*"); + recepients.add("*|" + typeAndRole[1] + "|*"); + recepients.add(role + "|*"); + if (!StringUtils.isEmpty(criteria.getTenantId())) { + recepients.add(typeAndRole[0] +"|*|"+criteria.getTenantId()); + recepients.add("*|"+ typeAndRole[1] + "|" +criteria.getTenantId()); + recepients.add(role + "|" + criteria.getTenantId()); + } + + }); + } + if (!StringUtils.isEmpty(criteria.getTenantId())) { + recepients.add("*|*|" + criteria.getTenantId()); + } + recepients.add(UserEventsConstants.ALL_KEYWORD); + + criteria.setRecepients(recepients); + } + + + /** + * This method is used to populate recepientEventMap in create and update flow. The logic is as follows: + * 1. If both toUser and toRoles are empty, the event is assumed to be addressed to the ULB to which the event belongs to. + * 2. if toUsers is non-empty, toRoles irrespective of its values is discarded. toUsers will always take precedence. + * 3. if toRoles is non-empty and toUsers is empty, the values of toRoles are coupled with tenantId, '.' is replaced with '|' + * to build a list of recepients and store the same in the db, this intermediate list of recepients is introduced to make searches faster. + * + * every value of toRoles is of the format - TYPE.ROLE (TYPE.*, *.ROLE etc is also valid) + * + * @param event + * @param recepientEventList + */ + public void manageRecepients(Event event, List recepientEventList) { + if(null != event.getRecepient()) { + if (CollectionUtils.isEmpty(event.getRecepient().getToUsers()) + && CollectionUtils.isEmpty(event.getRecepient().getToRoles())) { + RecepientEvent rcpntevent = RecepientEvent.builder().recepient("*|*|" + event.getTenantId()) + .eventId(event.getId()).build(); + recepientEventList.add(rcpntevent); + } else { + if (!CollectionUtils.isEmpty(event.getRecepient().getToUsers())) { + if(!CollectionUtils.isEmpty(event.getRecepient().getToRoles())) + event.getRecepient().getToRoles().clear(); + if (!CollectionUtils.isEmpty(event.getRecepient().getToUsers())) { + event.getRecepient().getToUsers().forEach(user -> { + RecepientEvent rcpntevent = RecepientEvent.builder().recepient(user).eventId(event.getId()) + .build(); + recepientEventList.add(rcpntevent); + }); + } + } // toUsers will take precedence over toRoles. + else { + if (!CollectionUtils.isEmpty(event.getRecepient().getToRoles())) { + if(!event.getRecepient().getToRoles().contains(UserEventsConstants.ALL_KEYWORD)) { + event.getRecepient().getToRoles().forEach(role -> { + role = role.replaceAll("\\.", "|"); + role = role + "|" + event.getTenantId(); + RecepientEvent rcpntevent = RecepientEvent.builder().recepient(role).eventId(event.getId()) + .build(); + recepientEventList.add(rcpntevent); + }); + }else { + RecepientEvent rcpntevent = RecepientEvent.builder().recepient(UserEventsConstants.ALL_KEYWORD).eventId(event.getId()) + .build(); + recepientEventList.add(rcpntevent); + } + } + } + } + }else { + RecepientEvent rcpntevent = RecepientEvent.builder().recepient("*|*|" + event.getTenantId()) + .eventId(event.getId()).build(); + recepientEventList.add(rcpntevent); + } + + } + + + /** + * Enhancement for multi-tenancy: Checks if the user trying to search the event has access to search events in that tenant or not. + * + * @param tenantId + * @param userInfo + * @return + */ + public Boolean doesTheEmployeeHaveAccessToThisTenant(String tenantId, User userInfo) { + List roles = userInfo.getRoles().stream().filter(obj -> obj.getCode().equals(tenantId)).map(Role :: getCode).collect(Collectors.toList()); + for(String role: roles) { + Arrays.asList(UserEventsConstants.VALID_ROLES_FOR_SEARCH).contains(role); + return true; + } + return false; + } + + + /** + * When it comes to BROADCAST, we have to consider the next day for validation. + * This method returns epoch of the 24hrs later from the current instance. + * + * @return + */ + public Long getTomorrowsEpoch() { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DAY_OF_YEAR, 1); + Date tomorrow = calendar.getTime(); + + return tomorrow.getTime(); + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/Action.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/Action.java new file mode 100644 index 00000000000..ef4f4707d34 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/Action.java @@ -0,0 +1,41 @@ +package org.egov.userevent.web.contract; + +import java.util.List; + +import jakarta.validation.constraints.NotNull; + +import org.egov.tracer.annotations.CustomSafeHtml; +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class Action { + @CustomSafeHtml + private String tenantId; + + @CustomSafeHtml + private String id; + + @CustomSafeHtml + private String eventId; + + @NotNull + private List actionUrls; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/ActionItem.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/ActionItem.java new file mode 100644 index 00000000000..e9ed67cb9d3 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/ActionItem.java @@ -0,0 +1,34 @@ +package org.egov.userevent.web.contract; + +import jakarta.validation.constraints.NotNull; + +import org.egov.tracer.annotations.CustomSafeHtml; +import org.springframework.validation.annotation.Validated; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class ActionItem { + + @NotNull + @CustomSafeHtml + private String actionUrl; + + @NotNull + @CustomSafeHtml + private String code; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/Event.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/Event.java new file mode 100644 index 00000000000..3539162cc1f --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/Event.java @@ -0,0 +1,113 @@ +package org.egov.userevent.web.contract; + +import java.util.Comparator; +import java.util.List; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +import org.egov.userevent.model.AuditDetails; +import org.egov.userevent.model.RecepientEvent; +import org.egov.userevent.model.enums.Source; +import org.egov.userevent.model.enums.Status; +import org.egov.tracer.annotations.CustomSafeHtml; +import org.springframework.validation.annotation.Validated; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class Event { + + @NotNull + @CustomSafeHtml + private String tenantId; + + @CustomSafeHtml + private String id; + + @CustomSafeHtml + private String referenceId; + + @NotNull + @CustomSafeHtml + private String eventType; + + @CustomSafeHtml + private String eventCategory; + + @NotNull + @CustomSafeHtml + @Size(max = 65) + private String name; + + @NotNull + @CustomSafeHtml + @Size(max = 500) + private String description; + + private Status status; + + @NotNull + private Source source; + + @CustomSafeHtml + private String postedBy; + + private Recepient recepient; + + private Action actions; + + private EventDetails eventDetails; + + private AuditDetails auditDetails; + + private List recepientEventMap; + + private Boolean generateCounterEvent; + + private Boolean internallyUpdted; + + + + /** + * Comparator for fromDate based sorting of EVENTSONGROUND + * + * @return + */ + public static Comparator getFromDateComparatorForEvents() { + return new Comparator() { + @Override + public int compare(Event o1, Event o2) { + return o1.getEventDetails().getFromDate().compareTo(o2.getEventDetails().getFromDate()); + } + }; + } + + /** + * Comparator for createdDate based sorting of all the events. + * + * @return + */ + public static Comparator getCreatedDateComparator() { + return new Comparator() { + @Override + public int compare(Event o1, Event o2) { + return o2.getAuditDetails().getCreatedTime().compareTo(o1.getAuditDetails().getCreatedTime()); + } + }; + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventDetails.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventDetails.java new file mode 100644 index 00000000000..42efd964c77 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventDetails.java @@ -0,0 +1,61 @@ +package org.egov.userevent.web.contract; + +import java.math.BigDecimal; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.egov.userevent.model.Document; +import org.egov.tracer.annotations.CustomSafeHtml; +import org.springframework.validation.annotation.Validated; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class EventDetails { + + @CustomSafeHtml + private String id; + + @CustomSafeHtml + private String eventId; + + @CustomSafeHtml + private String organizer; + + private Long fromDate; + + private Long toDate; + + private BigDecimal latitude; + + private BigDecimal longitude; + + @CustomSafeHtml + private String address; + + private List documents; + + private BigDecimal fees; + + public boolean isEmpty(EventDetails details) { + if(null != details.getFromDate() && null != details.getToDate() && + (!StringUtils.isEmpty(details.getAddress()) || (null != details.getLatitude() && null != details.getLongitude()))) { + return false; + } + return true; + } + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventRequest.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventRequest.java new file mode 100644 index 00000000000..35de9056038 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventRequest.java @@ -0,0 +1,77 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov.userevent.web.contract; + +import java.util.List; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; + +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Validated +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EventRequest { + + @NotNull + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @NotNull + @Valid + @JsonProperty("events") + private List events; + + +} \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventResponse.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventResponse.java new file mode 100644 index 00000000000..e6d6c20d4d8 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventResponse.java @@ -0,0 +1,77 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov.userevent.web.contract; + +import java.util.List; + +import org.egov.common.contract.response.ResponseInfo; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + + +@Builder +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EventResponse { + + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo; + + private List events; + + @JsonProperty("totalCount") + private Integer totalCount; + +} \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventSearchCriteria.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventSearchCriteria.java new file mode 100644 index 00000000000..50df783f8c0 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/EventSearchCriteria.java @@ -0,0 +1,70 @@ +package org.egov.userevent.web.contract; + +import java.util.List; + +import jakarta.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.CollectionUtils; +import org.springframework.validation.annotation.Validated; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +@Validated +@Data +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class EventSearchCriteria { + + private List ids; + + private List userids; + + private List roles; + + private List postedBy; + + private List name; + + private List referenceIds; + + private List source; + + private List status; + + private List eventTypes; + + @NotNull + private String tenantId; + + private List recepients; + + private Integer offset; + + private Integer limit; + + private Boolean isCitizenSearch; + + private Boolean isEventsCountCall = false; + + private Long fromDate; + + private Long toDate; + + public Boolean isEmpty(EventSearchCriteria eventSearchCriteria) { + if(CollectionUtils.isEmpty(eventSearchCriteria.getIds()) && CollectionUtils.isEmpty(eventSearchCriteria.getPostedBy()) + && CollectionUtils.isEmpty(eventSearchCriteria.getRecepients()) && CollectionUtils.isEmpty(eventSearchCriteria.getRoles()) + && CollectionUtils.isEmpty(eventSearchCriteria.getStatus()) && CollectionUtils.isEmpty(eventSearchCriteria.getUserids()) + && StringUtils.isEmpty(eventSearchCriteria.getTenantId())) { + return true; + }else + return false; + } + + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/NotificationCountResponse.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/NotificationCountResponse.java new file mode 100644 index 00000000000..5b71878497d --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/NotificationCountResponse.java @@ -0,0 +1,32 @@ +package org.egov.userevent.web.contract; + +import org.egov.common.contract.response.ResponseInfo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + + +@Builder +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +public class NotificationCountResponse { + + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo; + + private Long totalCount; + + private Long unreadCount; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/Recepient.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/Recepient.java new file mode 100644 index 00000000000..3669140b44f --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/contract/Recepient.java @@ -0,0 +1,33 @@ +package org.egov.userevent.web.contract; + +import java.util.List; + +import jakarta.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Validated +@AllArgsConstructor +@EqualsAndHashCode +@Getter +@NoArgsConstructor +@Setter +@ToString +@Builder +public class Recepient { + + private List toRoles; + + private List toUsers; + +} diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/controller/UserEventsController.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/controller/UserEventsController.java new file mode 100644 index 00000000000..0823db17b90 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/controller/UserEventsController.java @@ -0,0 +1,146 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov.userevent.web.controller; + +import jakarta.validation.Valid; + +import org.egov.common.contract.response.ResponseInfo; +import org.egov.userevent.model.RequestInfoWrapper; +import org.egov.userevent.service.UserEventsService; +import org.egov.userevent.web.contract.EventRequest; +import org.egov.userevent.web.contract.EventResponse; +import org.egov.userevent.web.contract.EventSearchCriteria; +import org.egov.userevent.web.contract.NotificationCountResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@RequestMapping(value = "/v1/events/") +public class UserEventsController { + + @Autowired + private UserEventsService service; + + + /** + * Endpoint to create events in the system. + * + * @param topic + * @param indexJson + * @return + */ + @PostMapping("_create") + @ResponseBody + private ResponseEntity create(@RequestBody @Valid EventRequest request) { + EventResponse response = service.createEvents(request, false); + return new ResponseEntity<>(response, HttpStatus.OK); + } + + /** + * Endpoint to upate events in the system. + * + * @param topic + * @param indexJson + * @return + */ + @PostMapping("/_update") + @ResponseBody + private ResponseEntity update(@RequestBody @Valid EventRequest request) { + EventResponse response = service.updateEvents(request); + return new ResponseEntity<>(response, HttpStatus.OK); + } + + /** + * Endpoint to search events in the system. + * + * @param topic + * @param indexJson + * @return + */ + @PostMapping("/_search") + @ResponseBody + private ResponseEntity search(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper, + @ModelAttribute @Valid EventSearchCriteria eventSearchCriteria) { + EventResponse response = service.searchEvents(requestInfoWrapper.getRequestInfo(), eventSearchCriteria, false); + return new ResponseEntity<>(response, HttpStatus.OK); + + } + + /** + * Endpoint to get count of notifications for a user in the system. + * + * @param topic + * @param indexJson + * @return + */ + @PostMapping("/notifications/_count") + @ResponseBody + private ResponseEntity count(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper, + @ModelAttribute @Valid EventSearchCriteria eventSearchCriteria) { + NotificationCountResponse response = service.fetchCount(requestInfoWrapper.getRequestInfo(), eventSearchCriteria); + return new ResponseEntity<>(response, HttpStatus.OK); + + } + + + /** + * Endpoint to update the lastaccesstime of a user in the system. This required to fetch count of unread notifs through search. + * + * @param topic + * @param indexJson + * @return + */ + @PostMapping("/lat/_update") + @ResponseBody + private ResponseEntity updatellt(@RequestBody @Valid RequestInfoWrapper requestInfoWrapper) { + ResponseInfo response = service.persistLastAccessTime(requestInfoWrapper.getRequestInfo()); + return new ResponseEntity<>(response, HttpStatus.OK); + + } + +} \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/java/org/egov/userevent/web/validator/UserEventsValidator.java b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/validator/UserEventsValidator.java new file mode 100644 index 00000000000..7b9630aa8c4 --- /dev/null +++ b/core-services/egov-user-event/src/main/java/org/egov/userevent/web/validator/UserEventsValidator.java @@ -0,0 +1,306 @@ +package org.egov.userevent.web.validator; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.function.Function; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.egov.common.contract.request.RequestInfo; +import org.egov.tracer.model.CustomException; +import org.egov.userevent.model.enums.Status; +import org.egov.userevent.service.MDMSService; +import org.egov.userevent.service.UserEventsService; +import org.egov.userevent.utils.ErrorConstants; +import org.egov.userevent.utils.UserEventsConstants; +import org.egov.userevent.web.contract.Event; +import org.egov.userevent.web.contract.EventRequest; +import org.egov.userevent.web.contract.EventSearchCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import lombok.extern.slf4j.Slf4j; + +@Service +@Slf4j +public class UserEventsValidator { + + @Autowired + private MDMSService mdmsService; + +// @Autowired +// private UserEventsService service; + + /** + * Validator to validate the create event request + * + * @param request + */ + public void validateCreateEvent(EventRequest request, Boolean isCreate) { + log.info("Validating the request......"); + Map errorMap = new HashMap<>(); + validateRI(request.getRequestInfo(), errorMap); + Set eventTenants = request.getEvents().stream().map(Event :: getTenantId).collect(Collectors.toSet()); + if(eventTenants.size() != 1) { + throw new CustomException("MEN_DIFF_TENANT_ERROR", "All events must belong to the same tenant"); + } + Map> eventMaster = mdmsService.fetchEventMasters(request.getRequestInfo(), request.getEvents().get(0).getTenantId()); + request.getEvents().forEach(event -> { + validateEventData(request.getRequestInfo(), event, errorMap, eventMaster, isCreate); + }); + if (!CollectionUtils.isEmpty(errorMap.keySet())) { + throw new CustomException(errorMap); + } + + } + + /** + * Validator to validate the update event request + * + * @param request + */ +// public void validateUpdateEvent(EventRequest request) { +// Map errorMap = new HashMap<>(); +// validateForUpdate(request, errorMap); +// validateCreateEvent(request, false); +// } + + + + /** + * Validator to validate the request for event search and count + * + * @param requestInfo + * @param criteria + */ + public void validateSearch(RequestInfo requestInfo, EventSearchCriteria criteria) { + Map errorMap = new HashMap<>(); + //validateRI(requestInfo, errorMap); + if (!CollectionUtils.isEmpty(errorMap.keySet())) { + throw new CustomException(errorMap); + } + } + + /** + * Helper method that checks if the events to be updated are existing in the system. + * + * @param request + * @param errorMap + */ +// private void validateForUpdate(EventRequest request, Map errorMap) { +// EventSearchCriteria criteria = new EventSearchCriteria(); +// List ids = request.getEvents().stream().map(Event::getId).collect(Collectors.toList()); +// criteria.setIds(ids); +// List responseFromDB = service.searchEvents(request.getRequestInfo(), criteria, true).getEvents(); +// if (responseFromDB.size() != request.getEvents().size()) { +// log.info("responseFromDB: "+responseFromDB.stream().map(Event::getId).collect(Collectors.toList())); +// log.info("request.getEvents(): "+request.getEvents().stream().map(Event::getId).collect(Collectors.toList())); +// +// errorMap.put(ErrorConstants.MEN_UPDATE_MISSING_EVENTS_CODE, ErrorConstants.MEN_UPDATE_MISSING_EVENTS_MSG); +// } +// Map dBEventsMap = responseFromDB.stream().collect(Collectors.toMap(Event::getId, Function.identity())); +// for (Event event : request.getEvents()) { +// if (null == event.getStatus()) { +// errorMap.put(ErrorConstants.MEN_UPDATE_STATUS_NOTNULL_CODE, ErrorConstants.MEN_UPDATE_STATUS_NOTNULL_MSG); +// } +// if(null != event.getEventDetails()) { +// if(null != dBEventsMap.get(event.getId()).getEventDetails()) { +// if(!event.getEventDetails().getFromDate().equals(dBEventsMap.get(event.getId()).getEventDetails().getFromDate())) { +// if(event.getEventDetails().getFromDate() < new Date().getTime()) { +// errorMap.put(ErrorConstants.INVALID_FROM_DATE_CODE, ErrorConstants.INVALID_FROM_DATE_MSG); +// } +// } +// if(!event.getEventDetails().getToDate().equals(dBEventsMap.get(event.getId()).getEventDetails().getToDate())) { +// if(event.getEventDetails().getToDate() < new Date().getTime()) { +// errorMap.put(ErrorConstants.INVALID_TO_DATE_CODE, ErrorConstants.INVALID_TO_DATE_MSG); +// } +// } +// }else { +// if(event.getEventDetails().getFromDate() < new Date().getTime() +// || event.getEventDetails().getToDate() < new Date().getTime()) { +// errorMap.put(ErrorConstants.INVALID_FROM_TO_DATE_CODE, ErrorConstants.INVALID_FROM_TO_DATE_MSG); +// } +// } +// } +// } +// validateActions(request.getEvents(), responseFromDB, errorMap); +// +// if (!CollectionUtils.isEmpty(errorMap.keySet())) { +// throw new CustomException(errorMap); +// } +// +// } + + /** + * Validates the actions performed on an event. As follows: + * 1. If the event is already in CANCELLED state, it cannot be made ACTIVE or INACTIVE. + * 2. for events of type EVENTSONGROUND, this method decides whether a counter events has to be generated based on the action. + * + * @param reqEvents + * @param dbEvents + * @param errorMap + */ + public void validateActions(List reqEvents, List dbEvents, Map errorMap) { + Map mapOfIdAndCurrentState = dbEvents.stream() + .collect(Collectors.toMap(Event::getId, Event::getStatus)); + reqEvents.forEach(event -> { + if (event.getEventType().equals(UserEventsConstants.MEN_MDMS_EVENTSONGROUND_CODE)) { + if (mapOfIdAndCurrentState.get(event.getId()).equals(Status.CANCELLED)) { + if (event.getStatus().equals(Status.INACTIVE) || event.getStatus().equals(Status.ACTIVE)) { + errorMap.put(ErrorConstants.MEN_INVALID_ACTION_CANCEL_CODE, + ErrorConstants.MEN_INVALID_ACTION_CANCEL_MSG); + } + if (event.getStatus().equals(Status.CANCELLED)) { + event.setGenerateCounterEvent(false); + } + } + if (mapOfIdAndCurrentState.get(event.getId()).equals(Status.INACTIVE)) { + if (event.getStatus().equals(Status.INACTIVE)) { + event.setGenerateCounterEvent(false); + } + + } + } + }); + } + + /** + * Method to validate the necessary RI details. + * + * @param requestInfo + * @param errorMap + */ + private void validateRI(RequestInfo requestInfo, Map errorMap) { + if (null != requestInfo) { + if(null != requestInfo.getUserInfo()) { + if ((StringUtils.isEmpty(requestInfo.getUserInfo().getUuid())) + || (CollectionUtils.isEmpty(requestInfo.getUserInfo().getRoles())) + || (StringUtils.isEmpty(requestInfo.getUserInfo().getTenantId()))) { + errorMap.put(ErrorConstants.MISSING_ROLE_USERID_CODE, ErrorConstants.MISSING_ROLE_USERID_MSG); + } + }else { + errorMap.put(ErrorConstants.MISSING_USR_INFO_CODE, ErrorConstants.MISSING_USR_INFO_MSG); + } + + } else { + errorMap.put(ErrorConstants.MISSING_REQ_INFO_CODE, ErrorConstants.MISSING_REQ_INFO_MSG); + } + if (!CollectionUtils.isEmpty(errorMap.keySet())) { + throw new CustomException(errorMap); + } + + } + + /** + * Does a sanity check on the event data entered as part of the create/update. + * + * @param requestInfo + * @param event + * @param errorMap + */ + private void validateEventData(RequestInfo requestInfo, Event event, Map errorMap, Map> eventMaster, Boolean isCreate) { + if (null != event.getEventDetails()) { + if(null != event.getEventDetails().getFromDate() && null != event.getEventDetails().getToDate()) { + if (event.getEventDetails().getFromDate() > event.getEventDetails().getToDate()) { + errorMap.put(ErrorConstants.INVALID_EVENT_DATE_CODE, ErrorConstants.INVALID_EVENT_DATE_MSG); + } + if(isCreate) { + if(event.getEventDetails().getFromDate() < new Date().getTime() + || event.getEventDetails().getToDate() < new Date().getTime()) { + errorMap.put(ErrorConstants.INVALID_FROM_TO_DATE_CODE, ErrorConstants.INVALID_FROM_TO_DATE_MSG); + } + } + } + } + if(null != event.getRecepient()) { + if (!CollectionUtils.isEmpty(event.getRecepient().getToRoles())) { + if (event.getRecepient().getToRoles().contains(UserEventsConstants.ALL_KEYWORD) + && (event.getRecepient().getToRoles().size() > 1)) { + if ((event.getRecepient().getToRoles().size() > 1) + || !CollectionUtils.isEmpty(event.getRecepient().getToUsers())) { + errorMap.put(ErrorConstants.MEN_INVALID_TOROLE_ALL_CODE, ErrorConstants.MEN_INVALID_TOROLE_ALL_MSG); + } + } + event.getRecepient().getToRoles().forEach(role -> { + Pattern p = Pattern.compile(UserEventsConstants.REGEX_FOR_SPCHARS_EXCEPT_DOT); + Matcher m = p.matcher(role); + if (m.find()) { + errorMap.put(ErrorConstants.MEN_INVALID_TOROLE_CODE, ErrorConstants.MEN_INVALID_TOROLE_MSG); + } + }); + } + + if (!CollectionUtils.isEmpty(event.getRecepient().getToUsers())) { + event.getRecepient().getToUsers().forEach(user -> { + try { + UUID.fromString(user); + } catch (Exception e) { + errorMap.put(ErrorConstants.MEN_INVALID_TOUSER_CODE, ErrorConstants.MEN_INVALID_TOUSER_MSG); + } + }); + } + } + + validateMDMSData(requestInfo, event, errorMap, eventMaster); + } + + /** + * Fetches data from MDMS and performs validations based on the retrieved data. + * + * @param requestInfo + * @param event + * @param errorMap + */ + private void validateMDMSData(RequestInfo requestInfo, Event event, Map errorMap, Map> eventMaster) { + List eventTypes = eventMaster.get(UserEventsConstants.MEN_MDMS_EVENTMASTER_CODE); + List eventCategories = eventMaster.get(UserEventsConstants.MEN_MDMS_EVENTCATEGORY_MASTER_CODE); + if (!CollectionUtils.isEmpty(eventTypes) && !CollectionUtils.isEmpty(eventCategories)) { + if (!eventTypes.contains(event.getEventType())) + errorMap.put(ErrorConstants.MEN_INVALID_EVENTTYPE_CODE, ErrorConstants.MEN_INVALID_EVENTTYPE_MSG); + else { + if (event.getEventType().equals(UserEventsConstants.MEN_MDMS_EVENTSONGROUND_CODE)) { + if(!StringUtils.isEmpty(event.getEventCategory())) { + if(eventCategories.contains(event.getEventCategory())) { + if (null == event.getEventDetails()) { + errorMap.put(ErrorConstants.MEN_UPDATE_EVENTDETAILS_MANDATORY_CODE, ErrorConstants.MEN_UPDATE_EVENTDETAILS_MANDATORY_MSG); + } else if (event.getEventDetails().isEmpty(event.getEventDetails())) { + errorMap.put(ErrorConstants.MEN_UPDATE_EVENTDETAILS_MANDATORY_CODE, ErrorConstants.MEN_UPDATE_EVENTDETAILS_MANDATORY_MSG); + } + if (StringUtils.isEmpty(event.getName())) { + errorMap.put(ErrorConstants.MEN_CREATE_NAMEMANDATORY_CODE, ErrorConstants.MEN_CREATE_NAMEMANDATOR_MSG); + } + }else { + errorMap.put(ErrorConstants.MEN_INVALID_CATEGORYMANDATORY_CODE, ErrorConstants.MEN_INVALID_CATEGORYMANDATORY_MSG); + } + + }else { + errorMap.put(ErrorConstants.MEN_CREATE_CATEGORYMANDATORY_CODE, ErrorConstants.MEN_CREATE_CATEGORYMANDATORY_MSG); + } + } + + if(event.getEventType().equals(UserEventsConstants.MEN_MDMS_BROADCAST_CODE )) { + if (StringUtils.isEmpty(event.getName())) { + errorMap.put(ErrorConstants.MEN_CREATE_NAMEMANDATORY_CODE, ErrorConstants.MEN_CREATE_NAMEMANDATOR_MSG); + } + if (null == event.getEventDetails()) { + errorMap.put(ErrorConstants.MEN_UPDATE_EVENTDETAILS_MANDATORY_CODE, + ErrorConstants.MEN_UPDATE_EVENTDETAILS_MANDATORY_MSG); + } else if (null == event.getEventDetails().getFromDate()) { + errorMap.put(ErrorConstants.MEN_BROADCAST_ED_FD_MANDATORY_CODE, ErrorConstants.MEN_BROADCAST_ED_FD_MANDATORY_MSG); + } + } + + } + } else { + throw new CustomException(ErrorConstants.MEN_NO_DATA_MDMS_CODE, ErrorConstants.MEN_NO_DATA_MDMS_MSG); + } + } + +} diff --git a/core-services/egov-user-event/src/main/resources/application.properties b/core-services/egov-user-event/src/main/resources/application.properties new file mode 100644 index 00000000000..4c4e4cd64bc --- /dev/null +++ b/core-services/egov-user-event/src/main/resources/application.properties @@ -0,0 +1,73 @@ +#---------------------------- DATABASE CONFIGURATIONS -----------------------------# +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/mseva +spring.datasource.username=postgres +spring.datasource.password=postgres + +#----------------------------- FLYWAY CONFIGURATIONS ------------------------------# +spring.flyway.url=jdbc:postgresql://localhost:5432/mseva +spring.flyway.user=postgres +spring.flyway.password=postgres +spring.flyway.table=mseva_notification_schema_version +spring.flyway.baseline-on-migrate=true +spring.flyway.outOfOrder=true +spring.flyway.locations=classpath:/db/migration/main +spring.flyway.enabled=false + +#--------------------------- PATH & PORT CONFIGURATIONS ---------------------------# +server.context-path=/egov-user-event +server.servlet.context-path=/egov-user-event +server.port=8091 +management.endpoints.web.base-path=/ + +#---------------------------- TIMEZONE CONFIGURATIONS -----------------------------# +app.timezone=UTC + +#-------------------------- EXTERNAL API CONFIGURATIONS ---------------------------# + +#external module configs +egov.mdms.host=https://dev.digit.org +egov.mdms.search.endpoint=/egov-mdms-service/v1/_search + +#egov.localisation.host=http://egov-localization:8080 +egov.localisation.host=https://dev.digit.org +egov.localisation.search.endpoint=/localization/messages/v1/_search +egov.localisation.is.statelevel=false + + +#------------------------------ KAFKA CONFIGURATIONS ------------------------------# +# KAFKA SERVER CONFIGURATIONS +spring.kafka.bootstrap.servers=localhost:9092 + +# SPRING KAFKA CONSUMER CONFIGURATIONS +spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.group-id=mseva-event-notifications +spring.kafka.listener.missing-topics-fatal=false +spring.kafka.consumer.properties.spring.json.use.type.headers=false + +# SPRING KAFKA PRODUCER CONFIGURATIONS +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer + + +# KAFKA TOPIC CONFIGURATIONS +kafka.topics.persister.save.events=save-user-events +kafka.topics.persister.update.events=update-user-events +kafka.topics.lat.details=user-events-lat + +kafka.topics.save.events=persist-user-events-async +kafka.topics.update.events=update-user-events-async + +#VARIABLES +mseva.notif.search.offset=0 +mseva.notif.search.limit=200 + + +#------------------------------ TRACER CONFIGURATIONS -----------------------------# +# tracer.detailed.tracing.enabled=false + +#------------------------------ LOGGER CONFIGURATIONS -----------------------------# +logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} + +log4j.logger.org.springframework.jdbc.core = TRACE \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/resources/config/application-config.properties b/core-services/egov-user-event/src/main/resources/config/application-config.properties similarity index 100% rename from business-services/egov-hrms/src/main/resources/config/application-config.properties rename to core-services/egov-user-event/src/main/resources/config/application-config.properties diff --git a/core-services/egov-user-event/src/main/resources/db/Dockerfile b/core-services/egov-user-event/src/main/resources/db/Dockerfile new file mode 100644 index 00000000000..f38638a269f --- /dev/null +++ b/core-services/egov-user-event/src/main/resources/db/Dockerfile @@ -0,0 +1,9 @@ +FROM egovio/flyway:10.7.1 + +COPY ./migration/main /flyway/sql + +COPY migrate.sh /usr/bin/migrate.sh + +RUN chmod +x /usr/bin/migrate.sh + +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/business-services/egf-instrument/src/main/resources/db/migrate.sh b/core-services/egov-user-event/src/main/resources/db/migrate.sh similarity index 100% rename from business-services/egf-instrument/src/main/resources/db/migrate.sh rename to core-services/egov-user-event/src/main/resources/db/migrate.sh diff --git a/core-services/egov-user-event/src/main/resources/db/migration/main/V20190603172852__create_tables_ddl.sql b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190603172852__create_tables_ddl.sql new file mode 100644 index 00000000000..5f3f0fa266a --- /dev/null +++ b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190603172852__create_tables_ddl.sql @@ -0,0 +1,41 @@ +CREATE TABLE eg_men_events( + + tenantid character varying(256) NOT NULL, + id character varying(500) NOT NULL, + source character varying(256), + eventtype character varying(256), + name character varying(256), + description character varying(256), + status character varying(256), + postedby character varying(256), + referenceid character varying(256), + recepient jsonb, + eventdetails jsonb, + actions jsonb, + createdby character varying(256) NOT NULL, + createdtime bigint NOT NULL, + lastmodifiedby character varying(256), + lastmodifiedtime bigint, + + CONSTRAINT pk_eg_men_events PRIMARY KEY (id) + +); + + + +CREATE TABLE eg_men_recepnt_event_registry( + + recepient character varying(500) NOT NULL, + eventid character varying(500) NOT NULL + +); + + +CREATE TABLE eg_men_user_llt( + + userid character varying(500) NOT NULL, + lastlogintime bigint NOT NULL, + + CONSTRAINT pk_eg_llt PRIMARY KEY (userid) + +); \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/resources/db/migration/main/V20190708164237__alter_table_name_ddl.sql b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190708164237__alter_table_name_ddl.sql new file mode 100644 index 00000000000..9393836241e --- /dev/null +++ b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190708164237__alter_table_name_ddl.sql @@ -0,0 +1,4 @@ +ALTER TABLE eg_men_events RENAME TO eg_usrevents_events; +ALTER TABLE eg_men_recepnt_event_registry RENAME TO eg_usrevents_recepnt_event_registry; +ALTER TABLE eg_men_user_llt RENAME COLUMN lastlogintime TO lastaccesstime; +ALTER TABLE eg_men_user_llt RENAME TO eg_usrevents_user_lat; \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/resources/db/migration/main/V20190729160337__alter_table_add_category_ddl.sql b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190729160337__alter_table_add_category_ddl.sql new file mode 100644 index 00000000000..c6768adbb7d --- /dev/null +++ b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190729160337__alter_table_add_category_ddl.sql @@ -0,0 +1 @@ +ALTER TABLE eg_usrevents_events ADD COLUMN category character varying(256); \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/resources/db/migration/main/V20190801171004__alter_column_length_ddl.sql b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190801171004__alter_column_length_ddl.sql new file mode 100644 index 00000000000..3bff9bcf5a9 --- /dev/null +++ b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190801171004__alter_column_length_ddl.sql @@ -0,0 +1 @@ +ALTER TABLE eg_usrevents_events ALTER COLUMN description TYPE text; \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/resources/db/migration/main/V20190801173930__add_secondary_indexes_ddl.sql b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190801173930__add_secondary_indexes_ddl.sql new file mode 100644 index 00000000000..5b1492af12d --- /dev/null +++ b/core-services/egov-user-event/src/main/resources/db/migration/main/V20190801173930__add_secondary_indexes_ddl.sql @@ -0,0 +1,6 @@ +CREATE INDEX on_eventtype ON eg_usrevents_events ("eventtype"); +CREATE INDEX on_status ON eg_usrevents_events ("status"); +CREATE INDEX on_postedby ON eg_usrevents_events ("postedby"); +CREATE INDEX on_tenantid ON eg_usrevents_events ("tenantid"); + +CREATE INDEX on_recepient ON eg_usrevents_recepnt_event_registry ("recepient"); \ No newline at end of file diff --git a/core-services/egov-user-event/src/main/resources/db/migration/main/V20200925213030__add_userevent_search_indexes_ddl.sql b/core-services/egov-user-event/src/main/resources/db/migration/main/V20200925213030__add_userevent_search_indexes_ddl.sql new file mode 100644 index 00000000000..6070c9aab97 --- /dev/null +++ b/core-services/egov-user-event/src/main/resources/db/migration/main/V20200925213030__add_userevent_search_indexes_ddl.sql @@ -0,0 +1,3 @@ +CREATE INDEX IF NOT EXISTS index_eg_usrevents_events_name ON eg_usrevents_events (name); + +CREATE INDEX IF NOT EXISTS index_eg_usrevents_events_referenceid ON eg_usrevents_events (referenceid); \ No newline at end of file diff --git a/business-services/egov-hrms/src/main/resources/db/migration/seed/.gitkeep b/core-services/egov-user-event/src/main/resources/db/migration/seed/.gitkeep similarity index 100% rename from business-services/egov-hrms/src/main/resources/db/migration/seed/.gitkeep rename to core-services/egov-user-event/src/main/resources/db/migration/seed/.gitkeep diff --git a/core-services/egov-user-event/src/test/resources/application.properties b/core-services/egov-user-event/src/test/resources/application.properties new file mode 100644 index 00000000000..275cb96e56a --- /dev/null +++ b/core-services/egov-user-event/src/test/resources/application.properties @@ -0,0 +1,108 @@ +#---------------------------- DATABASE CONFIGURATIONS -----------------------------# +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/hr_employee_db +spring.datasource.username=postgres +spring.datasource.password=postgres + +#----------------------------- FLYWAY CONFIGURATIONS ------------------------------# +flyway.url=jdbc:postgresql://localhost:5432/hr_employee_db +flyway.user=postgres +flyway.password=postgres +flyway.table=hr_employee_schema_version +flyway.baseline-on-migrate=true +flyway.outOfOrder=true +flyway.locations=db/migration/main,db/migration/seed + +#--------------------------- PATH & PORT CONFIGURATIONS ---------------------------# +server.contextPath=/hr-employee-v2 +server.port=9999 + +#---------------------------- TIMEZONE CONFIGURATIONS -----------------------------# +app.timezone=UTC + +#-------------------------- EXTERNAL API CONFIGURATIONS ---------------------------# +egov.services.data_sync_employee.required = false + +# HR-EMPLOYEE (SELF) SERVICE PATH +egov.services.hr_employee_service.hostname=https://dev.digit.org +egov.services.hr_employee_service.basepath=/hr-employee-v2 +egov.services.hr_employee_service.employee.createpath=/employees/_create +egov.services.hr_employee_service.default.password=abcdefgh + +# USER SERVICE PATH +egov.services.users_service.hostname=https://dev.digit.org +egov.services.users_service.users.basepath=/user +egov.services.users_service.users.searchpath=/v1/_search +egov.services.users_service.users.createpath=/users/_createnovalidate +egov.services.users_service.users.updatepath=/users/_updatenovalidate + +# HR-MASTERS SERVICE PATH +egov.services.hr_masters_service.hostname=https://dev.digit.org +egov.services.hr_masters_service.basepath=/hr-masters-v2 +egov.services.hr_masters_service.positions.searchpath=/positions/_search +egov.services.hr_masters_service.designations.searchpath=/designations/_search +egov.services.hr_masters_service.hr_configurations.searchpath=/hrconfigurations/_search +egov.services.hr_masters_service.vacantpositions.searchpath=/vacantpositions/_search +egov.services.hr_masters_service.empstatus.searchpath=//hrstatuses/_search +egov.services.hr_masters_service.emptype.searchpath=/employeetypes/_search + +# HYBRID-DATA-SYNC SERVICE PATH +egov.services.data_sync_employee_service.hostname=https://dev.digit.org +egov.services.data_sync_employee_service.basepath=/data-sync-employee +egov.services.data_sync_employee_service.createpath=/datasync/_create + +# ID GENERATION SERVICE PATH +egov.services.egov_idgen.hostname=https://dev.digit.org +egov.services.egov_idgen.createpath=/egov-idgen/id/_generate +egov.services.egov_idgen.emp.code.name=employee.code +egov.services.egov_idgen.emp.code.format=EMP_[SEQ_EMPLOYEE_CODE] + +# COMMON-WORKFLOW SERVICE PATH +egov.services.common_workflows_service.hostname=https://dev.digit.org +egov.services.common_workflows_service.searchpath=/egov-common-workflows/tasks/_search + +# MDMS SERVICE PATH +egov.services.egov_mdms.hostname=https://dev.digit.org/ +egov.services.egov_mdms.searchpath=egov-mdms-service/v1/_search + +# ERP SERVICE PATH +egov.services.eis_service.hostname=https://dev.digit.org +egov.municipality.host=http://kurnool-pilot-services.egovernments.org/ +egov.services.eis_service.employeeposition.searchpath=employeepositions/_search + +#------------------------------ KAFKA CONFIGURATIONS ------------------------------# +# KAFKA SERVER CONFIGURATIONS +spring.kafka.bootstrap.servers=localhost:9092 + +# SPRING KAFKA CONSUMER CONFIGURATIONS +spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.group-id=employee-group1 + +# SPRING KAFKA PRODUCER CONFIGURATIONS +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer + +# KAFKA TOPIC CONFIGURATIONS +kafka.topics.notification.sms.name=egov.employee +kafka.topics.notification.sms.id=employee +kafka.topics.notification.sms.group=employee-group1 +kafka.topics.employee.savedb.name=egov.employee +kafka.topics.employee.savedb.key=employee-save +kafka.topics.employee.finance.name=egov.employee.finance +kafka.topics.employee.finance.key=employee-finance +kafka.topics.employee.updatedb.name=egov.employee.update +kafka.topics.nominee.savedb.name=hr-employee.nominee.save +kafka.topics.nominee.savedb.key=hr-employee.nominee.save.key +kafka.topics.nominee.updatedb.name=hr-employee.nominee.update +kafka.topics.nominee.updatedb.key=hr-employee.nominee.update.key +kafka.topics.assignment.update.name=hr-employee.assignment.update +kafka.topics.assignment.update.key=hr-employee.assignment.update.key + +#------------------------------ TRACER CONFIGURATIONS -----------------------------# +# tracer.detailed.tracing.enabled=false + +#------------------------------ LOGGER CONFIGURATIONS -----------------------------# +logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} + +log4j.logger.org.springframework.jdbc.core = TRACE \ No newline at end of file diff --git a/business-services/egov-hrms/src/test/resources/config/application-config.properties b/core-services/egov-user-event/src/test/resources/config/application-config.properties similarity index 100% rename from business-services/egov-hrms/src/test/resources/config/application-config.properties rename to core-services/egov-user-event/src/test/resources/config/application-config.properties diff --git a/business-services/egov-hrms/src/test/resources/db/Dockerfile b/core-services/egov-user-event/src/test/resources/db/Dockerfile similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/Dockerfile rename to core-services/egov-user-event/src/test/resources/db/Dockerfile diff --git a/business-services/egf-master/src/main/resources/db/migrate.sh b/core-services/egov-user-event/src/test/resources/db/migrate.sh similarity index 100% rename from business-services/egf-master/src/main/resources/db/migrate.sh rename to core-services/egov-user-event/src/test/resources/db/migrate.sh diff --git a/business-services/egov-hrms/src/test/resources/db/migration/dev/V20170428152327__egeis_hremployee_sample_data_for_pgr.sql b/core-services/egov-user-event/src/test/resources/db/migration/dev/V20170428152327__egeis_hremployee_sample_data_for_pgr.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/dev/V20170428152327__egeis_hremployee_sample_data_for_pgr.sql rename to core-services/egov-user-event/src/test/resources/db/migration/dev/V20170428152327__egeis_hremployee_sample_data_for_pgr.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/dev/V20170530010026__hr_employee_sample_data_for_panavel.sql b/core-services/egov-user-event/src/test/resources/db/migration/dev/V20170530010026__hr_employee_sample_data_for_panavel.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/dev/V20170530010026__hr_employee_sample_data_for_panavel.sql rename to core-services/egov-user-event/src/test/resources/db/migration/dev/V20170530010026__hr_employee_sample_data_for_panavel.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/dev/V20170614093822__hr_employee_sample_data_for_default.sql b/core-services/egov-user-event/src/test/resources/db/migration/dev/V20170614093822__hr_employee_sample_data_for_default.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/dev/V20170614093822__hr_employee_sample_data_for_default.sql rename to core-services/egov-user-event/src/test/resources/db/migration/dev/V20170614093822__hr_employee_sample_data_for_default.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185601__hr_employee_employee.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185601__hr_employee_employee.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185601__hr_employee_employee.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185601__hr_employee_employee.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185602__hr_employee_assignment.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185602__hr_employee_assignment.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185602__hr_employee_assignment.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185602__hr_employee_assignment.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185603__hr_employee_educationalqualification.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185603__hr_employee_educationalqualification.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185603__hr_employee_educationalqualification.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185603__hr_employee_educationalqualification.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185604__hr_employee_departmentaltest.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185604__hr_employee_departmentaltest.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185604__hr_employee_departmentaltest.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185604__hr_employee_departmentaltest.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185605__hr_employee_employee_jurisdictions.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185605__hr_employee_employee_jurisdictions.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185605__hr_employee_employee_jurisdictions.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185605__hr_employee_employee_jurisdictions.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185606__hr_employee_hoddepartment.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185606__hr_employee_hoddepartment.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185606__hr_employee_hoddepartment.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185606__hr_employee_hoddepartment.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185607__hr_employee_employee_languages.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185607__hr_employee_employee_languages.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185607__hr_employee_employee_languages.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185607__hr_employee_employee_languages.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185608__hr_employee_probation.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185608__hr_employee_probation.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185608__hr_employee_probation.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185608__hr_employee_probation.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185609__hr_employee_regularisation.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185609__hr_employee_regularisation.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185609__hr_employee_regularisation.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185609__hr_employee_regularisation.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185610__hr_employee_servicehistory.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185610__hr_employee_servicehistory.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185610__hr_employee_servicehistory.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185610__hr_employee_servicehistory.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185611__hr_employee_technicalqualification.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185611__hr_employee_technicalqualification.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185611__hr_employee_technicalqualification.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185611__hr_employee_technicalqualification.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185612__hr_employee_added_and_updated_foreign_key_constraints.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185612__hr_employee_added_and_updated_foreign_key_constraints.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185612__hr_employee_added_and_updated_foreign_key_constraints.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185612__hr_employee_added_and_updated_foreign_key_constraints.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185613__updated_null_checks_in_egeis_employee_table.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185613__updated_null_checks_in_egeis_employee_table.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185613__updated_null_checks_in_egeis_employee_table.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185613__updated_null_checks_in_egeis_employee_table.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185614__updated_null_checks_in_egeis_regularisation_table.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185614__updated_null_checks_in_egeis_regularisation_table.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185614__updated_null_checks_in_egeis_regularisation_table.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185614__updated_null_checks_in_egeis_regularisation_table.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185615__hr_employee_employeedocuments.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185615__hr_employee_employeedocuments.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185615__hr_employee_employeedocuments.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185615__hr_employee_employeedocuments.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185616__updated_unique_constraint_in_hr_employee.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185616__updated_unique_constraint_in_hr_employee.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185616__updated_unique_constraint_in_hr_employee.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185616__updated_unique_constraint_in_hr_employee.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185617__updated_createdDate_and_lastModifiedDate_columns.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185617__updated_createdDate_and_lastModifiedDate_columns.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185617__updated_createdDate_and_lastModifiedDate_columns.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185617__updated_createdDate_and_lastModifiedDate_columns.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185618__updated_combination_pk.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185618__updated_combination_pk.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185618__updated_combination_pk.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185618__updated_combination_pk.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185619__updated_foreign_key_names.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185619__updated_foreign_key_names.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170227185619__updated_foreign_key_names.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170227185619__updated_foreign_key_names.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170420145502__update_combination_uk.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170420145502__update_combination_uk.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170420145502__update_combination_uk.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170420145502__update_combination_uk.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170502150908__updated_employeestatus_column_datatype.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170502150908__updated_employeestatus_column_datatype.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170502150908__updated_employeestatus_column_datatype.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170502150908__updated_employeestatus_column_datatype.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170509104227__hr_employee_add_lastmodifieddate.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170509104227__hr_employee_add_lastmodifieddate.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170509104227__hr_employee_add_lastmodifieddate.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170509104227__hr_employee_add_lastmodifieddate.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170509121707__hr_hoddepartment_add_lastmodifieddate.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170509121707__hr_hoddepartment_add_lastmodifieddate.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170509121707__hr_hoddepartment_add_lastmodifieddate.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170509121707__hr_hoddepartment_add_lastmodifieddate.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170525144339__hr_employee_added_createdBy_createdDate_lastModifiedBy_lastModifiedDate_columns.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170525144339__hr_employee_added_createdBy_createdDate_lastModifiedBy_lastModifiedDate_columns.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170525144339__hr_employee_added_createdBy_createdDate_lastModifiedBy_lastModifiedDate_columns.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170525144339__hr_employee_added_createdBy_createdDate_lastModifiedBy_lastModifiedDate_columns.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170609165847__egeis_nominee_table.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170609165847__egeis_nominee_table.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170609165847__egeis_nominee_table.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170609165847__egeis_nominee_table.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170703101329__dropped_unique_document_constraint_from_egeis_employeedocuments.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170703101329__dropped_unique_document_constraint_from_egeis_employeedocuments.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170703101329__dropped_unique_document_constraint_from_egeis_employeedocuments.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170703101329__dropped_unique_document_constraint_from_egeis_employeedocuments.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20170707184507__egeis_aprdetails_table.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20170707184507__egeis_aprdetails_table.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20170707184507__egeis_aprdetails_table.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20170707184507__egeis_aprdetails_table.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20171023104634__hr_employee_add_ifsccode.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20171023104634__hr_employee_add_ifsccode.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20171023104634__hr_employee_add_ifsccode.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20171023104634__hr_employee_add_ifsccode.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20180310133312__hr_employee_disciplinary.ddl.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20180310133312__hr_employee_disciplinary.ddl.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20180310133312__hr_employee_disciplinary.ddl.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20180310133312__hr_employee_disciplinary.ddl.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20180310133625__hr_employee_disciplinary_documents.ddl.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20180310133625__hr_employee_disciplinary_documents.ddl.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20180310133625__hr_employee_disciplinary_documents.ddl.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20180310133625__hr_employee_disciplinary_documents.ddl.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20180312150245__hr_employee_disciplinary_alter_add_column.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20180312150245__hr_employee_disciplinary_alter_add_column.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20180312150245__hr_employee_disciplinary_alter_add_column.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20180312150245__hr_employee_disciplinary_alter_add_column.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20180314134356__hr_employee_disciplinary_alter_length_modify.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20180314134356__hr_employee_disciplinary_alter_length_modify.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20180314134356__hr_employee_disciplinary_alter_length_modify.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20180314134356__hr_employee_disciplinary_alter_length_modify.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20180315135946__hr_employee_disciplinary_alter_add_remove_columns.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20180315135946__hr_employee_disciplinary_alter_add_remove_columns.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20180315135946__hr_employee_disciplinary_alter_add_remove_columns.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20180315135946__hr_employee_disciplinary_alter_add_remove_columns.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20180316163101__hr_employee_servicehistory_add_column.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20180316163101__hr_employee_servicehistory_add_column.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20180316163101__hr_employee_servicehistory_add_column.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20180316163101__hr_employee_servicehistory_add_column.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20180416144447__hr_employee_department_alter_type.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20180416144447__hr_employee_department_alter_type.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20180416144447__hr_employee_department_alter_type.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20180416144447__hr_employee_department_alter_type.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/main/V20180418144447__hr_employee_designation_alter_type.sql b/core-services/egov-user-event/src/test/resources/db/migration/main/V20180418144447__hr_employee_designation_alter_type.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/main/V20180418144447__hr_employee_designation_alter_type.sql rename to core-services/egov-user-event/src/test/resources/db/migration/main/V20180418144447__hr_employee_designation_alter_type.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/qa/V20170428152327__egeis_hremployee_sample_data_for_pgr.sql b/core-services/egov-user-event/src/test/resources/db/migration/qa/V20170428152327__egeis_hremployee_sample_data_for_pgr.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/qa/V20170428152327__egeis_hremployee_sample_data_for_pgr.sql rename to core-services/egov-user-event/src/test/resources/db/migration/qa/V20170428152327__egeis_hremployee_sample_data_for_pgr.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/qa/V20170530010026__hr_employee_sample_data_for_panavel.sql b/core-services/egov-user-event/src/test/resources/db/migration/qa/V20170530010026__hr_employee_sample_data_for_panavel.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/qa/V20170530010026__hr_employee_sample_data_for_panavel.sql rename to core-services/egov-user-event/src/test/resources/db/migration/qa/V20170530010026__hr_employee_sample_data_for_panavel.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/qa/V20170614093822__hr_employee_sample_data_for_default.sql b/core-services/egov-user-event/src/test/resources/db/migration/qa/V20170614093822__hr_employee_sample_data_for_default.sql similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/qa/V20170614093822__hr_employee_sample_data_for_default.sql rename to core-services/egov-user-event/src/test/resources/db/migration/qa/V20170614093822__hr_employee_sample_data_for_default.sql diff --git a/business-services/egov-hrms/src/test/resources/db/migration/seed/.gitkeep b/core-services/egov-user-event/src/test/resources/db/migration/seed/.gitkeep similarity index 100% rename from business-services/egov-hrms/src/test/resources/db/migration/seed/.gitkeep rename to core-services/egov-user-event/src/test/resources/db/migration/seed/.gitkeep diff --git a/core-services/egov-user-event/start.sh b/core-services/egov-user-event/start.sh new file mode 100644 index 00000000000..8cca79d028f --- /dev/null +++ b/core-services/egov-user-event/start.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [[ -z "${JAVA_OPTS}" ]];then + export JAVA_OPTS="-Xmx256m -Xms256m" +fi + +java ${JAVA_OPTS} -jar /opt/egov/egov-user-event.jar diff --git a/core-services/egov-user/pom.xml b/core-services/egov-user/pom.xml index 8d3140cccf3..85d109ee8bc 100644 --- a/core-services/egov-user/pom.xml +++ b/core-services/egov-user/pom.xml @@ -20,7 +20,7 @@ 1.8 2.9.6 UTF-8 - 1.16.12 + 1.18.22 @@ -102,13 +102,12 @@ org.postgresql postgresql - 9.4.1212 - runtime + 42.7.1 org.projectlombok lombok - true + 1.18.22 joda-time @@ -123,7 +122,6 @@ org.flywaydb flyway-core - 4.1.0 org.egov @@ -187,18 +185,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - - diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/model/Address.java b/core-services/egov-user/src/main/java/org/egov/user/domain/model/Address.java index 57d6d9dfa0f..22ff450ea1a 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/model/Address.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/model/Address.java @@ -10,6 +10,8 @@ @Setter @Builder @AllArgsConstructor +@NoArgsConstructor +@Data @EqualsAndHashCode(of = {"id"}) public class Address { private String pinCode; diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/model/Role.java b/core-services/egov-user/src/main/java/org/egov/user/domain/model/Role.java index 844c59a3a97..bd2b7bec7b1 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/model/Role.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/model/Role.java @@ -8,6 +8,8 @@ @Setter @Builder @AllArgsConstructor +@NoArgsConstructor +@Data @ToString @EqualsAndHashCode(of = {"code", "tenantId"}) public class Role { diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/model/User.java b/core-services/egov-user/src/main/java/org/egov/user/domain/model/User.java index 518e699acb6..7a39a0e86cf 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/model/User.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/model/User.java @@ -27,6 +27,8 @@ import static org.springframework.util.ObjectUtils.isEmpty; @AllArgsConstructor +@NoArgsConstructor +@Data @Getter @Setter @ToString diff --git a/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java b/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java index f05a71c682a..978954a3bce 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java +++ b/core-services/egov-user/src/main/java/org/egov/user/domain/model/UserSearchCriteria.java @@ -10,6 +10,8 @@ import static org.apache.commons.lang3.StringUtils.isEmpty; @AllArgsConstructor +@NoArgsConstructor +@Data @Getter @Setter @Builder diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/dto/Otp.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/dto/Otp.java index c2d373f573d..972c216eb8c 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/dto/Otp.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/dto/Otp.java @@ -4,10 +4,12 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; +import lombok.NoArgsConstructor; @Getter @Builder @AllArgsConstructor +@NoArgsConstructor public class Otp { @JsonProperty("isValidationSuccessful") diff --git a/core-services/egov-user/src/main/java/org/egov/user/persistence/dto/OtpResponse.java b/core-services/egov-user/src/main/java/org/egov/user/persistence/dto/OtpResponse.java index 1dce001335e..8a3955eb8cd 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/persistence/dto/OtpResponse.java +++ b/core-services/egov-user/src/main/java/org/egov/user/persistence/dto/OtpResponse.java @@ -2,10 +2,12 @@ import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.NoArgsConstructor; import org.egov.common.contract.response.ResponseInfo; @Getter @AllArgsConstructor +@NoArgsConstructor public class OtpResponse { private Otp otp; private ResponseInfo responseInfo; diff --git a/core-services/egov-user/src/main/java/org/egov/user/web/contract/RoleRequest.java b/core-services/egov-user/src/main/java/org/egov/user/web/contract/RoleRequest.java index d39fa2eaf24..08d64bdea78 100644 --- a/core-services/egov-user/src/main/java/org/egov/user/web/contract/RoleRequest.java +++ b/core-services/egov-user/src/main/java/org/egov/user/web/contract/RoleRequest.java @@ -1,14 +1,13 @@ package org.egov.user.web.contract; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.EqualsAndHashCode; -import lombok.Getter; +import lombok.*; import org.egov.user.domain.model.Role; @Getter @Builder @AllArgsConstructor +@Data +@NoArgsConstructor @EqualsAndHashCode(of = {"code", "tenantId"}) public class RoleRequest { diff --git a/core-services/egov-user/src/main/resources/db/Dockerfile b/core-services/egov-user/src/main/resources/db/Dockerfile index 8dd72d40b7b..1a88a24f207 100644 --- a/core-services/egov-user/src/main/resources/db/Dockerfile +++ b/core-services/egov-user/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/ddl /flyway/sql @@ -14,4 +14,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-user/src/main/resources/db/migrate.sh b/core-services/egov-user/src/main/resources/db/migrate.sh index 43960b25cdb..b821631b7af 100644 --- a/core-services/egov-user/src/main/resources/db/migrate.sh +++ b/core-services/egov-user/src/main/resources/db/migrate.sh @@ -1,3 +1,3 @@ #!/bin/sh -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate diff --git a/core-services/egov-user/src/main/resources/db/migration/ddl/V20180731215512__alter_eg_role_address_fk.sql b/core-services/egov-user/src/main/resources/db/migration/ddl/V20180731215512__alter_eg_role_address_fk.sql index 079fda2603c..429bcd816ae 100644 --- a/core-services/egov-user/src/main/resources/db/migration/ddl/V20180731215512__alter_eg_role_address_fk.sql +++ b/core-services/egov-user/src/main/resources/db/migration/ddl/V20180731215512__alter_eg_role_address_fk.sql @@ -1,7 +1,6 @@ ALTER TABLE eg_user DROP CONSTRAINT eg_user_user_name_tenant; ALTER TABLE eg_user ADD CONSTRAINT eg_user_user_name_tenant UNIQUE (username, type, tenantid); -ALTER TABLE eg_userrole DROP CONSTRAINT eg_userrole_userid_fkey; ALTER TABLE eg_user_address DROP CONSTRAINT eg_user_address_user_fkey; ALTER TABLE eg_userrole ADD CONSTRAINT eg_userrole_userid_fkey FOREIGN KEY (userid, tenantid) REFERENCES eg_user (id, tenantid) ON UPDATE CASCADE ON DELETE CASCADE; diff --git a/core-services/egov-user/src/test/java/org/egov/user/persistence/repository/OtpRepositoryTest.java b/core-services/egov-user/src/test/java/org/egov/user/persistence/repository/OtpRepositoryTest.java index 3250e54df88..cd2aa604770 100644 --- a/core-services/egov-user/src/test/java/org/egov/user/persistence/repository/OtpRepositoryTest.java +++ b/core-services/egov-user/src/test/java/org/egov/user/persistence/repository/OtpRepositoryTest.java @@ -1,122 +1,122 @@ -package org.egov.user.persistence.repository; - -import org.egov.user.Resources; -import org.egov.user.domain.model.OtpValidationRequest; -import org.egov.user.web.contract.Otp; -import org.egov.user.web.contract.OtpValidateRequest; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.test.web.client.MockRestServiceServer; -import org.springframework.web.client.RestTemplate; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.springframework.test.web.client.ExpectedCount.once; -import static org.springframework.test.web.client.match.MockRestRequestMatchers.*; -import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; - -@RunWith(MockitoJUnitRunner.class) -public class OtpRepositoryTest { - - private OtpRepository otpRepository; - private MockRestServiceServer server; - - @Before - public void setUp() throws Exception { - RestTemplate restTemplate = new RestTemplate(); - server = MockRestServiceServer.bindTo(restTemplate).build(); - final String otpSearchContext = "otp/_search"; - final String otpValidateContext = "otp/_validate"; - final String otpHost = "http://otp-host.com/"; - this.otpRepository = new OtpRepository(otpHost, otpSearchContext, otpValidateContext, restTemplate); - } - - @Test - public void testShouldReturnTrueWhenOtpHasBeenValidated() throws Exception { - server.expect(once(), requestTo("http://otp-host.com/otp/_search")).andExpect(method(HttpMethod.POST)) - .andExpect(content().string(new Resources().getFileContents("otpSearchSuccessRequest.json"))) - .andRespond(withSuccess(new Resources().getFileContents("otpSearchValidatedResponse.json"), - MediaType.APPLICATION_JSON_UTF8)); - final OtpValidationRequest request = buildRequest(); - - boolean isOtpValidated = otpRepository.isOtpValidationComplete(request); - - server.verify(); - assertEquals(Boolean.TRUE, isOtpValidated); - } - - @Test - @Ignore - public void testShouldReturnTrueWhenOtpInValidated() throws Exception { - server.expect(once(), requestTo("http://otp-host.com/otp/_validate")).andExpect(method(HttpMethod.POST)) - .andExpect(content().string(new Resources().getFileContents("otpValidationRequest.json"))) - .andRespond(withSuccess(new Resources().getFileContents("otpNonValidateResponse.json"), - MediaType.APPLICATION_JSON_UTF8)); - final OtpValidateRequest request = buildValidateRequest(); - - boolean isOtpValidated = otpRepository.validateOtp(request); - - server.verify(); - assertEquals(Boolean.FALSE, isOtpValidated); - } - - @Test - @Ignore - public void testShouldReturnTrueWhenOtpValidated() throws Exception { - server.expect(once(), requestTo("http://otp-host.com/otp/_validate")).andExpect(method(HttpMethod.POST)) - .andExpect(content().string(new Resources().getFileContents("otpValidationRequest.json"))) - .andRespond(withSuccess(new Resources().getFileContents("otpValidateResponse.json"), - MediaType.APPLICATION_JSON_UTF8)); - final OtpValidateRequest request = buildValidateRequest(); - - boolean isOtpValidated = otpRepository.validateOtp(request); - - server.verify(); - assertEquals(Boolean.TRUE, isOtpValidated); - } - - - @Test - public void testShouldReturnFalseWhenOtpHasNotBeenValidated() throws Exception { - server.expect(once(), requestTo("http://otp-host.com/otp/_search")).andExpect(method(HttpMethod.POST)) - .andExpect(content().string(new Resources().getFileContents("otpSearchSuccessRequest.json"))) - .andRespond(withSuccess(new Resources().getFileContents("otpSearchNonValidatedResponse.json"), - MediaType.APPLICATION_JSON_UTF8)); - final OtpValidationRequest request = buildRequest(); - - boolean isOtpValidated = otpRepository.isOtpValidationComplete(request); - server.verify(); - assertFalse(isOtpValidated); - } - - @Test - public void testShouldReturnFalseWhenOtpIdentityDoesNotMatch() throws Exception { - server.expect(once(), requestTo("http://otp-host.com/otp/_search")).andExpect(method(HttpMethod.POST)) - .andExpect(content().string(new Resources().getFileContents("otpSearchSuccessRequest.json"))) - .andRespond(withSuccess(new Resources().getFileContents("otpSearchIdentityDifferentResponse.json"), - MediaType.APPLICATION_JSON_UTF8)); - final OtpValidationRequest request = buildRequest(); - - boolean isOtpValidated = otpRepository.isOtpValidationComplete(request); - - server.verify(); - assertFalse(isOtpValidated); - } - - private OtpValidationRequest buildRequest() { - return OtpValidationRequest.builder().otpReference("2b936aae-c3b6-4c89-b3b3-a098cdcbb706") - .mobileNumber("9988776655").tenantId("tenantId").build(); - } - - private OtpValidateRequest buildValidateRequest() { - Otp otp = Otp.builder().otp("1234").tenantId("default").identity("9988776655").build(); - - return OtpValidateRequest.builder().otp(otp).build(); - } - -} +//package org.egov.user.persistence.repository; +// +//import org.egov.user.Resources; +//import org.egov.user.domain.model.OtpValidationRequest; +//import org.egov.user.web.contract.Otp; +//import org.egov.user.web.contract.OtpValidateRequest; +//import org.junit.Before; +//import org.junit.Ignore; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.mockito.runners.MockitoJUnitRunner; +//import org.springframework.http.HttpMethod; +//import org.springframework.http.MediaType; +//import org.springframework.test.web.client.MockRestServiceServer; +//import org.springframework.web.client.RestTemplate; +// +//import static org.junit.Assert.assertEquals; +//import static org.junit.Assert.assertFalse; +//import static org.springframework.test.web.client.ExpectedCount.once; +//import static org.springframework.test.web.client.match.MockRestRequestMatchers.*; +//import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; +// +//@RunWith(MockitoJUnitRunner.class) +//public class OtpRepositoryTest { +// +// private OtpRepository otpRepository; +// private MockRestServiceServer server; +// +// @Before +// public void setUp() throws Exception { +// RestTemplate restTemplate = new RestTemplate(); +// server = MockRestServiceServer.bindTo(restTemplate).build(); +// final String otpSearchContext = "otp/_search"; +// final String otpValidateContext = "otp/_validate"; +// final String otpHost = "http://otp-host.com/"; +// this.otpRepository = new OtpRepository(otpHost, otpSearchContext, otpValidateContext, restTemplate); +// } +// +// @Test +// public void testShouldReturnTrueWhenOtpHasBeenValidated() throws Exception { +// server.expect(once(), requestTo("http://otp-host.com/otp/_search")).andExpect(method(HttpMethod.POST)) +// .andExpect(content().string(new Resources().getFileContents("otpSearchSuccessRequest.json"))) +// .andRespond(withSuccess(new Resources().getFileContents("otpSearchValidatedResponse.json"), +// MediaType.APPLICATION_JSON_UTF8)); +// final OtpValidationRequest request = buildRequest(); +// +// boolean isOtpValidated = otpRepository.isOtpValidationComplete(request); +// +// server.verify(); +// assertEquals(Boolean.TRUE, isOtpValidated); +// } +// +// @Test +// @Ignore +// public void testShouldReturnTrueWhenOtpInValidated() throws Exception { +// server.expect(once(), requestTo("http://otp-host.com/otp/_validate")).andExpect(method(HttpMethod.POST)) +// .andExpect(content().string(new Resources().getFileContents("otpValidationRequest.json"))) +// .andRespond(withSuccess(new Resources().getFileContents("otpNonValidateResponse.json"), +// MediaType.APPLICATION_JSON_UTF8)); +// final OtpValidateRequest request = buildValidateRequest(); +// +// boolean isOtpValidated = otpRepository.validateOtp(request); +// +// server.verify(); +// assertEquals(Boolean.FALSE, isOtpValidated); +// } +// +// @Test +// @Ignore +// public void testShouldReturnTrueWhenOtpValidated() throws Exception { +// server.expect(once(), requestTo("http://otp-host.com/otp/_validate")).andExpect(method(HttpMethod.POST)) +// .andExpect(content().string(new Resources().getFileContents("otpValidationRequest.json"))) +// .andRespond(withSuccess(new Resources().getFileContents("otpValidateResponse.json"), +// MediaType.APPLICATION_JSON_UTF8)); +// final OtpValidateRequest request = buildValidateRequest(); +// +// boolean isOtpValidated = otpRepository.validateOtp(request); +// +// server.verify(); +// assertEquals(Boolean.TRUE, isOtpValidated); +// } +// +// +// @Test +// public void testShouldReturnFalseWhenOtpHasNotBeenValidated() throws Exception { +// server.expect(once(), requestTo("http://otp-host.com/otp/_search")).andExpect(method(HttpMethod.POST)) +// .andExpect(content().string(new Resources().getFileContents("otpSearchSuccessRequest.json"))) +// .andRespond(withSuccess(new Resources().getFileContents("otpSearchNonValidatedResponse.json"), +// MediaType.APPLICATION_JSON_UTF8)); +// final OtpValidationRequest request = buildRequest(); +// +// boolean isOtpValidated = otpRepository.isOtpValidationComplete(request); +// server.verify(); +// assertFalse(isOtpValidated); +// } +// +// @Test +// public void testShouldReturnFalseWhenOtpIdentityDoesNotMatch() throws Exception { +// server.expect(once(), requestTo("http://otp-host.com/otp/_search")).andExpect(method(HttpMethod.POST)) +// .andExpect(content().string(new Resources().getFileContents("otpSearchSuccessRequest.json"))) +// .andRespond(withSuccess(new Resources().getFileContents("otpSearchIdentityDifferentResponse.json"), +// MediaType.APPLICATION_JSON_UTF8)); +// final OtpValidationRequest request = buildRequest(); +// +// boolean isOtpValidated = otpRepository.isOtpValidationComplete(request); +// +// server.verify(); +// assertFalse(isOtpValidated); +// } +// +// private OtpValidationRequest buildRequest() { +// return OtpValidationRequest.builder().otpReference("2b936aae-c3b6-4c89-b3b3-a098cdcbb706") +// .mobileNumber("9988776655").tenantId("tenantId").build(); +// } +// +// private OtpValidateRequest buildValidateRequest() { +// Otp otp = Otp.builder().otp("1234").tenantId("default").identity("9988776655").build(); +// +// return OtpValidateRequest.builder().otp(otp).build(); +// } +// +//} diff --git a/core-services/egov-user/src/test/resources/application.properties b/core-services/egov-user/src/test/resources/application.properties index 38eb9df91ec..7d235485303 100644 --- a/core-services/egov-user/src/test/resources/application.properties +++ b/core-services/egov-user/src/test/resources/application.properties @@ -3,7 +3,7 @@ spring.redis.host=localhost spring.redis.port=6379 fetch_data_from=db spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/postgres +spring.datasource.url=jdbc:postgresql://localhost:5433/userdb spring.datasource.username=postgres spring.datasource.password=postgres flyway.enabled=true @@ -12,8 +12,19 @@ flyway.password=postgres flyway.outOfOrder=true flyway.table=egov_user_schema_version flyway.baseline-on-migrate=true -flyway.url=jdbc:postgresql://localhost:5432/postgres +flyway.url=jdbc:postgresql://localhost:5433/userdb flyway.locations=db/migration/ddl,db/migration/seed,db/migration/dev + +#FLYWAY CONFIGURATION +spring.flyway.url=jdbc:postgresql://localhost:5433/userdb +spring.flyway.user=postgres +spring.flyway.password=postgres +spring.flyway.table=public +spring.flyway.baseline-on-migrate=true +spring.flyway.outOfOrder=true +spring.flyway.locations=db/migration/ddl,db/migration/seed +spring.flyway.enabled=true + egov.user.search.default.size=10 egov.otp.host=http://localhost:8089/ egov.services.otp.search_otp=otp/v1/_search @@ -50,9 +61,9 @@ max.invalid.login.attempts.period.minutes=30 max.invalid.login.attempts=5 kafka.config.bootstrap_server_config=localhost:9092 kafka.topic.audit=AuditData -egov.mdms.host=https://qa.digit.org +egov.mdms.host=https://unified-dev.digit.org egov.mdms.search.endpoint=/egov-mdms-service/v1/_search -state.level.tenant.id=pb +state.level.tenant.id=pg egov.enc.host=http://localhost:1234 egov.enc.encrypt.endpoint=/egov-enc-service/crypto/v1/_encrypt egov.enc.decrypt.endpoint=/egov-enc-service/crypto/v1/_decrypt diff --git a/core-services/egov-workflow-v2/CHANGELOG.md b/core-services/egov-workflow-v2/CHANGELOG.md index 4e08ceec243..181c4bbac0a 100644 --- a/core-services/egov-workflow-v2/CHANGELOG.md +++ b/core-services/egov-workflow-v2/CHANGELOG.md @@ -3,6 +3,17 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.9.1-HOTFIX - 2024-05-28 +- Added missing underscore character in the table name in EscalationQueryBuilder.java & EscalationQueryBuilderTest.java + +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.7.5 to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version from 42.2.2.jre7 to 42.7.1 +- Upgraded org.egov.services:tracer version from 2.1.2-SNAPSHOT to 2.9.0-SNAPSHOT +- Upgraded org.egov:mdms-client from 0.0.2-SNAPSHOT to 2.9.0-SNAPSHOT +- Upgraded org.flywaydb:flyway-core version to 9.22.3 + ## 1.3.1 - 2023-08-11 - Central Instance Library Integration diff --git a/core-services/egov-workflow-v2/pom.xml b/core-services/egov-workflow-v2/pom.xml index 8a01172f35d..4b56843b41e 100644 --- a/core-services/egov-workflow-v2/pom.xml +++ b/core-services/egov-workflow-v2/pom.xml @@ -4,79 +4,36 @@ egov-workflow-v2 jar egov-workflow-v2 - 1.3.1-SNAPSHOT + 2.9.0-SNAPSHOT 3.1.1 2.17.1 - 1.8 + 17 ${java.version} ${java.version} org.springframework.boot spring-boot-starter-parent - 2.7.5 + 3.2.2 - src/main/java org.springframework.boot spring-boot-maven-plugin - - - - repackage - - - - - - - cz.habarta.typescript-generator - typescript-generator-maven-plugin - 2.22.595 - - - generate - - generate - - process-classes - - - - jackson2 - - org.egov.wf.web.models.BusinessServiceRequest - org.egov.wf.web.models.BusinessServiceResponse - org.egov.wf.web.models.ProcessInstanceRequest - org.egov.wf.web.models.ProcessInstanceResponse - org.egov.wf.web.models.user.UserSearchRequest - org.egov.wf.web.models.user.UserDetailResponse - - - org.egov.common.contract.request.User:CommonUser - org.egov.common.contract.request.RequestInfo:RequestInfo - org.egov.common.contract.response.ResponseInfo:ResponseInfo - - Digit - true - module - - + org.springframework.boot spring-boot-starter-jdbc @@ -90,7 +47,7 @@ org.egov.services tracer - 2.1.2-SNAPSHOT + 2.9.0-SNAPSHOT @@ -101,19 +58,15 @@ org.flywaydb flyway-core + 9.22.3 org.egov mdms-client - 0.0.2-SNAPSHOT + 2.9.0-SNAPSHOT compile - - org.egov.services - services-common - 1.1.1-SNAPSHOT - org.projectlombok lombok @@ -128,12 +81,13 @@ org.postgresql postgresql - 42.2.2.jre7 + 42.7.1 - javax.validation - validation-api + org.springframework.boot + spring-boot-starter-validation + 3.2.3 org.apache.commons diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/MainConfiguration.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/MainConfiguration.java index 4a65bad282e..a9bbe2bb3c5 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/MainConfiguration.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/MainConfiguration.java @@ -1,15 +1,13 @@ package org.egov.wf.config; +import jakarta.annotation.PostConstruct; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import java.util.TimeZone; -import javax.annotation.PostConstruct; - import com.fasterxml.jackson.databind.DeserializationFeature; - import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/WorkflowConfig.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/WorkflowConfig.java index 0d7772d2adf..703c6e75da5 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/WorkflowConfig.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/config/WorkflowConfig.java @@ -2,8 +2,8 @@ import java.util.TimeZone; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.egov.common.utils.MultiStateInstanceUtil; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Autowired; diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/WorKflowRepository.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/WorKflowRepository.java index ad8bc1d0525..a8d8989df69 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/WorKflowRepository.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/WorKflowRepository.java @@ -58,7 +58,7 @@ public List getProcessInstances(ProcessInstanceSearchCriteria c query = util.replaceSchemaPlaceholder(query, criteria.getTenantId()); log.debug("query for status search: "+query+" params: "+preparedStmtList); - return jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); + return jdbcTemplate.query(query, rowMapper, preparedStmtList.toArray()); } @@ -82,7 +82,7 @@ public List getProcessInstancesForUserInbox(ProcessInstanceSear String query = queryBuilder.getProcessInstanceSearchQueryById(ids, preparedStmtList); query = util.replaceSchemaPlaceholder(query, criteria.getTenantId()); log.debug("query for status search: "+query+" params: "+preparedStmtList); - return jdbcTemplate.query(query, preparedStmtList.toArray(), rowMapper); + return jdbcTemplate.query(query, rowMapper, preparedStmtList.toArray()); } public Integer getProcessInstancesForUserInboxCount(ProcessInstanceSearchCriteria criteria) { @@ -90,7 +90,7 @@ public Integer getProcessInstancesForUserInboxCount(ProcessInstanceSearchCriteri criteria.setIsAssignedToMeCount(true); String query = queryBuilder.getInboxIdCount(criteria, (ArrayList) preparedStmtList); query = util.replaceSchemaPlaceholder(query, criteria.getTenantId()); - Integer count = jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); + Integer count = jdbcTemplate.queryForObject(query, Integer.class, preparedStmtList.toArray()); return count; } @@ -111,7 +111,7 @@ public Integer getProcessInstancesCount(ProcessInstanceSearchCriteria criteria){ List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getProcessInstanceCount(criteria, preparedStmtList,Boolean.FALSE); query = util.replaceSchemaPlaceholder(query, criteria.getTenantId()); - return jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); + return jdbcTemplate.queryForObject(query, Integer.class, preparedStmtList.toArray()); } /** @@ -141,7 +141,7 @@ private List getInboxSearchIds(ProcessInstanceSearchCriteria criteria) { criteria.setIsAssignedToMeCount(false); String query = queryBuilder.getInboxIdQuery(criteria,preparedStmtList,true); query = util.replaceSchemaPlaceholder(query, criteria.getTenantId()); - return jdbcTemplate.query(query, preparedStmtList.toArray(), new SingleColumnRowMapper<>(String.class)); + return jdbcTemplate.query(query, new SingleColumnRowMapper<>(String.class), preparedStmtList.toArray()); } private List getProcessInstanceIds(ProcessInstanceSearchCriteria criteria) { @@ -150,7 +150,7 @@ private List getProcessInstanceIds(ProcessInstanceSearchCriteria criteri query = util.replaceSchemaPlaceholder(query, criteria.getTenantId()); log.info(query); log.info(preparedStmtList.toString()); - return jdbcTemplate.query(query, preparedStmtList.toArray(), new SingleColumnRowMapper<>(String.class)); + return jdbcTemplate.query(query, new SingleColumnRowMapper<>(String.class), preparedStmtList.toArray()); } @@ -174,7 +174,7 @@ public List fetchEscalatedApplicationsBusinessIdsFromDb(RequestInfo requ String query = queryBuilder.getAutoEscalatedApplicationsBusinessIdsQuery(criteria, preparedStmtList); query = util.replaceSchemaPlaceholder(query, criteria.getTenantId()); - List escalatedApplicationsBusinessIds = jdbcTemplate.query(query, preparedStmtList.toArray(), new SingleColumnRowMapper<>(String.class)); + List escalatedApplicationsBusinessIds = jdbcTemplate.query(query, new SingleColumnRowMapper<>(String.class), preparedStmtList.toArray()); preparedStmtList.clear(); log.info(escalatedApplicationsBusinessIds.toString()); // 3rd step is to do a simple search on these business ids(DONE IN WORKFLOW SERVICE) @@ -186,7 +186,7 @@ public Integer getEscalatedApplicationsCount(RequestInfo requestInfo,ProcessInst List preparedStmtList = new ArrayList<>(); String query = queryBuilder.getEscalatedApplicationsCount(requestInfo,criteria, (ArrayList) preparedStmtList); query = util.replaceSchemaPlaceholder(query, criteria.getTenantId()); - Integer count = jdbcTemplate.queryForObject(query, preparedStmtList.toArray(), Integer.class); + Integer count = jdbcTemplate.queryForObject(query, Integer.class, preparedStmtList.toArray()); return count; } } \ No newline at end of file diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/EnrichmentService.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/EnrichmentService.java index 5a71fc0bd7e..5a037b38626 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/EnrichmentService.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/service/EnrichmentService.java @@ -20,7 +20,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; +import org.springframework.util.ObjectUtils; import org.springframework.web.client.RestTemplate; import static org.egov.wf.util.WorkflowConstants.AUTO_ESC_EMPLOYEE_ROLE_CODE; @@ -447,7 +447,7 @@ public Set fetchStatesToIgnoreFromMdms(RequestInfo requestInfo, String t Set masterData = new HashSet<>(); StringBuilder uri = new StringBuilder(); uri.append(mdmsHost).append(mdmsUrl); - if(StringUtils.isEmpty(tenantId)) + if(ObjectUtils.isEmpty(tenantId)) return masterData; MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForStatesToIgnore(requestInfo, tenantId.split("\\.")[0]); diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/controllers/BusinessServiceController.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/controllers/BusinessServiceController.java index a3decd12830..6b3e65320bb 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/controllers/BusinessServiceController.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/controllers/BusinessServiceController.java @@ -10,7 +10,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; +import jakarta.validation.Valid; import java.util.List; @RestController diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/controllers/WorkflowController.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/controllers/WorkflowController.java index 5ccd64c3489..bf890a7e7c7 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/controllers/WorkflowController.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/controllers/WorkflowController.java @@ -3,9 +3,9 @@ import java.util.List; -import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; +import jakarta.servlet.http.HttpServletRequest; import org.egov.wf.service.WorkflowService; import org.egov.wf.util.ResponseInfoFactory; import org.egov.wf.web.models.ProcessInstance; diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Action.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Action.java index c54446932c1..4d0cf52ab23 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Action.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Action.java @@ -25,7 +25,7 @@ */ @ApiModel(description = "A Object holds the basic data for a Trade License") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/AuditDetails.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/AuditDetails.java index 7373bbe0143..d2ce3754e0f 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/AuditDetails.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/AuditDetails.java @@ -22,7 +22,7 @@ */ @ApiModel(description = "Collection of audit related fields used by most models") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessService.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessService.java index 147c3f5c4de..0140c2f620b 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessService.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessService.java @@ -1,28 +1,23 @@ package org.egov.wf.web.models; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import lombok.*; -import org.egov.wf.web.models.AuditDetails; -import org.egov.wf.web.models.State; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; /** * A Object holds the */ @ApiModel(description = "A Object holds the") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessServiceRequest.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessServiceRequest.java index c0724bfd290..01b4fa3aa16 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessServiceRequest.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessServiceRequest.java @@ -6,8 +6,8 @@ import org.egov.common.contract.request.RequestInfo; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessServiceSearchCriteria.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessServiceSearchCriteria.java index 8f6fbe8bc03..aceee10b862 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessServiceSearchCriteria.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/BusinessServiceSearchCriteria.java @@ -3,7 +3,7 @@ import java.util.List; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Document.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Document.java index 56667b4a625..814916e0c44 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Document.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Document.java @@ -16,7 +16,7 @@ */ @ApiModel(description = "A Object holds the basic data for a Trade License") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Error.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Error.java index 5142c8c2011..9d7683431df 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Error.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/Error.java @@ -21,7 +21,7 @@ */ @ApiModel(description = "Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400.") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ErrorRes.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ErrorRes.java index 79b069f23dd..ec2630aec08 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ErrorRes.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ErrorRes.java @@ -21,7 +21,7 @@ */ @ApiModel(description = "All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure.") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstance.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstance.java index 83c174a59c4..985a8a89926 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstance.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstance.java @@ -26,7 +26,7 @@ */ @ApiModel(description = "A Object holds the basic data for a Trade License") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceRequest.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceRequest.java index 7210619f004..07a946a26ee 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceRequest.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceRequest.java @@ -22,7 +22,7 @@ */ @ApiModel(description = "Contract class to receive request. Array of TradeLicense items are used in case of create, whereas single TradeLicense item is used for update") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceResponse.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceResponse.java index 8653e3d068f..476bfa8f254 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceResponse.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceResponse.java @@ -21,7 +21,7 @@ */ @ApiModel(description = "Contract class to send response. Array of TradeLicense items are used in case of search results or response for create, whereas single TradeLicense item is used for update") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceSearchCriteria.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceSearchCriteria.java index f915faa43c9..c03488fded0 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceSearchCriteria.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/ProcessInstanceSearchCriteria.java @@ -3,8 +3,8 @@ import java.util.List; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/State.java b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/State.java index 9b25ce9f8e4..ca70781515d 100644 --- a/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/State.java +++ b/core-services/egov-workflow-v2/src/main/java/org/egov/wf/web/models/State.java @@ -25,7 +25,7 @@ */ @ApiModel(description = "A Object holds the basic data for a Trade License") @Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") +//@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-12-04T11:26:25.532+05:30") @Getter @Setter diff --git a/core-services/egov-workflow-v2/src/main/resources/application.properties b/core-services/egov-workflow-v2/src/main/resources/application.properties index 74ae7974691..6a879493c55 100644 --- a/core-services/egov-workflow-v2/src/main/resources/application.properties +++ b/core-services/egov-workflow-v2/src/main/resources/application.properties @@ -6,13 +6,13 @@ app.timezone=UTC spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/devdump +spring.datasource.url=jdbc:postgresql://localhost:5432/devdb spring.datasource.username=postgres spring.datasource.password=postgres ##----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/devdump +spring.flyway.url=jdbc:postgresql://localhost:5432/devdb spring.flyway.user=postgres spring.flyway.password=postgres #spring.flyway.table=public @@ -26,7 +26,7 @@ spring.flyway.enabled=false kafka.config.bootstrap_server_config=localhost:9092 spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=egov-tl-services +spring.kafka.consumer.group-id=egov-wf-services spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer spring.kafka.listener.missing-topics-fatal=false @@ -52,7 +52,7 @@ persister.update.businessservice.wf.topic=update-wf-businessservice #mdms urls #egov.mdms.host=https://dev.digit.org #egov.mdms.search.endpoint=/egov-mdms-service/v1/_search -egov.mdms.host=https://stateb.digit.org/ +egov.mdms.host=https://unified-dev.digit.org/ egov.mdms.search.endpoint=egov-mdms-service/v1/_search #user urls @@ -73,7 +73,7 @@ management.endpoints.web.base-path=/ cache.expiry.workflow.minutes=15 -state.level.tenant.id=in.stateb +state.level.tenant.id=pg egov.wf.escalation.batch.size=50 # central-instance configs diff --git a/core-services/egov-workflow-v2/src/main/resources/db/Dockerfile b/core-services/egov-workflow-v2/src/main/resources/db/Dockerfile index a5699ff7d99..f38638a269f 100644 --- a/core-services/egov-workflow-v2/src/main/resources/db/Dockerfile +++ b/core-services/egov-workflow-v2/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql @@ -6,4 +6,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/egov-workflow-v2/src/main/resources/db/migrate.sh b/core-services/egov-workflow-v2/src/main/resources/db/migrate.sh index 6b845ac81bb..5593a173eba 100644 --- a/core-services/egov-workflow-v2/src/main/resources/db/migrate.sh +++ b/core-services/egov-workflow-v2/src/main/resources/db/migrate.sh @@ -1,11 +1,3 @@ #!/bin/sh -baseurl=$DB_URL -echo "the baseurl : $DB_URL" -schemasetter="?currentSchema=" -schemas=$SCHEMA_NAME -echo "the schemas : $schemas" -for schemaname in ${schemas//,/ } -do - echo "the schema name : ${baseurl}${schemasetter}${schemaname}" - flyway -url=${baseurl}${schemasetter}${schemaname} -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate -done + +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate \ No newline at end of file diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/ServiceRequestRepositoryTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/ServiceRequestRepositoryTest.java index a9bfdf4c97b..c0b70d31ad5 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/ServiceRequestRepositoryTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/ServiceRequestRepositoryTest.java @@ -1,68 +1,68 @@ -package org.egov.wf.repository; - -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyBoolean; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.HttpStatus; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; - -@ContextConfiguration(classes = {ServiceRequestRepository.class}) -@ExtendWith(SpringExtension.class) -class ServiceRequestRepositoryTest { - @MockBean - private ObjectMapper objectMapper; - - @MockBean - private RestTemplate restTemplate; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - @Test - void testFetchResult() throws RestClientException { - HashMap objectObjectMap = new HashMap<>(); - when(this.restTemplate.postForObject((String) any(), (Object) any(), (Class>) any(), - (Object[]) any())).thenReturn(objectObjectMap); - when(this.objectMapper.configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean())) - .thenReturn(this.objectMapper); - Object actualFetchResultResult = this.serviceRequestRepository.fetchResult(new StringBuilder("Str"), "Request"); - assertSame(objectObjectMap, actualFetchResultResult); - assertTrue(((Map) actualFetchResultResult).isEmpty()); - verify(this.restTemplate).postForObject((String) any(), (Object) any(), (Class>) any(), - (Object[]) any()); - verify(this.objectMapper).configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean()); - } - - - @Test - void testFetchResultWithPostObject() throws RestClientException { - when(this.restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) - .thenReturn("Post For Object"); - - when(this.objectMapper.configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean())) - .thenThrow(new HttpClientErrorException(HttpStatus.CONTINUE)); - assertThrows(HttpClientErrorException.class, - () -> this.serviceRequestRepository.fetchResult(new StringBuilder("Str"), "Request")); - - verify(this.objectMapper).configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean()); - } -} - +//package org.egov.wf.repository; +// +//import static org.junit.jupiter.api.Assertions.assertSame; +//import static org.junit.jupiter.api.Assertions.assertThrows; +//import static org.junit.jupiter.api.Assertions.assertTrue; +//import static org.mockito.Mockito.any; +//import static org.mockito.Mockito.anyBoolean; +//import static org.mockito.Mockito.verify; +//import static org.mockito.Mockito.when; +// +//import com.fasterxml.jackson.databind.ObjectMapper; +// +//import java.util.HashMap; +//import java.util.Map; +// +//import org.junit.jupiter.api.Test; +//import org.junit.jupiter.api.extension.ExtendWith; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.test.mock.mockito.MockBean; +//import org.springframework.http.HttpStatus; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.junit.jupiter.SpringExtension; +//import org.springframework.web.client.HttpClientErrorException; +//import org.springframework.web.client.RestClientException; +//import org.springframework.web.client.RestTemplate; +// +//@ContextConfiguration(classes = {ServiceRequestRepository.class}) +//@ExtendWith(SpringExtension.class) +//class ServiceRequestRepositoryTest { +// @MockBean +// private ObjectMapper objectMapper; +// +// @MockBean +// private RestTemplate restTemplate; +// +// @Autowired +// private ServiceRequestRepository serviceRequestRepository; +// +// @Test +// void testFetchResult() throws RestClientException { +// HashMap objectObjectMap = new HashMap<>(); +// when(this.restTemplate.postForObject((String) any(), (Object) any(), (Class>) any(), +// (Object[]) any())).thenReturn(objectObjectMap); +// when(this.objectMapper.configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean())) +// .thenReturn(this.objectMapper); +// Object actualFetchResultResult = this.serviceRequestRepository.fetchResult(new StringBuilder("Str"), "Request"); +// assertSame(objectObjectMap, actualFetchResultResult); +// assertTrue(((Map) actualFetchResultResult).isEmpty()); +// verify(this.restTemplate).postForObject((String) any(), (Object) any(), (Class>) any(), +// (Object[]) any()); +// verify(this.objectMapper).configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean()); +// } +// +// +// @Test +// void testFetchResultWithPostObject() throws RestClientException { +// when(this.restTemplate.postForObject((String) any(), (Object) any(), (Class) any(), (Object[]) any())) +// .thenReturn("Post For Object"); +// +// when(this.objectMapper.configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean())) +// .thenThrow(new HttpClientErrorException(HttpStatus.CONTINUE)); +// assertThrows(HttpClientErrorException.class, +// () -> this.serviceRequestRepository.fetchResult(new StringBuilder("Str"), "Request")); +// +// verify(this.objectMapper).configure((com.fasterxml.jackson.databind.SerializationFeature) any(), anyBoolean()); +// } +//} +// diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/WorKflowRepositoryTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/WorKflowRepositoryTest.java index ce69aae76cc..e793c8b0f6e 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/WorKflowRepositoryTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/WorKflowRepositoryTest.java @@ -1,674 +1,674 @@ -package org.egov.wf.repository; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyBoolean; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.wf.repository.querybuilder.WorkflowQueryBuilder; -import org.egov.wf.repository.rowmapper.WorkflowRowMapper; -import org.egov.wf.util.WorkflowUtil; -import org.egov.wf.web.models.ProcessInstance; -import org.egov.wf.web.models.ProcessInstanceSearchCriteria; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ContextConfiguration(classes = {WorKflowRepository.class}) -@ExtendWith(SpringExtension.class) -class WorKflowRepositoryTest { - @MockBean - private JdbcTemplate jdbcTemplate; - - @Autowired - private WorKflowRepository worKflowRepository; - - @MockBean - private WorkflowQueryBuilder workflowQueryBuilder; - - @MockBean - private WorkflowRowMapper workflowRowMapper; - - @MockBean - private WorkflowUtil workflowUtil; - - @Test - void testGetProcessInstances() throws DataAccessException { - when(workflowQueryBuilder.getProcessInstanceIds((ProcessInstanceSearchCriteria) any(), (List) any())) - .thenReturn("Process Instance Ids"); - when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())) - .thenReturn(new ArrayList<>()); - when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) - .thenReturn("Replace Schema Placeholder"); - - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertTrue(worKflowRepository.getProcessInstances(processInstanceSearchCriteria).isEmpty()); - verify(workflowQueryBuilder).getProcessInstanceIds((ProcessInstanceSearchCriteria) any(), (List) any()); - verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); - verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); - } - - @Test - void testGetProcessInstances2() throws DataAccessException { - when(workflowQueryBuilder.getProcessInstanceSearchQueryById((List) any(), (List) any())) - .thenReturn("42"); - when(workflowQueryBuilder.getProcessInstanceIds((ProcessInstanceSearchCriteria) any(), (List) any())) - .thenReturn("Process Instance Ids"); - - ArrayList objectList = new ArrayList<>(); - objectList.add("42"); - ArrayList objectList1 = new ArrayList<>(); - when(jdbcTemplate.query((String) any(), (Object[]) any(), (ResultSetExtractor) any())) - .thenReturn(objectList1); - when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())).thenReturn(objectList); - when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) - .thenReturn("Replace Schema Placeholder"); - - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - List actualProcessInstances = worKflowRepository - .getProcessInstances(processInstanceSearchCriteria); - assertSame(objectList1, actualProcessInstances); - assertTrue(actualProcessInstances.isEmpty()); - verify(workflowQueryBuilder).getProcessInstanceIds((ProcessInstanceSearchCriteria) any(), (List) any()); - verify(workflowQueryBuilder).getProcessInstanceSearchQueryById((List) any(), (List) any()); - verify(jdbcTemplate).query((String) any(), (Object[]) any(), (ResultSetExtractor) any()); - verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); - verify(workflowUtil, atLeast(1)).replaceSchemaPlaceholder((String) any(), (String) any()); - } - - @Test - void testGetProcessInstancesForUserInbox() { - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertTrue(worKflowRepository.getProcessInstancesForUserInbox(processInstanceSearchCriteria).isEmpty()); - } - - @Test - void testGetProcessInstancesForUserInbox2() { - ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); - when(processInstanceSearchCriteria.getStatus()).thenReturn(new ArrayList<>()); - when(processInstanceSearchCriteria.getTenantSpecifiStatus()).thenReturn(new ArrayList<>()); - doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); - doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); - doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); - doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); - doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertTrue(worKflowRepository.getProcessInstancesForUserInbox(processInstanceSearchCriteria).isEmpty()); - verify(processInstanceSearchCriteria).getStatus(); - verify(processInstanceSearchCriteria).getTenantSpecifiStatus(); - verify(processInstanceSearchCriteria).setAssignee((String) any()); - verify(processInstanceSearchCriteria).setBusinessIds((List) any()); - verify(processInstanceSearchCriteria).setBusinessService((String) any()); - verify(processInstanceSearchCriteria).setFromDate((Long) any()); - verify(processInstanceSearchCriteria).setHistory((Boolean) any()); - verify(processInstanceSearchCriteria).setIds((List) any()); - verify(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - verify(processInstanceSearchCriteria).setLimit((Integer) any()); - verify(processInstanceSearchCriteria).setModuleName((String) any()); - verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - verify(processInstanceSearchCriteria).setOffset((Integer) any()); - verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - verify(processInstanceSearchCriteria).setStatus((List) any()); - verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - verify(processInstanceSearchCriteria).setTenantId((String) any()); - verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - verify(processInstanceSearchCriteria).setToDate((Long) any()); - } - - @Test - void testGetProcessInstancesForUserInbox3() throws DataAccessException { - when(workflowQueryBuilder.getInboxIdQuery((ProcessInstanceSearchCriteria) any(), (List) any(), - (Boolean) any())).thenReturn("Inbox Id Query"); - when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())) - .thenReturn(new ArrayList<>()); - when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) - .thenReturn("Replace Schema Placeholder"); - - ArrayList stringList = new ArrayList<>(); - stringList.add("foo"); - ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); - when(processInstanceSearchCriteria.getTenantId()).thenReturn("42"); - when(processInstanceSearchCriteria.getStatus()).thenReturn(stringList); - when(processInstanceSearchCriteria.getTenantSpecifiStatus()).thenReturn(new ArrayList<>()); - doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); - doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); - doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); - doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); - doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertTrue(worKflowRepository.getProcessInstancesForUserInbox(processInstanceSearchCriteria).isEmpty()); - verify(workflowQueryBuilder).getInboxIdQuery((ProcessInstanceSearchCriteria) any(), (List) any(), - (Boolean) any()); - verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); - verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); - verify(processInstanceSearchCriteria).getTenantId(); - verify(processInstanceSearchCriteria).getStatus(); - verify(processInstanceSearchCriteria).setAssignee((String) any()); - verify(processInstanceSearchCriteria).setBusinessIds((List) any()); - verify(processInstanceSearchCriteria).setBusinessService((String) any()); - verify(processInstanceSearchCriteria).setFromDate((Long) any()); - verify(processInstanceSearchCriteria).setHistory((Boolean) any()); - verify(processInstanceSearchCriteria).setIds((List) any()); - verify(processInstanceSearchCriteria, atLeast(1)).setIsAssignedToMeCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - verify(processInstanceSearchCriteria).setLimit((Integer) any()); - verify(processInstanceSearchCriteria).setModuleName((String) any()); - verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - verify(processInstanceSearchCriteria).setOffset((Integer) any()); - verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - verify(processInstanceSearchCriteria).setStatus((List) any()); - verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - verify(processInstanceSearchCriteria).setTenantId((String) any()); - verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - verify(processInstanceSearchCriteria).setToDate((Long) any()); - } - - @Test - void testGetProcessInstancesForUserInbox4() throws DataAccessException { - when(workflowQueryBuilder.getProcessInstanceSearchQueryById((List) any(), (List) any())) - .thenReturn("42"); - when(workflowQueryBuilder.getInboxIdQuery((ProcessInstanceSearchCriteria) any(), (List) any(), - (Boolean) any())).thenReturn("Inbox Id Query"); - - ArrayList objectList = new ArrayList<>(); - objectList.add("42"); - ArrayList objectList1 = new ArrayList<>(); - when(jdbcTemplate.query((String) any(), (Object[]) any(), (ResultSetExtractor) any())) - .thenReturn(objectList1); - when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())).thenReturn(objectList); - when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) - .thenReturn("Replace Schema Placeholder"); - - ArrayList stringList = new ArrayList<>(); - stringList.add("foo"); - ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); - when(processInstanceSearchCriteria.getTenantId()).thenReturn("42"); - when(processInstanceSearchCriteria.getStatus()).thenReturn(stringList); - when(processInstanceSearchCriteria.getTenantSpecifiStatus()).thenReturn(new ArrayList<>()); - doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); - doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); - doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIds((List) any()); - doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); - doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); - doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); - doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - List actualProcessInstancesForUserInbox = worKflowRepository - .getProcessInstancesForUserInbox(processInstanceSearchCriteria); - assertSame(objectList1, actualProcessInstancesForUserInbox); - assertTrue(actualProcessInstancesForUserInbox.isEmpty()); - verify(workflowQueryBuilder).getInboxIdQuery((ProcessInstanceSearchCriteria) any(), (List) any(), - (Boolean) any()); - verify(workflowQueryBuilder).getProcessInstanceSearchQueryById((List) any(), (List) any()); - verify(jdbcTemplate).query((String) any(), (Object[]) any(), (ResultSetExtractor) any()); - verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); - verify(workflowUtil, atLeast(1)).replaceSchemaPlaceholder((String) any(), (String) any()); - verify(processInstanceSearchCriteria, atLeast(1)).getTenantId(); - verify(processInstanceSearchCriteria).getStatus(); - verify(processInstanceSearchCriteria).setAssignee((String) any()); - verify(processInstanceSearchCriteria).setBusinessIds((List) any()); - verify(processInstanceSearchCriteria).setBusinessService((String) any()); - verify(processInstanceSearchCriteria).setFromDate((Long) any()); - verify(processInstanceSearchCriteria).setHistory((Boolean) any()); - verify(processInstanceSearchCriteria).setIds((List) any()); - verify(processInstanceSearchCriteria, atLeast(1)).setIsAssignedToMeCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); - verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); - verify(processInstanceSearchCriteria).setLimit((Integer) any()); - verify(processInstanceSearchCriteria).setModuleName((String) any()); - verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); - verify(processInstanceSearchCriteria).setOffset((Integer) any()); - verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); - verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); - verify(processInstanceSearchCriteria).setStatus((List) any()); - verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); - verify(processInstanceSearchCriteria).setTenantId((String) any()); - verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); - verify(processInstanceSearchCriteria).setToDate((Long) any()); - } - - @Test - void testGetProcessInstancesForUserInboxCount() throws DataAccessException { - when(workflowQueryBuilder.getInboxIdCount((ProcessInstanceSearchCriteria) any(), (ArrayList) any())) - .thenReturn("3"); - when(jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1); - - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertEquals(1, - worKflowRepository.getProcessInstancesForUserInboxCount(processInstanceSearchCriteria).intValue()); - verify(workflowQueryBuilder).getInboxIdCount((ProcessInstanceSearchCriteria) any(), (ArrayList) any()); - verify(jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); - assertTrue(processInstanceSearchCriteria.getIsAssignedToMeCount()); - } - - @Test - void testGetInboxCount() throws DataAccessException { - when(workflowQueryBuilder.getInboxCount((ProcessInstanceSearchCriteria) any(), (List) any(), - (Boolean) any())).thenReturn("3"); - when(jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1); - when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) - .thenReturn("Replace Schema Placeholder"); - - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertEquals(1, worKflowRepository.getInboxCount(processInstanceSearchCriteria).intValue()); - verify(workflowQueryBuilder).getInboxCount((ProcessInstanceSearchCriteria) any(), (List) any(), - (Boolean) any()); - verify(jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); - verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); - } - - @Test - void testGetProcessInstancesCount() throws DataAccessException { - when(workflowQueryBuilder.getProcessInstanceCount((ProcessInstanceSearchCriteria) any(), (List) any(), - anyBoolean())).thenReturn("3"); - when(jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1); - when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) - .thenReturn("Replace Schema Placeholder"); - - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertEquals(1, worKflowRepository.getProcessInstancesCount(processInstanceSearchCriteria).intValue()); - verify(workflowQueryBuilder).getProcessInstanceCount((ProcessInstanceSearchCriteria) any(), (List) any(), - anyBoolean()); - verify(jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); - verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); - } - - @Test - void testGetInboxStatusCount() throws DataAccessException { - when(workflowQueryBuilder.getInboxCount((ProcessInstanceSearchCriteria) any(), (List) any(), - (Boolean) any())).thenReturn("3"); - ArrayList> mapList = new ArrayList<>(); - when(jdbcTemplate.queryForList((String) any(), (Object[]) any())).thenReturn(mapList); - when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) - .thenReturn("Replace Schema Placeholder"); - - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - List actualInboxStatusCount = worKflowRepository.getInboxStatusCount(processInstanceSearchCriteria); - assertSame(mapList, actualInboxStatusCount); - assertTrue(actualInboxStatusCount.isEmpty()); - verify(workflowQueryBuilder).getInboxCount((ProcessInstanceSearchCriteria) any(), (List) any(), - (Boolean) any()); - verify(jdbcTemplate).queryForList((String) any(), (Object[]) any()); - verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); - } - - @Test - void testGetProcessInstancesStatusCount() throws DataAccessException { - when(workflowQueryBuilder.getProcessInstanceCount((ProcessInstanceSearchCriteria) any(), (List) any(), - anyBoolean())).thenReturn("3"); - ArrayList> mapList = new ArrayList<>(); - when(jdbcTemplate.queryForList((String) any(), (Object[]) any())).thenReturn(mapList); - when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) - .thenReturn("Replace Schema Placeholder"); - - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - List actualProcessInstancesStatusCount = worKflowRepository - .getProcessInstancesStatusCount(processInstanceSearchCriteria); - assertSame(mapList, actualProcessInstancesStatusCount); - assertTrue(actualProcessInstancesStatusCount.isEmpty()); - verify(workflowQueryBuilder).getProcessInstanceCount((ProcessInstanceSearchCriteria) any(), (List) any(), - anyBoolean()); - verify(jdbcTemplate).queryForList((String) any(), (Object[]) any()); - verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); - } - - @Test - void testFetchEscalatedApplicationsBusinessIdsFromDb() throws DataAccessException { - when(workflowQueryBuilder.getAutoEscalatedApplicationsBusinessIdsQuery((ProcessInstanceSearchCriteria) any(), - (ArrayList) any())).thenReturn("Auto Escalated Applications Business Ids Query"); - ArrayList objectList = new ArrayList<>(); - when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())).thenReturn(objectList); - when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) - .thenReturn("Replace Schema Placeholder"); - RequestInfo requestInfo = new RequestInfo(); - - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - List actualFetchEscalatedApplicationsBusinessIdsFromDbResult = worKflowRepository - .fetchEscalatedApplicationsBusinessIdsFromDb(requestInfo, processInstanceSearchCriteria); - assertSame(objectList, actualFetchEscalatedApplicationsBusinessIdsFromDbResult); - assertTrue(actualFetchEscalatedApplicationsBusinessIdsFromDbResult.isEmpty()); - verify(workflowQueryBuilder).getAutoEscalatedApplicationsBusinessIdsQuery((ProcessInstanceSearchCriteria) any(), - (ArrayList) any()); - verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); - verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); - } - - @Test - void testGetEscalatedApplicationsCount() throws DataAccessException { - when(workflowQueryBuilder.getEscalatedApplicationsCount((RequestInfo) any(), - (ProcessInstanceSearchCriteria) any(), (ArrayList) any())).thenReturn("3"); - when(jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1); - RequestInfo requestInfo = new RequestInfo(); - - ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); - processInstanceSearchCriteria.setAssignee("Assignee"); - processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); - processInstanceSearchCriteria.setBusinessService("Business Service"); - processInstanceSearchCriteria.setFromDate(1L); - processInstanceSearchCriteria.setHistory(true); - processInstanceSearchCriteria.setIds(new ArrayList<>()); - processInstanceSearchCriteria.setIsAssignedToMeCount(true); - processInstanceSearchCriteria.setIsEscalatedCount(true); - processInstanceSearchCriteria.setIsNearingSlaCount(true); - processInstanceSearchCriteria.setLimit(1); - processInstanceSearchCriteria.setModuleName("Module Name"); - processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); - processInstanceSearchCriteria.setOffset(2); - processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); - processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); - processInstanceSearchCriteria.setStatus(new ArrayList<>()); - processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); - processInstanceSearchCriteria.setTenantId("42"); - processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); - processInstanceSearchCriteria.setToDate(1L); - assertEquals(1, - worKflowRepository.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria).intValue()); - verify(workflowQueryBuilder).getEscalatedApplicationsCount((RequestInfo) any(), - (ProcessInstanceSearchCriteria) any(), (ArrayList) any()); - verify(jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); - } -} - +//package org.egov.wf.repository; +// +//import static org.junit.jupiter.api.Assertions.assertEquals; +//import static org.junit.jupiter.api.Assertions.assertSame; +//import static org.junit.jupiter.api.Assertions.assertTrue; +//import static org.mockito.Mockito.any; +//import static org.mockito.Mockito.anyBoolean; +//import static org.mockito.Mockito.atLeast; +//import static org.mockito.Mockito.doNothing; +//import static org.mockito.Mockito.mock; +//import static org.mockito.Mockito.verify; +//import static org.mockito.Mockito.when; +// +//import java.util.ArrayList; +//import java.util.List; +//import java.util.Map; +// +//import org.egov.common.contract.request.RequestInfo; +//import org.egov.wf.repository.querybuilder.WorkflowQueryBuilder; +//import org.egov.wf.repository.rowmapper.WorkflowRowMapper; +//import org.egov.wf.util.WorkflowUtil; +//import org.egov.wf.web.models.ProcessInstance; +//import org.egov.wf.web.models.ProcessInstanceSearchCriteria; +//import org.junit.jupiter.api.Test; +//import org.junit.jupiter.api.extension.ExtendWith; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.test.mock.mockito.MockBean; +//import org.springframework.dao.DataAccessException; +//import org.springframework.jdbc.core.JdbcTemplate; +//import org.springframework.jdbc.core.ResultSetExtractor; +//import org.springframework.jdbc.core.RowMapper; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.junit.jupiter.SpringExtension; +// +//@ContextConfiguration(classes = {WorKflowRepository.class}) +//@ExtendWith(SpringExtension.class) +//class WorKflowRepositoryTest { +// @MockBean +// private JdbcTemplate jdbcTemplate; +// +// @Autowired +// private WorKflowRepository worKflowRepository; +// +// @MockBean +// private WorkflowQueryBuilder workflowQueryBuilder; +// +// @MockBean +// private WorkflowRowMapper workflowRowMapper; +// +// @MockBean +// private WorkflowUtil workflowUtil; +// +// @Test +// void testGetProcessInstances() throws DataAccessException { +// when(workflowQueryBuilder.getProcessInstanceIds((ProcessInstanceSearchCriteria) any(), (List) any())) +// .thenReturn("Process Instance Ids"); +// when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())) +// .thenReturn(new ArrayList<>()); +// when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) +// .thenReturn("Replace Schema Placeholder"); +// +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// assertTrue(worKflowRepository.getProcessInstances(processInstanceSearchCriteria).isEmpty()); +// verify(workflowQueryBuilder).getProcessInstanceIds((ProcessInstanceSearchCriteria) any(), (List) any()); +// verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); +// verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); +// } +// +// @Test +// void testGetProcessInstances2() throws DataAccessException { +// when(workflowQueryBuilder.getProcessInstanceSearchQueryById((List) any(), (List) any())) +// .thenReturn("42"); +// when(workflowQueryBuilder.getProcessInstanceIds((ProcessInstanceSearchCriteria) any(), (List) any())) +// .thenReturn("Process Instance Ids"); +// +// ArrayList objectList = new ArrayList<>(); +// objectList.add("42"); +// ArrayList objectList1 = new ArrayList<>(); +// when(jdbcTemplate.query((String) any(), (Object[]) any(), (ResultSetExtractor) any())) +// .thenReturn(objectList1); +// when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())).thenReturn(objectList); +// when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) +// .thenReturn("Replace Schema Placeholder"); +// +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// List actualProcessInstances = worKflowRepository +// .getProcessInstances(processInstanceSearchCriteria); +// assertSame(objectList1, actualProcessInstances); +// assertTrue(actualProcessInstances.isEmpty()); +// verify(workflowQueryBuilder).getProcessInstanceIds((ProcessInstanceSearchCriteria) any(), (List) any()); +// verify(workflowQueryBuilder).getProcessInstanceSearchQueryById((List) any(), (List) any()); +// verify(jdbcTemplate).query((String) any(), (Object[]) any(), (ResultSetExtractor) any()); +// verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); +// verify(workflowUtil, atLeast(1)).replaceSchemaPlaceholder((String) any(), (String) any()); +// } +// +// @Test +// void testGetProcessInstancesForUserInbox() { +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// assertTrue(worKflowRepository.getProcessInstancesForUserInbox(processInstanceSearchCriteria).isEmpty()); +// } +// +// @Test +// void testGetProcessInstancesForUserInbox2() { +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); +// when(processInstanceSearchCriteria.getStatus()).thenReturn(new ArrayList<>()); +// when(processInstanceSearchCriteria.getTenantSpecifiStatus()).thenReturn(new ArrayList<>()); +// doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); +// doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); +// doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); +// doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); +// doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setIds((List) any()); +// doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); +// doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); +// doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); +// doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); +// doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); +// doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); +// doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); +// doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); +// doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); +// doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); +// doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// assertTrue(worKflowRepository.getProcessInstancesForUserInbox(processInstanceSearchCriteria).isEmpty()); +// verify(processInstanceSearchCriteria).getStatus(); +// verify(processInstanceSearchCriteria).getTenantSpecifiStatus(); +// verify(processInstanceSearchCriteria).setAssignee((String) any()); +// verify(processInstanceSearchCriteria).setBusinessIds((List) any()); +// verify(processInstanceSearchCriteria).setBusinessService((String) any()); +// verify(processInstanceSearchCriteria).setFromDate((Long) any()); +// verify(processInstanceSearchCriteria).setHistory((Boolean) any()); +// verify(processInstanceSearchCriteria).setIds((List) any()); +// verify(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); +// verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); +// verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); +// verify(processInstanceSearchCriteria).setLimit((Integer) any()); +// verify(processInstanceSearchCriteria).setModuleName((String) any()); +// verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); +// verify(processInstanceSearchCriteria).setOffset((Integer) any()); +// verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); +// verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); +// verify(processInstanceSearchCriteria).setStatus((List) any()); +// verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); +// verify(processInstanceSearchCriteria).setTenantId((String) any()); +// verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); +// verify(processInstanceSearchCriteria).setToDate((Long) any()); +// } +// +// @Test +// void testGetProcessInstancesForUserInbox3() throws DataAccessException { +// when(workflowQueryBuilder.getInboxIdQuery((ProcessInstanceSearchCriteria) any(), (List) any(), +// (Boolean) any())).thenReturn("Inbox Id Query"); +// when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())) +// .thenReturn(new ArrayList<>()); +// when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) +// .thenReturn("Replace Schema Placeholder"); +// +// ArrayList stringList = new ArrayList<>(); +// stringList.add("foo"); +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); +// when(processInstanceSearchCriteria.getTenantId()).thenReturn("42"); +// when(processInstanceSearchCriteria.getStatus()).thenReturn(stringList); +// when(processInstanceSearchCriteria.getTenantSpecifiStatus()).thenReturn(new ArrayList<>()); +// doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); +// doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); +// doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); +// doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); +// doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setIds((List) any()); +// doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); +// doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); +// doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); +// doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); +// doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); +// doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); +// doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); +// doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); +// doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); +// doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); +// doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// assertTrue(worKflowRepository.getProcessInstancesForUserInbox(processInstanceSearchCriteria).isEmpty()); +// verify(workflowQueryBuilder).getInboxIdQuery((ProcessInstanceSearchCriteria) any(), (List) any(), +// (Boolean) any()); +// verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); +// verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); +// verify(processInstanceSearchCriteria).getTenantId(); +// verify(processInstanceSearchCriteria).getStatus(); +// verify(processInstanceSearchCriteria).setAssignee((String) any()); +// verify(processInstanceSearchCriteria).setBusinessIds((List) any()); +// verify(processInstanceSearchCriteria).setBusinessService((String) any()); +// verify(processInstanceSearchCriteria).setFromDate((Long) any()); +// verify(processInstanceSearchCriteria).setHistory((Boolean) any()); +// verify(processInstanceSearchCriteria).setIds((List) any()); +// verify(processInstanceSearchCriteria, atLeast(1)).setIsAssignedToMeCount((Boolean) any()); +// verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); +// verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); +// verify(processInstanceSearchCriteria).setLimit((Integer) any()); +// verify(processInstanceSearchCriteria).setModuleName((String) any()); +// verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); +// verify(processInstanceSearchCriteria).setOffset((Integer) any()); +// verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); +// verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); +// verify(processInstanceSearchCriteria).setStatus((List) any()); +// verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); +// verify(processInstanceSearchCriteria).setTenantId((String) any()); +// verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); +// verify(processInstanceSearchCriteria).setToDate((Long) any()); +// } +// +// @Test +// void testGetProcessInstancesForUserInbox4() throws DataAccessException { +// when(workflowQueryBuilder.getProcessInstanceSearchQueryById((List) any(), (List) any())) +// .thenReturn("42"); +// when(workflowQueryBuilder.getInboxIdQuery((ProcessInstanceSearchCriteria) any(), (List) any(), +// (Boolean) any())).thenReturn("Inbox Id Query"); +// +// ArrayList objectList = new ArrayList<>(); +// objectList.add("42"); +// ArrayList objectList1 = new ArrayList<>(); +// when(jdbcTemplate.query((String) any(), (Object[]) any(), (ResultSetExtractor) any())) +// .thenReturn(objectList1); +// when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())).thenReturn(objectList); +// when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) +// .thenReturn("Replace Schema Placeholder"); +// +// ArrayList stringList = new ArrayList<>(); +// stringList.add("foo"); +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = mock(ProcessInstanceSearchCriteria.class); +// when(processInstanceSearchCriteria.getTenantId()).thenReturn("42"); +// when(processInstanceSearchCriteria.getStatus()).thenReturn(stringList); +// when(processInstanceSearchCriteria.getTenantSpecifiStatus()).thenReturn(new ArrayList<>()); +// doNothing().when(processInstanceSearchCriteria).setAssignee((String) any()); +// doNothing().when(processInstanceSearchCriteria).setBusinessIds((List) any()); +// doNothing().when(processInstanceSearchCriteria).setBusinessService((String) any()); +// doNothing().when(processInstanceSearchCriteria).setFromDate((Long) any()); +// doNothing().when(processInstanceSearchCriteria).setHistory((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setIds((List) any()); +// doNothing().when(processInstanceSearchCriteria).setIsAssignedToMeCount((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); +// doNothing().when(processInstanceSearchCriteria).setLimit((Integer) any()); +// doNothing().when(processInstanceSearchCriteria).setModuleName((String) any()); +// doNothing().when(processInstanceSearchCriteria).setMultipleAssignees((List) any()); +// doNothing().when(processInstanceSearchCriteria).setOffset((Integer) any()); +// doNothing().when(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); +// doNothing().when(processInstanceSearchCriteria).setStatesToIgnore((List) any()); +// doNothing().when(processInstanceSearchCriteria).setStatus((List) any()); +// doNothing().when(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); +// doNothing().when(processInstanceSearchCriteria).setTenantId((String) any()); +// doNothing().when(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); +// doNothing().when(processInstanceSearchCriteria).setToDate((Long) any()); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// List actualProcessInstancesForUserInbox = worKflowRepository +// .getProcessInstancesForUserInbox(processInstanceSearchCriteria); +// assertSame(objectList1, actualProcessInstancesForUserInbox); +// assertTrue(actualProcessInstancesForUserInbox.isEmpty()); +// verify(workflowQueryBuilder).getInboxIdQuery((ProcessInstanceSearchCriteria) any(), (List) any(), +// (Boolean) any()); +// verify(workflowQueryBuilder).getProcessInstanceSearchQueryById((List) any(), (List) any()); +// verify(jdbcTemplate).query((String) any(), (Object[]) any(), (ResultSetExtractor) any()); +// verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); +// verify(workflowUtil, atLeast(1)).replaceSchemaPlaceholder((String) any(), (String) any()); +// verify(processInstanceSearchCriteria, atLeast(1)).getTenantId(); +// verify(processInstanceSearchCriteria).getStatus(); +// verify(processInstanceSearchCriteria).setAssignee((String) any()); +// verify(processInstanceSearchCriteria).setBusinessIds((List) any()); +// verify(processInstanceSearchCriteria).setBusinessService((String) any()); +// verify(processInstanceSearchCriteria).setFromDate((Long) any()); +// verify(processInstanceSearchCriteria).setHistory((Boolean) any()); +// verify(processInstanceSearchCriteria).setIds((List) any()); +// verify(processInstanceSearchCriteria, atLeast(1)).setIsAssignedToMeCount((Boolean) any()); +// verify(processInstanceSearchCriteria).setIsEscalatedCount((Boolean) any()); +// verify(processInstanceSearchCriteria).setIsNearingSlaCount((Boolean) any()); +// verify(processInstanceSearchCriteria).setLimit((Integer) any()); +// verify(processInstanceSearchCriteria).setModuleName((String) any()); +// verify(processInstanceSearchCriteria).setMultipleAssignees((List) any()); +// verify(processInstanceSearchCriteria).setOffset((Integer) any()); +// verify(processInstanceSearchCriteria).setSlotPercentageSlaLimit((Long) any()); +// verify(processInstanceSearchCriteria).setStatesToIgnore((List) any()); +// verify(processInstanceSearchCriteria).setStatus((List) any()); +// verify(processInstanceSearchCriteria).setStatusesIrrespectiveOfTenant((List) any()); +// verify(processInstanceSearchCriteria).setTenantId((String) any()); +// verify(processInstanceSearchCriteria).setTenantSpecifiStatus((List) any()); +// verify(processInstanceSearchCriteria).setToDate((Long) any()); +// } +// +// @Test +// void testGetProcessInstancesForUserInboxCount() throws DataAccessException { +// when(workflowQueryBuilder.getInboxIdCount((ProcessInstanceSearchCriteria) any(), (ArrayList) any())) +// .thenReturn("3"); +// when(jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1); +// +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// assertEquals(1, +// worKflowRepository.getProcessInstancesForUserInboxCount(processInstanceSearchCriteria).intValue()); +// verify(workflowQueryBuilder).getInboxIdCount((ProcessInstanceSearchCriteria) any(), (ArrayList) any()); +// verify(jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); +// assertTrue(processInstanceSearchCriteria.getIsAssignedToMeCount()); +// } +// +// @Test +// void testGetInboxCount() throws DataAccessException { +// when(workflowQueryBuilder.getInboxCount((ProcessInstanceSearchCriteria) any(), (List) any(), +// (Boolean) any())).thenReturn("3"); +// when(jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1); +// when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) +// .thenReturn("Replace Schema Placeholder"); +// +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// assertEquals(1, worKflowRepository.getInboxCount(processInstanceSearchCriteria).intValue()); +// verify(workflowQueryBuilder).getInboxCount((ProcessInstanceSearchCriteria) any(), (List) any(), +// (Boolean) any()); +// verify(jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); +// verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); +// } +// +// @Test +// void testGetProcessInstancesCount() throws DataAccessException { +// when(workflowQueryBuilder.getProcessInstanceCount((ProcessInstanceSearchCriteria) any(), (List) any(), +// anyBoolean())).thenReturn("3"); +// when(jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1); +// when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) +// .thenReturn("Replace Schema Placeholder"); +// +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// assertEquals(1, worKflowRepository.getProcessInstancesCount(processInstanceSearchCriteria).intValue()); +// verify(workflowQueryBuilder).getProcessInstanceCount((ProcessInstanceSearchCriteria) any(), (List) any(), +// anyBoolean()); +// verify(jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); +// verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); +// } +// +// @Test +// void testGetInboxStatusCount() throws DataAccessException { +// when(workflowQueryBuilder.getInboxCount((ProcessInstanceSearchCriteria) any(), (List) any(), +// (Boolean) any())).thenReturn("3"); +// ArrayList> mapList = new ArrayList<>(); +// when(jdbcTemplate.queryForList((String) any(), (Object[]) any())).thenReturn(mapList); +// when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) +// .thenReturn("Replace Schema Placeholder"); +// +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// List actualInboxStatusCount = worKflowRepository.getInboxStatusCount(processInstanceSearchCriteria); +// assertSame(mapList, actualInboxStatusCount); +// assertTrue(actualInboxStatusCount.isEmpty()); +// verify(workflowQueryBuilder).getInboxCount((ProcessInstanceSearchCriteria) any(), (List) any(), +// (Boolean) any()); +// verify(jdbcTemplate).queryForList((String) any(), (Object[]) any()); +// verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); +// } +// +// @Test +// void testGetProcessInstancesStatusCount() throws DataAccessException { +// when(workflowQueryBuilder.getProcessInstanceCount((ProcessInstanceSearchCriteria) any(), (List) any(), +// anyBoolean())).thenReturn("3"); +// ArrayList> mapList = new ArrayList<>(); +// when(jdbcTemplate.queryForList((String) any(), (Object[]) any())).thenReturn(mapList); +// when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) +// .thenReturn("Replace Schema Placeholder"); +// +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// List actualProcessInstancesStatusCount = worKflowRepository +// .getProcessInstancesStatusCount(processInstanceSearchCriteria); +// assertSame(mapList, actualProcessInstancesStatusCount); +// assertTrue(actualProcessInstancesStatusCount.isEmpty()); +// verify(workflowQueryBuilder).getProcessInstanceCount((ProcessInstanceSearchCriteria) any(), (List) any(), +// anyBoolean()); +// verify(jdbcTemplate).queryForList((String) any(), (Object[]) any()); +// verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); +// } +// +// @Test +// void testFetchEscalatedApplicationsBusinessIdsFromDb() throws DataAccessException { +// when(workflowQueryBuilder.getAutoEscalatedApplicationsBusinessIdsQuery((ProcessInstanceSearchCriteria) any(), +// (ArrayList) any())).thenReturn("Auto Escalated Applications Business Ids Query"); +// ArrayList objectList = new ArrayList<>(); +// when(jdbcTemplate.query((String) any(), (Object[]) any(), (RowMapper) any())).thenReturn(objectList); +// when(workflowUtil.replaceSchemaPlaceholder((String) any(), (String) any())) +// .thenReturn("Replace Schema Placeholder"); +// RequestInfo requestInfo = new RequestInfo(); +// +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// List actualFetchEscalatedApplicationsBusinessIdsFromDbResult = worKflowRepository +// .fetchEscalatedApplicationsBusinessIdsFromDb(requestInfo, processInstanceSearchCriteria); +// assertSame(objectList, actualFetchEscalatedApplicationsBusinessIdsFromDbResult); +// assertTrue(actualFetchEscalatedApplicationsBusinessIdsFromDbResult.isEmpty()); +// verify(workflowQueryBuilder).getAutoEscalatedApplicationsBusinessIdsQuery((ProcessInstanceSearchCriteria) any(), +// (ArrayList) any()); +// verify(jdbcTemplate).query((String) any(), (Object[]) any(), (RowMapper) any()); +// verify(workflowUtil).replaceSchemaPlaceholder((String) any(), (String) any()); +// } +// +// @Test +// void testGetEscalatedApplicationsCount() throws DataAccessException { +// when(workflowQueryBuilder.getEscalatedApplicationsCount((RequestInfo) any(), +// (ProcessInstanceSearchCriteria) any(), (ArrayList) any())).thenReturn("3"); +// when(jdbcTemplate.queryForObject((String) any(), (Object[]) any(), (Class) any())).thenReturn(1); +// RequestInfo requestInfo = new RequestInfo(); +// +// ProcessInstanceSearchCriteria processInstanceSearchCriteria = new ProcessInstanceSearchCriteria(); +// processInstanceSearchCriteria.setAssignee("Assignee"); +// processInstanceSearchCriteria.setBusinessIds(new ArrayList<>()); +// processInstanceSearchCriteria.setBusinessService("Business Service"); +// processInstanceSearchCriteria.setFromDate(1L); +// processInstanceSearchCriteria.setHistory(true); +// processInstanceSearchCriteria.setIds(new ArrayList<>()); +// processInstanceSearchCriteria.setIsAssignedToMeCount(true); +// processInstanceSearchCriteria.setIsEscalatedCount(true); +// processInstanceSearchCriteria.setIsNearingSlaCount(true); +// processInstanceSearchCriteria.setLimit(1); +// processInstanceSearchCriteria.setModuleName("Module Name"); +// processInstanceSearchCriteria.setMultipleAssignees(new ArrayList<>()); +// processInstanceSearchCriteria.setOffset(2); +// processInstanceSearchCriteria.setSlotPercentageSlaLimit(1L); +// processInstanceSearchCriteria.setStatesToIgnore(new ArrayList<>()); +// processInstanceSearchCriteria.setStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setStatusesIrrespectiveOfTenant(new ArrayList<>()); +// processInstanceSearchCriteria.setTenantId("42"); +// processInstanceSearchCriteria.setTenantSpecifiStatus(new ArrayList<>()); +// processInstanceSearchCriteria.setToDate(1L); +// assertEquals(1, +// worKflowRepository.getEscalatedApplicationsCount(requestInfo, processInstanceSearchCriteria).intValue()); +// verify(workflowQueryBuilder).getEscalatedApplicationsCount((RequestInfo) any(), +// (ProcessInstanceSearchCriteria) any(), (ArrayList) any()); +// verify(jdbcTemplate).queryForObject((String) any(), (Object[]) any(), (Class) any()); +// } +//} +// diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/web/controllers/BusinessServiceControllerTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/web/controllers/BusinessServiceControllerTest.java index c3280c74e34..6b65caf07d4 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/web/controllers/BusinessServiceControllerTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/web/controllers/BusinessServiceControllerTest.java @@ -98,6 +98,7 @@ void testSearch() throws Exception { requestInfoWrapper.setRequestInfo(new RequestInfo()); String content = (new ObjectMapper()).writeValueAsString(requestInfoWrapper); MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/egov-wf/businessservice/_search") + .param("tenantId", "default") .contentType(MediaType.APPLICATION_JSON) .content(content); ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(this.businessServiceController) diff --git a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/web/controllers/WorkflowControllerTest.java b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/web/controllers/WorkflowControllerTest.java index e0e04ac7b8c..9d7f83de4d6 100644 --- a/core-services/egov-workflow-v2/src/test/java/org/egov/wf/web/controllers/WorkflowControllerTest.java +++ b/core-services/egov-workflow-v2/src/test/java/org/egov/wf/web/controllers/WorkflowControllerTest.java @@ -6,8 +6,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.response.ResponseInfo; import org.egov.wf.service.WorkflowService; diff --git a/core-services/gateway/.gitignore b/core-services/gateway/.gitignore new file mode 100644 index 00000000000..549e00a2a96 --- /dev/null +++ b/core-services/gateway/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/core-services/gateway/CHANGELOG.MD b/core-services/gateway/CHANGELOG.MD new file mode 100644 index 00000000000..515f5780622 --- /dev/null +++ b/core-services/gateway/CHANGELOG.MD @@ -0,0 +1,5 @@ +# Changelog +All notable changes to this module will be documented in this file. + +## 2.9.1-HOTFIX - 2024-05-28 +- Fixed support for form data diff --git a/core-services/gateway/mvnw b/core-services/gateway/mvnw new file mode 100755 index 00000000000..8a8fb2282df --- /dev/null +++ b/core-services/gateway/mvnw @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# 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 +# +# https://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/core-services/gateway/pom.xml b/core-services/gateway/pom.xml new file mode 100644 index 00000000000..4f27aa17ca1 --- /dev/null +++ b/core-services/gateway/pom.xml @@ -0,0 +1,122 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.2 + + + org.egov + gateway + 1.0.0-SNAPSHOT + gateway + API Gateway for Spring Boot + + 17 + 3.1.1 + 2.17.1 + ${java.version} + ${java.version} + + + + org.springframework.boot + spring-boot-starter-data-redis-reactive + + + commons-io + commons-io + 2.15.1 + + + org.springframework.cloud + spring-cloud-starter-gateway + 4.1.1 + + + com.jayway.jsonpath + json-path + 2.9.0 + + + + + + + + org.projectlombok + lombok + 1.18.22 + + + org.egov.services + tracer + 2.9.0-SNAPSHOT + + + org.egov.services + services-common + 2.9.0-SNAPSHOT + + + org.springframework.kafka + spring-kafka + + + + com.google.code.gson + gson + 2.10.1 + + + org.springframework.kafka + spring-kafka + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-reactor-netty + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + + + + + + + + + + + + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + diff --git a/core-services/gateway/src/main/java/com/example/gateway/GatewayApplication.java b/core-services/gateway/src/main/java/com/example/gateway/GatewayApplication.java new file mode 100644 index 00000000000..2e5d88aa27a --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/GatewayApplication.java @@ -0,0 +1,78 @@ +package com.example.gateway; +import com.example.gateway.config.ApplicationProperties; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.gateway.filter.ratelimit.RedisRateLimiter; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.PropertySource; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +import java.util.Collections; +import java.util.List; + +@SpringBootApplication +@RestController +@PropertySource({"${spring.routes.filepath}"}) +public class GatewayApplication { + + @Autowired + private ApplicationProperties applicationProperties; + + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } + + @Value("${egov.user-info-header}") + private String userInfoHeader; + private List encryptedUrlSet; + private List openEndpointsWhitelist; + private List mixedModeEndpointsWhitelist; + + @Value("${egov.encrypted-endpoints-list}") + public void setEncrytpedUrlListValues(List EcryptedListFromProperties) { + this.encryptedUrlSet = Collections.unmodifiableList(EcryptedListFromProperties); + } + + @Value("${egov.open-endpoints-whitelist}") + public void setOpenEndpointsWhitelistValues(List openUrlListFromProperties) { + this.openEndpointsWhitelist = Collections.unmodifiableList(openUrlListFromProperties); + } + + @Value("${egov.mixed-mode-endpoints-whitelist}") + public void setMixModeEndpointListVaaues(List mixModeUrlListFromProperties) { + this.mixedModeEndpointsWhitelist = Collections.unmodifiableList(mixModeUrlListFromProperties); + } + + @Value("${egov.auth-service-host}") + private String authServiceHost; + + @Value("${egov.auth-service-uri}") + private String authServiceUri; + + @Value("${egov.authorize.access.control.host}${egov.authorize.access.control.uri}") + private String authorizationUrl; + + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } + + @Bean + public MultiStateInstanceUtil centralInstanceUtil() { + return new MultiStateInstanceUtil(); + } + + /** + * This to create a default RedisRateLimiter + * @return + */ + @Bean + public RedisRateLimiter redisRateLimiter() { + return new RedisRateLimiter(applicationProperties.getDefaultReplenishRate(), applicationProperties.getDefaultBurstCapacity()); + } + +} \ No newline at end of file diff --git a/core-services/gateway/src/main/java/com/example/gateway/config/ApplicationProperties.java b/core-services/gateway/src/main/java/com/example/gateway/config/ApplicationProperties.java new file mode 100644 index 00000000000..6158370dcdf --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/config/ApplicationProperties.java @@ -0,0 +1,57 @@ +package com.example.gateway.config; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +import java.util.Collections; +import java.util.List; + +@Configuration +@ToString +@Setter +@Getter +public class ApplicationProperties { + + @Value("${egov.auth-service-host}") + private String authServiceHost; + + @Value("${egov.auth-service-uri}") + private String authUri; + + @Value("${egov.auth-service-host}${egov.user.search.path}") + private String userSearchURI; + + @Value("${spring.data.redis.default.replenishRate}") + private Integer defaultReplenishRate; + + @Value("${spring.data.redis.default.burstCapacity}") + private Integer defaultBurstCapacity; + + @Value("${egov.authorize.access.control.host}${egov.authorize.access.control.uri}") + private String authorizationUrl; + + private List encryptedUrlSet; + + private List openEndpointsWhitelist; + + private List mixedModeEndpointsWhitelist; + @Value("${egov.encrypted-endpoints-list}") + public void setEncryptedUrlListValues(List encryptedListFromProperties) { + this.encryptedUrlSet = Collections.unmodifiableList(encryptedListFromProperties); + } + + @Value("${egov.open-endpoints-whitelist}") + public void setOpenEndpointsWhitelistValues(List openUrlListFromProperties) { + this.openEndpointsWhitelist = Collections.unmodifiableList(openUrlListFromProperties); + } + + @Value("${egov.mixed-mode-endpoints-whitelist}") + public void setMixModeEndpointListValues(List mixModeUrlListFromProperties) { + this.mixedModeEndpointsWhitelist = Collections.unmodifiableList(mixModeUrlListFromProperties); + } + + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/config/RedisConfig.java b/core-services/gateway/src/main/java/com/example/gateway/config/RedisConfig.java new file mode 100644 index 00000000000..69fba464d8e --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/config/RedisConfig.java @@ -0,0 +1,35 @@ +/* +package com.example.gateway.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConfiguration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.RedisStandaloneConfiguration; +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.data.redis.core.StringRedisTemplate; + +@Configuration +public class RedisConfig { + + @Value("${spring.redis.host}") + private String redisHost; + + @Value("${spring.redis.port}") + private int redisPort; + + @Bean + public RedisConnectionFactory redisConnectionFactory() { + RedisConfiguration redisConfiguration = new RedisStandaloneConfiguration(redisHost, redisPort); + return new LettuceConnectionFactory(redisConfiguration); + } + + @Bean + public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory) { + return new StringRedisTemplate(redisConnectionFactory); + } + +} +*/ diff --git a/core-services/gateway/src/main/java/com/example/gateway/constants/GatewayConstants.java b/core-services/gateway/src/main/java/com/example/gateway/constants/GatewayConstants.java new file mode 100644 index 00000000000..ba6bc9f6329 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/constants/GatewayConstants.java @@ -0,0 +1,40 @@ +package com.example.gateway.constants; + +public class GatewayConstants { + + public static final String EMPTY_STRING = ""; + public static final String JSON_TYPE = "json"; + public static final String X_WWW_FORM_URLENCODED_TYPE = "application/x-www-form-urlencoded"; + public static final String FORM_DATA = "multipart/form-data"; + public static final String RECEIVED_REQUEST_MESSAGE = "Received request for: {}"; + public static final String AUTH_BOOLEAN_FLAG_NAME = "shouldDoAuth"; + public static final String AUTH_TOKEN_KEY = "authToken"; + public static final String ERROR_MESSAGE_KEY = "error.message"; + public static final String ERROR_CODE_KEY = "error.status_code"; + public static final String CURRENT_REQUEST_TENANTID = "request.tenant_id"; + public static final String CURRENT_REQUEST_SANITIZED_BODY = "request.body.sanitized"; + public static final String CURRENT_REQUEST_SANITIZED_BODY_STR = "request.body.sanitized.str"; + public static final String CURRENT_REQUEST_START_TIME = "request.time.start"; + public static final String CURRENT_REQUEST_END_TIME = "request.time.end"; + public static final String GET = "GET"; + public static final String POST = "POST"; + public static final String PUT = "PUT"; + public static final String PATCH = "PATCH"; + + public static final String FILESTORE_REGEX = "^/filestore/.*"; + public static final String REQUEST_INFO_FIELD_NAME_PASCAL_CASE = "RequestInfo"; + public static final String REQUEST_INFO_FIELD_NAME_CAMEL_CASE = "requestInfo"; + public static final String USER_INFO_FIELD_NAME = "userInfo"; + public static final String USER_INFO_KEY = "USER_INFO"; + public static final String CORRELATION_ID_FIELD_NAME = "correlationId"; + public static final String CORRELATION_ID_HEADER_NAME = "x-correlation-id"; + public static final String CORRELATION_ID_KEY = "CORRELATION_ID"; + public static final String TENANTID_MDC = "TENANTID"; + public static final String RBAC_BOOLEAN_FLAG_NAME = "shouldDoRbac"; + public static final String SKIP_RBAC = "RBAC check skipped"; + public static final String REQUEST_TENANT_ID_KEY = "tenantId"; + public static final String TENANT_ID_KEY = "TENANT_ID"; + public static final String OPEN_ENDPOINT_MESSAGE = "Routing to an open endpoint: {}"; + + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/error/ErrorFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/error/ErrorFilter.java new file mode 100644 index 00000000000..b3d0699ec10 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/error/ErrorFilter.java @@ -0,0 +1,38 @@ +package com.example.gateway.filters.error; + +import com.example.gateway.utils.ExceptionUtils; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyResponseBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; + +import java.util.Map; + +import static com.example.gateway.constants.GatewayConstants.REQUEST_INFO_FIELD_NAME_PASCAL_CASE; +import static com.example.gateway.utils.ExceptionUtils.raiseErrorFilterException; + +@Slf4j +@Component +public class ErrorFilter implements GlobalFilter, Ordered { + + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + return chain.filter(exchange) + .onErrorResume(throwable -> { + return ExceptionUtils.raiseErrorFilterException(exchange, throwable); + }); + } + @Override + public int getOrder () { + return Ordered.HIGHEST_PRECEDENCE + 1; + } +} \ No newline at end of file diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/post/CustomAsyncFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/post/CustomAsyncFilter.java new file mode 100644 index 00000000000..29fc0c30427 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/post/CustomAsyncFilter.java @@ -0,0 +1,90 @@ +package com.example.gateway.filters.post; + +import com.example.gateway.model.CustomAsyncRequest; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.cloud.gateway.filter.WebClientWriteResponseFilter; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyRequestBodyGatewayFilterFactory; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyResponseBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.io.buffer.DataBufferFactory; +import org.springframework.core.io.buffer.DataBufferUtils; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.http.server.reactive.ServerHttpResponse; +import org.springframework.http.server.reactive.ServerHttpResponseDecorator; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@Slf4j +@Component +public class CustomAsyncFilter implements GlobalFilter, Ordered { + + @Value("#{'${egov.custom.async.uris}'.split(',')}") + private List sourceUri; + + @Value("${egov.custom.async.filter.topic}") + private String topic; + + @Autowired + private KafkaTemplate kafkaTemplate; + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + log.info("Executing CustomAsyncFilter"); + try { + + // TODO: Enrich Request and Response body + + CustomAsyncRequest customAsyncRequest = CustomAsyncRequest.builder() + .sourceUri(exchange.getRequest().getURI().toString()) + .queryParamMap(exchange.getRequest().getQueryParams()) + .build(); + + log.info("CustomAsyncFilter Topic:" + topic); +// kafkaTemplate.send(topic, customAsyncRequest); + + + } catch (Exception ex) { + log.error("Exception while sending async request to kafka topic: " + ex.getMessage()); + } + + return chain.filter(exchange); + } + + private Map jsonToMap(String json) { + Map resMap = null; + if (json != null) { + try { + resMap = new ObjectMapper().readValue(json, new TypeReference>() { + }); + } catch (IOException e) { + // TODO Auto-generated catch block + log.error("IO exception while converting json to map: " + e.getMessage()); + } + } + return resMap; + } + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE-2; + } +} + diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/post/PostEventLogFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/post/PostEventLogFilter.java new file mode 100644 index 00000000000..3a4645aa479 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/post/PostEventLogFilter.java @@ -0,0 +1,61 @@ +package com.example.gateway.filters.post; + +import com.example.gateway.utils.EventLoggerUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyResponseBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; + +@Slf4j +@Component +public class PostEventLogFilter implements GlobalFilter , Ordered { + + @Value("${eventlog.enabled:false}") + Boolean eventLogEnabled; + + @Value("${eventlog.topic}") + String eventLogSuccessTopic; + + @Value("#{'${eventlog.urls.whitelist}'.split(',')}") + private List urlsWhiteList; + + @Autowired + private EventLoggerUtil eventLoggerUtil; + + @Autowired + private ModifyResponseBodyGatewayFilterFactory modifyResponseBodyGatewayFilter; + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + String requestURL = exchange.getRequest().getURI().toString(); + Boolean toLog = urlsWhiteList.stream().anyMatch(url -> requestURL.startsWith(url)) || urlsWhiteList.isEmpty(); + + return modifyResponseBodyGatewayFilter.apply(new ModifyResponseBodyGatewayFilterFactory + .Config() + .setRewriteFunction(Map.class,Map.class, + (exchange1, body) -> { + + if(eventLogEnabled && toLog) + eventLoggerUtil.logCurrentRequest(exchange1,body,eventLogSuccessTopic); + + return Mono.just(body); + } + )).filter(exchange, chain); + + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE-1; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/post/PostHookFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/post/PostHookFilter.java new file mode 100644 index 00000000000..98fc7ba5af4 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/post/PostHookFilter.java @@ -0,0 +1,24 @@ +package com.example.gateway.filters.post; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +@Slf4j +//@Component +public class PostHookFilter implements GlobalFilter , Ordered { + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + // Implement PostHook + return null; + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE-3; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/post/ResponseEnhancementFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/post/ResponseEnhancementFilter.java new file mode 100644 index 00000000000..2d07a409001 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/post/ResponseEnhancementFilter.java @@ -0,0 +1,47 @@ +package com.example.gateway.filters.post; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import static com.example.gateway.constants.GatewayConstants.CORRELATION_ID_KEY; + +@Slf4j +@Component +public class ResponseEnhancementFilter implements GlobalFilter , Ordered { + + private static final String CORRELATION_HEADER_NAME = "x-correlation-id"; + private static final String RECEIVED_RESPONSE_MESSAGE = "Received response code: {} from upstream URI {}"; + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + try { + logger.info(RECEIVED_RESPONSE_MESSAGE, exchange.getResponse().getStatusCode(), exchange.getRequest().getURI()); + exchange.getResponse().getHeaders().add(CORRELATION_HEADER_NAME, exchange.getAttributes().getOrDefault(CORRELATION_ID_KEY,"").toString()); + exchange.getResponse().getHeaders().add("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate"); + return chain.filter(exchange); + } catch (Exception e) { + + logger.error("Error in filter", e); + return Mono.error(e); // Return an error Mono + + } + + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE-4; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/AuthFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/AuthFilter.java new file mode 100644 index 00000000000..551c4cb43d9 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/AuthFilter.java @@ -0,0 +1,51 @@ +package com.example.gateway.filters.pre; + +import com.example.gateway.filters.pre.helpers.AuthCheckFilterHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpHeaders; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyRequestBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.Map; + +import static com.example.gateway.constants.GatewayConstants.AUTH_BOOLEAN_FLAG_NAME; + +@Slf4j +@Component +public class AuthFilter implements GlobalFilter, Ordered { + + private ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter; + + private AuthCheckFilterHelper authCheckFilterHelper; + + public AuthFilter(ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter, AuthCheckFilterHelper authCheckFilterHelper) { + this.modifyRequestBodyFilter = modifyRequestBodyFilter; + this.authCheckFilterHelper = authCheckFilterHelper; + } + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + Boolean doAuth = exchange.getAttribute(AUTH_BOOLEAN_FLAG_NAME); + + if(doAuth) { + return modifyRequestBodyFilter.apply(new ModifyRequestBodyGatewayFilterFactory.Config() + .setRewriteFunction(Map.class, Map.class, authCheckFilterHelper)) + .filter(exchange, chain); + } + else { + return chain.filter(exchange); + } + } + + @Override + public int getOrder() { + return 4; + } + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/AuthPreCheckFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/AuthPreCheckFilter.java new file mode 100644 index 00000000000..ef020b79a82 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/AuthPreCheckFilter.java @@ -0,0 +1,60 @@ +package com.example.gateway.filters.pre; + +import com.example.gateway.config.ApplicationProperties; +import com.example.gateway.filters.pre.helpers.AuthPreCheckFilterHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpHeaders; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyRequestBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; + +import static com.example.gateway.constants.GatewayConstants.*; +import static com.example.gateway.constants.GatewayConstants.OPEN_ENDPOINT_MESSAGE; + +@Slf4j +@Component +public class AuthPreCheckFilter implements GlobalFilter, Ordered { + + private ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter; + + private AuthPreCheckFilterHelper authPreCheckFilterHelper; + + private ApplicationProperties applicationProperties; + + public AuthPreCheckFilter(ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter, AuthPreCheckFilterHelper authPreCheckFilterHelper, ApplicationProperties applicationProperties) { + this.modifyRequestBodyFilter = modifyRequestBodyFilter; + this.authPreCheckFilterHelper = authPreCheckFilterHelper; + this.applicationProperties = applicationProperties; + } + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + String authToken; + String endPointPath = exchange.getRequest().getPath().value(); + + if (applicationProperties.getOpenEndpointsWhitelist().contains(endPointPath)) { + exchange.getAttributes().put(AUTH_BOOLEAN_FLAG_NAME, Boolean.FALSE); + log.info(OPEN_ENDPOINT_MESSAGE, endPointPath); + return chain.filter(exchange); + } + else { + return modifyRequestBodyFilter.apply(new ModifyRequestBodyGatewayFilterFactory.Config() + .setRewriteFunction(Map.class, Map.class, authPreCheckFilterHelper)) + .filter(exchange, chain); + } + } + + @Override + public int getOrder() { + return 2; + } + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/CorrelationIdFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/CorrelationIdFilter.java new file mode 100644 index 00000000000..0ade2183198 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/CorrelationIdFilter.java @@ -0,0 +1,75 @@ +package com.example.gateway.filters.pre; + +import com.example.gateway.config.ApplicationProperties; +import com.example.gateway.filters.pre.helpers.CorrIdFormDataFilterHelper; +import com.example.gateway.filters.pre.helpers.CorrelationIdFilterHelper; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpHeaders; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.tracer.model.CustomException; +import org.slf4j.MDC; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyRequestBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.http.codec.multipart.Part; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import static com.example.gateway.constants.GatewayConstants.*; + +@Slf4j +@Component +public class CorrelationIdFilter implements GlobalFilter, Ordered { + + private ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter; + + private CorrelationIdFilterHelper correlationIdFilterHelper; + + private CorrIdFormDataFilterHelper correlationIdFormDataFilterHelper; + + private ApplicationProperties applicationProperties; + + public CorrelationIdFilter(ModifyRequestBodyGatewayFilterFactory modifyRequestBodyGatewayFilter, CorrelationIdFilterHelper correlationIdFilterHelper, + CorrIdFormDataFilterHelper correlationIdFormDataFilterHelper, ApplicationProperties applicationProperties) { + + this.modifyRequestBodyFilter = modifyRequestBodyGatewayFilter; + this.correlationIdFilterHelper = correlationIdFilterHelper; + this.correlationIdFormDataFilterHelper = correlationIdFormDataFilterHelper; + + this.applicationProperties = applicationProperties; + } + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + String contentType = exchange.getRequest().getHeaders().getFirst(HttpHeaders.CONTENT_TYPE); + String endPointPath = exchange.getRequest().getPath().value(); + + if(endPointPath.contains("/filestore")){ + return chain.filter(exchange); + } + else if (contentType != null && (contentType.contains("multipart/form-data") || contentType.contains("application/x-www-form-urlencoded"))) { + return modifyRequestBodyFilter.apply(new ModifyRequestBodyGatewayFilterFactory.Config() + .setRewriteFunction(MultiValueMap.class, MultiValueMap.class, correlationIdFormDataFilterHelper)) + .filter(exchange, chain); + } + else { + return modifyRequestBodyFilter.apply(new ModifyRequestBodyGatewayFilterFactory.Config() + .setRewriteFunction(Map.class, Map.class, correlationIdFilterHelper)) + .filter(exchange, chain); + } + } + + @Override + public int getOrder() { + return 1; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/PreHookFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/PreHookFilter.java new file mode 100644 index 00000000000..3b31fe5d133 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/PreHookFilter.java @@ -0,0 +1,44 @@ +package com.example.gateway.filters.pre; + +import com.example.gateway.filters.pre.helpers.PreHookFilterHelper; +import org.apache.http.HttpHeaders; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyRequestBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.Map; + +public class PreHookFilter implements GlobalFilter, Ordered { + + private ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter; + + private PreHookFilterHelper preHookFilterHelper; + + public PreHookFilter(ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter, PreHookFilterHelper preHookFilterHelper) { + this.modifyRequestBodyFilter = modifyRequestBodyFilter; + this.preHookFilterHelper = preHookFilterHelper; + } + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + String contentType = exchange.getRequest().getHeaders().getFirst(HttpHeaders.CONTENT_TYPE); + + if (contentType != null && (contentType.contains("multipart/form-data") || contentType.contains("application/x-www-form-urlencoded"))) { + return chain.filter(exchange); + } else { + return modifyRequestBodyFilter.apply(new ModifyRequestBodyGatewayFilterFactory.Config() + .setRewriteFunction(Map.class, Map.class, preHookFilterHelper)) + .filter(exchange, chain); + } + + } + + @Override + public int getOrder() { + return 3; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RbacFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RbacFilter.java new file mode 100644 index 00000000000..eef4a37a443 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RbacFilter.java @@ -0,0 +1,49 @@ +package com.example.gateway.filters.pre; + +import com.example.gateway.filters.pre.helpers.RbacFilterHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpHeaders; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyRequestBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.Map; + +import static com.example.gateway.constants.GatewayConstants.RBAC_BOOLEAN_FLAG_NAME; + +@Slf4j +@Component +public class RbacFilter implements GlobalFilter , Ordered { + + private ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter; + private RbacFilterHelper rbacFilterHelper; + + public RbacFilter(ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter, RbacFilterHelper rbacFilterHelper) { + this.modifyRequestBodyFilter = modifyRequestBodyFilter; + this.rbacFilterHelper = rbacFilterHelper; + } + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + Boolean rbacFlag = exchange.getAttribute(RBAC_BOOLEAN_FLAG_NAME); + + if(rbacFlag) { + return modifyRequestBodyFilter.apply(new ModifyRequestBodyGatewayFilterFactory.Config() + .setRewriteFunction(Map.class, Map.class, rbacFilterHelper)) + .filter(exchange, chain); + + } + + return chain.filter(exchange); + } + + @Override + public int getOrder() { + return 5; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RbacPreCheckFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RbacPreCheckFilter.java new file mode 100644 index 00000000000..490cba4f103 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RbacPreCheckFilter.java @@ -0,0 +1,58 @@ +package com.example.gateway.filters.pre; + +import com.example.gateway.config.ApplicationProperties; +import com.example.gateway.filters.pre.helpers.RbacPreCheckFilterHelper; +import com.example.gateway.filters.pre.helpers.RbacPreCheckFormDataFilterHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpHeaders; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyRequestBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; + +import static com.example.gateway.constants.GatewayConstants.*; + +@Slf4j +@Component +public class RbacPreCheckFilter implements GlobalFilter, Ordered { + + private ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter; + + private final List anonymousEndpointsWhitelist; + + private final ApplicationProperties applicationProperties; + + public RbacPreCheckFilter(ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter, List anonymousEndpointsWhitelist, ApplicationProperties applicationProperties) { + this.modifyRequestBodyFilter = modifyRequestBodyFilter; + this.anonymousEndpointsWhitelist = anonymousEndpointsWhitelist; + this.applicationProperties = applicationProperties; + } + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + String endPointPath = exchange.getRequest().getPath().value(); + + if(applicationProperties.getOpenEndpointsWhitelist().contains(endPointPath) || anonymousEndpointsWhitelist.contains(endPointPath)){ + exchange.getAttributes().put(RBAC_BOOLEAN_FLAG_NAME, false); + log.info(SKIP_RBAC, endPointPath); + } + else { + exchange.getAttributes().put(RBAC_BOOLEAN_FLAG_NAME, true); + } + return chain.filter(exchange); + + } + + @Override + public int getOrder() { + return 3; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RequestEnrichmentFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RequestEnrichmentFilter.java new file mode 100644 index 00000000000..5fe3c5f0e28 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RequestEnrichmentFilter.java @@ -0,0 +1,47 @@ +package com.example.gateway.filters.pre; + +import com.example.gateway.filters.pre.helpers.RequestEnrichmentFilterHelper; +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpHeaders; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyRequestBodyGatewayFilterFactory; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.Map; + +@Slf4j +@Component +public class RequestEnrichmentFilter implements GlobalFilter , Ordered { + + private ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter; + + private RequestEnrichmentFilterHelper requestEnrichmentFilterHelper; + + public RequestEnrichmentFilter(ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter, RequestEnrichmentFilterHelper requestEnrichmentFilterHelper) { + this.modifyRequestBodyFilter = modifyRequestBodyFilter; + this.requestEnrichmentFilterHelper = requestEnrichmentFilterHelper; + } + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + String contentType = exchange.getRequest().getHeaders().getFirst(HttpHeaders.CONTENT_TYPE); + + if (contentType != null && (contentType.contains("multipart/form-data") || contentType.contains("application/x-www-form-urlencoded"))) { + return chain.filter(exchange); + } else { + return modifyRequestBodyFilter.apply(new ModifyRequestBodyGatewayFilterFactory.Config() + .setRewriteFunction(Map.class, Map.class, requestEnrichmentFilterHelper)) + .filter(exchange, chain); + } + + } + + @Override + public int getOrder() { + return 6; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RequestStartTimeFilter.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RequestStartTimeFilter.java new file mode 100644 index 00000000000..b7060ad527c --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/RequestStartTimeFilter.java @@ -0,0 +1,29 @@ +package com.example.gateway.filters.pre; + +import lombok.extern.slf4j.Slf4j; +import org.apache.http.HttpHeaders; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; +import static com.example.gateway.constants.GatewayConstants.CURRENT_REQUEST_START_TIME; + +@Slf4j +@Component +public class RequestStartTimeFilter implements GlobalFilter, Ordered { + + public RequestStartTimeFilter() {} + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + exchange.getAttributes().put(CURRENT_REQUEST_START_TIME, System.currentTimeMillis()); + return chain.filter(exchange); + } + + @Override + public int getOrder() { + return 0; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/AuthCheckFilterHelper.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/AuthCheckFilterHelper.java new file mode 100644 index 00000000000..317378187b9 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/AuthCheckFilterHelper.java @@ -0,0 +1,45 @@ +package com.example.gateway.filters.pre.helpers; + +import com.example.gateway.utils.UserUtils; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.User; +import org.egov.tracer.model.CustomException; +import org.reactivestreams.Publisher; +import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; +import java.util.Map; +import static com.example.gateway.constants.GatewayConstants.REQUEST_INFO_FIELD_NAME_PASCAL_CASE; + +@Slf4j +@Component +public class AuthCheckFilterHelper implements RewriteFunction { + + private ObjectMapper objectMapper; + + private UserUtils userUtils; + + public AuthCheckFilterHelper(ObjectMapper objectMapper, UserUtils userUtils) { + this.objectMapper = objectMapper; + this.userUtils = userUtils; + } + + @Override + public Publisher apply(ServerWebExchange serverWebExchange, Map body) { + try { + RequestInfo requestInfo = objectMapper.convertValue(body.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE), RequestInfo.class); + requestInfo.setUserInfo(userUtils.getUser(requestInfo.getAuthToken())); + body.put(REQUEST_INFO_FIELD_NAME_PASCAL_CASE, requestInfo); + return Mono.just(body); + } catch (Exception ex) { + log.error("An error occured while transforming the request body in class RequestBodyRewrite. {}", ex); + + // Throw a custom exception + throw new CustomException("AUTHENTICATION_ERROR", ex.getMessage()); + } + } + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/AuthPreCheckFilterHelper.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/AuthPreCheckFilterHelper.java new file mode 100644 index 00000000000..3ece265c88b --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/AuthPreCheckFilterHelper.java @@ -0,0 +1,84 @@ +package com.example.gateway.filters.pre.helpers; + +import com.example.gateway.utils.UserUtils; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.tracer.model.CustomException; +import org.reactivestreams.Publisher; +import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; + +import static com.example.gateway.constants.GatewayConstants.*; + +@Slf4j +@Component +public class AuthPreCheckFilterHelper implements RewriteFunction { + + public static final String AUTH_TOKEN_RETRIEVE_FAILURE_MESSAGE = "Retrieving of auth token failed"; + public static final String ROUTING_TO_ANONYMOUS_ENDPOINT_MESSAGE = "Routing to anonymous endpoint: {}"; + public static final String ROUTING_TO_PROTECTED_ENDPOINT_RESTRICTED_MESSAGE = + "Routing to protected endpoint {} restricted - No auth token"; + public static final String UNAUTHORIZED_USER_MESSAGE = "You are not authorized to access this resource"; + public static final String PROCEED_ROUTING_MESSAGE = "Routing to an endpoint: {} - auth provided"; + private List openEndpointsWhitelist; + private List mixedModeEndpointsWhitelist; + private ObjectMapper objectMapper; + + private UserUtils userUtils; + public AuthPreCheckFilterHelper(List openEndpointsWhitelist, List mixedModeEndpointsWhitelist, + ObjectMapper objectMapper, UserUtils userUtils) { + + this.openEndpointsWhitelist = openEndpointsWhitelist; + this.mixedModeEndpointsWhitelist = mixedModeEndpointsWhitelist; + this.objectMapper = objectMapper; + } + + + @Override + public Publisher apply(ServerWebExchange exchange, Map body) { + + String authToken; + String endPointPath = exchange.getRequest().getPath().value(); + + if (openEndpointsWhitelist.contains(endPointPath)) { + exchange.getAttributes().put(AUTH_BOOLEAN_FLAG_NAME, Boolean.FALSE); + log.info(OPEN_ENDPOINT_MESSAGE, endPointPath); + return Mono.just(body); + } + + try { + RequestInfo requestInfo = objectMapper.convertValue(body.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE), RequestInfo.class); + authToken = requestInfo.getAuthToken(); + } catch (Exception e) { + log.error(AUTH_TOKEN_RETRIEVE_FAILURE_MESSAGE, e); + throw new CustomException(AUTH_TOKEN_RETRIEVE_FAILURE_MESSAGE, e.getMessage()); + } + + if (ObjectUtils.isEmpty(authToken)) { + if (mixedModeEndpointsWhitelist.contains(endPointPath)) { + log.info(ROUTING_TO_ANONYMOUS_ENDPOINT_MESSAGE, endPointPath); + exchange.getAttributes().put(AUTH_BOOLEAN_FLAG_NAME, Boolean.FALSE); +// User systemUser = userUtils.fetchSystemUser(requestInfo.getTenantId(), exchange.getRequest().getHeaders().getFirst(CORRELATION_ID_HEADER_NAME)); + } else { + log.info(ROUTING_TO_PROTECTED_ENDPOINT_RESTRICTED_MESSAGE, endPointPath); + CustomException customException = new CustomException(UNAUTHORIZED_USER_MESSAGE, UNAUTHORIZED_USER_MESSAGE); + customException.setCode(HttpStatus.UNAUTHORIZED.toString()); + throw customException; + } + } else { + log.info(PROCEED_ROUTING_MESSAGE, endPointPath); + exchange.getAttributes().put(AUTH_BOOLEAN_FLAG_NAME, Boolean.TRUE); + + } + + return Mono.just(body); + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/CorrIdFormDataFilterHelper.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/CorrIdFormDataFilterHelper.java new file mode 100644 index 00000000000..331676dcf04 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/CorrIdFormDataFilterHelper.java @@ -0,0 +1,81 @@ +package com.example.gateway.filters.pre.helpers; + +import com.example.gateway.config.ApplicationProperties; +import com.example.gateway.utils.CommonUtils; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.JsonNodeType; +import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.tracer.model.CustomException; +import org.reactivestreams.Publisher; +import org.slf4j.MDC; +import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction; +import org.springframework.http.HttpStatus; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.MultiValueMap; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.*; + +import static com.example.gateway.constants.GatewayConstants.*; + +@Slf4j +@Component +public class CorrIdFormDataFilterHelper implements RewriteFunction { + + private ApplicationProperties applicationProperties; + + private MultiStateInstanceUtil centralInstanceUtil; + + private ObjectMapper objectMapper; + + private CommonUtils commonUtils; + + public CorrIdFormDataFilterHelper(ApplicationProperties applicationProperties, MultiStateInstanceUtil centralInstanceUtil, + ObjectMapper objectMapper, CommonUtils commonUtils) { + this.applicationProperties = applicationProperties; + this.centralInstanceUtil = centralInstanceUtil; + this.objectMapper = objectMapper; + this.commonUtils = commonUtils; + } + + @Override + public Publisher apply(ServerWebExchange exchange, MultiValueMap body) { + + String requestURI = exchange.getRequest().getPath().value(); + String requestPath = exchange.getRequest().getPath().toString(); + Boolean isOpenRequest = applicationProperties.getOpenEndpointsWhitelist().contains(requestPath); + Boolean isMixModeRequest = applicationProperties.getMixedModeEndpointsWhitelist().contains(requestPath); + + if (centralInstanceUtil.getIsEnvironmentCentralInstance() && (isOpenRequest || isMixModeRequest) + && !requestURI.equalsIgnoreCase("/user/oauth/token")) { + /* + * Adding tenantid to header for open urls, authorized urls will get ovverrided + * in RBAC filter + */ + Set tenantIds = commonUtils.getTenantIdsFromRequest(exchange.getRequest(), body.toSingleValueMap()); + + if (CollectionUtils.isEmpty(tenantIds) && isOpenRequest) { + throw new CustomException("INVALID_TENANT_ID", "No tenantId in the request"); + } + + String tenantId = commonUtils.getLowLevelTenantIdFromSet(tenantIds); + MDC.put(TENANTID_MDC, tenantId); + exchange.getAttributes().put(TENANTID_MDC, tenantId); + + } + + String correlationId = UUID.randomUUID().toString(); + MDC.put(CORRELATION_ID_KEY, correlationId); + exchange.getAttributes().put(CORRELATION_ID_KEY, correlationId); + log.debug(RECEIVED_REQUEST_MESSAGE, requestURI); + + return Mono.just(body); + } + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/CorrelationIdFilterHelper.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/CorrelationIdFilterHelper.java new file mode 100644 index 00000000000..0cbebaed3f8 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/CorrelationIdFilterHelper.java @@ -0,0 +1,143 @@ +package com.example.gateway.filters.pre.helpers; + +import com.example.gateway.config.ApplicationProperties; +import com.example.gateway.utils.CommonUtils; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.JsonNodeType; +import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.tracer.model.CustomException; +import org.reactivestreams.Publisher; +import org.slf4j.MDC; +import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction; +import org.springframework.http.HttpStatus; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.MultiValueMap; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; +import java.util.*; + +import static com.example.gateway.constants.GatewayConstants.*; + +@Slf4j +@Component +public class CorrelationIdFilterHelper implements RewriteFunction { + + private ApplicationProperties applicationProperties; + + private MultiStateInstanceUtil centralInstanceUtil; + + private ObjectMapper objectMapper; + + private CommonUtils commonUtils; + + public CorrelationIdFilterHelper(ApplicationProperties applicationProperties, MultiStateInstanceUtil centralInstanceUtil, + ObjectMapper objectMapper, CommonUtils commonUtils) { + this.applicationProperties = applicationProperties; + this.centralInstanceUtil = centralInstanceUtil; + this.objectMapper = objectMapper; + this.commonUtils = commonUtils; + } + + + @Override + public Publisher apply(ServerWebExchange exchange, Map body) { + String requestURI = exchange.getRequest().getPath().value(); + String requestPath = exchange.getRequest().getPath().toString(); + Boolean isOpenRequest = applicationProperties.getOpenEndpointsWhitelist().contains(requestPath); + Boolean isMixModeRequest = applicationProperties.getMixedModeEndpointsWhitelist().contains(requestPath); + + if (centralInstanceUtil.getIsEnvironmentCentralInstance() && (isOpenRequest || isMixModeRequest) + && !requestURI.equalsIgnoreCase("/user/oauth/token")) { + /* + * Adding tenantid to header for open urls, authorized urls will get ovverrided + * in RBAC filter + */ + Set tenantIds = getTenantIdsFromRequest(exchange.getRequest(), body); + + if (CollectionUtils.isEmpty(tenantIds) && isOpenRequest) { + throw new CustomException("INVALID_TENANT_ID", "No tenantId in the request"); + } + + String tenantId = commonUtils.getLowLevelTenantIdFromSet(tenantIds); + MDC.put(TENANTID_MDC, tenantId); + exchange.getAttributes().put(TENANTID_MDC, tenantId); + + } + + String correlationId = UUID.randomUUID().toString(); + MDC.put(CORRELATION_ID_KEY, correlationId); + exchange.getAttributes().put(CORRELATION_ID_KEY, correlationId); + log.debug(RECEIVED_REQUEST_MESSAGE, requestURI); + + return Mono.just(body); + } + + private Set getTenantIdsFromRequest(ServerHttpRequest request, Map body) throws CustomException { + + Set tenantIds = new HashSet<>(); + + if (CommonUtils.isRequestBodyCompatible(request)) { + + try { + ObjectNode requestBody = objectMapper.convertValue(body, ObjectNode.class); + + if (requestBody.has(REQUEST_INFO_FIELD_NAME_PASCAL_CASE)) + requestBody.remove(REQUEST_INFO_FIELD_NAME_PASCAL_CASE); + + else if (requestBody.has(REQUEST_INFO_FIELD_NAME_CAMEL_CASE)) + requestBody.remove(REQUEST_INFO_FIELD_NAME_CAMEL_CASE); + + List tenants = new LinkedList<>(); + + for (JsonNode node : requestBody.findValues(REQUEST_TENANT_ID_KEY)) { + if (node.getNodeType() == JsonNodeType.ARRAY) { + node.elements().forEachRemaining(n -> tenants.add(n.asText())); + } else if (node.getNodeType() == JsonNodeType.STRING) { + tenants.add(node.asText()); + } + } + + if (!tenants.isEmpty()) { + tenants.forEach(tenant -> { + if (tenant != null && !tenant.equalsIgnoreCase("null")) + tenantIds.add(tenant); + }); + } else { + setTenantIdsFromQueryParams(request.getQueryParams(), tenantIds); + } + + } catch (Exception e) { + CustomException customException = new CustomException("REQUEST_PARSE_FAILED", "Failed to parse request at API gateway"); + customException.setCode(HttpStatus.UNAUTHORIZED.toString()); + throw customException; + } + } + else { + setTenantIdsFromQueryParams(request.getQueryParams(), tenantIds); + } + + return tenantIds; + } + + private void setTenantIdsFromQueryParams(MultiValueMap queryParams, Set tenantIds) throws CustomException { + + if (!CollectionUtils.isEmpty(queryParams) && queryParams.containsKey(REQUEST_TENANT_ID_KEY) + && queryParams.get(REQUEST_TENANT_ID_KEY).size() > 0) { + String tenantId = queryParams.get(REQUEST_TENANT_ID_KEY).get(0); + if (tenantId.contains(",")) { + tenantIds.addAll(Arrays.asList(tenantId.split(","))); + } else { + tenantIds.add(tenantId); + } + } else { + throw new CustomException("TENANT_ID_MANDATORY", "TenantId is mandatory in URL for non json requests"); + } + + } + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/PreHookFilterHelper.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/PreHookFilterHelper.java new file mode 100644 index 00000000000..c3622aff59d --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/PreHookFilterHelper.java @@ -0,0 +1,58 @@ +package com.example.gateway.filters.pre.helpers; + +import com.example.gateway.model.PreHookFilterRequest; +import com.example.gateway.utils.URLProvider; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.tracer.model.CustomException; +import org.reactivestreams.Publisher; +import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction; +import org.springframework.stereotype.Component; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.HttpServerErrorException; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; +import java.util.Map; + +@Slf4j +@Component +public class PreHookFilterHelper implements RewriteFunction { + + private RestTemplate restTemplate; + + private ObjectMapper objectMapper; + + public PreHookFilterHelper(RestTemplate restTemplate, ObjectMapper objectMapper) { + this.restTemplate = restTemplate; + this.objectMapper = objectMapper; + } + + @Override + public Publisher apply(ServerWebExchange exchange, Map body) { + String uri = exchange.getRequest().getURI().toString(); + PreHookFilterRequest preHookFilterRequest; + try { + preHookFilterRequest = PreHookFilterRequest.builder().Request(objectMapper.writeValueAsString(body)).build(); + } catch (JsonProcessingException e) { + throw new CustomException("PARSING_ERROR", "Failed to parse request body"); + } + + String response; + + try { + log.debug("Executing pre-hook filter. Sending request to - " + URLProvider.getUrlPreHooksMap().get(uri)); + response = restTemplate.postForObject(URLProvider.getUrlPreHooksMap().get(uri), preHookFilterRequest, String.class); + return Mono.just(objectMapper.convertValue(response, Map.class)); + + } catch (HttpClientErrorException | HttpServerErrorException e) { + log.error("Pre-Hook - Http Exception Occurred", e); + throw new CustomException("PRE_HOOK_ERROR", "Pre-hook url threw an error - " + e.getMessage()); + } catch (Exception e) { + log.error("Pre-Hook - Exception Occurred", e); + throw new CustomException("PRE_HOOK_ERROR", "Pre-hook url threw an error" + e.getMessage()); + } + } + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RbacFilterHelper.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RbacFilterHelper.java new file mode 100644 index 00000000000..f0ae92bcd6f --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RbacFilterHelper.java @@ -0,0 +1,127 @@ +package com.example.gateway.filters.pre.helpers; + +import com.example.gateway.config.ApplicationProperties; +import com.example.gateway.model.AuthorizationRequest; +import com.example.gateway.model.AuthorizationRequestWrapper; +import com.example.gateway.utils.CommonUtils; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.User; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.tracer.model.CustomException; +import org.reactivestreams.Publisher; +import org.slf4j.MDC; +import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import static com.example.gateway.constants.GatewayConstants.*; + +@Slf4j +@Component +public class RbacFilterHelper implements RewriteFunction { + + private ObjectMapper objectMapper; + + private MultiStateInstanceUtil centralInstanceUtil; + + private CommonUtils commonUtils; + + private ApplicationProperties applicationProperties; + + private RestTemplate restTemplate; + + public RbacFilterHelper(ObjectMapper objectMapper, MultiStateInstanceUtil centralInstanceUtil, CommonUtils commonUtils, ApplicationProperties applicationProperties, RestTemplate restTemplate) { + this.objectMapper = objectMapper; + this.centralInstanceUtil = centralInstanceUtil; + this.commonUtils = commonUtils; + this.applicationProperties = applicationProperties; + this.restTemplate = restTemplate; + } + + @Override + public Publisher apply(ServerWebExchange serverWebExchange, Map map) { + + isIncomingURIInAuthorizedActionList(serverWebExchange,map); + return Mono.just(map); + } + + private void isIncomingURIInAuthorizedActionList(ServerWebExchange exchange, Map map) { + + String requestUri = exchange.getRequest().getURI().getPath(); + RequestInfo requestInfo = objectMapper.convertValue(map.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE), RequestInfo.class); + User user = requestInfo.getUserInfo(); + + if (user == null) { + throw new RuntimeException("User information not found. Can't execute RBAC filter"); + } + + Set tenantIds = commonUtils.validateRequestAndSetRequestTenantId(exchange,map); + + /* + * Adding tenantId to header for tracer logging with correlation-id + */ + if (centralInstanceUtil.getIsEnvironmentCentralInstance() && StringUtils.isEmpty(exchange.getAttributes().get(TENANTID_MDC))) { + String singleTenantId = commonUtils.getLowLevelTenantIdFromSet(tenantIds); + MDC.put(TENANTID_MDC, singleTenantId); + exchange.getAttributes().put(TENANTID_MDC, singleTenantId); + } + + exchange.getAttributes().put(CURRENT_REQUEST_TENANTID, String.join(",", tenantIds)); + + AuthorizationRequest request = AuthorizationRequest.builder() + .roles(new HashSet<>(user.getRoles())) + .uri(requestUri) + .tenantIds(tenantIds) + .build(); + + boolean isUriAuthorised = isUriAuthorized(request , exchange); + + if(!isUriAuthorised) { + throw new CustomException(HttpStatus.UNAUTHORIZED.toString(), "You are not authorized to access this resource"); + } + + } + + private boolean isUriAuthorized(AuthorizationRequest authorizationRequest , ServerWebExchange exchange) { + + AuthorizationRequestWrapper authorizationRequestWrapper = new AuthorizationRequestWrapper(new RequestInfo(), authorizationRequest); + + final HttpHeaders headers = new HttpHeaders(); + + headers.add(CORRELATION_ID_HEADER_NAME, (String) exchange.getAttributes().get(CORRELATION_ID_KEY)); + + if (centralInstanceUtil.getIsEnvironmentCentralInstance()) + headers.add(REQUEST_TENANT_ID_KEY, (String) exchange.getAttributes().get(TENANTID_MDC)); + + final HttpEntity httpEntity = new HttpEntity<>(authorizationRequestWrapper, headers); + + try { + + ResponseEntity responseEntity = restTemplate.postForEntity(applicationProperties.getAuthorizationUrl(), httpEntity, Void + .class); + + return responseEntity.getStatusCode().equals(HttpStatus.OK); + } catch (HttpClientErrorException e) { + log.warn("Exception while attempting to authorize via access control", e); + return false; + } catch (Exception e) { + log.error("Unknown exception occurred while attempting to authorize via access control", e); + return false; + } + + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RbacPreCheckFilterHelper.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RbacPreCheckFilterHelper.java new file mode 100644 index 00000000000..f1ea5c72a55 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RbacPreCheckFilterHelper.java @@ -0,0 +1,44 @@ +package com.example.gateway.filters.pre.helpers; + +import com.example.gateway.config.ApplicationProperties; +import lombok.extern.slf4j.Slf4j; +import org.reactivestreams.Publisher; +import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; + +import static com.example.gateway.constants.GatewayConstants.RBAC_BOOLEAN_FLAG_NAME; +import static com.example.gateway.constants.GatewayConstants.SKIP_RBAC; + +@Slf4j +@Component +public class RbacPreCheckFilterHelper implements RewriteFunction { + + + private List anonymousEndpointsWhitelist; + + private ApplicationProperties applicationProperties; + + public RbacPreCheckFilterHelper(List anonymousEndpointsWhitelist , ApplicationProperties applicationProperties) { + this.anonymousEndpointsWhitelist = anonymousEndpointsWhitelist; + this.applicationProperties = applicationProperties; + } + + @Override + public Publisher apply(ServerWebExchange serverWebExchange, Map map) { + String endPointPath = serverWebExchange.getRequest().getPath().value(); + + if(applicationProperties.getOpenEndpointsWhitelist().contains(endPointPath) || anonymousEndpointsWhitelist.contains(endPointPath)){ + serverWebExchange.getAttributes().put(RBAC_BOOLEAN_FLAG_NAME, false); + log.info(SKIP_RBAC, endPointPath); + } + else { + serverWebExchange.getAttributes().put(RBAC_BOOLEAN_FLAG_NAME, true); + } + return Mono.just(map); + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RbacPreCheckFormDataFilterHelper.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RbacPreCheckFormDataFilterHelper.java new file mode 100644 index 00000000000..f1b8df6b50e --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RbacPreCheckFormDataFilterHelper.java @@ -0,0 +1,43 @@ +package com.example.gateway.filters.pre.helpers; + +import com.example.gateway.config.ApplicationProperties; +import lombok.extern.slf4j.Slf4j; +import org.reactivestreams.Publisher; +import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.util.List; + +import static com.example.gateway.constants.GatewayConstants.RBAC_BOOLEAN_FLAG_NAME; +import static com.example.gateway.constants.GatewayConstants.SKIP_RBAC; + +@Slf4j +@Component +public class RbacPreCheckFormDataFilterHelper implements RewriteFunction { + + private List anonymousEndpointsWhitelist; + + private ApplicationProperties applicationProperties; + + public RbacPreCheckFormDataFilterHelper(List anonymousEndpointsWhitelist, ApplicationProperties applicationProperties) { + this.anonymousEndpointsWhitelist = anonymousEndpointsWhitelist; + this.applicationProperties = applicationProperties; + } + + @Override + public Publisher apply(ServerWebExchange exchange, MultiValueMap body) { + String endPointPath = exchange.getRequest().getPath().value(); + + if(applicationProperties.getOpenEndpointsWhitelist().contains(endPointPath) || anonymousEndpointsWhitelist.contains(endPointPath)){ + exchange.getAttributes().put(RBAC_BOOLEAN_FLAG_NAME, false); + log.info(SKIP_RBAC, endPointPath); + } + else { + exchange.getAttributes().put(RBAC_BOOLEAN_FLAG_NAME, true); + } + return Mono.just(body); + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RequestEnrichmentFilterHelper.java b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RequestEnrichmentFilterHelper.java new file mode 100644 index 00000000000..e072b8f6fb7 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/filters/pre/helpers/RequestEnrichmentFilterHelper.java @@ -0,0 +1,152 @@ +package com.example.gateway.filters.pre.helpers; + +import com.example.gateway.utils.CommonUtils; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.User; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.tracer.model.CustomException; +import org.reactivestreams.Publisher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.cloud.gateway.filter.factory.rewrite.RewriteFunction; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import static com.example.gateway.constants.GatewayConstants.*; +import static com.example.gateway.utils.CommonUtils.isRequestBodyCompatible; +import static org.springframework.messaging.simp.SimpMessageHeaderAccessor.getUser; + +@Slf4j +@Component +public class RequestEnrichmentFilterHelper implements RewriteFunction { + + private MultiStateInstanceUtil centralInstanceUtil; + + private CommonUtils commonUtils; + private static final String FAILED_TO_ENRICH_REQUEST_BODY_MESSAGE = "Failed to enrich request body"; + private static final String USER_SERIALIZATION_MESSAGE = "Failed to serialize user"; + private static final String SKIPPED_BODY_ENRICHMENT_DUE_TO_NO_KNOWN_FIELD_MESSAGE = + "Skipped enriching request body since request info field is not present."; + private static final String BODY_ENRICHED_MESSAGE = "Enriched request payload."; + private static final String ADDED_USER_INFO_TO_HEADER_MESSAGE = "Adding user info to header."; + private static final String EMPTY_STRING = ""; + private static final String JSON_TYPE = "json"; + private ObjectMapper objectMapper; + private static final String USER_INFO_HEADER_NAME = "x-user-info"; + private static final String PASS_THROUGH_GATEWAY_HEADER_NAME = "x-pass-through-gateway"; + private static final String PASS_THROUGH_GATEWAY_HEADER_VALUE = "true"; + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + public RequestEnrichmentFilterHelper(MultiStateInstanceUtil centralInstanceUtil, CommonUtils commonUtils, ObjectMapper objectMapper) { + this.centralInstanceUtil = centralInstanceUtil; + this.commonUtils = commonUtils; + this.objectMapper = objectMapper; + } + + @Override + public Publisher apply(ServerWebExchange exchange, Map body) { + + // Enrich User Info and Correlation Id in the request + modifyRequestBody(exchange , body); + + // Add User_Info and Correlation Id in the header + addRequestHeaders(exchange , body); + if(Objects.isNull(body)){ + return Mono.empty(); + } + else + return Mono.just(body); + } + + private void addRequestHeaders(ServerWebExchange exchange , Map body) { + addCorrelationIdHeader(exchange); + addUserInfoHeader(exchange,body); + addPassThroughGatewayHeader(exchange); + } + + private void addCorrelationIdHeader(ServerWebExchange exchange) { + + String correlationId = (String) exchange.getAttributes().get(CORRELATION_ID_KEY); + String TenantId = (String) exchange.getAttributes().get(TENANTID_MDC); + + exchange.getRequest().mutate() + .headers(httpHeaders -> { + httpHeaders.add(CORRELATION_ID_HEADER_NAME, correlationId); + if (centralInstanceUtil.getIsEnvironmentCentralInstance()) { + httpHeaders.add(REQUEST_TENANT_ID_KEY, TenantId); + } + }); + } + + private void addUserInfoHeader(ServerWebExchange exchange , Map body) { + if (isUserInfoPresent(body) && !isRequestBodyCompatible(exchange.getRequest())) { + User user = getUser(body); + exchange.getRequest().mutate().headers(httpHeaders -> { + try { + httpHeaders.add(USER_INFO_HEADER_NAME, objectMapper.writeValueAsString(user)); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + }); + logger.info(ADDED_USER_INFO_TO_HEADER_MESSAGE); + } + } + + private User getUser(Map body) { + RequestInfo requestInfo = objectMapper.convertValue(body.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE), RequestInfo.class); + return requestInfo.getUserInfo(); + } + private void addPassThroughGatewayHeader(ServerWebExchange exchange) { + exchange.getRequest().mutate().headers(httpHeaders -> { + httpHeaders.add(PASS_THROUGH_GATEWAY_HEADER_NAME, PASS_THROUGH_GATEWAY_HEADER_VALUE); + }); + } + + private boolean isUserInfoPresent(Map body) { + + if(Objects.isNull(body) || Objects.isNull(body.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE))){ + return Boolean.FALSE; + } + + RequestInfo requestInfo = objectMapper.convertValue(body.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE), RequestInfo.class); + return requestInfo.getUserInfo() != null; + } + + private void modifyRequestBody(ServerWebExchange exchange , Map body) { + + if(!isRequestBodyCompatible(exchange.getRequest())) { + return; + } + try { + enrichRequestBody(exchange , body); + } catch (IOException e) { + logger.error(FAILED_TO_ENRICH_REQUEST_BODY_MESSAGE, e); + throw new CustomException("FAILED_TO_ENRICH_REQUEST_BODY", e.getMessage()); + } + } + + private void enrichRequestBody(ServerWebExchange exchange , Map body) throws IOException { + + // TODO: Check for Camel case of requestInfo as well + if(Objects.isNull(body) || Objects.isNull(body.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE))){ + logger.info(SKIPPED_BODY_ENRICHMENT_DUE_TO_NO_KNOWN_FIELD_MESSAGE); + return; + } + RequestInfo requestInfo = objectMapper.convertValue(body.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE), RequestInfo.class); + requestInfo.setCorrelationId((String) exchange.getAttributes().get(CORRELATION_ID_KEY)); + body.put(REQUEST_INFO_FIELD_NAME_PASCAL_CASE, requestInfo); + + logger.info(BODY_ENRICHED_MESSAGE); + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/AuthorizationRequest.java b/core-services/gateway/src/main/java/com/example/gateway/model/AuthorizationRequest.java new file mode 100644 index 00000000000..fadd755abbb --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/AuthorizationRequest.java @@ -0,0 +1,30 @@ +package com.example.gateway.model; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.Role; + + +import java.util.Set; + +@NoArgsConstructor +@AllArgsConstructor +@Data +@Builder +public class AuthorizationRequest { + + @NotNull + @Size(min = 1) + private Set roles; + + @NotNull + private String uri; + + @NotNull + private Set tenantIds; + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/AuthorizationRequestWrapper.java b/core-services/gateway/src/main/java/com/example/gateway/model/AuthorizationRequestWrapper.java new file mode 100644 index 00000000000..cc7f6ea07c4 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/AuthorizationRequestWrapper.java @@ -0,0 +1,22 @@ +package com.example.gateway.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; + +@NoArgsConstructor +@AllArgsConstructor +@Data +@Builder +public class AuthorizationRequestWrapper { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @JsonProperty("AuthorizationRequest") + private AuthorizationRequest authorizationRequest; + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/CustomAsyncRequest.java b/core-services/gateway/src/main/java/com/example/gateway/model/CustomAsyncRequest.java new file mode 100644 index 00000000000..d4445abaaf7 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/CustomAsyncRequest.java @@ -0,0 +1,25 @@ +package com.example.gateway.model; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.extern.slf4j.Slf4j; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Setter +@Getter +@ToString +@Slf4j +@Builder +public class CustomAsyncRequest { + + private Map request; + private Map response; + private String sourceUri; + Map> queryParamMap = new HashMap<>(); + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/EventLogRequest.java b/core-services/gateway/src/main/java/com/example/gateway/model/EventLogRequest.java new file mode 100644 index 00000000000..c048255725e --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/EventLogRequest.java @@ -0,0 +1,141 @@ +package com.example.gateway.model; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.User; +import org.springframework.http.MediaType; +import org.springframework.web.server.ServerWebExchange; + +import java.text.SimpleDateFormat; +import java.util.*; + +import static com.example.gateway.constants.GatewayConstants.*; + + +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +@Slf4j +public class EventLogRequest { + private static final ObjectMapper objectMapper = new ObjectMapper(); + + Object requestBody; + + Object responseBody; + + String method; + String referer; + String url; + String responseContentType; + String queryParams; + Integer uid; + String username; + + int statusCode; + + String timestamp; + String userType; + Long requestDuration; + + String correlationId; + String userTenantId; + String userId; + + String tenantId; + + public static Object getResponseBody(Map body) { + System.out.println(body); + return body; + } + + private static Boolean isJsonResponse(ServerWebExchange exchange) { + MediaType contentType = exchange.getResponse().getHeaders().getContentType(); + return contentType != null && contentType.includes(MediaType.APPLICATION_JSON); + } + + public static EventLogRequest fromRequestContext(ServerWebExchange exchange, Map body, RequestCaptureCriteria criteria) { + + Object reqBody = null; + if (criteria.isCaptureInputBody()) { + reqBody = body.get(CURRENT_REQUEST_SANITIZED_BODY_STR); + + if (body == null) { + reqBody = exchange.getRequest().getBody().toString(); + } + } + + + String referer = exchange.getRequest().getHeaders().getFirst("referer"); + String method = exchange.getRequest().getMethod().toString(); + Long startTime = exchange.getAttribute("CURRENT_REQUEST_START_TIME"); + Long endTime = System.currentTimeMillis(); + exchange.getAttributes().put(CURRENT_REQUEST_END_TIME, endTime); + + Object responseBody = null; + int statusCode = exchange.getResponse().getStatusCode().value(); + boolean isErrorStatusCode = !(statusCode >= 200 && statusCode < 300); + if ( + criteria.isCaptureOutputBody() || + (criteria.isCaptureOutputBodyOnlyForError() && isErrorStatusCode) + ) { + try { + responseBody = getResponseBody(body); + if (isJsonResponse(exchange)) { + responseBody = objectMapper.readValue((String) responseBody, + new TypeReference>() { + }); + } + } catch (Exception e) { + log.error("Exception while reading body", e); + } + } + + RequestInfo requestInfo = objectMapper.convertValue(body.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE), RequestInfo.class); + User user = requestInfo.getUserInfo(); + + String uuid = ""; + String userType = ""; + String userTenantId = ""; + String userName = ""; + Integer userId = 0; + + if (user != null) { + uuid = user.getUuid(); + userType = user.getType(); + userTenantId = user.getTenantId(); + userName = user.getUserName(); + userId = Math.toIntExact(user.getId()); + } + + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); + Date date = new Date(startTime); + formatter.setTimeZone(TimeZone.getTimeZone("UTC")); + + EventLogRequest req = EventLogRequest.builder() + .requestBody(body) + .method(method) + .referer(referer) + .username(userName) + .uid(userId) + .userType(userType) + .responseBody(responseBody) + .queryParams(exchange.getRequest().getQueryParams().toString()) + .correlationId(exchange.getAttribute(CORRELATION_ID_KEY)) + .statusCode(statusCode) + .timestamp(formatter.format(date)) + .requestDuration(endTime - startTime) + .userId(uuid) + .userTenantId(userTenantId) + .tenantId(exchange.getAttribute(CURRENT_REQUEST_TENANTID)) + .url(exchange.getRequest().getURI().toString()).build(); + + return req; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/PostHookFilterRequest.java b/core-services/gateway/src/main/java/com/example/gateway/model/PostHookFilterRequest.java new file mode 100644 index 00000000000..ac94230a131 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/PostHookFilterRequest.java @@ -0,0 +1,18 @@ +package com.example.gateway.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PostHookFilterRequest { + + private String Request; + + private String Response; + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/PreHookFilterRequest.java b/core-services/gateway/src/main/java/com/example/gateway/model/PreHookFilterRequest.java new file mode 100644 index 00000000000..cbaf67979a8 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/PreHookFilterRequest.java @@ -0,0 +1,16 @@ +package com.example.gateway.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PreHookFilterRequest { + + private String Request; + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/RequestBodyInspector.java b/core-services/gateway/src/main/java/com/example/gateway/model/RequestBodyInspector.java new file mode 100644 index 00000000000..014bf9b272f --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/RequestBodyInspector.java @@ -0,0 +1,58 @@ +//package com.example.gateway.model; +// +//import java.util.HashMap; +// +////import static org.egov.constants.RequestContextConstants.REQUEST_INFO_FIELD_NAME_CAMEL_CASE; +////import static org.egov.constants.RequestContextConstants.REQUEST_INFO_FIELD_NAME_PASCAL_CASE; +// +//public class RequestBodyInspector { +// private HashMap requestBody; +// +// public RequestBodyInspector(HashMap requestBody) { +// this.requestBody = requestBody; +// } +// +// public boolean isRequestInfoPresent() { +// return requestBody != null && isRequestInfoContainerFieldPresent(); +// } +// +// public HashMap getRequestBody() { +// return requestBody; +// } +// +// public void updateRequestInfo(HashMap requestInfo) { +// if (!isRequestInfoPresent()) { +// return; +// } +// requestBody.put(getRequestInfoFieldNamePresent(), requestInfo); +// } +// +// @SuppressWarnings("unchecked") +// public HashMap getRequestInfo() { +// if (isRequestInfoPresent()) { +// return (HashMap) requestBody.get(getRequestInfoFieldNamePresent()); +// } +// return null; +// } +// +// private String getRequestInfoFieldNamePresent() { +// if (isPascalCasePresent()) { +// return REQUEST_INFO_FIELD_NAME_PASCAL_CASE; +// } else { +// return REQUEST_INFO_FIELD_NAME_CAMEL_CASE; +// } +// } +// +// private boolean isRequestInfoContainerFieldPresent() { +// return isPascalCasePresent() || isCamelCasePresent(); +// } +// +// private boolean isCamelCasePresent() { +// return requestBody.containsKey(REQUEST_INFO_FIELD_NAME_CAMEL_CASE); +// } +// +// private boolean isPascalCasePresent() { +// return requestBody.containsKey(REQUEST_INFO_FIELD_NAME_PASCAL_CASE); +// } +// +//} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/RequestCaptureCriteria.java b/core-services/gateway/src/main/java/com/example/gateway/model/RequestCaptureCriteria.java new file mode 100644 index 00000000000..bbf5b3b4d62 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/RequestCaptureCriteria.java @@ -0,0 +1,16 @@ +package com.example.gateway.model; + +import lombok.*; + +@Builder +@Data +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class RequestCaptureCriteria { + boolean captureInputBody; + boolean captureOutputBody; + boolean captureOutputBodyOnlyForError; + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/UserDetailResponse.java b/core-services/gateway/src/main/java/com/example/gateway/model/UserDetailResponse.java new file mode 100644 index 00000000000..4621d499577 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/UserDetailResponse.java @@ -0,0 +1,23 @@ +package com.example.gateway.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.User; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.List; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +public class UserDetailResponse { + + @JsonProperty("responseInfo") + ResponseInfo responseInfo; + + @JsonProperty("user") + List user; + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/model/UserSearchRequest.java b/core-services/gateway/src/main/java/com/example/gateway/model/UserSearchRequest.java new file mode 100644 index 00000000000..a0acdcb9f4a --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/model/UserSearchRequest.java @@ -0,0 +1,50 @@ +package com.example.gateway.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +import org.egov.common.contract.request.RequestInfo; + +import java.util.Collections; +import java.util.List; + +@Getter +@Setter +public class UserSearchRequest { + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + @JsonProperty("uuid") + private List uuid; + @JsonProperty("id") + private List id; + @JsonProperty("userName") + private String userName; + @JsonProperty("name") + private String name; + @JsonProperty("mobileNumber") + private String mobileNumber; + @JsonProperty("aadhaarNumber") + private String aadhaarNumber; + @JsonProperty("pan") + private String pan; + @JsonProperty("emailId") + private String emailId; + @JsonProperty("fuzzyLogic") + private boolean fuzzyLogic; + @JsonProperty("active") + @Setter + private Boolean active; + @JsonProperty("tenantId") + private String tenantId; + @JsonProperty("pageSize") + private int pageSize; + @JsonProperty("pageNumber") + private int pageNumber = 0; + @JsonProperty("sort") + private List sort = Collections.singletonList("name"); + @JsonProperty("userType") + private String userType; + @JsonProperty("roleCodes") + private List roleCodes; +} + diff --git a/core-services/gateway/src/main/java/com/example/gateway/producer/Producer.java b/core-services/gateway/src/main/java/com/example/gateway/producer/Producer.java new file mode 100644 index 00000000000..02dd6b651fc --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/producer/Producer.java @@ -0,0 +1,18 @@ +package com.example.gateway.producer; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class Producer { + + @Autowired + private KafkaTemplate kafkaTemplate; + + public void push(String topic, Object value) { + kafkaTemplate.send(topic, value); + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/ratelimiters/RateLimiterConfiguration.java b/core-services/gateway/src/main/java/com/example/gateway/ratelimiters/RateLimiterConfiguration.java new file mode 100644 index 00000000000..332b58bb8f3 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/ratelimiters/RateLimiterConfiguration.java @@ -0,0 +1,59 @@ +package com.example.gateway.ratelimiters; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.cloud.gateway.filter.factory.rewrite.ModifyRequestBodyGatewayFilterFactory; +import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import reactor.core.publisher.Mono; + +import java.util.Map; +import java.util.Objects; + +import static com.example.gateway.constants.GatewayConstants.REQUEST_INFO_FIELD_NAME_PASCAL_CASE; + + +@Configuration +public class RateLimiterConfiguration { + + private ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter; + + private ObjectMapper objectMapper; + + public RateLimiterConfiguration(ModifyRequestBodyGatewayFilterFactory modifyRequestBodyFilter, ObjectMapper objectMapper) { + this.modifyRequestBodyFilter = modifyRequestBodyFilter; + this.objectMapper = objectMapper; + } + + /** + * IP limit + * @return + */ + @Bean + @Primary + public KeyResolver ipKeyResolver() { + return exchange -> Mono.just(Objects.requireNonNull(exchange.getRequest().getRemoteAddress()).getAddress().getHostAddress()); + } + + + /** + * user limit + * @return + */ + @Bean + public KeyResolver userKeyResolver() { + + return exchange -> { + return Mono.just(modifyRequestBodyFilter.apply( + new ModifyRequestBodyGatewayFilterFactory + .Config() + .setRewriteFunction(Map.class, String.class, (serverWebExchange, s) -> { + RequestInfo requestInfo = objectMapper.convertValue(s.get(REQUEST_INFO_FIELD_NAME_PASCAL_CASE), RequestInfo.class); + return Mono.just(requestInfo.getUserInfo().getUuid()); + })).toString()); + }; + } + +} \ No newline at end of file diff --git a/core-services/gateway/src/main/java/com/example/gateway/utils/CommonUtils.java b/core-services/gateway/src/main/java/com/example/gateway/utils/CommonUtils.java new file mode 100644 index 00000000000..a9c103a652f --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/utils/CommonUtils.java @@ -0,0 +1,149 @@ +package com.example.gateway.utils; + +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; + +import org.egov.tracer.model.CustomException; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.JsonNodeType; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.MultiValueMap; +import org.springframework.web.server.ServerWebExchange; + +import static com.example.gateway.constants.GatewayConstants.*; + +@Component +public class CommonUtils { + + private ObjectMapper objectMapper; + + public CommonUtils(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + public static boolean isRequestBodyCompatible(ServerHttpRequest serverHttpRequest) { + String requestMethod = getRequestMethod(serverHttpRequest); + String contentType = getRequestContentType(serverHttpRequest); + + return (POST.equalsIgnoreCase(requestMethod) + || PUT.equalsIgnoreCase(requestMethod) + || PATCH.equalsIgnoreCase(requestMethod)) + && (contentType.contains(JSON_TYPE) + || contentType.contains(X_WWW_FORM_URLENCODED_TYPE)); + } + + private static String getRequestMethod(ServerHttpRequest serverHttpRequest) { + return serverHttpRequest.getMethod().toString(); + } + + + public static String getRequestContentType(ServerHttpRequest serverHttpRequest) { + List contentTypeHeaders = serverHttpRequest.getHeaders().get(HttpHeaders.CONTENT_TYPE); + + // Wrap the list in an Optional + Optional> contentTypeOptional = Optional.ofNullable(contentTypeHeaders); + + // If the Optional is empty, return an empty string + if (contentTypeOptional.isEmpty()) { + return ""; + } + + // Get the first content type header, convert it to lowercase, and return it + return contentTypeOptional.get().stream() + .findFirst() + .map(String::toLowerCase) + .orElse(""); + } + + + public String getLowLevelTenantIdFromSet(Set tenants) { + + String lowLevelTenant = null; + int countOfSubTenantsPresent = 0; + + for (String tenant : tenants) { + int currentCount = tenant.split("\\.").length; + if (currentCount >= countOfSubTenantsPresent) { + countOfSubTenantsPresent = currentCount; + lowLevelTenant = tenant; + } + } + return lowLevelTenant; + } + + + public Set validateRequestAndSetRequestTenantId(ServerWebExchange exchange , Map body) { + + return getTenantIdsFromRequest(exchange.getRequest(), body); + } + + public Set getTenantIdsFromRequest(ServerHttpRequest request, Map body) throws CustomException { + + Set tenantIds = new HashSet<>(); + + if (CommonUtils.isRequestBodyCompatible(request)) { + + try { + ObjectNode requestBody = objectMapper.convertValue(body, ObjectNode.class); + + if (requestBody.has(REQUEST_INFO_FIELD_NAME_PASCAL_CASE)) + requestBody.remove(REQUEST_INFO_FIELD_NAME_PASCAL_CASE); + + else if (requestBody.has(REQUEST_INFO_FIELD_NAME_CAMEL_CASE)) + requestBody.remove(REQUEST_INFO_FIELD_NAME_CAMEL_CASE); + + List tenants = new LinkedList<>(); + + for (JsonNode node : requestBody.findValues(REQUEST_TENANT_ID_KEY)) { + if (node.getNodeType() == JsonNodeType.ARRAY) { + node.elements().forEachRemaining(n -> tenants.add(n.asText())); + } else if (node.getNodeType() == JsonNodeType.STRING) { + tenants.add(node.asText()); + } + } + + if (!tenants.isEmpty()) { + tenants.forEach(tenant -> { + if (tenant != null && !tenant.equalsIgnoreCase("null")) + tenantIds.add(tenant); + }); + } else { + setTenantIdsFromQueryParams(request.getQueryParams(), tenantIds); + } + + } catch (Exception e) { + CustomException customException = new CustomException("REQUEST_PARSE_FAILED", "Failed to parse request at API gateway"); + customException.setCode(HttpStatus.UNAUTHORIZED.toString()); + throw customException; + } + } + else { + setTenantIdsFromQueryParams(request.getQueryParams(), tenantIds); + } + + return tenantIds; + } + public void setTenantIdsFromQueryParams(MultiValueMap queryParams, Set tenantIds) throws CustomException { + + if (!CollectionUtils.isEmpty(queryParams) && queryParams.containsKey(REQUEST_TENANT_ID_KEY) + && queryParams.get(REQUEST_TENANT_ID_KEY).size() > 0) { + String tenantId = queryParams.get(REQUEST_TENANT_ID_KEY).get(0); + if (tenantId.contains(",")) { + tenantIds.addAll(Arrays.asList(tenantId.split(","))); + } else { + tenantIds.add(tenantId); + } + } else { + throw new CustomException("TENANT_ID_MANDATORY", "TenantId is mandatory in URL for non json requests"); + } + + } + +} \ No newline at end of file diff --git a/core-services/gateway/src/main/java/com/example/gateway/utils/EventLoggerUtil.java b/core-services/gateway/src/main/java/com/example/gateway/utils/EventLoggerUtil.java new file mode 100644 index 00000000000..bf795b30244 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/utils/EventLoggerUtil.java @@ -0,0 +1,51 @@ +package com.example.gateway.utils; + +import com.example.gateway.model.EventLogRequest; +import com.example.gateway.model.RequestCaptureCriteria; +import com.example.gateway.producer.Producer; +import jakarta.annotation.PostConstruct; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; + +import java.util.Map; + +@Component +@Slf4j +public class EventLoggerUtil { + + @Autowired + Producer producer; + + @Value("${eventlog.captureInputBody:false}") + private boolean captureInputBody; + + @Value("${eventlog.captureOutputBody:false}") + private boolean captureOutputBody; + + @Value("${eventlog.captureOutputBodyOnlyOnError:true}") + private boolean captureOutputBodyOnlyOnError; + + private RequestCaptureCriteria criteria; + + @PostConstruct + public void init(){ + criteria = RequestCaptureCriteria.builder() + .captureInputBody(captureInputBody) + .captureOutputBody(captureOutputBody) + .captureOutputBodyOnlyForError(captureOutputBodyOnlyOnError) + .build(); + } + + public Object logCurrentRequest(ServerWebExchange exchange , Map body, String topic){ + try { + EventLogRequest request = EventLogRequest.fromRequestContext(exchange , body , criteria); + producer.push(topic, request); + } catch (Exception ex) { + log.error("event logger", ex); + } + return null; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/utils/ExceptionUtils.java b/core-services/gateway/src/main/java/com/example/gateway/utils/ExceptionUtils.java new file mode 100644 index 00000000000..061ec020be7 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/utils/ExceptionUtils.java @@ -0,0 +1,119 @@ +package com.example.gateway.utils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.tracer.model.CustomException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.support.NotFoundException; +import org.springframework.http.HttpStatus; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.server.ResponseStatusException; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.example.gateway.constants.GatewayConstants.REQUEST_INFO_FIELD_NAME_PASCAL_CASE; + +public class ExceptionUtils { + + private static final Logger logger = LoggerFactory.getLogger(ExceptionUtils.class); + + public static Mono raiseErrorFilterException(ServerWebExchange exchange , Throwable e) { + + try { + if (e == null) { + HttpStatus status = (HttpStatus) exchange.getResponse().getStatusCode(); + if (status == HttpStatus.NOT_FOUND) { + return _setExceptionBody(exchange,HttpStatus.NOT_FOUND, getErrorInfoObject("ResourceNotFoundException", + "The resource - " + exchange.getRequest().getPath() + " not found", null)); + } else if (status == HttpStatus.BAD_REQUEST) { + String existingResponse = exchange.getResponse().toString(); + if (existingResponse != null && existingResponse.contains("InvalidAccessTokenException")) + return _setExceptionBody(exchange,HttpStatus.UNAUTHORIZED, existingResponse); + } + return null; + } + + while ((e instanceof NotFoundException || e instanceof ResponseStatusException) && e.getCause() != null) + e = e.getCause(); + + String exceptionName = e.getClass().getSimpleName(); + String exceptionMessage = e.getMessage(); + + if (exceptionName.equalsIgnoreCase("HttpHostConnectException") || + exceptionName.equalsIgnoreCase("ResourceAccessException")) { + return _setExceptionBody(exchange,HttpStatus.BAD_GATEWAY, getErrorInfoObject(exceptionName, "The backend service is unreachable", null)); + } else if (exceptionName.equalsIgnoreCase("NullPointerException")) { + e.printStackTrace(); + return _setExceptionBody(exchange,HttpStatus.INTERNAL_SERVER_ERROR, getErrorInfoObject(exceptionName, exceptionMessage, exceptionMessage)); + } else if (exceptionName.equalsIgnoreCase("HttpClientErrorException")) { + String existingResponse = ((HttpClientErrorException) e).getResponseBodyAsString(); + if (existingResponse.contains("InvalidAccessTokenException")) + return _setExceptionBody(exchange,HttpStatus.UNAUTHORIZED, existingResponse); + else + return _setExceptionBody(exchange,(HttpStatus) ((HttpClientErrorException) e).getStatusCode(), existingResponse); + } else if (exceptionName.equalsIgnoreCase("InvalidAccessTokenException")) { + return _setExceptionBody(exchange,HttpStatus.UNAUTHORIZED, getErrorInfoObject(exceptionName, exceptionMessage, exceptionMessage)); + } else if (exceptionName.equalsIgnoreCase("RateLimitExceededException")) { + return _setExceptionBody(exchange,HttpStatus.TOO_MANY_REQUESTS, getErrorInfoObject(exceptionName, "Rate limit exceeded", null)); + } else if (exceptionName.equalsIgnoreCase("JsonParseException")) { + return _setExceptionBody(exchange,HttpStatus.BAD_REQUEST, getErrorInfoObject(exceptionName, "Bad request", null)); + } else if (exceptionName.equalsIgnoreCase("CustomException")) { + CustomException ce = (CustomException) e; +// HttpStatus.valueOf(ce.getCode()); + return _setExceptionBody(exchange,HttpStatus.valueOf(401), getErrorInfoObject(exceptionName, exceptionMessage, exceptionMessage)); + } else { + return _setExceptionBody(exchange,HttpStatus.INTERNAL_SERVER_ERROR, getErrorInfoObject(exceptionName, exceptionMessage, exceptionMessage)); + } + } catch (Exception e1) { + logger.error("Exception while raising error filter exception: " + e1.getMessage()); + } + return null; + } + + private static Mono _setExceptionBody(ServerWebExchange exchange , HttpStatus status, Object body) throws JsonProcessingException { + exchange.getResponse().setStatusCode(status); + return exchange.getResponse().writeWith(Mono.just(exchange.getResponse() + .bufferFactory().wrap(getObjectJSONString(body).getBytes()))); + + } + + private static String getObjectJSONString(Object obj) throws JsonProcessingException { + return new ObjectMapper().writeValueAsString(obj); + } + + private static HashMap getErrorInfoObject(String code, String message, String description) { + String errorTemplate = "{\n" + + " \"ResponseInfo\": null,\n" + + " \"Errors\": [\n" + + " {\n" + + " \"code\": \"Exception\",\n" + + " \"message\": null,\n" + + " \"description\": null,\n" + + " \"params\": null\n" + + " }\n" + + " ]\n" + + "}"; + ObjectMapper objectMapper = new ObjectMapper(); + try { + HashMap errorInfo = objectMapper.readValue(errorTemplate, new TypeReference>() { + }); + HashMap error = (HashMap) ((List) errorInfo.get("Errors")).get(0); + error.put("code", code); + error.put("message", message); + error.put("description", description); + return errorInfo; + } catch (IOException e) { + logger.error("IO Exception while getting errorInfo object: " + e.getMessage()); + } + + return null; + } + +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/utils/URLProvider.java b/core-services/gateway/src/main/java/com/example/gateway/utils/URLProvider.java new file mode 100644 index 00000000000..ac7b1c0f6b1 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/utils/URLProvider.java @@ -0,0 +1,87 @@ +package com.example.gateway.utils; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ResourceLoader; +import org.springframework.stereotype.Component; +import org.springframework.core.io.Resource; + +import jakarta.annotation.PostConstruct; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +@Slf4j +@Component +public class URLProvider { + + @Autowired + private ResourceLoader resourceLoader; + + private static Map urlPostHooksMap; + + @Value("${url.posthook.lists}") + private String postHookUrls; + + private static Map urlPreHooksMap; + + @Value("${url.prehook.lists}") + private String preHookUrls; + + + private Map getUrlToUrlMapping(String config) { + String[] urlArray; + Map map = new HashMap<>(); + if (StringUtils.isEmpty(config)) + return Collections.unmodifiableMap(map); + + if ( + StringUtils.startsWithIgnoreCase(config, "http://") + || StringUtils.startsWithIgnoreCase(config, "https://") + || StringUtils.startsWithIgnoreCase(config, "file://") + || StringUtils.startsWithIgnoreCase(config, "classpath:") + ) + { + ObjectMapper mapper = new ObjectMapper(new JsonFactory()); + + Resource resource = resourceLoader.getResource(config); + try { + map = mapper.readValue(resource.getInputStream(),map.getClass()); + } catch (IOException e) { + log.error("IO Exception while mapping resource: " + e.getMessage()); + } + + } else { + urlArray = config.split("\\|"); + + for (int i = 0; i < urlArray.length; i++) { + + String[] index = urlArray[i].split(":", 2); + map.put(index[0], index[1]); + } + urlPostHooksMap = Collections.unmodifiableMap(map); + } + + return Collections.unmodifiableMap(map); + } + + @PostConstruct + public void loadUrls() { + urlPostHooksMap = getUrlToUrlMapping(postHookUrls); + urlPreHooksMap = getUrlToUrlMapping(preHookUrls); + + } + + public static Map getUrlPostHooksMap() { + return urlPostHooksMap; + } + + public static Map getUrlPreHooksMap() { + return urlPreHooksMap; + } +} diff --git a/core-services/gateway/src/main/java/com/example/gateway/utils/UserUtils.java b/core-services/gateway/src/main/java/com/example/gateway/utils/UserUtils.java new file mode 100644 index 00000000000..6cff95fa581 --- /dev/null +++ b/core-services/gateway/src/main/java/com/example/gateway/utils/UserUtils.java @@ -0,0 +1,83 @@ +package com.example.gateway.utils; + +import com.example.gateway.config.ApplicationProperties; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.User; +import org.egov.common.contract.user.UserDetailResponse; +import org.egov.common.contract.user.UserSearchRequest; +import org.egov.common.utils.MultiStateInstanceUtil; +import org.egov.tracer.model.CustomException; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.web.client.RestTemplate; + +import java.util.Collections; + +import static com.example.gateway.constants.GatewayConstants.CORRELATION_ID_HEADER_NAME; +import static com.example.gateway.constants.GatewayConstants.REQUEST_TENANT_ID_KEY; + +@Slf4j +@Component +public class UserUtils { + + private RestTemplate restTemplate; + + private ApplicationProperties applicationProperties; + + private MultiStateInstanceUtil multiStateInstanceUtil; + + public UserUtils (RestTemplate restTemplate, ApplicationProperties applicationProperties) { + this.restTemplate = restTemplate; + this.applicationProperties = applicationProperties; + } + + public User getUser(String authToken) { + String authURL = String.format("%s%s%s", applicationProperties.getAuthServiceHost(), applicationProperties.getAuthUri(), authToken); + + User user; + + try { + user = restTemplate.postForObject(authURL, null, User.class); + } catch (Exception e) { + throw new CustomException("Exception occurred while fetching user: ", e.getMessage()); +// throw new CustomException("Exception occurred while fetching user: ", "Error while authenticating the auth token"); + } + + return user; + } + + @Cacheable(value = "systemUser" , sync = true) + public User fetchSystemUser(String tenantId, String correlationId) { + + UserSearchRequest userSearchRequest =new UserSearchRequest(); + userSearchRequest.setRoleCodes(Collections.singletonList("ANONYMOUS")); + userSearchRequest.setUserType("SYSTEM"); + userSearchRequest.setPageSize(1); + userSearchRequest.setTenantId(tenantId); + + final HttpHeaders headers = new HttpHeaders(); + headers.add(CORRELATION_ID_HEADER_NAME, correlationId); + if (multiStateInstanceUtil.getIsEnvironmentCentralInstance()) + headers.add(REQUEST_TENANT_ID_KEY, tenantId); + final HttpEntity httpEntity = new HttpEntity<>(userSearchRequest, headers); + + StringBuilder uri = new StringBuilder(applicationProperties.getUserSearchURI()); + User user = null; + try { + UserDetailResponse response = restTemplate.postForObject(uri.toString(), httpEntity, UserDetailResponse.class); + if (!CollectionUtils.isEmpty(response.getUser())) + user = response.getUser().get(0); + } catch(Exception e) { + log.error("Exception while fetching system user: ",e); + } + + /*if(user == null) + throw new CustomException("NO_SYSTEUSER_FOUND","No system user found");*/ + + return user; + } + +} diff --git a/core-services/gateway/src/main/resources/application.properties b/core-services/gateway/src/main/resources/application.properties new file mode 100644 index 00000000000..0e4acc0f53f --- /dev/null +++ b/core-services/gateway/src/main/resources/application.properties @@ -0,0 +1,55 @@ +#logging.level.org.springframework=DEBUG +spring.main.web-application-type=reactive + +# spring.cloud.gateway.routes.location=file:routes.yaml + + +eventlog.enabled = false +eventlog.topic = springGateway.eventlog +eventlog.urls.whitelist= +eventlog.captureInputBody=false +eventlog.captureOutputBody=false +eventlog.captureOutputBodyOnlyOnError=true + + +egov.user.search.path=/user/v1/_search +#spring.routes.filepath=classpath:routes.properties +#spring.limiter.filepath=classpath:limiter.properties +url.posthook.lists= +url.prehook.lists= + +# ------------------------ access-control ------------------------ +egov.authorize.access.control.host=http://localhost:8092/ +egov.authorize.access.control.uri=access/v1/actions/_authorize + +# ------------------------ auth-service ------------------------ +egov.auth-service-host=http://localhost:8081/ +egov.auth-service-uri=user/_details?access_token= +egov.user-info-header=x-user-info + +egov.custom.async.filter.topic=res-filter +tracer.filter.enabled=false + +# central instance configs +state.level.tenantid.length=2 +state.schema.index.position.tenantid=1 +is.environment.central.instance=true + +logging.pattern.console=%clr(%X{CORRELATION_ID:-}) %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} + +egov.encrypted-endpoints-list=/user/oauth/token,/filestore/v1/files +egov.open-endpoints-whitelist=/user/oauth/token,/user-otp/v1/_send,/otp/v1/_validate,/user/citizen/_create,/localization/messages,/localization/messages/v1/_search,/user/password/nologin/_update,/pgr/servicedefinition/v1/_search,/pgr/servicecategories/v1/_search,/pgr/v1/otp/_send,/pgr-master/receivingmode/v1/_search,/tenant/v1/tenant/_search,/egov-location/boundarys,/egov-location/boundarys/boundariesByBndryTypeNameAndHierarchyTypeName,/pgr-master/service/v1/_search,/egov-location/boundarys/getLocationByLocationName,/pgr-master/OTPConfig/_search,/pgr-master/serviceGroup/v1/_search,/egov-location/boundarys/isshapefileexist,/pgr/services/v1/_search,/hr-masters/hrconfigurations/_search,/collection-services/receipts/_view,/pgr-master/service/v2/_search,/pgr-master/servicedefinition/v1/_search,/citizen-services,/citizen-services/v1/requests/_search,/admin/abc,/whatsapp-webhook/messages,/egov-mdms-service/v1/_search +egov.mixed-mode-endpoints-whitelist=/pgr/seva/v1/_create,/pgr/seva/v1/_search,/pgr/seva/v1/_count,/workflow/history/v1/_search,/filestore/v1/files/id,/filestore/v1/files,/filestore/v1/files/tag,/wcms/masters/categorytype/_search,/wcms/masters/pipesize/_search,/wcms/masters/sourcetype/_search,/wcms/masters/supplytype/_search,/pt-property/property/propertytypes/_search,/wcms/masters/donation/_search,/wcms/masters/propertytype-categorytype/_search,/wcms/masters/propertytype-pipesize/_search,/wcms/masters/propertytype-usagetype/_search,/wcms/masters/treatmentplant/_search,/wcms-connection/connection/_getconnectiontypes,/wcms-connection/connection/_getbillingtypes,/pt-property/properties/_search,/pt-property/property/usages/_search,/egov-idgen/id/_generate,/egf-masters/financialyears/_search,/egov-common-workflows/process/_start,/egov-common-workflows/process/_search,/egov-common-workflows/tasks,/egov-common-workflows/tasks/{id}/_update,/user/_search,/user/users/_createnovalidate,/user/users/{id}/_update,/wcms-connection/connection/_create + + +egov.statelevel.tenant.map={'statea.digit.org':'in.statea','stateb.digit.org':'in.stateb','central-instance.digit.org':'in'} +egov.statelevel.tenant= + +spring.data.redis.host=redis.backbone +spring.data.redis.port=6379 + +spring.data.redis.default.replenishRate = 5 +spring.data.redis.default.burstCapacity = 5 + +egov.custom.async.uris=/user/_logout +spring.routes.filepath=classpath:routes.properties \ No newline at end of file diff --git a/core-services/gateway/src/main/resources/routes.properties b/core-services/gateway/src/main/resources/routes.properties new file mode 100644 index 00000000000..7389179600c --- /dev/null +++ b/core-services/gateway/src/main/resources/routes.properties @@ -0,0 +1,125 @@ +spring.cloud.gateway.routes[0].id=audit-service +spring.cloud.gateway.routes[0].uri=http://audit-service.egov:8080/ +spring.cloud.gateway.routes[0].predicates[0]=Path=/audit-service/** +spring.cloud.gateway.routes[0].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[0].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[0].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[1].id=access +spring.cloud.gateway.routes[1].uri=http://egov-accesscontrol.egov:8080/ +spring.cloud.gateway.routes[1].predicates[0]=Path=/access/** +spring.cloud.gateway.routes[1].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[1].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[1].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[2].id=egov-enc-service +spring.cloud.gateway.routes[2].uri=http://egov-enc-service.egov:8080/ +spring.cloud.gateway.routes[2].predicates[0]=Path=/egov-enc-service/** +spring.cloud.gateway.routes[2].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[2].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[2].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[3].id=filestore +spring.cloud.gateway.routes[3].uri=http://egov-filestore.egov:8080/ +spring.cloud.gateway.routes[3].predicates[0]=Path=/filestore/** +spring.cloud.gateway.routes[3].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[3].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[3].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[4].id=egov-hrms +spring.cloud.gateway.routes[4].uri=http://egov-hrms.egov:8080/ +spring.cloud.gateway.routes[4].predicates[0]=Path=/egov-hrms/** +spring.cloud.gateway.routes[4].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[4].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[4].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[5].id=egov-idgen +spring.cloud.gateway.routes[5].uri=http://egov-idgen.egov:8080/ +spring.cloud.gateway.routes[5].predicates[0]=Path=/egov-idgen/** +spring.cloud.gateway.routes[5].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[5].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[5].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[6].id=egov-indexer +spring.cloud.gateway.routes[6].uri=http://egov-indexer.egov:8080/ +spring.cloud.gateway.routes[6].predicates[0]=Path=/egov-indexer/** +spring.cloud.gateway.routes[6].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[6].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[6].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[7].id=localization +spring.cloud.gateway.routes[7].uri=http://egov-localization.egov:8080/ +spring.cloud.gateway.routes[7].predicates[0]=Path=/localization/** +spring.cloud.gateway.routes[7].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[7].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[7].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[8].id=egov-location +spring.cloud.gateway.routes[8].uri=http://egov-location.egov:8080/ +spring.cloud.gateway.routes[8].predicates[0]=Path=/egov-location/** +spring.cloud.gateway.routes[8].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[8].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[8].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[9].id=egov-mdms-service +spring.cloud.gateway.routes[9].uri=http://egov-mdms-service.egov:8080/ +spring.cloud.gateway.routes[9].predicates[0]=Path=/egov-mdms-service/** +spring.cloud.gateway.routes[9].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[9].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[9].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[10].id=otp +spring.cloud.gateway.routes[10].uri=http://egov-otp.egov:8080/ +spring.cloud.gateway.routes[10].predicates[0]=Path=/otp/** +spring.cloud.gateway.routes[10].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[10].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[10].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[11].id=pg-service +spring.cloud.gateway.routes[11].uri=http://egov-pg-service.egov:8080/ +spring.cloud.gateway.routes[11].predicates[0]=Path=/pg-service/** +spring.cloud.gateway.routes[11].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[11].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[11].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[12].id=user +spring.cloud.gateway.routes[12].uri=http://egov-user.egov:8080/ +spring.cloud.gateway.routes[12].predicates[0]=Path=/user/** +spring.cloud.gateway.routes[12].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[12].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[12].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[13].id=egov-workflow-v2 +spring.cloud.gateway.routes[13].uri=http://egov-workflow-v2.egov:8080/ +spring.cloud.gateway.routes[13].predicates[0]=Path=/egov-workflow-v2/** +spring.cloud.gateway.routes[13].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[13].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[13].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[14].id=internal-gateway-scg +spring.cloud.gateway.routes[14].uri=http://internal-gateway-scg.egov:8080/ +spring.cloud.gateway.routes[14].predicates[0]=Path=/internal-gateway-scg/** +spring.cloud.gateway.routes[14].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[14].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[14].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[15].id=pgr-services +spring.cloud.gateway.routes[15].uri=http://pgr-services.egov:8080/ +spring.cloud.gateway.routes[15].predicates[0]=Path=/pgr-services/** +spring.cloud.gateway.routes[15].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[15].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[15].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[16].id=service-request +spring.cloud.gateway.routes[16].uri=http://service-request.egov:8080/ +spring.cloud.gateway.routes[16].predicates[0]=Path=/service-request/** +spring.cloud.gateway.routes[16].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[16].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[16].filters[0].args.redis-rate-limiter.burstCapacity=2 + +spring.cloud.gateway.routes[17].id=user-otp +spring.cloud.gateway.routes[17].uri=http://user-otp.egov:8080/ +spring.cloud.gateway.routes[17].predicates[0]=Path=/user-otp/** +spring.cloud.gateway.routes[17].filters[0].name=RequestRateLimiter +spring.cloud.gateway.routes[17].filters[0].args.redis-rate-limiter.replenishRate=2 +spring.cloud.gateway.routes[17].filters[0].args.redis-rate-limiter.burstCapacity=2 \ No newline at end of file diff --git a/core-services/gateway/src/test/java/com/example/gateway/GatewayApplicationTests.java b/core-services/gateway/src/test/java/com/example/gateway/GatewayApplicationTests.java new file mode 100644 index 00000000000..f4565baf4ee --- /dev/null +++ b/core-services/gateway/src/test/java/com/example/gateway/GatewayApplicationTests.java @@ -0,0 +1,13 @@ +//package com.example.gateway; +// +//import org.junit.jupiter.api.Test; +//import org.springframework.boot.test.context.SpringBootTest; +// +//@SpringBootTest +//class GatewayApplicationTests { +// +// @Test +// void contextLoads() { +// } +// +//} diff --git a/core-services/internal-gateway-scg/.gitignore b/core-services/internal-gateway-scg/.gitignore new file mode 100644 index 00000000000..549e00a2a96 --- /dev/null +++ b/core-services/internal-gateway-scg/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/core-services/internal-gateway-scg/mvnw b/core-services/internal-gateway-scg/mvnw new file mode 100755 index 00000000000..66df2854281 --- /dev/null +++ b/core-services/internal-gateway-scg/mvnw @@ -0,0 +1,308 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# 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 +# +# https://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.2.0 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "$(uname)" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && + JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin ; then + javaHome="$(dirname "\"$javaExecutable\"")" + javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "\"$javaExecutable\"")" + fi + javaHome="$(dirname "\"$javaExecutable\"")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$(cd "$wdir/.." || exit 1; pwd) + fi + # end of workaround + done + printf '%s' "$(cd "$basedir" || exit 1; pwd)" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' < "$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + fi + while IFS="=" read -r key value; do + # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; + esac + done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget > /dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; + esac +done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/core-services/internal-gateway-scg/pom.xml b/core-services/internal-gateway-scg/pom.xml new file mode 100644 index 00000000000..b2f7748d721 --- /dev/null +++ b/core-services/internal-gateway-scg/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.2 + + + org.egov + internal-gateway-scg + 2.9.0-SNAPSHOT + internal-gateway-scg + internal gateway + + 17 + 2023.0.0 + 2.17.1 + ${java.version} + ${java.version} + + + + org.springframework.cloud + spring-cloud-starter-gateway + 4.1.1 + + + org.springframework.boot + spring-boot-starter-test + test + + + org.egov.services + tracer + 2.9.0-SNAPSHOT + + + org.projectlombok + lombok + provided + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-reactor-netty + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + + + + + + + + + + + + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + diff --git a/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/InternalGatewayScgApplication.java b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/InternalGatewayScgApplication.java new file mode 100644 index 00000000000..08255ace171 --- /dev/null +++ b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/InternalGatewayScgApplication.java @@ -0,0 +1,13 @@ +package org.egov.internalgatewayscg; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class InternalGatewayScgApplication { + + public static void main(String[] args) { + SpringApplication.run(InternalGatewayScgApplication.class, args); + } + +} diff --git a/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/filter/ErrorFilter.java b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/filter/ErrorFilter.java new file mode 100644 index 00000000000..f951e9f85b2 --- /dev/null +++ b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/filter/ErrorFilter.java @@ -0,0 +1,35 @@ +package org.egov.internalgatewayscg.filter; +import lombok.extern.slf4j.Slf4j; +import org.egov.internalgatewayscg.utils.ErrorUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.cloud.gateway.filter.GlobalFilter; + +import org.springframework.core.Ordered; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +@Slf4j +@Component +public class ErrorFilter implements GlobalFilter, Ordered { + + @Autowired + private ErrorUtils errorUtils; + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + return chain.filter(exchange) + .onErrorResume(throwable -> { + return errorUtils.raiseErrorFilterException(exchange, throwable); + }).then(); + } + + @Override + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE; + } + +} diff --git a/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/filter/RequestRouteFilter.java b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/filter/RequestRouteFilter.java new file mode 100644 index 00000000000..35917d5dec5 --- /dev/null +++ b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/filter/RequestRouteFilter.java @@ -0,0 +1,93 @@ +package org.egov.internalgatewayscg.filter; + +import lombok.extern.slf4j.Slf4j; +import org.egov.internalgatewayscg.utils.CustomException; +import org.egov.internalgatewayscg.utils.RoutingConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cloud.gateway.filter.*; +import org.springframework.cloud.gateway.support.ServerWebExchangeUtils; +import org.springframework.core.Ordered; +import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; +import org.springframework.web.server.ServerWebExchange; +import org.springframework.web.util.UriComponentsBuilder; +import reactor.core.publisher.Mono; + +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Map; +import java.util.Objects; + +@Slf4j +@Component +public class RequestRouteFilter extends RouteToRequestUrlFilter { + + @Autowired + private RoutingConfig routingConfig; + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + + String requestURI = exchange.getRequest().getURI().getPath(); + String requestTenantId = exchange.getRequest().getHeaders().getFirst("tenantId"); + + if(Objects.isNull(requestTenantId)) { + throw new CustomException(HttpStatus.BAD_REQUEST, "TenantId is mandatory"); + } + + log.info(" Route filter routing for URI ....... " + requestURI + " and tenantId : " + requestTenantId); + URL url = null; + + for (Map.Entry> tenantRoutingConfig : + routingConfig.getTeanantRoutingConfigWrapper().entrySet()) { + + if (requestURI.matches(tenantRoutingConfig.getKey())) { + + Map tenantRoutingMap = tenantRoutingConfig.getValue(); + String routingHost = findTenant(tenantRoutingMap, requestTenantId); + if (routingHost != null) { + URI uri = exchange.getRequest().getURI(); + boolean encoded = ServerWebExchangeUtils.containsEncodedParts(uri); + try { + URI routeuri = new URI(routingHost); + URI mergedUrl = UriComponentsBuilder.fromUri(uri) + .scheme(routeuri.getScheme()) + .host(routeuri.getHost()) + .port(routeuri.getPort()) + .build(encoded) + .toUri(); + exchange.getAttributes().put(ServerWebExchangeUtils.GATEWAY_REQUEST_URL_ATTR, mergedUrl); + break; + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + + } + break; + } + } + return chain.filter(exchange); + } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE - 1; + } + + private String findTenant(Map tenantRoutingMap, String reqTenantId) { + int count = StringUtils.countOccurrencesOf(reqTenantId, ".") + 1; + String tmpTenantId = new String(reqTenantId); + for (int i = 0; i < count; i++) { + if (tenantRoutingMap.containsKey(tmpTenantId)) { + return tenantRoutingMap.get(tmpTenantId); + } + tmpTenantId = tmpTenantId.substring(0,tmpTenantId.lastIndexOf(".")); + } + return null; + } +} diff --git a/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/utils/CustomException.java b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/utils/CustomException.java new file mode 100644 index 00000000000..99a6b9188a6 --- /dev/null +++ b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/utils/CustomException.java @@ -0,0 +1,15 @@ +package org.egov.internalgatewayscg.utils; + + +import org.springframework.http.HttpStatus; +import org.springframework.web.server.ResponseStatusException; + +public class CustomException extends ResponseStatusException { + public CustomException(HttpStatus status, String reason) { + super(status, reason); + } + + public CustomException(HttpStatus status, String reason, Throwable cause) { + super(status, reason, cause); + } +} \ No newline at end of file diff --git a/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/utils/ErrorUtils.java b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/utils/ErrorUtils.java new file mode 100644 index 00000000000..5c6d0437a71 --- /dev/null +++ b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/utils/ErrorUtils.java @@ -0,0 +1,90 @@ +package org.egov.internalgatewayscg.utils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.util.HashMap; + +@Component +@Slf4j +public class ErrorUtils { + + private static final String SEND_ERROR_FILTER_RAN = "sendErrorFilter.ran"; + + private static final ThreadLocal om = new ThreadLocal() { + @Override + protected ObjectMapper initialValue() { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + return objectMapper; + } + }; + + public static ObjectMapper getObjectMapper() { + return om.get(); + } + +// public static String getResponseBody(RequestContext ctx) throws IOException { +// String body = ctx.getResponseBody(); +// +// if (body == null) { +// body = IOUtils.toString(ctx.getResponseDataStream()); +// ctx.setResponseBody(body); +// } +// +// return body; +// } + + public static Mono raiseErrorFilterException(ServerWebExchange exchange, Throwable e) { + + try { + String message = e.getMessage(); + while (e.getCause() != null) + e = e.getCause(); + return _setExceptionBody(exchange, HttpStatus.INTERNAL_SERVER_ERROR, getErrorInfoObject(e.getClass().getName(), message, e.getMessage())); + } catch (Exception e1) { + e1.printStackTrace(); + } + return null; + } + + private static HashMap getErrorInfoObject(String code, String message, String description) { + + HashMap error = new HashMap(); + error.put("code", "INTERNAL_GATEWAY_ERROR"); + error.put("message", code + " : " + message); + error.put("description", description); + return error; + } + +// public static void setCustomException(HttpStatus status, String message) { +// try { +// _setExceptionBody(status, getErrorInfoObject("CustomException", message, message)); +// } catch (JsonProcessingException e) { +// e.printStackTrace(); +// } +// } + +// private static void _setExceptionBody(HttpStatus status, Object body) throws JsonProcessingException { +// _setExceptionBody(status, getObjectJSONString(body)); +// } + + private static Mono _setExceptionBody(ServerWebExchange exchange , HttpStatus status, Object body) throws JsonProcessingException { + exchange.getResponse().setStatusCode(status); + return exchange.getResponse().writeWith(Mono.just(exchange.getResponse() + .bufferFactory().wrap(getObjectJSONString(body).getBytes()))); + + } + + private static String getObjectJSONString(Object obj) throws JsonProcessingException { + return om.get().writeValueAsString(obj); + } + +} \ No newline at end of file diff --git a/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/utils/RoutingConfig.java b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/utils/RoutingConfig.java new file mode 100644 index 00000000000..5bec5f061be --- /dev/null +++ b/core-services/internal-gateway-scg/src/main/java/org/egov/internalgatewayscg/utils/RoutingConfig.java @@ -0,0 +1,44 @@ +package org.egov.internalgatewayscg.utils; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.annotation.PostConstruct; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.Map; + +@Slf4j +@Component +public class RoutingConfig { + + @Value("${egov.service.config.path}") + private String serviceConfigPath; + + private Map> tenantRoutingConfigWrapper; + + @PostConstruct + public void loadServiceConfigurationYaml() { + + log.info(" Translator Service Reading Configuration from tenant-config givne in path : " + serviceConfigPath); + ObjectMapper mapper = new ObjectMapper(); + try { + URL serviceConfigUrl = new URL(serviceConfigPath); + tenantRoutingConfigWrapper = mapper.readValue(new InputStreamReader(serviceConfigUrl.openStream()), + new TypeReference>>(){}); + + log.info("loging the map constructed from the cofig file : " + tenantRoutingConfigWrapper.toString()); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public Map> getTeanantRoutingConfigWrapper() { + return tenantRoutingConfigWrapper; + } + +} \ No newline at end of file diff --git a/core-services/internal-gateway-scg/src/main/resources/application.properties b/core-services/internal-gateway-scg/src/main/resources/application.properties new file mode 100644 index 00000000000..94f18b1a210 --- /dev/null +++ b/core-services/internal-gateway-scg/src/main/resources/application.properties @@ -0,0 +1,16 @@ +server.port = 8081 +spring.main.web-application-type=reactive +zuul.routes.egov.path=/** +zuul.routes.egov.stripPrefix=false +management.endpoints.web.base-path=/ +zuul.ignored-patterns=/health/** + +#zuul.routes.egf-bank.path=/todos1/* +#zuul.routes.egf-bank.stripPrefix=false +#zuul.routes.egf-bank.url=https://jsonplaceholder.typicode.com + +egov.service.config.path=classpath:tenant-config.json + +spring.cloud.gateway.routes[0].id=catch-all-route +spring.cloud.gateway.routes[0].uri=http://localhost:8080 +spring.cloud.gateway.routes[0].predicates[0]=Path=/** \ No newline at end of file diff --git a/core-services/internal-gateway-scg/src/main/resources/tenant-config.json b/core-services/internal-gateway-scg/src/main/resources/tenant-config.json new file mode 100644 index 00000000000..f107fc1b9db --- /dev/null +++ b/core-services/internal-gateway-scg/src/main/resources/tenant-config.json @@ -0,0 +1,69 @@ +{ + "/egov-mdms-service/.*": { + "in.statea": "http://egov-mdms-service.statea:8080", + "in.stateb": "http://egov-mdms-service.stateb:8080", + "in": "http://egov-mdms-service:8080" + }, + "/pt-calculator-v2/.*": { + "in.statea": "http://pt-calculator-v2.statea:8080", + "in.stateb": "http://pt-calculator-v2.stateb:8080", + "in": "http://pt-calculator-v2.digit:8080" + }, + "/property-services/.*": { + "in.stateb": "http://property-services.digit:8080", + "in.statea": "http://property-services.digit:8080" + }, + "/billing-service/.*": { + "in.stateb": "http://billing-service.digit:8080", + "in.statea": "http://billing-service.digit:8080" + }, + "/tl-calculator/.*": { + "in.statea": "http://tl-calculator.statea:8080", + "in.stateb": "http://tl-calculator.stateb:8080" + }, + "/ws-calculator/.*": { + "in.statea": "http://ws-calculator.statea:8080", + "in.stateb": "http://ws-calculator.stateb:8080" + }, + "/sw-calculator/.*": { + "in.statea": "http://sw-calculator.statea:8080", + "in.stateb": "http://sw-calculator.stateb:8080" + }, + "/egov-searcher/.*": { + "in.statea": "http://egov-searcher.statea:8080", + "in.stateb": "http://egov-searcher.stateb:8080" + }, + "/firenoc-calculator/.*": { + "in.statea": "http://firenoc-calculator.statea:8080", + "in.stateb": "http://firenoc-calculator.stateb:8080" + }, + "/pg-service/.*": { + "in.statea": "http://egov-pg-service.statea:8080", + "in.stateb": "http://egov-pg-service.stateb:8080" + }, + "/dashboard-analytics/.*": { + "in.statea": "http://dashboard-analytics.statea:8080", + "in.stateb": "http://dashboard-analytics.stateb:8080" + }, + "/report/.*": { + "in.statea": "http://report.digit:8080", + "in.stateb": "http://report.digit:8080" + }, + "/pdf-service/.*": { + "in.statea": "http://pdf-service.statea:8080", + "in.stateb": "http://pdf-service.stateb:8080" + }, + "/filestore/.*": { + "in.statea": "http://egov-filestore.statea:8080", + "in.stateb": "http://egov-filestore.stateb:8080", + "in": "http://egov-filestore:8080" + }, + "/echallan-calculator/.*": { + "in.statea": "http://echallan-calculator.statea:8080", + "in.stateb": "http://echallan-calculator.stateb:8080" + }, + "/edcr/.*": { + "in.statea": "http://egov-edcr.statea:8080", + "in.stateb": "http://egov-edcr.stateb:8080" + } +} \ No newline at end of file diff --git a/core-services/internal-gateway-scg/src/test/java/org/egov/internalgatewayscg/InternalGatewayScgApplicationTests.java b/core-services/internal-gateway-scg/src/test/java/org/egov/internalgatewayscg/InternalGatewayScgApplicationTests.java new file mode 100644 index 00000000000..cea68005092 --- /dev/null +++ b/core-services/internal-gateway-scg/src/test/java/org/egov/internalgatewayscg/InternalGatewayScgApplicationTests.java @@ -0,0 +1,13 @@ +package org.egov.internalgatewayscg; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class InternalGatewayScgApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/core-services/libraries/digit-models/.gitignore b/core-services/libraries/digit-models/.gitignore deleted file mode 100644 index 2af7cefb0a3..00000000000 --- a/core-services/libraries/digit-models/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ \ No newline at end of file diff --git a/core-services/libraries/digit-models/CHANGELOG.md b/core-services/libraries/digit-models/CHANGELOG.md deleted file mode 100644 index 8336d84b5a5..00000000000 --- a/core-services/libraries/digit-models/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Changelog - -## 1.0.0 - -- Base version \ No newline at end of file diff --git a/core-services/libraries/digit-models/Dockerfile b/core-services/libraries/digit-models/Dockerfile deleted file mode 100644 index cd50dd4120d..00000000000 --- a/core-services/libraries/digit-models/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM egovio/alpine-maven-builder-jdk-8:1-master-NA-6036091e AS build -ARG WORK_DIR -ARG nexusUsername -ARG nexusPassword -WORKDIR /app -# copy the project files -COPY ${WORK_DIR}/pom.xml ./pom.xml -COPY ${WORK_DIR}/settings.xml ./settings.xml -# COPY build/maven/settings.xml ./settings.xml -# COPY build/maven/start.sh ./start.sh -COPY ${WORK_DIR}/src ./src -# not useful for stateless builds -# RUN mvn -B dependency:go-offline -RUN cd ${WORK_DIR} \ - && mvn -B -f /app/pom.xml test verify deploy -s settings.xml \ - -Dnexus.user=${nexusUsername} -Dnexus.password=${nexusPassword} -FROM scratch \ No newline at end of file diff --git a/core-services/libraries/digit-models/README.md b/core-services/libraries/digit-models/README.md deleted file mode 100644 index 2b38486e14c..00000000000 --- a/core-services/libraries/digit-models/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Digit Models - -Digit Models is a library to store common classes needed by many services. diff --git a/core-services/libraries/digit-models/pom.xml b/core-services/libraries/digit-models/pom.xml deleted file mode 100644 index 8ee9873b27c..00000000000 --- a/core-services/libraries/digit-models/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - 4.0.0 - org.egov.services - digit-models - 1.0.0-SNAPSHOT - digit-models - Shared classes among services - - - repo.digit.org - eGov ERP Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/releases/ - - - repo.digit.org - eGov ERP Snapshots Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - - - repo.digit.org - eGov ERP Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/releases/ - - - snapshots.repo.digit.org - eGov ERP Snapshots Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - - 2.17.1 - UTF-8 - 1.8 - UTF-8 - - - - org.apache.commons - commons-lang3 - 3.0 - - - net.minidev - json-smart - 2.2.1 - - - org.projectlombok - lombok - 1.18.24 - true - - - com.fasterxml.jackson.core - jackson-annotations - 2.8.7 - - - com.fasterxml.jackson.core - jackson-databind - 2.8.7 - - - org.springframework - spring-core - 5.2.5.RELEASE - - - org.egov.services - services-common - 1.1.0-SNAPSHOT - - - jakarta.validation - jakarta.validation-api - 2.0.2 - compile - - - - - - maven-compiler-plugin - - 8 - 8 - - - - maven-source-plugin - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - diff --git a/core-services/libraries/digit-models/settings.xml b/core-services/libraries/digit-models/settings.xml deleted file mode 100644 index f65f9dd2bfa..00000000000 --- a/core-services/libraries/digit-models/settings.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - nexus - central - https://nexus-repo.digit.org/nexus/content/groups/public/ - - - - - repo.digit.org - ${nexus.user} - ${nexus.password} - - - - com.versioneye - - diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Action.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Action.java deleted file mode 100644 index 1957c73144b..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Action.java +++ /dev/null @@ -1,56 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId", "currentState", "action"}) -public class Action { - - @Size(max = 256) - @JsonProperty("uuid") - private String uuid; - - @Size(max = 256) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max = 256) - @JsonProperty("currentState") - private String currentState; - - @Size(max = 256) - @JsonProperty("action") - private String action; - - @Size(max = 256) - @JsonProperty("nextState") - private String nextState; - - @Size(max = 1024) - @JsonProperty("roles") - @Valid - private List roles; - - private AuditDetails auditDetails; - - - public Action addRolesItem(String rolesItem) { - if (this.roles == null) { - this.roles = new ArrayList<>(); - } - this.roles.add(rolesItem); - return this; - } - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/AuditDetails.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/AuditDetails.java deleted file mode 100644 index c84fe7f74b1..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/AuditDetails.java +++ /dev/null @@ -1,31 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - - -/** - * Collection of audit related fields used by most models - */ - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class AuditDetails { - @JsonProperty("createdBy") - private String createdBy = null; - - @JsonProperty("lastModifiedBy") - private String lastModifiedBy = null; - - @JsonProperty("createdTime") - private Long createdTime = null; - - @JsonProperty("lastModifiedTime") - private Long lastModifiedTime = null; - - -} - diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Bill.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Bill.java deleted file mode 100644 index 61f645d777b..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Bill.java +++ /dev/null @@ -1,158 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.springframework.util.CollectionUtils; - -import javax.validation.Valid; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class Bill { - // TODO some of the fields are mandatory in yml, lets discuss billdetail and billaccountdetail also for more clarity - - @JsonProperty("id") - private String id; - - @JsonProperty("mobileNumber") - private String mobileNumber; - - @JsonProperty("paidBy") - private String paidBy; - - @JsonProperty("payerName") - private String payerName; - - @JsonProperty("payerAddress") - private String payerAddress; - - @JsonProperty("payerEmail") - private String payerEmail; - - @JsonProperty("payerId") - private String payerId; - - @JsonProperty("status") - private StatusEnum status; - - @JsonProperty("reasonForCancellation") - private String reasonForCancellation; - - @JsonProperty("isCancelled") - private Boolean isCancelled; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("billDetails") - @Valid - private List billDetails; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("collectionModesNotAllowed") - private List collectionModesNotAllowed; - - @JsonProperty("partPaymentAllowed") - private Boolean partPaymentAllowed; - - @JsonProperty("isAdvanceAllowed") - private Boolean isAdvanceAllowed; - - @JsonProperty("minimumAmountToBePaid") - private BigDecimal minimumAmountToBePaid; - - @JsonProperty("businessService") - private String businessService; - - @JsonProperty("totalAmount") - private BigDecimal totalAmount; - - @JsonProperty("consumerCode") - private String consumerCode; - - @JsonProperty("billNumber") - private String billNumber; - - @JsonProperty("billDate") - private Long billDate; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid; - - - public enum StatusEnum { - ACTIVE("ACTIVE"), - - CANCELLED("CANCELLED"), - - PAID("PAID"), - - EXPIRED("EXPIRED"); - - private final String value; - - StatusEnum(String value) { - this.value = value; - } - - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - public static boolean contains(String test) { - for (StatusEnum val : StatusEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - - } - - public Boolean addBillDetail(BillDetail billDetail) { - - if (CollectionUtils.isEmpty(billDetails)) { - - billDetails = new ArrayList<>(); - return billDetails.add(billDetail); - } else { - - if (!billDetails.contains(billDetail)) - return billDetails.add(billDetail); - else - return false; - } - } - - -} \ No newline at end of file diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BillAccountDetail.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BillAccountDetail.java deleted file mode 100644 index 64a10ed3564..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BillAccountDetail.java +++ /dev/null @@ -1,56 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; - -import javax.validation.constraints.Size; -import java.math.BigDecimal; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class BillAccountDetail { - - @Size(max = 64) - @JsonProperty("id") - private String id; - - @Size(max = 64) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max = 64) - @JsonProperty("billDetailId") - private String billDetailId; - - @Size(max = 64) - @JsonProperty("demandDetailId") - private String demandDetailId; - - @JsonProperty("order") - private Integer order; - - @JsonProperty("amount") - private BigDecimal amount; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount; - - @JsonProperty("isActualDemand") - private Boolean isActualDemand; - - @Size(max = 64) - @JsonProperty("taxHeadCode") - private String taxHeadCode; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BillDetail.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BillDetail.java deleted file mode 100644 index 2ee333ea675..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BillDetail.java +++ /dev/null @@ -1,99 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.springframework.util.CollectionUtils; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(of = {"id"}) -public class BillDetail { - - @JsonProperty("id") - private String id; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("demandId") - private String demandId; - - @JsonProperty("billId") - private String billId; - - @JsonProperty("amount") - @NotNull - private BigDecimal amount; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid; - - @NotNull - @JsonProperty("fromPeriod") - private Long fromPeriod; - - @NotNull - @JsonProperty("toPeriod") - private Long toPeriod; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("channel") - private String channel; - - @JsonProperty("voucherHeader") - private String voucherHeader; - - @JsonProperty("boundary") - private String boundary; - - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate; - - @JsonProperty("billAccountDetails") - private List billAccountDetails; - - @NotNull - @JsonProperty("collectionType") - private String collectionType; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - private String billDescription; - - @NotNull - @JsonProperty("expiryDate") - private Long expiryDate; - - - public Boolean addBillAccountDetail(BillAccountDetail billAccountDetail) { - - if (CollectionUtils.isEmpty(billAccountDetails)) { - - billAccountDetails = new ArrayList<>(); - return billAccountDetails.add(billAccountDetail); - } else { - - if (!billAccountDetails.contains(billAccountDetail)) - return billAccountDetails.add(billAccountDetail); - else - return false; - } - } - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BusinessService.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BusinessService.java deleted file mode 100644 index 5309583efa5..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BusinessService.java +++ /dev/null @@ -1,88 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId", "businessService"}) -@JsonInclude(JsonInclude.Include.NON_NULL) -public class BusinessService { - - @Size(max = 256) - @JsonProperty("tenantId") - private String tenantId = null; - - @Size(max = 256) - @JsonProperty("uuid") - private String uuid = null; - - @Size(max = 256) - @JsonProperty("businessService") - private String businessService = null; - - @Size(max = 256) - @JsonProperty("business") - private String business = null; - - @Size(max = 1024) - @JsonProperty("getUri") - private String getUri = null; - - @Size(max = 1024) - @JsonProperty("postUri") - private String postUri = null; - - @JsonProperty("businessServiceSla") - private Long businessServiceSla = null; - - @NotNull - @Valid - @JsonProperty("states") - private List states = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - - - public BusinessService addStatesItem(State statesItem) { - if (this.states == null) { - this.states = new ArrayList<>(); - } - this.states.add(statesItem); - return this; - } - - - /** - * Returns the currentState with the given uuid if not present returns null - * - * @param uuid the uuid of the currentState to be returned - * @return - */ - public State getStateFromUuid(String uuid) { - State state = null; - if (this.states != null) { - for (State s : this.states) { - if (s.getUuid().equalsIgnoreCase(uuid)) { - state = s; - break; - } - } - } - return state; - } - - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BusinessServiceResponse.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BusinessServiceResponse.java deleted file mode 100644 index 52ca27917ec..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/BusinessServiceResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.ArrayList; -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@ToString -public class BusinessServiceResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("BusinessServices") - @Valid - @NotNull - private List businessServices; - - - public BusinessServiceResponse addBusinessServiceItem(BusinessService businessServiceItem) { - if (this.businessServices == null) { - this.businessServices = new ArrayList<>(); - } - this.businessServices.add(businessServiceItem); - return this; - } - - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/CreateUserRequest.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/CreateUserRequest.java deleted file mode 100644 index e47e43cd800..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/CreateUserRequest.java +++ /dev/null @@ -1,21 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.User; - -@AllArgsConstructor -@Getter -@NoArgsConstructor -public class CreateUserRequest { - - @JsonProperty("requestInfo") - private RequestInfo requestInfo; - - @JsonProperty("user") - private User user; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Document.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Document.java deleted file mode 100644 index 8377243b6b0..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Document.java +++ /dev/null @@ -1,27 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Document { - @JsonProperty("id") - private String id = null; - - @JsonProperty("documentType") - private String documentType = null; - - @JsonProperty("fileStore") - private String fileStore = null; - - @JsonProperty("documentUid") - private String documentUid = null; - - @JsonProperty("additionalDetails") - private Object additionalDetails = null; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdGenerationRequest.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdGenerationRequest.java deleted file mode 100644 index 7157fb5291d..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdGenerationRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.RequestInfo; - -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class IdGenerationRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - private List idRequests; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdGenerationResponse.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdGenerationResponse.java deleted file mode 100644 index bb92f357a5d..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdGenerationResponse.java +++ /dev/null @@ -1,21 +0,0 @@ -package digit.models.coremodels; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class IdGenerationResponse { - - private ResponseInfo responseInfo; - - private List idResponses; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdRequest.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdRequest.java deleted file mode 100644 index 6340e1ac43f..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.constraints.NotNull; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class IdRequest { - - @JsonProperty("idName") - @NotNull - private String idName; - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("format") - private String format; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdResponse.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdResponse.java deleted file mode 100644 index 808b6ffbba9..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/IdResponse.java +++ /dev/null @@ -1,16 +0,0 @@ -package digit.models.coremodels; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class IdResponse { - - private String id; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Payment.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Payment.java deleted file mode 100644 index 697cb80cd8c..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/Payment.java +++ /dev/null @@ -1,109 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@EqualsAndHashCode -public class Payment { - - @Size(max = 64) - @JsonProperty("id") - private String id; - - @NotNull - @Size(max = 64) - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("totalDue") - private BigDecimal totalDue; - - @NotNull - @JsonProperty("totalAmountPaid") - private BigDecimal totalAmountPaid; - - @Size(max = 128) - @JsonProperty("transactionNumber") - private String transactionNumber; - - @JsonProperty("transactionDate") - private Long transactionDate; - - @NotNull - @JsonProperty("paymentMode") - private String paymentMode; - - @JsonProperty("instrumentDate") - private Long instrumentDate; - - @Size(max = 128) - @JsonProperty("instrumentNumber") - private String instrumentNumber; - - @JsonProperty("instrumentStatus") - private String instrumentStatus; - - @Size(max = 64) - @JsonProperty("ifscCode") - private String ifscCode; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("paymentDetails") - @Valid - private List paymentDetails; - - @Size(max = 128) - @NotNull - @JsonProperty("paidBy") - private String paidBy; - - @Size(max = 64) - @NotNull - @JsonProperty("mobileNumber") - private String mobileNumber; - - @Size(max = 128) - @JsonProperty("payerName") - private String payerName; - - @Size(max = 1024) - @JsonProperty("payerAddress") - private String payerAddress; - - @Size(max = 64) - @JsonProperty("payerEmail") - private String payerEmail; - - @Size(max = 64) - @JsonProperty("payerId") - private String payerId; - - @JsonProperty("paymentStatus") - private String paymentStatus; - - public Payment addpaymentDetailsItem(PaymentDetail paymentDetail) { - if (this.paymentDetails == null) { - this.paymentDetails = new ArrayList<>(); - } - this.paymentDetails.add(paymentDetail); - return this; - } - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/PaymentDetail.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/PaymentDetail.java deleted file mode 100644 index 68a127f42c9..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/PaymentDetail.java +++ /dev/null @@ -1,67 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@EqualsAndHashCode -public class PaymentDetail { - - @Size(max = 64) - @JsonProperty("id") - private String id; - - @Size(max = 64) - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("totalDue") - private BigDecimal totalDue; - - @NotNull - @JsonProperty("totalAmountPaid") - private BigDecimal totalAmountPaid; - - @Size(max = 64) - @JsonProperty("receiptNumber") - private String receiptNumber; - - @Size(max = 64) - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate; - - @JsonProperty("receiptDate") - private Long receiptDate; - - @JsonProperty("receiptType") - private String receiptType; - - @JsonProperty("businessService") - private String businessService; - - @NotNull - @Size(max = 64) - @JsonProperty("billId") - private String billId; - - @JsonProperty("bill") - private Bill bill; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/PaymentRequest.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/PaymentRequest.java deleted file mode 100644 index a42345bf357..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/PaymentRequest.java +++ /dev/null @@ -1,27 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.RequestInfo; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class PaymentRequest { - - @NotNull - @Valid - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @Valid - @JsonProperty("Payment") - private Payment payment; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/ProcessInstance.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/ProcessInstance.java deleted file mode 100644 index c2e054fb4ce..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/ProcessInstance.java +++ /dev/null @@ -1,75 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.User; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@EqualsAndHashCode(of = {"id"}) -@ToString -public class ProcessInstance { - - @Size(max = 64) - @JsonProperty("id") - private String id; - - @NotNull - @Size(max = 128) - @JsonProperty("tenantId") - private String tenantId; - - @NotNull - @Size(max = 128) - @JsonProperty("businessService") - private String businessService; - - @NotNull - @Size(max = 128) - @JsonProperty("businessId") - private String businessId; - - @NotNull - @Size(max = 128) - @JsonProperty("action") - private String action; - - @NotNull - @Size(max = 64) - @JsonProperty("moduleName") - private String moduleName; - - @JsonProperty("state") - private State state; - - - @JsonProperty("comment") - private String comment; - - @JsonProperty("documents") - @Valid - private List documents; - - @JsonProperty("assignes") - private List assignes; - - public ProcessInstance addDocumentsItem(Document documentsItem) { - if (this.documents == null) { - this.documents = new ArrayList<>(); - } - if (!this.documents.contains(documentsItem)) - this.documents.add(documentsItem); - - return this; - } - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/ProcessInstanceRequest.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/ProcessInstanceRequest.java deleted file mode 100644 index d2ef94e77da..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/ProcessInstanceRequest.java +++ /dev/null @@ -1,36 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -public class ProcessInstanceRequest { - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("ProcessInstances") - @Valid - @NotNull - private List processInstances; - - - public ProcessInstanceRequest addProcessInstanceItem(ProcessInstance processInstanceItem) { - if (this.processInstances == null) { - this.processInstances = new ArrayList<>(); - } - this.processInstances.add(processInstanceItem); - return this; - } - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/ProcessInstanceResponse.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/ProcessInstanceResponse.java deleted file mode 100644 index 9aebacb3951..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/ProcessInstanceResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class ProcessInstanceResponse { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("ProcessInstances") - @Valid - private List processInstances; - - - public ProcessInstanceResponse addProcessInstanceItem(ProcessInstance proceInstanceItem) { - if (this.processInstances == null) { - this.processInstances = new ArrayList<>(); - } - this.processInstances.add(proceInstanceItem); - return this; - } - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/RequestInfoWrapper.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/RequestInfoWrapper.java deleted file mode 100644 index 3eda053bc35..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/RequestInfoWrapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class RequestInfoWrapper { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; -} \ No newline at end of file diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/SMSRequest.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/SMSRequest.java deleted file mode 100644 index 7989fadc218..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/SMSRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package digit.models.coremodels; - -import lombok.*; - -@Getter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -public class SMSRequest { - private String mobileNumber; - private String message; -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/State.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/State.java deleted file mode 100644 index a101de62036..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/State.java +++ /dev/null @@ -1,70 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId", "businessServiceId", "state"}) -public class State { - - @Size(max = 256) - @JsonProperty("uuid") - private String uuid; - - @Size(max = 256) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max = 256) - @JsonProperty("businessServiceId") - private String businessServiceId; - - @JsonProperty("sla") - private Long sla; - - @Size(max = 256) - @JsonProperty("state") - private String state; - - @Size(max = 256) - @JsonProperty("applicationStatus") - private String applicationStatus; - - @JsonProperty("docUploadRequired") - private Boolean docUploadRequired; - - @JsonProperty("isStartState") - private Boolean isStartState; - - @JsonProperty("isTerminateState") - private Boolean isTerminateState; - - @JsonProperty("isStateUpdatable") - private Boolean isStateUpdatable; - - @JsonProperty("actions") - @Valid - private List actions; - - private AuditDetails auditDetails; - - - public State addActionsItem(Action actionsItem) { - if (this.actions == null) { - this.actions = new ArrayList<>(); - } - this.actions.add(actionsItem); - return this; - } - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/UserDetailResponse.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/UserDetailResponse.java deleted file mode 100644 index f54dd38b97f..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/UserDetailResponse.java +++ /dev/null @@ -1,21 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.User; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@AllArgsConstructor -@NoArgsConstructor -@Getter -public class UserDetailResponse { - @JsonProperty("responseInfo") - ResponseInfo responseInfo; - - @JsonProperty("user") - List user; -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/UserSearchRequest.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/UserSearchRequest.java deleted file mode 100644 index e6f1add6616..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/UserSearchRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -package digit.models.coremodels; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Getter; -import lombok.Setter; -import org.egov.common.contract.request.RequestInfo; - -import java.util.Collections; -import java.util.List; - -@Getter -@Setter -public class UserSearchRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("uuid") - private List uuid; - - @JsonProperty("id") - private List id; - - @JsonProperty("userName") - private String userName; - - @JsonProperty("name") - private String name; - - @JsonProperty("mobileNumber") - private String mobileNumber; - - @JsonProperty("aadhaarNumber") - private String aadhaarNumber; - - @JsonProperty("pan") - private String pan; - - @JsonProperty("emailId") - private String emailId; - - @JsonProperty("fuzzyLogic") - private boolean fuzzyLogic; - - @JsonProperty("active") - @Setter - private Boolean active; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("pageSize") - private int pageSize; - - @JsonProperty("pageNumber") - private int pageNumber = 0; - - @JsonProperty("sort") - private List sort = Collections.singletonList("name"); - - @JsonProperty("userType") - private String userType; - - @JsonProperty("roleCodes") - private List roleCodes; - - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MDMSCreateErrorResponse.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MDMSCreateErrorResponse.java deleted file mode 100644 index cfffdeacb47..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MDMSCreateErrorResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -package digit.models.coremodels.mdms; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; - -@Getter -@Setter -@ToString -@AllArgsConstructor -@NoArgsConstructor -public class MDMSCreateErrorResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("Message") - private String message; - - @JsonProperty("Data") - private Object data; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MDMSCreateRequest.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MDMSCreateRequest.java deleted file mode 100644 index 7aa3f3646d0..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MDMSCreateRequest.java +++ /dev/null @@ -1,20 +0,0 @@ -package digit.models.coremodels.mdms; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; - -@Getter -@Setter -@ToString -@AllArgsConstructor -@NoArgsConstructor -public class MDMSCreateRequest { - - @JsonProperty("RequestInfo") - public RequestInfo requestInfo; - - @JsonProperty("MasterMetaData") - public MasterMetaData masterMetaData; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MasterDetail.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MasterDetail.java deleted file mode 100644 index 27b72526e1c..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MasterDetail.java +++ /dev/null @@ -1,18 +0,0 @@ -package digit.models.coremodels.mdms; - -import lombok.*; - -import javax.validation.constraints.Size; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class MasterDetail { - @Size(max=256) - private String name; - - private String filter; -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MasterMetaData.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MasterMetaData.java deleted file mode 100644 index a63f428aa75..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MasterMetaData.java +++ /dev/null @@ -1,26 +0,0 @@ -package digit.models.coremodels.mdms; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import java.util.List; - -@Getter -@Setter -@ToString -@AllArgsConstructor -@NoArgsConstructor -public class MasterMetaData { - - @JsonProperty("tenantId") - public String tenantId; - - @JsonProperty("moduleName") - public String moduleName; - - @JsonProperty("masterName") - public String masterName; - - @JsonProperty("masterData") - public List masterData; -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsCreateResponse.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsCreateResponse.java deleted file mode 100644 index 2d9c6179e53..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsCreateResponse.java +++ /dev/null @@ -1,20 +0,0 @@ -package digit.models.coremodels.mdms; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; - -@Getter -@Setter -@ToString -@AllArgsConstructor -@NoArgsConstructor -public class MdmsCreateResponse { - - @JsonProperty("ResponseInfo") - public ResponseInfo responseInfo; - - @JsonProperty("Data") - public Object data; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsCriteria.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsCriteria.java deleted file mode 100644 index 6e01d6ad364..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsCriteria.java +++ /dev/null @@ -1,25 +0,0 @@ -package digit.models.coremodels.mdms; - -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.List; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class MdmsCriteria { - - @NotNull - @Size(max=256) - private String tenantId; - - @NotNull - @Valid - private List moduleDetails; -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsCriteriaReq.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsCriteriaReq.java deleted file mode 100644 index 5ebdc3d59ff..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsCriteriaReq.java +++ /dev/null @@ -1,28 +0,0 @@ -package digit.models.coremodels.mdms; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class MdmsCriteriaReq { - - @JsonProperty("RequestInfo") - @Valid - @NotNull - private RequestInfo requestInfo; - - @JsonProperty("MdmsCriteria") - @Valid - @NotNull - private MdmsCriteria mdmsCriteria; - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsResponse.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsResponse.java deleted file mode 100644 index f3bfdc9f461..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/MdmsResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -package digit.models.coremodels.mdms; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; -import net.minidev.json.JSONArray; - -import java.util.Map; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class MdmsResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("MdmsRes") - private Map> mdmsRes; -} \ No newline at end of file diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/ModuleDetail.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/ModuleDetail.java deleted file mode 100644 index 6a935790872..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/mdms/ModuleDetail.java +++ /dev/null @@ -1,23 +0,0 @@ -package digit.models.coremodels.mdms; - -import lombok.*; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.List; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class ModuleDetail { - - @NotNull - @Size(max=256) - private String moduleName; - - private List masterDetails; - -} \ No newline at end of file diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/Address.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/Address.java deleted file mode 100644 index ebdd3417b6c..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/Address.java +++ /dev/null @@ -1,50 +0,0 @@ -package digit.models.coremodels.user; - -import digit.models.coremodels.user.enums.AddressType; -import lombok.*; -import org.apache.commons.lang3.StringUtils; - -import java.util.Date; - -@Getter -@Setter -@Builder -@AllArgsConstructor -@EqualsAndHashCode(of = {"id"}) -public class Address { - private String pinCode; - private String city; - private String address; - private AddressType type; - private Long id; - private String tenantId; - private Long userId; - private String addressType; - private Long LastModifiedBy; - private Date LastModifiedDate; - - boolean isInvalid() { - return isPinCodeInvalid() - || isCityInvalid() - || isAddressInvalid(); - } - - - boolean isNotEmpty() { - return StringUtils.isNotEmpty(pinCode) - || StringUtils.isNotEmpty(city) - || StringUtils.isNotEmpty(address); - } - - boolean isPinCodeInvalid() { - return pinCode != null && pinCode.length() > 10; - } - - boolean isCityInvalid() { - return city != null && city.length() > 300; - } - - boolean isAddressInvalid() { - return address != null && address.length() > 300; - } -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/Role.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/Role.java deleted file mode 100644 index 290503083f9..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/Role.java +++ /dev/null @@ -1,27 +0,0 @@ -package digit.models.coremodels.user; - -import lombok.*; - -import java.util.Date; - -@Getter -@Setter -@Builder -@AllArgsConstructor -@ToString -@EqualsAndHashCode(of = {"code", "tenantId"}) -public class Role { - private static final String CITIZEN = "CITIZEN"; - private String name; - private String code; - private String description; - private Long createdBy; - private Date createdDate; - private Long lastModifiedBy; - private Date lastModifiedDate; - private String tenantId; - - public static Role getCitizenRole() { - return Role.builder().code(CITIZEN).build(); - } -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/User.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/User.java deleted file mode 100644 index 50cd910da8b..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/User.java +++ /dev/null @@ -1,241 +0,0 @@ -package digit.models.coremodels.user; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import digit.models.coremodels.user.config.UserServiceConstants; -import digit.models.coremodels.user.enums.BloodGroup; -import digit.models.coremodels.user.enums.Gender; -import digit.models.coremodels.user.enums.GuardianRelation; -import digit.models.coremodels.user.enums.UserType; -import digit.models.coremodels.user.exception.InvalidUserCreateException; -import digit.models.coremodels.user.exception.InvalidUserUpdateException; -import lombok.*; -import org.apache.commons.lang3.time.DateUtils; -import org.springframework.util.CollectionUtils; - -import javax.validation.constraints.Email; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; -import java.util.*; - -import static org.springframework.util.ObjectUtils.isEmpty; - -@AllArgsConstructor -@Getter -@Setter -@ToString -@Builder(toBuilder = true) -public class User { - - private Long id; - private String uuid; - - @Pattern(regexp = UserServiceConstants.PATTERN_TENANT) - @Size(max = 50) - private String tenantId; - private String username; - private String title; - private String password; - private String salutation; - - @Pattern(regexp = UserServiceConstants.PATTERN_NAME) - private String guardian; - - private GuardianRelation guardianRelation; - - @Pattern(regexp = UserServiceConstants.PATTERN_NAME) - @Size(max = 50) - private String name; - private Gender gender; - private String mobileNumber; - - @Email - private String emailId; - private String altContactNumber; - private String pan; - private String aadhaarNumber; - private Address permanentAddress; - private Address correspondenceAddress; - private Set
addresses; - private Boolean active; - private Set roles; - private Date dob; - private Date passwordExpiryDate; - private String locale = "en_IN"; - private UserType type; - private BloodGroup bloodGroup; - private String identificationMark; - private String signature; - private String photo; - private Boolean accountLocked; - private Long accountLockedDate; - private Date lastModifiedDate; - private Date createdDate; - private String otpReference; - private Long createdBy; - private Long lastModifiedBy; - private Long loggedInUserId; - private boolean otpValidationMandatory; - private boolean mobileValidationMandatory = true; - private String alternateMobileNumber; - - public User addAddressItem(Address addressItem) { - if (this.addresses == null) { - this.addresses = new HashSet<>(); - } - this.addresses.add(addressItem); - return this; - } - - public User addRolesItem(Role roleItem) { - if (this.roles == null) { - this.roles = new HashSet<>(); - } - this.roles.add(roleItem); - return this; - } - - public void validateNewUser() { - validateNewUser(true); - } - - public void validateNewUser(boolean createUserValidateName) { - if (isUsernameAbsent() - || (createUserValidateName && isNameAbsent()) - || isMobileNumberAbsent() - || isActiveIndicatorAbsent() - || isTypeAbsent() - || isPermanentAddressInvalid() - || isCorrespondenceAddressInvalid() - || isRolesAbsent() - || isOtpReferenceAbsent() - || isTenantIdAbsent()) { - throw new InvalidUserCreateException(this); - } - } - - public void validateUserModification() { - if (isPermanentAddressInvalid() - || isCorrespondenceAddressInvalid() - || isTenantIdAbsent() - ) { - throw new InvalidUserUpdateException(this); - } - } - - @JsonIgnore - public boolean isCorrespondenceAddressInvalid() { - return correspondenceAddress != null && correspondenceAddress.isInvalid(); - } - - @JsonIgnore - public boolean isPermanentAddressInvalid() { - return permanentAddress != null && permanentAddress.isInvalid(); - } - - @JsonIgnore - public boolean isOtpReferenceAbsent() { - return otpValidationMandatory && isEmpty(otpReference); - } - - @JsonIgnore - public boolean isTypeAbsent() { - return isEmpty(type); - } - - @JsonIgnore - public boolean isActiveIndicatorAbsent() { - return isEmpty(active); - } - - @JsonIgnore - public boolean isMobileNumberAbsent() { - return mobileValidationMandatory && isEmpty(mobileNumber); - } - - @JsonIgnore - public boolean isNameAbsent() { - return isEmpty(name); - } - - @JsonIgnore - public boolean isUsernameAbsent() { - return isEmpty(username); - } - - @JsonIgnore - public boolean isTenantIdAbsent() { - return isEmpty(tenantId); - } - - @JsonIgnore - public boolean isPasswordAbsent() { - return isEmpty(password); - } - - @JsonIgnore - public boolean isRolesAbsent() { - return CollectionUtils.isEmpty(roles) || roles.stream().anyMatch(r -> isEmpty(r.getCode())); - } - - @JsonIgnore - public boolean isIdAbsent() { - return id == null; - } - - public void nullifySensitiveFields() { - username = null; - type = null; - mobileNumber = null; - password = null; - passwordExpiryDate = null; - roles = null; - accountLocked = null; - accountLockedDate = null; - } - - @JsonIgnore - public boolean isLoggedInUserDifferentFromUpdatedUser() { - return !id.equals(loggedInUserId); - } - - public void setRoleToCitizen() { - type = UserType.CITIZEN; - roles = Collections.singleton(Role.getCitizenRole()); - } - - public void updatePassword(String newPassword) { - password = newPassword; - } - - @JsonIgnore - public OtpValidationRequest getOtpValidationRequest() { - return OtpValidationRequest.builder() - .mobileNumber(mobileNumber) - .tenantId(tenantId) - .otpReference(otpReference) - .build(); - } - - @JsonIgnore - public List
getPermanentAndCorrespondenceAddresses() { - final ArrayList
addresses = new ArrayList<>(); - if (correspondenceAddress != null && correspondenceAddress.isNotEmpty()) { - addresses.add(correspondenceAddress); - } - if (permanentAddress != null && permanentAddress.isNotEmpty()) { - addresses.add(permanentAddress); - } - return addresses; - } - - public void setDefaultPasswordExpiry(int expiryInDays) { - if (passwordExpiryDate == null) { - passwordExpiryDate = DateUtils.addDays(new Date(), expiryInDays); - } - } - - public void setActive(boolean isActive) { - active = isActive; - } -} - diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/Gender.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/Gender.java deleted file mode 100644 index 58f1b1b440b..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/Gender.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package digit.models.coremodels.user.enums; - -public enum Gender { - //This order should not be interrupted - FEMALE, MALE, OTHERS, TRANSGENDER; -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/GuardianRelation.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/GuardianRelation.java deleted file mode 100644 index 34859c66fb5..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/GuardianRelation.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package digit.models.coremodels.user.enums; - -public enum GuardianRelation { - FATHER, MOTHER, HUSBAND, OTHER; -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/UserType.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/UserType.java deleted file mode 100644 index ac6c5820f01..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/UserType.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * eGov suite of products aim to improve the internal efficiency,transparency, - * accountability and the service delivery of the government organizations. - * - * Copyright (C) 2016 eGovernments Foundation - * - * The updated version of eGov suite of products as by eGovernments Foundation - * is available at http://www.egovernments.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ or - * http://www.gnu.org/licenses/gpl.html . - * - * In addition to the terms of the GPL license to be adhered to in using this - * program, the following additional terms are to be complied with: - * - * 1) All versions of this program, verbatim or modified must carry this - * Legal Notice. - * - * 2) Any misrepresentation of the origin of the material is prohibited. It - * is required that all modified versions of this material be marked in - * reasonable ways as different from the original version. - * - * 3) This license does not grant any rights to any user of the program - * with regards to rights under trademark law for use of the trade names - * or trademarks of eGovernments Foundation. - * - * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. - */ - -package digit.models.coremodels.user.enums; - -import com.fasterxml.jackson.annotation.JsonCreator; - -public enum UserType { - CITIZEN, EMPLOYEE, SYSTEM, BUSINESS; - - @JsonCreator - public static UserType fromValue(String text) { - for (UserType userType : UserType.values()) { - if (String.valueOf(userType).equalsIgnoreCase(text)) { - return userType; - } - } - return null; - } -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/exception/InvalidUserCreateException.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/exception/InvalidUserCreateException.java deleted file mode 100644 index 1ed89944466..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/exception/InvalidUserCreateException.java +++ /dev/null @@ -1,16 +0,0 @@ -package digit.models.coremodels.user.exception; - -import digit.models.coremodels.user.User; -import lombok.Getter; - -@Getter -public class InvalidUserCreateException extends RuntimeException { - - private static final long serialVersionUID = -761312648494992125L; - private User user; - - public InvalidUserCreateException(User user) { - this.user = user; - } - -} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/exception/InvalidUserUpdateException.java b/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/exception/InvalidUserUpdateException.java deleted file mode 100644 index 2d56ad8b0db..00000000000 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/exception/InvalidUserUpdateException.java +++ /dev/null @@ -1,16 +0,0 @@ -package digit.models.coremodels.user.exception; - -import digit.models.coremodels.user.User; -import lombok.Getter; - -public class InvalidUserUpdateException extends RuntimeException { - - private static final long serialVersionUID = 580361940613077431L; - @Getter - private User user; - - public InvalidUserUpdateException(User user) { - this.user = user; - } - -} diff --git a/core-services/libraries/enc-client/CHANGELOG.md b/core-services/libraries/enc-client/CHANGELOG.md new file mode 100644 index 00000000000..9a2eb0da341 --- /dev/null +++ b/core-services/libraries/enc-client/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog +All notable changes to this library will be documented in this file. + +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.6.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 \ No newline at end of file diff --git a/core-services/libraries/enc-client/Dockerfile b/core-services/libraries/enc-client/Dockerfile index cd50dd4120d..809c16d1e84 100644 --- a/core-services/libraries/enc-client/Dockerfile +++ b/core-services/libraries/enc-client/Dockerfile @@ -1,8 +1,12 @@ -FROM egovio/alpine-maven-builder-jdk-8:1-master-NA-6036091e AS build +FROM egovio/amazoncorretto:17-alpine3.19 AS build ARG WORK_DIR ARG nexusUsername ARG nexusPassword WORKDIR /app + +# Install Maven +RUN apk add --no-cache maven + # copy the project files COPY ${WORK_DIR}/pom.xml ./pom.xml COPY ${WORK_DIR}/settings.xml ./settings.xml diff --git a/core-services/libraries/enc-client/pom.xml b/core-services/libraries/enc-client/pom.xml index 4ca44af3e3d..17be26e8af1 100644 --- a/core-services/libraries/enc-client/pom.xml +++ b/core-services/libraries/enc-client/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.egov enc-client - 2.0.4-SNAPSHOT + 2.9.0-SNAPSHOT org.springframework.boot spring-boot-starter-parent - 2.2.6.RELEASE + 3.2.2 @@ -29,26 +29,26 @@ 2.17.1 UTF-8 - 1.8 + 17 UTF-8 - - org.egov.services - services-common - 1.1.0-SNAPSHOT - org.egov.services tracer - 2.1.1-SNAPSHOT + 2.9.0-SNAPSHOT org.egov mdms-client - 0.0.4-SNAPSHOT + 2.9.0-SNAPSHOT + + net.minidev + json-smart + 2.5.0 + com.fasterxml.jackson.core jackson-databind @@ -79,11 +79,6 @@ org.springframework spring-core - - org.egov.services - services-common - 1.1.1-SNAPSHOT - org.springframework spring-test @@ -122,23 +117,16 @@ + org.apache.maven.plugins maven-compiler-plugin + 3.12.1 - 8 - 8 + 17 + 17 + 17 + true - - maven-source-plugin - - - attach-sources - - jar - - - - diff --git a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/config/DecryptionPolicyConfiguration.java b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/config/DecryptionPolicyConfiguration.java index 33b66c41eec..a426e4862c3 100644 --- a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/config/DecryptionPolicyConfiguration.java +++ b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/config/DecryptionPolicyConfiguration.java @@ -13,7 +13,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.client.RestTemplate; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; diff --git a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/config/EncryptionPolicyConfiguration.java b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/config/EncryptionPolicyConfiguration.java index a1ee893b4b9..3032fd14933 100644 --- a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/config/EncryptionPolicyConfiguration.java +++ b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/config/EncryptionPolicyConfiguration.java @@ -12,7 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.util.List; import java.util.Map; diff --git a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/masking/MaskingService.java b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/masking/MaskingService.java index 093fabf7a59..2043e7cd562 100644 --- a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/masking/MaskingService.java +++ b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/masking/MaskingService.java @@ -19,7 +19,7 @@ import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.util.*; @Slf4j diff --git a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/util/MdmsFetcher.java b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/util/MdmsFetcher.java index 8fb96ff471e..4447191d736 100644 --- a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/util/MdmsFetcher.java +++ b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/util/MdmsFetcher.java @@ -14,7 +14,6 @@ import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import org.slf4j.MDC; - import java.util.Arrays; @Slf4j diff --git a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/web/contract/EncReqObject.java b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/web/contract/EncReqObject.java index ddc7fe910e0..0f5f7f8dad1 100644 --- a/core-services/libraries/enc-client/src/main/java/org/egov/encryption/web/contract/EncReqObject.java +++ b/core-services/libraries/enc-client/src/main/java/org/egov/encryption/web/contract/EncReqObject.java @@ -6,7 +6,7 @@ /** * Encryption / Decryption Request Meta-data and Values */ -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-10-11T17:31:52.360+05:30") +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2018-10-11T17:31:52.360+05:30") @Getter @Setter diff --git a/core-services/libraries/enc-client/src/main/java/org/egov/hash/HashService.java b/core-services/libraries/enc-client/src/main/java/org/egov/hash/HashService.java index 8705a916154..59d9335cb15 100644 --- a/core-services/libraries/enc-client/src/main/java/org/egov/hash/HashService.java +++ b/core-services/libraries/enc-client/src/main/java/org/egov/hash/HashService.java @@ -4,7 +4,7 @@ import org.apache.commons.codec.binary.Base64; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; diff --git a/core-services/libraries/mdms-client/CHANGELOG.md b/core-services/libraries/mdms-client/CHANGELOG.md new file mode 100644 index 00000000000..9a2eb0da341 --- /dev/null +++ b/core-services/libraries/mdms-client/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog +All notable changes to this library will be documented in this file. + +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.6.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 \ No newline at end of file diff --git a/core-services/libraries/mdms-client/Dockerfile b/core-services/libraries/mdms-client/Dockerfile new file mode 100644 index 00000000000..809c16d1e84 --- /dev/null +++ b/core-services/libraries/mdms-client/Dockerfile @@ -0,0 +1,21 @@ +FROM egovio/amazoncorretto:17-alpine3.19 AS build +ARG WORK_DIR +ARG nexusUsername +ARG nexusPassword +WORKDIR /app + +# Install Maven +RUN apk add --no-cache maven + +# copy the project files +COPY ${WORK_DIR}/pom.xml ./pom.xml +COPY ${WORK_DIR}/settings.xml ./settings.xml +# COPY build/maven/settings.xml ./settings.xml +# COPY build/maven/start.sh ./start.sh +COPY ${WORK_DIR}/src ./src +# not useful for stateless builds +# RUN mvn -B dependency:go-offline +RUN cd ${WORK_DIR} \ + && mvn -B -f /app/pom.xml test verify deploy -s settings.xml \ + -Dnexus.user=${nexusUsername} -Dnexus.password=${nexusPassword} +FROM scratch \ No newline at end of file diff --git a/core-services/libraries/mdms-client/pom.xml b/core-services/libraries/mdms-client/pom.xml index 86e2c5e5950..417caa1bb39 100644 --- a/core-services/libraries/mdms-client/pom.xml +++ b/core-services/libraries/mdms-client/pom.xml @@ -5,37 +5,26 @@ org.springframework.boot spring-boot-starter-parent - 1.5.22.RELEASE + 3.2.2 org.egov mdms-client - 0.0.4-SNAPSHOT + 2.9.0-SNAPSHOT - - repo.digit.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - repo.egovernments.org + repo.digit.org eGov ERP Snapshots Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - 2.17.1 UTF-8 - 1.8 + 17 UTF-8 3.3.9 - 1.18.8 + 1.18.22 2.6 @@ -68,11 +57,6 @@ spring-boot-starter-test test - - org.egov.services - services-common - 1.1.0-SNAPSHOT - com.jayway.jsonpath json-path @@ -96,52 +80,28 @@ org.egov.services tracer - 2.1.1-SNAPSHOT + 2.9.0-SNAPSHOT - repo.egovernments.org.snapshots - eGov ERP Snapshots Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - repo.digit.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - + - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - exec - - - + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 - - - org.projectlombok - lombok - - - org.springframework.boot - spring-boot-devtools - - + 17 + 17 + 17 + true diff --git a/core-services/libraries/mdms-client/settings.xml b/core-services/libraries/mdms-client/settings.xml index 092c5ee4b49..8de43f8a369 100644 --- a/core-services/libraries/mdms-client/settings.xml +++ b/core-services/libraries/mdms-client/settings.xml @@ -12,7 +12,7 @@ - repo.egovernments.org + repo.digit.org ${nexus.user} ${nexus.password} diff --git a/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MasterDetail.java b/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MasterDetail.java index 35d6f80aa1b..e5bc5396f14 100644 --- a/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MasterDetail.java +++ b/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MasterDetail.java @@ -1,7 +1,7 @@ package org.egov.mdms.model; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MdmsCriteria.java b/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MdmsCriteria.java index 4f2f3658411..3364e382f94 100644 --- a/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MdmsCriteria.java +++ b/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MdmsCriteria.java @@ -2,9 +2,9 @@ import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import org.egov.mdms.model.MasterDetail.MasterDetailBuilder; diff --git a/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MdmsCriteriaReq.java b/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MdmsCriteriaReq.java index b1f03f82fe3..1c866bc530f 100644 --- a/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MdmsCriteriaReq.java +++ b/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/MdmsCriteriaReq.java @@ -1,7 +1,7 @@ package org.egov.mdms.model; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; import org.egov.common.contract.request.RequestInfo; import org.egov.mdms.model.MasterDetail.MasterDetailBuilder; diff --git a/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/ModuleDetail.java b/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/ModuleDetail.java index bc655c7517d..9f85c31e156 100644 --- a/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/ModuleDetail.java +++ b/core-services/libraries/mdms-client/src/main/java/org/egov/mdms/model/ModuleDetail.java @@ -2,9 +2,9 @@ import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import org.egov.mdms.model.MasterDetail.MasterDetailBuilder; diff --git a/core-services/libraries/services-common/CHANGELOG.md b/core-services/libraries/services-common/CHANGELOG.md new file mode 100644 index 00000000000..9a2eb0da341 --- /dev/null +++ b/core-services/libraries/services-common/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog +All notable changes to this library will be documented in this file. + +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.6.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 \ No newline at end of file diff --git a/core-services/libraries/services-common/Dockerfile b/core-services/libraries/services-common/Dockerfile index cd50dd4120d..809c16d1e84 100644 --- a/core-services/libraries/services-common/Dockerfile +++ b/core-services/libraries/services-common/Dockerfile @@ -1,8 +1,12 @@ -FROM egovio/alpine-maven-builder-jdk-8:1-master-NA-6036091e AS build +FROM egovio/amazoncorretto:17-alpine3.19 AS build ARG WORK_DIR ARG nexusUsername ARG nexusPassword WORKDIR /app + +# Install Maven +RUN apk add --no-cache maven + # copy the project files COPY ${WORK_DIR}/pom.xml ./pom.xml COPY ${WORK_DIR}/settings.xml ./settings.xml diff --git a/core-services/libraries/services-common/pom.xml b/core-services/libraries/services-common/pom.xml index 125fbba57b8..30aa299008d 100644 --- a/core-services/libraries/services-common/pom.xml +++ b/core-services/libraries/services-common/pom.xml @@ -6,26 +6,16 @@ org.springframework.boot spring-boot-starter-parent - 1.5.22.RELEASE + 3.2.2 org.egov.services services-common - 1.1.1-SNAPSHOT + 2.9.0-SNAPSHOT services-common Shared classes among services - - repo.digit.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ - - - repo.digit.org - eGov ERP Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/releases/ - - + repo.digit.org eGov ERP Snapshots Repository https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ @@ -34,7 +24,7 @@ 2.17.1 UTF-8 - 1.8 + 17 UTF-8 @@ -71,8 +61,13 @@ 2.0.2 compile + + org.apache.commons + commons-lang3 + 3.0 + - + repo.egovernments.org eGov DIGIT Releases Repository @@ -84,44 +79,4 @@ https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - - maven-pmd-plugin - 3.7 - - - verify - - check - - - - - false - false - - - - maven-deploy-plugin - 2.8.2 - - - default-deploy - deploy - - deploy - - - - - - maven-compiler-plugin - - 8 - 8 - - - - diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/constants/ServiceCommonConstants.java b/core-services/libraries/services-common/src/main/java/org/egov/common/constants/ServiceCommonConstants.java new file mode 100644 index 00000000000..b404466b374 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/constants/ServiceCommonConstants.java @@ -0,0 +1,13 @@ +package org.egov.common.constants; + +public class ServiceCommonConstants { + public static final String EMPTY_STRING = ""; + + public static final String RES_MESSAGE_ID = "uief87324"; + + public static final String SUCCESSFUL_STATUS = "successful"; + + public static final String FAILED_STATUS = "failed"; + + public static final String SET_KEYWORD = "set"; +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdGenerationRequest.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdGenerationRequest.java new file mode 100644 index 00000000000..b7aff5085d2 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdGenerationRequest.java @@ -0,0 +1,23 @@ +package org.egov.common.contract.idgen; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class IdGenerationRequest { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + private List idRequests; + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdGenerationResponse.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdGenerationResponse.java new file mode 100644 index 00000000000..0dbbac681d9 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdGenerationResponse.java @@ -0,0 +1,21 @@ +package org.egov.common.contract.idgen; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class IdGenerationResponse { + + private ResponseInfo responseInfo; + + private List idResponses; + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdRequest.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdRequest.java new file mode 100644 index 00000000000..8e7dadc11cc --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdRequest.java @@ -0,0 +1,28 @@ +package org.egov.common.contract.idgen; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class IdRequest { + + @JsonProperty("idName") + @NotNull + private String idName; + + @NotNull + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("format") + private String format; + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdResponse.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdResponse.java new file mode 100644 index 00000000000..7161adf43b9 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/idgen/IdResponse.java @@ -0,0 +1,16 @@ +package org.egov.common.contract.idgen; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class IdResponse { + + private String id; + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/Address.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/Address.java new file mode 100644 index 00000000000..185101cb1df --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/Address.java @@ -0,0 +1,50 @@ +package org.egov.common.contract.models; + +import lombok.*; +import org.egov.common.contract.user.enums.AddressType; +import org.springframework.util.StringUtils; + +import java.util.Date; + +@Getter +@Setter +@Builder +@AllArgsConstructor +@EqualsAndHashCode(of = {"id"}) +public class Address { + private String pinCode; + private String city; + private String address; + private AddressType type; + private Long id; + private String tenantId; + private Long userId; + private String addressType; + private Long LastModifiedBy; + private Date LastModifiedDate; + + boolean isInvalid() { + return isPinCodeInvalid() + || isCityInvalid() + || isAddressInvalid(); + } + + + boolean isNotEmpty() { + return !StringUtils.isEmpty(pinCode) + || !StringUtils.isEmpty(city) + || !StringUtils.isEmpty(address); + } + + boolean isPinCodeInvalid() { + return pinCode != null && pinCode.length() > 10; + } + + boolean isCityInvalid() { + return city != null && city.length() > 300; + } + + boolean isAddressInvalid() { + return address != null && address.length() > 300; + } +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/AuditDetails.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/AuditDetails.java new file mode 100644 index 00000000000..8a8b0fae5fb --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/AuditDetails.java @@ -0,0 +1,32 @@ +package org.egov.common.contract.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + + +/** + * Collection of audit related fields used by most models + */ + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class AuditDetails { + @JsonProperty("createdBy") + private String createdBy = null; + + @JsonProperty("lastModifiedBy") + private String lastModifiedBy = null; + + @JsonProperty("createdTime") + private Long createdTime = null; + + @JsonProperty("lastModifiedTime") + private Long lastModifiedTime = null; + + +} + diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/Document.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/Document.java new file mode 100644 index 00000000000..5bdf6899771 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/Document.java @@ -0,0 +1,27 @@ +package org.egov.common.contract.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Document { + @JsonProperty("id") + private String id = null; + + @JsonProperty("documentType") + private String documentType = null; + + @JsonProperty("fileStore") + private String fileStore = null; + + @JsonProperty("documentUid") + private String documentUid = null; + + @JsonProperty("additionalDetails") + private Object additionalDetails = null; + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/RequestInfoWrapper.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/RequestInfoWrapper.java new file mode 100644 index 00000000000..fef3038c5dd --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/RequestInfoWrapper.java @@ -0,0 +1,16 @@ +package org.egov.common.contract.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class RequestInfoWrapper { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; +} \ No newline at end of file diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/Workflow.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/Workflow.java new file mode 100644 index 00000000000..64e4da0a135 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/models/Workflow.java @@ -0,0 +1,41 @@ +package org.egov.common.contract.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Workflow { + @JsonProperty("action") + private String action = null; + + @JsonProperty("comments") + private String comments = null; + + @JsonProperty("documents") + @Valid + private List documents = null; + + @JsonProperty("assignes") + @Valid + private List assignes = null; + + @JsonProperty("rating") + private Integer rating = null; + + public Workflow addDocumentsItem(Document documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/CreateUserRequest.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/CreateUserRequest.java new file mode 100644 index 00000000000..ac806885f8b --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/CreateUserRequest.java @@ -0,0 +1,21 @@ +package org.egov.common.contract.user; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.User; + +@AllArgsConstructor +@Getter +@NoArgsConstructor +public class CreateUserRequest { + + @JsonProperty("requestInfo") + private RequestInfo requestInfo; + + @JsonProperty("user") + private User user; + +} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/OtpValidationRequest.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/OtpValidationRequest.java similarity index 88% rename from core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/OtpValidationRequest.java rename to core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/OtpValidationRequest.java index e47b6d6e390..470992cc9d9 100644 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/OtpValidationRequest.java +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/OtpValidationRequest.java @@ -1,4 +1,4 @@ -package digit.models.coremodels.user; +package org.egov.common.contract.user; import lombok.AllArgsConstructor; diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/UserDetailResponse.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/UserDetailResponse.java new file mode 100644 index 00000000000..1ebd0ae4650 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/UserDetailResponse.java @@ -0,0 +1,21 @@ +package org.egov.common.contract.user; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.User; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.List; + +@AllArgsConstructor +@NoArgsConstructor +@Getter +public class UserDetailResponse { + @JsonProperty("responseInfo") + ResponseInfo responseInfo; + + @JsonProperty("user") + List user; +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/UserSearchRequest.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/UserSearchRequest.java new file mode 100644 index 00000000000..a8dae66e541 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/UserSearchRequest.java @@ -0,0 +1,68 @@ +package org.egov.common.contract.user; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +import org.egov.common.contract.request.RequestInfo; + +import java.util.Collections; +import java.util.List; + +@Getter +@Setter +public class UserSearchRequest { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @JsonProperty("uuid") + private List uuid; + + @JsonProperty("id") + private List id; + + @JsonProperty("userName") + private String userName; + + @JsonProperty("name") + private String name; + + @JsonProperty("mobileNumber") + private String mobileNumber; + + @JsonProperty("aadhaarNumber") + private String aadhaarNumber; + + @JsonProperty("pan") + private String pan; + + @JsonProperty("emailId") + private String emailId; + + @JsonProperty("fuzzyLogic") + private boolean fuzzyLogic; + + @JsonProperty("active") + @Setter + private Boolean active; + + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("pageSize") + private int pageSize; + + @JsonProperty("pageNumber") + private int pageNumber = 0; + + @JsonProperty("sort") + private List sort = Collections.singletonList("name"); + + @JsonProperty("userType") + private String userType; + + @JsonProperty("roleCodes") + private List roleCodes; + + +} diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/config/UserServiceConstants.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/config/UserServiceConstants.java similarity index 95% rename from core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/config/UserServiceConstants.java rename to core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/config/UserServiceConstants.java index 66463a5ded3..2edd06fbf40 100644 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/config/UserServiceConstants.java +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/config/UserServiceConstants.java @@ -1,4 +1,4 @@ -package digit.models.coremodels.user.config; +package org.egov.common.contract.user.config; public class UserServiceConstants { diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/AddressType.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/AddressType.java similarity index 93% rename from core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/AddressType.java rename to core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/AddressType.java index 5954f4b866d..75ba54f78f0 100644 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/AddressType.java +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/AddressType.java @@ -1,4 +1,4 @@ -package digit.models.coremodels.user.enums; +package org.egov.common.contract.user.enums; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/BloodGroup.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/BloodGroup.java similarity index 93% rename from core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/BloodGroup.java rename to core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/BloodGroup.java index 629e09c5005..1eb56b59a95 100644 --- a/core-services/libraries/digit-models/src/main/java/digit/models/coremodels/user/enums/BloodGroup.java +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/BloodGroup.java @@ -1,4 +1,4 @@ -package digit.models.coremodels.user.enums; +package org.egov.common.contract.user.enums; import com.fasterxml.jackson.annotation.JsonCreator; import lombok.Getter; diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/Gender.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/Gender.java new file mode 100644 index 00000000000..3029b6daab9 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/Gender.java @@ -0,0 +1,46 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov.common.contract.user.enums; + +public enum Gender { + //This order should not be interrupted + FEMALE, MALE, OTHERS, TRANSGENDER; +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/GuardianRelation.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/GuardianRelation.java new file mode 100644 index 00000000000..4c9fc8a18ff --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/GuardianRelation.java @@ -0,0 +1,45 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov.common.contract.user.enums; + +public enum GuardianRelation { + FATHER, MOTHER, HUSBAND, OTHER; +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/UserType.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/UserType.java new file mode 100644 index 00000000000..ab8e9cd8713 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/enums/UserType.java @@ -0,0 +1,57 @@ +/* + * eGov suite of products aim to improve the internal efficiency,transparency, + * accountability and the service delivery of the government organizations. + * + * Copyright (C) 2016 eGovernments Foundation + * + * The updated version of eGov suite of products as by eGovernments Foundation + * is available at http://www.egovernments.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ or + * http://www.gnu.org/licenses/gpl.html . + * + * In addition to the terms of the GPL license to be adhered to in using this + * program, the following additional terms are to be complied with: + * + * 1) All versions of this program, verbatim or modified must carry this + * Legal Notice. + * + * 2) Any misrepresentation of the origin of the material is prohibited. It + * is required that all modified versions of this material be marked in + * reasonable ways as different from the original version. + * + * 3) This license does not grant any rights to any user of the program + * with regards to rights under trademark law for use of the trade names + * or trademarks of eGovernments Foundation. + * + * In case of any queries, you can reach eGovernments Foundation at contact@egovernments.org. + */ + +package org.egov.common.contract.user.enums; + +import com.fasterxml.jackson.annotation.JsonCreator; + +public enum UserType { + CITIZEN, EMPLOYEE, SYSTEM, BUSINESS; + + @JsonCreator + public static UserType fromValue(String text) { + for (UserType userType : UserType.values()) { + if (String.valueOf(userType).equalsIgnoreCase(text)) { + return userType; + } + } + return null; + } +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/exception/InvalidUserCreateException.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/exception/InvalidUserCreateException.java new file mode 100644 index 00000000000..e2f1cdeb3fc --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/exception/InvalidUserCreateException.java @@ -0,0 +1,16 @@ +package org.egov.common.contract.user.exception; + +import lombok.Getter; +import org.egov.common.contract.request.User; + +@Getter +public class InvalidUserCreateException extends RuntimeException { + + private static final long serialVersionUID = -761312648494992125L; + private User user; + + public InvalidUserCreateException(User user) { + this.user = user; + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/exception/InvalidUserUpdateException.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/exception/InvalidUserUpdateException.java new file mode 100644 index 00000000000..bef41a28850 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/user/exception/InvalidUserUpdateException.java @@ -0,0 +1,16 @@ +package org.egov.common.contract.user.exception; + +import lombok.Getter; +import org.egov.common.contract.request.User; + +public class InvalidUserUpdateException extends RuntimeException { + + private static final long serialVersionUID = 580361940613077431L; + @Getter + private User user; + + public InvalidUserUpdateException(User user) { + this.user = user; + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/Action.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/Action.java new file mode 100644 index 00000000000..accece7876d --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/Action.java @@ -0,0 +1,57 @@ +package org.egov.common.contract.workflow; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import javax.validation.Valid; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; +import org.egov.common.contract.models.AuditDetails; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +@EqualsAndHashCode(of = {"tenantId", "currentState", "action"}) +public class Action { + + @Size(max = 256) + @JsonProperty("uuid") + private String uuid; + + @Size(max = 256) + @JsonProperty("tenantId") + private String tenantId; + + @Size(max = 256) + @JsonProperty("currentState") + private String currentState; + + @Size(max = 256) + @JsonProperty("action") + private String action; + + @Size(max = 256) + @JsonProperty("nextState") + private String nextState; + + @Size(max = 1024) + @JsonProperty("roles") + @Valid + private List roles; + + private AuditDetails auditDetails; + + + public Action addRolesItem(String rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); + } + this.roles.add(rolesItem); + return this; + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/BusinessService.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/BusinessService.java new file mode 100644 index 00000000000..9cd28d08b81 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/BusinessService.java @@ -0,0 +1,89 @@ +package org.egov.common.contract.workflow; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.models.AuditDetails; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +@EqualsAndHashCode(of = {"tenantId", "businessService"}) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class BusinessService { + + @Size(max = 256) + @JsonProperty("tenantId") + private String tenantId = null; + + @Size(max = 256) + @JsonProperty("uuid") + private String uuid = null; + + @Size(max = 256) + @JsonProperty("businessService") + private String businessService = null; + + @Size(max = 256) + @JsonProperty("business") + private String business = null; + + @Size(max = 1024) + @JsonProperty("getUri") + private String getUri = null; + + @Size(max = 1024) + @JsonProperty("postUri") + private String postUri = null; + + @JsonProperty("businessServiceSla") + private Long businessServiceSla = null; + + @NotNull + @Valid + @JsonProperty("states") + private List states = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + + public BusinessService addStatesItem(State statesItem) { + if (this.states == null) { + this.states = new ArrayList<>(); + } + this.states.add(statesItem); + return this; + } + + + /** + * Returns the currentState with the given uuid if not present returns null + * + * @param uuid the uuid of the currentState to be returned + * @return + */ + public State getStateFromUuid(String uuid) { + State state = null; + if (this.states != null) { + for (State s : this.states) { + if (s.getUuid().equalsIgnoreCase(uuid)) { + state = s; + break; + } + } + } + return state; + } + + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/BusinessServiceResponse.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/BusinessServiceResponse.java new file mode 100644 index 00000000000..d2eaa7e105c --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/BusinessServiceResponse.java @@ -0,0 +1,37 @@ +package org.egov.common.contract.workflow; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.response.ResponseInfo; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +@ToString +public class BusinessServiceResponse { + + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo; + + @JsonProperty("BusinessServices") + @Valid + @NotNull + private List businessServices; + + + public BusinessServiceResponse addBusinessServiceItem(BusinessService businessServiceItem) { + if (this.businessServices == null) { + this.businessServices = new ArrayList<>(); + } + this.businessServices.add(businessServiceItem); + return this; + } + + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/ProcessInstance.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/ProcessInstance.java new file mode 100644 index 00000000000..001d881f695 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/ProcessInstance.java @@ -0,0 +1,76 @@ +package org.egov.common.contract.workflow; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.models.Document; +import org.egov.common.contract.request.User; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@EqualsAndHashCode(of = {"id"}) +@ToString +public class ProcessInstance { + + @Size(max = 64) + @JsonProperty("id") + private String id; + + @NotNull + @Size(max = 128) + @JsonProperty("tenantId") + private String tenantId; + + @NotNull + @Size(max = 128) + @JsonProperty("businessService") + private String businessService; + + @NotNull + @Size(max = 128) + @JsonProperty("businessId") + private String businessId; + + @NotNull + @Size(max = 128) + @JsonProperty("action") + private String action; + + @NotNull + @Size(max = 64) + @JsonProperty("moduleName") + private String moduleName; + + @JsonProperty("state") + private State state; + + + @JsonProperty("comment") + private String comment; + + @JsonProperty("documents") + @Valid + private List documents; + + @JsonProperty("assignes") + private List assignes; + + public ProcessInstance addDocumentsItem(Document documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + if (!this.documents.contains(documentsItem)) + this.documents.add(documentsItem); + + return this; + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/ProcessInstanceRequest.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/ProcessInstanceRequest.java new file mode 100644 index 00000000000..da34016e91f --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/ProcessInstanceRequest.java @@ -0,0 +1,36 @@ +package org.egov.common.contract.workflow; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class ProcessInstanceRequest { + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @JsonProperty("ProcessInstances") + @Valid + @NotNull + private List processInstances; + + + public ProcessInstanceRequest addProcessInstanceItem(ProcessInstance processInstanceItem) { + if (this.processInstances == null) { + this.processInstances = new ArrayList<>(); + } + this.processInstances.add(processInstanceItem); + return this; + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/ProcessInstanceResponse.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/ProcessInstanceResponse.java new file mode 100644 index 00000000000..30867bfb03a --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/ProcessInstanceResponse.java @@ -0,0 +1,33 @@ +package org.egov.common.contract.workflow; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.response.ResponseInfo; + +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ProcessInstanceResponse { + @JsonProperty("ResponseInfo") + private ResponseInfo responseInfo; + + @JsonProperty("ProcessInstances") + @Valid + private List processInstances; + + + public ProcessInstanceResponse addProcessInstanceItem(ProcessInstance proceInstanceItem) { + if (this.processInstances == null) { + this.processInstances = new ArrayList<>(); + } + this.processInstances.add(proceInstanceItem); + return this; + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/State.java b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/State.java new file mode 100644 index 00000000000..da9535ec439 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/contract/workflow/State.java @@ -0,0 +1,71 @@ +package org.egov.common.contract.workflow; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.models.AuditDetails; + +import javax.validation.Valid; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +@EqualsAndHashCode(of = {"tenantId", "businessServiceId", "state"}) +public class State { + + @Size(max = 256) + @JsonProperty("uuid") + private String uuid; + + @Size(max = 256) + @JsonProperty("tenantId") + private String tenantId; + + @Size(max = 256) + @JsonProperty("businessServiceId") + private String businessServiceId; + + @JsonProperty("sla") + private Long sla; + + @Size(max = 256) + @JsonProperty("state") + private String state; + + @Size(max = 256) + @JsonProperty("applicationStatus") + private String applicationStatus; + + @JsonProperty("docUploadRequired") + private Boolean docUploadRequired; + + @JsonProperty("isStartState") + private Boolean isStartState; + + @JsonProperty("isTerminateState") + private Boolean isTerminateState; + + @JsonProperty("isStateUpdatable") + private Boolean isStateUpdatable; + + @JsonProperty("actions") + @Valid + private List actions; + + private AuditDetails auditDetails; + + + public State addActionsItem(Action actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList<>(); + } + this.actions.add(actionsItem); + return this; + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/error/ErrorCode.java b/core-services/libraries/services-common/src/main/java/org/egov/common/error/ErrorCode.java new file mode 100644 index 00000000000..e6cf909ec7f --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/error/ErrorCode.java @@ -0,0 +1,17 @@ +package org.egov.common.error; + +public class ErrorCode { + public static final String IS_CREATE_REQUEST_FLAG_NULL_ERROR_MESSAGE = "IsCreateRequest flag being sent to enrichAuditDetails method must not be null"; + + public static final String AUDIT_DETAILS_NULL_ERROR_MESSAGE = "AuditDetails being sent to enrichAuditDetails method must not be null"; + + public static final String REQUEST_INFO_NULL_ERROR_MESSAGE = "RequestInfo being sent to enrichAuditDetails method must not be null"; + + public static final String USER_INFO_NULL_ERROR_MESSAGE = "UserInfo present inside RequestInfo being sent to enrichAuditDetails method must not be null"; + + public static final String USER_UUID_NULL_ERROR_MESSAGE = "User uuid present inside UserInfo being sent to enrichAuditDetails method must not be null"; + + public static final String CREATED_TIME_NULL_ERROR_MESSAGE = "CreatedTime present inside AuditDetails being sent to enrichAuditDetails method must not be null in case of update request"; + + public static final String CREATED_BY_NULL_ERROR_MESSAGE = "CreatedBy present inside AuditDetails being sent to enrichAuditDetails method must not be null in case of update request"; +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/exception/MethodNotFoundException.java b/core-services/libraries/services-common/src/main/java/org/egov/common/exception/MethodNotFoundException.java new file mode 100644 index 00000000000..22e7114a2d2 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/exception/MethodNotFoundException.java @@ -0,0 +1,9 @@ +package org.egov.common.exception; + +public class MethodNotFoundException extends RuntimeException { + + public MethodNotFoundException(String message){ + super(message); + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/exception/NullCheckException.java b/core-services/libraries/services-common/src/main/java/org/egov/common/exception/NullCheckException.java new file mode 100644 index 00000000000..9a6c86f9b99 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/exception/NullCheckException.java @@ -0,0 +1,11 @@ +package org.egov.common.exception; + +public class NullCheckException extends RuntimeException { + + public NullCheckException(String message){ + super(message); + } + + private static final long serialVersionUID = 1L; + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/utils/AuditDetailsEnrichmentUtil.java b/core-services/libraries/services-common/src/main/java/org/egov/common/utils/AuditDetailsEnrichmentUtil.java new file mode 100644 index 00000000000..015f5e73378 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/utils/AuditDetailsEnrichmentUtil.java @@ -0,0 +1,85 @@ +package org.egov.common.utils; + +import org.egov.common.contract.models.AuditDetails; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.exception.NullCheckException; +import org.springframework.util.ObjectUtils; + +import static org.egov.common.error.ErrorCode.*; + +public class AuditDetailsEnrichmentUtil { + + private AuditDetailsEnrichmentUtil(){}; + + /** + * This is a utility method to enrich auditDetails so that modules don't have to write logic to + * enrich auditDetails in case of create and update requests. + * @param auditDetails + * @param requestInfo + * @param isCreateRequest + */ + public static AuditDetails prepareAuditDetails(AuditDetails auditDetails, RequestInfo requestInfo, Boolean isCreateRequest) { + // This method validates if auditDetails, requestInfo and userInfo are not null. + validateInput(auditDetails, requestInfo, isCreateRequest); + + // Check if isCreateRequest flag is true - in this case, enrich createdTime and createdBy fields. + if(isCreateRequest){ + auditDetails = AuditDetails.builder().build(); + auditDetails.setCreatedTime(System.currentTimeMillis()); + auditDetails.setCreatedBy(requestInfo.getUserInfo().getUuid()); + } + + // Update lastModifiedBy and lastModifiedTime fields for both create and update requests. + auditDetails.setLastModifiedTime(System.currentTimeMillis()); + auditDetails.setLastModifiedBy(requestInfo.getUserInfo().getUuid()); + + // Check if isCreateRequest flag is true - in this case, enrich createdTime and createdBy fields. + if(isCreateRequest){ + auditDetails.setCreatedTime(System.currentTimeMillis()); + auditDetails.setCreatedBy(requestInfo.getUserInfo().getUuid()); + } + + return auditDetails; + } + + /** + * This method validates the input fed to enrichAuditDetails method + * @param auditDetails + * @param requestInfo + * @param isCreateRequest + */ + private static void validateInput(AuditDetails auditDetails, RequestInfo requestInfo, Boolean isCreateRequest) { + // Throw null check exception in case isCreateRequest flag is null. + if(ObjectUtils.isEmpty(isCreateRequest)) + throw new NullCheckException(IS_CREATE_REQUEST_FLAG_NULL_ERROR_MESSAGE); + + // Throw null check exception in case requestInfo is null. + if(ObjectUtils.isEmpty(requestInfo)) + throw new NullCheckException(REQUEST_INFO_NULL_ERROR_MESSAGE); + + // Throw null check exception in case userInfo within requestInfo is null. + if(ObjectUtils.isEmpty(requestInfo.getUserInfo())) + throw new NullCheckException(USER_INFO_NULL_ERROR_MESSAGE); + + // Throw null check exception in case userInfo within requestInfo is null. + if(ObjectUtils.isEmpty(requestInfo.getUserInfo().getUuid())) + throw new NullCheckException(USER_UUID_NULL_ERROR_MESSAGE); + + // Check whether createdBy and createdTime fields are set within auditDetails in case of update request. + if(!isCreateRequest) { + // Throw null check exception in case auditDetails is null. + if(ObjectUtils.isEmpty(auditDetails)) + throw new NullCheckException(AUDIT_DETAILS_NULL_ERROR_MESSAGE); + + // Throw null check exception in case createdBy within auditDetails is null + if (ObjectUtils.isEmpty(auditDetails.getCreatedBy())) + throw new NullCheckException(CREATED_BY_NULL_ERROR_MESSAGE); + + // Throw null check exception in case createdTime within auditDetails is null + if (ObjectUtils.isEmpty(auditDetails.getCreatedTime())) + throw new NullCheckException(CREATED_TIME_NULL_ERROR_MESSAGE); + } + + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/utils/ResponseInfoUtil.java b/core-services/libraries/services-common/src/main/java/org/egov/common/utils/ResponseInfoUtil.java new file mode 100644 index 00000000000..e746fa7c79a --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/utils/ResponseInfoUtil.java @@ -0,0 +1,25 @@ +package org.egov.common.utils; + +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; + +import static org.egov.common.constants.ServiceCommonConstants.*; + +public class ResponseInfoUtil { + + public static ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { + + final String apiId = requestInfo != null ? requestInfo.getApiId() : EMPTY_STRING; + final String ver = requestInfo != null ? requestInfo.getVer() : EMPTY_STRING; + Long ts = null; + if(requestInfo != null) + ts = requestInfo.getTs(); + final String resMsgId = RES_MESSAGE_ID; + final String msgId = requestInfo != null ? requestInfo.getMsgId() : EMPTY_STRING; + final String responseStatus = success ? SUCCESSFUL_STATUS : FAILED_STATUS; + + return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) + .status(responseStatus).build(); + } + +} diff --git a/core-services/libraries/services-common/src/main/java/org/egov/common/utils/UUIDEnrichmentUtil.java b/core-services/libraries/services-common/src/main/java/org/egov/common/utils/UUIDEnrichmentUtil.java new file mode 100644 index 00000000000..04239791344 --- /dev/null +++ b/core-services/libraries/services-common/src/main/java/org/egov/common/utils/UUIDEnrichmentUtil.java @@ -0,0 +1,82 @@ +package org.egov.common.utils; + +import org.egov.common.exception.MethodNotFoundException; +import org.springframework.util.ReflectionUtils; + +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.stream.IntStream; + +import static org.egov.common.constants.ServiceCommonConstants.SET_KEYWORD; + +public class UUIDEnrichmentUtil { + + private UUIDEnrichmentUtil(){} + + /** + * This method accepts an object of generic type and the field to be enriched. + * If the parent object passed is an instance of List, each of the child objects + * are enriched with random UUIDs. However, if the passed parent object is non-collection + * type, the target field passed is enriched with UUID. + * + * @param obj + * @param field + * @param + */ + public static void enrichRandomUuid(T obj, String field) { + Class objClass = getObjClass(obj); + Method setIdMethod = getMethod(getSetterMethodName(field), objClass); + + if (obj instanceof List) { + IntStream.range(0, ((List) obj).size()) + .forEach(i -> { + ReflectionUtils.invokeMethod(setIdMethod, ((List) obj).get(i), UUID.randomUUID().toString()); + }); + } else { + ReflectionUtils.invokeMethod(setIdMethod, obj, UUID.randomUUID().toString()); + } + } + + /** + * This method accepts an object and returns the + * class the parameter object belongs to + * @param obj + * @param + * @return + */ + private static Class getObjClass(T obj) { + if(obj instanceof List){ + return ((List) obj).stream().findAny().get().getClass(); + }else{ + return obj.getClass(); + } + } + + /** + * This method returns the invokable method from the class + * based on the methodName passed to it + * @param methodName + * @param clazz + * @return + */ + private static Method getMethod(String methodName, Class clazz) { + return Arrays.stream(clazz.getDeclaredMethods()) + .filter(m -> m.getName().equals(methodName)) + .findFirst().orElseThrow(() -> new MethodNotFoundException("Method " + methodName + " not found in class " + clazz.getName())); // Change this + } + + /** + * This method generates and returns the setter method name for the + * field being passed to it + * @param field + * @return + */ + private static String getSetterMethodName(String field) { + return new StringBuilder(SET_KEYWORD) + .append(field.substring(0, 1).toUpperCase()) + .append(field.substring(1)) + .toString(); + } +} diff --git a/core-services/libraries/services-common/src/test/java/org/egov/common/utils/MultiStateInstanceUtilTest.java b/core-services/libraries/services-common/src/test/java/org/egov/common/utils/MultiStateInstanceUtilTest.java index 51754289c44..1e38164bcfd 100644 --- a/core-services/libraries/services-common/src/test/java/org/egov/common/utils/MultiStateInstanceUtilTest.java +++ b/core-services/libraries/services-common/src/test/java/org/egov/common/utils/MultiStateInstanceUtilTest.java @@ -4,7 +4,7 @@ import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class MultiStateInstanceUtilTest { diff --git a/core-services/libraries/tracer/CHANGELOG.md b/core-services/libraries/tracer/CHANGELOG.md index 77823ad3ac9..94b19eb2aba 100644 --- a/core-services/libraries/tracer/CHANGELOG.md +++ b/core-services/libraries/tracer/CHANGELOG.md @@ -1,3 +1,9 @@ +# Changelog +All notable changes to this library will be documented in this file. + +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.6.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 ## 2.1.3 - Removed critical vulnerabilities library diff --git a/core-services/libraries/tracer/Dockerfile b/core-services/libraries/tracer/Dockerfile index cd50dd4120d..809c16d1e84 100644 --- a/core-services/libraries/tracer/Dockerfile +++ b/core-services/libraries/tracer/Dockerfile @@ -1,8 +1,12 @@ -FROM egovio/alpine-maven-builder-jdk-8:1-master-NA-6036091e AS build +FROM egovio/amazoncorretto:17-alpine3.19 AS build ARG WORK_DIR ARG nexusUsername ARG nexusPassword WORKDIR /app + +# Install Maven +RUN apk add --no-cache maven + # copy the project files COPY ${WORK_DIR}/pom.xml ./pom.xml COPY ${WORK_DIR}/settings.xml ./settings.xml diff --git a/core-services/libraries/tracer/pom.xml b/core-services/libraries/tracer/pom.xml index fb55c9f71b8..3b541e905e8 100644 --- a/core-services/libraries/tracer/pom.xml +++ b/core-services/libraries/tracer/pom.xml @@ -6,15 +6,15 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE + 3.2.2 org.egov.services tracer - 2.1.3-SNAPSHOT + 2.9.0-SNAPSHOT tracer Assist in tracing http and message queue flows - + repo.digit.org eGov ERP Snapshots Repository https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ @@ -23,15 +23,10 @@ 2.17.1 UTF-8 - 1.8 + 17 UTF-8 - - org.springframework - spring-beans - 5.2.20.RELEASE - org.springframework.boot spring-boot-starter-web @@ -47,19 +42,8 @@ org.projectlombok lombok - 1.18.24 true - - commons-io - commons-io - 2.5 - - - org.egov.services - services-common - 1.1.1-SNAPSHOT - com.jayway.jsonpath json-path @@ -72,7 +56,7 @@ org.springframework.boot spring-boot-starter-actuator - + io.jaegertracing jaeger-client @@ -107,47 +91,33 @@ test - com.github.stefanbirkner - system-rules - 1.16.1 - test + jakarta.servlet + jakarta.servlet-api + 5.0.0 + + + org.egov.services + services-common + 2.9.0-SNAPSHOT - - - repo.egovernments.org.public - eGov Public Repository Group - https://nexus-repo.egovernments.org/nexus/content/groups/public/ - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - repo.egovernments.org.snapshots - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - repo.digit.org - eGov DIGIT Releases Repository - https://nexus-repo.digit.org/nexus/content/repositories/release/ - - - + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + - maven-source-plugin - - - attach-sources - - jar - - - + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + 17 + - + \ No newline at end of file diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/ExceptionAdvise.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/ExceptionAdvise.java index b84f959c65a..f1161e53da0 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/ExceptionAdvise.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/ExceptionAdvise.java @@ -5,13 +5,13 @@ import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.io.IOUtils; import org.egov.tracer.config.TracerProperties; import org.egov.tracer.http.filters.MultiReadRequestWrapper; import org.egov.tracer.kafka.ErrorQueueProducer; -import org.egov.tracer.model.Error; import org.egov.tracer.model.*; +import org.egov.tracer.model.Error; import org.slf4j.MDC; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -20,6 +20,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.util.ObjectUtils; import org.springframework.validation.BindException; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; @@ -31,16 +32,17 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.client.ResourceAccessException; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; +import java.nio.charset.StandardCharsets; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.egov.tracer.constants.TracerConstants.CORRELATION_ID_MDC; +import static org.egov.tracer.constants.TracerConstants.*; @ControllerAdvice @@ -70,7 +72,8 @@ public ResponseEntity exceptionHandler(HttpServletRequest request, Exception try { if (request instanceof MultiReadRequestWrapper) { ServletInputStream stream = request.getInputStream(); - body = IOUtils.toString(stream, "UTF-8"); + //body = IOUtils.toString(stream, "UTF-8"); + body = new String(stream.readAllBytes(), StandardCharsets.UTF_8); } else body = "Unable to retrieve request body"; @@ -138,6 +141,8 @@ public ResponseEntity exceptionHandler(HttpServletRequest request, Exception } else if (ex instanceof ServiceCallException) { ServiceCallException serviceCallException = (ServiceCallException) ex; sendErrorMessage(body, ex, request.getRequestURL().toString(), errorRes, isJsonContentType); + if(tracerProperties.isShouldPublishErrorDetailsFlag()) + prepareErrorDetailsAndInvokeExceptionHandler(request, ex); DocumentContext documentContext = JsonPath.parse(serviceCallException.getError()); LinkedHashMap linkedHashMap = documentContext.json(); return new ResponseEntity<>(linkedHashMap, HttpStatus.BAD_REQUEST); @@ -166,6 +171,8 @@ public ResponseEntity exceptionHandler(HttpServletRequest request, Exception if (errorRes.getErrors() == null || errorRes.getErrors().size() == 0) { errorRes.setErrors(new ArrayList<>(Collections.singletonList(new Error(exceptionName, "An unhandled exception occurred on the server", exceptionMessage, null)))); + if(tracerProperties.isShouldPublishErrorDetailsFlag()) + prepareErrorDetailsAndInvokeExceptionHandler(request, ex); } else if (provideExceptionInDetails && errorRes.getErrors() != null && errorRes.getErrors().size() > 0) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); @@ -180,6 +187,102 @@ public ResponseEntity exceptionHandler(HttpServletRequest request, Exception return new ResponseEntity<>(errorRes, HttpStatus.BAD_REQUEST); } + /** + * This method is an overloaded sister method of error handling interceptor method + * to enable modules to invoke it based on the error details they have prepared + * to allow them to store these errors and retry them. + * + * @param errorDetails + */ + public void exceptionHandler(List errorDetails) { + + // Log incoming errors + errorDetails.forEach(errorDetail -> { + errorDetail.getErrors().forEach(errorEntity -> { + Exception ex = errorEntity.getException(); + log.error(EXCEPTION_CAUGHT_IN_TRACER_MSG, ex); + }); + }); + + // Initialize error details list for indexing + List errorDetailsForIndexing = new ArrayList<>(); + + // Prepare audit details + AuditDetails auditDetails = AuditDetails.builder().createdTime(System.currentTimeMillis()).lastModifiedTime(System.currentTimeMillis()).build(); + + // Enrich error uuid and audit details for indexing error details + errorDetails.forEach(errorDetail -> { + // Initialize error details + ErrorDetailDTO errorDetailDTO = new ErrorDetailDTO(); + BeanUtils.copyProperties(errorDetail, errorDetailDTO); + + // Initialize values for error detail + errorDetailDTO.setAuditDetails(auditDetails); + errorDetailDTO.setStatus(Status.PENDING); + + // Set uuid and retry count only if errorDetail does not have an id + if(ObjectUtils.isEmpty(errorDetailDTO.getApiDetails().getId())) { + errorDetailDTO.setUuid(UUID.randomUUID().toString()); + errorDetailDTO.setRetryCount(0); + }else{ + errorDetailDTO.setUuid(errorDetailDTO.getApiDetails().getId()); + } + + errorDetailsForIndexing.add(errorDetailDTO); + }); + + // Send error details for indexing + errorQueueProducer.sendErrorDetails(errorDetailsForIndexing); + + } + + + /** + * This method prepares error details in case of unhandled exceptions caught by tracer interceptor + * and invokes its sister exceptionHandler method to store it for retry. + * @param request + * @param ex + */ + private void prepareErrorDetailsAndInvokeExceptionHandler(HttpServletRequest request, Exception ex) { + String contentType = request.getContentType(); + String body = ""; + + // Block to parse incoming request for which exception was thrown + try { + if (request instanceof MultiReadRequestWrapper) { + ServletInputStream stream = request.getInputStream(); + // body = IOUtils.toString(stream, UTF_8_CODE); + body = new String(stream.readAllBytes(), StandardCharsets.UTF_8); + } else + body = UNABLE_TO_RETRIEVE_REQUEST_BODY_MSG; + + } catch (IOException ignored) { + body = UNABLE_TO_RETRIEVE_REQUEST_BODY_MSG; + } + + // Prepare API Details + ApiDetails apiDetails = new ApiDetails(); + apiDetails.setRequestBody(body); + apiDetails.setContentType(contentType); + apiDetails.setUrl(request.getRequestURL().toString()); + + // Prepare error entity + ErrorEntity errorEntity = new ErrorEntity(); + errorEntity.setErrorType(ErrorType.RECOVERABLE); + errorEntity.setErrorMessage(ex.getMessage()); + errorEntity.setErrorCode(UNHANDLED_EXCEPTION_ERROR_CODE); + errorEntity.setException(ex); + + // Prepare error detail + ErrorDetail errorDetail = new ErrorDetail(); + errorDetail.setApiDetails(apiDetails); + errorDetail.setErrors(Collections.singletonList(errorEntity)); + + // Call exceptionHandler method to persist unhandled errors + exceptionHandler(Collections.singletonList(errorDetail)); + } + + private List getBindingErrors(BindingResult bindingResult, List errors) { List objectErrors = bindingResult.getAllErrors(); @@ -213,6 +316,37 @@ private void populateCustomErrors(CustomException customException, List e } + void sendErrorMessage(String body, Exception ex, String source, boolean isJsonContentType) { + DocumentContext documentContext; + + if (tracerProperties.isErrorsPublish()) { + Object requestBody = body; + if (isJsonContentType) { + try { + documentContext = JsonPath.parse(body); + requestBody = documentContext.json(); + } catch (Exception exception) { + requestBody = body; + } + } + + StackTraceElement elements[] = ex.getStackTrace(); + + ErrorQueueContract errorQueueContract = ErrorQueueContract.builder() + .id(UUID.randomUUID().toString()) + .correlationId(MDC.get(CORRELATION_ID_MDC)) + .body(requestBody) + .source(source) + .ts(new Date().getTime()) + .exception(Arrays.asList(elements)) + .message(ex.getMessage()) + .build(); + + errorQueueProducer.sendMessage(errorQueueContract); + } + + } + void sendErrorMessage(String body, Exception ex, String source, ErrorRes errorRes, boolean isJsonContentType) { DocumentContext documentContext; diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/KafkaConsumerErrorHandler.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/KafkaConsumerErrorHandler.java index 431231266aa..8ab723e1c05 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/KafkaConsumerErrorHandler.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/KafkaConsumerErrorHandler.java @@ -2,16 +2,20 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; +import org.apache.kafka.clients.consumer.Consumer; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.kafka.listener.LoggingErrorHandler; +import org.springframework.kafka.listener.DefaultErrorHandler; +import org.springframework.kafka.listener.MessageListenerContainer; import org.springframework.stereotype.Component; import org.springframework.util.ObjectUtils; +import java.util.List; + @Component @Slf4j -public class KafkaConsumerErrorHandler extends LoggingErrorHandler { +public class KafkaConsumerErrorHandler extends DefaultErrorHandler { @Autowired private ExceptionAdvise exceptionAdvise; @@ -20,17 +24,20 @@ public class KafkaConsumerErrorHandler extends LoggingErrorHandler { private boolean sendErrorsToKafka; @Override - public void handle(Exception thrownException, ConsumerRecord record) { + public void handleRemaining (Exception thrownException, List> records, + Consumer consumer, MessageListenerContainer container) { if (sendErrorsToKafka) { - log.error("Error while processing1: " + ObjectUtils.nullSafeToString(record), thrownException); - ObjectMapper objectMapper = new ObjectMapper(); - String body = null; - try { - body = objectMapper.writeValueAsString(record.value()); - } catch (Exception ex) { - log.error("KafkaConsumerErrorHandller Kafka consumer can not parse json data " + ex.getMessage()); - } - exceptionAdvise.sendErrorMessage(body, thrownException, record.topic(), null, false); + records.forEach(record -> { + log.error("Error while processing1: " + ObjectUtils.nullSafeToString(record), thrownException); + ObjectMapper objectMapper = new ObjectMapper(); + String body = null; + try { + body = objectMapper.writeValueAsString(record.value()); + } catch (Exception ex) { + log.error("KafkaConsumerErrorHandller Kafka consumer can not parse json data " + ex.getMessage()); + } + exceptionAdvise.sendErrorMessage(body, thrownException, record.topic(), false); + }); } } } diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/OpenTracingConfiguration.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/OpenTracingConfiguration.java index 9194b1faabb..64d898bf144 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/OpenTracingConfiguration.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/OpenTracingConfiguration.java @@ -1,3 +1,4 @@ +/* package org.egov.tracer.config; import io.opentracing.Span; @@ -10,10 +11,10 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.List; @@ -23,7 +24,7 @@ @Configuration @ConditionalOnWebApplication @AutoConfigureAfter({TracerAutoConfiguration.class}) -@ConditionalOnClass({WebMvcConfigurerAdapter.class}) +@ConditionalOnClass({WebMvcConfigurer.class}) @ConditionalOnProperty( name = {"tracer.opentracing.enabled"}, havingValue = "true", @@ -31,24 +32,28 @@ ) public class OpenTracingConfiguration { - /** + */ +/** * Jaeger Tracer instance configured via environment variables * * @return Tracer implementation - */ + *//* + @Bean public io.opentracing.Tracer jaegerTracer() { return io.jaegertracing.Configuration.fromEnv() .getTracer(); } - /** + */ +/** * Use span decorator to add a correlation id span tag *

* Filter order configured to run after Tracer Filter * * @return span decorators - */ + *//* + @Bean public List spanDecorator() { List decorators = new ArrayList<>(); @@ -79,3 +84,4 @@ public void onTimeout(HttpServletRequest httpServletRequest, HttpServletResponse } } +*/ diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/TracerConfiguration.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/TracerConfiguration.java index 28266bd8079..d547354d6dc 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/TracerConfiguration.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/TracerConfiguration.java @@ -19,7 +19,7 @@ @ComponentScan(basePackages = {"org.egov.tracer"}) @PropertySource("classpath:tracer.properties") @EnableConfigurationProperties({TracerProperties.class}) -@Import(OpenTracingConfiguration.class) +//@Import(OpenTracingConfiguration.class) public class TracerConfiguration { @Bean diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/TracerProperties.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/TracerProperties.java index 3d8cb4b5ff9..bce68831410 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/TracerProperties.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/config/TracerProperties.java @@ -24,8 +24,14 @@ public class TracerProperties { // Topic to which errors need to be published private String errorsTopic; + // Topic to which error details need to be published + private String errorDetailsTopic; + // Exclusion list for tracer filter private String filterSkipPattern; + // Flag to enable exceptions caught on tracer interceptor to be persisted on ElasticSearch. + private boolean shouldPublishErrorDetailsFlag; + } diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/constants/TracerConstants.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/constants/TracerConstants.java index 7d312fabb19..a5ca257e42c 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/constants/TracerConstants.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/constants/TracerConstants.java @@ -11,6 +11,10 @@ public class TracerConstants { public static final String TIME_ZONE_PROPERTY = "app.timezone"; public static final String REQUEST_INFO_FIELD_NAME_IN_JAVA_CLASS_CASE = "RequestInfo"; public static final String REQUEST_INFO_IN_CAMEL_CASE = "requestInfo"; + public static final String UNHANDLED_EXCEPTION_ERROR_CODE = "UNHANDLED_EXCEPTION_ERROR"; + public static final String UNABLE_TO_RETRIEVE_REQUEST_BODY_MSG = "Unable to retrieve request body"; + public static final String UTF_8_CODE = "UTF-8"; + public static final String EXCEPTION_CAUGHT_IN_TRACER_MSG = "Exception caught in tracer "; private TracerConstants() { } diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/RestTemplateLoggingInterceptor.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/RestTemplateLoggingInterceptor.java index b32a85cf28a..266aba51256 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/RestTemplateLoggingInterceptor.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/RestTemplateLoggingInterceptor.java @@ -6,10 +6,11 @@ import static org.egov.tracer.constants.TracerConstants.TENANT_ID_HEADER; import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; -import org.apache.commons.io.IOUtils; import org.egov.tracer.config.TracerProperties; import org.slf4j.MDC; import org.springframework.http.HttpMessage; @@ -110,7 +111,9 @@ private boolean isBodyCompatibleForParsing(HttpMessage httpMessage) { private String getBodyString(ClientHttpResponse response) { try { if (response != null && response.getBody() != null) { - return IOUtils.toString(response.getBody(), UTF_8); + InputStream bodyStream = response.getBody(); + return new String(bodyStream.readAllBytes(), StandardCharsets.UTF_8); + //return IOUtils.toString(response.getBody(), UTF_8); } else { return EMPTY_BODY; } diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/filters/MultiReadRequestWrapper.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/filters/MultiReadRequestWrapper.java index a476f2f7515..859d097a213 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/filters/MultiReadRequestWrapper.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/filters/MultiReadRequestWrapper.java @@ -1,12 +1,11 @@ package org.egov.tracer.http.filters; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.io.IOUtils; -import javax.servlet.ReadListener; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; +import jakarta.servlet.ReadListener; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import java.io.*; @Slf4j @@ -47,7 +46,8 @@ public BufferedReader getReader() throws IOException { private void cacheInputStream() throws IOException { cachedBytes = new ByteArrayOutputStream(); - IOUtils.copy(super.getInputStream(), cachedBytes); + //IOUtils.copy(super.getInputStream(), cachedBytes); + super.getInputStream().transferTo(cachedBytes); } public class CachedServletInputStream extends ServletInputStream { diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/filters/TracerFilter.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/filters/TracerFilter.java index b3052dc0d4c..f97f99b1788 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/filters/TracerFilter.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/http/filters/TracerFilter.java @@ -8,9 +8,10 @@ import static org.egov.tracer.constants.TracerConstants.REQUEST_INFO_IN_CAMEL_CASE; import static org.egov.tracer.constants.TracerConstants.TENANTID_MDC; import static org.egov.tracer.constants.TracerConstants.TENANT_ID_HEADER; -import static org.springframework.util.StringUtils.isEmpty; +import static org.springframework.util.ObjectUtils.isEmpty; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -18,16 +19,10 @@ import java.util.UUID; import java.util.regex.Pattern; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; -import org.apache.commons.io.IOUtils; import org.egov.tracer.config.ObjectMapperFactory; import org.egov.tracer.config.TracerProperties; import org.slf4j.MDC; @@ -41,7 +36,7 @@ public class TracerFilter implements Filter { private static final List JSON_MEDIA_TYPES = - Arrays.asList(MediaType.APPLICATION_JSON_UTF8_VALUE, MediaType.APPLICATION_JSON_VALUE); + Arrays.asList(MediaType.APPLICATION_JSON_VALUE); private static final String POST = "POST"; private static final String REQUEST_BODY_LOG_MESSAGE = "Request body - {}"; private static final String FAILED_TO_LOG_REQUEST_MESSAGE = "Failed to log request body"; @@ -158,7 +153,9 @@ private boolean isBodyCompatibleForParsing(HttpServletRequest httpRequest) { private void logRequestBodyAndParams(HttpServletRequest requestWrapper) { try { - final String requestBody = IOUtils.toString(requestWrapper.getInputStream(), UTF_8); + //final String requestBody = IOUtils.toString(requestWrapper.getInputStream(), UTF_8); + final ServletInputStream inputStream = requestWrapper.getInputStream(); + String requestBody = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); String requestParams = requestWrapper.getQueryString(); if (!isEmpty(requestParams)) diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/kafka/DeadLetterQueueConfiguration.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/kafka/DeadLetterQueueConfiguration.java new file mode 100644 index 00000000000..d3016bc79a1 --- /dev/null +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/kafka/DeadLetterQueueConfiguration.java @@ -0,0 +1,38 @@ +/* +package org.egov.tracer.kafka; + +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.common.TopicPartition; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.kafka.core.KafkaOperations; +import org.springframework.kafka.listener.DeadLetterPublishingRecoverer; +import org.springframework.kafka.listener.DefaultErrorHandler; + +import java.util.function.BiFunction; + +@Configuration +public class DeadLetterQueueConfiguration { + + + + @Bean + @ConditionalOnProperty(name = "tracer.errorsPublish", havingValue = "true") + public DeadLetterPublishingRecoverer deadLetterPublishingRecoverer(KafkaOperations kafkaTemplate) { + BiFunction, Exception, TopicPartition> destinationResolver = (cr, e) -> + new TopicPartition(cr.topic() + ".dlt", cr.partition()); + + return new DeadLetterPublishingRecoverer(kafkaTemplate, destinationResolver); + } + + @Bean + @ConditionalOnProperty(name = "tracer.errorsPublish", havingValue = "true") + public DefaultErrorHandler errorHandler(DeadLetterPublishingRecoverer recoverer) { + return new DefaultErrorHandler(recoverer); + } + + + +} +*/ diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/kafka/ErrorQueueProducer.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/kafka/ErrorQueueProducer.java index f1feab4d774..d8e4f473cfc 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/kafka/ErrorQueueProducer.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/kafka/ErrorQueueProducer.java @@ -5,11 +5,14 @@ import org.apache.kafka.common.errors.SerializationException; import org.egov.tracer.config.ObjectMapperFactory; import org.egov.tracer.config.TracerProperties; +import org.egov.tracer.model.ErrorDetailDTO; import org.egov.tracer.model.ErrorQueueContract; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Component; +import java.util.List; + @Component @Slf4j public class ErrorQueueProducer { @@ -25,6 +28,7 @@ public class ErrorQueueProducer { public void sendMessage(ErrorQueueContract errorQueueContract) { try { + log.info("Sending message to topic - " + tracerProperties.getErrorsTopic()); kafkaTemplate.send(tracerProperties.getErrorsTopic(), errorQueueContract); } catch (SerializationException serializationException) { log.info("SerializationException exception occurred while sending exception to error queue"); @@ -39,4 +43,20 @@ public void sendMessage(ErrorQueueContract errorQueueContract) { } } + public void sendErrorDetails(List errorDetailList) { + try { + log.info("Sending message to topic - " + "error-details-indexer-topic"); + kafkaTemplate.send(tracerProperties.getErrorDetailsTopic(), errorDetailList); + } catch (SerializationException serializationException) { + log.info("SerializationException exception occurred while sending exception to error queue"); + try { + kafkaTemplate.send(tracerProperties.getErrorDetailsTopic(), objectMapperFactory.getObjectMapper().writeValueAsString(errorDetailList)); + } catch (JsonProcessingException e) { + log.info("exception occurred while converting error details to json string"); + } + } catch (Exception ex) { + log.error("exception occurred while sending exception to error queue"); + } + } + } diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ApiDetails.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ApiDetails.java new file mode 100644 index 00000000000..4a6205f77d2 --- /dev/null +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ApiDetails.java @@ -0,0 +1,35 @@ +package org.egov.tracer.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.Map; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ApiDetails { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("url") + private String url = null; + + @JsonProperty("contentType") + private String contentType = null; + + @JsonProperty("methodType") + private String methodType = null; + + @JsonProperty("requestBody") + private String requestBody = null; + + @JsonProperty("requestHeaders") + private Map requestHeaders = null; + + @JsonProperty("additionalDetails") + private Object additionalDetails = null; + +} diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/AuditDetails.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/AuditDetails.java new file mode 100644 index 00000000000..0488946e374 --- /dev/null +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/AuditDetails.java @@ -0,0 +1,25 @@ +package org.egov.tracer.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class AuditDetails { + @JsonProperty("createdBy") + private String createdBy = null; + + @JsonProperty("lastModifiedBy") + private String lastModifiedBy = null; + + @JsonProperty("createdTime") + private Long createdTime = null; + + @JsonProperty("lastModifiedTime") + private Long lastModifiedTime = null; + + +} diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/Error.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/Error.java index 62a6f5bb39b..6a902aa9d7f 100644 --- a/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/Error.java +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/Error.java @@ -16,6 +16,12 @@ @AllArgsConstructor @ToString public class Error { + @JsonProperty("id") + private String id = null; + + @JsonProperty("parentId") + private String parentId = null; + @JsonProperty("code") private String code = null; @@ -28,4 +34,11 @@ public class Error { @JsonProperty("params") private List params = null; + public Error(String id, String code, String message, String description){ + this.id = id; + this.code = code; + this.message = message; + this.description = description; + } + } diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorDetail.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorDetail.java new file mode 100644 index 00000000000..68acfca84ec --- /dev/null +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorDetail.java @@ -0,0 +1,20 @@ +package org.egov.tracer.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ErrorDetail { + + @JsonProperty("apiDetails") + private ApiDetails apiDetails = null; + + @JsonProperty("errors") + private List errors = null; + +} diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorDetailDTO.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorDetailDTO.java new file mode 100644 index 00000000000..9db1dd41957 --- /dev/null +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorDetailDTO.java @@ -0,0 +1,17 @@ +package org.egov.tracer.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +@Setter +@Getter +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class ErrorDetailDTO extends ErrorDetail{ + private String uuid; + private AuditDetails auditDetails; + private Integer retryCount; + private Status status; + +} diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorEntity.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorEntity.java new file mode 100644 index 00000000000..5bafe9b07ac --- /dev/null +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorEntity.java @@ -0,0 +1,25 @@ +package org.egov.tracer.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ErrorEntity { + @JsonProperty("exception") + private Exception exception = null; + + @JsonProperty("type") + private ErrorType errorType = null; + + @JsonProperty("errorCode") + private String errorCode = null; + + @JsonProperty("errorMessage") + private String errorMessage = null; + + @JsonProperty("additionalDetails") + private Object additionalDetails = null; +} diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorType.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorType.java new file mode 100644 index 00000000000..ec0c9052111 --- /dev/null +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/ErrorType.java @@ -0,0 +1,33 @@ +package org.egov.tracer.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ErrorType { + + RECOVERABLE("RECOVERABLE"), + + NON_RECOVERABLE("NON_RECOVERABLE"); + + private String value; + + ErrorType(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ErrorType fromValue(String text) { + for (ErrorType b : ErrorType.values()) { + if (String.valueOf(b.value).equalsIgnoreCase(text)) { + return b; + } + } + return null; + } +} diff --git a/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/Status.java b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/Status.java new file mode 100644 index 00000000000..d3f11ac2ea8 --- /dev/null +++ b/core-services/libraries/tracer/src/main/java/org/egov/tracer/model/Status.java @@ -0,0 +1,34 @@ +package org.egov.tracer.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public enum Status { + SUCCESS("SUCCESS"), + + FAILED("FAILED"), + + PENDING("PENDING"); + + private String value; + + Status(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static Status fromValue(String text) { + for (Status b : Status.values()) { + if (String.valueOf(b.value).equalsIgnoreCase(text)) { + return b; + } + } + return null; + } +} diff --git a/core-services/libraries/tracer/src/main/resources/tracer.properties b/core-services/libraries/tracer/src/main/resources/tracer.properties index af6055f7d98..84a88389fea 100644 --- a/core-services/libraries/tracer/src/main/resources/tracer.properties +++ b/core-services/libraries/tracer/src/main/resources/tracer.properties @@ -6,6 +6,8 @@ tracer.kafkaMessageLoggingEnabled=false tracer.restTemplateDetailedLoggingEnabled=false tracer.errorsPublish=false tracer.errorsTopic=egov-error +tracer.errorDetailsTopic=error-details-indexer-topic +tracer.errorDetailsPublishFlag=false tracer.filterSkipPattern=/api-docs.*|/autoconfig|/configprops|/dump|/health|/info|/metrics\ .*|/mappings|/swagger.*|.*\.png|.*\.css|.*\.js|.*\.html|/favicon.ico|/hystrix.stream|/prometheus|/manage/* diff --git a/core-services/libraries/tracer/src/test/java/org/egov/ObjectMapperTest.java b/core-services/libraries/tracer/src/test/java/org/egov/ObjectMapperTest.java index 3e926bd67e7..67d7a2929a9 100644 --- a/core-services/libraries/tracer/src/test/java/org/egov/ObjectMapperTest.java +++ b/core-services/libraries/tracer/src/test/java/org/egov/ObjectMapperTest.java @@ -1,3 +1,4 @@ +/* package org.egov; import com.fasterxml.jackson.databind.ObjectMapper; @@ -56,3 +57,4 @@ private class SubFoo { } } +*/ diff --git a/core-services/libraries/tracer/src/test/java/org/egov/Resources.java b/core-services/libraries/tracer/src/test/java/org/egov/Resources.java index f838c49af2b..69cd1b8ea53 100644 --- a/core-services/libraries/tracer/src/test/java/org/egov/Resources.java +++ b/core-services/libraries/tracer/src/test/java/org/egov/Resources.java @@ -1,15 +1,23 @@ package org.egov; -import org.apache.commons.io.IOUtils; - import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; public class Resources { public String getFileContents(String fileName) { try { - return IOUtils.toString(this.getClass().getClassLoader() + /*return IOUtils.toString(this.getClass().getClassLoader() .getResourceAsStream(fileName), "UTF-8") - .replace(" ", "").replace("\n", ""); + .replace(" ", "").replace("\n", "");*/ + String content; + try (InputStream stream = this.getClass().getClassLoader().getResourceAsStream(fileName)) { + if (stream == null) { + throw new IllegalArgumentException("File not found: " + fileName); + } + content = new String(stream.readAllBytes(), StandardCharsets.UTF_8); + } + return content.replace(" ", "").replace("\n", ""); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/core-services/libraries/tracer/src/test/java/org/egov/tracer/kafka/KafkaListenerLoggingAspectTest.java b/core-services/libraries/tracer/src/test/java/org/egov/tracer/kafka/KafkaListenerLoggingAspectTest.java index 18dbee304e1..86efdf2fca7 100644 --- a/core-services/libraries/tracer/src/test/java/org/egov/tracer/kafka/KafkaListenerLoggingAspectTest.java +++ b/core-services/libraries/tracer/src/test/java/org/egov/tracer/kafka/KafkaListenerLoggingAspectTest.java @@ -1,3 +1,4 @@ +/* package org.egov.tracer.kafka; import org.egov.tracer.config.TracerConfiguration; @@ -244,3 +245,4 @@ public void bar(@Payload String payload, @Header(KafkaHeaders.RECEIVED_PARTITION } } +*/ diff --git a/core-services/service-request/CHANGELOG.md b/core-services/service-request/CHANGELOG.md new file mode 100644 index 00000000000..0ce8c31af4d --- /dev/null +++ b/core-services/service-request/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog +All notable changes to this module will be documented in this file. + +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.6.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded postgresql version from 42.2.2.jre7 to 42.7.1 +- Upgraded org.flywaydb:flyway-core version to 9.22.3 +- Upgraded org.egov.services:tracer version from 2.1.2-SNAPSHOT to 2.9.0-SNAPSHOT +- Upgraded org.egov:mdms-client from 0.0.2-SNAPSHOT to 2.9.0-SNAPSHOT \ No newline at end of file diff --git a/core-services/service-request/pom.xml b/core-services/service-request/pom.xml index 6dfbc669431..fdbe1e2b826 100644 --- a/core-services/service-request/pom.xml +++ b/core-services/service-request/pom.xml @@ -4,30 +4,22 @@ service-request jar service-request - 1.0.0 + 2.9.0-SNAPSHOT - 1.8 + 17 ${java.version} ${java.version} org.springframework.boot spring-boot-starter-parent - 2.2.6.RELEASE + 3.2.2 - src/main/java org.springframework.boot spring-boot-maven-plugin - - - - repackage - - - @@ -36,18 +28,24 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + 3.2.3 + org.springframework.boot spring-boot-starter-jdbc - org.flywaydb - flyway-core + org.flywaydb + flyway-core + 9.22.3 org.postgresql postgresql - 42.2.2.jre7 + 42.7.1 org.springframework.boot @@ -70,17 +68,12 @@ org.egov.services tracer - 2.1.2-SNAPSHOT - - - org.egov.services - digit-models - 1.0.0-SNAPSHOT + 2.9.0-SNAPSHOT org.egov mdms-client - 0.0.2-SNAPSHOT + 2.9.0-SNAPSHOT compile @@ -94,10 +87,6 @@ jackson-datatype-jsr310 - - javax.validation - validation-api - diff --git a/core-services/service-request/src/main/java/digit/config/Configuration.java b/core-services/service-request/src/main/java/digit/config/Configuration.java index f25fcf9f4ad..86050864839 100644 --- a/core-services/service-request/src/main/java/digit/config/Configuration.java +++ b/core-services/service-request/src/main/java/digit/config/Configuration.java @@ -1,6 +1,7 @@ package digit.config; import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.annotation.PostConstruct; import lombok.*; import org.egov.tracer.config.TracerConfiguration; import org.springframework.beans.factory.annotation.Autowired; @@ -10,7 +11,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; import java.util.TimeZone; @Component diff --git a/core-services/service-request/src/main/java/digit/config/MainConfiguration.java b/core-services/service-request/src/main/java/digit/config/MainConfiguration.java index 60b7660e94c..fd07a5e5c28 100644 --- a/core-services/service-request/src/main/java/digit/config/MainConfiguration.java +++ b/core-services/service-request/src/main/java/digit/config/MainConfiguration.java @@ -1,5 +1,6 @@ package digit.config; +import jakarta.annotation.PostConstruct; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.beans.factory.annotation.Autowired; @@ -7,7 +8,6 @@ import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import java.util.TimeZone; -import javax.annotation.PostConstruct; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import org.egov.tracer.config.TracerConfiguration; diff --git a/core-services/service-request/src/main/java/digit/repository/rowmapper/ServiceDefinitionRowMapper.java b/core-services/service-request/src/main/java/digit/repository/rowmapper/ServiceDefinitionRowMapper.java index aa8ec5a98de..8621978892a 100644 --- a/core-services/service-request/src/main/java/digit/repository/rowmapper/ServiceDefinitionRowMapper.java +++ b/core-services/service-request/src/main/java/digit/repository/rowmapper/ServiceDefinitionRowMapper.java @@ -3,10 +3,10 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import digit.models.coremodels.AuditDetails; import digit.web.models.AttributeDefinition; import digit.web.models.ServiceDefinition; import org.apache.commons.lang.StringUtils; +import org.egov.common.contract.models.AuditDetails; import org.egov.tracer.model.CustomException; import org.postgresql.util.PGobject; import org.springframework.beans.factory.annotation.Autowired; diff --git a/core-services/service-request/src/main/java/digit/repository/rowmapper/ServiceRowMapper.java b/core-services/service-request/src/main/java/digit/repository/rowmapper/ServiceRowMapper.java index 0792c6a70f6..f58300598d5 100644 --- a/core-services/service-request/src/main/java/digit/repository/rowmapper/ServiceRowMapper.java +++ b/core-services/service-request/src/main/java/digit/repository/rowmapper/ServiceRowMapper.java @@ -4,12 +4,10 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; -import digit.models.coremodels.AuditDetails; -import digit.web.models.AttributeDefinition; import digit.web.models.AttributeValue; import digit.web.models.Service; -import digit.web.models.ServiceDefinition; import org.apache.commons.lang.StringUtils; +import org.egov.common.contract.models.AuditDetails; import org.egov.tracer.model.CustomException; import org.postgresql.util.PGobject; import org.springframework.beans.factory.annotation.Autowired; diff --git a/core-services/service-request/src/main/java/digit/service/ServiceRequestEnrichmentService.java b/core-services/service-request/src/main/java/digit/service/ServiceRequestEnrichmentService.java index 79a8e90a3a0..199991bfafe 100644 --- a/core-services/service-request/src/main/java/digit/service/ServiceRequestEnrichmentService.java +++ b/core-services/service-request/src/main/java/digit/service/ServiceRequestEnrichmentService.java @@ -1,7 +1,7 @@ package digit.service; -import digit.models.coremodels.AuditDetails; import digit.web.models.*; +import org.egov.common.contract.models.AuditDetails; import org.egov.common.contract.request.RequestInfo; import org.springframework.stereotype.Component; diff --git a/core-services/service-request/src/main/java/digit/web/controllers/ServiceController.java b/core-services/service-request/src/main/java/digit/web/controllers/ServiceController.java index 18b6b78b187..5d356775542 100644 --- a/core-services/service-request/src/main/java/digit/web/controllers/ServiceController.java +++ b/core-services/service-request/src/main/java/digit/web/controllers/ServiceController.java @@ -11,7 +11,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; +import jakarta.validation.Valid; import java.util.Collections; import java.util.List; diff --git a/core-services/service-request/src/main/java/digit/web/controllers/ServiceDefinitionController.java b/core-services/service-request/src/main/java/digit/web/controllers/ServiceDefinitionController.java index 8cc826b4b26..a2074eebdfa 100644 --- a/core-services/service-request/src/main/java/digit/web/controllers/ServiceDefinitionController.java +++ b/core-services/service-request/src/main/java/digit/web/controllers/ServiceDefinitionController.java @@ -15,7 +15,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; +import jakarta.validation.Valid; import java.util.Collections; import java.util.List; diff --git a/core-services/service-request/src/main/java/digit/web/models/AttributeDefinition.java b/core-services/service-request/src/main/java/digit/web/models/AttributeDefinition.java index 3419cf98f64..8a094ba7302 100644 --- a/core-services/service-request/src/main/java/digit/web/models/AttributeDefinition.java +++ b/core-services/service-request/src/main/java/digit/web/models/AttributeDefinition.java @@ -5,16 +5,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -import digit.models.coremodels.AuditDetails; import io.swagger.v3.oas.annotations.media.Schema; import java.util.ArrayList; import java.util.List; +import org.egov.common.contract.models.AuditDetails; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/AttributeValue.java b/core-services/service-request/src/main/java/digit/web/models/AttributeValue.java index beed4cfd2f2..1c2cb27a1aa 100644 --- a/core-services/service-request/src/main/java/digit/web/models/AttributeValue.java +++ b/core-services/service-request/src/main/java/digit/web/models/AttributeValue.java @@ -4,12 +4,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; -import digit.models.coremodels.AuditDetails; import io.swagger.v3.oas.annotations.media.Schema; +import org.egov.common.contract.models.AuditDetails; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/Pagination.java b/core-services/service-request/src/main/java/digit/web/models/Pagination.java index 077d9d54307..55895d2d768 100644 --- a/core-services/service-request/src/main/java/digit/web/models/Pagination.java +++ b/core-services/service-request/src/main/java/digit/web/models/Pagination.java @@ -11,8 +11,8 @@ import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/Service.java b/core-services/service-request/src/main/java/digit/web/models/Service.java index 89305b2d2bc..12d0c35e12c 100644 --- a/core-services/service-request/src/main/java/digit/web/models/Service.java +++ b/core-services/service-request/src/main/java/digit/web/models/Service.java @@ -4,17 +4,17 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; -import digit.models.coremodels.AuditDetails; import digit.web.models.AttributeValue; import io.swagger.v3.oas.annotations.media.Schema; import java.util.ArrayList; import java.util.List; +import org.egov.common.contract.models.AuditDetails; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceCriteria.java b/core-services/service-request/src/main/java/digit/web/models/ServiceCriteria.java index 3b4e1d3a52d..4efe8f8c5da 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceCriteria.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceCriteria.java @@ -11,8 +11,8 @@ import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinition.java b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinition.java index 69841b4d268..2d0e28fa6a9 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinition.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinition.java @@ -4,17 +4,17 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; -import digit.models.coremodels.AuditDetails; import digit.web.models.AttributeDefinition; import io.swagger.v3.oas.annotations.media.Schema; import java.util.ArrayList; import java.util.List; +import org.egov.common.contract.models.AuditDetails; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionCriteria.java b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionCriteria.java index d89277541be..b6cac2119bf 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionCriteria.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionCriteria.java @@ -11,8 +11,8 @@ import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionRequest.java b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionRequest.java index 8508c638ae1..c8863366d1b 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionRequest.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionRequest.java @@ -7,8 +7,8 @@ import io.swagger.v3.oas.annotations.media.Schema; import org.egov.common.contract.request.RequestInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.Data; diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionResponse.java b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionResponse.java index 7e5e126f0d5..eb18400e649 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionResponse.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionResponse.java @@ -14,8 +14,8 @@ import org.egov.common.contract.response.ResponseInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionSearchRequest.java b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionSearchRequest.java index a5f47ae1248..14c41ce8d21 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionSearchRequest.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceDefinitionSearchRequest.java @@ -10,8 +10,8 @@ import org.egov.common.contract.request.RequestInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceRequest.java b/core-services/service-request/src/main/java/digit/web/models/ServiceRequest.java index 76c5a9db7b0..9f7a8711ec4 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceRequest.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceRequest.java @@ -9,8 +9,8 @@ import org.egov.common.contract.request.RequestInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceResponse.java b/core-services/service-request/src/main/java/digit/web/models/ServiceResponse.java index 963dbda74b4..39bd9251753 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceResponse.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceResponse.java @@ -14,8 +14,8 @@ import org.egov.common.contract.response.ResponseInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/java/digit/web/models/ServiceSearchRequest.java b/core-services/service-request/src/main/java/digit/web/models/ServiceSearchRequest.java index d25081d2c99..d42f0cd5820 100644 --- a/core-services/service-request/src/main/java/digit/web/models/ServiceSearchRequest.java +++ b/core-services/service-request/src/main/java/digit/web/models/ServiceSearchRequest.java @@ -10,8 +10,8 @@ import org.egov.common.contract.request.RequestInfo; import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; diff --git a/core-services/service-request/src/main/resources/db/Dockerfile b/core-services/service-request/src/main/resources/db/Dockerfile index a5699ff7d99..f38638a269f 100644 --- a/core-services/service-request/src/main/resources/db/Dockerfile +++ b/core-services/service-request/src/main/resources/db/Dockerfile @@ -1,4 +1,4 @@ -FROM egovio/flyway:4.1.2 +FROM egovio/flyway:10.7.1 COPY ./migration/main /flyway/sql @@ -6,4 +6,4 @@ COPY migrate.sh /usr/bin/migrate.sh RUN chmod +x /usr/bin/migrate.sh -CMD ["/usr/bin/migrate.sh"] +ENTRYPOINT ["/usr/bin/migrate.sh"] diff --git a/core-services/service-request/src/main/resources/db/migrate.sh b/core-services/service-request/src/main/resources/db/migrate.sh index 43960b25cdb..5593a173eba 100644 --- a/core-services/service-request/src/main/resources/db/migrate.sh +++ b/core-services/service-request/src/main/resources/db/migrate.sh @@ -1,3 +1,3 @@ #!/bin/sh -flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true -ignoreMissingMigrations=true migrate \ No newline at end of file +flyway -url=$DB_URL -table=$SCHEMA_TABLE -user=$FLYWAY_USER -password=$FLYWAY_PASSWORD -locations=$FLYWAY_LOCATIONS -baselineOnMigrate=true -outOfOrder=true migrate \ No newline at end of file diff --git a/core-services/user-otp/CHANGELOG.md b/core-services/user-otp/CHANGELOG.md index 532dc1cc72e..006f84d635c 100644 --- a/core-services/user-otp/CHANGELOG.md +++ b/core-services/user-otp/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog All notable changes to this module will be documented in this file. +## 2.9.0 - 2024-02-29 +- Upgraded spring boot version from 2.2.13.RELEASE to 3.2.2 +- Upgraded java version from 1.8 to 17 +- Upgraded org.egov.services:tracer version from 2.0.0-SNAPSHOT to 2.9.0-SNAPSHOT + ## 1.2.1 - 2023-08-11 - Central Instance Library Integration diff --git a/core-services/user-otp/pom.xml b/core-services/user-otp/pom.xml index 2d583576ffa..fc04afabfa7 100644 --- a/core-services/user-otp/pom.xml +++ b/core-services/user-otp/pom.xml @@ -5,7 +5,7 @@ org.egov user-otp - 1.2.1-SNAPSHOT + 2.9.0-SNAPSHOT jar user-otp @@ -14,29 +14,32 @@ org.springframework.boot spring-boot-starter-parent - 2.2.13.RELEASE - + 3.2.2 2.17.1 UTF-8 UTF-8 - 1.8 + 17 org.springframework spring-beans - 5.2.20.RELEASE org.springframework.boot spring-boot-starter-web - + + junit + junit + 4.13.2 + test + org.springframework.kafka spring-kafka @@ -48,27 +51,10 @@ true - - org.apache.commons - commons-lang3 - 3.0 - - - - commons-io - commons-io - 2.5 - - org.egov.services tracer - 2.0.0-SNAPSHOT - - - org.egov.services - services-common - 1.1.1-SNAPSHOT + 2.9.0-SNAPSHOT @@ -76,6 +62,13 @@ spring-boot-starter-test test + + junit + junit + 4.13.2 + test + + diff --git a/core-services/user-otp/src/main/java/org/egov/domain/model/OtpRequest.java b/core-services/user-otp/src/main/java/org/egov/domain/model/OtpRequest.java index 80b6dcf1530..caed1f6d8f5 100644 --- a/core-services/user-otp/src/main/java/org/egov/domain/model/OtpRequest.java +++ b/core-services/user-otp/src/main/java/org/egov/domain/model/OtpRequest.java @@ -1,11 +1,10 @@ package org.egov.domain.model; import lombok.*; -import org.apache.commons.lang3.StringUtils; import org.egov.domain.exception.InvalidOtpRequestException; import org.egov.web.contract.RequestInfo; -import static org.springframework.util.StringUtils.isEmpty; +import static org.springframework.util.ObjectUtils.isEmpty; @Getter @AllArgsConstructor @@ -34,7 +33,8 @@ public void validate() { public boolean isMobileNumberNumeric() { // TODO Auto-generated method stub if(!(type!=null && type.toString().equalsIgnoreCase(OtpRequestType.PASSWORD_RESET.toString()))) - return !StringUtils.isNumeric(mobileNumber); + //return !StringUtils.isNumeric(mobileNumber); + return !(mobileNumber != null && mobileNumber.matches("\\d+")); return false; } diff --git a/core-services/user-otp/src/main/java/org/egov/domain/service/OtpService.java b/core-services/user-otp/src/main/java/org/egov/domain/service/OtpService.java index 7ebcb5fb107..43277495bf9 100644 --- a/core-services/user-otp/src/main/java/org/egov/domain/service/OtpService.java +++ b/core-services/user-otp/src/main/java/org/egov/domain/service/OtpService.java @@ -11,7 +11,6 @@ import org.egov.persistence.repository.OtpRepository; import org.egov.persistence.repository.OtpSMSRepository; import org.egov.persistence.repository.UserRepository; -import org.egov.tracer.model.CustomException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/core-services/user-otp/src/main/java/org/egov/persistence/contract/OtpResponse.java b/core-services/user-otp/src/main/java/org/egov/persistence/contract/OtpResponse.java index 357518b1f61..21f689be1bb 100644 --- a/core-services/user-otp/src/main/java/org/egov/persistence/contract/OtpResponse.java +++ b/core-services/user-otp/src/main/java/org/egov/persistence/contract/OtpResponse.java @@ -6,7 +6,7 @@ import lombok.Setter; import org.egov.common.contract.response.ResponseInfo; -import static org.springframework.util.StringUtils.isEmpty; +import static org.springframework.util.ObjectUtils.isEmpty; @Getter @AllArgsConstructor diff --git a/core-services/user-otp/src/main/java/org/egov/persistence/repository/OtpEmailRepository.java b/core-services/user-otp/src/main/java/org/egov/persistence/repository/OtpEmailRepository.java index c1f364ccda7..76ce72b7f32 100644 --- a/core-services/user-otp/src/main/java/org/egov/persistence/repository/OtpEmailRepository.java +++ b/core-services/user-otp/src/main/java/org/egov/persistence/repository/OtpEmailRepository.java @@ -18,7 +18,6 @@ import java.util.Map; import static java.lang.String.format; -import static org.apache.commons.lang3.StringUtils.isEmpty; @Service @Slf4j @@ -51,7 +50,7 @@ public OtpEmailRepository(CustomKafkaTemplate kafkaTemplat } public void send(String emailId, String otpNumber, OtpRequest otpRequest) { - if (isEmpty(emailId)) { + if (emailId == null || emailId.isEmpty()) { return; } sendEmail(emailId, otpNumber, otpRequest); diff --git a/core-services/user-otp/src/main/java/org/egov/persistence/repository/OtpSMSRepository.java b/core-services/user-otp/src/main/java/org/egov/persistence/repository/OtpSMSRepository.java index a394597ce3b..155aad96b58 100644 --- a/core-services/user-otp/src/main/java/org/egov/persistence/repository/OtpSMSRepository.java +++ b/core-services/user-otp/src/main/java/org/egov/persistence/repository/OtpSMSRepository.java @@ -12,7 +12,6 @@ import org.springframework.stereotype.Repository; import org.springframework.stereotype.Service; -import javax.validation.constraints.NotNull; import java.util.Map; import static java.lang.String.format; diff --git a/core-services/user-otp/src/main/java/org/egov/web/contract/Otp.java b/core-services/user-otp/src/main/java/org/egov/web/contract/Otp.java index f4dc2119221..fbf65d40906 100644 --- a/core-services/user-otp/src/main/java/org/egov/web/contract/Otp.java +++ b/core-services/user-otp/src/main/java/org/egov/web/contract/Otp.java @@ -4,7 +4,6 @@ import lombok.*; import org.egov.domain.model.OtpRequestType; -import static org.apache.commons.lang3.StringUtils.isEmpty; @Getter @AllArgsConstructor @@ -22,7 +21,7 @@ public class Otp { @JsonIgnore public OtpRequestType getTypeOrDefault() { - return isEmpty(type) ? OtpRequestType.REGISTER : mapToDomainType(); + return (type == null || type.isEmpty()) ? OtpRequestType.REGISTER : mapToDomainType(); } private OtpRequestType mapToDomainType() { diff --git a/core-services/user-otp/src/test/java/org/egov/Resources.java b/core-services/user-otp/src/test/java/org/egov/Resources.java index efe166e8882..882f787f790 100644 --- a/core-services/user-otp/src/test/java/org/egov/Resources.java +++ b/core-services/user-otp/src/test/java/org/egov/Resources.java @@ -1,16 +1,20 @@ package org.egov; -import org.apache.commons.io.IOUtils; - +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.stream.Collectors; public class Resources { public String getFileContents(String fileName) { - try { - return IOUtils.toString(this.getClass().getClassLoader() - .getResourceAsStream(fileName), "UTF-8") - .replaceAll("\\s*\\{\\s*", "\\{") - .replaceAll("\\s*\\}\\s*", "\\}") + try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName); + BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { + + String content = reader.lines().collect(Collectors.joining()); + return content.replaceAll("\\s*\\{\\s*", "{") + .replaceAll("\\s*\\}\\s*", "}") .replaceAll("\\s*:\\s*", ":") .replace("\n", ""); } catch (IOException e) { diff --git a/core-services/user-otp/src/test/java/org/egov/domain/service/OtpServiceTest.java b/core-services/user-otp/src/test/java/org/egov/domain/service/OtpServiceTest.java index 6ec23b3d03a..8095939c651 100644 --- a/core-services/user-otp/src/test/java/org/egov/domain/service/OtpServiceTest.java +++ b/core-services/user-otp/src/test/java/org/egov/domain/service/OtpServiceTest.java @@ -14,7 +14,6 @@ import org.mockito.Mock; import org.mockito.junit.*; -import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) diff --git a/core-services/user-otp/src/test/java/org/egov/persistence/repository/OtpEmailRepositoryTest.java b/core-services/user-otp/src/test/java/org/egov/persistence/repository/OtpEmailRepositoryTest.java index 4b1ecffc283..969da335e4b 100644 --- a/core-services/user-otp/src/test/java/org/egov/persistence/repository/OtpEmailRepositoryTest.java +++ b/core-services/user-otp/src/test/java/org/egov/persistence/repository/OtpEmailRepositoryTest.java @@ -16,7 +16,6 @@ import java.util.*; -import static org.mockito.Matchers.any; import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) diff --git a/core-services/user-otp/src/test/java/org/egov/persistence/repository/OtpRepositoryTest.java b/core-services/user-otp/src/test/java/org/egov/persistence/repository/OtpRepositoryTest.java index 1e73966634a..1116078996c 100644 --- a/core-services/user-otp/src/test/java/org/egov/persistence/repository/OtpRepositoryTest.java +++ b/core-services/user-otp/src/test/java/org/egov/persistence/repository/OtpRepositoryTest.java @@ -8,15 +8,15 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.test.web.client.MockRestServiceServer; import org.springframework.web.client.RestTemplate; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.springframework.test.web.client.ExpectedCount.once; diff --git a/core-services/user-otp/src/test/java/org/egov/persistence/repository/UserRepositoryTest.java b/core-services/user-otp/src/test/java/org/egov/persistence/repository/UserRepositoryTest.java index 879efc0b965..3577b697650 100644 --- a/core-services/user-otp/src/test/java/org/egov/persistence/repository/UserRepositoryTest.java +++ b/core-services/user-otp/src/test/java/org/egov/persistence/repository/UserRepositoryTest.java @@ -19,7 +19,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.springframework.http.HttpEntity; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.client.RestTemplate; diff --git a/tutorials/backend-developer-guide/btr-service/README.md b/tutorials/backend-developer-guide/btr-service/README.md new file mode 100644 index 00000000000..a2e8a9f7b84 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/README.md @@ -0,0 +1,18 @@ +# Swagger generated server + +Spring Boot Server + + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. +This is an example of building a swagger-enabled server in Java using the SpringBoot framework. + +The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) + +Start your server as an simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/ + +Change default port value in application.properties \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/pom.xml b/tutorials/backend-developer-guide/btr-service/pom.xml new file mode 100644 index 00000000000..82e1c6865dc --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/pom.xml @@ -0,0 +1,134 @@ + + 4.0.0 + org.egov + birth-registration + jar + birth-registration + 1.0.0 + + 17 + ${java.version} + ${java.version} + + + org.springframework.boot + spring-boot-starter-parent + 3.2.2 + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.flywaydb + flyway-core + 9.22.3 + + + org.postgresql + postgresql + 42.7.1 + + + org.springframework.boot + spring-boot-starter-test + test + + + + io.swagger + swagger-core + 1.5.18 + + + io.swagger.core.v3 + swagger-annotations + 2.2.8 + + + net.minidev + json-smart + 2.5.0 + + + + org.egov.services + tracer + 2.9.0-SNAPSHOT + + + + + + + + org.egov + mdms-client + 2.9.0-SNAPSHOT + compile + + + org.projectlombok + lombok + true + + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + org.springframework.boot + spring-boot-starter-validation + + + junit + junit + test + + + + + repo.egovernments.org + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + + + repo.egovernments.org.snapshots + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ + + + repo.egovernments.org.public + eGov Public Repository Group + https://nexus-repo.egovernments.org/nexus/content/groups/public/ + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/Main.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/Main.java new file mode 100644 index 00000000000..6e3d79db11c --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/Main.java @@ -0,0 +1,20 @@ +package digit; + + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Import; + +@Import({ TracerConfiguration.class }) +@SpringBootApplication +@ComponentScan(basePackages = { "digit", "digit.web.controllers" , "digit.config"}) +public class Main { + + + public static void main(String[] args) throws Exception { + SpringApplication.run(Main.class, args); + } + +} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/config/BTRConfiguration.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/BTRConfiguration.java similarity index 80% rename from tutorials/backend-developer-guide/btr-services/src/main/java/digit/config/BTRConfiguration.java rename to tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/BTRConfiguration.java index e18d1d4b6f8..dae06281be7 100644 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/config/BTRConfiguration.java +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/BTRConfiguration.java @@ -9,8 +9,7 @@ import org.springframework.context.annotation.Import; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.util.TimeZone; @Component @@ -21,26 +20,21 @@ @Setter @Getter public class BTRConfiguration { - @Value("${app.timezone}") private String timeZone; - // BTR Variables - - @Value("${btr.kafka.create.topic}") - private String createTopic; - - @Value("${btr.kafka.update.topic}") - private String updateTopic; - - @Value("${btr.default.offset}") - private Integer defaultOffset; - - @Value("${btr.default.limit}") - private Integer defaultLimit; + @PostConstruct + public void initialize() { + TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); + } - @Value("${btr.search.max.limit}") - private Integer maxLimit; + @Bean + @Autowired + public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setObjectMapper(objectMapper); + return converter; + } // User Config @Value("${egov.user.host}") @@ -81,6 +75,25 @@ public class BTRConfiguration { @Value("${is.workflow.enabled}") private Boolean isWorkflowEnabled; + + // BTR Variables + + @Value("${btr.kafka.create.topic}") + private String createTopic; + + @Value("${btr.kafka.update.topic}") + private String updateTopic; + + @Value("${btr.default.offset}") + private Integer defaultOffset; + + @Value("${btr.default.limit}") + private Integer defaultLimit; + + @Value("${btr.search.max.limit}") + private Integer maxLimit; + + //MDMS @Value("${egov.mdms.host}") private String mdmsHost; @@ -88,12 +101,12 @@ public class BTRConfiguration { @Value("${egov.mdms.search.endpoint}") private String mdmsEndPoint; -// //HRMS -// @Value("${egov.hrms.host}") -// private String hrmsHost; -// -// @Value("${egov.hrms.search.endpoint}") -// private String hrmsEndPoint; + //HRMS + @Value("${egov.hrms.host}") + private String hrmsHost; + + @Value("${egov.hrms.search.endpoint}") + private String hrmsEndPoint; @Value("${egov.url.shortner.host}") private String urlShortnerHost; @@ -101,12 +114,6 @@ public class BTRConfiguration { @Value("${egov.url.shortner.endpoint}") private String urlShortnerEndpoint; - @Value("${egov.btrcalculator.host}") - private String btrCalculatorHost; - - @Value("${egov.btrcalculator.endpoint}") - private String btrCalculatorCalculateEndpoint; - @Value("${egov.sms.notification.topic}") private String smsNotificationTopic; } diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/Configuration.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/Configuration.java new file mode 100644 index 00000000000..c01a6160905 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/Configuration.java @@ -0,0 +1,92 @@ +package digit.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.*; +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.stereotype.Component; + +import jakarta.annotation.PostConstruct; +import java.util.TimeZone; + +@Component +@Data +@Import({TracerConfiguration.class}) +@NoArgsConstructor +@AllArgsConstructor +@Setter +@Getter +public class Configuration { + + + // User Config + @Value("${egov.user.host}") + private String userHost; + + @Value("${egov.user.context.path}") + private String userContextPath; + + @Value("${egov.user.create.path}") + private String userCreateEndpoint; + + @Value("${egov.user.search.path}") + private String userSearchEndpoint; + + @Value("${egov.user.update.path}") + private String userUpdateEndpoint; + + + //Idgen Config + @Value("${egov.idgen.host}") + private String idGenHost; + + @Value("${egov.idgen.path}") + private String idGenPath; + + + //Workflow Config + @Value("${egov.workflow.host}") + private String wfHost; + + @Value("${egov.workflow.transition.path}") + private String wfTransitionPath; + + @Value("${egov.workflow.businessservice.search.path}") + private String wfBusinessServiceSearchPath; + + @Value("${egov.workflow.processinstance.search.path}") + private String wfProcessInstanceSearchPath; + + + //MDMS + @Value("${egov.mdms.host}") + private String mdmsHost; + + @Value("${egov.mdms.search.endpoint}") + private String mdmsEndPoint; + + + //HRMS + @Value("${egov.hrms.host}") + private String hrmsHost; + + @Value("${egov.hrms.search.endpoint}") + private String hrmsEndPoint; + + + //URLShortening + @Value("${egov.url.shortner.host}") + private String urlShortnerHost; + + @Value("${egov.url.shortner.endpoint}") + private String urlShortnerEndpoint; + + + //SMSNotification + @Value("${egov.sms.notification.topic}") + private String smsNotificationTopic; +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/MainConfiguration.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/MainConfiguration.java new file mode 100644 index 00000000000..3ccf47e694b --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/MainConfiguration.java @@ -0,0 +1,39 @@ +package digit.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import java.util.TimeZone; +import jakarta.annotation.PostConstruct; + import com.fasterxml.jackson.databind.DeserializationFeature; + import com.fasterxml.jackson.databind.ObjectMapper; +import org.egov.tracer.config.TracerConfiguration; + + +@Import({TracerConfiguration.class}) +public class MainConfiguration { + + @Value("${app.timezone}") + private String timeZone; + + @PostConstruct + public void initialize() { + TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); + } + + @Bean + public ObjectMapper objectMapper(){ + return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).setTimeZone(TimeZone.getTimeZone(timeZone)); + } + + @Bean + @Autowired + public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setObjectMapper(objectMapper); + return converter; + } +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/ServiceConstants.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/ServiceConstants.java new file mode 100644 index 00000000000..6b0c4a6f9ab --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/config/ServiceConstants.java @@ -0,0 +1,50 @@ +package digit.config; + + +import org.springframework.stereotype.Component; + + +@Component +public class ServiceConstants { + + public static final String EXTERNAL_SERVICE_EXCEPTION = "External Service threw an Exception: "; + public static final String SEARCHER_SERVICE_EXCEPTION = "Exception while fetching from searcher: "; + + public static final String IDGEN_ERROR = "IDGEN ERROR"; + public static final String NO_IDS_FOUND_ERROR = "No ids returned from idgen Service"; + + public static final String ERROR_WHILE_FETCHING_FROM_MDMS = "Exception occurred while fetching category lists from mdms: "; + + public static final String RES_MSG_ID = "uief87324"; + public static final String SUCCESSFUL = "successful"; + public static final String FAILED = "failed"; + + public static final String URL = "url"; + public static final String URL_SHORTENING_ERROR_CODE = "URL_SHORTENING_ERROR"; + public static final String URL_SHORTENING_ERROR_MESSAGE = "Unable to shorten url: "; + + public static final String DOB_FORMAT_Y_M_D = "yyyy-MM-dd"; + public static final String DOB_FORMAT_D_M_Y = "dd/MM/yyyy"; + public static final String ILLEGAL_ARGUMENT_EXCEPTION_CODE = "IllegalArgumentException"; + public static final String OBJECTMAPPER_UNABLE_TO_CONVERT = "ObjectMapper not able to convertValue in userCall"; + public static final String DOB_FORMAT_D_M_Y_H_M_S = "dd-MM-yyyy HH:mm:ss"; + public static final String CREATED_DATE = "createdDate"; + public static final String LAST_MODIFIED_DATE = "lastModifiedDate"; + public static final String DOB = "dob"; + public static final String PWD_EXPIRY_DATE = "pwdExpiryDate"; + public static final String INVALID_DATE_FORMAT_CODE = "INVALID_DATE_FORMAT"; + public static final String INVALID_DATE_FORMAT_MESSAGE = "Failed to parse date format in user"; + public static final String CITIZEN_UPPER = "CITIZEN"; + public static final String CITIZEN_LOWER = "Citizen"; + public static final String USER = "user"; + + public static final String PARSING_ERROR = "PARSING ERROR"; + public static final String FAILED_TO_PARSE_BUSINESS_SERVICE_SEARCH = "Failed to parse response of workflow business service search"; + public static final String BUSINESS_SERVICE_NOT_FOUND = "BUSINESSSERVICE_NOT_FOUND"; + public static final String THE_BUSINESS_SERVICE = "The businessService "; + public static final String NOT_FOUND = " is not found"; + public static final String TENANTID = "?tenantId="; + public static final String BUSINESS_SERVICES = "&businessServices="; + + +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/enrichment/BirthApplicationEnrichment.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/enrichment/BirthApplicationEnrichment.java new file mode 100644 index 00000000000..b921a8842ad --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/enrichment/BirthApplicationEnrichment.java @@ -0,0 +1,86 @@ +package digit.enrichment; + +import digit.service.UserService; +import digit.util.IdgenUtil; +import digit.util.UserUtil; +import digit.web.models.*; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.models.AuditDetails; +import org.egov.common.contract.request.User; +import org.egov.common.contract.user.UserDetailResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.UUID; +@Component +@Slf4j +public class BirthApplicationEnrichment { + + @Autowired + private IdgenUtil idgenUtil; + + @Autowired + private UserService userService; + + @Autowired + private UserUtil userUtils; + + public void enrichBirthApplication(BirthRegistrationRequest birthRegistrationRequest) { + List birthRegistrationIdList = idgenUtil.getIdList(birthRegistrationRequest.getRequestInfo(), birthRegistrationRequest.getBirthRegistrationApplications().get(0).getTenantId(), "btr.registrationid", "", birthRegistrationRequest.getBirthRegistrationApplications().size()); + Integer index = 0; + for(BirthRegistrationApplication application : birthRegistrationRequest.getBirthRegistrationApplications()){ + // Enrich audit details + AuditDetails auditDetails = AuditDetails.builder().createdBy(birthRegistrationRequest.getRequestInfo().getUserInfo().getUuid()).createdTime(System.currentTimeMillis()).lastModifiedBy(birthRegistrationRequest.getRequestInfo().getUserInfo().getUuid()).lastModifiedTime(System.currentTimeMillis()).build(); + application.setAuditDetails(auditDetails); + + // Enrich UUID + application.setId(UUID.randomUUID().toString()); + +// Enrich application number from IDgen + application.setApplicationNumber(birthRegistrationIdList.get(index++)); +// Enrich registration Id + application.getAddress().setApplicationNumber(application.getId()); + + // Enrich address UUID + application.getAddress().setId(UUID.randomUUID().toString()); + + } + } + + public void enrichBirthApplicationUponUpdate(BirthRegistrationRequest birthRegistrationRequest) { + // Enrich lastModifiedTime and lastModifiedBy in case of update + birthRegistrationRequest.getBirthRegistrationApplications().get(0).getAuditDetails().setLastModifiedTime(System.currentTimeMillis()); + birthRegistrationRequest.getBirthRegistrationApplications().get(0).getAuditDetails().setLastModifiedBy(birthRegistrationRequest.getRequestInfo().getUserInfo().getUuid()); + } + + public void enrichFatherApplicantOnSearch(BirthRegistrationApplication application) { + UserDetailResponse fatherUserResponse = userService.searchUser(userUtils.getStateLevelTenant(application.getTenantId()),application.getFather().getUuid(),null); + User fatherUser = fatherUserResponse.getUser().get(0); + log.info(fatherUser.toString()); + User fatherApplicant = User.builder() + .mobileNumber(fatherUser.getMobileNumber()) + .id(fatherUser.getId()) + .name(fatherUser.getName()) + .userName((fatherUser.getUserName())) + .type(fatherUser.getType()) + .roles(fatherUser.getRoles()) + .uuid(fatherUser.getUuid()).build(); + application.setFather(fatherApplicant); + } + + public void enrichMotherApplicantOnSearch(BirthRegistrationApplication application) { + UserDetailResponse motherUserResponse = userService.searchUser(userUtils.getStateLevelTenant(application.getTenantId()),application.getMother().getUuid(),null); + User motherUser = motherUserResponse.getUser().get(0); + log.info(motherUser.toString()); + User motherApplicant = User.builder() + .mobileNumber(motherUser.getMobileNumber()) + .id(motherUser.getId()) + .name(motherUser.getName()) + .userName((motherUser.getUserName())) + .type(motherUser.getType()) + .roles(motherUser.getRoles()) + .uuid(motherUser.getUuid()).build(); + application.setMother(motherApplicant); + } +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/kafka/Consumer.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/kafka/Consumer.java new file mode 100644 index 00000000000..557ffe5d7bb --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/kafka/Consumer.java @@ -0,0 +1,21 @@ +package digit.kafka; + +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Component; + +import java.util.HashMap; + +@Component +public class Consumer { + + /* + * Uncomment the below line to start consuming record from kafka.topics.consumer + * Value of the variable kafka.topics.consumer should be overwritten in application.properties + */ + //@KafkaListener(topics = {"kafka.topics.consumer"}) + public void listen(final HashMap record) { + + //TODO + + } +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/kafka/Producer.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/kafka/Producer.java new file mode 100644 index 00000000000..542f4f686c0 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/kafka/Producer.java @@ -0,0 +1,20 @@ +package digit.kafka; + +import lombok.extern.slf4j.Slf4j; +import org.egov.tracer.kafka.CustomKafkaTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +// NOTE: If tracer is disabled change CustomKafkaTemplate to KafkaTemplate in autowiring + +@Service +@Slf4j +public class Producer { + + @Autowired + private CustomKafkaTemplate kafkaTemplate; + + public void push(String topic, Object value) { + kafkaTemplate.send(topic, value); + } +} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/BirthRegistrationRepository.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/BirthRegistrationRepository.java similarity index 99% rename from tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/BirthRegistrationRepository.java rename to tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/BirthRegistrationRepository.java index d9bc21cc2b3..e9594d9a1c8 100644 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/BirthRegistrationRepository.java +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/BirthRegistrationRepository.java @@ -5,6 +5,7 @@ import digit.web.models.BirthApplicationSearchCriteria; import digit.web.models.BirthRegistrationApplication; import lombok.extern.slf4j.Slf4j; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/ServiceRequestRepository.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/ServiceRequestRepository.java new file mode 100644 index 00000000000..7f1d24ed2ae --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/ServiceRequestRepository.java @@ -0,0 +1,47 @@ +package digit.repository; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import lombok.extern.slf4j.Slf4j; +import org.egov.tracer.model.ServiceCallException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +import static digit.config.ServiceConstants.*; + +@Repository +@Slf4j +public class ServiceRequestRepository { + + private ObjectMapper mapper; + + private RestTemplate restTemplate; + + + @Autowired + public ServiceRequestRepository(ObjectMapper mapper, RestTemplate restTemplate) { + this.mapper = mapper; + this.restTemplate = restTemplate; + } + + + public Object fetchResult(StringBuilder uri, Object request) { + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + Object response = null; + try { + response = restTemplate.postForObject(uri.toString(), request, Map.class); + }catch(HttpClientErrorException e) { + log.error(EXTERNAL_SERVICE_EXCEPTION,e); + throw new ServiceCallException(e.getResponseBodyAsString()); + }catch(Exception e) { + log.error(SEARCHER_SERVICE_EXCEPTION,e); + } + + return response; + } +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/querybuilder/BirthApplicationQueryBuilder.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/querybuilder/BirthApplicationQueryBuilder.java similarity index 87% rename from tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/querybuilder/BirthApplicationQueryBuilder.java rename to tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/querybuilder/BirthApplicationQueryBuilder.java index 42fe935579e..5c7af5bf3ab 100644 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/querybuilder/BirthApplicationQueryBuilder.java +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/querybuilder/BirthApplicationQueryBuilder.java @@ -12,7 +12,7 @@ public class BirthApplicationQueryBuilder { private static final String BASE_BTR_QUERY = " SELECT btr.id as bid, btr.tenantid as btenantid, btr.applicationnumber as bapplicationnumber, btr.babyfirstname as bbabyfirstname, btr.babylastname as bbabylastname, btr.fatherid as bfatherid, btr.motherid as bmotherid, btr.doctorname as bdoctorname, btr.hospitalname as bhospitalname, btr.placeofbirth as bplaceofbirth, btr.timeofbirth as btimeofbirth, btr.createdby as bcreatedby, btr.lastmodifiedby as blastmodifiedby, btr.createdtime as bcreatedtime, btr.lastmodifiedtime as blastmodifiedtime, "; - private static final String ADDRESS_SELECT_QUERY = " add.id as aid, add.tenantid as atenantid, add.doorno as adoorno, add.latitude as alatitude, add.longitude as alongitude, add.buildingname as abuildingname, add.addressid as aaddressid, add.addressnumber as aaddressnumber, add.type as atype, add.addressline1 as aaddressline1, add.addressline2 as aaddressline2, add.landmark as alandmark, add.street as astreet, add.city as acity, add.locality as alocality, add.pincode as apincode, add.detail as adetail, add.registrationid as aregistrationid "; + private static final String ADDRESS_SELECT_QUERY = " add.id as aid, add.tenantid as atenantid, add.type as atype, add.address as aaddress, add.city as acity, add.pincode as apincode, add.registrationid as aregistrationid "; private static final String FROM_TABLES = " FROM eg_bt_registration btr LEFT JOIN eg_bt_address add ON btr.id = add.registrationid "; @@ -74,4 +74,4 @@ private void addToPreparedStatement(List preparedStmtList, List preparedStmtList.add(id); }); } -} +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/rowmapper/BirthApplicationRowMapper.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/rowmapper/BirthApplicationRowMapper.java new file mode 100644 index 00000000000..8ce9c1deda6 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/repository/rowmapper/BirthApplicationRowMapper.java @@ -0,0 +1,87 @@ +package digit.repository.rowmapper; + +import digit.web.models.*; +import org.egov.common.contract.models.Address; +import org.egov.common.contract.models.AuditDetails; +import org.egov.common.contract.request.User; +import org.egov.common.contract.user.enums.AddressType; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.*; + +@Component +public class BirthApplicationRowMapper implements ResultSetExtractor> { + public List extractData(ResultSet rs) throws SQLException, DataAccessException { + Map birthRegistrationApplicationMap = new LinkedHashMap<>(); + + while (rs.next()){ + String uuid = rs.getString("bapplicationnumber"); + BirthRegistrationApplication birthRegistrationApplication = birthRegistrationApplicationMap.get(uuid); + + if(birthRegistrationApplication == null) { + + Long lastModifiedTime = rs.getLong("blastModifiedTime"); + if (rs.wasNull()) { + lastModifiedTime = null; + } + + + User father = User.builder().uuid(rs.getString("bfatherid")).build(); + User mother = User.builder().uuid(rs.getString("bmotherid")).build(); + + AuditDetails auditdetails = AuditDetails.builder() + .createdBy(rs.getString("bcreatedBy")) + .createdTime(rs.getLong("bcreatedTime")) + .lastModifiedBy(rs.getString("blastModifiedBy")) + .lastModifiedTime(lastModifiedTime) + .build(); + + birthRegistrationApplication = BirthRegistrationApplication.builder() + .applicationNumber(rs.getString("bapplicationnumber")) + .tenantId(rs.getString("btenantid")) + .id(rs.getString("bid")) + .babyFirstName(rs.getString("bbabyfirstname")) + .babyLastName(rs.getString("bbabylastname")) + .father(father) + .mother(mother) + .doctorName(rs.getString("bdoctorname")) + .hospitalName(rs.getString("bhospitalname")) + .placeOfBirth(rs.getString("bplaceofbirth")) + .timeOfBirth(rs.getInt("btimeofbirth")) + .auditDetails(auditdetails) + .build(); + } + addChildrenToProperty(rs, birthRegistrationApplication); + birthRegistrationApplicationMap.put(uuid, birthRegistrationApplication); + } + return new ArrayList<>(birthRegistrationApplicationMap.values()); + } + + private void addChildrenToProperty(ResultSet rs, BirthRegistrationApplication birthRegistrationApplication) + throws SQLException { + addAddressToApplication(rs, birthRegistrationApplication); + } + + private void addAddressToApplication(ResultSet rs, BirthRegistrationApplication birthRegistrationApplication) throws SQLException { + Address address = Address.builder() + .tenantId(rs.getString("atenantid")) + .address(rs.getString("aaddress")) + .city(rs.getString("acity")) + .pinCode(rs.getString("apincode")) + .build(); + + BirthApplicationAddress birthApplicationAddress= BirthApplicationAddress.builder() + .id(rs.getString("aid")) + .tenantId(rs.getString("atenantid")) + .applicantAddress(address) + .build(); + + birthRegistrationApplication.setAddress(birthApplicationAddress); + + } + +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/BirthRegistrationService.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/BirthRegistrationService.java new file mode 100644 index 00000000000..27edda79048 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/BirthRegistrationService.java @@ -0,0 +1,100 @@ +package digit.service; + + +import digit.enrichment.BirthApplicationEnrichment; +import digit.kafka.Producer; +import digit.repository.BirthRegistrationRepository; +import digit.validators.BirthApplicationValidator; +import digit.web.models.BirthApplicationSearchCriteria; +import digit.web.models.BirthRegistrationApplication; +import digit.web.models.BirthRegistrationRequest; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Service +@Slf4j +public class BirthRegistrationService { + + @Autowired + private BirthApplicationValidator validator; + + @Autowired + private BirthApplicationEnrichment enrichmentUtil; + + @Autowired + private UserService userService; + + @Autowired + private WorkflowService workflowService; + + @Autowired + private BirthRegistrationRepository birthRegistrationRepository; + + @Autowired + private Producer producer; + + public List registerBtRequest(BirthRegistrationRequest birthRegistrationRequest) { + // Validate applications + validator.validateBirthApplication(birthRegistrationRequest); + + // Enrich applications + enrichmentUtil.enrichBirthApplication(birthRegistrationRequest); + + // Enrich/Upsert user in upon birth registration + userService.callUserService(birthRegistrationRequest); + + // Initiate workflow for the new application + workflowService.updateWorkflowStatus(birthRegistrationRequest); + + // Push the application to the topic for persister to listen and persist + producer.push("save-bt-application", birthRegistrationRequest); + + // Return the response back to user + return birthRegistrationRequest.getBirthRegistrationApplications(); + } + + public List searchBtApplications(RequestInfo requestInfo, BirthApplicationSearchCriteria birthApplicationSearchCriteria) { + // Fetch applications from database according to the given search criteria + List applications = birthRegistrationRepository.getApplications(birthApplicationSearchCriteria); + + // If no applications are found matching the given criteria, return an empty list + if(CollectionUtils.isEmpty(applications)) + return new ArrayList<>(); + +// Enrich mother and father of applicant objects + applications.forEach(application -> { + enrichmentUtil.enrichFatherApplicantOnSearch(application); + enrichmentUtil.enrichMotherApplicantOnSearch(application); + }); + + // Otherwise return the found applications + return applications; + } + + public BirthRegistrationApplication updateBtApplication(BirthRegistrationRequest birthRegistrationRequest) { + // Validate whether the application that is being requested for update indeed exists + BirthRegistrationApplication existingApplication = validator.validateApplicationExistence(birthRegistrationRequest.getBirthRegistrationApplications().get(0)); + existingApplication.setWorkflow(birthRegistrationRequest.getBirthRegistrationApplications().get(0).getWorkflow()); + log.info(existingApplication.toString()); + birthRegistrationRequest.setBirthRegistrationApplications(Collections.singletonList(existingApplication)); + + // Enrich application upon update + enrichmentUtil.enrichBirthApplicationUponUpdate(birthRegistrationRequest); + + workflowService.updateWorkflowStatus(birthRegistrationRequest); + + // Just like create request, update request will be handled asynchronously by the persister + producer.push("update-bt-application", birthRegistrationRequest); + + return birthRegistrationRequest.getBirthRegistrationApplications().get(0); + + + } +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/CalculationService.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/CalculationService.java new file mode 100644 index 00000000000..75b3eb7ebf1 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/CalculationService.java @@ -0,0 +1,50 @@ +//package digit.service; +// +//import com.fasterxml.jackson.databind.ObjectMapper; +//import digit.config.BTRConfiguration; +//import digit.repository.ServiceRequestRepository; +//import digit.web.models.*; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Service; +// +//import java.util.ArrayList; +//import java.util.List; +// +//@Service +//public class CalculationService { +// +// @Autowired +// private BTRConfiguration btrConfiguration; +// +// @Autowired +// private ObjectMapper mapper; +// +// @Autowired +// private ServiceRequestRepository serviceRequestRepository; +// +// public CalculationRes getCalculation(BirthRegistrationRequest request){ +// +// List calculationCriteriaList = new ArrayList<>(); +// for(BirthRegistrationApplication application : request.getBirthRegistrationApplications()) { +// CalculationCriteria calculationCriteria = CalculationCriteria.builder() +// .birthregistrationapplication(application) +// .tenantId(application.getTenantId()) +// .applicationNumber(application.getApplicationNumber()) +// .build(); +// calculationCriteriaList.add(calculationCriteria); +// } +// +// CalculationReq calculationReq = CalculationReq.builder() +// .requestInfo(request.getRequestInfo()) +// .calculationCriteria(calculationCriteriaList) +// .build(); +// +// StringBuilder url = new StringBuilder().append(btrConfiguration.getBtrCalculatorHost()) +// .append(btrConfiguration.getBtrCalculatorCalculateEndpoint()); +// +// Object response = serviceRequestRepository.fetchResult(url, calculationReq); +// CalculationRes calculationRes = mapper.convertValue(response, CalculationRes.class); +// +// return calculationRes; +// } +//} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/NotificationService.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/NotificationService.java new file mode 100644 index 00000000000..ac9d4e4b856 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/NotificationService.java @@ -0,0 +1,51 @@ +package digit.service; + +import digit.config.BTRConfiguration; +import digit.kafka.Producer; +import digit.web.models.BirthRegistrationApplication; +import digit.web.models.BirthRegistrationRequest; +import digit.web.models.SMSRequest; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.List; +@Slf4j +@Service +public class NotificationService { + + @Autowired + private Producer producer; + + @Autowired + private BTRConfiguration config; + + @Autowired + private RestTemplate restTemplate; + + private static final String smsTemplate = "Dear {FATHER_NAME} and {MOTHER_NAME} your birth registration application has been successfully created on the system with application number - {APPNUMBER}."; + + public void prepareEventAndSend(BirthRegistrationRequest request){ + List smsRequestList = new ArrayList<>(); + request.getBirthRegistrationApplications().forEach(application -> { + SMSRequest smsRequestForFather = SMSRequest.builder().mobileNumber( application.getFather().getMobileNumber()).message(getCustomMessage(smsTemplate, application)).build(); + SMSRequest smsRequestForMother = SMSRequest.builder().mobileNumber(application.getMother().getMobileNumber()).message(getCustomMessage(smsTemplate, application)).build(); + smsRequestList.add(smsRequestForFather); + smsRequestList.add(smsRequestForMother); + }); + for (SMSRequest smsRequest : smsRequestList) { + producer.push(config.getSmsNotificationTopic(), smsRequest); + log.info("Messages: " + smsRequest.getMessage()); + } + } + + private String getCustomMessage(String template, BirthRegistrationApplication application) { + template = template.replace("{APPNUMBER}", application.getApplicationNumber()); + template = template.replace("{FATHER_NAME}", application.getFather().getName()); + template = template.replace("{MOTHER_NAME}", application.getMother().getName()); + return template; + } + +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/UserService.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/UserService.java new file mode 100644 index 00000000000..62c8e6595bf --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/UserService.java @@ -0,0 +1,234 @@ +package digit.service; + +import digit.config.BTRConfiguration; +import digit.util.UserUtil; +import digit.web.models.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.User; +import org.egov.common.contract.user.CreateUserRequest; +import org.egov.common.contract.user.UserDetailResponse; +import org.egov.common.contract.user.UserSearchRequest; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + + +@Service +@Slf4j +public class UserService { + private UserUtil userUtils; + + private BTRConfiguration config; + + @Autowired + public UserService(UserUtil userUtils, BTRConfiguration config) { + this.userUtils = userUtils; + this.config = config; + } + + /** + * Calls user service to enrich user from search or upsert user + * @param request + */ + public void callUserService(BirthRegistrationRequest request){ + request.getBirthRegistrationApplications().forEach(application -> { + if(!StringUtils.isEmpty(application.getFather().getUuid())) + enrichUser(application, request.getRequestInfo()); + else { + User user = createFatherUser(application); + application.getFather().setUuid(upsertUser(user, request.getRequestInfo()).getUuid()); + } + }); + + request.getBirthRegistrationApplications().forEach(application -> { + if(!StringUtils.isEmpty(application.getMother().getUuid())) + enrichUser(application, request.getRequestInfo()); + else { + User user = createMotherUser(application); + application.getMother().setUuid(upsertUser(user, request.getRequestInfo()).getUuid()); + } + }); + } + + private User createFatherUser(BirthRegistrationApplication application){ + User father = application.getFather(); + User user = User.builder().userName(father.getUserName()) + .name(father.getName()) + .userName((father.getUserName())) + .mobileNumber(father.getMobileNumber()) + .emailId(father.getEmailId()) + .tenantId(father.getTenantId()) + .type(father.getType()) + .roles(father.getRoles()) + .build(); + return user; + } + + private User createMotherUser(BirthRegistrationApplication application){ + User mother = application.getMother(); + User user = User.builder().userName(mother.getUserName()) + .name(mother.getName()) + .userName((mother.getUserName())) + .mobileNumber(mother.getMobileNumber()) + .emailId(mother.getEmailId()) + .tenantId(mother.getTenantId()) + .type(mother.getType()) + .roles(mother.getRoles()) + .build(); + return user; + } + private User upsertUser(User user, RequestInfo requestInfo){ + + String tenantId = user.getTenantId(); + User userServiceResponse = null; + + // Search on mobile number as user name + UserDetailResponse userDetailResponse = searchUser(userUtils.getStateLevelTenant(tenantId),null, user.getUserName()); + if (!userDetailResponse.getUser().isEmpty()) { + User userFromSearch = userDetailResponse.getUser().get(0); + log.info(userFromSearch.toString()); + if(!user.getUserName().equalsIgnoreCase(userFromSearch.getUserName())){ + userServiceResponse = updateUser(requestInfo,user,userFromSearch); + } + else userServiceResponse = userDetailResponse.getUser().get(0); + } + else { + userServiceResponse = createUser(requestInfo,tenantId,user); + } + + // Enrich the accountId + // user.setId(userServiceResponse.getUuid()); + return userServiceResponse; + } + + + private void enrichUser(BirthRegistrationApplication application, RequestInfo requestInfo){ + String accountIdFather = application.getFather().getUuid(); + String accountIdMother = application.getMother().getUuid(); + String tenantId = application.getTenantId(); + + UserDetailResponse userDetailResponseFather = searchUser(userUtils.getStateLevelTenant(tenantId),accountIdFather,null); + UserDetailResponse userDetailResponseMother = searchUser(userUtils.getStateLevelTenant(tenantId),accountIdMother,null); + if(userDetailResponseFather.getUser().isEmpty()) + throw new CustomException("INVALID_ACCOUNTID","No user exist for the given accountId"); + + else application.getFather().setUuid(userDetailResponseFather.getUser().get(0).getUuid()); + + if(userDetailResponseMother.getUser().isEmpty()) + throw new CustomException("INVALID_ACCOUNTID","No user exist for the given accountId"); + + else application.getMother().setUuid(userDetailResponseMother.getUser().get(0).getUuid()); + + } + + /** + * Creates the user from the given userInfo by calling user service + * @param requestInfo + * @param tenantId + * @param userInfo + * @return + */ + private User createUser(RequestInfo requestInfo,String tenantId, User userInfo) { + + userUtils.addUserDefaultFields(userInfo.getMobileNumber(),tenantId, userInfo); + StringBuilder uri = new StringBuilder(config.getUserHost()) + .append(config.getUserContextPath()) + .append(config.getUserCreateEndpoint()); + + CreateUserRequest user = new CreateUserRequest(requestInfo, userInfo); + log.info(user.getUser().toString()); + UserDetailResponse userDetailResponse = userUtils.userCall(user, uri); + + return userDetailResponse.getUser().get(0); + + } + + /** + * Updates the given user by calling user service + * @param requestInfo + * @param user + * @param userFromSearch + * @return + */ + private User updateUser(RequestInfo requestInfo,User user,User userFromSearch) { + + userFromSearch.setName(user.getName()); + + StringBuilder uri = new StringBuilder(config.getUserHost()) + .append(config.getUserContextPath()) + .append(config.getUserUpdateEndpoint()); + + + UserDetailResponse userDetailResponse = userUtils.userCall(new CreateUserRequest(requestInfo, userFromSearch), uri); + + return userDetailResponse.getUser().get(0); + + } + + /** + * calls the user search API based on the given accountId and userName + * @param stateLevelTenant + * @param accountId + * @param userName + * @return + */ + public UserDetailResponse searchUser(String stateLevelTenant, String accountId, String userName){ + + UserSearchRequest userSearchRequest =new UserSearchRequest(); + userSearchRequest.setActive(true); +// userSearchRequest.setUserType("CITIZEN"); + userSearchRequest.setTenantId(stateLevelTenant); + + if(StringUtils.isEmpty(accountId) && StringUtils.isEmpty(userName)) + return null; + + if(!StringUtils.isEmpty(accountId)) + userSearchRequest.setUuid(Collections.singletonList(accountId)); + + if(!StringUtils.isEmpty(userName)) + userSearchRequest.setUserName(userName); + + StringBuilder uri = new StringBuilder(config.getUserHost()).append(config.getUserSearchEndpoint()); + return userUtils.userCall(userSearchRequest,uri); + + } + + /** + * calls the user search API based on the given list of user uuids + * @param uuids + * @return + */ + private Map searchBulkUser(List uuids){ + + UserSearchRequest userSearchRequest =new UserSearchRequest(); + userSearchRequest.setActive(true); + userSearchRequest.setUserType("CITIZEN"); + + + if(!CollectionUtils.isEmpty(uuids)) + userSearchRequest.setUuid(uuids); + + + StringBuilder uri = new StringBuilder(config.getUserHost()).append(config.getUserSearchEndpoint()); + UserDetailResponse userDetailResponse = userUtils.userCall(userSearchRequest,uri); + List users = userDetailResponse.getUser(); + + if(CollectionUtils.isEmpty(users)) + throw new CustomException("USER_NOT_FOUND","No user found for the uuids"); + + Map idToUserMap = users.stream().collect(Collectors.toMap(User::getUuid, Function.identity())); + + return idToUserMap; + } + +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/WorkflowService.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/WorkflowService.java new file mode 100644 index 00000000000..6911ce613f1 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/service/WorkflowService.java @@ -0,0 +1,151 @@ +package digit.service; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.config.BTRConfiguration; +import digit.repository.ServiceRequestRepository; +import digit.web.models.*; +import lombok.extern.slf4j.Slf4j; +import org.egov.common.contract.models.Workflow; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.models.RequestInfoWrapper; +import org.egov.common.contract.request.User; +import org.egov.common.contract.workflow.*; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +@Component +@Slf4j +public class WorkflowService { + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository repository; + + @Autowired + private BTRConfiguration config; + + public void updateWorkflowStatus(BirthRegistrationRequest birthRegistrationRequest) { + birthRegistrationRequest.getBirthRegistrationApplications().forEach(application -> { + ProcessInstance processInstance = getProcessInstanceForBTR(application, birthRegistrationRequest.getRequestInfo()); + ProcessInstanceRequest workflowRequest = new ProcessInstanceRequest(birthRegistrationRequest.getRequestInfo(), Collections.singletonList(processInstance)); + callWorkFlow(workflowRequest); + }); + } + + public State callWorkFlow(ProcessInstanceRequest workflowReq) { + + ProcessInstanceResponse response = null; + StringBuilder url = new StringBuilder(config.getWfHost().concat(config.getWfTransitionPath())); + Object optional = repository.fetchResult(url, workflowReq); + response = mapper.convertValue(optional, ProcessInstanceResponse.class); + return response.getProcessInstances().get(0).getState(); + } + + private ProcessInstance getProcessInstanceForBTR(BirthRegistrationApplication application, RequestInfo requestInfo) { + Workflow workflow = application.getWorkflow(); + + ProcessInstance processInstance = new ProcessInstance(); + processInstance.setBusinessId(application.getApplicationNumber()); + processInstance.setAction(workflow.getAction()); + processInstance.setModuleName("birth-services"); + processInstance.setTenantId(application.getTenantId()); + processInstance.setBusinessService("BTR"); + processInstance.setDocuments(workflow.getDocuments()); + processInstance.setComment(workflow.getComments()); + + if(!CollectionUtils.isEmpty(workflow.getAssignes())){ + List users = new ArrayList<>(); + + workflow.getAssignes().forEach(uuid -> { + User user = new User(); + user.setUuid(uuid); + users.add(user); + }); + + processInstance.setAssignes(users); + } + + return processInstance; + + } + + public ProcessInstance getCurrentWorkflow(RequestInfo requestInfo, String tenantId, String businessId) { + + RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); + + StringBuilder url = getSearchURLWithParams(tenantId, businessId); + + Object res = repository.fetchResult(url, requestInfoWrapper); + ProcessInstanceResponse response = null; + + try{ + response = mapper.convertValue(res, ProcessInstanceResponse.class); + } + catch (Exception e){ + throw new CustomException("PARSING_ERROR","Failed to parse workflow search response"); + } + + if(response!=null && !CollectionUtils.isEmpty(response.getProcessInstances()) && response.getProcessInstances().get(0)!=null) + return response.getProcessInstances().get(0); + + return null; + } + + private BusinessService getBusinessService(BirthRegistrationApplication application, RequestInfo requestInfo) { + String tenantId = application.getTenantId(); + StringBuilder url = getSearchURLWithParams(tenantId, "BTR"); + RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); + Object result = repository.fetchResult(url, requestInfoWrapper); + BusinessServiceResponse response = null; + try { + response = mapper.convertValue(result, BusinessServiceResponse.class); + } catch (IllegalArgumentException e) { + throw new CustomException("PARSING ERROR", "Failed to parse response of workflow business service search"); + } + + if (CollectionUtils.isEmpty(response.getBusinessServices())) + throw new CustomException("BUSINESSSERVICE_NOT_FOUND", "The businessService " + "BTR" + " is not found"); + + return response.getBusinessServices().get(0); + } + + private StringBuilder getSearchURLWithParams(String tenantId, String businessService) { + + StringBuilder url = new StringBuilder(config.getWfHost()); + url.append(config.getWfBusinessServiceSearchPath()); + url.append("?tenantId="); + url.append(tenantId); + url.append("&businessServices="); + url.append(businessService); + return url; + } + + public ProcessInstanceRequest getProcessInstanceForBirthRegistrationPayment(BirthRegistrationRequest updateRequest) { + + BirthRegistrationApplication application = updateRequest.getBirthRegistrationApplications().get(0); + + ProcessInstance process = ProcessInstance.builder() + .businessService("BTR") + .businessId(application.getApplicationNumber()) + .comment("Payment for birth registration processed") + .moduleName("birth-services") + .tenantId(application.getTenantId()) + .action("PAY") + .build(); + + return ProcessInstanceRequest.builder() + .requestInfo(updateRequest.getRequestInfo()) + .processInstances(Arrays.asList(process)) + .build(); + + } +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/IdgenUtil.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/IdgenUtil.java new file mode 100644 index 00000000000..650af00bde8 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/IdgenUtil.java @@ -0,0 +1,51 @@ +package digit.util; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.repository.ServiceRequestRepository; +import digit.config.Configuration; +import org.egov.common.contract.idgen.IdGenerationRequest; +import org.egov.common.contract.idgen.IdGenerationResponse; +import org.egov.common.contract.idgen.IdRequest; +import org.egov.common.contract.idgen.IdResponse; +import org.egov.common.contract.request.RequestInfo; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import static digit.config.ServiceConstants.*; + +@Component +public class IdgenUtil { + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository restRepo; + + @Autowired + private Configuration configs; + + public List getIdList(RequestInfo requestInfo, String tenantId, String idName, String idformat, Integer count) { + List reqList = new ArrayList<>(); + for (int i = 0; i < count; i++) { + reqList.add(IdRequest.builder().idName(idName).format(idformat).tenantId(tenantId).build()); + } + + IdGenerationRequest request = IdGenerationRequest.builder().idRequests(reqList).requestInfo(requestInfo).build(); + StringBuilder uri = new StringBuilder(configs.getIdGenHost()).append(configs.getIdGenPath()); + IdGenerationResponse response = mapper.convertValue(restRepo.fetchResult(uri, request), IdGenerationResponse.class); + + List idResponses = response.getIdResponses(); + + if (CollectionUtils.isEmpty(idResponses)) + throw new CustomException(IDGEN_ERROR, NO_IDS_FOUND_ERROR); + + return idResponses.stream().map(IdResponse::getId).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/MdmsUtil.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/MdmsUtil.java new file mode 100644 index 00000000000..5db8d2c4f1d --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/MdmsUtil.java @@ -0,0 +1,81 @@ +package digit.util; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.config.Configuration; +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; +import org.egov.common.contract.request.RequestInfo; +import org.egov.mdms.model.*; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static digit.config.ServiceConstants.*; + +@Slf4j +@Component +public class MdmsUtil { + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private Configuration configs; + + + + + public Map> fetchMdmsData(RequestInfo requestInfo, String tenantId, String moduleName, + List masterNameList) { + StringBuilder uri = new StringBuilder(); + uri.append(configs.getMdmsHost()).append(configs.getMdmsEndPoint()); + MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequest(requestInfo, tenantId, moduleName, masterNameList); + Object response = new HashMap<>(); + Integer rate = 0; + MdmsResponse mdmsResponse = new MdmsResponse(); + try { + response = restTemplate.postForObject(uri.toString(), mdmsCriteriaReq, Map.class); + mdmsResponse = mapper.convertValue(response, MdmsResponse.class); + }catch(Exception e) { + log.error(ERROR_WHILE_FETCHING_FROM_MDMS,e); + } + + return mdmsResponse.getMdmsRes(); + //log.info(ulbToCategoryListMap.toString()); + } + + private MdmsCriteriaReq getMdmsRequest(RequestInfo requestInfo, String tenantId, + String moduleName, List masterNameList) { + List masterDetailList = new ArrayList<>(); + for(String masterName: masterNameList) { + MasterDetail masterDetail = new MasterDetail(); + masterDetail.setName(masterName); + masterDetailList.add(masterDetail); + } + + ModuleDetail moduleDetail = new ModuleDetail(); + moduleDetail.setMasterDetails(masterDetailList); + moduleDetail.setModuleName(moduleName); + List moduleDetailList = new ArrayList<>(); + moduleDetailList.add(moduleDetail); + + MdmsCriteria mdmsCriteria = new MdmsCriteria(); + mdmsCriteria.setTenantId(tenantId.split("\\.")[0]); + mdmsCriteria.setModuleDetails(moduleDetailList); + + MdmsCriteriaReq mdmsCriteriaReq = new MdmsCriteriaReq(); + mdmsCriteriaReq.setMdmsCriteria(mdmsCriteria); + mdmsCriteriaReq.setRequestInfo(requestInfo); + + return mdmsCriteriaReq; + } +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/ResponseInfoFactory.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/ResponseInfoFactory.java new file mode 100644 index 00000000000..3f02b2e71cd --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/ResponseInfoFactory.java @@ -0,0 +1,27 @@ +package digit.util; + +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.stereotype.Component; + +import static digit.config.ServiceConstants.*; + +@Component +public class ResponseInfoFactory { + + public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { + + final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; + final String ver = requestInfo != null ? requestInfo.getVer() : ""; + Long ts = null; + if(requestInfo!=null) + ts = requestInfo.getTs(); + final String resMsgId = RES_MSG_ID; // FIXME : Hard-coded + final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; + final String responseStatus = success ? SUCCESSFUL : FAILED; + + return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) + .status(responseStatus).build(); + } + +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/UrlShortenerUtil.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/UrlShortenerUtil.java new file mode 100644 index 00000000000..efb4d3d3fa3 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/UrlShortenerUtil.java @@ -0,0 +1,39 @@ +package digit.util; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; +import java.util.HashMap; +import digit.config.Configuration; +import static digit.config.ServiceConstants.*; + +@Slf4j +@Component +public class UrlShortenerUtil { + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private Configuration configs; + + + public String getShortenedUrl(String url){ + + HashMap body = new HashMap<>(); + body.put(URL,url); + StringBuilder builder = new StringBuilder(configs.getUrlShortnerHost()); + builder.append(configs.getUrlShortnerEndpoint()); + String res = restTemplate.postForObject(builder.toString(), body, String.class); + + if(StringUtils.isEmpty(res)){ + log.error(URL_SHORTENING_ERROR_CODE, URL_SHORTENING_ERROR_MESSAGE + url); ; + return url; + } + else return res; + } + + +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/UserUtil.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/UserUtil.java new file mode 100644 index 00000000000..beac89ddcf4 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/UserUtil.java @@ -0,0 +1,134 @@ +package digit.util; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.config.Configuration; +import static digit.config.ServiceConstants.*; +import org.egov.common.contract.request.Role; +import org.egov.common.contract.request.User; +import org.egov.common.contract.user.UserDetailResponse; +import org.egov.common.contract.user.enums.UserType; +import digit.repository.ServiceRequestRepository; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +@Component +public class UserUtil { + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository serviceRequestRepository; + + @Autowired + private Configuration configs; + + + @Autowired + public UserUtil(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepository) { + this.mapper = mapper; + this.serviceRequestRepository = serviceRequestRepository; + } + + /** + * Returns UserDetailResponse by calling user service with given uri and object + * @param userRequest Request object for user service + * @param uri The address of the endpoint + * @return Response from user service as parsed as userDetailResponse + */ + + public UserDetailResponse userCall(Object userRequest, StringBuilder uri) { + String dobFormat = null; + if(uri.toString().contains(configs.getUserSearchEndpoint()) || uri.toString().contains(configs.getUserUpdateEndpoint())) + dobFormat=DOB_FORMAT_Y_M_D; + else if(uri.toString().contains(configs.getUserCreateEndpoint())) + dobFormat = DOB_FORMAT_D_M_Y; + try{ + LinkedHashMap responseMap = (LinkedHashMap)serviceRequestRepository.fetchResult(uri, userRequest); + parseResponse(responseMap,dobFormat); + UserDetailResponse userDetailResponse = mapper.convertValue(responseMap,UserDetailResponse.class); + return userDetailResponse; + } + catch(IllegalArgumentException e) + { + throw new CustomException(ILLEGAL_ARGUMENT_EXCEPTION_CODE,OBJECTMAPPER_UNABLE_TO_CONVERT); + } + } + + + /** + * Parses date formats to long for all users in responseMap + * @param responseMap LinkedHashMap got from user api response + */ + + public void parseResponse(LinkedHashMap responseMap, String dobFormat){ + List users = (List)responseMap.get(USER); + String format1 = DOB_FORMAT_D_M_Y_H_M_S; + if(users!=null){ + users.forEach( map -> { + map.put(CREATED_DATE,dateTolong((String)map.get(CREATED_DATE),format1)); + if((String)map.get(LAST_MODIFIED_DATE)!=null) + map.put(LAST_MODIFIED_DATE,dateTolong((String)map.get(LAST_MODIFIED_DATE),format1)); + if((String)map.get(DOB)!=null) + map.put(DOB,dateTolong((String)map.get(DOB),dobFormat)); + if((String)map.get(PWD_EXPIRY_DATE)!=null) + map.put(PWD_EXPIRY_DATE,dateTolong((String)map.get(PWD_EXPIRY_DATE),format1)); + } + ); + } + } + + /** + * Converts date to long + * @param date date to be parsed + * @param format Format of the date + * @return Long value of date + */ + private Long dateTolong(String date,String format){ + SimpleDateFormat f = new SimpleDateFormat(format); + Date d = null; + try { + d = f.parse(date); + } catch (ParseException e) { + throw new CustomException(INVALID_DATE_FORMAT_CODE,INVALID_DATE_FORMAT_MESSAGE); + } + return d.getTime(); + } + + /** + * enriches the userInfo with statelevel tenantId and other fields + * The function creates user with username as mobile number. + * @param mobileNumber + * @param tenantId + * @param userInfo + */ + public void addUserDefaultFields(String mobileNumber,String tenantId, User userInfo){ + Role role = getCitizenRole(tenantId); + userInfo.setMobileNumber(mobileNumber); + userInfo.setTenantId(getStateLevelTenant(tenantId)); + userInfo.setType("CITIZEN"); + } + + /** + * Returns role object for citizen + * @param tenantId + * @return + */ + private Role getCitizenRole(String tenantId){ + Role role = Role.builder().build(); + role.setCode(CITIZEN_UPPER); + role.setName(CITIZEN_LOWER); + role.setTenantId(getStateLevelTenant(tenantId)); + return role; + } + + public String getStateLevelTenant(String tenantId){ + return tenantId.split("\\.")[0]; + } + +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/WorkflowUtil.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/WorkflowUtil.java new file mode 100644 index 00000000000..ed996e01813 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/util/WorkflowUtil.java @@ -0,0 +1,172 @@ +package digit.util; + +import com.fasterxml.jackson.databind.ObjectMapper; +import digit.config.Configuration; +import static digit.config.ServiceConstants.*; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.request.User; +import org.egov.common.contract.workflow.*; +import org.egov.common.contract.models.*; +import digit.repository.ServiceRequestRepository; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class WorkflowUtil { + + @Autowired + private ServiceRequestRepository repository; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private Configuration configs; + + + + /** + * Searches the BussinessService corresponding to the businessServiceCode + * Returns applicable BussinessService for the given parameters + * @param requestInfo + * @param tenantId + * @param businessServiceCode + * @return + */ + public BusinessService getBusinessService(RequestInfo requestInfo, String tenantId, String businessServiceCode) { + + StringBuilder url = getSearchURLWithParams(tenantId, businessServiceCode); + RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); + Object result = repository.fetchResult(url, requestInfoWrapper); + BusinessServiceResponse response = null; + try { + response = mapper.convertValue(result, BusinessServiceResponse.class); + } catch (IllegalArgumentException e) { + throw new CustomException(PARSING_ERROR, FAILED_TO_PARSE_BUSINESS_SERVICE_SEARCH); + } + + if (CollectionUtils.isEmpty(response.getBusinessServices())) + throw new CustomException(BUSINESS_SERVICE_NOT_FOUND, THE_BUSINESS_SERVICE + businessServiceCode + NOT_FOUND); + + return response.getBusinessServices().get(0); + } + + /** + * Calls the workflow service with the given action and updates the status + * Returns the updated status of the application + * @param requestInfo + * @param tenantId + * @param businessId + * @param businessServiceCode + * @param workflow + * @param wfModuleName + * @return + */ + public String updateWorkflowStatus(RequestInfo requestInfo, String tenantId, + String businessId, String businessServiceCode, Workflow workflow, String wfModuleName) { + ProcessInstance processInstance = getProcessInstanceForWorkflow(requestInfo, tenantId, businessId, + businessServiceCode, workflow, wfModuleName); + ProcessInstanceRequest workflowRequest = new ProcessInstanceRequest(requestInfo, Collections.singletonList(processInstance)); + State state = callWorkFlow(workflowRequest); + + return state.getApplicationStatus(); + } + + /** + * Creates url for search based on given tenantId and businessServices + * @param tenantId + * @param businessService + * @return + */ + private StringBuilder getSearchURLWithParams(String tenantId, String businessService) { + StringBuilder url = new StringBuilder(configs.getWfHost()); + url.append(configs.getWfBusinessServiceSearchPath()); + url.append(TENANTID); + url.append(tenantId); + url.append(BUSINESS_SERVICES); + url.append(businessService); + return url; + } + + /** + * Enriches ProcessInstance Object for Workflow + * @param requestInfo + * @param tenantId + * @param businessId + * @param businessServiceCode + * @param workflow + * @param wfModuleName + * @return + */ + private ProcessInstance getProcessInstanceForWorkflow(RequestInfo requestInfo, String tenantId, + String businessId, String businessServiceCode, Workflow workflow, String wfModuleName) { + + ProcessInstance processInstance = new ProcessInstance(); + processInstance.setBusinessId(businessId); + processInstance.setAction(workflow.getAction()); + processInstance.setModuleName(wfModuleName); + processInstance.setTenantId(tenantId); + processInstance.setBusinessService(getBusinessService(requestInfo, tenantId, businessServiceCode).getBusinessService()); + processInstance.setComment(workflow.getComments()); + + if(!CollectionUtils.isEmpty(workflow.getAssignes())) { + List users = new ArrayList<>(); + + workflow.getAssignes().forEach(uuid -> { + User user = new User(); + user.setUuid(uuid); + users.add(user); + }); + + processInstance.setAssignes(users); + } + + return processInstance; + } + + /** + * Gets the workflow corresponding to the processInstance + * @param processInstances + * @return + */ + public Map getWorkflow(List processInstances) { + + Map businessIdToWorkflow = new HashMap<>(); + + processInstances.forEach(processInstance -> { + List userIds = null; + + if(!CollectionUtils.isEmpty(processInstance.getAssignes())){ + userIds = processInstance.getAssignes().stream().map(User::getUuid).collect(Collectors.toList()); + } + + Workflow workflow = Workflow.builder() + .action(processInstance.getAction()) + .assignes(userIds) + .comments(processInstance.getComment()) + .build(); + + businessIdToWorkflow.put(processInstance.getBusinessId(), workflow); + }); + + return businessIdToWorkflow; + } + + /** + * Method to take the ProcessInstanceRequest as parameter and set resultant status + * @param workflowReq + * @return + */ + private State callWorkFlow(ProcessInstanceRequest workflowReq) { + ProcessInstanceResponse response = null; + StringBuilder url = new StringBuilder(configs.getWfHost().concat(configs.getWfTransitionPath())); + Object optional = repository.fetchResult(url, workflowReq); + response = mapper.convertValue(optional, ProcessInstanceResponse.class); + return response.getProcessInstances().get(0).getState(); + } +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/validators/BirthApplicationValidator.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/validators/BirthApplicationValidator.java new file mode 100644 index 00000000000..8162f4c0cf3 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/validators/BirthApplicationValidator.java @@ -0,0 +1,28 @@ +package digit.validators; + +import digit.repository.BirthRegistrationRepository; +import digit.web.models.BirthApplicationSearchCriteria; +import digit.web.models.BirthRegistrationApplication; +import digit.web.models.BirthRegistrationRequest; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +@Component +public class BirthApplicationValidator { + + @Autowired + private BirthRegistrationRepository repository; + + public void validateBirthApplication(BirthRegistrationRequest birthRegistrationRequest) { + birthRegistrationRequest.getBirthRegistrationApplications().forEach(application -> { + if(ObjectUtils.isEmpty(application.getTenantId())) + throw new CustomException("EG_BT_APP_ERR", "tenantId is mandatory for creating birth registration applications"); + }); + } + + public BirthRegistrationApplication validateApplicationExistence(BirthRegistrationApplication birthRegistrationApplication) { + return repository.getApplications(BirthApplicationSearchCriteria.builder().applicationNumber(birthRegistrationApplication.getApplicationNumber()).build()).get(0); + } +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/controllers/BirthApiController.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/controllers/BirthApiController.java new file mode 100644 index 00000000000..eedebf5f704 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/controllers/BirthApiController.java @@ -0,0 +1,74 @@ +package digit.web.controllers; + + +import digit.service.BirthRegistrationService; +import digit.util.ResponseInfoFactory; +import digit.web.models.*; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestMapping; +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +import jakarta.validation.Valid; +import jakarta.servlet.http.HttpServletRequest; + + +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2024-03-07T11:10:12.732364039+05:30[Asia/Kolkata]") +@Controller + @RequestMapping("") + public class BirthApiController{ + + private final ObjectMapper objectMapper; + + private final HttpServletRequest request; + + private BirthRegistrationService birthRegistrationService; + + @Autowired + private ResponseInfoFactory responseInfoFactory; + + @Autowired + public BirthApiController(ObjectMapper objectMapper, HttpServletRequest request, BirthRegistrationService birthRegistrationService) { + this.objectMapper = objectMapper; + this.request = request; + this.birthRegistrationService = birthRegistrationService; + } + + @RequestMapping(value="/registration/v1/_create", method = RequestMethod.POST) + public ResponseEntity v1RegistrationCreatePost(@ApiParam(value = "Details for the new Birth Registration Application(s) + RequestInfo meta data." ,required=true ) @Valid @RequestBody BirthRegistrationRequest birthRegistrationRequest) { + List applications = birthRegistrationService.registerBtRequest(birthRegistrationRequest); + ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(birthRegistrationRequest.getRequestInfo(), true); + BirthRegistrationResponse response = BirthRegistrationResponse.builder().birthRegistrationApplications(applications).responseInfo(responseInfo).build(); + return new ResponseEntity<>(response, HttpStatus.OK); + } + + @RequestMapping(value="/v1/registration/_search", method = RequestMethod.POST) + public ResponseEntity v1RegistrationSearchPost(@ApiParam(value = "Details for the new Birth Registration Application(s) + RequestInfo meta data." ,required=true ) @Valid @RequestBody BirthApplicationSearchRequest birthApplicationSearchRequest) { + List applications = birthRegistrationService.searchBtApplications(birthApplicationSearchRequest.getRequestInfo(), birthApplicationSearchRequest.getBirthApplicationSearchCriteria()); + ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(birthApplicationSearchRequest.getRequestInfo(), true); + BirthRegistrationResponse response = BirthRegistrationResponse.builder().birthRegistrationApplications(applications).responseInfo(responseInfo).build(); + return new ResponseEntity<>(response,HttpStatus.OK); + } + + @RequestMapping(value="/registration/v1/_update", method = RequestMethod.POST) + public ResponseEntity v1RegistrationUpdatePost(@ApiParam(value = "Details for the new (s) + RequestInfo meta data." ,required=true ) @Valid @RequestBody BirthRegistrationRequest birthRegistrationRequest) { + BirthRegistrationApplication application = birthRegistrationService.updateBtApplication(birthRegistrationRequest); + ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(birthRegistrationRequest.getRequestInfo(), true); + BirthRegistrationResponse response = BirthRegistrationResponse.builder().birthRegistrationApplications(Collections.singletonList(application)).responseInfo(responseInfo).build(); + return new ResponseEntity<>(response, HttpStatus.OK); + } + + + } diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthApplicationAddress.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthApplicationAddress.java new file mode 100644 index 00000000000..725e6105be3 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthApplicationAddress.java @@ -0,0 +1,47 @@ +package digit.web.models; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.UUID; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; +import org.egov.common.contract.models.Address; + +/** + * BirthApplicationAddress + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2024-03-07T11:10:12.732364039+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthApplicationAddress { + @JsonProperty("id") + + @Valid + private String id = null; + + @JsonProperty("tenantId") + @NotNull + + @Size(min=2,max=64) private String tenantId = null; + + @JsonProperty("applicationNumber") + + private String applicationNumber = null; + + @JsonProperty("applicantAddress") + + @Valid + private Address applicantAddress = null; + + +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthApplicationSearchCriteria.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthApplicationSearchCriteria.java new file mode 100644 index 00000000000..854b7697ee6 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthApplicationSearchCriteria.java @@ -0,0 +1,53 @@ +package digit.web.models; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.ArrayList; +import java.util.List; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BirthApplicationSearchCriteria + */ +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2024-03-07T11:10:12.732364039+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthApplicationSearchCriteria { + @JsonProperty("tenantId") + @NotNull + + private String tenantId = null; + + @JsonProperty("status") + + private String status = null; + + @JsonProperty("ids") + + @Size(max=50) private List ids = null; + + @JsonProperty("applicationNumber") + + @Size(min=2,max=64) private String applicationNumber = null; + + + public BirthApplicationSearchCriteria addIdsItem(String idsItem) { + if (this.ids == null) { + this.ids = new ArrayList<>(); + } + this.ids.add(idsItem); + return this; + } + +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthApplicationSearchRequest.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthApplicationSearchRequest.java new file mode 100644 index 00000000000..523211d8fa0 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthApplicationSearchRequest.java @@ -0,0 +1,31 @@ +package digit.web.models; +import com.fasterxml.jackson.annotation.JsonProperty; + +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * BirthApplicationSearchCriteria + */ +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthApplicationSearchRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("BirthApplicationSearchCriteria") + @Valid + private BirthApplicationSearchCriteria birthApplicationSearchCriteria = null; + +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthRegistrationApplication.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthRegistrationApplication.java new file mode 100644 index 00000000000..d395a65ef39 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthRegistrationApplication.java @@ -0,0 +1,99 @@ +package digit.web.models; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import digit.web.models.BirthApplicationAddress; +import io.swagger.v3.oas.annotations.media.Schema; +import org.egov.common.contract.models.AuditDetails; +import org.egov.common.contract.models.Workflow; +import org.egov.common.contract.request.User; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * A Object holds the basic data for a Birth Registration Application + */ +@Schema(description = "A Object holds the basic data for a Birth Registration Application") +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2024-03-07T11:10:12.732364039+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthRegistrationApplication { + @JsonProperty("id") + + @Size(min=2,max=64) private String id = null; + + @JsonProperty("tenantId") + @NotNull + + @Size(min=2,max=128) private String tenantId = null; + + @JsonProperty("applicationNumber") + + @Size(min=2,max=128) private String applicationNumber = null; + + @JsonProperty("babyFirstName") + @NotNull + + @Size(min=2,max=128) private String babyFirstName = null; + + @JsonProperty("babyLastName") + + @Size(min=2,max=128) private String babyLastName = null; + + @JsonProperty("father") + @NotNull + + @Valid + private User father = null; + + @JsonProperty("mother") + @NotNull + + @Valid + private User mother = null; + + @JsonProperty("doctorName") + @NotNull + + @Size(min=2,max=128) private String doctorName = null; + + @JsonProperty("hospitalName") + @NotNull + + @Size(min=2,max=128) private String hospitalName = null; + + @JsonProperty("placeOfBirth") + @NotNull + + @Size(min=2,max=128) private String placeOfBirth = null; + + @JsonProperty("timeOfBirth") + + private Integer timeOfBirth = null; + + @JsonProperty("address") + + @Valid + private BirthApplicationAddress address = null; + + @JsonProperty("workflow") + + @Valid + private Workflow workflow = null; + + @JsonProperty("auditDetails") + + @Valid + private AuditDetails auditDetails = null; + + +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthRegistrationRequest.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthRegistrationRequest.java new file mode 100644 index 00000000000..a5a6bd80ac5 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthRegistrationRequest.java @@ -0,0 +1,49 @@ +package digit.web.models; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import digit.web.models.BirthRegistrationApplication; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.ArrayList; +import java.util.List; + +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * Contract class to receive request. Array of items are used in case of create, whereas single item is used for update + */ +@Schema(description = "Contract class to receive request. Array of items are used in case of create, whereas single item is used for update") +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2024-03-07T11:10:12.732364039+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthRegistrationRequest { + @JsonProperty("RequestInfo") + + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("BirthRegistrationApplications") + @Valid + private List birthRegistrationApplications = null; + + + public BirthRegistrationRequest addBirthRegistrationApplicationsItem(BirthRegistrationApplication birthRegistrationApplicationsItem) { + if (this.birthRegistrationApplications == null) { + this.birthRegistrationApplications = new ArrayList<>(); + } + this.birthRegistrationApplications.add(birthRegistrationApplicationsItem); + return this; + } + +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthRegistrationResponse.java b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthRegistrationResponse.java new file mode 100644 index 00000000000..720a49bbd99 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/java/digit/web/models/BirthRegistrationResponse.java @@ -0,0 +1,49 @@ +package digit.web.models; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import digit.web.models.BirthRegistrationApplication; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.ArrayList; +import java.util.List; + +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Data; +import lombok.Builder; + +/** + * Contract class to send response. Array of items are used in case of search results or response for create, whereas single item is used for update + */ +@Schema(description = "Contract class to send response. Array of items are used in case of search results or response for create, whereas single item is used for update") +@Validated +@jakarta.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2024-03-07T11:10:12.732364039+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BirthRegistrationResponse { + @JsonProperty("ResponseInfo") + + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("BirthRegistrationApplications") + @Valid + private List birthRegistrationApplications = null; + + + public BirthRegistrationResponse addBirthRegistrationApplicationsItem(BirthRegistrationApplication birthRegistrationApplicationsItem) { + if (this.birthRegistrationApplications == null) { + this.birthRegistrationApplications = new ArrayList<>(); + } + this.birthRegistrationApplications.add(birthRegistrationApplicationsItem); + return this; + } + +} diff --git a/tutorials/backend-developer-guide/btr-service/src/main/resources/application.properties b/tutorials/backend-developer-guide/btr-service/src/main/resources/application.properties new file mode 100644 index 00000000000..f14edf76579 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/resources/application.properties @@ -0,0 +1,92 @@ +server.contextPath=/birth +server.servlet.context-path=/birth +server.port=8080 +app.timezone=UTC + +#DATABASE CONFIGURATION +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/asdfg +spring.datasource.username=postgres +spring.datasource.password=1234 + +#FLYWAY CONFIGURATION +spring.flyway.url=jdbc:postgresql://localhost:5432/asdfg +spring.flyway.user=postgres +spring.flyway.password=1234 +spring.flyway.table=public +spring.flyway.baseline-on-migrate=true +spring.flyway.outOfOrder=true +spring.flyway.locations=classpath:/db/migration/main +spring.flyway.enabled=true + +# KAFKA SERVER CONFIGURATIONS +kafka.config.bootstrap_server_config=localhost:9092 +spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.group-id=birth-registration +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.listener.missing-topics-fatal=false +spring.kafka.consumer.properties.spring.json.use.type.headers=false + +# KAFKA CONSUMER CONFIGURATIONS +kafka.consumer.config.auto_commit=true +kafka.consumer.config.auto_commit_interval=100 +kafka.consumer.config.session_timeout=15000 +kafka.consumer.config.auto_offset_reset=earliest +# KAFKA PRODUCER CONFIGURATIONS +kafka.producer.config.retries_config=0 +kafka.producer.config.batch_size_config=16384 +kafka.producer.config.linger_ms_config=1 +kafka.producer.config.buffer_memory_config=33554432 + +# Birth registration Kafka config +btr.kafka.create.topic=save-bt-application +btr.kafka.update.topic=update-bt-application +btr.default.offset=0 +btr.default.limit=10 +btr.search.max.limit=50 + +#Localization config +egov.localization.host=https://dev.digit.org +egov.localization.workDir.path=/localization/messages/v1 +egov.localization.context.path=/localization/messages/v1 +egov.localization.search.endpoint=/_search +egov.localization.statelevel=true + +#mdms urls +egov.mdms.host=https://dev.digit.org +egov.mdms.search.endpoint=/egov-mdms-service/v1/_search + +#hrms urls +egov.hrms.host=https://dev.digit.org +egov.hrms.search.endpoint=/egov-hrms/employees/_search + +#User config +egov.user.host=http://localhost:8081 +egov.user.context.path=/user/users +egov.user.create.path=/_createnovalidate +egov.user.search.path=/user/_search +egov.user.update.path=/_updatenovalidate + +#Idgen Config +egov.idgen.host=http://localhost:8085/ +egov.idgen.path=egov-idgen/id/_generate + + +#Workflow config +is.workflow.enabled=true +egov.workflow.host=https://dev.digit.org +egov.workflow.transition.path=/egov-workflow-v2/egov-wf/process/_transition +egov.workflow.businessservice.search.path=/egov-workflow-v2/egov-wf/businessservice/_search +egov.workflow.processinstance.search.path=/egov-workflow-v2/egov-wf/process/_search + +#url shortner +egov.url.shortner.host=https://dev.digit.org +egov.url.shortner.endpoint=/egov-url-shortening/shortener + +egov.sms.notification.topic=egov.core.notification.sms +kafka.topics.receipt.create=dss-collection + +# The value of the following field should be changed to service specific name +kafka.topics.consumer=service-consumer-topic \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/resources/btr-indexer.yaml b/tutorials/backend-developer-guide/btr-service/src/main/resources/btr-indexer.yaml new file mode 100644 index 00000000000..2f89930a127 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/resources/btr-indexer.yaml @@ -0,0 +1,47 @@ +ServiceMaps: + serviceName: Birth Registration Service + version: 1.0.0 + mappings: + - topic: save-bt-application + configKey: INDEX + indexes: + - name: btindex-v1 + type: _doc + id: $.id + isBulk: true + timeStampField: $.auditDetails.createdTime + jsonPath: $.BirthRegistrationApplications + customJsonMapping: + indexMapping: {"Data":{"birthapplication":{},"history":{}}} + fieldMapping: + - inJsonPath: $ + outJsonPath: $.Data.birthapplication + externalUriMapping: + - path: http://localhost:8282/egov-workflow-v2/egov-wf/process/_search + queryParam: businessIds=$.applicationNumber,history=true,tenantId=$.tenantId + apiRequest: {"RequestInfo":{"apiId":"org.egov.pt","ver":"1.0","ts":1502890899493,"action":"asd","did":"4354648646","key":"xyz","msgId":"654654","requesterId":"61","authToken":"d9994555-7656-4a67-ab3a-a952a0d4dfc8","userInfo":{"id":1,"uuid":"1fec8102-0e02-4d0a-b283-cd80d5dab067","type":"EMPLOYEE","tenantId":"pb.amritsar","roles":[{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"}]}}} + uriResponseMapping: + - inJsonPath: $.ProcessInstances + outJsonPath: $.Data.history + + - topic: update-bt-application + configKey: INDEX + indexes: + - name: btindex-v1 + type: _doc + id: $.id + isBulk: true + timeStampField: $.auditDetails.createdTime + jsonPath: $.BirthRegistrationApplications + customJsonMapping: + indexMapping: {"Data":{"birthapplication":{},"history":{}}} + fieldMapping: + - inJsonPath: $ + outJsonPath: $.Data.birthapplication + externalUriMapping: + - path: http://egov-workflow-v2.egov:8080/egov-workflow-v2/egov-wf/process/_search + queryParam: businessIds=$.applicationNumber,history=true,tenantId=$.tenantId + apiRequest: {"RequestInfo":{"apiId":"org.egov.pt","ver":"1.0","ts":1502890899493,"action":"asd","did":"4354648646","key":"xyz","msgId":"654654","requesterId":"61","authToken":"d9994555-7656-4a67-ab3a-a952a0d4dfc8","userInfo":{"id":1,"uuid":"1fec8102-0e02-4d0a-b283-cd80d5dab067","type":"EMPLOYEE","tenantId":"pb.amritsar","roles":[{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"}]}}} + uriResponseMapping: + - inJsonPath: $.ProcessInstances + outJsonPath: $.Data.history \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/resources/btr-persister.yaml b/tutorials/backend-developer-guide/btr-service/src/main/resources/btr-persister.yaml new file mode 100644 index 00000000000..fcd2799bb3c --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/resources/btr-persister.yaml @@ -0,0 +1,82 @@ +serviceMaps: + serviceName: btr-services + mappings: + - version: 1.0 + description: Persists birth details in tables + fromTopic: save-bt-application + isTransaction: true + queryMaps: + + - query: INSERT INTO eg_bt_registration(id,tenantid,applicationnumber,babyfirstname,babylastname,fatherid,motherid,doctorname,hospitalname,placeofbirth,timeofbirth,createdby,lastmodifiedby,createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?); + basePath: BirthRegistrationApplications.* + jsonMaps: + - jsonPath: $.BirthRegistrationApplications.*.id + + - jsonPath: $.BirthRegistrationApplications.*.tenantId + + - jsonPath: $.BirthRegistrationApplications.*.applicationNumber + + - jsonPath: $.BirthRegistrationApplications.*.babyFirstName + + - jsonPath: $.BirthRegistrationApplications.*.babyLastName + + - jsonPath: $.BirthRegistrationApplications.*.father.uuid + + - jsonPath: $.BirthRegistrationApplications.*.mother.uuid + + - jsonPath: $.BirthRegistrationApplications.*.doctorName + + - jsonPath: $.BirthRegistrationApplications.*.hospitalName + + - jsonPath: $.BirthRegistrationApplications.*.placeOfBirth + + - jsonPath: $.BirthRegistrationApplications.*.timeOfBirth + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdBy + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedBy + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdTime + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedTime + + - query: INSERT INTO eg_bt_address(id, tenantid, type, address, city, pincode, registrationid, createdby, lastmodifiedby, createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); + basePath: BirthRegistrationApplications.* + jsonMaps: + - jsonPath: $.BirthRegistrationApplications.*.address.id + + - jsonPath: $.BirthRegistrationApplications.*.address.tenantId + + - jsonPath: $.BirthRegistrationApplications.*.address.applicantAddress.type + + - jsonPath: $.BirthRegistrationApplications.*.address.applicantAddress.address + + - jsonPath: $.BirthRegistrationApplications.*.address.applicantAddress.city + + - jsonPath: $.BirthRegistrationApplications.*.address.applicantAddress.pincode + + - jsonPath: $.BirthRegistrationApplications.*.address.applicationNumber + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdBy + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedBy + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdTime + + - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedTime + + - version: 1.0 + description: Update birth registration applications in table + fromTopic: update-bt-application + isTransaction: true + queryMaps: + - query: UPDATE eg_bt_registration SET tenantid = ?,babyFirstName = ?, timeOfBirth = ? WHERE id=?; + basePath: BirthRegistrationApplications.* + jsonMaps: + - jsonPath: $.BirthRegistrationApplications.*.tenantId + + - jsonPath: $.BirthRegistrationApplications.*.babyFirstName + + - jsonPath: $.BirthRegistrationApplications.*.timeOfBirth + + - jsonPath: $.BirthRegistrationApplications.*.id \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/main/resources/db/migration/main/V20240307110535__birth_ddl.sql b/tutorials/backend-developer-guide/btr-service/src/main/resources/db/migration/main/V20240307110535__birth_ddl.sql new file mode 100644 index 00000000000..95f3a937bc9 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/main/resources/db/migration/main/V20240307110535__birth_ddl.sql @@ -0,0 +1,35 @@ +CREATE TABLE eg_bt_registration( + id character varying(64), + tenantId character varying(64), + applicationNumber character varying(64), + babyFirstName character varying(64), + babyLastName character varying(64), + fatherId character varying(64), + motherId character varying(64), + doctorName character varying(64), + hospitalName character varying(64), + placeOfBirth character varying(64), + timeOfBirth bigint, + createdBy character varying(64), + lastModifiedBy character varying(64), + createdTime bigint, + lastModifiedTime bigint, + CONSTRAINT uk_eg_bt_registration UNIQUE (id) +); +CREATE TABLE eg_bt_address( + id character varying(64), + tenantId character varying(64), + type character varying(64), + address character varying(256), + city character varying(64), + pincode character varying(64), + registrationId character varying(64), + createdBy character varying(64), + lastModifiedBy character varying(64), + createdTime bigint, + lastModifiedTime bigint, + CONSTRAINT uk_eg_bt_address PRIMARY KEY (id), + CONSTRAINT fk_eg_bt_address FOREIGN KEY (registrationId) REFERENCES eg_bt_registration (id) + ON UPDATE CASCADE + ON DELETE CASCADE +); \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/test/java/digit/TestConfiguration.java b/tutorials/backend-developer-guide/btr-service/src/test/java/digit/TestConfiguration.java new file mode 100644 index 00000000000..570236cfc94 --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/test/java/digit/TestConfiguration.java @@ -0,0 +1,16 @@ +package digit; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.kafka.core.KafkaTemplate; + +import static org.mockito.Mockito.mock; + +@Configuration +public class TestConfiguration { + @Bean + @SuppressWarnings("unchecked") + public KafkaTemplate kafkaTemplate() { + return mock(KafkaTemplate.class); + } +} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-service/src/test/java/digit/web/controllers/BirthApiControllerTest.java b/tutorials/backend-developer-guide/btr-service/src/test/java/digit/web/controllers/BirthApiControllerTest.java new file mode 100644 index 00000000000..7d1ef04dd5c --- /dev/null +++ b/tutorials/backend-developer-guide/btr-service/src/test/java/digit/web/controllers/BirthApiControllerTest.java @@ -0,0 +1,72 @@ +package digit.web.controllers; + +import org.junit.Test; +import org.junit.Ignore; +import org.junit.runner.RunWith; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.context.annotation.Import; +import org.springframework.http.MediaType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import digit.TestConfiguration; + +//import static org.mockito.Matchers.any; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +/** +* API tests for BirthApiController +*/ +@Ignore +@RunWith(SpringRunner.class) +@WebMvcTest(BirthApiController.class) +@Import(TestConfiguration.class) +public class BirthApiControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void birthRegistrationV1CreatePostSuccess() throws Exception { + mockMvc.perform(post("/birth/registration/v1/_create").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void birthRegistrationV1CreatePostFailure() throws Exception { + mockMvc.perform(post("/birth/registration/v1/_create").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + + @Test + public void birthRegistrationV1SearchPostSuccess() throws Exception { + mockMvc.perform(post("/birth/registration/v1/_search").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void birthRegistrationV1SearchPostFailure() throws Exception { + mockMvc.perform(post("/birth/registration/v1/_search").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + + @Test + public void birthRegistrationV1UpdatePostSuccess() throws Exception { + mockMvc.perform(post("/birth/registration/v1/_update").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void birthRegistrationV1UpdatePostFailure() throws Exception { + mockMvc.perform(post("/birth/registration/v1/_update").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + +} diff --git a/tutorials/backend-developer-guide/btr-services/README.md b/tutorials/backend-developer-guide/btr-services/README.md deleted file mode 100644 index 76cdd375214..00000000000 --- a/tutorials/backend-developer-guide/btr-services/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# Birth Registration Service - -This service is used to issue birth certificate. - -### Service Dependencies - -- egov-idgen -- egov-user -- egov-workflow -- btr-calculator - -### Swagger API Contract - -[API Contract](./birth-registration-api-spec.yaml) - -## Service Details - -The service is integrated with User service, IdGen service and -Workflow service to create, update and search a birth registration application. -It is also integrated with btr-calculator to calculate the amount to be -paid. - -### API Details - -`BasePath` /birth-registration/birth-services/v1/registration/[API endpoint] - -#### Method - -a) `_create` -- Creates birth registration application and return the application number - -b) `_update` -- Updates birth registration application based on application number - -c) `_search` -- Searches birth registration application based on application number - -### Kafka Consumers - -- Following are the Consumer topics. - - **kafka.topics.receipt.create** - - **btr.kafka.create.topic** - -### Kafka Producers - -- Following are the Producer topics. - - **save-bt-application** - - **update-bt-application** - diff --git a/tutorials/backend-developer-guide/btr-services/birth-certificate-pdf.json b/tutorials/backend-developer-guide/btr-services/birth-certificate-pdf.json deleted file mode 100644 index 823fe8ce302..00000000000 --- a/tutorials/backend-developer-guide/btr-services/birth-certificate-pdf.json +++ /dev/null @@ -1,527 +0,0 @@ -{ - "key": "birth-certificate", - "DataConfigs": { - "serviceName": "rainmaker-common", - "version": "1.0.0", - "baseKeyPath": "$.BirthCertificate.*", - "entityIdPath":"$.id", - "isCommonTableBorderRequired": true, - "mappings": [ - { - "topic": "common-pdf-generation-3", - "mappings": [ - { - "direct": [ - { - "variable": "logoImage", - "url":"https://raw.githubusercontent.com/egovernments/egov-web-app/master/web/rainmaker/dev-packages/egov-ui-kit-dev/src/assets/images/pblogo.png", - "type":"image" - }, - { - "variable": "name", - "value": { - "path": "$.fullName" - }, - "type":"setEmpty" - }, - { - "variable": "embeddedUrl", - "value": { - "path": "$.embeddedUrl" - } - }, - { - "variable": "dob", - "value": { - "path": "$.dateofbirth" - }, - "type": "date" - }, - { - "variable": "gender", - "value": { - "path": "$.genderStr" - }, - "type":"setEmpty" - }, - { - "variable": "registrationNo", - "value": { - "path": "$.registrationno" - }, - "type":"setEmpty" - }, - { - "variable": "registration_date", - "value": { - "path": "$.dateofreport" - }, - "type": "date" - }, - { - "variable": "updatedOn", - "value": { - "path": "$.dateofissue" - }, - "type": "date" - }, - { - "variable": "year", - "value": { - "path": "$.year" - }, - "type": "setEmpty" - }, - { - "variable": "fatherName", - "value": { - "path": "$.birthFatherInfo.fullName" - }, - "type":"setEmpty" - }, - { - "variable": "motherName", - "value": { - "path": "$.birthMotherInfo.fullName" - }, - "type":"setEmpty" - }, - { - "variable": "childAddress", - "value": { - "path": "$.birthPresentaddr.fullAddress" - }, - "type":"setEmpty" - }, - { - "variable": "parentsAddress", - "value": { - "path": "$.birthPermaddr.fullAddress" - }, - "type":"setEmpty" - }, - { - "variable": "parentsCity", - "value": { - "path": "$.birthPermaddr.city" - }, - "type":"setEmpty" - }, - { - "variable": "parentsStreet", - "value": { - "path": "$.birthPermaddr.street" - }, - "type":"setEmpty" - }, - { - "variable": "parentsTehsil", - "value": { - "path": "$.birthPermaddr.tehsil" - }, - "type":"setEmpty" - }, - { - "variable": "parentsDistrict", - "value": { - "path": "$.birthPermaddr.district" - }, - "type":"setEmpty" - }, - { - "variable": "fatherUid", - "value": { - "path": "$.birthFatherInfo.aadharno" - }, - "type":"setEmpty" - }, - { - "variable": "motherUid", - "value": { - "path": "$.birthMotherInfo.aadharno" - }, - "type":"setEmpty" - }, - { - "variable": "remarks", - "value": { - "path": "$.remarks" - }, - "type":"setEmpty" - }, - { - "variable": "placeOfBirth", - "value": { - "path": "$.placeofbirth" - }, - "type":"setEmpty" - }, - { - "variable": "issueDate", - "value": { - "path": "$.dateofissue" - }, - "type": "date" - }, - - { - "variable": "certificateType", - "value": { - "path": "$.certificateType" - }, - "type":"setEmpty" - }, - { - "variable": "cantonment-board", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_TLCERTIFICATE_MUNICIPAL_CORPORATION" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - { - "variable": "govt_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_GOVT_UP" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "dept_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_DEPT" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - - - { - "variable": "certificate_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_CERTIFICATE_BIRTH" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "certificate_label", - "value": { - "path": "PDF_STATIC_LABEL_BD_EN_CERTIFICATE" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - { - "variable": "rule1_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_RULE_1" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "rule2_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_RULE_2" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "name_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_NAME" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "gender_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_GENDER" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "dob_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_DOB" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "pob_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_POB" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "mother_name_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_MOTHER_NAME" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "father_name_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_FATHER_NAME" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "mother_uid_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_MOTHER_UID" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "father_uid_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_FATHER_UID" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "child_address_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_ADDRESS_OF_CHILD_BIRTH" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "parent_address_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_PERMENENT_ADDRESS_OF_PARENT" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "registration_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_REGISTRATION_NUMBER" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "registration_date_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_REGISTRATION_DATE" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "remarks_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_REMARKS" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "issue_date_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_ISSUE_DATE" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "issuing_authority_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_ISSUING_AUTHORITY_NAME" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "instruction1_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_INSTRUCTION_1" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "instruction2_label", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_INSTRUCTION_2" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - { - "variable": "issuing_authority", - "value": { - "path": "PDF_STATIC_LABEL_CONSOLIDATED_BIRTHCERIFICATE_ISSUING_AUTHORITY" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - }, - - - { - "variable": "cb_letter_label", - "value": { - "path": "PDF_STATIC_LABEL_BD_EN_CB" - }, - "type": "label", - "localisation":{ - "required":true, - "prefix": null, - "module":"rainmaker-pdf" - } - } - - ] - }, - { - "qrcodeConfig": [ - { - "variable": "qr_code_image", - "value":"{{embeddedUrl}}" - } - ] - } - ] - } - ] - } -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/btr-indexer.yml b/tutorials/backend-developer-guide/btr-services/btr-indexer.yml deleted file mode 100644 index b0549b8cdb5..00000000000 --- a/tutorials/backend-developer-guide/btr-services/btr-indexer.yml +++ /dev/null @@ -1,47 +0,0 @@ -ServiceMaps: - serviceName: Birth Registration Service - version: 1.0.0 - mappings: - - topic: save-bt-application - configKey: INDEX - indexes: - - name: btindex-v1 - type: general - id: $.id - isBulk: true - timeStampField: $.auditDetails.createdTime - jsonPath: $.BirthRegistrationApplications - customJsonMapping: - indexMapping: {"Data":{"birthapplication":{},"history":{}}} - fieldMapping: - - inJsonPath: $ - outJsonPath: $.Data.birthapplication - externalUriMapping: - - path: http://localhost:8282/egov-workflow-v2/egov-wf/process/_search - queryParam: businessIds=$.applicationNumber,history=true,tenantId=$.tenantId - apiRequest: {"RequestInfo":{"apiId":"org.egov.pt","ver":"1.0","ts":1502890899493,"action":"asd","did":"4354648646","key":"xyz","msgId":"654654","requesterId":"61","authToken":"d9994555-7656-4a67-ab3a-a952a0d4dfc8","userInfo":{"id":1,"uuid":"1fec8102-0e02-4d0a-b283-cd80d5dab067","type":"EMPLOYEE","tenantId":"pb.amritsar","roles":[{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"}]}}} - uriResponseMapping: - - inJsonPath: $.ProcessInstances - outJsonPath: $.Data.history - - - topic: update-bt-application - configKey: INDEX - indexes: - - name: btindex-v1 - type: general - id: $.id - isBulk: true - timeStampField: $.auditDetails.createdTime - jsonPath: $.BirthRegistrationApplications - customJsonMapping: - indexMapping: {"Data":{"birthapplication":{},"history":{}}} - fieldMapping: - - inJsonPath: $ - outJsonPath: $.Data.birthapplication - externalUriMapping: - - path: http://egov-workflow-v2.egov:8080/egov-workflow-v2/egov-wf/process/_search - queryParam: businessIds=$.applicationNumber,history=true,tenantId=$.tenantId - apiRequest: {"RequestInfo":{"apiId":"org.egov.pt","ver":"1.0","ts":1502890899493,"action":"asd","did":"4354648646","key":"xyz","msgId":"654654","requesterId":"61","authToken":"d9994555-7656-4a67-ab3a-a952a0d4dfc8","userInfo":{"id":1,"uuid":"1fec8102-0e02-4d0a-b283-cd80d5dab067","type":"EMPLOYEE","tenantId":"pb.amritsar","roles":[{"name":"Employee","code":"EMPLOYEE","tenantId":"pb.amritsar"}]}}} - uriResponseMapping: - - inJsonPath: $.ProcessInstances - outJsonPath: $.Data.history \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/btr-persister.yml b/tutorials/backend-developer-guide/btr-services/btr-persister.yml deleted file mode 100644 index cec7620a19b..00000000000 --- a/tutorials/backend-developer-guide/btr-services/btr-persister.yml +++ /dev/null @@ -1,104 +0,0 @@ -serviceMaps: - serviceName: btr-services - mappings: - - version: 1.0 - description: Persists birth details in tables - fromTopic: save-bt-application - isTransaction: true - queryMaps: - - - query: INSERT INTO eg_bt_registration(id,tenantid,applicationnumber,babyfirstname,babylastname,fatherid,motherid,doctorname,hospitalname,placeofbirth,timeofbirth,createdby,lastmodifiedby,createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?); - basePath: BirthRegistrationApplications.* - jsonMaps: - - jsonPath: $.BirthRegistrationApplications.*.id - - - jsonPath: $.BirthRegistrationApplications.*.tenantId - - - jsonPath: $.BirthRegistrationApplications.*.applicationNumber - - - jsonPath: $.BirthRegistrationApplications.*.babyFirstName - - - jsonPath: $.BirthRegistrationApplications.*.babyLastName - - - jsonPath: $.BirthRegistrationApplications.*.fatherOfApplicant.id - - - jsonPath: $.BirthRegistrationApplications.*.motherOfApplicant.id - - - jsonPath: $.BirthRegistrationApplications.*.doctorName - - - jsonPath: $.BirthRegistrationApplications.*.hospitalName - - - jsonPath: $.BirthRegistrationApplications.*.placeOfBirth - - - jsonPath: $.BirthRegistrationApplications.*.timeOfBirth - - - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdBy - - - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedBy - - - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdTime - - - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedTime - - - query: INSERT INTO eg_bt_address(id, tenantid, doorno, latitude, longitude, buildingname, addressid, addressnumber, type, addressline1, addressline2, landmark, street, city, locality, pincode, detail, registrationid, createdby, lastmodifiedby, createdtime, lastmodifiedtime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); - basePath: BirthRegistrationApplications.* - jsonMaps: - - jsonPath: $.BirthRegistrationApplications.*.address.id - - - jsonPath: $.BirthRegistrationApplications.*.address.tenantId - - - jsonPath: $.BirthRegistrationApplications.*.address.doorNo - - - jsonPath: $.BirthRegistrationApplications.*.address.latitude - - - jsonPath: $.BirthRegistrationApplications.*.address.longitude - - - jsonPath: $.BirthRegistrationApplications.*.address.buildingName - - - jsonPath: $.BirthRegistrationApplications.*.address.addressId - - - jsonPath: $.BirthRegistrationApplications.*.address.addressNumber - - - jsonPath: $.BirthRegistrationApplications.*.address.type - - - jsonPath: $.BirthRegistrationApplications.*.address.addressLine1 - - - jsonPath: $.BirthRegistrationApplications.*.address.addressLine2 - - - jsonPath: $.BirthRegistrationApplications.*.address.landmark - - - jsonPath: $.BirthRegistrationApplications.*.address.street - - - jsonPath: $.BirthRegistrationApplications.*.address.city - - - jsonPath: $.BirthRegistrationApplications.*.address.locality.name - - - jsonPath: $.BirthRegistrationApplications.*.address.pincode - - - jsonPath: $.BirthRegistrationApplications.*.address.detail - - - jsonPath: $.BirthRegistrationApplications.*.id - - - jsonPath: $.BirthRegistrationApplications.*.address.createdBy - - - jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedBy - - - jsonPath: $.BirthRegistrationApplications.*.address.createdTime - - - jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedTime - - - version: 1.0 - description: Update birth registration applications in table - fromTopic: update-bt-application - isTransaction: true - queryMaps: - - query: UPDATE eg_bt_registration SET tenantid = ?,babyFirstName = ?, timeOfBirth = ? WHERE id=?; - basePath: BirthRegistrationApplications.* - jsonMaps: - - jsonPath: $.BirthRegistrationApplications.*.tenantId - - - jsonPath: $.BirthRegistrationApplications.*.babyFirstName - - - jsonPath: $.BirthRegistrationApplications.*.timeOfBirth - - - jsonPath: $.BirthRegistrationApplications.*.id \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/pom.xml b/tutorials/backend-developer-guide/btr-services/pom.xml deleted file mode 100644 index 9aac623e7d1..00000000000 --- a/tutorials/backend-developer-guide/btr-services/pom.xml +++ /dev/null @@ -1,113 +0,0 @@ - - 4.0.0 - org.egov - birth-registration - jar - birth-registration - 1.0.0 - - 1.8 - ${java.version} - ${java.version} - - - org.springframework.boot - spring-boot-starter-parent - 1.5.9.RELEASE - - - src/main/java - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.flywaydb - flyway-core - - - org.postgresql - postgresql - 42.2.2.jre7 - - - org.springframework.boot - spring-boot-starter-test - test - - - - io.swagger - swagger-core - 1.5.18 - - - - org.egov.services - tracer - 2.0.0-SNAPSHOT - - - org.egov.services - services-common - 1.0.1-SNAPSHOT - - - org.egov - mdms-client - 0.0.2-SNAPSHOT - compile - - - org.projectlombok - lombok - true - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - - javax.validation - validation-api - - - - - - repo.egovernments.org - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ - - - repo.egovernments.org.snapshots - eGov ERP Releases Repository - https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ - - - repo.egovernments.org.public - eGov Public Repository Group - https://nexus-repo.egovernments.org/nexus/content/groups/public/ - - - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/Main.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/Main.java deleted file mode 100644 index 48f4e7a1bd5..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/Main.java +++ /dev/null @@ -1,19 +0,0 @@ -package digit; - - -import org.egov.tracer.config.TracerConfiguration; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Import; - -@Import({TracerConfiguration.class}) -@SpringBootApplication -@ComponentScan(basePackages = {"digit", "digit.web.controllers", "digit.config"}) -public class Main { - - public static void main(String[] args) throws Exception { - SpringApplication.run(Main.class, args); - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/config/MainConfiguration.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/config/MainConfiguration.java deleted file mode 100644 index 0a59c792c3b..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/config/MainConfiguration.java +++ /dev/null @@ -1,39 +0,0 @@ -package digit.config; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.egov.tracer.config.TracerConfiguration; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; - -import javax.annotation.PostConstruct; -import java.util.TimeZone; - - -@Import({TracerConfiguration.class}) -public class MainConfiguration { - - @Value("${app.timezone}") - private String timeZone; - - @PostConstruct - public void initialize() { - TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); - } - - @Bean - public ObjectMapper objectMapper() { - return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).setTimeZone(TimeZone.getTimeZone(timeZone)); - } - - @Bean - @Autowired - public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { - MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); - converter.setObjectMapper(objectMapper); - return converter; - } -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/consumer/NotificationConsumer.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/consumer/NotificationConsumer.java deleted file mode 100644 index cd93d21c87d..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/consumer/NotificationConsumer.java +++ /dev/null @@ -1,40 +0,0 @@ -package digit.consumer; - -import com.fasterxml.jackson.databind.ObjectMapper; -import digit.service.NotificationService; -import digit.web.models.BirthRegistrationRequest; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Component; - -import java.util.HashMap; - -@Component -@Slf4j -public class NotificationConsumer { - - @Autowired - private ObjectMapper mapper; - - @Autowired - private NotificationService notificationService; - - @KafkaListener(topics = {"${btr.kafka.create.topic}"}) - public void listen(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - - try { - - BirthRegistrationRequest request = mapper.convertValue(record, BirthRegistrationRequest.class); - //log.info(request.toString()); - notificationService.prepareEventAndSend(request); - - } catch (final Exception e) { - - log.error("Error while listening to value: " + record + " on topic: " + topic + ": ", e); - } - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/consumer/PaymentBackUpdateConsumer.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/consumer/PaymentBackUpdateConsumer.java deleted file mode 100644 index 8d08d6711b7..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/consumer/PaymentBackUpdateConsumer.java +++ /dev/null @@ -1,22 +0,0 @@ -package digit.consumer; - -import digit.service.PaymentUpdateService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.kafka.annotation.KafkaListener; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.messaging.handler.annotation.Header; -import org.springframework.stereotype.Component; - -import java.util.HashMap; - -@Component -public class PaymentBackUpdateConsumer { - - @Autowired - private PaymentUpdateService paymentUpdateService; - - @KafkaListener(topics = {"${kafka.topics.receipt.create}"}) - public void listenPayments(final HashMap record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) { - paymentUpdateService.process(record); - } -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/enrichment/BirthApplicationEnrichment.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/enrichment/BirthApplicationEnrichment.java deleted file mode 100644 index f00c25159e2..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/enrichment/BirthApplicationEnrichment.java +++ /dev/null @@ -1,95 +0,0 @@ -package digit.enrichment; - -import digit.service.UserService; -import digit.util.IdgenUtil; -import digit.util.UserUtil; -import digit.web.models.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.UUID; - -@Slf4j -@Component -public class BirthApplicationEnrichment { - - @Autowired - private IdgenUtil idgenUtil; - @Autowired - private UserService userService; - @Autowired - private UserUtil userUtils; - - public void enrichBirthApplication(BirthRegistrationRequest birthRegistrationRequest) { - List birthRegistrationIdList = idgenUtil.getIdList(birthRegistrationRequest.getRequestInfo(), birthRegistrationRequest.getBirthRegistrationApplications().get(0).getTenantId(), "btr.registrationid", "", birthRegistrationRequest.getBirthRegistrationApplications().size()); - Integer index = 0; - for(BirthRegistrationApplication application : birthRegistrationRequest.getBirthRegistrationApplications()) { - // Enrich audit details - AuditDetails auditDetails = AuditDetails.builder().createdBy(birthRegistrationRequest.getRequestInfo().getUserInfo().getUuid()).createdTime(System.currentTimeMillis()).lastModifiedBy(birthRegistrationRequest.getRequestInfo().getUserInfo().getUuid()).lastModifiedTime(System.currentTimeMillis()).build(); - application.setAuditDetails(auditDetails); - - // Enrich UUID - application.setId(UUID.randomUUID().toString()); - - // Set application number from IdGen - application.setApplicationNumber(birthRegistrationIdList.get(index++)); - - // Enrich registration Id - application.getAddress().setRegistrationId(application.getId()); - - // Enrich address UUID - application.getAddress().setId(UUID.randomUUID().toString()); - } - } - - public void enrichBirthApplicationUponUpdate(BirthRegistrationRequest birthRegistrationRequest) { - // Enrich lastModifiedTime and lastModifiedBy in case of update - for(BirthRegistrationApplication application : birthRegistrationRequest.getBirthRegistrationApplications()) { - application.getAuditDetails().setLastModifiedTime(System.currentTimeMillis()); - application.getAuditDetails().setLastModifiedBy(birthRegistrationRequest.getRequestInfo().getUserInfo().getUuid()); - } - } - - public void enrichFatherApplicantOnSearch(BirthRegistrationApplication application) { - UserDetailResponse fatherUserResponse = userService.searchUser(userUtils.getStateLevelTenant(application.getTenantId()),application.getFather().getId(),null); - User fatherUser = fatherUserResponse.getUser().get(0); - log.info(fatherUser.toString()); - FatherApplicant fatherApplicant = FatherApplicant.builder().aadhaarNumber(fatherUser.getAadhaarNumber()) - .accountLocked(fatherUser.getAccountLocked()) - .active(fatherUser.getActive()) - .altContactNumber(fatherUser.getAltContactNumber()) - .bloodGroup(fatherUser.getBloodGroup()) - .correspondenceAddress(fatherUser.getCorrespondenceAddress()) - .correspondenceCity(fatherUser.getCorrespondenceCity()) - .correspondencePincode(fatherUser.getCorrespondencePincode()) - .gender(fatherUser.getGender()) - .id(fatherUser.getUuid()) - .name(fatherUser.getName()) - .type(fatherUser.getType()) - .roles(fatherUser.getRoles()).build(); - application.setFather(fatherApplicant); - } - - public void enrichMotherApplicantOnSearch(BirthRegistrationApplication application) { - UserDetailResponse motherUserResponse = userService.searchUser(userUtils.getStateLevelTenant(application.getTenantId()),application.getMother().getId(),null); - User motherUser = motherUserResponse.getUser().get(0); - log.info(motherUser.toString()); - MotherApplicant motherApplicant = MotherApplicant.builder().aadhaarNumber(motherUser.getAadhaarNumber()) - .accountLocked(motherUser.getAccountLocked()) - .active(motherUser.getActive()) - .altContactNumber(motherUser.getAltContactNumber()) - .bloodGroup(motherUser.getBloodGroup()) - .correspondenceAddress(motherUser.getCorrespondenceAddress()) - .correspondenceCity(motherUser.getCorrespondenceCity()) - .correspondencePincode(motherUser.getCorrespondencePincode()) - .gender(motherUser.getGender()) - .id(motherUser.getUuid()) - .name(motherUser.getName()) - .type(motherUser.getType()) - .roles(motherUser.getRoles()).build(); - application.setMother(motherApplicant); - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/producer/Producer.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/producer/Producer.java deleted file mode 100644 index e0ae8f7232a..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/producer/Producer.java +++ /dev/null @@ -1,18 +0,0 @@ -package digit.producer; - -import lombok.extern.slf4j.Slf4j; -import org.egov.tracer.kafka.CustomKafkaTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -@Slf4j -public class Producer { - - @Autowired - private CustomKafkaTemplate kafkaTemplate; - - public void push(String topic, Object value) { - kafkaTemplate.send(topic, value); - } -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/ServiceRequestRepository.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/ServiceRequestRepository.java deleted file mode 100644 index 284ee77bfc2..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/ServiceRequestRepository.java +++ /dev/null @@ -1,44 +0,0 @@ -package digit.repository; - - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import lombok.extern.slf4j.Slf4j; -import org.egov.tracer.model.ServiceCallException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -import java.util.Map; - -@Repository -@Slf4j -public class ServiceRequestRepository { - - private ObjectMapper mapper; - - private RestTemplate restTemplate; - - @Autowired - public ServiceRequestRepository(ObjectMapper mapper, RestTemplate restTemplate) { - this.mapper = mapper; - this.restTemplate = restTemplate; - } - - - public Object fetchResult(StringBuilder uri, Object request) { - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - Object response = null; - try { - response = restTemplate.postForObject(uri.toString(), request, Map.class); - } catch (HttpClientErrorException e) { - log.error("External Service threw an Exception: ", e); - throw new ServiceCallException(e.getResponseBodyAsString()); - } catch (Exception e) { - log.error("Exception while fetching from searcher: ", e); - } - - return response; - } -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/rowmapper/BirthApplicationRowMapper.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/rowmapper/BirthApplicationRowMapper.java deleted file mode 100644 index 141f104501a..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/repository/rowmapper/BirthApplicationRowMapper.java +++ /dev/null @@ -1,93 +0,0 @@ -package digit.repository.rowmapper; - -import digit.web.models.*; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ResultSetExtractor; -import org.springframework.stereotype.Component; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -@Component -public class BirthApplicationRowMapper implements ResultSetExtractor> { - public List extractData(ResultSet rs) throws SQLException, DataAccessException { - Map birthRegistrationApplicationMap = new LinkedHashMap<>(); - - while (rs.next()){ - String uuid = rs.getString("bapplicationnumber"); - BirthRegistrationApplication birthRegistrationApplication = birthRegistrationApplicationMap.get(uuid); - - if(birthRegistrationApplication == null) { - - Long lastModifiedTime = rs.getLong("blastModifiedTime"); - if (rs.wasNull()) { - lastModifiedTime = null; - } - - - FatherApplicant father = FatherApplicant.builder().id(rs.getString("bfatherid")).build(); - MotherApplicant mother = MotherApplicant.builder().id(rs.getString("bmotherid")).build(); - - AuditDetails auditdetails = AuditDetails.builder() - .createdBy(rs.getString("bcreatedBy")) - .createdTime(rs.getLong("bcreatedTime")) - .lastModifiedBy(rs.getString("blastModifiedBy")) - .lastModifiedTime(lastModifiedTime) - .build(); - - birthRegistrationApplication = BirthRegistrationApplication.builder() - .applicationNumber(rs.getString("bapplicationnumber")) - .tenantId(rs.getString("btenantid")) - .id(rs.getString("bid")) - .babyFirstName(rs.getString("bbabyfirstname")) - .babyLastName(rs.getString("bbabylastname")) - .father(father) - .mother(mother) - .doctorName(rs.getString("bdoctorname")) - .hospitalName(rs.getString("bhospitalname")) - .placeOfBirth(rs.getString("bplaceofbirth")) - .timeOfBirth(rs.getInt("btimeofbirth")) - .auditDetails(auditdetails) - .build(); - } - addChildrenToProperty(rs, birthRegistrationApplication); - birthRegistrationApplicationMap.put(uuid, birthRegistrationApplication); - } - return new ArrayList<>(birthRegistrationApplicationMap.values()); - } - - private void addChildrenToProperty(ResultSet rs, BirthRegistrationApplication birthRegistrationApplication) - throws SQLException { - addAddressToApplication(rs, birthRegistrationApplication); - } - - private void addAddressToApplication(ResultSet rs, BirthRegistrationApplication birthRegistrationApplication) throws SQLException { - Address address = Address.builder() - .id(rs.getString("aid")) - .tenantId(rs.getString("atenantid")) - .doorNo(rs.getString("adoorno")) - .latitude(rs.getDouble("alatitude")) - .longitude(rs.getDouble("alongitude")) - .buildingName(rs.getString("abuildingname")) - .addressId(rs.getString("aaddressid")) - .addressNumber(rs.getString("aaddressnumber")) - .type(rs.getString("atype")) - .addressLine1(rs.getString("aaddressline1")) - .addressLine2(rs.getString("aaddressline2")) - .landmark(rs.getString("alandmark")) - .street(rs.getString("astreet")) - .city(rs.getString("acity")) - .pincode(rs.getString("apincode")) - .detail("adetail") - .registrationId("aregistrationid") - .build(); - - birthRegistrationApplication.setAddress(address); - - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/BirthRegistrationService.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/BirthRegistrationService.java deleted file mode 100644 index 78e0ab59c06..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/BirthRegistrationService.java +++ /dev/null @@ -1,94 +0,0 @@ -package digit.service; - -import digit.config.BTRConfiguration; -import digit.enrichment.BirthApplicationEnrichment; -import digit.producer.Producer; -import digit.repository.BirthRegistrationRepository; -import digit.validator.BirthApplicationValidator; -import digit.web.models.BirthApplicationSearchCriteria; -import digit.web.models.BirthRegistrationApplication; -import digit.web.models.BirthRegistrationRequest; -import digit.web.models.Workflow; -import org.egov.common.contract.request.RequestInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.ArrayList; -import java.util.List; - -@Service -public class BirthRegistrationService { - - @Autowired - private BirthApplicationValidator birthApplicationValidator; - @Autowired - private BirthApplicationEnrichment birthApplicationEnrichment; - @Autowired - private Producer producer; - @Autowired - private BTRConfiguration configuration; - @Autowired - private BirthRegistrationRepository birthRegistrationRepository; - @Autowired - private UserService userService; - @Autowired - private WorkflowService workflowService; - @Autowired - private CalculationService calculationService; - - public List registerBtRequest(BirthRegistrationRequest birthRegistrationRequest) { - birthApplicationValidator.validateBirthApplication(birthRegistrationRequest); - birthApplicationEnrichment.enrichBirthApplication(birthRegistrationRequest); - - // Enrich/Upsert user in upon birth registration - userService.callUserService(birthRegistrationRequest); - - // Initiate workflow for the new application - workflowService.updateWorkflowStatus(birthRegistrationRequest); - - //Call calculator to calculate and create demand - calculationService.getCalculation(birthRegistrationRequest); - - // Push the application to the topic for persister to listen and persist - producer.push(configuration.getCreateTopic(), birthRegistrationRequest); - - // Return the response back to user - return birthRegistrationRequest.getBirthRegistrationApplications(); - } - - public List searchBtApplications(RequestInfo requestInfo, BirthApplicationSearchCriteria birthApplicationSearchCriteria) { - // Fetch applications from database according to the given search criteria - List applications = birthRegistrationRepository.getApplications(birthApplicationSearchCriteria); - - // If no applications are found matching the given criteria, return an empty list - if(CollectionUtils.isEmpty(applications)) - return new ArrayList<>(); - - // Enrich mother and father of applicant objects - applications.forEach(application -> { - birthApplicationEnrichment.enrichFatherApplicantOnSearch(application); - birthApplicationEnrichment.enrichMotherApplicantOnSearch(application); - }); - - applications.forEach(application -> { - application.setWorkflow(Workflow.builder().status(workflowService.getCurrentWorkflow(requestInfo, application.getTenantId(), application.getApplicationNumber()).getState().getState()).build()); - }); - - // Otherwise, return the found applications - return applications; - } - - public List updateBtApplication(BirthRegistrationRequest birthRegistrationRequest) { - // Validate whether the application that is being requested for update indeed exists - List existingApplication = birthApplicationValidator.validateApplicationUpdateRequest(birthRegistrationRequest); - // Enrich application upon update - birthApplicationEnrichment.enrichBirthApplicationUponUpdate(birthRegistrationRequest); - workflowService.updateWorkflowStatus(birthRegistrationRequest); - // Just like create request, update request will be handled asynchronously by the persister - producer.push(configuration.getUpdateTopic(), birthRegistrationRequest); - - return birthRegistrationRequest.getBirthRegistrationApplications(); - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/CalculationService.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/CalculationService.java deleted file mode 100644 index b198aeb57cd..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/CalculationService.java +++ /dev/null @@ -1,50 +0,0 @@ -package digit.service; - -import com.fasterxml.jackson.databind.ObjectMapper; -import digit.config.BTRConfiguration; -import digit.repository.ServiceRequestRepository; -import digit.web.models.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; - -@Service -public class CalculationService { - - @Autowired - private BTRConfiguration btrConfiguration; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private ServiceRequestRepository serviceRequestRepository; - - public CalculationRes getCalculation(BirthRegistrationRequest request){ - - List calculationCriteriaList = new ArrayList<>(); - for(BirthRegistrationApplication application : request.getBirthRegistrationApplications()) { - CalculationCriteria calculationCriteria = CalculationCriteria.builder() - .birthregistrationapplication(application) - .tenantId(application.getTenantId()) - .applicationNumber(application.getApplicationNumber()) - .build(); - calculationCriteriaList.add(calculationCriteria); - } - - CalculationReq calculationReq = CalculationReq.builder() - .requestInfo(request.getRequestInfo()) - .calculationCriteria(calculationCriteriaList) - .build(); - - StringBuilder url = new StringBuilder().append(btrConfiguration.getBtrCalculatorHost()) - .append(btrConfiguration.getBtrCalculatorCalculateEndpoint()); - - Object response = serviceRequestRepository.fetchResult(url, calculationReq); - CalculationRes calculationRes = mapper.convertValue(response, CalculationRes.class); - - return calculationRes; - } -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/NotificationService.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/NotificationService.java deleted file mode 100644 index 30be125cf83..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/NotificationService.java +++ /dev/null @@ -1,52 +0,0 @@ -package digit.service; - -import digit.config.BTRConfiguration; -import digit.producer.Producer; -import digit.web.models.BirthRegistrationApplication; -import digit.web.models.BirthRegistrationRequest; -import digit.web.models.SMSRequest; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Service -public class NotificationService { - - @Autowired - private Producer producer; - - @Autowired - private BTRConfiguration config; - - @Autowired - private RestTemplate restTemplate; - - private static final String smsTemplate = "Dear {FATHER_NAME} and {MOTHER_NAME} your birth registration application has been successfully created on the system with application number - {APPNUMBER}."; - - public void prepareEventAndSend(BirthRegistrationRequest request){ - List smsRequestList = new ArrayList<>(); - request.getBirthRegistrationApplications().forEach(application -> { - SMSRequest smsRequestForFather = SMSRequest.builder().mobileNumber(application.getFatherMobileNumber()).message(getCustomMessage(smsTemplate, application)).build(); - SMSRequest smsRequestForMother = SMSRequest.builder().mobileNumber(application.getMotherMobileNumber()).message(getCustomMessage(smsTemplate, application)).build(); - smsRequestList.add(smsRequestForFather); - smsRequestList.add(smsRequestForMother); - }); - for (SMSRequest smsRequest : smsRequestList) { - producer.push(config.getSmsNotificationTopic(), smsRequest); - log.info("Messages: " + smsRequest.getMessage()); - } - } - - private String getCustomMessage(String template, BirthRegistrationApplication application) { - template = template.replace("{APPNUMBER}", application.getApplicationNumber()); - template = template.replace("{FATHER_NAME}", application.getFather().getName()); - template = template.replace("{MOTHER_NAME}", application.getMother().getName()); - return template; - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/PaymentUpdateService.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/PaymentUpdateService.java deleted file mode 100644 index ba6db196f42..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/PaymentUpdateService.java +++ /dev/null @@ -1,80 +0,0 @@ -package digit.service; - -import com.fasterxml.jackson.databind.ObjectMapper; -import digit.repository.BirthRegistrationRepository; -import digit.web.models.*; -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.request.Role; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; - -@Slf4j -@Service -public class PaymentUpdateService { - - @Autowired - private WorkflowService workflowService; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private BirthRegistrationRepository repository; - - public void process(HashMap record) { - - try { - - PaymentRequest paymentRequest = mapper.convertValue(record, PaymentRequest.class); - RequestInfo requestInfo = paymentRequest.getRequestInfo(); - - List paymentDetails = paymentRequest.getPayment().getPaymentDetails(); - String tenantId = paymentRequest.getPayment().getTenantId(); - - for (PaymentDetail paymentDetail : paymentDetails) { - updateWorkflowForBirthRegistrationPayment(requestInfo, tenantId, paymentDetail); - } - } catch (Exception e) { - log.error("KAFKA_PROCESS_ERROR:", e); - } - - } - - private void updateWorkflowForBirthRegistrationPayment(RequestInfo requestInfo, String tenantId, PaymentDetail paymentDetail) { - - Bill bill = paymentDetail.getBill(); - - BirthApplicationSearchCriteria criteria = BirthApplicationSearchCriteria.builder() - .applicationNumber(bill.getConsumerCode()) - .tenantId(tenantId) - .build(); - - List birthRegistrationApplicationList = repository.getApplications(criteria); - - if (CollectionUtils.isEmpty(birthRegistrationApplicationList)) - throw new CustomException("INVALID RECEIPT", - "No applications found for the consumerCode " + criteria.getApplicationNumber()); - - Role role = Role.builder().code("SYSTEM_PAYMENT").tenantId(tenantId).build(); - requestInfo.getUserInfo().getRoles().add(role); - - birthRegistrationApplicationList.forEach( application -> { - - BirthRegistrationRequest updateRequest = BirthRegistrationRequest.builder().requestInfo(requestInfo) - .birthRegistrationApplications(Collections.singletonList(application)).build(); - - ProcessInstanceRequest wfRequest = workflowService.getProcessInstanceForBirthRegistrationPayment(updateRequest); - - State state = workflowService.callWorkFlow(wfRequest); - - }); - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/UserService.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/UserService.java deleted file mode 100644 index 0ee08b3c454..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/UserService.java +++ /dev/null @@ -1,232 +0,0 @@ -package digit.service; - -import digit.config.BTRConfiguration; -import digit.util.UserUtil; -import digit.web.models.*; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - - -@Service -@Slf4j -public class UserService { - private UserUtil userUtils; - - private BTRConfiguration config; - - @Autowired - public UserService(UserUtil userUtils, BTRConfiguration config) { - this.userUtils = userUtils; - this.config = config; - } - - /** - * Calls user service to enrich user from search or upsert user - * @param request - */ - public void callUserService(BirthRegistrationRequest request){ - request.getBirthRegistrationApplications().forEach(application -> { - if(!StringUtils.isEmpty(application.getFather().getId())) - enrichUser(application, request.getRequestInfo()); - else { - User user = createFatherUser(application); - application.getFather().setId(upsertUser(user, request.getRequestInfo())); - } - }); - - request.getBirthRegistrationApplications().forEach(application -> { - if(!StringUtils.isEmpty(application.getMother().getId())) - enrichUser(application, request.getRequestInfo()); - else { - User user = createMotherUser(application); - application.getMother().setId(upsertUser(user, request.getRequestInfo())); - } - }); - } - - private User createFatherUser(BirthRegistrationApplication application){ - FatherApplicant father = application.getFather(); - User user = User.builder().userName(father.getUserName()) - .name(father.getName()) - .mobileNumber(father.getMobileNumber()) - .emailId(father.getEmailId()) - .altContactNumber(father.getAltContactNumber()) - .tenantId(father.getTenantId()) - .type(father.getType()) - .roles(father.getRoles()) - .build(); -// String tenantId = father.getTenantId(); - return user; - } - - private User createMotherUser(BirthRegistrationApplication application){ - MotherApplicant mother = application.getMother(); - User user = User.builder().userName(mother.getUserName()) - .name(mother.getName()) - .mobileNumber(mother.getMobileNumber()) - .emailId(mother.getEmailId()) - .altContactNumber(mother.getAltContactNumber()) - .tenantId(mother.getTenantId()) - .type(mother.getType()) - .roles(mother.getRoles()) - .build(); -// String tenantId = father.getTenantId(); - return user; - } - private String upsertUser(User user, RequestInfo requestInfo){ - - String tenantId = user.getTenantId(); - User userServiceResponse = null; - - // Search on mobile number as user name - UserDetailResponse userDetailResponse = searchUser(userUtils.getStateLevelTenant(tenantId),null, user.getMobileNumber()); - if (!userDetailResponse.getUser().isEmpty()) { - User userFromSearch = userDetailResponse.getUser().get(0); - log.info(userFromSearch.toString()); - if(!user.getUserName().equalsIgnoreCase(userFromSearch.getUserName())){ - userServiceResponse = updateUser(requestInfo,user,userFromSearch); - } - else userServiceResponse = userDetailResponse.getUser().get(0); - } - else { - userServiceResponse = createUser(requestInfo,tenantId,user); - } - - // Enrich the accountId - // user.setId(userServiceResponse.getUuid()); - return userServiceResponse.getUuid(); - } - - - private void enrichUser(BirthRegistrationApplication application, RequestInfo requestInfo){ - String accountIdFather = application.getFather().getId(); - String accountIdMother = application.getMother().getId(); - String tenantId = application.getTenantId(); - - UserDetailResponse userDetailResponseFather = searchUser(userUtils.getStateLevelTenant(tenantId),accountIdFather,null); - UserDetailResponse userDetailResponseMother = searchUser(userUtils.getStateLevelTenant(tenantId),accountIdMother,null); - if(userDetailResponseFather.getUser().isEmpty()) - throw new CustomException("INVALID_ACCOUNTID","No user exist for the given accountId"); - - else application.getFather().setId(userDetailResponseFather.getUser().get(0).getUuid()); - - if(userDetailResponseMother.getUser().isEmpty()) - throw new CustomException("INVALID_ACCOUNTID","No user exist for the given accountId"); - - else application.getMother().setId(userDetailResponseMother.getUser().get(0).getUuid()); - - } - - /** - * Creates the user from the given userInfo by calling user service - * @param requestInfo - * @param tenantId - * @param userInfo - * @return - */ - private User createUser(RequestInfo requestInfo,String tenantId, User userInfo) { - - userUtils.addUserDefaultFields(userInfo.getMobileNumber(),tenantId, userInfo); - StringBuilder uri = new StringBuilder(config.getUserHost()) - .append(config.getUserContextPath()) - .append(config.getUserCreateEndpoint()); - - CreateUserRequest user = new CreateUserRequest(requestInfo, userInfo); - log.info(user.getUser().toString()); - UserDetailResponse userDetailResponse = userUtils.userCall(user, uri); - - return userDetailResponse.getUser().get(0); - - } - - /** - * Updates the given user by calling user service - * @param requestInfo - * @param user - * @param userFromSearch - * @return - */ - private User updateUser(RequestInfo requestInfo,User user,User userFromSearch) { - - userFromSearch.setName(user.getName()); - userFromSearch.setActive(true); - - StringBuilder uri = new StringBuilder(config.getUserHost()) - .append(config.getUserContextPath()) - .append(config.getUserUpdateEndpoint()); - - - UserDetailResponse userDetailResponse = userUtils.userCall(new CreateUserRequest(requestInfo, userFromSearch), uri); - - return userDetailResponse.getUser().get(0); - - } - - /** - * calls the user search API based on the given accountId and userName - * @param stateLevelTenant - * @param accountId - * @param userName - * @return - */ - public UserDetailResponse searchUser(String stateLevelTenant, String accountId, String userName){ - - UserSearchRequest userSearchRequest =new UserSearchRequest(); - userSearchRequest.setActive(true); - userSearchRequest.setUserType("CITIZEN"); - userSearchRequest.setTenantId(stateLevelTenant); - - if(StringUtils.isEmpty(accountId) && StringUtils.isEmpty(userName)) - return null; - - if(!StringUtils.isEmpty(accountId)) - userSearchRequest.setUuid(Collections.singletonList(accountId)); - - if(!StringUtils.isEmpty(userName)) - userSearchRequest.setUserName(userName); - - StringBuilder uri = new StringBuilder(config.getUserHost()).append(config.getUserSearchEndpoint()); - return userUtils.userCall(userSearchRequest,uri); - - } - - /** - * calls the user search API based on the given list of user uuids - * @param uuids - * @return - */ - private Map searchBulkUser(List uuids){ - - UserSearchRequest userSearchRequest =new UserSearchRequest(); - userSearchRequest.setActive(true); - userSearchRequest.setUserType("CITIZEN"); - - - if(!CollectionUtils.isEmpty(uuids)) - userSearchRequest.setUuid(uuids); - - - StringBuilder uri = new StringBuilder(config.getUserHost()).append(config.getUserSearchEndpoint()); - UserDetailResponse userDetailResponse = userUtils.userCall(userSearchRequest,uri); - List users = userDetailResponse.getUser(); - - if(CollectionUtils.isEmpty(users)) - throw new CustomException("USER_NOT_FOUND","No user found for the uuids"); - - Map idToUserMap = users.stream().collect(Collectors.toMap(User::getUuid, Function.identity())); - - return idToUserMap; - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/WorkflowService.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/WorkflowService.java deleted file mode 100644 index 55e3f4d6db2..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/service/WorkflowService.java +++ /dev/null @@ -1,159 +0,0 @@ -package digit.service; - -import com.fasterxml.jackson.databind.ObjectMapper; -import digit.config.BTRConfiguration; -import digit.repository.ServiceRequestRepository; -import digit.web.models.*; -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -@Component -@Slf4j -public class WorkflowService { - - @Autowired - private ObjectMapper mapper; - - @Autowired - private ServiceRequestRepository repository; - - @Autowired - private BTRConfiguration config; - - public void updateWorkflowStatus(BirthRegistrationRequest birthRegistrationRequest) { - birthRegistrationRequest.getBirthRegistrationApplications().forEach(application -> { - ProcessInstance processInstance = getProcessInstanceForBTR(application, birthRegistrationRequest.getRequestInfo()); - ProcessInstanceRequest workflowRequest = new ProcessInstanceRequest(birthRegistrationRequest.getRequestInfo(), Collections.singletonList(processInstance)); - callWorkFlow(workflowRequest); - }); - } - - public State callWorkFlow(ProcessInstanceRequest workflowReq) { - - ProcessInstanceResponse response = null; - StringBuilder url = new StringBuilder(config.getWfHost().concat(config.getWfTransitionPath())); - Object optional = repository.fetchResult(url, workflowReq); - response = mapper.convertValue(optional, ProcessInstanceResponse.class); - return response.getProcessInstances().get(0).getState(); - } - - private ProcessInstance getProcessInstanceForBTR(BirthRegistrationApplication application, RequestInfo requestInfo) { - Workflow workflow = application.getWorkflow(); - - ProcessInstance processInstance = new ProcessInstance(); - processInstance.setBusinessId(application.getApplicationNumber()); - processInstance.setAction(workflow.getAction()); - processInstance.setModuleName("birth-services"); - processInstance.setTenantId(application.getTenantId()); - processInstance.setBusinessService("BTR"); - processInstance.setDocuments(workflow.getDocuments()); - processInstance.setComment(workflow.getComments()); - - if(!CollectionUtils.isEmpty(workflow.getAssignes())){ - List users = new ArrayList<>(); - - workflow.getAssignes().forEach(uuid -> { - User user = new User(); - user.setUuid(uuid); - users.add(user); - }); - - processInstance.setAssignes(users); - } - - return processInstance; - - } - - private BusinessService getBusinessService(BirthRegistrationApplication application, RequestInfo requestInfo) { - String tenantId = application.getTenantId(); - StringBuilder url = getSearchURLWithParams(tenantId, "BTR"); - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - Object result = repository.fetchResult(url, requestInfoWrapper); - BusinessServiceResponse response = null; - try { - response = mapper.convertValue(result, BusinessServiceResponse.class); - } catch (IllegalArgumentException e) { - throw new CustomException("PARSING ERROR", "Failed to parse response of workflow business service search"); - } - - if (CollectionUtils.isEmpty(response.getBusinessServices())) - throw new CustomException("BUSINESSSERVICE_NOT_FOUND", "The businessService " + "BTR" + " is not found"); - - return response.getBusinessServices().get(0); - } - - private StringBuilder getSearchURLWithParams(String tenantId, String businessService) { - - StringBuilder url = new StringBuilder(config.getWfHost()); - url.append(config.getWfBusinessServiceSearchPath()); - url.append("?tenantId="); - url.append(tenantId); - url.append("&businessServices="); - url.append(businessService); - return url; - } - - public ProcessInstanceRequest getProcessInstanceForBirthRegistrationPayment(BirthRegistrationRequest updateRequest) { - - BirthRegistrationApplication application = updateRequest.getBirthRegistrationApplications().get(0); - - ProcessInstance process = ProcessInstance.builder() - .businessService("BTR") - .businessId(application.getApplicationNumber()) - .comment("Payment for birth registration processed") - .moduleName("birth-services") - .tenantId(application.getTenantId()) - .action("PAY") - .build(); - - return ProcessInstanceRequest.builder() - .requestInfo(updateRequest.getRequestInfo()) - .processInstances(Arrays.asList(process)) - .build(); - - } - - private StringBuilder getWorkflowSearchURLWithParams(String tenantId, String businessId) { - - StringBuilder url = new StringBuilder(config.getWfHost()); - url.append(config.getWfProcessInstanceSearchPath()); - url.append("?tenantId="); - url.append(tenantId); - url.append("&businessIds="); - url.append(businessId); - return url; - } - - public ProcessInstance getCurrentWorkflow(RequestInfo requestInfo, String tenantId, String businessId) { - - RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); - - StringBuilder url = getWorkflowSearchURLWithParams(tenantId, businessId); - - Object res = repository.fetchResult(url, requestInfoWrapper); - ProcessInstanceResponse response = null; - - try{ - response = mapper.convertValue(res, ProcessInstanceResponse.class); - } - catch (Exception e){ - throw new CustomException("PARSING_ERROR","Failed to parse workflow search response"); - } - - if(response!=null && !CollectionUtils.isEmpty(response.getProcessInstances()) && response.getProcessInstances().get(0)!=null) - return response.getProcessInstances().get(0); - - return null; - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/IdgenUtil.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/IdgenUtil.java deleted file mode 100644 index 224456b5f5e..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/IdgenUtil.java +++ /dev/null @@ -1,52 +0,0 @@ -package digit.util; - -import com.fasterxml.jackson.databind.ObjectMapper; -import digit.repository.ServiceRequestRepository; -import digit.web.models.IdGenerationRequest; -import digit.web.models.IdGenerationResponse; -import digit.web.models.IdRequest; -import digit.web.models.IdResponse; -import org.egov.common.contract.request.RequestInfo; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -@Component -public class IdgenUtil { - - @Value("${egov.idgen.host}") - private String idGenHost; - - @Value("${egov.idgen.path}") - private String idGenPath; - - @Autowired - private ObjectMapper mapper; - - @Autowired - private ServiceRequestRepository restRepo; - - public List getIdList(RequestInfo requestInfo, String tenantId, String idName, String idformat, Integer count) { - List reqList = new ArrayList<>(); - for (int i = 0; i < count; i++) { - reqList.add(IdRequest.builder().idName(idName).format(idformat).tenantId(tenantId).build()); - } - - IdGenerationRequest request = IdGenerationRequest.builder().idRequests(reqList).requestInfo(requestInfo).build(); - StringBuilder uri = new StringBuilder(idGenHost).append(idGenPath); - IdGenerationResponse response = mapper.convertValue(restRepo.fetchResult(uri, request), IdGenerationResponse.class); - - List idResponses = response.getIdResponses(); - - if (CollectionUtils.isEmpty(idResponses)) - throw new CustomException("IDGEN ERROR", "No ids returned from idgen Service"); - - return idResponses.stream().map(IdResponse::getId).collect(Collectors.toList()); - } -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/MdmsUtil.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/MdmsUtil.java deleted file mode 100644 index 865bdff28e7..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/MdmsUtil.java +++ /dev/null @@ -1,70 +0,0 @@ -package digit.util; - -import com.jayway.jsonpath.JsonPath; -import org.egov.common.contract.request.RequestInfo; -import org.egov.mdms.model.MasterDetail; -import org.egov.mdms.model.MdmsCriteria; -import org.egov.mdms.model.MdmsCriteriaReq; -import org.egov.mdms.model.ModuleDetail; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.springframework.web.client.RestTemplate; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -@Component -public class MdmsUtil { - @Autowired - private RestTemplate restTemplate; - - @Value("${egov.mdms.host}") - private String mdmsHost; - - @Value("${egov.mdms.search.endpoint}") - private String mdmsUrl; - - - public Integer fetchRegistrationChargesFromMdms(RequestInfo requestInfo, String tenantId) { - StringBuilder uri = new StringBuilder(); - uri.append(mdmsHost).append(mdmsUrl); - MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequestForCategoryList(requestInfo, tenantId); - Object response = new HashMap<>(); - Integer rate = 0; - try { - response = restTemplate.postForObject(uri.toString(), mdmsCriteriaReq, Map.class); - rate = JsonPath.read(response, "$.MdmsRes.BTR.RegistrationCharges.[0].amount"); - }catch(Exception e) { - return null; - } - return rate; - } - - private MdmsCriteriaReq getMdmsRequestForCategoryList(RequestInfo requestInfo, String tenantId) { - MasterDetail masterDetail = new MasterDetail(); - masterDetail.setName("RegistrationCharges"); - List masterDetailList = new ArrayList<>(); - masterDetailList.add(masterDetail); - - ModuleDetail moduleDetail = new ModuleDetail(); - moduleDetail.setMasterDetails(masterDetailList); - moduleDetail.setModuleName("BTR"); - List moduleDetailList = new ArrayList<>(); - moduleDetailList.add(moduleDetail); - - MdmsCriteria mdmsCriteria = new MdmsCriteria(); - mdmsCriteria.setTenantId(tenantId.split("\\.")[0]); - mdmsCriteria.setModuleDetails(moduleDetailList); - - MdmsCriteriaReq mdmsCriteriaReq = new MdmsCriteriaReq(); - mdmsCriteriaReq.setMdmsCriteria(mdmsCriteria); - mdmsCriteriaReq.setRequestInfo(requestInfo); - - return mdmsCriteriaReq; - } -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/ResponseInfoFactory.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/ResponseInfoFactory.java deleted file mode 100644 index 5246bd6a9b5..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/ResponseInfoFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -package digit.util; - -import org.egov.common.contract.request.RequestInfo; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.stereotype.Component; - -@Component -public class ResponseInfoFactory { - - public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { - - final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; - final String ver = requestInfo != null ? requestInfo.getVer() : ""; - Long ts = null; - if (requestInfo != null) - ts = requestInfo.getTs(); - final String resMsgId = "uief87324"; // FIXME : Hard-coded - final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; - final String responseStatus = success ? "successful" : "failed"; - - return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) - .status(responseStatus).build(); - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/UrlShortnerUtil.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/UrlShortnerUtil.java deleted file mode 100644 index 28bd16fa1d3..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/UrlShortnerUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -package digit.util; - -import digit.config.BTRConfiguration; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.web.client.RestTemplate; - -import java.util.HashMap; - -@Slf4j -@Component -public class UrlShortnerUtil { - @Autowired - private RestTemplate restTemplate; - - @Autowired - private BTRConfiguration config; - - public String getShortenedUrl(String url){ - - HashMap body = new HashMap<>(); - body.put("url",url); - StringBuilder builder = new StringBuilder(config.getUrlShortnerHost()); - builder.append(config.getUrlShortnerEndpoint()); - String res = restTemplate.postForObject(builder.toString(), body, String.class); - - if(StringUtils.isEmpty(res)){ - log.error("URL_SHORTENING_ERROR", "Unable to shorten url: " + url); - return url; - } - else return res; - } -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/UserUtil.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/UserUtil.java deleted file mode 100644 index e949c062793..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/util/UserUtil.java +++ /dev/null @@ -1,135 +0,0 @@ -package digit.util; - -import com.fasterxml.jackson.databind.ObjectMapper; -import digit.config.BTRConfiguration; -import digit.repository.ServiceRequestRepository; -import digit.web.models.Role; -import digit.web.models.User; -import digit.web.models.UserDetailResponse; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Collections; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; - -@Component -public class UserUtil { - - - private ObjectMapper mapper; - - private ServiceRequestRepository serviceRequestRepository; - - private BTRConfiguration config; - - @Autowired - public UserUtil(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepository, BTRConfiguration config) { - this.mapper = mapper; - this.serviceRequestRepository = serviceRequestRepository; - this.config = config; - } - - /** - * Returns UserDetailResponse by calling user service with given uri and object - * @param userRequest Request object for user service - * @param uri The address of the endpoint - * @return Response from user service as parsed as userDetailResponse - */ - - public UserDetailResponse userCall(Object userRequest, StringBuilder uri) { - String dobFormat = null; - - if(uri.toString().contains(config.getUserSearchEndpoint()) || uri.toString().contains(config.getUserUpdateEndpoint())) - dobFormat="yyyy-MM-dd"; - else if(uri.toString().contains(config.getUserCreateEndpoint())) - dobFormat = "dd/MM/yyyy"; - try{ - LinkedHashMap responseMap = (LinkedHashMap)serviceRequestRepository.fetchResult(uri, userRequest); - parseResponse(responseMap,dobFormat); - UserDetailResponse userDetailResponse = mapper.convertValue(responseMap,UserDetailResponse.class); - return userDetailResponse; - } - catch(IllegalArgumentException e) - { - throw new CustomException("IllegalArgumentException","ObjectMapper not able to convertValue in userCall"); - } - } - - - /** - * Parses date formats to long for all users in responseMap - * @param responeMap LinkedHashMap got from user api response - */ - - public void parseResponse(LinkedHashMap responeMap, String dobFormat){ - List users = (List)responeMap.get("user"); - String format1 = "dd-MM-yyyy HH:mm:ss"; - if(users!=null){ - users.forEach( map -> { - map.put("createdDate",dateTolong((String)map.get("createdDate"),format1)); - if((String)map.get("lastModifiedDate")!=null) - map.put("lastModifiedDate",dateTolong((String)map.get("lastModifiedDate"),format1)); - if((String)map.get("dob")!=null) - map.put("dob",dateTolong((String)map.get("dob"),dobFormat)); - if((String)map.get("pwdExpiryDate")!=null) - map.put("pwdExpiryDate",dateTolong((String)map.get("pwdExpiryDate"),format1)); - } - ); - } - } - - /** - * Converts date to long - * @param date date to be parsed - * @param format Format of the date - * @return Long value of date - */ - private Long dateTolong(String date,String format){ - SimpleDateFormat f = new SimpleDateFormat(format); - Date d = null; - try { - d = f.parse(date); - } catch (ParseException e) { - throw new CustomException("INVALID_DATE_FORMAT","Failed to parse date format in user"); - } - return d.getTime(); - } - - /** - * enriches the userInfo with statelevel tenantId and other fields - * @param mobileNumber - * @param tenantId - * @param userInfo - */ - public void addUserDefaultFields(String mobileNumber,String tenantId, User userInfo){ - Role role = getCitizenRole(tenantId); - userInfo.setRoles(Collections.singletonList(role)); - userInfo.setType("CITIZEN"); - userInfo.setUserName(mobileNumber); - userInfo.setTenantId(getStateLevelTenant(tenantId)); - userInfo.setActive(true); - } - - /** - * Returns role object for citizen - * @param tenantId - * @return - */ - private Role getCitizenRole(String tenantId){ - Role role = new Role(); - role.setCode("CITIZEN"); - role.setName("Citizen"); - role.setTenantId(getStateLevelTenant(tenantId)); - return role; - } - - public String getStateLevelTenant(String tenantId){ - return tenantId.split("\\.")[0]; - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/validator/BirthApplicationValidator.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/validator/BirthApplicationValidator.java deleted file mode 100644 index dd48b2a24b2..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/validator/BirthApplicationValidator.java +++ /dev/null @@ -1,36 +0,0 @@ -package digit.validator; - -import digit.repository.BirthRegistrationRepository; -import digit.web.models.BirthApplicationSearchCriteria; -import digit.web.models.BirthRegistrationApplication; -import digit.web.models.BirthRegistrationRequest; -import org.egov.tracer.model.CustomException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.ObjectUtils; - -import java.util.List; -import java.util.stream.Collectors; - -@Component -public class BirthApplicationValidator { - - @Autowired - private BirthRegistrationRepository repository; - - public void validateBirthApplication(BirthRegistrationRequest birthRegistrationRequest) { - birthRegistrationRequest.getBirthRegistrationApplications().forEach(application -> { - if(ObjectUtils.isEmpty(application.getTenantId())) - throw new CustomException("EG_BT_APP_ERR", "tenantId is mandatory for creating birth registration applications"); - }); - } - - public List validateApplicationUpdateRequest(BirthRegistrationRequest birthRegistrationRequest) { - List ids = birthRegistrationRequest.getBirthRegistrationApplications().stream().map(BirthRegistrationApplication::getId).collect(Collectors.toList()); - List birthRegistrationApplications = repository.getApplications(BirthApplicationSearchCriteria.builder().ids(ids).build()); - if(birthRegistrationApplications.size() != ids.size()) - throw new CustomException("APPLICATION_DOES_NOT_EXIST", "One of the application ids does not exist."); - return birthRegistrationApplications; - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/controllers/V1ApiController.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/controllers/V1ApiController.java deleted file mode 100644 index 00e98e24e9c..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/controllers/V1ApiController.java +++ /dev/null @@ -1,72 +0,0 @@ -package digit.web.controllers; - - -import com.fasterxml.jackson.databind.ObjectMapper; -import digit.service.BirthRegistrationService; -import digit.util.ResponseInfoFactory; -import digit.web.models.*; -import io.swagger.annotations.ApiParam; -import lombok.ToString; -import lombok.extern.slf4j.Slf4j; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import javax.servlet.http.HttpServletRequest; -import javax.validation.Valid; -import java.util.Collections; -import java.util.List; -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-07-26T12:39:05.988+05:30") -@Slf4j -@ToString -@Controller -@RequestMapping("/birth-services") -public class V1ApiController{ - - private final ObjectMapper objectMapper; - - private final HttpServletRequest request; - - private BirthRegistrationService birthRegistrationService; - - @Autowired - private ResponseInfoFactory responseInfoFactory; - - @Autowired - public V1ApiController(ObjectMapper objectMapper, HttpServletRequest request, BirthRegistrationService birthRegistrationService) { - this.objectMapper = objectMapper; - this.request = request; - this.birthRegistrationService = birthRegistrationService; - } - - @RequestMapping(value="/v1/registration/_create", method = RequestMethod.POST) - public ResponseEntity v1RegistrationCreatePost(@ApiParam(value = "Details for the new Birth Registration Application(s) + RequestInfo meta data." ,required=true ) @Valid @RequestBody BirthRegistrationRequest birthRegistrationRequest) { - List applications = birthRegistrationService.registerBtRequest(birthRegistrationRequest); - ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(birthRegistrationRequest.getRequestInfo(), true); - BirthRegistrationResponse response = BirthRegistrationResponse.builder().birthRegistrationApplications(applications).responseInfo(responseInfo).build(); - return new ResponseEntity<>(response, HttpStatus.OK); - } - - @RequestMapping(value="/v1/registration/_search", method = RequestMethod.POST) - public ResponseEntity v1RegistrationSearchPost(@RequestBody RequestInfoWrapper requestInfoWrapper, @Valid @ModelAttribute BirthApplicationSearchCriteria birthApplicationSearchCriteria) { - List applications = birthRegistrationService.searchBtApplications(requestInfoWrapper.getRequestInfo(), birthApplicationSearchCriteria); - ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true); - BirthRegistrationResponse response = BirthRegistrationResponse.builder().birthRegistrationApplications(applications).responseInfo(responseInfo).build(); - return new ResponseEntity<>(response,HttpStatus.OK); - } - - @RequestMapping(value="/v1/registration/_update", method = RequestMethod.POST) - public ResponseEntity v1RegistrationUpdatePost(@ApiParam(value = "Details for the new (s) + RequestInfo meta data." ,required=true ) @Valid @RequestBody BirthRegistrationRequest birthRegistrationRequest) { - List applications = birthRegistrationService.updateBtApplication(birthRegistrationRequest); - ResponseInfo responseInfo = responseInfoFactory.createResponseInfoFromRequestInfo(birthRegistrationRequest.getRequestInfo(), true); - BirthRegistrationResponse response = BirthRegistrationResponse.builder().birthRegistrationApplications(applications).responseInfo(responseInfo).build(); - return new ResponseEntity<>(response, HttpStatus.OK); - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Action.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Action.java deleted file mode 100644 index 4fe5eab073a..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Action.java +++ /dev/null @@ -1,56 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId","currentState","action"}) -public class Action { - - @Size(max=256) - @JsonProperty("uuid") - private String uuid; - - @Size(max=256) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max=256) - @JsonProperty("currentState") - private String currentState; - - @Size(max=256) - @JsonProperty("action") - private String action; - - @Size(max=256) - @JsonProperty("nextState") - private String nextState; - - @Size(max=1024) - @JsonProperty("roles") - @Valid - private List roles; - - private AuditDetails auditDetails; - - - public Action addRolesItem(String rolesItem) { - if (this.roles == null) { - this.roles = new ArrayList<>(); - } - this.roles.add(rolesItem); - return this; - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Address.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Address.java deleted file mode 100644 index 6f8561c1dd3..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Address.java +++ /dev/null @@ -1,76 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -/** - * Representation of a address. Indiavidual APIs may choose to extend from this using allOf if more details needed to be added in their case. - */ -@ApiModel(description = "Representation of a address. Indiavidual APIs may choose to extend from this using allOf if more details needed to be added in their case. ") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Address { - - @JsonProperty("id") - private String id; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("doorNo") - private String doorNo = null; - - @JsonProperty("latitude") - private Double latitude = null; - - @JsonProperty("longitude") - private Double longitude = null; - - @JsonProperty("addressId") - private String addressId = null; - - @JsonProperty("addressNumber") - private String addressNumber = null; - - @JsonProperty("type") - private String type = null; - - @JsonProperty("addressLine1") - private String addressLine1 = null; - - @JsonProperty("addressLine2") - private String addressLine2 = null; - - @JsonProperty("landmark") - private String landmark = null; - - @JsonProperty("city") - private String city = null; - - @JsonProperty("pincode") - private String pincode = null; - - @JsonProperty("detail") - private String detail = null; - - @JsonProperty("buildingName") - private String buildingName = null; - - @JsonProperty("street") - private String street = null; - - @JsonProperty("locality") - private Boundary locality = null; - - @JsonProperty("registrationId") - private String registrationId; - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Applicant.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Applicant.java deleted file mode 100644 index c89a2f8cace..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Applicant.java +++ /dev/null @@ -1,142 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.List; - -/** - * Details of the user applying for birth registration - */ -@ApiModel(description = "Details of the user applying for birth registration") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Applicant { - @JsonProperty("id") - private Long id = null; - - @JsonProperty("userName") - private String userName = null; - - @JsonProperty("password") - private String password = null; - - @JsonProperty("salutation") - private String salutation = null; - - @JsonProperty("name") - private String name = null; - - @JsonProperty("gender") - private String gender = null; - - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @JsonProperty("emailId") - private String emailId = null; - - @JsonProperty("altContactNumber") - private String altContactNumber = null; - - @JsonProperty("pan") - private String pan = null; - - @JsonProperty("aadhaarNumber") - private String aadhaarNumber = null; - - @JsonProperty("permanentAddress") - private String permanentAddress = null; - - @JsonProperty("permanentCity") - private String permanentCity = null; - - @JsonProperty("permanentPincode") - private String permanentPincode = null; - - @JsonProperty("correspondenceCity") - private String correspondenceCity = null; - - @JsonProperty("correspondencePincode") - private String correspondencePincode = null; - - @JsonProperty("correspondenceAddress") - private String correspondenceAddress = null; - - @JsonProperty("active") - private Boolean active = null; - - @JsonProperty("dob") - private LocalDate dob = null; - - @JsonProperty("pwdExpiryDate") - private LocalDate pwdExpiryDate = null; - - @JsonProperty("locale") - private String locale = null; - - @JsonProperty("type") - private String type = null; - - @JsonProperty("signature") - private String signature = null; - - @JsonProperty("accountLocked") - private Boolean accountLocked = null; - - @JsonProperty("roles") - @Valid - private List roles = null; - - @JsonProperty("fatherOrHusbandName") - private String fatherOrHusbandName = null; - - @JsonProperty("bloodGroup") - private String bloodGroup = null; - - @JsonProperty("identificationMark") - private String identificationMark = null; - - @JsonProperty("photo") - private String photo = null; - - @JsonProperty("createdBy") - private Long createdBy = null; - - @JsonProperty("createdDate") - private LocalDate createdDate = null; - - @JsonProperty("lastModifiedBy") - private Long lastModifiedBy = null; - - @JsonProperty("lastModifiedDate") - private LocalDate lastModifiedDate = null; - - @JsonProperty("otpReference") - private String otpReference = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - - public Applicant addRolesItem(Role rolesItem) { - if (this.roles == null) { - this.roles = new ArrayList<>(); - } - this.roles.add(rolesItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/AuditDetails.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/AuditDetails.java deleted file mode 100644 index a244e41bc83..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/AuditDetails.java +++ /dev/null @@ -1,35 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -/** - * Collection of audit related fields used by most models - */ -@ApiModel(description = "Collection of audit related fields used by most models") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class AuditDetails { - @JsonProperty("createdBy") - private String createdBy = null; - - @JsonProperty("lastModifiedBy") - private String lastModifiedBy = null; - - @JsonProperty("createdTime") - private Long createdTime = null; - - @JsonProperty("lastModifiedTime") - private Long lastModifiedTime = null; - - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Bill.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Bill.java deleted file mode 100644 index 86223908495..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Bill.java +++ /dev/null @@ -1,158 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.springframework.util.CollectionUtils; - -import javax.validation.Valid; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class Bill { - - @JsonProperty("id") - private String id; - - @JsonProperty("mobileNumber") - private String mobileNumber; - - @JsonProperty("paidBy") - private String paidBy; - - @JsonProperty("payerName") - private String payerName; - - @JsonProperty("payerAddress") - private String payerAddress; - - @JsonProperty("payerEmail") - private String payerEmail; - - @JsonProperty("payerId") - private String payerId; - - @JsonProperty("status") - private StatusEnum status; - - @JsonProperty("reasonForCancellation") - private String reasonForCancellation; - - @JsonProperty("isCancelled") - private Boolean isCancelled; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("billDetails") - @Valid - private List billDetails; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("collectionModesNotAllowed") - private List collectionModesNotAllowed; - - @JsonProperty("partPaymentAllowed") - private Boolean partPaymentAllowed; - - @JsonProperty("isAdvanceAllowed") - private Boolean isAdvanceAllowed; - - @JsonProperty("minimumAmountToBePaid") - private BigDecimal minimumAmountToBePaid; - - @JsonProperty("businessService") - private String businessService; - - @JsonProperty("totalAmount") - private BigDecimal totalAmount; - - @JsonProperty("consumerCode") - private String consumerCode; - - @JsonProperty("billNumber") - private String billNumber; - - @JsonProperty("billDate") - private Long billDate; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid; - - - - public enum StatusEnum { - ACTIVE("ACTIVE"), - - CANCELLED("CANCELLED"), - - PAID("PAID"), - - EXPIRED("EXPIRED"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - - @Override - @JsonValue - public String toString() { - return String.valueOf(value); - } - - public static boolean contains(String test) { - for (StatusEnum val : StatusEnum.values()) { - if (val.name().equalsIgnoreCase(test)) { - return true; - } - } - return false; - } - - @JsonCreator - public static StatusEnum fromValue(String text) { - for (StatusEnum b : StatusEnum.values()) { - if (String.valueOf(b.value).equals(text)) { - return b; - } - } - return null; - } - - } - - public Boolean addBillDetail(BillDetail billDetail) { - - if (CollectionUtils.isEmpty(billDetails)) { - - billDetails = new ArrayList<>(); - return billDetails.add(billDetail); - } else { - - if (!billDetails.contains(billDetail)) - return billDetails.add(billDetail); - else - return false; - } - } - - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BillAccountDetail.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BillAccountDetail.java deleted file mode 100644 index 1d5ab2d9d95..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BillAccountDetail.java +++ /dev/null @@ -1,56 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; - -import javax.validation.constraints.Size; -import java.math.BigDecimal; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode -public class BillAccountDetail { - - @Size(max = 64) - @JsonProperty("id") - private String id; - - @Size(max = 64) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max = 64) - @JsonProperty("billDetailId") - private String billDetailId; - - @Size(max = 64) - @JsonProperty("demandDetailId") - private String demandDetailId; - - @JsonProperty("order") - private Integer order; - - @JsonProperty("amount") - private BigDecimal amount; - - @JsonProperty("adjustedAmount") - private BigDecimal adjustedAmount; - - @JsonProperty("isActualDemand") - private Boolean isActualDemand; - - @Size(max = 64) - @JsonProperty("taxHeadCode") - private String taxHeadCode; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BillDetail.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BillDetail.java deleted file mode 100644 index bc0f7374b90..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BillDetail.java +++ /dev/null @@ -1,99 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; -import org.springframework.util.CollectionUtils; - -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Setter -@Getter -@ToString -@Builder -@NoArgsConstructor -@AllArgsConstructor -@EqualsAndHashCode(of = { "id" }) -public class BillDetail { - - @JsonProperty("id") - private String id; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("demandId") - private String demandId; - - @JsonProperty("billId") - private String billId; - - @JsonProperty("amount") - @NotNull - private BigDecimal amount; - - @JsonProperty("amountPaid") - private BigDecimal amountPaid; - - @NotNull - @JsonProperty("fromPeriod") - private Long fromPeriod; - - @NotNull - @JsonProperty("toPeriod") - private Long toPeriod; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("channel") - private String channel; - - @JsonProperty("voucherHeader") - private String voucherHeader; - - @JsonProperty("boundary") - private String boundary; - - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate; - - @JsonProperty("billAccountDetails") - private List billAccountDetails; - - @NotNull - @JsonProperty("collectionType") - private String collectionType; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - private String billDescription; - - @NotNull - @JsonProperty("expiryDate") - private Long expiryDate; - - - public Boolean addBillAccountDetail(BillAccountDetail billAccountDetail) { - - if (CollectionUtils.isEmpty(billAccountDetails)) { - - billAccountDetails = new ArrayList<>(); - return billAccountDetails.add(billAccountDetail); - } else { - - if (!billAccountDetails.contains(billAccountDetail)) - return billAccountDetails.add(billAccountDetail); - else - return false; - } - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthApplicationSearchCriteria.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthApplicationSearchCriteria.java deleted file mode 100644 index 904da6c4448..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthApplicationSearchCriteria.java +++ /dev/null @@ -1,29 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import java.util.List; - -@Data -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -public class BirthApplicationSearchCriteria { - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("status") - private String status; - - @JsonProperty("ids") - private List ids; - - @JsonProperty("applicationNumber") - private String applicationNumber; - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthRegistrationApplication.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthRegistrationApplication.java deleted file mode 100644 index c21043ca623..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthRegistrationApplication.java +++ /dev/null @@ -1,91 +0,0 @@ -package digit.web.models; - -import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import digit.web.models.Address; -import digit.web.models.AuditDetails; -import digit.web.models.FatherApplicant; -import digit.web.models.MotherApplicant; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.springframework.validation.annotation.Validated; -import javax.validation.Valid; -import javax.validation.constraints.*; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.Builder; - -/** - * A Object holds the basic data for a Birth Registration Application - */ -@ApiModel(description = "A Object holds the basic data for a Birth Registration Application") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class BirthRegistrationApplication { - - @JsonProperty("id") - private String id = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("applicationNumber") - private String applicationNumber = null; - - @JsonProperty("babyFirstName") - private String babyFirstName = null; - - @JsonProperty("babyLastName") - private String babyLastName = null; - - @JsonProperty("fatherMobileNumber") - private String fatherMobileNumber = null; - - @JsonProperty("motherMobileNumber") - private String motherMobileNumber = null; - - @JsonProperty("doctorName") - private String doctorName = null; - - @JsonProperty("hospitalName") - private String hospitalName = null; - - @JsonProperty("placeOfBirth") - private String placeOfBirth = null; - - @JsonProperty("timeOfBirth") - private Integer timeOfBirth = null; - - @JsonProperty("address") - private Address address = null; - - @JsonProperty("fatherOfApplicant") - private FatherApplicant father = null; - - @JsonProperty("motherOfApplicant") - private MotherApplicant mother = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - -// @JsonProperty("father") -// private User father = null; -// -// @JsonProperty("mother") -// private User mother = null; - - @Valid - @JsonProperty("workflow") - private Workflow workflow = null; - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthRegistrationRequest.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthRegistrationRequest.java deleted file mode 100644 index 041a879f04c..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthRegistrationRequest.java +++ /dev/null @@ -1,43 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * Contract class to receive request. Array of items are used in case of create, whereas single item is used for update - */ -@ApiModel(description = "Contract class to receive request. Array of items are used in case of create, whereas single item is used for update") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class BirthRegistrationRequest { - @JsonProperty("RequestInfo") - private RequestInfo requestInfo = null; - - @JsonProperty("BirthRegistrationApplications") - @Valid - private List birthRegistrationApplications = null; - - - public BirthRegistrationRequest addBirthRegistrationApplicationsItem(BirthRegistrationApplication birthRegistrationApplicationsItem) { - if (this.birthRegistrationApplications == null) { - this.birthRegistrationApplications = new ArrayList<>(); - } - this.birthRegistrationApplications.add(birthRegistrationApplicationsItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthRegistrationResponse.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthRegistrationResponse.java deleted file mode 100644 index 50450a7d0e7..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BirthRegistrationResponse.java +++ /dev/null @@ -1,43 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * Contract class to send response. Array of items are used in case of search results or response for create, whereas single item is used for update - */ -@ApiModel(description = "Contract class to send response. Array of items are used in case of search results or response for create, whereas single item is used for update") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class BirthRegistrationResponse { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("BirthRegistrationApplications") - @Valid - private List birthRegistrationApplications = null; - - - public BirthRegistrationResponse addBirthRegistrationApplicationsItem(BirthRegistrationApplication birthRegistrationApplicationsItem) { - if (this.birthRegistrationApplications == null) { - this.birthRegistrationApplications = new ArrayList<>(); - } - this.birthRegistrationApplications.add(birthRegistrationApplicationsItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Boundary.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Boundary.java deleted file mode 100644 index 9c9c18061aa..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Boundary.java +++ /dev/null @@ -1,55 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * Boundary - */ -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Boundary { - @JsonProperty("code") - private String code = null; - - @JsonProperty("name") - private String name = null; - - @JsonProperty("label") - private String label = null; - - @JsonProperty("latitude") - private String latitude = null; - - @JsonProperty("longitude") - private String longitude = null; - - @JsonProperty("children") - @Valid - private List children = null; - - @JsonProperty("materializedPath") - private String materializedPath = null; - - - public Boundary addChildrenItem(Boundary childrenItem) { - if (this.children == null) { - this.children = new ArrayList<>(); - } - this.children.add(childrenItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BusinessService.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BusinessService.java deleted file mode 100644 index 7c28495ae0a..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BusinessService.java +++ /dev/null @@ -1,90 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId","businessService"}) -@JsonInclude(JsonInclude.Include.NON_NULL) -public class BusinessService { - - @Size(max=256) - @JsonProperty("tenantId") - private String tenantId = null; - - @Size(max=256) - @JsonProperty("uuid") - private String uuid = null; - - @Size(max=256) - @JsonProperty("businessService") - private String businessService = null; - - @Size(max=256) - @JsonProperty("business") - private String business = null; - - @Size(max=1024) - @JsonProperty("getUri") - private String getUri = null; - - @Size(max=1024) - @JsonProperty("postUri") - private String postUri = null; - - @JsonProperty("businessServiceSla") - private Long businessServiceSla = null; - - @NotNull - @Valid - @JsonProperty("states") - private List states = null; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails = null; - - - - public BusinessService addStatesItem(State statesItem) { - if (this.states == null) { - this.states = new ArrayList<>(); - } - this.states.add(statesItem); - return this; - } - - - /** - * Returns the currentState with the given uuid if not present returns null - * @param uuid the uuid of the currentState to be returned - * @return - */ - public State getStateFromUuid(String uuid) { - State state = null; - if(this.states!=null){ - for(State s : this.states){ - if(s.getUuid().equalsIgnoreCase(uuid)){ - state = s; - break; - } - } - } - return state; - } - - - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BusinessServiceResponse.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BusinessServiceResponse.java deleted file mode 100644 index af8d29e3770..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/BusinessServiceResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.ArrayList; -import java.util.List; - - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@ToString -public class BusinessServiceResponse { - - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("BusinessServices") - @Valid - @NotNull - private List businessServices; - - - public BusinessServiceResponse addBusinessServiceItem(BusinessService businessServiceItem) { - if (this.businessServices == null) { - this.businessServices = new ArrayList<>(); - } - this.businessServices.add(businessServiceItem); - return this; - } - - - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Calculation.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Calculation.java deleted file mode 100644 index 78fc5103e69..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Calculation.java +++ /dev/null @@ -1,30 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -/** - * Calculation - */ -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Calculation { - @JsonProperty("applicationNumber") - private String applicationNumber = null; - - @JsonProperty("totalAmount") - private Double totalAmount = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CalculationCriteria.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CalculationCriteria.java deleted file mode 100644 index 6795983fcc7..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CalculationCriteria.java +++ /dev/null @@ -1,32 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -/** - * Criteria to calculate charges for birth registration. - */ -@ApiModel(description = "Criteria to calculate charges for birth registration.") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class CalculationCriteria { - @JsonProperty("birthregistrationapplication") - private BirthRegistrationApplication birthregistrationapplication = null; - - @JsonProperty("applicationNumber") - private String applicationNumber = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CalculationReq.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CalculationReq.java deleted file mode 100644 index 8f521ac8020..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CalculationReq.java +++ /dev/null @@ -1,38 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * CalculationReq - */ -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class CalculationReq { - @JsonProperty("RequestInfo") - private RequestInfo requestInfo = null; - - @JsonProperty("CalculationCriteria") - @Valid - private List calculationCriteria = new ArrayList<>(); - - - public CalculationReq addCalculationCriteriaItem(CalculationCriteria calculationCriteriaItem) { - this.calculationCriteria.add(calculationCriteriaItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CalculationRes.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CalculationRes.java deleted file mode 100644 index bba37735840..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CalculationRes.java +++ /dev/null @@ -1,41 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * CalculationRes - */ -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-11-04T14:15:45.774+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class CalculationRes { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("Calculation") - @Valid - private List calculation = null; - - - public CalculationRes addCalculationItem(Calculation calculationItem) { - if (this.calculation == null) { - this.calculation = new ArrayList<>(); - } - this.calculation.add(calculationItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CreateUserRequest.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CreateUserRequest.java deleted file mode 100644 index 107b9972389..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/CreateUserRequest.java +++ /dev/null @@ -1,20 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.RequestInfo; - -@AllArgsConstructor -@Getter -@NoArgsConstructor -public class CreateUserRequest { - - @JsonProperty("requestInfo") - private RequestInfo requestInfo; - - @JsonProperty("user") - private User user; - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Document.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Document.java deleted file mode 100644 index 9549883c5fb..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Document.java +++ /dev/null @@ -1,38 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -/** - * This object holds list of documents attached during the transaciton for a property - */ -@ApiModel(description = "This object holds list of documents attached during the transaciton for a property") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Document { - @JsonProperty("id") - private String id = null; - - @JsonProperty("documentType") - private String documentType = null; - - @JsonProperty("fileStore") - private String fileStore = null; - - @JsonProperty("documentUid") - private String documentUid = null; - - @JsonProperty("additionalDetails") - private Object additionalDetails = null; - - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Error.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Error.java deleted file mode 100644 index 2e169cf4ea6..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Error.java +++ /dev/null @@ -1,48 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400. - */ -@ApiModel(description = "Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400.") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Error { - @JsonProperty("code") - private String code = null; - - @JsonProperty("message") - private String message = null; - - @JsonProperty("description") - private String description = null; - - @JsonProperty("params") - @Valid - private List params = null; - - - public Error addParamsItem(String paramsItem) { - if (this.params == null) { - this.params = new ArrayList<>(); - } - this.params.add(paramsItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ErrorRes.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ErrorRes.java deleted file mode 100644 index aadc513d943..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ErrorRes.java +++ /dev/null @@ -1,43 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure. - */ -@ApiModel(description = "All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure.") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class ErrorRes { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo = null; - - @JsonProperty("Errors") - @Valid - private List errors = null; - - - public ErrorRes addErrorsItem(Error errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList<>(); - } - this.errors.add(errorsItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/FatherApplicant.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/FatherApplicant.java deleted file mode 100644 index b1aea741efc..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/FatherApplicant.java +++ /dev/null @@ -1,142 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.List; - -/** - * Details of the user applying for birth registration - */ -@ApiModel(description = "Details of the user applying for birth registration") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class FatherApplicant { - @JsonProperty("id") - private String id = null; - - @JsonProperty("userName") - private String userName = null; - - @JsonProperty("password") - private String password = null; - - @JsonProperty("salutation") - private String salutation = null; - - @JsonProperty("name") - private String name = null; - - @JsonProperty("gender") - private String gender = null; - - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @JsonProperty("emailId") - private String emailId = null; - - @JsonProperty("altContactNumber") - private String altContactNumber = null; - - @JsonProperty("pan") - private String pan = null; - - @JsonProperty("aadhaarNumber") - private String aadhaarNumber = null; - - @JsonProperty("permanentAddress") - private String permanentAddress = null; - - @JsonProperty("permanentCity") - private String permanentCity = null; - - @JsonProperty("permanentPincode") - private String permanentPincode = null; - - @JsonProperty("correspondenceCity") - private String correspondenceCity = null; - - @JsonProperty("correspondencePincode") - private String correspondencePincode = null; - - @JsonProperty("correspondenceAddress") - private String correspondenceAddress = null; - - @JsonProperty("active") - private Boolean active = null; - - @JsonProperty("dob") - private LocalDate dob = null; - - @JsonProperty("pwdExpiryDate") - private LocalDate pwdExpiryDate = null; - - @JsonProperty("locale") - private String locale = null; - - @JsonProperty("type") - private String type = null; - - @JsonProperty("signature") - private String signature = null; - - @JsonProperty("accountLocked") - private Boolean accountLocked = null; - - @JsonProperty("roles") - @Valid - private List roles = null; - - @JsonProperty("fatherOrHusbandName") - private String fatherOrHusbandName = null; - - @JsonProperty("bloodGroup") - private String bloodGroup = null; - - @JsonProperty("identificationMark") - private String identificationMark = null; - - @JsonProperty("photo") - private String photo = null; - - @JsonProperty("createdBy") - private Long createdBy = null; - - @JsonProperty("createdDate") - private LocalDate createdDate = null; - - @JsonProperty("lastModifiedBy") - private Long lastModifiedBy = null; - - @JsonProperty("lastModifiedDate") - private LocalDate lastModifiedDate = null; - - @JsonProperty("otpReference") - private String otpReference = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - - public FatherApplicant addRolesItem(Role rolesItem) { - if (this.roles == null) { - this.roles = new ArrayList<>(); - } - this.roles.add(rolesItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdGenerationRequest.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdGenerationRequest.java deleted file mode 100644 index 991c42964e4..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdGenerationRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.RequestInfo; - -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class IdGenerationRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - private List idRequests; - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdGenerationResponse.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdGenerationResponse.java deleted file mode 100644 index 97d50b46808..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdGenerationResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -package digit.web.models; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class IdGenerationResponse { - - private ResponseInfo responseInfo; - - private List idResponses; - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdRequest.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdRequest.java deleted file mode 100644 index 908ca689e91..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package digit.web.models; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import javax.validation.constraints.NotNull; - - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class IdRequest { - - @JsonProperty("idName") - @NotNull - private String idName; - - @NotNull - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("format") - private String format; - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdResponse.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdResponse.java deleted file mode 100644 index 45c3dbc6f51..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/IdResponse.java +++ /dev/null @@ -1,17 +0,0 @@ -package digit.web.models; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class IdResponse { - - private String id; - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/MotherApplicant.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/MotherApplicant.java deleted file mode 100644 index a731c702647..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/MotherApplicant.java +++ /dev/null @@ -1,142 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.List; - -/** - * Details of the user applying for birth registration - */ -@ApiModel(description = "Details of the user applying for birth registration") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class MotherApplicant { - @JsonProperty("id") - private String id = null; - - @JsonProperty("userName") - private String userName = null; - - @JsonProperty("password") - private String password = null; - - @JsonProperty("salutation") - private String salutation = null; - - @JsonProperty("name") - private String name = null; - - @JsonProperty("gender") - private String gender = null; - - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @JsonProperty("emailId") - private String emailId = null; - - @JsonProperty("altContactNumber") - private String altContactNumber = null; - - @JsonProperty("pan") - private String pan = null; - - @JsonProperty("aadhaarNumber") - private String aadhaarNumber = null; - - @JsonProperty("permanentAddress") - private String permanentAddress = null; - - @JsonProperty("permanentCity") - private String permanentCity = null; - - @JsonProperty("permanentPincode") - private String permanentPincode = null; - - @JsonProperty("correspondenceCity") - private String correspondenceCity = null; - - @JsonProperty("correspondencePincode") - private String correspondencePincode = null; - - @JsonProperty("correspondenceAddress") - private String correspondenceAddress = null; - - @JsonProperty("active") - private Boolean active = null; - - @JsonProperty("dob") - private LocalDate dob = null; - - @JsonProperty("pwdExpiryDate") - private LocalDate pwdExpiryDate = null; - - @JsonProperty("locale") - private String locale = null; - - @JsonProperty("type") - private String type = null; - - @JsonProperty("signature") - private String signature = null; - - @JsonProperty("accountLocked") - private Boolean accountLocked = null; - - @JsonProperty("roles") - @Valid - private List roles = null; - - @JsonProperty("fatherOrHusbandName") - private String fatherOrHusbandName = null; - - @JsonProperty("bloodGroup") - private String bloodGroup = null; - - @JsonProperty("identificationMark") - private String identificationMark = null; - - @JsonProperty("photo") - private String photo = null; - - @JsonProperty("createdBy") - private Long createdBy = null; - - @JsonProperty("createdDate") - private LocalDate createdDate = null; - - @JsonProperty("lastModifiedBy") - private Long lastModifiedBy = null; - - @JsonProperty("lastModifiedDate") - private LocalDate lastModifiedDate = null; - - @JsonProperty("otpReference") - private String otpReference = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - - public MotherApplicant addRolesItem(Role rolesItem) { - if (this.roles == null) { - this.roles = new ArrayList<>(); - } - this.roles.add(rolesItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Payment.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Payment.java deleted file mode 100644 index 7ce384e2045..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Payment.java +++ /dev/null @@ -1,109 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@EqualsAndHashCode -public class Payment { - - @Size(max = 64) - @JsonProperty("id") - private String id; - - @NotNull - @Size(max = 64) - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("totalDue") - private BigDecimal totalDue; - - @NotNull - @JsonProperty("totalAmountPaid") - private BigDecimal totalAmountPaid; - - @Size(max = 128) - @JsonProperty("transactionNumber") - private String transactionNumber; - - @JsonProperty("transactionDate") - private Long transactionDate; - - @NotNull - @JsonProperty("paymentMode") - private String paymentMode; - - @JsonProperty("instrumentDate") - private Long instrumentDate; - - @Size(max = 128) - @JsonProperty("instrumentNumber") - private String instrumentNumber; - - @JsonProperty("instrumentStatus") - private String instrumentStatus; - - @Size(max = 64) - @JsonProperty("ifscCode") - private String ifscCode; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("paymentDetails") - @Valid - private List paymentDetails; - - @Size(max = 128) - @NotNull - @JsonProperty("paidBy") - private String paidBy; - - @Size(max = 64) - @NotNull - @JsonProperty("mobileNumber") - private String mobileNumber; - - @Size(max = 128) - @JsonProperty("payerName") - private String payerName; - - @Size(max = 1024) - @JsonProperty("payerAddress") - private String payerAddress; - - @Size(max = 64) - @JsonProperty("payerEmail") - private String payerEmail; - - @Size(max = 64) - @JsonProperty("payerId") - private String payerId; - - @JsonProperty("paymentStatus") - private String paymentStatus; - - public Payment addpaymentDetailsItem(PaymentDetail paymentDetail) { - if (this.paymentDetails == null) { - this.paymentDetails = new ArrayList<>(); - } - this.paymentDetails.add(paymentDetail); - return this; - } - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/PaymentDetail.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/PaymentDetail.java deleted file mode 100644 index bd56b4519b4..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/PaymentDetail.java +++ /dev/null @@ -1,67 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; -import lombok.*; - -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.math.BigDecimal; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@EqualsAndHashCode -public class PaymentDetail { - - @Size(max = 64) - @JsonProperty("id") - private String id; - - @Size(max = 64) - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("totalDue") - private BigDecimal totalDue; - - @NotNull - @JsonProperty("totalAmountPaid") - private BigDecimal totalAmountPaid; - - @Size(max = 64) - @JsonProperty("receiptNumber") - private String receiptNumber; - - @Size(max = 64) - @JsonProperty("manualReceiptNumber") - private String manualReceiptNumber; - - @JsonProperty("manualReceiptDate") - private Long manualReceiptDate; - - @JsonProperty("receiptDate") - private Long receiptDate; - - @JsonProperty("receiptType") - private String receiptType; - - @JsonProperty("businessService") - private String businessService; - - @NotNull - @Size(max = 64) - @JsonProperty("billId") - private String billId; - - @JsonProperty("bill") - private Bill bill; - - @JsonProperty("additionalDetails") - private JsonNode additionalDetails; - - @JsonProperty("auditDetails") - private AuditDetails auditDetails; - -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/PaymentRequest.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/PaymentRequest.java deleted file mode 100644 index d2eb9ee7cad..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/PaymentRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.egov.common.contract.request.RequestInfo; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class PaymentRequest { - - @NotNull - @Valid - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @NotNull - @Valid - @JsonProperty("Payment") - private Payment payment; - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ProcessInstance.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ProcessInstance.java deleted file mode 100644 index e581662cf24..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ProcessInstance.java +++ /dev/null @@ -1,73 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@EqualsAndHashCode(of = { "id" }) -@ToString -public class ProcessInstance { - - @Size(max = 64) - @JsonProperty("id") - private String id; - - @NotNull - @Size(max = 128) - @JsonProperty("tenantId") - private String tenantId; - - @NotNull - @Size(max = 128) - @JsonProperty("businessService") - private String businessService; - - @NotNull - @Size(max = 128) - @JsonProperty("businessId") - private String businessId; - - @NotNull - @Size(max = 128) - @JsonProperty("action") - private String action; - - @NotNull - @Size(max = 64) - @JsonProperty("moduleName") - private String moduleName; - - @JsonProperty("state") - private State state; - - @JsonProperty("comment") - private String comment; - - @JsonProperty("documents") - @Valid - private List documents; - - @JsonProperty("assignes") - private List assignes; - - public ProcessInstance addDocumentsItem(Document documentsItem) { - if (this.documents == null) { - this.documents = new ArrayList<>(); - } - if (!this.documents.contains(documentsItem)) - this.documents.add(documentsItem); - - return this; - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ProcessInstanceRequest.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ProcessInstanceRequest.java deleted file mode 100644 index 25603738136..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ProcessInstanceRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; - -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import java.util.ArrayList; -import java.util.List; - - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -public class ProcessInstanceRequest { - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("ProcessInstances") - @Valid - @NotNull - private List processInstances; - - - public ProcessInstanceRequest addProcessInstanceItem(ProcessInstance processInstanceItem) { - if (this.processInstances == null) { - this.processInstances = new ArrayList<>(); - } - this.processInstances.add(processInstanceItem); - return this; - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ProcessInstanceResponse.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ProcessInstanceResponse.java deleted file mode 100644 index 31cacadf997..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/ProcessInstanceResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.response.ResponseInfo; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class ProcessInstanceResponse { - @JsonProperty("ResponseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("ProcessInstances") - @Valid - private List processInstances; - - - public ProcessInstanceResponse addProceInstanceItem(ProcessInstance proceInstanceItem) { - if (this.processInstances == null) { - this.processInstances = new ArrayList<>(); - } - this.processInstances.add(proceInstanceItem); - return this; - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/RequestInfoWrapper.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/RequestInfoWrapper.java deleted file mode 100644 index 160a6d3b93f..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/RequestInfoWrapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.egov.common.contract.request.RequestInfo; - - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class RequestInfoWrapper { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Role.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Role.java deleted file mode 100644 index 1d3301a80c3..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Role.java +++ /dev/null @@ -1,50 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import java.time.LocalDate; - -/** - * Role - */ -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Role { - @JsonProperty("id") - private Long id = null; - - @JsonProperty("name") - private String name = null; - - @JsonProperty("code") - private String code = null; - - @JsonProperty("description") - private String description = null; - - @JsonProperty("createdBy") - private Long createdBy = null; - - @JsonProperty("createdDate") - private LocalDate createdDate = null; - - @JsonProperty("lastModifiedBy") - private Long lastModifiedBy = null; - - @JsonProperty("lastModifiedDate") - private LocalDate lastModifiedDate = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Role2.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Role2.java deleted file mode 100644 index 4448dd5b5ad..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Role2.java +++ /dev/null @@ -1,32 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -/** - * minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes - */ -@ApiModel(description = "minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes ") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Role2 { - @JsonProperty("name") - private String name = null; - - @JsonProperty("code") - private String code = null; - - @JsonProperty("description") - private String description = null; - - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/SMSRequest.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/SMSRequest.java deleted file mode 100644 index 0b753f5cfe2..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/SMSRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package digit.web.models; - -import lombok.*; - -@Getter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -public class SMSRequest { - private String mobileNumber; - private String message; -} diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/State.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/State.java deleted file mode 100644 index 352bd27fc87..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/State.java +++ /dev/null @@ -1,70 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; - -import javax.validation.Valid; -import javax.validation.constraints.Size; -import java.util.ArrayList; -import java.util.List; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -@EqualsAndHashCode(of = {"tenantId","businessServiceId","state"}) -public class State { - - @Size(max=256) - @JsonProperty("uuid") - private String uuid; - - @Size(max=256) - @JsonProperty("tenantId") - private String tenantId; - - @Size(max=256) - @JsonProperty("businessServiceId") - private String businessServiceId; - - @JsonProperty("sla") - private Long sla; - - @Size(max=256) - @JsonProperty("state") - private String state; - - @Size(max=256) - @JsonProperty("applicationStatus") - private String applicationStatus; - - @JsonProperty("docUploadRequired") - private Boolean docUploadRequired; - - @JsonProperty("isStartState") - private Boolean isStartState; - - @JsonProperty("isTerminateState") - private Boolean isTerminateState; - - @JsonProperty("isStateUpdatable") - private Boolean isStateUpdatable; - - @JsonProperty("actions") - @Valid - private List actions; - - private AuditDetails auditDetails; - - - public State addActionsItem(Action actionsItem) { - if (this.actions == null) { - this.actions = new ArrayList<>(); - } - this.actions.add(actionsItem); - return this; - } - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/TenantRole.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/TenantRole.java deleted file mode 100644 index f813d179acc..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/TenantRole.java +++ /dev/null @@ -1,39 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * User role carries the tenant related role information for the user. A user can have multiple roles per tenant based on the need of the tenant. A user may also have multiple roles for multiple tenants. - */ -@ApiModel(description = "User role carries the tenant related role information for the user. A user can have multiple roles per tenant based on the need of the tenant. A user may also have multiple roles for multiple tenants.") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class TenantRole { - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("roles") - @Valid - private List roles = new ArrayList<>(); - - - public TenantRole addRolesItem(Role rolesItem) { - this.roles.add(rolesItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/User.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/User.java deleted file mode 100644 index 917f7f0129c..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/User.java +++ /dev/null @@ -1,130 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * User - */ -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -@ToString -public class User { - @JsonProperty("id") - private Long id = null; - - @JsonProperty("uuid") - private String uuid = null; - - @JsonProperty("userName") - private String userName = null; - - @JsonProperty("password") - private String password = null; - - @JsonProperty("salutation") - private String salutation = null; - - @JsonProperty("name") - private String name = null; - - @JsonProperty("gender") - private String gender = null; - - @JsonProperty("mobileNumber") - private String mobileNumber = null; - - @JsonProperty("emailId") - private String emailId = null; - - @JsonProperty("altContactNumber") - private String altContactNumber = null; - - @JsonProperty("pan") - private String pan = null; - - @JsonProperty("aadhaarNumber") - private String aadhaarNumber = null; - - @JsonProperty("permanentAddress") - private String permanentAddress = null; - - @JsonProperty("permanentCity") - private String permanentCity = null; - - @JsonProperty("permanentPincode") - private String permanentPincode = null; - - - @JsonProperty("roles") - @Valid - private List roles = null;@JsonProperty("correspondenceCity") - private String correspondenceCity = null; - - @JsonProperty("correspondencePincode") - private String correspondencePincode = null; - - @JsonProperty("correspondenceAddress") - private String correspondenceAddress = null; - - @JsonProperty("active") - private Boolean active = null; - - @JsonProperty("locale") - private String locale = null; - - @JsonProperty("type") - private String type = null; - - @JsonProperty("signature") - private String signature = null; - - @JsonProperty("accountLocked") - private Boolean accountLocked = null; - - @JsonProperty("fatherOrHusbandName") - private String fatherOrHusbandName = null; - - @JsonProperty("bloodGroup") - private String bloodGroup = null; - - @JsonProperty("identificationMark") - private String identificationMark = null; - - @JsonProperty("photo") - private String photo = null; - - @JsonProperty("createdBy") - private Long createdBy = null; - - @JsonProperty("lastModifiedBy") - private Long lastModifiedBy = null; - - @JsonProperty("otpReference") - private String otpReference = null; - - @JsonProperty("tenantId") - private String tenantId = null; - - - public User addRolesItem(Role rolesItem) { - if (this.roles == null) { - this.roles = new ArrayList<>(); - } - this.roles.add(rolesItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/UserDetailResponse.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/UserDetailResponse.java deleted file mode 100644 index 4571b31d29e..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/UserDetailResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.ToString; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@AllArgsConstructor -@NoArgsConstructor -@Getter -@ToString -public class UserDetailResponse { - @JsonProperty("responseInfo") - ResponseInfo responseInfo; - - @JsonProperty("user") - List user; -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/UserInfo.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/UserInfo.java deleted file mode 100644 index 173898eddef..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/UserInfo.java +++ /dev/null @@ -1,69 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server. - */ -@ApiModel(description = "This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server.") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-10-25T21:43:19.662+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class UserInfo { - @JsonProperty("tenantId") - private String tenantId = null; - - @JsonProperty("uuid") - private String uuid = null; - - @JsonProperty("userName") - private String userName = null; - - @JsonProperty("password") - private String password = null; - - @JsonProperty("idToken") - private String idToken = null; - - @JsonProperty("mobile") - private String mobile = null; - - @JsonProperty("email") - private String email = null; - - @JsonProperty("primaryrole") - @Valid - private List primaryrole = new ArrayList<>(); - - @JsonProperty("additionalroles") - @Valid - private List additionalroles = null; - - - public UserInfo addPrimaryroleItem(Role primaryroleItem) { - this.primaryrole.add(primaryroleItem); - return this; - } - - public UserInfo addAdditionalrolesItem(TenantRole additionalrolesItem) { - if (this.additionalroles == null) { - this.additionalroles = new ArrayList<>(); - } - this.additionalroles.add(additionalrolesItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/UserSearchRequest.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/UserSearchRequest.java deleted file mode 100644 index 48d9a7dd0de..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/UserSearchRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Getter; -import lombok.Setter; -import org.egov.common.contract.request.RequestInfo; - -import java.util.Collections; -import java.util.List; - - -@Getter -@Setter -public class UserSearchRequest { - - @JsonProperty("RequestInfo") - private RequestInfo requestInfo; - - @JsonProperty("uuid") - private List uuid; - - @JsonProperty("id") - private List id; - - @JsonProperty("userName") - private String userName; - - @JsonProperty("name") - private String name; - - @JsonProperty("mobileNumber") - private String mobileNumber; - - @JsonProperty("aadhaarNumber") - private String aadhaarNumber; - - @JsonProperty("pan") - private String pan; - - @JsonProperty("emailId") - private String emailId; - - @JsonProperty("fuzzyLogic") - private boolean fuzzyLogic; - - @JsonProperty("active") - @Setter - private Boolean active; - - @JsonProperty("tenantId") - private String tenantId; - - @JsonProperty("pageSize") - private int pageSize; - - @JsonProperty("pageNumber") - private int pageNumber = 0; - - @JsonProperty("sort") - private List sort = Collections.singletonList("name"); - - @JsonProperty("userType") - private String userType; - - @JsonProperty("roleCodes") - private List roleCodes; - -} \ No newline at end of file diff --git a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Workflow.java b/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Workflow.java deleted file mode 100644 index 121136b6d4b..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/java/digit/web/models/Workflow.java +++ /dev/null @@ -1,51 +0,0 @@ -package digit.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import lombok.*; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.ArrayList; -import java.util.List; - -/** - * Fields related to workflow service - */ -@ApiModel(description = "Fields related to workflow service") -@Validated -@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2022-08-16T15:34:24.436+05:30") - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Workflow { - @JsonProperty("action") - private String action = null; - - @JsonProperty("status") - private String status = null; - - @JsonProperty("comments") - private String comments = null; - - @JsonProperty("documents") - @Valid - private List documents = null; - - @JsonProperty("assignes") - @Valid - private List assignes = null; - - public Workflow addDocumentsItem(Document documentsItem) { - if (this.documents == null) { - this.documents = new ArrayList<>(); - } - this.documents.add(documentsItem); - return this; - } - -} - diff --git a/tutorials/backend-developer-guide/btr-services/src/main/resources/application.properties b/tutorials/backend-developer-guide/btr-services/src/main/resources/application.properties deleted file mode 100644 index 46cfa8869e2..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/resources/application.properties +++ /dev/null @@ -1,93 +0,0 @@ -server.contextPath=/birth-registration -server.port=8280 -app.timezone=UTC - -# BTR config -btr.kafka.create.topic=save-bt-application -btr.kafka.update.topic=update-bt-application -btr.default.offset=0 -btr.default.limit=10 -btr.search.max.limit=50 - -#DATABASE CONFIGURATION -spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/birthdb -spring.datasource.username=postgres -spring.datasource.password=postgres - -#FLYWAY CONFIGURATION -spring.flyway.url=jdbc:postgresql://localhost:5432/birthdb -spring.flyway.user=postgres -spring.flyway.password=postgres -spring.flyway.table=public -spring.flyway.baseline-on-migrate=true -spring.flyway.outOfOrder=true -spring.flyway.locations=classpath:/db/migration/main -spring.flyway.enabled=true - -# KAFKA SERVER CONFIGURATIONS -kafka.config.bootstrap_server_config=localhost:9092 -spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer -spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer -spring.kafka.consumer.group-id=birth-registration -spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer -spring.kafka.listener.missing-topics-fatal=false -spring.kafka.consumer.properties.spring.json.use.type.headers=false - -# KAFKA CONSUMER CONFIGURATIONS -kafka.consumer.config.auto_commit=true -kafka.consumer.config.auto_commit_interval=100 -kafka.consumer.config.session_timeout=15000 -kafka.consumer.config.auto_offset_reset=earliest -# KAFKA PRODUCER CONFIGURATIONS -kafka.producer.config.retries_config=0 -kafka.producer.config.batch_size_config=16384 -kafka.producer.config.linger_ms_config=1 -kafka.producer.config.buffer_memory_config=33554432 - -##Localization config -#egov.localization.host=https://dev.digit.org -#egov.localization.workDir.path=/localization/messages/v1 -#egov.localization.context.path=/localization/messages/v1 -#egov.localization.search.endpoint=/_search -#egov.localization.statelevel=true - -#mdms urls -egov.mdms.host=https://dev.digit.org -egov.mdms.search.endpoint=/egov-mdms-service/v1/_search -egov.mdms.master.name=RegistrationCharges -egov.mdms.module.name=BTR - -##hrms urls -#egov.hrms.host=https://dev.digit.org -#egov.hrms.search.endpoint=/egov-hrms/employees/_search - -#User config -egov.user.host=http://localhost:8081 -egov.user.context.path=/user/users -egov.user.create.path=/_createnovalidate -egov.user.search.path=/user/_search -egov.user.update.path=/_updatenovalidate - -#Idgen Config -egov.idgen.host=http://localhost:8012/ -egov.idgen.path=egov-idgen/id/_generate - -#Workflow config -is.workflow.enabled=true -egov.workflow.host=http://localhost:8013 -egov.workflow.transition.path=/egov-workflow-v2/egov-wf/process/_transition -egov.workflow.businessservice.search.path=/egov-workflow-v2/egov-wf/businessservice/_search -egov.workflow.processinstance.search.path=/egov-workflow-v2/egov-wf/process/_search - -#BTR Calculator -egov.btrcalculator.host=http://localhost:2345 -egov.btrcalculator.endpoint=/birth-calculator/v1/_calculate - -##url shortner -egov.url.shortner.host=https://dev.digit.org -egov.url.shortner.endpoint=/egov-url-shortening/shortener - -egov.sms.notification.topic=egov.core.notification.sms -kafka.topics.receipt.create=dss-collection diff --git a/tutorials/backend-developer-guide/btr-services/src/main/resources/db/migration/main/V20220816155959__bt_registration_ddl.sql b/tutorials/backend-developer-guide/btr-services/src/main/resources/db/migration/main/V20220816155959__bt_registration_ddl.sql deleted file mode 100644 index eec0700e24b..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/main/resources/db/migration/main/V20220816155959__bt_registration_ddl.sql +++ /dev/null @@ -1,46 +0,0 @@ -CREATE TABLE eg_bt_registration( - id character varying(64), - tenantId character varying(64), - applicationNumber character varying(64), - babyFirstName character varying(64), - babyLastName character varying(64), - fatherId character varying(64), - motherId character varying(64), - doctorName character varying(64), - hospitalName character varying(64), - placeOfBirth character varying(64), - timeOfBirth bigint, - createdBy character varying(64), - lastModifiedBy character varying(64), - createdTime bigint, - lastModifiedTime bigint, - CONSTRAINT uk_eg_bt_registration UNIQUE (id) -); -CREATE TABLE eg_bt_address( - id character varying(64), - tenantId character varying(64), - doorNo character varying(64), - latitude FLOAT, - longitude FLOAT, - buildingName character varying(64), - addressId character varying(64), - addressNumber character varying(64), - type character varying(64), - addressLine1 character varying(256), - addressLine2 character varying(256), - landmark character varying(64), - street character varying(64), - city character varying(64), - locality character varying(64), - pincode character varying(64), - detail character varying(64), - registrationId character varying(64), - createdBy character varying(64), - lastModifiedBy character varying(64), - createdTime bigint, - lastModifiedTime bigint, - CONSTRAINT uk_eg_bt_address PRIMARY KEY (id), - CONSTRAINT fk_eg_bt_address FOREIGN KEY (registrationId) REFERENCES eg_bt_registration (id) - ON UPDATE CASCADE - ON DELETE CASCADE -); diff --git a/tutorials/backend-developer-guide/btr-services/src/test/java/digit/web/controllers/V1ApiControllerTest.java b/tutorials/backend-developer-guide/btr-services/src/test/java/digit/web/controllers/V1ApiControllerTest.java deleted file mode 100644 index 2156a279a29..00000000000 --- a/tutorials/backend-developer-guide/btr-services/src/test/java/digit/web/controllers/V1ApiControllerTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package digit.web.controllers; - -import org.junit.Test; -import org.junit.Ignore; -import org.junit.runner.RunWith; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.context.annotation.Import; -import org.springframework.http.MediaType; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import digit.TestConfiguration; - -import static org.mockito.Matchers.any; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -/** -* API tests for V1ApiController -*/ -@Ignore -@RunWith(SpringRunner.class) -@WebMvcTest(V1ApiController.class) -@Import(TestConfiguration.class) -public class V1ApiControllerTest { - - @Autowired - private MockMvc mockMvc; - - @Test - public void v1RegistrationCreatePostSuccess() throws Exception { - mockMvc.perform(post("/birth-services/v1/registration/_create").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isOk()); - } - - @Test - public void v1RegistrationCreatePostFailure() throws Exception { - mockMvc.perform(post("/birth-services/v1/registration/_create").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - - @Test - public void v1RegistrationSearchPostSuccess() throws Exception { - mockMvc.perform(post("/birth-services/v1/registration/_search").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isOk()); - } - - @Test - public void v1RegistrationSearchPostFailure() throws Exception { - mockMvc.perform(post("/birth-services/v1/registration/_search").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - - @Test - public void v1RegistrationUpdatePostSuccess() throws Exception { - mockMvc.perform(post("/birth-services/v1/registration/_update").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isOk()); - } - - @Test - public void v1RegistrationUpdatePostFailure() throws Exception { - mockMvc.perform(post("/birth-services/v1/registration/_update").contentType(MediaType - .APPLICATION_JSON_UTF8)) - .andExpect(status().isBadRequest()); - } - -} diff --git a/utilities/boundary-migration/mvnw b/utilities/boundary-migration/mvnw new file mode 100755 index 00000000000..66df2854281 --- /dev/null +++ b/utilities/boundary-migration/mvnw @@ -0,0 +1,308 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# 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 +# +# https://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.2.0 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "$(uname)" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && + JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin ; then + javaHome="$(dirname "\"$javaExecutable\"")" + javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "\"$javaExecutable\"")" + fi + javaHome="$(dirname "\"$javaExecutable\"")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$(cd "$wdir/.." || exit 1; pwd) + fi + # end of workaround + done + printf '%s' "$(cd "$basedir" || exit 1; pwd)" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' < "$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + fi + while IFS="=" read -r key value; do + # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; + esac + done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget > /dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; + esac +done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/utilities/boundary-migration/pom.xml b/utilities/boundary-migration/pom.xml new file mode 100644 index 00000000000..3c5e71c6d55 --- /dev/null +++ b/utilities/boundary-migration/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.2.6.RELEASE + + + com.example + boundary-migration + 0.0.1-SNAPSHOT + boundary-migration + Migration service for boundary data + + 1.8 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.projectlombok + lombok + true + + + + org.egov.services + services-common + 2.0.0-SNAPSHOT + + + + org.egov.services + tracer + 2.1.2-SNAPSHOT + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/BoundaryMigrationApplication.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/BoundaryMigrationApplication.java new file mode 100644 index 00000000000..4b3529c0188 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/BoundaryMigrationApplication.java @@ -0,0 +1,21 @@ +package com.example.boundarymigration; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.client.RestTemplate; + +@SpringBootApplication +@ComponentScan(basePackages = { "com.example.boundarymigration" }) +public class BoundaryMigrationApplication { + + public static void main(String[] args) { + SpringApplication.run(BoundaryMigrationApplication.class, args); + } + + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/service/BoundaryMigrate.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/service/BoundaryMigrate.java new file mode 100644 index 00000000000..c8b728e4fcc --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/service/BoundaryMigrate.java @@ -0,0 +1,202 @@ +package com.example.boundarymigration.service; + +import com.example.boundarymigration.service.enrichment.BoundaryHierarchyEnricher; +import com.example.boundarymigration.web.models.BoundaryTypeHierarchy; +import com.example.boundarymigration.web.models.BoundaryTypeHierarchyDefinition; +import com.example.boundarymigration.web.models.BoundaryTypeHierarchyRequest; +import com.example.boundarymigration.web.models.legacy.*; +import org.egov.common.contract.models.AuditDetails; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class BoundaryMigrate { + + @Autowired + public RestTemplate restTemplate; + + @Autowired + public BoundaryHierarchyEnricher boundaryHierarchyEnricher; + + String boundaryRelationshipUrl = "http://localhost:8080/boundary-service/boundary-relationships/_create"; + + String boundaryUrl = "http://localhost:8080/boundary-service/boundary/_create"; + + String boundaryHierarchyUrl = "http://localhost:8080/boundary-service/boundary-hierarchy-definition/_create"; + + public BoundaryMigrate(RestTemplate restTemplate, BoundaryHierarchyEnricher boundaryHierarchyEnricher) { + this.restTemplate = restTemplate; + this.boundaryHierarchyEnricher = boundaryHierarchyEnricher; + } + + public void migrate(BoundaryMigrateRequest body) { + + // create boundary hierarchy definition + body.getTenantBoundary().forEach(tenantBoundary -> { + + // create boundaries + createBoundaryEntity(body.getTenantId() , tenantBoundary , body.getRequestInfo()); + + // create hierarchy definition + createBoundaryHierarchyDefinition(body.getTenantId() , tenantBoundary , body.getRequestInfo()); + + // create boundary relationships + try { + createBoundaryRelationships(tenantBoundary , body.getRequestInfo() , body.getTenantId() , null); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + + }); + + } + + public void createBoundaryRelationships(TenantBoundary tenantBoundary , RequestInfo requestInfo , String tenantId , String Parent) throws InterruptedException { + + parseBoundaryRelationships(tenantBoundary.getBoundary() , requestInfo , tenantId , Parent , tenantBoundary.getHierarchyType().getCode()); + + } + + public void parseBoundaryRelationships(Boundary boundary , RequestInfo requestInfo , String tenantId , String Parent , String hierarchyType) throws InterruptedException { + + BoundaryRelation boundaryRelation = BoundaryRelation.builder() + .tenantId(tenantId) + .code(boundary.getCode()) + .parent(Parent) + .boundaryType(boundary.getLabel()) + .hierarchyType(hierarchyType) + .build(); + + BoundaryRelationshipRequest boundaryRelationshipRequest = BoundaryRelationshipRequest.builder() + .boundaryRelationship(boundaryRelation) + .requestInfo(requestInfo) + .build(); + + // create this relationship + // 1. wait for some time + Thread.sleep(1000); + +// boundaryRelationshipService.createBoundaryRelationship(boundaryRelationshipRequest); + + restTemplate.postForObject(boundaryRelationshipUrl, boundaryRelationshipRequest, BoundaryRelationshipRequest.class); + + for(int i=0;i boundaryList = new ArrayList<>(); + + parseBoundary(tenantBoundary.getBoundary() , tenantId , requestInfo, boundaryList); + + int batchSize = 300; + List batchedRequests = new ArrayList<>(); + + for (int i = 0; i < boundaryList.size(); i += batchSize) { + int endIndex = Math.min(i + batchSize, boundaryList.size()); + List subList = boundaryList.subList(i, endIndex); + + BoundaryRequest batchedBoundaryRequest = BoundaryRequest.builder() + .requestInfo(requestInfo) + .boundary(subList) + .build(); + + batchedRequests.add(batchedBoundaryRequest); + } + + // Now, you can iterate through batchedRequests and save each batch to the repository + for (BoundaryRequest batchedRequest : batchedRequests) { +// boundaryRepository.create(batchedRequest); + restTemplate.postForObject(boundaryUrl, batchedRequest, BoundaryRequest.class); + } + + } + + public void parseBoundary(Boundary boundary , String tenantId , RequestInfo requestInfo , List boundaryList) { + + // Convert legacy boundary to new boundary + com.example.boundarymigration.web.models.Boundary currBoundary = com.example.boundarymigration.web.models.Boundary.builder() + .tenantId(tenantId) + .id(boundary.getId()) + .code(boundary.getCode()) + .auditDetails(AuditDetailsEnrichmentUtil.prepareAuditDetails(new AuditDetails(),requestInfo,Boolean.TRUE)) + .build(); + + boundaryList.add(currBoundary); + + // if no children return the current boundaryList + if(ObjectUtils.isEmpty(boundary.getChildren())) { + return; + } + + // if children are present parse them + for(int i=0;i boundaryHierarchy = parseBoundaryHierarchy(tenantBoundary.getBoundary(),null); + + BoundaryTypeHierarchyDefinition boundaryTypeHierarchyDefinition = BoundaryTypeHierarchyDefinition.builder() + .tenantId(tenantId) + .hierarchyType(tenantBoundary.getHierarchyType().getCode()) + .boundaryHierarchy(boundaryHierarchy) + .auditDetails(AuditDetailsEnrichmentUtil.prepareAuditDetails(new AuditDetails(),requestInfo,Boolean.TRUE)) + .build(); + + BoundaryTypeHierarchyRequest boundaryTypeHierarchyRequest = BoundaryTypeHierarchyRequest.builder() + .boundaryHierarchy(boundaryTypeHierarchyDefinition) + .requestInfo(requestInfo) + .build(); + + boundaryHierarchyEnricher.enrichBoundaryHierarchyDefinition(boundaryTypeHierarchyRequest); + + restTemplate.postForObject(boundaryHierarchyUrl, boundaryTypeHierarchyRequest, BoundaryTypeHierarchy.class); + + } + + public List parseBoundaryHierarchy(Boundary boundary, String parentBoundaryType) { + + List boundaryTypeHierarchyList = new ArrayList<>(); + BoundaryTypeHierarchy boundaryTypeHierarchy = BoundaryTypeHierarchy.builder() + .boundaryType(boundary.getLabel()) + .parentBoundaryType(parentBoundaryType) + .active(Boolean.TRUE) + .build(); + + // collections util or object utils (Spring framework to check if collection is empty) + if(boundary.getChildren() == null) { + boundaryTypeHierarchyList.add(boundaryTypeHierarchy); + return boundaryTypeHierarchyList; + } + + for(int i=0;i boundaryHierarchyList) { + try { + String jsonString = objectMapper.writeValueAsString(boundaryHierarchyList); + JsonNode jsonNode = objectMapper.readTree(jsonString); + return jsonNode; + } catch (Exception e) { + throw new CustomException("JSON_PARSING_ERROR", "Error in converting boundary hierarchy list to JSON"); + } + } + +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/controllers/BoundaryMigrationController.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/controllers/BoundaryMigrationController.java new file mode 100644 index 00000000000..54047203f09 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/controllers/BoundaryMigrationController.java @@ -0,0 +1,27 @@ +package com.example.boundarymigration.web.controllers; + +import com.example.boundarymigration.service.BoundaryMigrate; +import com.example.boundarymigration.web.models.legacy.BoundaryMigrateRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/boundary") +public class BoundaryMigrationController { + + @Autowired + private BoundaryMigrate boundaryMigrate; + + /** + * Migrate boundary data from old format to new format + * @param requestBody + * @return + */ + @RequestMapping(value = "/_migrate", method = RequestMethod.POST) + public void boundaryMigrate(@RequestBody BoundaryMigrateRequest requestBody) { + boundaryMigrate.migrate(requestBody); + } +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/Boundary.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/Boundary.java new file mode 100644 index 00000000000..5acd1308a2d --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/Boundary.java @@ -0,0 +1,45 @@ +package com.example.boundarymigration.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +/** + * Boundary + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Boundary { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("code") + @NotNull + private String code = null; + + @JsonProperty("geometry") + @Valid + private JsonNode geometry = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + @JsonProperty("additionalDetails") + private JsonNode additionalDetails = null; +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchy.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchy.java new file mode 100644 index 00000000000..1d80d38acc2 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchy.java @@ -0,0 +1,30 @@ +package com.example.boundarymigration.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +/** + * BoundaryTypeHierarchy + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchy { + + @JsonProperty("boundaryType") + private String boundaryType = null; + + @JsonProperty("parentBoundaryType") + private String parentBoundaryType = null; + + @JsonProperty("active") + private Boolean active = null; + +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchyDefinition.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchyDefinition.java new file mode 100644 index 00000000000..dd715b0b5a3 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchyDefinition.java @@ -0,0 +1,45 @@ +package com.example.boundarymigration.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.List; + +/** + * BoundaryTypeHierarchyDefinition + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchyDefinition { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("tenantId") + private String tenantId = null; + + @JsonProperty("hierarchyType") + private String hierarchyType = null; + + @JsonProperty("boundaryHierarchy") + @Valid + private List boundaryHierarchy = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + @JsonProperty("boundaryHierarchyJsonNode") + private JsonNode boundaryHierarchyJsonNode = null; + +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchyRequest.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchyRequest.java new file mode 100644 index 00000000000..4e07e069e85 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchyRequest.java @@ -0,0 +1,32 @@ +package com.example.boundarymigration.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; + +/** + * BoundaryTypeHierarchyRequest + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchyRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("BoundaryHierarchy") + @Valid + private BoundaryTypeHierarchyDefinition boundaryHierarchy = null; + +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchyResponse.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchyResponse.java new file mode 100644 index 00000000000..351f3b16c2e --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/BoundaryTypeHierarchyResponse.java @@ -0,0 +1,34 @@ +package com.example.boundarymigration.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import java.util.List; + +/** + * BoundaryTypeHierarchyRequest + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryTypeHierarchyResponse { + + @JsonProperty("RequestInfo") + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("BoundaryHierarchy") + @Valid + private List boundaryHierarchy = null; + +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/Boundary.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/Boundary.java new file mode 100644 index 00000000000..f59a3e4a0d9 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/Boundary.java @@ -0,0 +1,46 @@ +package com.example.boundarymigration.web.models.legacy; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +import java.util.List; + +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Boundary { + + @JsonProperty("id") + private String id; + + @JsonProperty("boundaryNum") + private String boundaryNum; + + @JsonProperty("name") + private String name; + + @JsonProperty("localname") + private String localname; + + @JsonProperty("longitude") + private String longitude; + + @JsonProperty("latitude") + private String latitude; + + @JsonProperty("label") + private String label; + + @JsonProperty("code") + private String code; + + @JsonProperty("children") + private List children; +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryMigrateRequest.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryMigrateRequest.java new file mode 100644 index 00000000000..78c467f8779 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryMigrateRequest.java @@ -0,0 +1,30 @@ +package com.example.boundarymigration.web.models.legacy; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import java.util.List; + +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryMigrateRequest { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + + @JsonProperty("tenantId") + private String tenantId; + + @JsonProperty("moduleName") + private String moduleName; + + @JsonProperty("TenantBoundary") + private List TenantBoundary; + +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryRelation.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryRelation.java new file mode 100644 index 00000000000..170e6ce3b33 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryRelation.java @@ -0,0 +1,54 @@ +package com.example.boundarymigration.web.models.legacy; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.models.AuditDetails; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotNull; + +/** + * BoundaryRelation + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRelation { + + @JsonProperty("id") + private String id = null; + + @JsonProperty("code") + @NotNull + private String code = null; + + @JsonProperty("tenantId") + @NotNull + private String tenantId = null; + + @JsonProperty("hierarchyType") + @NotNull + private String hierarchyType = null; + + @JsonProperty("boundaryType") + @NotNull + private String boundaryType = null; + + @JsonProperty("parent") + private String parent = null; + + @JsonProperty("auditDetails") + private AuditDetails auditDetails = null; + + @JsonIgnore + @Builder.Default + private String ancestralMaterializedPath = ""; + +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryRelationshipRequest.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryRelationshipRequest.java new file mode 100644 index 00000000000..bacbc3055af --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryRelationshipRequest.java @@ -0,0 +1,33 @@ +package com.example.boundarymigration.web.models.legacy; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; + +/** + * BoundaryRelationshipRequest + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRelationshipRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("BoundaryRelationship") + @Valid + private BoundaryRelation boundaryRelationship = null; + + +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryRequest.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryRequest.java new file mode 100644 index 00000000000..4a3ffca5494 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/BoundaryRequest.java @@ -0,0 +1,38 @@ +package com.example.boundarymigration.web.models.legacy; + +import com.example.boundarymigration.web.models.Boundary; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.egov.common.contract.request.RequestInfo; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.List; + +/** + * BoundaryRequest + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class BoundaryRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @Valid + @NotNull + @JsonProperty("Boundary") + @Size(min = 1, max = 300) + private List boundary = null; + +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/GenericPair.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/GenericPair.java new file mode 100644 index 00000000000..2b471684857 --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/GenericPair.java @@ -0,0 +1,20 @@ +package com.example.boundarymigration.web.models.legacy; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class GenericPair { + + private T first; + + private U second; + +} \ No newline at end of file diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/HierarchyType.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/HierarchyType.java new file mode 100644 index 00000000000..b4b1d1996ae --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/HierarchyType.java @@ -0,0 +1,23 @@ +package com.example.boundarymigration.web.models.legacy; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class HierarchyType { + + @JsonProperty("code") + private String code; + + @JsonProperty("name") + private String name; +} diff --git a/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/TenantBoundary.java b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/TenantBoundary.java new file mode 100644 index 00000000000..96178e2e44f --- /dev/null +++ b/utilities/boundary-migration/src/main/java/com/example/boundarymigration/web/models/legacy/TenantBoundary.java @@ -0,0 +1,23 @@ +package com.example.boundarymigration.web.models.legacy; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.validation.annotation.Validated; + +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-10-16T17:02:11.361704+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class TenantBoundary { + + @JsonProperty("hierarchyType") + private HierarchyType hierarchyType; + + @JsonProperty("boundary") + private Boundary boundary; +} diff --git a/utilities/boundary-migration/src/main/resources/application.properties b/utilities/boundary-migration/src/main/resources/application.properties new file mode 100644 index 00000000000..c91dd1f40c6 --- /dev/null +++ b/utilities/boundary-migration/src/main/resources/application.properties @@ -0,0 +1,3 @@ +# set the port of server to something else than 8080 +server.port=8081 +#logging.level.org.springframework=DEBUG diff --git a/utilities/boundary-migration/src/test/java/com/example/boundarymigration/BoundaryMigrationApplicationTests.java b/utilities/boundary-migration/src/test/java/com/example/boundarymigration/BoundaryMigrationApplicationTests.java new file mode 100644 index 00000000000..9a966819b33 --- /dev/null +++ b/utilities/boundary-migration/src/test/java/com/example/boundarymigration/BoundaryMigrationApplicationTests.java @@ -0,0 +1,13 @@ +package com.example.boundarymigration; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class BoundaryMigrationApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/utilities/mdms-migration-toolkit/README.md b/utilities/mdms-migration-toolkit/README.md new file mode 100644 index 00000000000..a2e8a9f7b84 --- /dev/null +++ b/utilities/mdms-migration-toolkit/README.md @@ -0,0 +1,18 @@ +# Swagger generated server + +Spring Boot Server + + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. +This is an example of building a swagger-enabled server in Java using the SpringBoot framework. + +The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) + +Start your server as an simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/ + +Change default port value in application.properties \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/pom.xml b/utilities/mdms-migration-toolkit/pom.xml new file mode 100644 index 00000000000..2beffb9b206 --- /dev/null +++ b/utilities/mdms-migration-toolkit/pom.xml @@ -0,0 +1,139 @@ + + 4.0.0 + org.egov + mdms-migration-toolkit + jar + mdms-migration-toolkit + 1.0.0 + + 1.8 + ${java.version} + ${java.version} + + + org.springframework.boot + spring-boot-starter-parent + 2.2.6.RELEASE + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.flywaydb + flyway-core + + + org.postgresql + postgresql + 42.2.2.jre7 + + + org.springframework.boot + spring-boot-starter-test + test + + + + io.swagger + swagger-core + 1.5.18 + + + io.swagger.core.v3 + swagger-annotations + 2.2.8 + + + + + org.egov.services + tracer + 2.1.2-SNAPSHOT + + + org.egov.services + digit-models + 1.0.0-SNAPSHOT + + + org.egov + mdms-client + 0.0.2-SNAPSHOT + compile + + + org.projectlombok + lombok + true + + + com.github.saasquatch + json-schema-inferrer + 0.2.0 + + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + javax.validation + validation-api + + + org.egov.services + services-common + 1.1.2-SNAPSHOT + + + + + + repo.egovernments.org + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/releases/ + + + repo.egovernments.org.snapshots + eGov ERP Releases Repository + https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/ + + + repo.egovernments.org.public + eGov Public Repository Group + https://nexus-repo.egovernments.org/nexus/content/groups/public/ + + + repo.digit.org + eGov DIGIT Releases Repository + https://nexus-repo.digit.org/nexus/content/repositories/snapshots/ + + + jitpack.io + https://jitpack.io + + + diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/Main.java b/utilities/mdms-migration-toolkit/src/main/java/digit/Main.java new file mode 100644 index 00000000000..9e5ace22113 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/Main.java @@ -0,0 +1,21 @@ +package digit; + + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Import; + +@Import({TracerConfiguration.class}) +@SpringBootApplication +@ComponentScan(basePackages = {"digit", "digit.web.controllers", "digit.config"}) +public class Main { + + + public static void main(String[] args) throws Exception { + SpringApplication.run(Main.class, args); + } + +} + \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/config/Configuration.java b/utilities/mdms-migration-toolkit/src/main/java/digit/config/Configuration.java new file mode 100644 index 00000000000..b655433ceb5 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/config/Configuration.java @@ -0,0 +1,90 @@ +package digit.config; + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Import; +import org.springframework.stereotype.Component; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Component +@Data +@Import({TracerConfiguration.class}) +@NoArgsConstructor +@AllArgsConstructor +@Setter +@Getter +public class Configuration { + + + // User Config + @Value("${egov.user.host}") + private String userHost; + + @Value("${egov.user.context.path}") + private String userContextPath; + + @Value("${egov.user.create.path}") + private String userCreateEndpoint; + + @Value("${egov.user.search.path}") + private String userSearchEndpoint; + + @Value("${egov.user.update.path}") + private String userUpdateEndpoint; + + + //Idgen Config + @Value("${egov.idgen.host}") + private String idGenHost; + + @Value("${egov.idgen.path}") + private String idGenPath; + + + //Workflow Config + @Value("${egov.workflow.host}") + private String wfHost; + + @Value("${egov.workflow.transition.path}") + private String wfTransitionPath; + + @Value("${egov.workflow.businessservice.search.path}") + private String wfBusinessServiceSearchPath; + + @Value("${egov.workflow.processinstance.search.path}") + private String wfProcessInstanceSearchPath; + + + //MDMS + @Value("${egov.mdms.host}") + private String mdmsHost; + + @Value("${egov.mdms.search.endpoint}") + private String mdmsEndPoint; + + + //HRMS + @Value("${egov.hrms.host}") + private String hrmsHost; + + @Value("${egov.hrms.search.endpoint}") + private String hrmsEndPoint; + + + //URLShortening + @Value("${egov.url.shortner.host}") + private String urlShortnerHost; + + @Value("${egov.url.shortner.endpoint}") + private String urlShortnerEndpoint; + + + //SMSNotification + @Value("${egov.sms.notification.topic}") + private String smsNotificationTopic; +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/config/MainConfiguration.java b/utilities/mdms-migration-toolkit/src/main/java/digit/config/MainConfiguration.java new file mode 100644 index 00000000000..d4436296da0 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/config/MainConfiguration.java @@ -0,0 +1,56 @@ +package digit.config; + +import java.util.TimeZone; + +import javax.annotation.PostConstruct; + +import org.egov.tracer.config.TracerConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.saasquatch.jsonschemainferrer.AdditionalPropertiesPolicies; +import com.saasquatch.jsonschemainferrer.JsonSchemaInferrer; +import com.saasquatch.jsonschemainferrer.RequiredPolicies; +import com.saasquatch.jsonschemainferrer.SpecVersion; + + +@Import({TracerConfiguration.class}) +@Configuration +public class MainConfiguration { + + @Value("${app.timezone}") + private String timeZone; + + @PostConstruct + public void initialize() { + TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); + } + + @Bean + public JsonSchemaInferrer jsonSchemaInferrer() { + return JsonSchemaInferrer.newBuilder() + .setSpecVersion(SpecVersion.DRAFT_07) + .setAdditionalPropertiesPolicy(AdditionalPropertiesPolicies.notAllowed()) + .setRequiredPolicy(RequiredPolicies.nonNullCommonFields()) + .build(); + } + + + public ObjectMapper objectMapper() { + return new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).setTimeZone(TimeZone.getTimeZone(timeZone)); + } + + @Bean + @Autowired + public MappingJackson2HttpMessageConverter jacksonConverter(ObjectMapper objectMapper) { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setObjectMapper(objectMapper); + return converter; + } +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/constants/ErrorCodes.java b/utilities/mdms-migration-toolkit/src/main/java/digit/constants/ErrorCodes.java new file mode 100644 index 00000000000..ce78a67912e --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/constants/ErrorCodes.java @@ -0,0 +1,13 @@ +package digit.constants; + +public class ErrorCodes { + public static final String IO_ERROR_CODE = "IO_ERROR"; + + public static final String IO_WRITE_ERROR_MESSAGE = "Error while writing to file"; + + public static final String IO_READ_ERROR_MESSAGE = "Error occurred while reading schema json content from file: "; + + public static final String MASTER_DATA_MIGRATION_ERROR_CODE = "MASTER_DATA_MIGRATION_ERROR"; + + public static final String MASTER_DATA_MIGRATION_TENANTID_DOES_NOT_EXIST_ERROR_MESSAGE = "Master data does not exist for tenantId - "; +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/constants/MDMSMigrationToolkitConstants.java b/utilities/mdms-migration-toolkit/src/main/java/digit/constants/MDMSMigrationToolkitConstants.java new file mode 100644 index 00000000000..aba8593d20a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/constants/MDMSMigrationToolkitConstants.java @@ -0,0 +1,7 @@ +package digit.constants; + +public class MDMSMigrationToolkitConstants { + public static final String JSON_EXTENSION = ".json"; + + public static final String DOT_SEPARATOR = "."; +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/kafka/Consumer.java b/utilities/mdms-migration-toolkit/src/main/java/digit/kafka/Consumer.java new file mode 100644 index 00000000000..5e9f99db180 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/kafka/Consumer.java @@ -0,0 +1,20 @@ +package digit.kafka; + +import java.util.HashMap; + +import org.springframework.stereotype.Component; + +@Component +public class Consumer { + + /* + * Uncomment the below line to start consuming record from kafka.topics.consumer + * Value of the variable kafka.topics.consumer should be overwritten in application.properties + */ + //@KafkaListener(topics = {"kafka.topics.consumer"}) + public void listen(final HashMap record) { + + //TODO + + } +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/kafka/Producer.java b/utilities/mdms-migration-toolkit/src/main/java/digit/kafka/Producer.java new file mode 100644 index 00000000000..88d028ba6aa --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/kafka/Producer.java @@ -0,0 +1,21 @@ +package digit.kafka; + +import org.egov.tracer.kafka.CustomKafkaTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import lombok.extern.slf4j.Slf4j; + +// NOTE: If tracer is disabled change CustomKafkaTemplate to KafkaTemplate in autowiring + +@Service +@Slf4j +public class Producer { + + @Autowired + private CustomKafkaTemplate kafkaTemplate; + + public void push(String topic, Object value) { + kafkaTemplate.send(topic, value); + } +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/repository/ServiceRequestRepository.java b/utilities/mdms-migration-toolkit/src/main/java/digit/repository/ServiceRequestRepository.java new file mode 100644 index 00000000000..8b1b127ca56 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/repository/ServiceRequestRepository.java @@ -0,0 +1,47 @@ +package digit.repository; + + +import java.util.Map; + +import org.egov.tracer.model.ServiceCallException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +import lombok.extern.slf4j.Slf4j; + +@Repository +@Slf4j +public class ServiceRequestRepository { + + private ObjectMapper mapper; + + private RestTemplate restTemplate; + + + @Autowired + public ServiceRequestRepository(ObjectMapper mapper, RestTemplate restTemplate) { + this.mapper = mapper; + this.restTemplate = restTemplate; + } + + + public Object fetchResult(StringBuilder uri, Object request) { + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + Object response = null; + try { + response = restTemplate.postForObject(uri.toString(), request, Map.class); + }catch(HttpClientErrorException e) { + log.error("External Service threw an Exception: ",e); + throw new ServiceCallException(e.getResponseBodyAsString()); + }catch(Exception e) { + log.error("Exception while fetching from searcher: ",e); + } + + return response; + } +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/service/MDMSApplicationRunnerImpl.java b/utilities/mdms-migration-toolkit/src/main/java/digit/service/MDMSApplicationRunnerImpl.java new file mode 100644 index 00000000000..7cb69251e4f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/service/MDMSApplicationRunnerImpl.java @@ -0,0 +1,206 @@ +package digit.service; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jayway.jsonpath.JsonPath; + +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; + + +@Component +@Slf4j +public class MDMSApplicationRunnerImpl { + + @Autowired + public ResourceLoader resourceLoader; + + @Value("${egov.mdms.conf.path}") + public String mdmsFileDirectory; + + @Value("${masters.config.url}") + public String masterConfigUrl; + + @Value("${egov.mdms.stopOnAnyConfigError:true}") + public boolean stopOnAnyConfigError; + + private static Map>> tenantMap = new HashMap<>(); + + private static Map> masterConfigMap = new HashMap<>(); + + ObjectMapper objectMapper = new ObjectMapper(); + + @PostConstruct + public void run() { + try { + log.info("Reading files from: " + mdmsFileDirectory); + LinkedList errorFilesList = new LinkedList<>(); + if (!StringUtils.isEmpty(masterConfigUrl)) + readMdmsConfigFiles(masterConfigUrl); + readFiles(mdmsFileDirectory, errorFilesList); + log.info("List Of Files which has Error while parsing " + errorFilesList); + if (!errorFilesList.isEmpty() && stopOnAnyConfigError) { + log.info("Stopping as all files could not be loaded"); + System.exit(1); + } + } catch (Exception e) { + log.error("Exception while loading yaml files: ", e); + } + + } + + public void readFiles(String baseFolderPath, LinkedList errorList) { + File folder = new File(baseFolderPath); + File[] listOfFiles = folder.listFiles(); + if (listOfFiles != null) { + for (File file : listOfFiles) { + if (file.isFile()) { + String name = file.getName(); + String fileExtension = FilenameUtils.getExtension(file.getAbsolutePath()).toLowerCase(); + + + if (fileExtension.equalsIgnoreCase("json") + || fileExtension.equalsIgnoreCase("yaml") + || fileExtension.equalsIgnoreCase("yml") + ) { + log.debug("Reading file....:- " + file.getAbsolutePath()); + try { + Map jsonMap = objectMapper.readValue(file, new TypeReference>() { + @Override + public Type getType() { + return super.getType(); + } + }); + prepareTenantMap(jsonMap); + } catch (Exception e) { + log.error("Error occurred while loading file", e); + errorList.add(file.getAbsolutePath()); + } + } + } else if (file.isDirectory()) { + readFiles(file.getAbsolutePath(), errorList); + } + } + } + } + + public void prepareTenantMap(Map map) { + + String tenantId = (String) map.get("tenantId"); + String moduleName = (String) map.get("moduleName"); + Set masterKeys = map.keySet(); + String nonMasterKeys = "tenantId,moduleName"; + List ignoreKey = new ArrayList<>(Arrays.asList(nonMasterKeys.split(","))); + masterKeys.removeAll(ignoreKey); + boolean isMergeAllowed; + Map masterDataMap = new HashMap<>(); + Iterator masterKeyIterator = masterKeys.iterator(); + String masterName = null; + JSONArray masterDataJsonArray = null; + while (masterKeyIterator.hasNext()) { + masterName = masterKeyIterator.next(); + try { + masterDataJsonArray = JsonPath.read(objectMapper.writeValueAsString(map.get(masterName)), + "$"); + } catch (JsonProcessingException e) { + log.error("Error while parsing file", e); + } + + if (!tenantMap.containsKey(tenantId)) { + Map> moduleMap = new HashMap<>(); + moduleMap.put(moduleName, masterDataMap); + tenantMap.put(tenantId, moduleMap); + } else { + Map> tenantModule = tenantMap.get(tenantId); + + if (!tenantModule.containsKey(moduleName)) { + tenantModule.put(moduleName, masterDataMap); + } else { + Map moduleMaster = tenantModule.get(moduleName); + isMergeAllowed = isMergeAllowedForMaster(moduleName, masterName); + + if (!moduleMaster.containsKey(masterName)) { + masterDataMap.put(masterName, masterDataJsonArray); + moduleMaster.putAll(masterDataMap); + tenantModule.put(moduleName, moduleMaster); + } else if (moduleMaster.containsKey(masterName) && isMergeAllowed) { + JSONArray existingMasterDataJsonArray = moduleMaster.get(masterName); + existingMasterDataJsonArray.merge(masterDataJsonArray); + } else if ((moduleMaster.containsKey(masterName) && !isMergeAllowed)) { + log.error("merge is not allowed for master ++" + moduleName + " " + masterName); + } + } + tenantMap.put(tenantId, tenantModule); + } + masterDataMap.put(masterName, masterDataJsonArray); + } + } + + public void readMdmsConfigFiles(String masterConfigUrl) { + log.info("Loading master configs from: " + masterConfigUrl); + Resource resource = resourceLoader.getResource(masterConfigUrl); + InputStream inputStream = null; + try { + inputStream = resource.getInputStream(); + masterConfigMap = objectMapper.readValue(inputStream, new TypeReference>>() { + }); + } catch (IOException e) { + log.error("Exception while fetching service map for: ", e); + } finally { + IOUtils.closeQuietly(inputStream); + } + + //log.info("the Master config Map : " + masterConfigMap); + } + + public boolean isMergeAllowedForMaster(String moduleName, String masterName) { + boolean isMergeAllowed = false; + + if (masterConfigMap.containsKey(moduleName) && masterConfigMap.get(moduleName).containsKey(masterName)) { + Object masterData = masterConfigMap.get(moduleName).get(masterName); + if (masterData != null) { + try { + isMergeAllowed = JsonPath.read(objectMapper.writeValueAsString(masterData), + "$.isMergeAllowed"); + } catch (Exception ignored) { + } + } + } + return isMergeAllowed; + } + + + public static Map>> getTenantMap() { + return tenantMap; + } + + public static Map> getMasterConfigMap() { + return masterConfigMap; + } + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/service/MasterDataMigrationService.java b/utilities/mdms-migration-toolkit/src/main/java/digit/service/MasterDataMigrationService.java new file mode 100644 index 00000000000..f3454f69029 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/service/MasterDataMigrationService.java @@ -0,0 +1,105 @@ +package digit.service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.validation.Valid; + +import org.egov.common.utils.AuditDetailsEnrichmentUtil; +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.models.coremodels.AuditDetails; +import digit.util.FileReader; +import digit.web.models.MasterDataMigrationRequest; +import digit.web.models.Mdms; +import digit.web.models.MdmsRequest; +import net.minidev.json.JSONArray; + +@Service +public class MasterDataMigrationService { + + @Autowired + private FileReader fileReader; + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private RestTemplate restTemplate; + + @Value("${master.schema.files.dir}") + public String schemaFilesDirectory; + + /** + * This methods accepts master data migration request and triggers + * creation of MDMS objects + * @param masterDataMigrationRequest + */ + public void migrateMasterData(@Valid MasterDataMigrationRequest masterDataMigrationRequest) { + + // Get Master Data map + Map>> tenantMap = MDMSApplicationRunnerImpl.getTenantMap(); + + // Get tenantId from request + String tenantId = masterDataMigrationRequest.getMasterDataMigrationCriteria().getTenantId(); + + // Build audit details for mdms objects creation + AuditDetails auditDetails = new AuditDetails(); + RequestInfo requestInfo = masterDataMigrationRequest.getRequestInfo(); + AuditDetailsEnrichmentUtil.enrichAuditDetails(auditDetails, requestInfo, Boolean.TRUE); + + List masterDataList = new ArrayList<>(); + + // Check if master data is present for the incoming tenantId. + if (tenantMap.containsKey(tenantId)) { + tenantMap.get(tenantId).keySet().forEach(module -> { + tenantMap.get(tenantId).get(module).keySet().forEach(master -> { + + // Get master data array for current module and master + JSONArray masterDataJsonArray = MDMSApplicationRunnerImpl + .getTenantMap() + .get(tenantId) + .get(module) + .get(master); + + // Build MDMS objects + masterDataJsonArray.forEach(masterDatum -> { + // Convert JSONArray member to JsonNode + JsonNode masterDatumJsonNode = objectMapper.valueToTree(masterDatum); + + // Build MDMS objects + Mdms mdms = Mdms.builder() + .schemaCode(module + DOT_SEPARATOR + master) + .data(masterDatumJsonNode) + .isActive(Boolean.TRUE) + .tenantId(tenantId) + .uniqueIdentifier(UUID.randomUUID().toString()) + .auditDetails(auditDetails) + .build(); + + MdmsRequest mdmsRequest = MdmsRequest.builder() + .mdms(mdms) + .requestInfo(requestInfo) + .build(); + + // TODO - Make call to MDMS Service with the created request + restTemplate.postForObject("http://localhost:8094/mdms-v2/v2/_create/" + mdmsRequest.getMdms().getSchemaCode(), mdmsRequest, Map.class); + }); + }); + }); + } else { + throw new CustomException(MASTER_DATA_MIGRATION_ERROR_CODE, MASTER_DATA_MIGRATION_TENANTID_DOES_NOT_EXIST_ERROR_MESSAGE + masterDataMigrationRequest.getMasterDataMigrationCriteria().getTenantId()); + } + + } + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/service/SchemaDefinitionMigrationService.java b/utilities/mdms-migration-toolkit/src/main/java/digit/service/SchemaDefinitionMigrationService.java new file mode 100644 index 00000000000..be85db70aba --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/service/SchemaDefinitionMigrationService.java @@ -0,0 +1,113 @@ +package digit.service; + +import static digit.constants.MDMSMigrationToolkitConstants.DOT_SEPARATOR; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.saasquatch.jsonschemainferrer.*; + +import digit.repository.ServiceRequestRepository; +import digit.util.FileReader; +import digit.util.FileWriter; +import digit.web.models.SchemaDefinition; +import digit.web.models.SchemaDefinitionRequest; +import digit.web.models.SchemaMigrationRequest; +import net.minidev.json.JSONArray; + +@Service +public class SchemaDefinitionMigrationService { + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private FileWriter fileWriter; + + @Autowired + private FileReader fileReader; + + @Autowired + private JsonSchemaInferrer inferrer; + + @Value("${master.schema.files.dir}") + public String schemaFilesDirectory; + + @Autowired + private ServiceRequestRepository serviceRequestRepository; + + private Map schemaCodeToSchemaJsonMap; + + public void beginMigration(SchemaMigrationRequest schemaMigrationRequest) { + // Fetch schema code to schema definition map + Map schemaCodeVsSchemaDefinitionMap = fileReader.readFiles(schemaFilesDirectory); + + List schemaDefinitionPOJOs = new ArrayList<>(); + + // Go through each schemas and generate SchemaDefinition DTOs + schemaCodeVsSchemaDefinitionMap.keySet().forEach(schemaCode -> { + SchemaDefinition schemaDefinition = SchemaDefinition.builder() + .tenantId(schemaMigrationRequest.getSchemaMigrationCriteria().getTenantId()) + .isActive(Boolean.TRUE) + .code(schemaCode) + .definition(schemaCodeVsSchemaDefinitionMap.get(schemaCode)) + .id(UUID.randomUUID().toString()) + .build(); + schemaDefinitionPOJOs.add(schemaDefinition); + }); + + schemaDefinitionPOJOs.forEach(schemaDefinition -> { + SchemaDefinitionRequest schemaDefinitionRequest = SchemaDefinitionRequest.builder() + .requestInfo(schemaMigrationRequest.getRequestInfo()) + .schemaDefinition(schemaDefinition) + .build(); + + // Send it to kafka/make API calls to MDMS service schema APIs + serviceRequestRepository.fetchResult(new StringBuilder("http://localhost:8094/mdms-v2/schema/v1/_create"), schemaDefinitionRequest); + }); + } + + + public void generateSchemaDefinition() { + Map>> tenantMap = MDMSApplicationRunnerImpl.getTenantMap(); + + schemaCodeToSchemaJsonMap = new HashMap<>(); + + // Traverse tenantMap across the tenants, modules and masters to generate schema for each master + tenantMap.keySet().forEach(tenantId -> { + tenantMap.get(tenantId).keySet().forEach(module -> { + tenantMap.get(tenantId).get(module).keySet().forEach(master -> { + JSONArray masterDataJsonArray = MDMSApplicationRunnerImpl + .getTenantMap() + .get(tenantId) + .get(module) + .get(master); + + if (!masterDataJsonArray.isEmpty()) { + // Convert master data to JsonNode + JsonNode jsonNode = objectMapper.convertValue(masterDataJsonArray.get(0), JsonNode.class); + + // Feed the converted master data to jsonSchemaInferrer for generating schema + JsonNode schemaNode = inferrer.inferForSample(jsonNode); + + // Populate schemaCodeToSchemaJsonMap + schemaCodeToSchemaJsonMap.put(module + DOT_SEPARATOR + master, schemaNode); + + // Write generated schema definition to files with the name in module.master format + fileWriter.writeJsonToFile(schemaNode, module + DOT_SEPARATOR + master); + } + + }); + }); + }); + } +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/util/FileReader.java b/utilities/mdms-migration-toolkit/src/main/java/digit/util/FileReader.java new file mode 100644 index 00000000000..e1b543ab294 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/util/FileReader.java @@ -0,0 +1,46 @@ +package digit.util; + +import static digit.constants.ErrorCodes.IO_ERROR_CODE; +import static digit.constants.ErrorCodes.IO_READ_ERROR_MESSAGE; +import static digit.constants.MDMSMigrationToolkitConstants.JSON_EXTENSION; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class FileReader { + + @Autowired + private ObjectMapper objectMapper; + + public Map readFiles(String directoryPath){ + File folder = new File(directoryPath); + File[] listOfFiles = folder.listFiles(); + + Map schemaCodeVsSchemaDefinitionMap = new HashMap<>(); + + Arrays.stream(listOfFiles).forEach(file -> { + String schemaCode = file.getName().replace(JSON_EXTENSION, ""); + JsonNode schemaDefinition = null; + try { + schemaDefinition = objectMapper.readValue(file, JsonNode.class); + } catch (IOException e) { + throw new CustomException(IO_ERROR_CODE, IO_READ_ERROR_MESSAGE + file.getName()); + } + schemaCodeVsSchemaDefinitionMap.put(schemaCode, schemaDefinition); + }); + + return schemaCodeVsSchemaDefinitionMap; + + } +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/util/FileWriter.java b/utilities/mdms-migration-toolkit/src/main/java/digit/util/FileWriter.java new file mode 100644 index 00000000000..720befdaf68 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/util/FileWriter.java @@ -0,0 +1,35 @@ +package digit.util; + +import static digit.constants.ErrorCodes.IO_ERROR_CODE; +import static digit.constants.ErrorCodes.IO_WRITE_ERROR_MESSAGE; +import static digit.constants.MDMSMigrationToolkitConstants.JSON_EXTENSION; + +import java.io.File; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class FileWriter { + + @Autowired + private ObjectMapper objectMapper; + + @Value("${master.schema.files.dir}") + private String masterSchemaFilesDirectory; + + public void writeJsonToFile(JsonNode content, String fileName) { + try { + objectMapper.writeValue(new File(masterSchemaFilesDirectory + fileName + JSON_EXTENSION), content); + }catch (Exception e){ + throw new CustomException(IO_ERROR_CODE, IO_WRITE_ERROR_MESSAGE); + } + + } + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/util/IdgenUtil.java b/utilities/mdms-migration-toolkit/src/main/java/digit/util/IdgenUtil.java new file mode 100644 index 00000000000..31d8d8fc2e9 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/util/IdgenUtil.java @@ -0,0 +1,50 @@ +package digit.util; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.config.Configuration; +import digit.models.coremodels.IdGenerationRequest; +import digit.models.coremodels.IdGenerationResponse; +import digit.models.coremodels.IdRequest; +import digit.models.coremodels.IdResponse; +import digit.repository.ServiceRequestRepository; + +@Component +public class IdgenUtil { + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository restRepo; + + @Autowired + private Configuration configs; + + public List getIdList(RequestInfo requestInfo, String tenantId, String idName, String idformat, Integer count) { + List reqList = new ArrayList<>(); + for (int i = 0; i < count; i++) { + reqList.add(IdRequest.builder().idName(idName).format(idformat).tenantId(tenantId).build()); + } + + IdGenerationRequest request = IdGenerationRequest.builder().idRequests(reqList).requestInfo(requestInfo).build(); + StringBuilder uri = new StringBuilder(configs.getIdGenHost()).append(configs.getIdGenPath()); + IdGenerationResponse response = mapper.convertValue(restRepo.fetchResult(uri, request), IdGenerationResponse.class); + + List idResponses = response.getIdResponses(); + + if (CollectionUtils.isEmpty(idResponses)) + throw new CustomException("IDGEN ERROR", "No ids returned from idgen Service"); + + return idResponses.stream().map(IdResponse::getId).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/util/MdmsUtil.java b/utilities/mdms-migration-toolkit/src/main/java/digit/util/MdmsUtil.java new file mode 100644 index 00000000000..455c6585113 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/util/MdmsUtil.java @@ -0,0 +1,83 @@ +package digit.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.egov.mdms.model.MasterDetail; +import org.egov.mdms.model.MdmsCriteria; +import org.egov.mdms.model.MdmsCriteriaReq; +import org.egov.mdms.model.MdmsResponse; +import org.egov.mdms.model.ModuleDetail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.config.Configuration; +import lombok.extern.slf4j.Slf4j; +import net.minidev.json.JSONArray; + +@Slf4j +@Component +public class MdmsUtil { + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private Configuration configs; + + + + + public Map> fetchMdmsData(RequestInfo requestInfo, String tenantId, String moduleName, + List masterNameList) { + StringBuilder uri = new StringBuilder(); + uri.append(configs.getMdmsHost()).append(configs.getMdmsEndPoint()); + MdmsCriteriaReq mdmsCriteriaReq = getMdmsRequest(requestInfo, tenantId, moduleName, masterNameList); + Object response = new HashMap<>(); + int rate = 0; + MdmsResponse mdmsResponse = new MdmsResponse(); + try { + response = restTemplate.postForObject(uri.toString(), mdmsCriteriaReq, Map.class); + mdmsResponse = mapper.convertValue(response, MdmsResponse.class); + }catch(Exception e) { + log.error("Exception occurred while fetching category lists from mdms: ",e); + } + + return mdmsResponse.getMdmsRes(); + //log.info(ulbToCategoryListMap.toString()); + } + + private MdmsCriteriaReq getMdmsRequest(RequestInfo requestInfo, String tenantId, + String moduleName, List masterNameList) { + List masterDetailList = new ArrayList<>(); + for(String masterName: masterNameList) { + MasterDetail masterDetail = new MasterDetail(); + masterDetail.setName(masterName); + masterDetailList.add(masterDetail); + } + + ModuleDetail moduleDetail = new ModuleDetail(); + moduleDetail.setMasterDetails(masterDetailList); + moduleDetail.setModuleName(moduleName); + List moduleDetailList = new ArrayList<>(); + moduleDetailList.add(moduleDetail); + + MdmsCriteria mdmsCriteria = new MdmsCriteria(); + mdmsCriteria.setTenantId(tenantId.split("\\.")[0]); + mdmsCriteria.setModuleDetails(moduleDetailList); + + MdmsCriteriaReq mdmsCriteriaReq = new MdmsCriteriaReq(); + mdmsCriteriaReq.setMdmsCriteria(mdmsCriteria); + mdmsCriteriaReq.setRequestInfo(requestInfo); + + return mdmsCriteriaReq; + } +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/util/ResponseInfoFactory.java b/utilities/mdms-migration-toolkit/src/main/java/digit/util/ResponseInfoFactory.java new file mode 100644 index 00000000000..19c02cd3a93 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/util/ResponseInfoFactory.java @@ -0,0 +1,25 @@ +package digit.util; + +import org.springframework.stereotype.Component; + +import digit.web.models.ResponseInfo; + +@Component +public class ResponseInfoFactory { + + public ResponseInfo createResponseInfoFromRequestInfo(final RequestInfo requestInfo, final Boolean success) { + + final String apiId = requestInfo != null ? requestInfo.getApiId() : ""; + final String ver = requestInfo != null ? requestInfo.getVer() : ""; + Long ts = null; + if(requestInfo!=null) + ts = requestInfo.getTs(); + final String resMsgId = "uief87324"; // FIXME : Hard-coded + final String msgId = requestInfo != null ? requestInfo.getMsgId() : ""; + final String responseStatus = success ? "successful" : "failed"; + + return ResponseInfo.builder().apiId(apiId).ver(ver).ts(ts).resMsgId(resMsgId).msgId(msgId).resMsgId(resMsgId) + .status(responseStatus).build(); + } + +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/util/UrlShortenerUtil.java b/utilities/mdms-migration-toolkit/src/main/java/digit/util/UrlShortenerUtil.java new file mode 100644 index 00000000000..e6d0b2df9cd --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/util/UrlShortenerUtil.java @@ -0,0 +1,40 @@ +package digit.util; + +import java.util.HashMap; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import digit.config.Configuration; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Component +public class UrlShortenerUtil { + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private Configuration configs; + + + public String getShortenedUrl(String url){ + + HashMap body = new HashMap<>(); + body.put("url",url); + StringBuilder builder = new StringBuilder(configs.getUrlShortnerHost()); + builder.append(configs.getUrlShortnerEndpoint()); + String res = restTemplate.postForObject(builder.toString(), body, String.class); + + if(StringUtils.isEmpty(res)){ + log.error("URL_SHORTENING_ERROR", "Unable to shorten url: " + url); + return url; + } + else return res; + } + + +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/util/UserUtil.java b/utilities/mdms-migration-toolkit/src/main/java/digit/util/UserUtil.java new file mode 100644 index 00000000000..6d754552c4f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/util/UserUtil.java @@ -0,0 +1,140 @@ +package digit.util; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.config.Configuration; +import digit.models.coremodels.UserDetailResponse; +import digit.models.coremodels.user.Role; +import digit.models.coremodels.user.User; +import digit.models.coremodels.user.enums.UserType; +import digit.repository.ServiceRequestRepository; + +@Component +public class UserUtil { + + @Autowired + private ObjectMapper mapper; + + @Autowired + private ServiceRequestRepository serviceRequestRepository; + + @Autowired + private Configuration configs; + + + @Autowired + public UserUtil(ObjectMapper mapper, ServiceRequestRepository serviceRequestRepository) { + this.mapper = mapper; + this.serviceRequestRepository = serviceRequestRepository; + } + + /** + * Returns UserDetailResponse by calling user service with given uri and object + * @param userRequest Request object for user service + * @param uri The address of the endpoint + * @return Response from user service as parsed as userDetailResponse + */ + + public UserDetailResponse userCall(Object userRequest, StringBuilder uri) { + String dobFormat = null; + if(uri.toString().contains(configs.getUserSearchEndpoint()) || uri.toString().contains(configs.getUserUpdateEndpoint())) + dobFormat="yyyy-MM-dd"; + else if(uri.toString().contains(configs.getUserCreateEndpoint())) + dobFormat = "dd/MM/yyyy"; + try{ + LinkedHashMap responseMap = (LinkedHashMap)serviceRequestRepository.fetchResult(uri, userRequest); + parseResponse(responseMap,dobFormat); + UserDetailResponse userDetailResponse = mapper.convertValue(responseMap,UserDetailResponse.class); + return userDetailResponse; + } + catch(IllegalArgumentException e) + { + throw new CustomException("IllegalArgumentException","ObjectMapper not able to convertValue in userCall"); + } + } + + + /** + * Parses date formats to long for all users in responseMap + * @param responseMap LinkedHashMap got from user api response + */ + + public void parseResponse(LinkedHashMap responseMap, String dobFormat){ + List users = (List)responseMap.get("user"); + String format1 = "dd-MM-yyyy HH:mm:ss"; + if(users!=null){ + users.forEach( map -> { + map.put("createdDate",dateTolong((String)map.get("createdDate"),format1)); + if((String)map.get("lastModifiedDate")!=null) + map.put("lastModifiedDate",dateTolong((String)map.get("lastModifiedDate"),format1)); + if((String)map.get("dob")!=null) + map.put("dob",dateTolong((String)map.get("dob"),dobFormat)); + if((String)map.get("pwdExpiryDate")!=null) + map.put("pwdExpiryDate",dateTolong((String)map.get("pwdExpiryDate"),format1)); + } + ); + } + } + + /** + * Converts date to long + * @param date date to be parsed + * @param format Format of the date + * @return Long value of date + */ + private Long dateTolong(String date,String format){ + SimpleDateFormat f = new SimpleDateFormat(format); + Date d = null; + try { + d = f.parse(date); + } catch (ParseException e) { + throw new CustomException("INVALID_DATE_FORMAT","Failed to parse date format in user"); + } + return d.getTime(); + } + + /** + * enriches the userInfo with statelevel tenantId and other fields + * The function creates user with username as mobile number. + * @param mobileNumber + * @param tenantId + * @param userInfo + */ + public void addUserDefaultFields(String mobileNumber,String tenantId, User userInfo, UserType userType){ + Role role = getCitizenRole(tenantId); + userInfo.setRoles(Collections.singleton(role)); + userInfo.setType(userType); + userInfo.setUsername(mobileNumber); + userInfo.setTenantId(getStateLevelTenant(tenantId)); + userInfo.setActive(true); + } + + /** + * Returns role object for citizen + * @param tenantId + * @return + */ + private Role getCitizenRole(String tenantId){ + Role role = Role.builder().build(); + role.setCode("CITIZEN"); + role.setName("Citizen"); + role.setTenantId(getStateLevelTenant(tenantId)); + return role; + } + + public String getStateLevelTenant(String tenantId){ + return tenantId.split("\\.")[0]; + } + +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/util/WorkflowUtil.java b/utilities/mdms-migration-toolkit/src/main/java/digit/util/WorkflowUtil.java new file mode 100644 index 00000000000..3dcc6897983 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/util/WorkflowUtil.java @@ -0,0 +1,183 @@ +package digit.util; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.egov.tracer.model.CustomException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.config.Configuration; +import digit.models.coremodels.BusinessService; +import digit.models.coremodels.BusinessServiceResponse; +import digit.models.coremodels.ProcessInstance; +import digit.models.coremodels.ProcessInstanceRequest; +import digit.models.coremodels.ProcessInstanceResponse; +import digit.models.coremodels.RequestInfoWrapper; +import digit.models.coremodels.State; +import digit.models.coremodels.Workflow; +import digit.repository.ServiceRequestRepository; + +@Service +public class WorkflowUtil { + + @Autowired + private ServiceRequestRepository repository; + + @Autowired + private ObjectMapper mapper; + + @Autowired + private Configuration configs; + + + + /** + * Searches the BussinessService corresponding to the businessServiceCode + * Returns applicable BussinessService for the given parameters + * @param requestInfo + * @param tenantId + * @param businessServiceCode + * @return + */ + public BusinessService getBusinessService(RequestInfo requestInfo, String tenantId, String businessServiceCode) { + + StringBuilder url = getSearchURLWithParams(tenantId, businessServiceCode); + RequestInfoWrapper requestInfoWrapper = RequestInfoWrapper.builder().requestInfo(requestInfo).build(); + Object result = repository.fetchResult(url, requestInfoWrapper); + BusinessServiceResponse response = null; + try { + response = mapper.convertValue(result, BusinessServiceResponse.class); + } catch (IllegalArgumentException e) { + throw new CustomException("PARSING ERROR", "Failed to parse response of workflow business service search"); + } + + if (CollectionUtils.isEmpty(response.getBusinessServices())) + throw new CustomException("BUSINESSSERVICE_NOT_FOUND", "The businessService " + businessServiceCode + " is not found"); + + return response.getBusinessServices().get(0); + } + + /** + * Calls the workflow service with the given action and updates the status + * Returns the updated status of the application + * @param requestInfo + * @param tenantId + * @param businessId + * @param businessServiceCode + * @param workflow + * @param wfModuleName + * @return + */ + public String updateWorkflowStatus(RequestInfo requestInfo, String tenantId, + String businessId, String businessServiceCode, Workflow workflow, String wfModuleName) { + ProcessInstance processInstance = getProcessInstanceForWorkflow(requestInfo, tenantId, businessId, + businessServiceCode, workflow, wfModuleName); + ProcessInstanceRequest workflowRequest = new ProcessInstanceRequest(requestInfo, Collections.singletonList(processInstance)); + State state = callWorkFlow(workflowRequest); + + return state.getApplicationStatus(); + } + + /** + * Creates url for search based on given tenantId and businessServices + * @param tenantId + * @param businessService + * @return + */ + private StringBuilder getSearchURLWithParams(String tenantId, String businessService) { + StringBuilder url = new StringBuilder(configs.getWfHost()); + url.append(configs.getWfBusinessServiceSearchPath()); + url.append("?tenantId="); + url.append(tenantId); + url.append("&businessServices="); + url.append(businessService); + return url; + } + + /** + * Enriches ProcessInstance Object for Workflow + * @param requestInfo + * @param tenantId + * @param businessId + * @param businessServiceCode + * @param workflow + * @param wfModuleName + * @return + */ + private ProcessInstance getProcessInstanceForWorkflow(RequestInfo requestInfo, String tenantId, + String businessId, String businessServiceCode, Workflow workflow, String wfModuleName) { + + ProcessInstance processInstance = new ProcessInstance(); + processInstance.setBusinessId(businessId); + processInstance.setAction(workflow.getAction()); + processInstance.setModuleName(wfModuleName); + processInstance.setTenantId(tenantId); + processInstance.setBusinessService(getBusinessService(requestInfo, tenantId, businessServiceCode).getBusinessService()); + processInstance.setDocuments(workflow.getVerificationDocuments()); + processInstance.setComment(workflow.getComments()); + + if(!CollectionUtils.isEmpty(workflow.getAssignes())) { + List users = new ArrayList<>(); + + workflow.getAssignes().forEach(uuid -> { + User user = new User(); + user.setUuid(uuid); + users.add(user); + }); + + processInstance.setAssignes(users); + } + + return processInstance; + } + + /** + * Gets the workflow corresponding to the processInstance + * @param processInstances + * @return + */ + public Map getWorkflow(List processInstances) { + + Map businessIdToWorkflow = new HashMap<>(); + + processInstances.forEach(processInstance -> { + List userIds = null; + + if(!CollectionUtils.isEmpty(processInstance.getAssignes())){ + userIds = processInstance.getAssignes().stream().map(User::getUuid).collect(Collectors.toList()); + } + + Workflow workflow = Workflow.builder() + .action(processInstance.getAction()) + .assignes(userIds) + .comments(processInstance.getComment()) + .verificationDocuments(processInstance.getDocuments()) + .build(); + + businessIdToWorkflow.put(processInstance.getBusinessId(), workflow); + }); + + return businessIdToWorkflow; + } + + /** + * Method to take the ProcessInstanceRequest as parameter and set resultant status + * @param workflowReq + * @return + */ + private State callWorkFlow(ProcessInstanceRequest workflowReq) { + ProcessInstanceResponse response = null; + StringBuilder url = new StringBuilder(configs.getWfHost().concat(configs.getWfTransitionPath())); + Object optional = repository.fetchResult(url, workflowReq); + response = mapper.convertValue(optional, ProcessInstanceResponse.class); + return response.getProcessInstances().get(0).getState(); + } +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/controllers/DataApiController.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/controllers/DataApiController.java new file mode 100644 index 00000000000..a206097f9a0 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/controllers/DataApiController.java @@ -0,0 +1,40 @@ +package digit.web.controllers; + + +import javax.validation.Valid; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.service.MasterDataMigrationService; +import digit.web.models.MasterDataMigrationRequest; + +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Controller +@RequestMapping(value = "/data") +public class DataApiController { + + private final ObjectMapper objectMapper; + + private final MasterDataMigrationService masterDataMigrationService; + + @Autowired + public DataApiController(ObjectMapper objectMapper, MasterDataMigrationService masterDataMigrationService) { + this.objectMapper = objectMapper; + this.masterDataMigrationService = masterDataMigrationService; + } + + @RequestMapping(value = "/v1/_migrate", method = RequestMethod.POST) + public ResponseEntity migrateMasterData(@Valid @RequestBody MasterDataMigrationRequest body) { + masterDataMigrationService.migrateMasterData(body); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/controllers/SchemaApiController.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/controllers/SchemaApiController.java new file mode 100644 index 00000000000..0b5ad03814c --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/controllers/SchemaApiController.java @@ -0,0 +1,49 @@ +package digit.web.controllers; + + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import digit.service.SchemaDefinitionMigrationService; +import digit.web.models.SchemaMigrationRequest; + +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@RestController +@RequestMapping(value = "/schema") +public class SchemaApiController { + + private final ObjectMapper objectMapper; + + private final HttpServletRequest request; + + private final SchemaDefinitionMigrationService schemaDefinitionMigrationService; + + @Autowired + public SchemaApiController(ObjectMapper objectMapper, HttpServletRequest request, SchemaDefinitionMigrationService schemaDefinitionMigrationService) { + this.objectMapper = objectMapper; + this.request = request; + this.schemaDefinitionMigrationService = schemaDefinitionMigrationService; + } + + @PostMapping(value = "/v1/_generate") + public ResponseEntity generateSchemaDefinition() { + schemaDefinitionMigrationService.generateSchemaDefinition(); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + + @PostMapping(value = "/v1/_migrate") + public ResponseEntity migrateSchemaDefinition(@RequestBody SchemaMigrationRequest schemaMigrationRequest) { + schemaDefinitionMigrationService.beginMigration(schemaMigrationRequest); + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/Error.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/Error.java new file mode 100644 index 00000000000..933951d200b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/Error.java @@ -0,0 +1,56 @@ +package digit.web.models; + +import java.util.ArrayList; +import java.util.List; + +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400. + */ +@Schema(description = "Error object will be returned as a part of reponse body in conjunction with ResponseInfo as part of ErrorResponse whenever the request processing status in the ResponseInfo is FAILED. HTTP return in this scenario will usually be HTTP 400.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Error { + @JsonProperty("code") + @NotNull + + private String code = null; + + @JsonProperty("message") + @NotNull + + private String message = null; + + @JsonProperty("description") + + private String description = null; + + @JsonProperty("params") + + private List params = null; + + + public Error addParamsItem(String paramsItem) { + if (this.params == null) { + this.params = new ArrayList<>(); + } + this.params.add(paramsItem); + return this; + } + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/ErrorRes.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/ErrorRes.java new file mode 100644 index 00000000000..c37966358a7 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/ErrorRes.java @@ -0,0 +1,49 @@ +package digit.web.models; + +import java.util.ArrayList; +import java.util.List; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure. + */ +@Schema(description = "All APIs will return ErrorRes in case of failure which will carry ResponseInfo as metadata and Error object as actual representation of error. In case of bulk apis, some apis may chose to return the array of Error objects to indicate individual failure.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ErrorRes { + @JsonProperty("ResponseInfo") + @NotNull + + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("Errors") + @Valid + private List errors = null; + + + public ErrorRes addErrorsItem(Error errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); + } + this.errors.add(errorsItem); + return this; + } + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/MasterDataMigrationCriteria.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/MasterDataMigrationCriteria.java new file mode 100644 index 00000000000..e94e0a17a9b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/MasterDataMigrationCriteria.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * MasterDataMigrationCriteria + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MasterDataMigrationCriteria { + + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 100) + private String tenantId = null; + + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/MasterDataMigrationRequest.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/MasterDataMigrationRequest.java new file mode 100644 index 00000000000..0c2d06e08bc --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/MasterDataMigrationRequest.java @@ -0,0 +1,35 @@ +package digit.web.models; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * MasterDataMigrationRequest + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MasterDataMigrationRequest { + @JsonProperty("masterDataMigrationCriteria") + @Valid + private MasterDataMigrationCriteria masterDataMigrationCriteria = null; + + @JsonProperty("requestInfo") + @NotNull + @Valid + private RequestInfo requestInfo = null; + + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/Mdms.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/Mdms.java new file mode 100644 index 00000000000..8459e45ff24 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/Mdms.java @@ -0,0 +1,47 @@ +package digit.web.models; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; + +import digit.models.coremodels.AuditDetails; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Mdms { + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 128) + private String tenantId = null; + + @JsonProperty("schemaCode") + @Size(min = 2, max = 128) + private String schemaCode = null; + + @JsonProperty("uniqueIdentifier") + @Size(min = 2, max = 128) + private String uniqueIdentifier = null; + + @JsonProperty("data") + @NotNull + private JsonNode data = null; + + @JsonProperty("isActive") + private Boolean isActive = true; + + @JsonProperty("auditDetails") + @Valid + private AuditDetails auditDetails = null; +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/MdmsRequest.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/MdmsRequest.java new file mode 100644 index 00000000000..b23f94c8a7b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/MdmsRequest.java @@ -0,0 +1,29 @@ +package digit.web.models; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MdmsRequest { + + @JsonProperty("RequestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("Mdms") + @Valid + private Mdms mdms = null; + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/RequestInfoWrapper.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/RequestInfoWrapper.java new file mode 100644 index 00000000000..32368e4c292 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/RequestInfoWrapper.java @@ -0,0 +1,22 @@ +package digit.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class RequestInfoWrapper { + + @JsonProperty("RequestInfo") + private RequestInfo requestInfo; + +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/ResponseInfo.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/ResponseInfo.java new file mode 100644 index 00000000000..c0fe3183cdd --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/ResponseInfo.java @@ -0,0 +1,87 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * ResponseInfo should be used to carry metadata information about the response from the server. apiId, ver and msgId in ResponseInfo should always correspond to the same values in respective request's RequestInfo. + */ +@Schema(description = "ResponseInfo should be used to carry metadata information about the response from the server. apiId, ver and msgId in ResponseInfo should always correspond to the same values in respective request's RequestInfo.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ResponseInfo { + @JsonProperty("apiId") + @NotNull + + @Size(max=128) private String apiId = null; + + @JsonProperty("ver") + @NotNull + + @Size(max=32) private String ver = null; + + @JsonProperty("ts") + @NotNull + + private Long ts = null; + + @JsonProperty("resMsgId") + + @Size(max=256) private String resMsgId = null; + + @JsonProperty("msgId") + + @Size(max=256) private String msgId = null; + + /** + * status of request processing - to be enhanced in futuer to include INPROGRESS + */ + public enum StatusEnum { + SUCCESSFUL("SUCCESSFUL"), + + FAILED("FAILED"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } @JsonProperty("status") + @NotNull + + private StatusEnum status = null; + + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/Role.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/Role.java new file mode 100644 index 00000000000..515969a2e53 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/Role.java @@ -0,0 +1,45 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes + */ +@Schema(description = "minimal representation of the Roles in the system to be carried along in UserInfo with RequestInfo meta data. Actual authorization service to extend this to have more role related attributes ") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Role { + @JsonProperty("tenantId") + @NotNull + + private String tenantId = null; + + @JsonProperty("id") + + private String id = null; + + @JsonProperty("name") + + @Size(max=64) private String name = null; + + @JsonProperty("description") + + private String description = null; + + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaDefinition.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaDefinition.java new file mode 100644 index 00000000000..f2e402931a6 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaDefinition.java @@ -0,0 +1,59 @@ +package digit.web.models; + + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; + +import digit.models.coremodels.AuditDetails; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefinition { + + @JsonProperty("id") + @Size(min = 2, max = 128) + private String id = null; + + @JsonProperty("tenantId") + @NotNull + @Size(min = 2, max = 128) + private String tenantId = null; + + @JsonProperty("code") + @NotNull + @Size(min = 2, max = 128) + private String code = null; + + @JsonProperty("description") + + @Size(min = 2, max = 512) + private String description = null; + + @JsonProperty("definition") + @NotNull + private JsonNode definition = null; + + @JsonProperty("isActive") + + private Boolean isActive = true; + + @JsonProperty("auditDetails") + @Valid + private AuditDetails auditDetails = null; + +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaDefinitionRequest.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaDefinitionRequest.java new file mode 100644 index 00000000000..37067d0c773 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaDefinitionRequest.java @@ -0,0 +1,32 @@ +package digit.web.models; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +@Validated +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@ToString +public class SchemaDefinitionRequest { + @JsonProperty("RequestInfo") + @NotNull + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("SchemaDefinition") + @NotNull + @Valid + private SchemaDefinition schemaDefinition = null; +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaDefinitionResponse.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaDefinitionResponse.java new file mode 100644 index 00000000000..cd109af58db --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaDefinitionResponse.java @@ -0,0 +1,47 @@ +package digit.web.models; + +import java.util.ArrayList; +import java.util.List; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * Response from server + */ +@Schema(description = "Response from server") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-05-30T09:26:57.838+05:30[Asia/Kolkata]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaDefinitionResponse { + @JsonProperty("ResponseInfo") + + @Valid + private ResponseInfo responseInfo = null; + + @JsonProperty("SchemaDefinitions") + @Valid + private List schemaDefinitions = null; + + + public SchemaDefinitionResponse addSchemaDefinitionsItem(SchemaDefinition schemaDefinitionsItem) { + if (this.schemaDefinitions == null) { + this.schemaDefinitions = new ArrayList<>(); + } + this.schemaDefinitions.add(schemaDefinitionsItem); + return this; + } + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaMigrationCriteria.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaMigrationCriteria.java new file mode 100644 index 00000000000..19f71dd57c8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaMigrationCriteria.java @@ -0,0 +1,29 @@ +package digit.web.models; + +import javax.validation.constraints.NotNull; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * SchemaMigrationCriteria + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaMigrationCriteria { + + @JsonProperty("tenantId") + @NotNull + private String tenantId = null; + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaMigrationRequest.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaMigrationRequest.java new file mode 100644 index 00000000000..0fcf47741c1 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/SchemaMigrationRequest.java @@ -0,0 +1,33 @@ +package digit.web.models; + +import javax.validation.Valid; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * SchemaMigrationRequest + */ +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SchemaMigrationRequest { + + @JsonProperty("requestInfo") + @Valid + private RequestInfo requestInfo = null; + + @JsonProperty("schemaMigrationCriteria") + @Valid + private SchemaMigrationCriteria schemaMigrationCriteria = null; + +} diff --git a/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/User.java b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/User.java new file mode 100644 index 00000000000..dcbc037b459 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/java/digit/web/models/User.java @@ -0,0 +1,199 @@ +package digit.web.models; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import org.springframework.validation.annotation.Validated; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server. + */ +@Schema(description = "This is acting ID token of the authenticated user on the server. Any value provided by the clients will be ignored and actual user based on authtoken will be used on the server.") +@Validated +@javax.annotation.Generated(value = "org.egov.codegen.SpringBootCodegen", date = "2023-06-20T09:54:35.237+05:30[Asia/Calcutta]") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class User { + @JsonProperty("tenantId") + @NotNull + + private String tenantId = null; + + @JsonProperty("id") + + private Integer id = null; + + @JsonProperty("uuid") + + private String uuid = null; + + @JsonProperty("userName") + @NotNull + + private String userName = null; + + @JsonProperty("mobileNumber") + + private String mobileNumber = null; + + @JsonProperty("emailId") + + private String emailId = null; + + @JsonProperty("roles") + @NotNull + @Valid + private List roles = new ArrayList<>(); + + @JsonProperty("salutation") + + private String salutation = null; + + @JsonProperty("name") + + private String name = null; + + @JsonProperty("gender") + + private String gender = null; + + @JsonProperty("alternateMobileNumber") + + private String alternateMobileNumber = null; + + @JsonProperty("altContactNumber") + + private String altContactNumber = null; + + @JsonProperty("pan") + + private String pan = null; + + @JsonProperty("aadhaarNumber") + + private String aadhaarNumber = null; + + @JsonProperty("permanentAddress") + + @Size(max=300) private String permanentAddress = null; + + @JsonProperty("permanentCity") + + @Size(max=300) private String permanentCity = null; + + @JsonProperty("permanentPincode") + + @Size(max=6) private String permanentPincode = null; + + @JsonProperty("correspondenceCity") + + @Size(max=50) private String correspondenceCity = null; + + @JsonProperty("correspondencePincode") + + @Size(max=6) private String correspondencePincode = null; + + @JsonProperty("correspondenceAddress") + + @Size(max=300) private String correspondenceAddress = null; + + @JsonProperty("active") + + private Boolean active = null; + + @JsonProperty("locale") + + @Size(max=10) private String locale = null; + + @JsonProperty("type") + + @Size(max=20) private String type = null; + + @JsonProperty("accountLocked") + + private Boolean accountLocked = null; + + @JsonProperty("accountLockedDate") + + private Long accountLockedDate = null; + + @JsonProperty("fatherOrHusbandName") + + @Size(max=100) private String fatherOrHusbandName = null; + + @JsonProperty("relationship") + + @Size(max=20) private String relationship = null; + + @JsonProperty("signature") + + private String signature = null; + + @JsonProperty("bloodGroup") + + @Size(max=3) private String bloodGroup = null; + + @JsonProperty("photo") + + private String photo = null; + + @JsonProperty("identificationMark") + + private String identificationMark = null; + + @JsonProperty("createdBy") + + private Long createdBy = null; + + @JsonProperty("password") + + private String password = null; + + @JsonProperty("otpReference") + + private String otpReference = null; + + @JsonProperty("lastModifiedBy") + + private Long lastModifiedBy = null; + + @JsonProperty("createdDate") + + @Valid + private LocalDate createdDate = null; + + @JsonProperty("lastModifiedDate") + + @Valid + private LocalDate lastModifiedDate = null; + + @JsonProperty("dob") + + private Long dob = null; + + @JsonProperty("pwdExpiryDate") + + private Long pwdExpiryDate = null; + + + public User addRolesItem(Role rolesItem) { + this.roles.add(rolesItem); + return this; + } + +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CancerCess b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CancerCess new file mode 100644 index 00000000000..df57031e61e --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CancerCess @@ -0,0 +1,89 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.CancerCess", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY" + ], + "x-unique": [ + "fromFY" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ChargeSlabs b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ChargeSlabs new file mode 100644 index 00000000000..439dd94ba1d --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ChargeSlabs @@ -0,0 +1,79 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.ChargeSlabs", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "floorNo", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "floorNo": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CommonFieldsConfig b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CommonFieldsConfig new file mode 100644 index 00000000000..b0267702ec3 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.CommonFieldsConfig @@ -0,0 +1,141 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.CommonFieldsConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "head", + "body" + ], + "x-unique": [ + "head" + ], + "properties": { + "body": { + "type": "array", + "items": { + "type": "object", + "required": [ + "route", + "component", + "nextStep", + "key", + "texts" + ], + "properties": { + "key": { + "type": "string" + }, + "type": { + "type": "string" + }, + "route": { + "type": "string" + }, + "texts": { + "type": "object", + "required": [ + "header", + "cardText" + ], + "properties": { + "header": { + "type": "string" + }, + "cardText": { + "type": "string" + }, + "nextText": { + "type": "string" + }, + "skipText": { + "type": "string" + }, + "headerCaption": { + "type": "string" + }, + "submitBarLabel": { + "type": "string" + }, + "skipAndContinueText": { + "type": "string" + } + }, + "additionalProperties": false + }, + "nextStep": { + "type": "string" + }, + "component": { + "type": "string" + }, + "isMandatory": { + "type": "boolean", + "default": true + }, + "withoutLabel": { + "type": "boolean", + "default": true + }, + "hideInEmployee": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + } + }, + "head": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionSubType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionSubType new file mode 100644 index 00000000000..addc206f0b8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionSubType @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.ConstructionSubType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionType new file mode 100644 index 00000000000..a27175aac72 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ConstructionType @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.ConstructionType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Documents b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Documents new file mode 100644 index 00000000000..e898bb49b9f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Documents @@ -0,0 +1,208 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Documents", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "documentType", + "required", + "active", + "hasDropdown", + "additionalDetails", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "required": { + "type": "boolean", + "default": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": true + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code", + "active" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "digit-citizen": { + "type": "boolean", + "default": true + }, + "additionalDetails": { + "type": "object", + "required": [ + "enabledActions" + ], + "properties": { + "enabledActions": { + "type": "object", + "required": [ + "assess", + "reassess", + "update", + "create" + ], + "properties": { + "assess": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "create": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "update": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "reassess": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.DuesOnPTMutation b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.DuesOnPTMutation new file mode 100644 index 00000000000..298c2009df8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.DuesOnPTMutation @@ -0,0 +1,83 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.DuesOnPTMutation", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "module", + "code", + "enabled", + "fetchConsumerUrl", + "fecthBillUrl" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "module": { + "type": "string" + }, + "enabled": { + "type": "boolean", + "default": true + }, + "fecthBillUrl": { + "type": "string" + }, + "fetchConsumerUrl": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.FireCess b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.FireCess new file mode 100644 index 00000000000..9b84195c158 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.FireCess @@ -0,0 +1,115 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.FireCess", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "dynamicFirecess", + "dynamicRates" + ], + "x-unique": [ + "fromFY" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "dynamicRates": { + "type": "object", + "required": [ + "firecess_inflammable", + "firecess_building_height", + "firecess_category_major" + ], + "properties": { + "firecess_inflammable": { + "type": "integer" + }, + "firecess_category_major": { + "type": "integer" + }, + "firecess_building_height": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "dynamicFirecess": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Floor b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Floor new file mode 100644 index 00000000000..ad195844e24 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Floor @@ -0,0 +1,79 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Floor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "description", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Interest b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Interest new file mode 100644 index 00000000000..0708776952f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Interest @@ -0,0 +1,95 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Interest", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string", + "format": "date" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MapConfig b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MapConfig new file mode 100644 index 00000000000..2a88768a742 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MapConfig @@ -0,0 +1,81 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MapConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "defaultConfig" + ], + "x-unique": [ + "defaultConfig" + ], + "properties": { + "defaultConfig": { + "type": "object", + "required": [ + "lat", + "lng" + ], + "properties": { + "lat": { + "type": "number", + "default": 31.6160638 + }, + "lng": { + "type": "number", + "default": 74.8978579 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationDocuments b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationDocuments new file mode 100644 index 00000000000..f8d579367b8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationDocuments @@ -0,0 +1,110 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MutationDocuments", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "documentType", + "required", + "active", + "hasDropdown", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + }, + "required": { + "type": "boolean", + "default": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": false + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code", + "active" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationPenalty b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationPenalty new file mode 100644 index 00000000000..e771453acbe --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationPenalty @@ -0,0 +1,94 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MutationPenalty", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay", + "mutationPaymentPeriodInMonth" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string", + "format": "date" + }, + "mutationPaymentPeriodInMonth": { + "type": "string", + "default": "06" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationReason b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationReason new file mode 100644 index 00000000000..7e37d9c5bb7 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationReason @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MutationReason", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationRebate b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationRebate new file mode 100644 index 00000000000..52f104c2cc4 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.MutationRebate @@ -0,0 +1,94 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.MutationRebate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "endingDay", + "mutationPaymentPeriodInMonth" + ], + "x-unique": [ + "fromFY", + "endingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "mutationPaymentPeriodInMonth": { + "type": "string", + "default": "06" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OccupancyType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OccupancyType new file mode 100644 index 00000000000..27c6dc5a71d --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OccupancyType @@ -0,0 +1,74 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.OccupancyType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerShipCategory b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerShipCategory new file mode 100644 index 00000000000..0922855cb20 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerShipCategory @@ -0,0 +1,75 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.OwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerType new file mode 100644 index 00000000000..36b62fd740c --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerType @@ -0,0 +1,107 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.OwnerType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "required": [ + "rate" + ], + "properties": { + "rate": { + "type": [ + "number", + "null" + ] + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerTypeDocument b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerTypeDocument new file mode 100644 index 00000000000..02438a9e82f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.OwnerTypeDocument @@ -0,0 +1,85 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.OwnerTypeDocument", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "ownerTypeCode", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "ownerTypeCode": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "ownerTypeCode", + "schemaCode": "PropertyTax.OwnerType" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTApplication b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTApplication new file mode 100644 index 00000000000..acd0ba64989 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTApplication @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PTApplication", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "creationReason", + "businessService", + "action", + "editAction" + ], + "x-unique": [ + "businessService" + ], + "properties": { + "action": { + "type": "string" + }, + "editAction": { + "type": "string" + }, + "creationReason": { + "type": "string" + }, + "businessService": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTWorkflow b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTWorkflow new file mode 100644 index 00000000000..da70968ba03 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PTWorkflow @@ -0,0 +1,81 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PTWorkflow", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "businessService", + "initialAction", + "inWorkflowStatusAllowed", + "enable" + ], + "x-unique": [ + "businessService", + "initialAction" + ], + "properties": { + "enable": { + "type": "boolean", + "default": false + }, + "initialAction": { + "type": "string" + }, + "businessService": { + "type": "string" + }, + "inWorkflowStatusAllowed": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Penalty b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Penalty new file mode 100644 index 00000000000..bc3542e4afb --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Penalty @@ -0,0 +1,88 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Penalty", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyConfiguration b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyConfiguration new file mode 100644 index 00000000000..f56ca478c85 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyConfiguration @@ -0,0 +1,85 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PropertyConfiguration", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "Mutation", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "Mutation": { + "type": "object", + "required": [ + "RegistrationDetails", + "MutationDetails" + ], + "properties": { + "MutationDetails": { + "type": "boolean", + "default": true + }, + "RegistrationDetails": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertySubType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertySubType new file mode 100644 index 00000000000..f567407790e --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertySubType @@ -0,0 +1,85 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PropertySubType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "propertyType" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "propertyType": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "propertyType", + "schemaCode": "PropertyTax.PropertyType" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyType new file mode 100644 index 00000000000..86aec8049ce --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.PropertyType @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.PropertyType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "propertyType": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ReasonForTransfer b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ReasonForTransfer new file mode 100644 index 00000000000..99994dbcb0a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.ReasonForTransfer @@ -0,0 +1,75 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.ReasonForTransfer", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Rebate b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Rebate new file mode 100644 index 00000000000..ef0bb9f1b9a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.Rebate @@ -0,0 +1,89 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.Rebate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "endingDay" + ], + "x-unique": [ + "fromFY", + "endingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.RentalDetails b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.RentalDetails new file mode 100644 index 00000000000..b1271afaf8b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.RentalDetails @@ -0,0 +1,75 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.RentalDetails", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.SubOwnerShipCategory b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.SubOwnerShipCategory new file mode 100644 index 00000000000..73ce49abcfc --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.SubOwnerShipCategory @@ -0,0 +1,85 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition":{ + "tenantId": "pg", + "code": "PropertyTax.SubOwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "ownerShipCategory" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "ownerShipCategory": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "ownerShipCategory", + "schemaCode": "PropertyTax.OwnerShipCategory" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UpdateNumber b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UpdateNumber new file mode 100644 index 00000000000..69251b4928c --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UpdateNumber @@ -0,0 +1,139 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UpdateNumber", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "invalidPattern", + "invalidNumber", + "warningEnabled", + "skipEnabled", + "documents" + ], + "x-unique": [ + "invalidNumber" + ], + "properties": { + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "active", + "code", + "description", + "documentType", + "dropdownData", + "hasDropdown", + "required", + "inputProps", + "maxFileSize" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "required": { + "type": "boolean", + "default": false + }, + "inputProps": { + "type": "object", + "required": [ + "accept" + ], + "properties": { + "accept": { + "type": "string" + } + }, + "additionalProperties": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": false + }, + "maxFileSize": { + "type": "integer" + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array" + } + }, + "additionalProperties": false + } + }, + "skipEnabled": { + "type": "boolean", + "default": true + }, + "invalidNumber": { + "type": "string" + }, + "invalidPattern": { + "type": "string" + }, + "warningEnabled": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategory b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategory new file mode 100644 index 00000000000..da9c55f6e68 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategory @@ -0,0 +1,106 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "properties": { + "rate": { + "type": [ + "number", + "null" + ], + "default": 0 + }, + "maxAmount": { + "type": [ + "number", + "null" + ], + "default": 0 + }, + "flatAmount": { + "type": [ + "number", + "null" + ], + "default": 0 + } + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryDetail b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryDetail new file mode 100644 index 00000000000..8aefa7d4091 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryDetail @@ -0,0 +1,112 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryDetail", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "usageCategorySubMinor", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": [ + "object", + "null" + ], + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "number" + }, + "maxAmount": { + "type": "number" + }, + "flatAmount": { + "type": "number" + } + } + }, + "usageCategorySubMinor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategorySubMinor", + "schemaCode": "PropertyTax.UsageCategorySubMinor" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMajor b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMajor new file mode 100644 index 00000000000..b76adc3f1cc --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMajor @@ -0,0 +1,80 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryMajor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMinor b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMinor new file mode 100644 index 00000000000..a30008fec5b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategoryMinor @@ -0,0 +1,111 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryMinor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY", + "usageCategoryMajor", + "exemption" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "integer" + }, + "maxAmount": { + "type": "integer" + }, + "flatAmount": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "usageCategoryMajor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategoryMajor", + "schemaCode": "PropertyTax.UsageCategoryMajor" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategorySubMinor b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategorySubMinor new file mode 100644 index 00000000000..fed6200feee --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/Property Tax/PropertyTax.UsageCategorySubMinor @@ -0,0 +1,114 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "PropertyTax.UsageCategorySubMinor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY", + "usageCategoryMinor", + "exemption" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": [ + "object", + "null" + ], + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "integer" + }, + "maxAmount": { + "type": "integer" + }, + "flatAmount": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "usageCategoryMinor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategoryMinor", + "schemaCode": "PropertyTax.UsageCategoryMinor" + } + ], + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ComplainClosingTime b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ComplainClosingTime new file mode 100644 index 00000000000..0ae18de37f4 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ComplainClosingTime @@ -0,0 +1,67 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "RAINMAKER-PGR.ComplainClosingTime", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "ComplainMaxIdleTime" + ], + "x-unique": [ + "ComplainMaxIdleTime" + ], + "properties": { + "ComplainMaxIdleTime": { + "type": "number", + "default": 3600000, + "minimum": 0 + } + } + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ServiceDefs b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ServiceDefs new file mode 100644 index 00000000000..74bfa2239f8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.ServiceDefs @@ -0,0 +1,100 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "RAINMAKER-PGR.ServiceDefs", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "serviceCode", + "name", + "keywords", + "department", + "slaHours", + "menuPath", + "active" + ], + "x-unique": [ + "serviceCode" + ], + "properties": { + "name": { + "type": "string" + }, + "order": { + "type": "integer" + }, + "active": { + "type": "boolean" + }, + "keywords": { + "type": "string" + }, + "menuPath": { + "type": "string" + }, + "slaHours": { + "type": "integer", + "default": 336, + "minimum": 1 + }, + "department": { + "type": "string" + }, + "serviceCode": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "department", + "schemaCode": "common-masters.Department" + } + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.UIConstants b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.UIConstants new file mode 100644 index 00000000000..b3164262bac --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/RAINMAKER-PGR/RAINMAKER-PGR.UIConstants @@ -0,0 +1,73 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "id": "c00c7744-8bff-48af-b659-45a85884d948", + "tenantId": "pg", + "code": "RAINMAKER-PGR.UIConstants", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "REOPENSLA" + ], + "x-unique": [ + "REOPENSLA" + ], + "properties": { + "REOPENSLA": { + "type": "integer", + "default": 432000000 + } + } + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702379477350, + "lastModifiedTime": 1702379477350 + } + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.AccessoriesCategory b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.AccessoriesCategory new file mode 100644 index 00000000000..84ed270fff7 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.AccessoriesCategory @@ -0,0 +1,78 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.AccessoriesCategory", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "uom": { + "type": [ + "string", + "null" + ] + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false, + "required": [ + "code", + "active", + "uom" + ], + "x-unique": [ + "code" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ApplicationType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ApplicationType new file mode 100644 index 00000000000..bff673628da --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ApplicationType @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.ApplicationType", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false, + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Documents b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Documents new file mode 100644 index 00000000000..e486fdd9d1a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Documents @@ -0,0 +1,105 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.Documents", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "documentType": { + "type": "string" + }, + "required": { + "type": "boolean", + "default": true + }, + "active": { + "type": "boolean", + "default": true + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false, + "required": [ + "code", + "active" + ] + } + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "code", + "documentType", + "required", + "active", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Penalty b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Penalty new file mode 100644 index 00000000000..9ec7ed8edaf --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Penalty @@ -0,0 +1,89 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.Penalty", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "rate": { + "type": "integer", + "default": 10, + "minimum": 0 + }, + "minAmount": { + "type": "number", + "minimum": 0 + }, + "flatAmount": { + "type": "number", + "minimum": 0 + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "startingDay": { + "type": "string", + "format": "date" + } + }, + "additionalProperties": false, + "required": [ + "rate", + "minAmount", + "flatAmount", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Rebate b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Rebate new file mode 100644 index 00000000000..f86e67f6767 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.Rebate @@ -0,0 +1,90 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.Rebate", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "rate": { + "type": "integer", + "minimum": 0 + }, + "maxAmount": { + "type": [ + "null", + "integer" + ], + "minimum": 0 + }, + "flatAmount": { + "type": "number", + "minimum": 0 + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + } + }, + "additionalProperties": false, + "required": [ + "rate", + "flatAmount", + "fromFY", + "endingDay" + ], + "x-unique": [ + "fromFY", + "endingDay" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ReminderPeriods b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ReminderPeriods new file mode 100644 index 00000000000..076eba5dfbc --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.ReminderPeriods @@ -0,0 +1,77 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.ReminderPeriods", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "tenantId": { + "type": "string" + }, + "reminderInterval": { + "type": "integer", + "default": 691200000 + } + }, + "additionalProperties": false, + "required": [ + "tenantId", + "reminderInterval" + ], + "x-unique": [ + "tenantId" + ], + "x-ref-schema": [ + { + "fieldPath": "tenantId", + "schemaCode": "tenant.tenantInfo" + } + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeRenewal b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeRenewal new file mode 100644 index 00000000000..c1c95f64c1f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeRenewal @@ -0,0 +1,68 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.TradeRenewal", + "description": null, + "definition": { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "renewalPeriod": { + "type": "integer", + "default": 7889400000, + "minimum": 0 + } + }, + "additionalProperties": false, + "required": [ + "renewalPeriod" + ], + "x-unique": [ + "renewalPeriod" + ] + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeType new file mode 100644 index 00000000000..e09795f7bd3 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/TradeLicense/TradeLicense.TradeType @@ -0,0 +1,133 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "TradeLicense.TradeType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "applicationDocument", + "verificationDocument", + "active", + "type" + ], + "x-unique": [ + "code" + ], + "properties": { + "uom": { + "type": [ + "null", + "string" + ] + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "validityPeriod": { + "type": [ + "null", + "integer" + ] + }, + "applicationDocument": { + "type": "array", + "items": { + "type": [ + "object", + "string" + ], + "required": [], + "properties": { + "documentList": { + "type": "array", + "items": { + "type": "string" + } + }, + "applicationType": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "verificationDocument": { + "type": [ + "array", + "null" + ] + }, + "restrictions": { + "type": "object", + "properties": { + "maxPlotArea": { + "type": "integer" + }, + "maxBulidingheight": { + "type": "integer" + }, + "maxFloors": { + "type": "integer" + } + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelCurrentBillReasons b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelCurrentBillReasons new file mode 100644 index 00000000000..3d39f04ed2a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelCurrentBillReasons @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CancelCurrentBillReasons", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelReceiptReason b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelReceiptReason new file mode 100644 index 00000000000..8a0e29b0379 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CancelReceiptReason @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CancelReceiptReason", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CensusYear b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CensusYear new file mode 100644 index 00000000000..d028dd9522f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CensusYear @@ -0,0 +1,74 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CensusYear", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenantId", + "name", + "code" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tenantId": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CitizenConsentForm b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CitizenConsentForm new file mode 100644 index 00000000000..55b5880fe59 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CitizenConsentForm @@ -0,0 +1,103 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CitizenConsentForm", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "isCitizenConsentFormEnabled", + "checkBoxLabels", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "checkBoxLabels": { + "type": "array", + "items": { + "type": "object", + "required": [ + "linkPrefix", + "link", + "linkId", + "linkPostfix", + "en_IN" + ], + "properties": { + "link": { + "type": "string" + }, + "en_IN": { + "type": "string" + }, + "linkId": { + "type": "string" + }, + "linkPrefix": { + "type": "string" + }, + "linkPostfix": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "isCitizenConsentFormEnabled": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CommonInboxConfig b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CommonInboxConfig new file mode 100644 index 00000000000..52b020d6ffa --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CommonInboxConfig @@ -0,0 +1,108 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CommonInboxConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "moduleName", + "BusinessService", + "roles", + "active", + "locality", + "localityModule", + "redirectConfig" + ], + "x-unique": [ + "BusinessService" + ], + "properties": { + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "active": { + "type": "boolean", + "default": true + }, + "locality": { + "type": "boolean", + "default": true + }, + "moduleName": { + "type": "string" + }, + "localityModule": { + "type": "string" + }, + "redirectConfig": { + "type": "object", + "required": [ + "INITIATED", + "DEFAULT" + ], + "properties": { + "DEFAULT": { + "type": "string" + }, + "INITIATED": { + "type": "string" + } + }, + "additionalProperties": false + }, + "BusinessService": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CronJobAPIConfig b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CronJobAPIConfig new file mode 100644 index 00000000000..cd4b8b563c9 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.CronJobAPIConfig @@ -0,0 +1,104 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.CronJobAPIConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "jobName", + "active", + "method", + "url", + "payload", + "header" + ], + "x-unique": [ + "url" + ], + "properties": { + "url": { + "type": "string" + }, + "active": { + "type": "string" + }, + "header": { + "type": "object", + "required": [ + "Content-Type" + ], + "properties": { + "Content-Type": { + "type": "string" + } + }, + "additionalProperties": false + }, + "method": { + "type": "string" + }, + "jobName": { + "type": "string" + }, + "payload": { + "type": "object", + "required": [ + "RequestInfo" + ], + "properties": { + "RequestInfo": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.Department b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.Department new file mode 100644 index 00000000000..f3d8ce424de --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.Department @@ -0,0 +1,75 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.Department", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.Designation b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.Designation new file mode 100644 index 00000000000..528031ecf1f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.Designation @@ -0,0 +1,79 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.Designation", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "name", + "description", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.DocumentType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.DocumentType new file mode 100644 index 00000000000..2816b84da5a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.DocumentType @@ -0,0 +1,80 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.DocumentType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "maxFileSize": { + "type": "number" + }, + "allowedFormat": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.GenderType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.GenderType new file mode 100644 index 00000000000..83a4ca14a69 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.GenderType @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.GenderType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.IdFormat b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.IdFormat new file mode 100644 index 00000000000..8cc3ea82b7b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.IdFormat @@ -0,0 +1,70 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.IdFormat", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "format", + "idname" + ], + "x-unique": [ + "idname" + ], + "properties": { + "format": { + "type": "string" + }, + "idname": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerShipCategory b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerShipCategory new file mode 100644 index 00000000000..0ae1ddb0332 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerShipCategory @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.OwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerType new file mode 100644 index 00000000000..41c03a9a54a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.OwnerType @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.OwnerType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.StateInfo b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.StateInfo new file mode 100644 index 00000000000..4c225aac601 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.StateInfo @@ -0,0 +1,152 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.StateInfo", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "qrCodeURL", + "bannerUrl", + "logoUrl", + "logoUrlWhite", + "statelogo", + "hasLocalisation", + "defaultUrl", + "languages", + "localizationModules" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "logoUrl": { + "type": "string" + }, + "bannerUrl": { + "type": "string" + }, + "languages": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "qrCodeURL": { + "type": "string" + }, + "statelogo": { + "type": "string" + }, + "defaultUrl": { + "type": "object", + "required": [ + "citizen", + "employee" + ], + "properties": { + "citizen": { + "type": "string" + }, + "employee": { + "type": "string" + } + }, + "additionalProperties": false + }, + "logoUrlWhite": { + "type": "string" + }, + "hasLocalisation": { + "type": "boolean", + "default": true + }, + "localizationModules": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.StructureType b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.StructureType new file mode 100644 index 00000000000..4679296a3cf --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.StructureType @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.StructureType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.TablePaginationOptions b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.TablePaginationOptions new file mode 100644 index 00000000000..64efcfdf153 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.TablePaginationOptions @@ -0,0 +1,77 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.TablePaginationOptions", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rowsPerPageOptions", + "defaultValue", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "defaultValue": { + "type": "integer" + }, + "rowsPerPageOptions": { + "type": "array", + "items": { + "type": "integer" + } + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.UOM b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.UOM new file mode 100644 index 00000000000..fac57a12d58 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.UOM @@ -0,0 +1,71 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.UOM", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.UomCategory b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.UomCategory new file mode 100644 index 00000000000..c132baeb7b5 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.UomCategory @@ -0,0 +1,94 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.UomCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "tenantId", + "uomCategory", + "name", + "code", + "description", + "fromDate", + "toDate" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "integer" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "toDate": { + "type": "integer" + }, + "fromDate": { + "type": "integer" + }, + "tenantId": { + "type": "string" + }, + "description": { + "type": "string" + }, + "uomCategory": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.Uomm b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.Uomm new file mode 100644 index 00000000000..e714b742f44 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.Uomm @@ -0,0 +1,99 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.Uom", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "tenantId", + "code", + "description", + "uomCategory", + "baseUom", + "fromDate", + "toDate", + "conversionFactor" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "integer" + }, + "code": { + "type": "string" + }, + "toDate": { + "type": "integer" + }, + "baseUom": { + "type": "boolean", + "default": true + }, + "fromDate": { + "type": "integer" + }, + "tenantId": { + "type": "string" + }, + "description": { + "type": "string" + }, + "uomCategory": { + "type": "string" + }, + "conversionFactor": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.bdTemplate b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.bdTemplate new file mode 100644 index 00000000000..07b15b8ec72 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.bdTemplate @@ -0,0 +1,70 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.bdTemplate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "template", + "code" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "template": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.uiCommonPay b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.uiCommonPay new file mode 100644 index 00000000000..722241ec549 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.uiCommonPay @@ -0,0 +1,120 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.uiCommonPay", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "headerBandLabel", + "receiptKey", + "billKey", + "cancelReceipt", + "cancelBill", + "arrears", + "buttons" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "arrears": { + "type": "boolean", + "default": true + }, + "billKey": { + "type": "string" + }, + "buttons": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "citizenUrl", + "employeeUrl" + ], + "properties": { + "label": { + "type": "string" + }, + "citizenUrl": { + "type": "string" + }, + "employeeUrl": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "pdfModule": { + "type": "string" + }, + "cancelBill": { + "type": "boolean", + "default": true + }, + "receiptKey": { + "type": "string" + }, + "cancelReceipt": { + "type": "boolean", + "default": true + }, + "headerBandLabel": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.wfSlaConfig b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.wfSlaConfig new file mode 100644 index 00000000000..83c3102dc85 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/Schema creation curls/common-masters/common-masters.wfSlaConfig @@ -0,0 +1,82 @@ +curl --location 'http://localhost:8094/mdms-v2/schema/v1/_create' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "Rainmaker", + "ver": ".01", + "ts": "", + "action": "_search", + "did": "1", + "key": "", + "msgId": "20170310130900|en_IN", + "authToken": "d194d705-ddbc-451a-98d1-e380d71e39e8", + "userInfo": { + "id": 2038, + "uuid": "677300e7-2ff3-4216-a3dc-c2cbb0d63d31", + "userName": "MCS1", + "name": "Vishal", + "mobileNumber": "7895875858", + "emailId": "", + "locale": null, + "type": "EMPLOYEE", + "roles": [ + { + "name": "Employee", + "code": "EMPLOYEE", + "tenantId": "pg.citya" + }, + { + "name": "Universal Collection Employee", + "code": "UC_EMP", + "tenantId": "pg.citya" + }, + { + "name": "Super User", + "code": "SUPERUSER", + "tenantId": "pg.citya" + } + ], + "active": true, + "tenantId": "pg.citya", + "permanentCity": null + } + }, + "SchemaDefinition": { + "tenantId": "pg", + "code": "common-masters.wfSlaConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "slotPercentage", + "positiveSlabColor", + "negativeSlabColor", + "middleSlabColor" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "integer" + }, + "slotPercentage": { + "type": "integer" + }, + "middleSlabColor": { + "type": "string" + }, + "negativeSlabColor": { + "type": "string" + }, + "positiveSlabColor": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true + } +}' \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data CancelCurrentBillReasons.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data CancelCurrentBillReasons.postman_collection new file mode 100644 index 00000000000..8f3e5286b99 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data CancelCurrentBillReasons.postman_collection @@ -0,0 +1,139 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"INCORRECT_PERSONAL_INFO\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INCORRECT_PROPERTY_DETAILS\",", + " \"active\": true", + " },{", + " \"code\": \"INCORRECT_CONNECTION_DETAILS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OTHER\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.CancelCurrentBillReasons\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.CancelCurrentBillReasons", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.CancelCurrentBillReasons" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainClosingTime.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainClosingTime.postman_collection new file mode 100644 index 00000000000..18a7889b3c8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainClosingTime.postman_collection @@ -0,0 +1,127 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"ComplainMaxIdleTime\": 3600000", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"RAINMAKER-PGR.ComplainClosingTime\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/RAINMAKER-PGR.ComplainClosingTime", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "RAINMAKER-PGR.ComplainClosingTime" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainMaxIdleTime.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainMaxIdleTime.postman_collection new file mode 100644 index 00000000000..18a7889b3c8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ComplainMaxIdleTime.postman_collection @@ -0,0 +1,127 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"ComplainMaxIdleTime\": 3600000", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"RAINMAKER-PGR.ComplainClosingTime\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/RAINMAKER-PGR.ComplainClosingTime", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "RAINMAKER-PGR.ComplainClosingTime" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionSubType.postman_collection.json b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionSubType.postman_collection.json new file mode 100644 index 00000000000..705ee696ea0 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionSubType.postman_collection.json @@ -0,0 +1,142 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"id\": \"1\",", + " \"name\": \"Pucca\",", + " \"code\": \"PUCCA\",", + " \"active\": true", + " },", + " {", + " \"id\": \"2\",", + " \"name\": \"Semi-Pucca\",", + " \"code\": \"SEMIPUCCA\",", + " \"active\": true", + " },", + " {", + " \"id\": \"3\",", + " \"name\": \"Kuccha\",", + " \"code\": \"KUCCHA\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.ConstructionSubType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.ConstructionSubType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.ConstructionSubType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionType.postman_collection new file mode 100644 index 00000000000..627ba7f56a0 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ConstructionType.postman_collection @@ -0,0 +1,142 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"id\": \"1\",", + " \"name\": \"Pucca\",", + " \"code\": \"PUCCA\",", + " \"active\": true", + " },", + " {", + " \"id\": \"2\",", + " \"name\": \"Semi-Pucca\",", + " \"code\": \"SEMIPUCCA\",", + " \"active\": true", + " },", + " {", + " \"id\": \"3\",", + " \"name\": \"Kuccha\",", + " \"code\": \"KUCCHA\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.ConstructionType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.ConstructionType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.ConstructionType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Documents.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Documents.postman_collection new file mode 100644 index 00000000000..1c3f88ecdc6 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Documents.postman_collection @@ -0,0 +1,539 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"OWNER.ADDRESSPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.ELECTRICITYBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.WATERBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.GASBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.AADHAAR\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.VOTERID\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.DRIVING\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.PASSPORT\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.ADDRESSPROOF.ADDRESSPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.AADHAAR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.VOTERID\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.DRIVING\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.PAN\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.PASSPORT\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.IDENTITYPROOF.IDENTITYPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.SALEDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.GIFTDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.PATTACERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.REGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.PARTITIONDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.COURTDECREE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.PROPERTYAUCTION\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.SUCCESSIONORDEATHCERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.FAMILYSETTLEMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.REGISTRATIONPROOF.UNREGISTEREDWILLDEED\",", + " ", + " \"active\": true", + " }", + " ],", + " \"description\": \"OWNER.REGISTRATIONPROOF.REGISTRATIONPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"filterCondition\": {", + " \"filterValue\": [", + " \"NONE\",", + " null", + " ],", + " \"jsonPath\": \"Properties[0].propertyDetails[0].owners\",", + " \"onArray\": true,", + " \"arrayAttribute\": \"ownerType\",", + " \"formDataPath\": [\"owners\"],", + " \"formArrayAttrPath\": [\"ownerType\", \"code\"]", + " },", + " \"dropdownFilter\": {", + " \"parentArrayJsonPath\": \"Properties[0].propertyDetails[0].owners\",", + " \"parentJsonpath\": \"ownerType\",", + " \"onArray\": true,", + " \"formArrayAttrPath\": [\"ownerType\", \"code\"],", + " \"formDataPath\": [\"owners\"]", + " },", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.SERVICEDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"FREEDOMFIGHTER\",", + " \"DEFENSE\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.HANDICAPCERTIFICATE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"HANDICAPPED\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.BPLDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"BPL\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.DEATHCERTIFICATE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"WIDOW\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.GENERALID\",", + " \"active\": true,", + " \"parentValue\": [", + " \"GENERAL\"", + " ]", + " }", + " ],", + " \"description\": \"OWNER.SPECIALCATEGORYPROOF.SPECIALCATEGORYPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.USAGEPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"dropdownFilter\": {", + " \"parentJsonpath\": \"Properties[0].propertyDetails[0].usageCategoryMinor\",", + " \"formDataPath\": [\"usageCategoryMinor\",\"code\"]", + " },", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.USAGEPROOF.ELECTRICITYBILL\",", + " \"active\": true,", + " \"parentValue\": [", + " null,", + " \"OFFICESPACE\",", + " \"OTHERS\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.USAGEPROOF.TRADELICENCE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"INDUSTRIAL\",", + " \"COMMERCIAL\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.USAGEPROOF.INSTITUTEREGISTRATIONDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"INSTITUTIONAL\"", + " ]", + " }", + " ],", + " \"description\": \"OWNER.USAGEPROOF.USAGEPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.CONSTRUCTIONPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"filterCondition\": {", + " \"filterValue\": [", + " \"VACANT\"", + " ],", + " \"jsonPath\": \"Properties[0].propertyDetails[0].propertyType\",", + " \"formDataPath\":[\"propertyType\",\"code\"],", + " \"onArray\": false", + " },", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.CONSTRUCTIONPROOF.BPACERTIFICATE\",", + " \"active\": true", + " }", + " ],", + " \"description\": \"OWNER.CONSTRUCTIONPROOF.CONSTRUCTIONPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.OCCUPANCYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": true,", + " \"active\": true,", + " \"digit-citizen\":true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"filterCondition\": {", + " \"filterValue\": [", + " \"SELFOCCUPIED\",", + " \"UNOCCUPIED\"", + " ],", + " \"jsonPath\": \"Properties[0].propertyDetails[0].units\",", + " \"onArray\": true,", + " \"arrayAttribute\": \"occupancyType\",", + " \"formDataPath\": [\"units\"],", + " \"formArrayAttrPath\": [\"occupancyType\"]", + " },", + " \"enabledActions\": {", + " \"assess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"reassess\": {", + " \"disableUpload\": true,", + " \"disableDropdown\": true", + " },", + " \"update\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " },", + " \"create\": {", + " \"disableUpload\": false,", + " \"disableDropdown\": false", + " }", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.OCCUPANCYPROOF.RENTAGREEMENT\",", + " \"active\": true", + " }", + " ],", + " \"description\": \"OWNER.OCCUPANCYPROOF.OCCUPANCYPROOF_DESCRIPTION\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.Documents\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.Documents", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.Documents" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data DuesOnPTMutation.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data DuesOnPTMutation.postman_collection new file mode 100644 index 00000000000..6944ce9feb7 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data DuesOnPTMutation.postman_collection @@ -0,0 +1,138 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"module\": \"WS\",", + " \"code\": \"WS\",", + " \"enabled\": true,", + " \"fetchConsumerUrl\": \"ws-services/wc/_search\",", + " \"fecthBillUrl\": \"billing-service/bill/v2/_fetchbill\"", + " },", + " {", + " \"module\": \"SW\",", + " \"code\": \"SW\",", + " \"enabled\": true,", + " \"fetchConsumerUrl\": \"sw-services/swc/_search\",", + " \"fecthBillUrl\": \"billing-service/bill/v2/_fetchbill\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.DuesOnPTMutation\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.DuesOnPTMutation", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.DuesOnPTMutation" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data FireCess.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data FireCess.postman_collection new file mode 100644 index 00000000000..bb9f847ed8e --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data FireCess.postman_collection @@ -0,0 +1,137 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 0,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2014-15\",", + " \"dynamicFirecess\": true,", + " \"dynamicRates\": {", + " \"firecess_inflammable\": 5,", + " \"firecess_building_height\": 2,", + " \"firecess_category_major\": 5", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.FireCess\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.FireCess", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.FireCess" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Floor.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Floor.postman_collection new file mode 100644 index 00000000000..87f765e5e3d --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Floor.postman_collection @@ -0,0 +1,226 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Fourth Basement\",", + " \"code\": \"-4\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Third Basement\",", + " \"code\": \"-3\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Second Basement\",", + " \"code\": \"-2\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"First Basement\",", + " \"code\": \"-1\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Ground Floor\",", + " \"code\": \"0\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"First Floor\",", + " \"code\": \"1\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Second Floor\",", + " \"code\": \"2\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Third Floor\",", + " \"code\": \"3\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Fourth Floor\",", + " \"code\": \"4\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Fifth Floor\",", + " \"code\": \"5\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Sixth Floor\",", + " \"code\": \"6\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Seventh Floor\",", + " \"code\": \"7\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Eighth Floor\",", + " \"code\": \"8\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Nineth Floor\",", + " \"code\": \"9\",", + " \"description\": \"floor number of the floor\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Tenth Floor\",", + " \"code\": \"10\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Eleventh Floor\",", + " \"code\": \"11\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Twelveth Floor\",", + " \"code\": \"12\",", + " \"description\": \"property unoccupied\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.Floor\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.Floor", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.Floor" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Interest.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Interest.postman_collection new file mode 100644 index 00000000000..0aa11086940 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Interest.postman_collection @@ -0,0 +1,172 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 18,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/01/2016\"", + " },", + " {", + " \"rate\": 12,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/04/2016\"", + " },", + " {", + " \"rate\": 4,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"01/04/2019\"", + " },", + " {", + " \"rate\": 9,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"11/12/2018\"", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"01/01/2024\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"maxAmount\": null,", + " \"fromFY\": \"2023-24\",", + " \"startingDay\": \"01/04/2024\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.Interest\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.Interest", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.Interest" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MapConfig.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MapConfig.postman_collection new file mode 100644 index 00000000000..d5110ab9a54 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MapConfig.postman_collection @@ -0,0 +1,130 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"defaultConfig\": {", + " \"lat\": 31.6160638,", + " \"lng\": 74.8978579", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MapConfig\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MapConfig", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MapConfig" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationDocuments.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationDocuments.postman_collection new file mode 100644 index 00000000000..dba16f8c720 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationDocuments.postman_collection @@ -0,0 +1,310 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"OWNER.ADDRESSPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": true,", + " \"active\": true,", + " \"hasDropdown\": true,", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.ELECTRICITYBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.WATERBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.GASBILL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.AADHAAR\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.VOTERID\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.DRIVING\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.ADDRESSPROOF.PASSPORT\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.ADDRESSPROOF.ADDRESSPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"hasDropdown\": true,", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.AADHAAR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.VOTERID\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.DRIVING\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.PAN\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.IDENTITYPROOF.PASSPORT\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.IDENTITYPROOF.IDENTITYPROOF_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT\",", + " \"documentType\": \"OWNER\",", + " \"required\": true,", + " \"active\": true,", + " \"hasDropdown\": true,", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.SALEDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.GIFTDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.PATTACERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.REGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.PARTITIONDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.COURTDECREE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.PROPERTYAUCTION\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.SUCCESSIONORDEATHCERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.FAMILYSETTLEMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.UNREGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.CORRECTIONINNAME\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OWNER.TRANSFERREASONDOCUMENT.CHANGEINOWNERSPECIALCATEGORY\",", + " \"active\": true", + " }", + " ],", + " \"description\": \"OWNER.TRANSFERREASONDOCUMENT.TRANSFERREASONDOCUMENT_DESCRIPTION\"", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": false,", + " \"active\": true,", + " \"hasDropdown\": true,", + " \"additionalDetails\": {", + " \"filterCondition\": {", + " \"filterValue\": [", + " \"NONE\"", + " ],", + " \"jsonPath\": \"Property.ownersTemp\",", + " \"onArray\": true,", + " \"arrayAttribute\": \"ownerType\"", + " },", + " \"dropdownFilter\": {", + " \"parentArrayJsonPath\": \"Property.ownersTemp\",", + " \"parentJsonpath\": \"ownerType\"", + " }", + " },", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.SERVICEDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"FREEDOMFIGHTER\",", + " \"DEFENSE\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.HANDICAPCERTIFICATE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"HANDICAPPED\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.BPLDOCUMENT\",", + " \"active\": true,", + " \"parentValue\": [", + " \"BPL\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.DEATHCERTIFICATE\",", + " \"active\": true,", + " \"parentValue\": [", + " \"WIDOW\"", + " ]", + " },", + " {", + " \"code\": \"OWNER.SPECIALCATEGORYPROOF.GENERALID\",", + " \"active\": true,", + " \"parentValue\": [", + " \"GENERAL\"", + " ]", + " }", + " ],", + " \"description\": \"OWNER.SPECIALCATEGORYPROOF.SPECIALCATEGORYPROOF_DESCRIPTION\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MutationDocuments\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MutationDocuments", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MutationDocuments" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationPenalty.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationPenalty.postman_collection new file mode 100644 index 00000000000..5aa4bbf5d3e --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationPenalty.postman_collection @@ -0,0 +1,165 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"1/01/2018\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/04/2016\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + "", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"11/12/2018\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2019-20\",", + " \"startingDay\": \"26/09/2019\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2020-21\",", + " \"startingDay\": \"26/09/2020\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MutationPenalty\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MutationPenalty", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MutationPenalty" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationReason.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationReason.postman_collection new file mode 100644 index 00000000000..c7096f32ad9 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationReason.postman_collection @@ -0,0 +1,172 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"SALEDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"GIFTDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"PATTACERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"REGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"PARTITIONDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"COURTDECREE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"PROPERTYAUCTION\",", + " \"active\": true", + " },", + " {", + " \"code\": \"SUCCESSIONORDEATHCERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"FAMILYSETTLEMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"UNREGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"CORRECTIONINNAME\",", + " \"active\": true", + " },", + " {", + " \"code\": \"CHANGEINOWNERSPECIALCATEGORY\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MutationReason\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MutationReason", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MutationReason" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationRebate.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationRebate.postman_collection new file mode 100644 index 00000000000..68df34a8e6f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data MutationRebate.postman_collection @@ -0,0 +1,149 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"endingDay\": \"25/09\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + "", + " },", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2019-20\",", + " \"endingDay\": \"25/09\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " },", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2020-21\",", + " \"endingDay\": \"26/09\",", + " \"mutationPaymentPeriodInMonth\": \"06\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.MutationRebate\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.MutationRebate", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.MutationRebate" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OccupancyType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OccupancyType.postman_collection new file mode 100644 index 00000000000..bd7e253f8f6 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OccupancyType.postman_collection @@ -0,0 +1,139 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Tenanted/ Rented\",", + " \"code\": \"RENTED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Self-Occupied\",", + " \"code\": \"SELFOCCUPIED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Unoccupied\",", + " \"code\": \"UNOCCUPIED\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.OccupancyType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.OccupancyType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.OccupancyType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerShipCategory.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerShipCategory.postman_collection new file mode 100644 index 00000000000..c3e45b52935 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerShipCategory.postman_collection @@ -0,0 +1,175 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Individual(s)\",", + " \"code\": \"INDIVIDUAL\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Institutional - Private \",", + " \"code\": \"INSTITUTIONALPRIVATE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Institutional - Government\",", + " \"code\": \"INSTITUTIONALGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Individual - SingleOwner\",", + " \"code\": \"INDIVIDUAL.SINGLEOWNER\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Multiple Owners\",", + " \"code\": \"INDIVIDUAL.MULTIPLEOWNERS\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Private Company\",", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATECOMPANY\",", + " \"active\": true", + " },", + " {", + " \"name\": \"NGO\",", + " \"code\": \"INSTITUTIONALPRIVATE.NGO\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Private Trust\",", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATETRUST\",", + " \"active\": true", + " },", + " ", + " {", + " \"name\": \"ULB Government\",", + " \"code\": \"INSTITUTIONALGOVERNMENT.ULBGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"name\": \"State Government\",", + " \"code\": \"INSTITUTIONALGOVERNMENT.STATEGOVERNMENT\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.OwnerShipCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.OwnerShipCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.OwnerShipCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerType.postman_collection new file mode 100644 index 00000000000..46b0b7fb501 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerType.postman_collection @@ -0,0 +1,196 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Freedom Fighter\",", + " \"code\": \"FREEDOMFIGHTER\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": null,", + " \"flatAmount\": null", + " }", + " },", + " {", + " \"name\": \"Widow\",", + " \"code\": \"WIDOW\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": null,", + " \"maxAmount\": null,", + " \"flatAmount\": 5000.0", + " }", + " },", + " {", + " \"name\": \"Handicapped Person\",", + " \"code\": \"HANDICAPPED\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": null,", + " \"maxAmount\": null,", + " \"flatAmount\": 5000.0", + " }", + " },", + " {", + " \"name\": \"Below Poverty Line\",", + " \"code\": \"BPL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100.0,", + " \"maxAmount\": null,", + " \"flatAmount\": null", + " }", + " },", + " {", + " \"name\": \"Defense Personnel\",", + " \"code\": \"DEFENSE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100.0,", + " \"maxAmount\": null,", + " \"flatAmount\": null", + " }", + " },", + " {", + " \"name\": \"General\",", + " \"code\": \"GENERAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100.0,", + " \"maxAmount\": null,", + " \"flatAmount\": null", + " }", + " },", + " {", + " \"name\": \"None of the above\",", + " \"code\": \"NONE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.OwnerType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.OwnerType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.OwnerType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerTypeDocument.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerTypeDocument.postman_collection new file mode 100644 index 00000000000..a4ac7caf026 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data OwnerTypeDocument.postman_collection @@ -0,0 +1,161 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Certificate issued by DC/ Competent Authority\",", + " \"code\": \"COMPETENTAUTHORITY\",", + " \"ownerTypeCode\": \"FREEDOMFIGHTER\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Death Certificate\",", + " \"code\": \"DEATHCERTIFICATE\",", + " \"ownerTypeCode\": \"WIDOW\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Certificate of Handicap by the competent authority\",", + " \"code\": \"HANDICAPCERTIFICATE\",", + " \"ownerTypeCode\": \"HANDICAPPED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"BPL card\",", + " \"code\": \"BPLCARD\",", + " \"ownerTypeCode\": \"BPL\",", + " \"active\": true", + " ", + " },", + " {", + " \"name\": \"Defence ID proof\",", + " \"code\": \"DEFENCEID\",", + " \"ownerTypeCode\": \"DEFENSE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"General ID proof\",", + " \"code\": \"GENERALID\",", + " \"ownerTypeCode\": \"GENERAL\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.OwnerTypeDocument\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.OwnerTypeDocument", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.OwnerTypeDocument" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTApplication.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTApplication.postman_collection new file mode 100644 index 00000000000..803585904f9 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTApplication.postman_collection @@ -0,0 +1,146 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"creationReason\": \"MUTATION\",", + " \"businessService\": \"PT.MUTATION\",", + " \"action\": \"OPEN\",", + " \"editAction\": \"REOPEN\"", + " },", + " {", + " \"creationReason\": \"CREATE\",", + " \"businessService\": \"PT.CREATE\",", + " \"action\": \"OPEN\",", + " \"editAction\": \"REOPEN\"", + " }, {", + " \"creationReason\": \"UPDATE\",", + " \"businessService\": \"PT.UPDATE\",", + " \"action\": \"OPEN\",", + " \"editAction\": \"REOPEN\"", + " }, {", + " \"creationReason\": \"LEGACY_ENTRY\",", + " \"businessService\": \"PT.LEGACY\",", + " \"action\": \"OPEN\",", + " \"editAction\": \"REOPEN\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.PTApplication\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.PTApplication", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.PTApplication" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTWorkflow.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTWorkflow.postman_collection new file mode 100644 index 00000000000..2ca6635ada9 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PTWorkflow.postman_collection @@ -0,0 +1,136 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"businessService\":\"PT.CREATEWITHWNS\",", + " \"initialAction\":\"OPEN\",", + " \"inWorkflowStatusAllowed\":false,", + " \"enable\":false", + " },", + " {", + " \"businessService\":\"PT.CREATE\",", + " \"initialAction\":\"open\",", + " \"inWorkflowStatusAllowed\":true,", + " \"enable\":true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.PTWorkflow\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.PTWorkflow", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.PTWorkflow" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Penalty.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Penalty.postman_collection new file mode 100644 index 00000000000..7dabd7acae1 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data Penalty.postman_collection @@ -0,0 +1,152 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"1/01/2018\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/04/2016\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"11/12/2018\"", + " },", + " {", + " \"rate\": 20,", + " \"minAmount\": null,", + " \"flatAmount\": null,", + " \"fromFY\": \"2023-24\",", + " \"startingDay\": \"31/12/2023\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.Penalty\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.Penalty", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.Penalty" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyAge.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyAge.postman_collection new file mode 100644 index 00000000000..b8aa44ed283 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyAge.postman_collection @@ -0,0 +1,139 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"less than 10 year\",", + " \"code\": \"<10year\",", + " \"active\": true", + " },", + " {", + " \"name\": \"greater than 15 year \",", + " \"code\": \">15year\",", + " \"active\": true", + " },", + " {", + " \"name\": \"greater than 25 year\",", + " \"code\": \">25year\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.PropertyAge\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.PropertyAge", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.PropertyAge" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyType.postman_collection new file mode 100644 index 00000000000..ef4c94e4927 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data PropertyType.postman_collection @@ -0,0 +1,146 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Vacant Land\",", + " \"code\": \"VACANT\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Built Up\",", + " \"code\": \"BUILTUP\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Flat/Part of the building\",", + " \"code\": \"BUILTUP.SHAREDPROPERTY\",", + " \"active\": true,", + " \"propertyType\": \"BUILTUP\"", + " },", + " {", + " \"name\": \"Independent Building\",", + " \"code\": \"BUILTUP.INDEPENDENTPROPERTY\",", + " \"active\": true,", + " \"propertyType\": \"BUILTUP\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.PropertyType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.PropertyType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.PropertyType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ReasonForTransfer.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ReasonForTransfer.postman_collection new file mode 100644 index 00000000000..3236c82183d --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data ReasonForTransfer.postman_collection @@ -0,0 +1,184 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Sale Deed\",", + " \"code\": \"SALEDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Gift Deed\",", + " \"code\": \"GIFTDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Patta Certificate\",", + " \"code\": \"PATTACERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Registered will deed\",", + " \"code\": \"REGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Partition Deed\",", + " \"code\": \"PARTITIONDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Court Decree\",", + " \"code\": \"COURTDECREE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Property Auction\",", + " \"code\": \"PROPERTYAUCTION\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Succession or Death Certificate\",", + " \"code\": \"SUCCESSIONORDEATHCERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Family Settlement\",", + " \"code\": \"FAMILYSETTLEMENT\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Unregistered Will deed\",", + " \"code\": \"UNREGISTEREDWILLDEED\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Correction in Name\",", + " \"code\": \"CORRECTIONINNAME\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Change in Owner Special Category\",", + " \"code\": \"CHANGEINOWNERSPECIALCATEGORY\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.ReasonForTransfer\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.ReasonForTransfer", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.ReasonForTransfer" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data RentalDetails.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data RentalDetails.postman_collection new file mode 100644 index 00000000000..1046702b7c6 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data RentalDetails.postman_collection @@ -0,0 +1,129 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Tax is 7.5% of the annual rent for the rented part of the property.\",", + " \"code\": \"7_5_PERCENTTAX\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.RentalDetails\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.RentalDetails", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.RentalDetails" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data SubOwnerShipCategory.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data SubOwnerShipCategory.postman_collection new file mode 100644 index 00000000000..48612004ca1 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data SubOwnerShipCategory.postman_collection @@ -0,0 +1,190 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Single Owner\",", + " \"code\": \"SINGLEOWNER\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INDIVIDUAL\"", + " },", + " {", + " \"name\": \"Multiple Owners\",", + " \"code\": \"MULTIPLEOWNERS\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INDIVIDUAL\"", + " },", + " {", + " \"name\": \"Private Company\",", + " \"code\": \"PRIVATECOMPANY\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"NGO\",", + " \"code\": \"NGO\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"Private Trust\",", + " \"code\": \"PRIVATETRUST\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"Private Board\",", + " \"code\": \"PRIVATEBOARD\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"ULB Government\",", + " \"code\": \"ULBGOVERNMENT\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALGOVERNMENT\"", + " },", + " {", + " \"name\": \"State Government\",", + " \"code\": \"STATEGOVERNMENT\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALGOVERNMENT\"", + " },", + " {", + " \"name\": \"Central Government\",", + " \"code\": \"CENTRALGOVERNMENT\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALGOVERNMENT\"", + " },", + " {", + " \"name\": \"Others - Private Instituition\",", + " \"code\": \"OTHERSPRIVATEINSTITUITION\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALPRIVATE\"", + " },", + " {", + " \"name\": \"Others - Government Instituition\",", + " \"code\": \"OTHERGOVERNMENTINSTITUITION\",", + " \"active\": true,", + " \"ownerShipCategory\": \"INSTITUTIONALGOVERNMENT\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.SubOwnerShipCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.SubOwnerShipCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.SubOwnerShipCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UpdateNumber.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UpdateNumber.postman_collection new file mode 100644 index 00000000000..703367f17dc --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UpdateNumber.postman_collection @@ -0,0 +1,158 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"invalidPattern\": \"^[6789][0-9]{9}$\",", + " \"invalidNumber\": \"9999999999\",", + " \"warningEnabled\": true,", + " \"skipEnabled\": true,", + " \"documents\": [", + " {", + " \"active\": true,", + " \"code\": \"OWNER.DULYSIGNED\",", + " \"description\": \"OWNER.DULYSIGNED_DESCRIPTION\",", + " \"documentType\": \"DULYSIGNED\",", + " \"dropdownData\": [],", + " \"hasDropdown\": false,", + " \"required\": false,", + " \"inputProps\": {", + " \"accept\": \"image/*, .pdf, .png, .jpeg\"", + " },", + " \"maxFileSize\": 5000", + " },", + " {", + " \"active\": true,", + " \"code\": \"OWNER.IDENTITYPROOF\",", + " \"description\": \"OWNER.IDENTITYPROOF_DESCRIPTION\",", + " \"documentType\": \"IDENTITYPROOF\",", + " \"dropdownData\": [],", + " \"hasDropdown\": false,", + " \"required\": false,", + " \"inputProps\": {", + " \"accept\": \"image/*, .pdf, .png, .jpeg\"", + " },", + " \"maxFileSize\": 5000", + " }", + " ]", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UpdateNumber\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UpdateNumber", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UpdateNumber" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMajor.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMajor.postman_collection new file mode 100644 index 00000000000..9014c05bc3f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMajor.postman_collection @@ -0,0 +1,142 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Residential\",", + " \"code\": \"RESIDENTIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"NonResidential\",", + " \"code\": \"NONRESIDENTIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Mixed\",", + " \"code\": \"MIXED\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UsageCategoryMajor\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UsageCategoryMajor", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UsageCategoryMajor" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMinor.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMinor.postman_collection new file mode 100644 index 00000000000..67717fc1632 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategoryMinor.postman_collection @@ -0,0 +1,172 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Commercial\",", + " \"code\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMajor\": \"NONRESIDENTIAL\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Industrial\",", + " \"code\": \"INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMajor\": \"NONRESIDENTIAL\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Institutional\",", + " \"code\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMajor\": \"NONRESIDENTIAL\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Others\",", + " \"code\": \"OTHERS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMajor\": \"NONRESIDENTIAL\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UsageCategoryMinor\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UsageCategoryMinor", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UsageCategoryMinor" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategorySubMinor.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategorySubMinor.postman_collection new file mode 100644 index 00000000000..88db09dd553 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data UsageCategorySubMinor.postman_collection @@ -0,0 +1,384 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Retail\",", + " \"code\": \"RETAIL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Hotels\",", + " \"code\": \"HOTELS\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Office Space\",", + " \"code\": \"OFFICESPACE\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Event Space \",", + " \"code\": \"EVENTSPACE\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Food Joints\",", + " \"code\": \"FOODJOINTS\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Statutory\",", + " \"code\": \"STATUTORY\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Entertainment\",", + " \"code\": \"ENTERTAINMENT\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Medical Facility\",", + " \"code\": \"MEDICALFACILITY\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Commercial Usage \",", + " \"code\": \"OTHERCOMMERCIALSUBMINOR\",", + " \"usageCategoryMinor\": \"COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Godown / Warehouse\",", + " \"code\": \"WAREHOUSE\",", + " \"usageCategoryMinor\": \"INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Manufacturing Facility\",", + " \"code\": \"MANUFACTURINGFACILITY\",", + " \"usageCategoryMinor\": \"INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Industrial Usage \",", + " \"code\": \"OTHERINDUSTRIALSUBMINOR\",", + " \"usageCategoryMinor\": \"INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational\",", + " \"code\": \"EDUCATIONAL\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational(govt. aided)\",", + " \"code\": \"EDUCATIONALGOVAIDED\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Recreational Space\",", + " \"code\": \"RECREATIONAL\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Others(care giving facilities)\",", + " \"code\": \"HOMESFORSPECIALCARE\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Religious Instituition\",", + " \"code\": \"RELIGIOUSINSTITUTION\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Stray Animal Care Center\",", + " \"code\": \"ANIMALCARE\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Historical Building\",", + " \"code\": \"HISTORICAL\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Public Facility\",", + " \"code\": \"PUBLICFACILITY\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Institutional Usage \",", + " \"code\": \"OTHERINSTITUTIONALSUBMINOR\",", + " \"usageCategoryMinor\": \"INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Public Spaces\",", + " \"code\": \"PUBLICSPACES\",", + " \"usageCategoryMinor\": \"OTHERS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": null", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UsageCategorySubMinor\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UsageCategorySubMinor", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UsageCategorySubMinor" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data. UsageCategorypostman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data. UsageCategorypostman_collection new file mode 100644 index 00000000000..b7cdebee4af --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/MDMS v2 Bulk Data. UsageCategorypostman_collection @@ -0,0 +1,794 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Residential\",", + " \"code\": \"RESIDENTIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"NonResidential\",", + " \"code\": \"NONRESIDENTIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Mixed\",", + " \"code\": \"MIXED\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Commercial\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Industrial\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Institutional\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Non-Residential\",", + " \"code\": \"NONRESIDENTIAL.OTHERS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Retail\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Hotels\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.HOTELS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Office Space\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.OFFICESPACE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Food Joints\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.FOODJOINTS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational(govt. aided)\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVAIDED\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Recreational Space\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RECREATIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Others(care giving facilities)\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Institutional Usage \",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERINSTITUTIONALSUBMINOR\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Public Facility\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Religious Instituition\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RELIGIOUSINSTITUTION\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Godown/Warehouse\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.WAREHOUSE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Other Commercial Usage\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.OTHERCOMMERCIALSUBMINOR\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Manufacturing Facility\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.MANUFACTURINGFACILITY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Showroom\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.SHOWROOM\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Malls\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.MALLS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"AC Restaurant\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.FOODJOINTS.ACRESTAURANT\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Non AC Restaurant\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.FOODJOINTS.NONACRESTAURANT\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Grocery Store\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.GROCERY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Godown/Warehouse\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.WAREHOUSE.WAREHOUSE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Manufacturing Facility\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.MANUFACTURINGFACILITY.MANUFACTURINGFACILITY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"College\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.COLLEGES\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Community Hall\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY.COMMUNITYHALL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Pharmacy\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.PHARMACY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Marriage Palace\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.EVENTSPACE.MARRIAGEPALACE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Multiplex \",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.ENTERTAINMENT.MULTIPLEX\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Movie Theatre\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.ENTERTAINMENT.MOVIETHEATRE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Statutory Organisation\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.STATUTORY.STATUTORYORGANISATION\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Private Hospital\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY.PVTHOSPITAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Private Dispensary\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY.PVTDISPENSARY\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Commercial Usage \",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.OTHERCOMMERCIALSUBMINOR.OTHERCOMMERCIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Industrial Usage \",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.OTHERINDUSTRIALSUBMINOR.OTHERINDUSTRIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"School\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.SCHOOL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Training Institute\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.TRAININGINSTITUTES\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Polytechnic\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.POLYTECHNICS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Private Educational Institute\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONAL.OTHEREDUCATIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Govt. Aided Educational Institute\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVAIDED.GOVAIDEDEDUCATIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Others \",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERINSTITUTIONALSUBMINOR.OTHERINSTITUTIONAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Sports Stadium\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RECREATIONAL.SPORTSSTADIUM\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Social Club\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RECREATIONAL.SOCIALCLUB\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Golf Club \",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RECREATIONAL.GOLFCLUB\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Orphanage\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE.ORPHANAGE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Old Age Homes\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE.OLDAGEHOMES\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Home for the disabled / destitute\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE.DISABLEDHOME\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Stray Animal Care Center\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HOMESFORSPECIALCARE.ANIMALCARE\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Govt. Hospital & Dispensary\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY.GOVTHOSPITAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 100,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Religious\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RELIGIOUSINSTITUITION.RELIGIOUS\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Historical Building\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.HISTORICAL.HISTORICAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Public Libraries\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY.LIBRARIES\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Cremation/ Burial Ground\",", + " \"code\": \"NONRESIDENTIAL.OTHERS.PUBLICSPACES.CREMATION/BURIAL\",", + " \"active\": true,", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Office Spaces\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.OFFICESPACES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Medical facility\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Manufacturing Facility\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.MANUFACTURINGFACILITIES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Others\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Religious\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RELIGIOUS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Public Spaces\",", + " \"code\": \"NONRESIDENTIAL.OTHERS.PUBLICSPACES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Educational (Govt. aided)\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\",", + " \"exemption\": {", + " \"rate\": 0,", + " \"maxAmount\": 0,", + " \"flatAmount\": 0", + " }", + " },", + " {", + " \"name\": \"Grocery & Supermarkets\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.GROCERY&SUPERMARKETS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Establishment in Malls\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.ESTABLISHMENTINMALLS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Establishment in Multiplex\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.ESTABLISHMENTINMULTIPLEX\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Retail Stores\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.RETAIL.OTHERRETAILSTORES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"2 Star or below\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.HOTELS.2STARORBELOW\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"3 Star and Above\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.HOTELS.3STARANDABOVE\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Resorts\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.HOTELS.RESORTS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Office spaces\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.OFFICESPACES.OFFICESPACES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Community Halls\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.EVENTSPACES.COMMUNITYHALLS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Food Outlets\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.FOODJOINTS.OTHERFOODOUTLETS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Gaming Centre\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.ENTERTAINMENT.GAMINGCENTRE\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Hospital\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY.HOSPITAL\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Dispensary\",", + " \"code\": \"NONRESIDENTIAL.COMMERCIAL.MEDICALFACILITY.DISPENSARY\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Other Storage Facilities\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.WAREHOUSE.OTHERSTORAGEFACILITIES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Industries\",", + " \"code\": \"NONRESIDENTIAL.INDUSTRIAL.MANUFACTURINGFACILITIES.INDUSTRIES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Orphanage\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS.ORPHANAGE\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Old age homes\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS.OLDAGEHOMES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Stray Animal Care Center\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS.STRAYANIMALCARECENTER\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Home for the disabled\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.OTHERS.HOMEFORTHEDISABLED\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Bus Stands & Railway Station\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.PUBLICFACILITY.BUSSTANDS&RAILWAYSTATION\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Religious\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.RELIGIOUS.RELIGIOUS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Parks\",", + " \"code\": \"NONRESIDENTIAL.OTHERS.PUBLICSPACES.PARKS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"School\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT.SCHOOL\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Colleges\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT.COLLEGES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Training Institutes\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT.TRAININGINSTITUTES\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " },", + " {", + " \"name\": \"Polytechnics\",", + " \"code\": \"NONRESIDENTIAL.INSTITUTIONAL.EDUCATIONALGOVT.POLYTECHNICS\",", + " \"active\": \"True\",", + " \"fromFY\": \"2015-16\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"PropertyTax.UsageCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/PropertyTax.UsageCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "PropertyTax.UsageCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/PropertyTax.CancerCess b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/PropertyTax.CancerCess new file mode 100644 index 00000000000..84f7a895922 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/PropertyTax.CancerCess @@ -0,0 +1,38 @@ +curl --location 'http://localhost:8094/mdms-v2/v2/_create/PropertyTax.CancerCess' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "action": null, + "did": null, + "key": null, + "msgId": "search with from and to values", + "authToken": "dfcca143-b5a6-4726-b5cd-c2c949cb0f2b", + "correlationId": null, + "userInfo": { + "id": "1", + "userName": null, + "name": null, + "type": null, + "mobileNumber": null, + "emailId": null, + "roles": null, + "uuid": "40dceade-992d-4a8f-8243-19dda76a4171" + } + }, + "Mdms": { + "tenantId": "pg", + "schemaCode": "PropertyTax.CancerCess", + "data": { + "rate": 5, + "minAmount": null, + "flatAmount": null, + "maxAmount": null, + "fromFY": "2015-16" + }, + "isActive": true + } +}' + diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/PropertyTax.ChargeSlabs b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/PropertyTax.ChargeSlabs new file mode 100644 index 00000000000..2f3bf86a190 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/PT/PropertyTax.ChargeSlabs @@ -0,0 +1,36 @@ +curl --location 'http://localhost:8094/mdms-v2/v2/_create/PropertyTax.ChargeSlabs' \ +--header 'Content-Type: application/json' \ +--data '{ + "RequestInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "action": null, + "did": null, + "key": null, + "msgId": "search with from and to values", + "authToken": "dfcca143-b5a6-4726-b5cd-c2c949cb0f2b", + "correlationId": null, + "userInfo": { + "id": "1", + "userName": null, + "name": null, + "type": null, + "mobileNumber": null, + "emailId": null, + "roles": null, + "uuid": "40dceade-992d-4a8f-8243-19dda76a4171" + } + }, + "Mdms": { + "tenantId": "pg", + "schemaCode": "PropertyTax.ChargeSlabs", + "data": { + "name": "2 / Sq.Yards", + "code": "PT_CHARGE_SLAB_0", + "floorNo": 0, + "active": true + }, + "isActive": true + } +}' diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy AccessoriesCategory.postman_collection.json b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy AccessoriesCategory.postman_collection.json new file mode 100644 index 00000000000..ce7b393813f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy AccessoriesCategory.postman_collection.json @@ -0,0 +1,149 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"ACC-1\",", + " \"uom\": \"HP\",", + " \"active\": true", + " },", + " {", + " \"code\": \"ACC-2\",", + " \"uom\": \"HP\",", + " \"active\": true", + " },", + " {", + " \"code\": \"ACC-3\",", + " \"uom\": \"HP\",", + " \"active\": true", + " },", + " {", + " \"code\": \"ACC-4\",", + " \"uom\": null,", + " \"active\": true", + " },", + " {", + " \"code\": \"ACC-5\",", + " \"uom\": null,", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.AccessoriesCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.AccessoriesCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.AccessoriesCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ApplicationType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ApplicationType.postman_collection new file mode 100644 index 00000000000..2b28befdf22 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ApplicationType.postman_collection @@ -0,0 +1,132 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"APPLICATIONTYPE.NEW\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPLICATIONTYPE.RENEWAL\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.ApplicationType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.ApplicationType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.ApplicationType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Documents.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Documents.postman_collection new file mode 100644 index 00000000000..d7510c45cbf --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Documents.postman_collection @@ -0,0 +1,149 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"OWNER.OWNERIDPROOF\",", + " \"documentType\": \"OWNER\",", + " \"required\": true,", + " \"active\": true,", + " \"dropdownData\": [", + " {", + " \"code\": \"OWNER.OWNERIDPROOF\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.OWNERSHIPPROOF\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.OWNERPHOTO\",", + " \"active\": false", + " },", + " {", + " \"code\": \"OWNER.OLDLICENCENO\",", + " \"active\": false", + " }", + " ],", + " \"description\": \"OWNER.OWNERIDPROOF.OWNERIDPROOF_DESCRIPTION\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.Documents\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.Documents", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.Documents" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Penalty.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Penalty.postman_collection new file mode 100644 index 00000000000..819a3e8deb3 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Penalty.postman_collection @@ -0,0 +1,160 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"1/09/2018\"", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2015-16\",", + " \"startingDay\": \"1/04/2016\"", + "", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2018-19\",", + " \"startingDay\": \"1/09/2018\"", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2019-20\",", + " \"startingDay\": \"1/09/2019\"", + " },", + " {", + " \"rate\": 10,", + " \"minAmount\": 0.0,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2020-21\",", + " \"startingDay\": \"1/09/2020\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.Penalty\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.Penalty", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.Penalty" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Rebate.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Rebate.postman_collection new file mode 100644 index 00000000000..5865cca562b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy Rebate.postman_collection @@ -0,0 +1,146 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2018-19\",", + " \"endingDay\": \"31/03\"", + "", + " },", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2019-20\",", + " \"endingDay\": \"31/03\"", + " },", + " {", + " \"rate\": 10,", + " \"maxAmount\": null,", + " \"flatAmount\": 0.0,", + " \"fromFY\": \"2020-21\",", + " \"endingDay\": \"31/03\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.Rebate\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.Rebate", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.Rebate" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ReminderPeriods.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ReminderPeriods.postman_collection new file mode 100644 index 00000000000..ad0a75058da --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy ReminderPeriods.postman_collection @@ -0,0 +1,136 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"tenantId\": \"pg.citya\",", + " \"reminderInterval\": 691200000", + " },", + " {", + " \"tenantId\": \"pg.cityb\",", + " \"reminderInterval\": 12345", + " },", + " {", + " \"tenantId\": \"pg.cityc\",", + " \"reminderInterval\": 12345 ", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.ReminderPeriods\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.ReminderPeriods", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.ReminderPeriods" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeRenewal.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeRenewal.postman_collection new file mode 100644 index 00000000000..3292d0a64c8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeRenewal.postman_collection @@ -0,0 +1,127 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"renewalPeriod\": 7889400000", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.TradeRenewal\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.TradeRenewal", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.TradeRenewal" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeType.postman_collection new file mode 100644 index 00000000000..a9a84b81311 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/TradeLicense/MDMS v2 Bulk Data Copy TradeType.postman_collection @@ -0,0 +1,6260 @@ +{ + "info": { + "_postman_id": "c6a56010-cb65-4bab-9514-ef85739f0d17", + "name": "MDMS v2 Bulk Data Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Any other manufacturing or store house or plane of business not specified elsewhere form offersive or unwholees smell noise or smoke arise\",", + " \"code\": \"GOODS.MANUFACTURE.TST-1\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Atta Chakki\",", + " \"code\": \"GOODS.MANUFACTURE.TST-2\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bitumen\",", + " \"code\": \"GOODS.MANUFACTURE.TST-10\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Blacksmith\",", + " \"code\": \"GOODS.MANUFACTURE.TST-11\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Brick Field Brick Kiln\",", + " \"code\": \"GOODS.MANUFACTURE.TST-12\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bricks or tiles by hand power\",", + " \"code\": \"GOODS.MANUFACTURE.TST-13\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bricks or tiles by mechanical power\",", + " \"code\": \"GOODS.MANUFACTURE.TST-14\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Charcoal Kiln\",", + " \"code\": \"GOODS.MANUFACTURE.TST-15\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Coaching centers\",", + " \"code\": \"GOODS.MANUFACTURE.TST-16\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Coppersmithy\",", + " \"code\": \"GOODS.MANUFACTURE.TST-17\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Desi Sharab\",", + " \"code\": \"GOODS.MANUFACTURE.TST-18\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dyeing Printing and Bleaching of Cloth Yarn Leather\",", + " \"code\": \"GOODS.MANUFACTURE.TST-19\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Electroplating\",", + " \"code\": \"GOODS.MANUFACTURE.TST-20\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Flour Mills\",", + " \"code\": \"GOODS.MANUFACTURE.TST-21\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Ghee\",", + " \"code\": \"GOODS.MANUFACTURE.TST-22\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Glass Bevelling ,Cutting ,Polishing\",", + " \"code\": \"GOODS.MANUFACTURE.TST-23\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Goldsmith,Sliver smith\",", + " \"code\": \"GOODS.MANUFACTURE.TST-24\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Grinding Edibles by Mechanical Process\",", + " \"code\": \"GOODS.MANUFACTURE.TST-25\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hemp\",", + " \"code\": \"GOODS.MANUFACTURE.TST-26\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Insecticide or disinfectents\",", + " \"code\": \"GOODS.MANUFACTURE.TST-27\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Jewelers\",", + " \"code\": \"GOODS.MANUFACTURE.TST-28\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bone meat and Bone powder\",", + " \"code\": \"GOODS.RETAIL.TST-29\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fish meat and churby\",", + " \"code\": \"GOODS.RETAIL.TST-30\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Building material construction building on hire\",", + " \"code\": \"GOODS.RETAIL.TST-31\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Item made with cement\",", + " \"code\": \"GOODS.RETAIL.TST-32\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"mentholated and denture spirit\",", + " \"code\": \"GOODS.RETAIL.TST-33\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Biri leaves\",", + " \"code\": \"GOODS.RETAIL.TST-34\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fuel wood coke and hard coke katch kola\",", + " \"code\": \"GOODS.RETAIL.TST-35\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"teak wood other than fuel wood\",", + " \"code\": \"GOODS.RETAIL.TST-36\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"coal\",", + " \"code\": \"GOODS.RETAIL.TST-37\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fuel wood\",", + " \"code\": \"GOODS.RETAIL.TST-38\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"A store for less than gross match up to 20\",", + " \"code\": \"GOODS.RETAIL.TST-39\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cement\",", + " \"code\": \"GOODS.RETAIL.TST-40\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cloth containing nylon terelene synthetic yarn Terri wool woolen\",", + " \"code\": \"GOODS.RETAIL.TST-41\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Druggist Mats and Coconut fibers\",", + " \"code\": \"GOODS.RETAIL.TST-42\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"rubber tires vehicle\",", + " \"code\": \"GOODS.RETAIL.TST-43\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Medicine and drugs\",", + " \"code\": \"GOODS.RETAIL.TST-44\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"optical Surgical goods\",", + " \"code\": \"GOODS.RETAIL.TST-45\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"machinery goods, Vbelts\",", + " \"code\": \"GOODS.RETAIL.TST-46\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"sanitary fitting \",", + " \"code\": \"GOODS.RETAIL.TST-47\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Karyana and Desi medicine\",", + " \"code\": \"GOODS.RETAIL.TST-48\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"two wheelers\",", + " \"code\": \"GOODS.RETAIL.TST-49\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"four wheelers\",", + " \"code\": \"GOODS.RETAIL.TST-50\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Panja, Kassi\",", + " \"code\": \"GOODS.RETAIL.TST-51\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"LPG Gas Cylinder and other Gas cylinder\",", + " \"code\": \"GOODS.RETAIL.TST-52\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"transformer\",", + " \"code\": \"GOODS.RETAIL.TST-53\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Muniyari General store\",", + " \"code\": \"GOODS.RETAIL.TST-54\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Watch showroom and shops\",", + " \"code\": \"GOODS.RETAIL.TST-55\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dynamite Carbonate\",", + " \"code\": \"GOODS.RETAIL.TST-56\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Nitro mixure, Sulpher Phosphors\",", + " \"code\": \"GOODS.RETAIL.TST-57\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Rags\",", + " \"code\": \"GOODS.RETAIL.TST-58\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"new By cycles and spare parts\",", + " \"code\": \"GOODS.RETAIL.TST-59\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Lottery stall and shop\",", + " \"code\": \"GOODS.RETAIL.TST-60\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Temporary stall any item\",", + " \"code\": \"GOODS.RETAIL.TST-61\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Any exhibition in Marriage palace Dharamshala,Hotel,Open place for promotion purpose\",", + " \"code\": \"GOODS.RETAIL.TST-62\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cylinder and other than LPG cylinder\",", + " \"code\": \"GOODS.RETAIL.TST-63\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"LPG Gas\",", + " \"code\": \"GOODS.RETAIL.TST-64\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"hoof horns\",", + " \"code\": \"GOODS.RETAIL.TST-65\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"raw wool and raw cotton\",", + " \"code\": \"GOODS.RETAIL.TST-66\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"skin\",", + " \"code\": \"GOODS.RETAIL.TST-67\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"yarn other than waste yarn\",", + " \"code\": \"GOODS.RETAIL.TST-68\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Skin and tallow\",", + " \"code\": \"GOODS.RETAIL.TST-69\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Camper\",", + " \"code\": \"GOODS.RETAIL.TST-70\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Resin dinner batter otherwise known as real\",", + " \"code\": \"GOODS.RETAIL.TST-71\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Kemp\",", + " \"code\": \"GOODS.RETAIL.TST-72\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"straw\",", + " \"code\": \"GOODS.RETAIL.TST-73\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Nytromixer, sulpher ,phosphorus blasting powder\",", + " \"code\": \"GOODS.RETAIL.TST-74\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"bamboos\",", + " \"code\": \"GOODS.RETAIL.TST-75\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"dry Leaves and articles made thereof Boedi Leaves\",", + " \"code\": \"GOODS.RETAIL.TST-76\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"English wine and Beer Bar\",", + " \"code\": \"GOODS.RETAIL.TST-77\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"All kinds Hosiery Machines run by Electric Motors and oil Engines\",", + " \"code\": \"GOODS.RETAIL.TST-78\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Groceries and items domestic\",", + " \"code\": \"GOODS.RETAIL.TST-79\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Furniture\",", + " \"code\": \"GOODS.RETAIL.TST-80\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cattle Feed\",", + " \"code\": \"GOODS.RETAIL.TST-81\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Fireworks\",", + " \"code\": \"GOODS.RETAIL.TST-82\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Store for unslacked lime\",", + " \"code\": \"GOODS.RETAIL.TST-83\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hydrogenated oil sugar\",", + " \"code\": \"GOODS.RETAIL.TST-84\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Matchboxes\",", + " \"code\": \"GOODS.RETAIL.TST-85\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Fireworks\",", + " \"code\": \"GOODS.RETAIL.TST-86\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"tor XRay films\",", + " \"code\": \"GOODS.RETAIL.TST-87\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Ahata\",", + " \"code\": \"GOODS.RETAIL.TST-88\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dessi Sharab\",", + " \"code\": \"GOODS.RETAIL.TST-89\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"plywood modeling, mica and glass\",", + " \"code\": \"GOODS.RETAIL.TST-90\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hosiery Goods\",", + " \"code\": \"GOODS.RETAIL.TST-91\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bardana Store\",", + " \"code\": \"GOODS.RETAIL.TST-92\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Celluloid Plastic goods\",", + " \"code\": \"GOODS.RETAIL.TST-93\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"tor tar coal and Bitumen\",", + " \"code\": \"GOODS.RETAIL.TST-94\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"mobile, computer\",", + " \"code\": \"GOODS.RETAIL.TST-95\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"vegetable oil and hydrogenated oil shops\",", + " \"code\": \"GOODS.RETAIL.TST-96\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"electronic goods \",", + " \"code\": \"GOODS.RETAIL.TST-97\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"paper and goods made including books and magazines\",", + " \"code\": \"GOODS.RETAIL.TST-98\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Silk Cloths and Art Silk\",", + " \"code\": \"GOODS.RETAIL.TST-99\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"gun powder and cartridges\",", + " \"code\": \"GOODS.RETAIL.TST-100\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Plywood, Mica\",", + " \"code\": \"GOODS.RETAIL.TST-101\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Candle, Dhoop, Aggarwatti\",", + " \"code\": \"GOODS.RETAIL.TST-102\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dynamo, Batteries and spare parts thereof\",", + " \"code\": \"GOODS.RETAIL.TST-103\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Vartan, Crockery and Gift house\",", + " \"code\": \"GOODS.RETAIL.TST-104\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hessian Cloth Jute and goods made thereof, Packing stuff\",", + " \"code\": \"GOODS.RETAIL.TST-105\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Gold and Silver jewelries, Goldsmith\",", + " \"code\": \"GOODS.RETAIL.TST-106\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"flowers\",", + " \"code\": \"GOODS.RETAIL.TST-107\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Grass, Chara, Bhusa, Kay Powder and Turri\",", + " \"code\": \"GOODS.RETAIL.TST-108\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Oil seeds, fodder, Seeds and Cotton seeds\",", + " \"code\": \"GOODS.RETAIL.TST-109\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Leather goods Leather foam Rexon and articles\",", + " \"code\": \"GOODS.RETAIL.TST-110\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Tyre ,Tube\",", + " \"code\": \"GOODS.RETAIL.TST-111\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Insecticides, Patricides and Fertilizers\",", + " \"code\": \"GOODS.RETAIL.TST-112\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Sirki, Bann, Khazoor, Patta, Munj, Ropes and Nylon Ropes\",", + " \"code\": \"GOODS.RETAIL.TST-113\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"marble, cutting, grinding dressing polishing\",", + " \"code\": \"GOODS.RETAIL.TST-114\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Video Cassettes\",", + " \"code\": \"GOODS.RETAIL.TST-115\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"photographic films\",", + " \"code\": \"GOODS.RETAIL.TST-116\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Audio cassettes\",", + " \"code\": \"GOODS.RETAIL.TST-117\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Electric goods\",", + " \"code\": \"GOODS.RETAIL.TST-118\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Tobacco, Zarda\",", + " \"code\": \"GOODS.RETAIL.TST-221\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Leather goods Leather foam Rexon and articles\",", + " \"code\": \"GOODS.RETAIL.TST-222\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Vegetable oil and hydrogenated oil\",", + " \"code\": \"GOODS.RETAIL.TST-223\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cloth containing nylon terelene synthetic yarn Terri wool woolen\",", + " \"code\": \"GOODS.RETAIL.TST-224\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"paints turpentine all kinds spirits colours varnish thinner oil their trading\",", + " \"code\": \"GOODS.WHOLESALE.TST-119\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"For working power looms\",", + " \"code\": \"GOODS.WHOLESALE.TST-120\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"mentholated and denture spirit\",", + " \"code\": \"GOODS.WHOLESALE.TST-121\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Kerosene oil, Mobil oil crude oil grease and all kinds lubricant oil\",", + " \"code\": \"GOODS.WHOLESALE.TST-122\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"plywood modeling mica and glass\",", + " \"code\": \"GOODS.WHOLESALE.TST-123\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fuel wood coke and hard coke katch kola\",", + " \"code\": \"GOODS.WHOLESALE.TST-124\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"teak wood other than fuel wood\",", + " \"code\": \"GOODS.WHOLESALE.TST-125\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"coal\",", + " \"code\": \"GOODS.WHOLESALE.TST-126\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fuel wood\",", + " \"code\": \"GOODS.WHOLESALE.TST-127\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cement\",", + " \"code\": \"GOODS.WHOLESALE.TST-128\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Bardana Store\",", + " \"code\": \"GOODS.WHOLESALE.TST-129\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Celluloid Plastic goods\",", + " \"code\": \"GOODS.WHOLESALE.TST-130\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"tor tar coal and Bitumen\",", + " \"code\": \"GOODS.WHOLESALE.TST-131\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"mobile computer\",", + " \"code\": \"GOODS.WHOLESALE.TST-132\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"sanitary fitting including GI CI Pipes SW Pipes AC Pipes Cement Pipes\",", + " \"code\": \"GOODS.WHOLESALE.TST-133\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Beer Bar\",", + " \"code\": \"GOODS.WHOLESALE.TST-134\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"English Wine and Beer Wholesale\",", + " \"code\": \"GOODS.WHOLESALE.TST-135\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"electronic goods and spare\",", + " \"code\": \"GOODS.WHOLESALE.TST-136\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"paper and goods made thereof including books and magazines\",", + " \"code\": \"GOODS.WHOLESALE.TST-137\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Silk Cloths and Art Silk\",", + " \"code\": \"GOODS.WHOLESALE.TST-138\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"gun powder and cartridges\",", + " \"code\": \"GOODS.WHOLESALE.TST-139\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Beer Bar\",", + " \"code\": \"GOODS.WHOLESALE.TST-140\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"English Wine and Beer Wholesale\",", + " \"code\": \"GOODS.WHOLESALE.TST-141\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Candle Dhoop Aggarwatti\",", + " \"code\": \"GOODS.WHOLESALE.TST-142\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"waste paper bags\",", + " \"code\": \"GOODS.WHOLESALE.TST-143\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"LPG Gas Cylinder and other Gas cylinder\",", + " \"code\": \"GOODS.WHOLESALE.TST-144\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dynamo Batteries\",", + " \"code\": \"GOODS.WHOLESALE.TST-145\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"transformer\",", + " \"code\": \"GOODS.WHOLESALE.TST-146\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Vartan Crockery and Gift house\",", + " \"code\": \"GOODS.WHOLESALE.TST-147\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hessian Cloth Jute and goods made thereof Packing stuff\",", + " \"code\": \"GOODS.WHOLESALE.TST-148\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Petrol Diesel \",", + " \"code\": \"GOODS.WHOLESALE.TST-149\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Gold and Silver jewelries Goldsmith\",", + " \"code\": \"GOODS.WHOLESALE.TST-150\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"flowers\",", + " \"code\": \"GOODS.WHOLESALE.TST-151\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Grass Chara Bhusa Kay Powder and Turri\",", + " \"code\": \"GOODS.WHOLESALE.TST-152\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Oil seeds fodder Seeds and Cotton seeds\",", + " \"code\": \"GOODS.WHOLESALE.TST-153\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cylinder and other than LPG cylinder\",", + " \"code\": \"GOODS.WHOLESALE.TST-154\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Leather goods Leather foam Rexon and articles\",", + " \"code\": \"GOODS.WHOLESALE.TST-155\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"TyreTube\",", + " \"code\": \"GOODS.WHOLESALE.TST-156\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"shuttering and pad materials for hire purposes\",", + " \"code\": \"GOODS.WHOLESALE.TST-157\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cotton in pressed bales\",", + " \"code\": \"GOODS.WHOLESALE.TST-158\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cloth in pressed bales\",", + " \"code\": \"GOODS.WHOLESALE.TST-159\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"raw wool and raw cotton\",", + " \"code\": \"GOODS.WHOLESALE.TST-160\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"yarn other than waste yarn\",", + " \"code\": \"GOODS.WHOLESALE.TST-161\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Insecticides Patricides and Fertilizers\",", + " \"code\": \"GOODS.WHOLESALE.TST-162\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Sirki Bann Khazoor Patta Munj Ropes and Nylon Ropes\",", + " \"code\": \"GOODS.WHOLESALE.TST-163\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"cold store\",", + " \"code\": \"GOODS.WHOLESALE.TST-164\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"marble cutting grinding dressing polishing\",", + " \"code\": \"GOODS.WHOLESALE.TST-165\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Any other store house place business not specified elsewhere\",", + " \"code\": \"GOODS.WHOLESALE.TST-166\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Video Cassettes\",", + " \"code\": \"GOODS.WHOLESALE.TST-167\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"photographic films\",", + " \"code\": \"GOODS.WHOLESALE.TST-168\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Audio cassettes\",", + " \"code\": \"GOODS.WHOLESALE.TST-169\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Electric goods\",", + " \"code\": \"GOODS.WHOLESALE.TST-170\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cattle Feed\",", + " \"code\": \"GOODS.WHOLESALE.TST-171\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fireworks\",", + " \"code\": \"GOODS.WHOLESALE.TST-172\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Any other store house not specified elsewhere from which offensive unwholesome smell noise smoke\",", + " \"code\": \"GOODS.WHOLESALE.TST-173\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Kerosene oil Whole\",", + " \"code\": \"GOODS.WHOLESALE.TST-174\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hydrogenated oil sugars\",", + " \"code\": \"GOODS.WHOLESALE.TST-175\",", + " \"uom\": \"GALLONS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Non Dangerous Petroleum Product\",", + " \"code\": \"GOODS.WHOLESALE.TST-176\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Non Dangerous Petroleum Product\",", + " \"code\": \"GOODS.WHOLESALE.TST-177\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"fireworks\",", + " \"code\": \"GOODS.WHOLESALE.TST-178\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"carton\",", + " \"code\": \"GOODS.WHOLESALE.TST-179\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"English wine\",", + " \"code\": \"GOODS.WHOLESALE.TST-180\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dessi Sharab\",", + " \"code\": \"GOODS.WHOLESALE.TST-181\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hosiery Goods\",", + " \"code\": \"GOODS.WHOLESALE.TST-182\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Atta Chakki\",", + " \"code\": \"SERVICES.GBS.TST-183\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Printing Press\",", + " \"code\": \"SERVICES.GBS.TST-184\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Tent House\",", + " \"code\": \"SERVICES.GBS.TST-185\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cinema films\",", + " \"code\": \"SERVICES.GBS.TST-186\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Aluminium door fitting fabrivations\",", + " \"code\": \"SERVICES.GBS.TST-187\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cable operator\",", + " \"code\": \"SERVICES.GBS.TST-188\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cinema Hall\",", + " \"code\": \"SERVICES.GBS.TST-189\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Circuses, fair magic show\",", + " \"code\": \"SERVICES.GBS.TST-190\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dhabha\",", + " \"code\": \"SERVICES.GBS.TST-191\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Diesel engine services\",", + " \"code\": \"SERVICES.GBS.TST-192\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Dry cleaning\",", + " \"code\": \"SERVICES.GBS.TST-193\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Hotel,Restaurant\",", + " \"code\": \"SERVICES.GBS.TST-194\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"junk dealer\",", + " \"code\": \"SERVICES.GBS.TST-195\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"motel\",", + " \"code\": \"SERVICES.GBS.TST-196\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Nursing home private hospital ultra sound ,CT scan centers\",", + " \"code\": \"SERVICES.GBS.TST-197\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Public Model School\",", + " \"code\": \"SERVICES.GBS.TST-198\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Service Station, Workshop\",", + " \"code\": \"SERVICES.GBS.TST-199\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Testing Lab\",", + " \"code\": \"SERVICES.GBS.TST-200\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Watch repair\",", + " \"code\": \"SERVICES.GBS.TST-201\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Welding set\",", + " \"code\": \"SERVICES.GBS.TST-202\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"All Dhaba, Tea shop and Halwai shop\",", + " \"code\": \"SERVICES.NGBS.TST-203\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"All Hotels, Restaurant,Beer,Bar\",", + " \"code\": \"SERVICES.NGBS.TST-204\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Barbers Shop\",", + " \"code\": \"SERVICES.NGBS.TST-205\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Beauty Parlour\",", + " \"code\": \"SERVICES.NGBS.TST-206\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Cinema Circus\",", + " \"code\": \"SERVICES.NGBS.TST-207\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Computer coaching,training coaching center and cyber cafe\",", + " \"code\": \"SERVICES.NGBS.TST-208\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"gym fitness center\",", + " \"code\": \"SERVICES.NGBS.TST-209\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Laundry Shop\",", + " \"code\": \"SERVICES.NGBS.TST-210\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Marriage Palaces\",", + " \"code\": \"SERVICES.NGBS.TST-211\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\": \"Nursing Homes, Private Hospital, Ultra Sound, CT Scan Centre\",", + " \"code\": \"SERVICES.NGBS.TST-212\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Painter, Flex printing, printing press Screen printing\",", + " \"code\": \"SERVICES.NGBS.TST-213\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Poultry Forms\",", + " \"code\": \"SERVICES.NGBS.TST-214\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Printing press\",", + " \"code\": \"SERVICES.NGBS.TST-215\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"property dealer\",", + " \"code\": \"SERVICES.NGBS.TST-216\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"shop tailoring running with electronic instrument\",", + " \"code\": \"SERVICES.NGBS.TST-217\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Transport and Booking Agency\",", + " \"code\": \"SERVICES.NGBS.TST-218\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"name\":\"Workshop\",", + " \"code\": \"SERVICES.NGBS.TST-219\",", + " \"uom\": \"GROSSUNITS\",", + " \"applicationDocument\": [", + " {", + " \"applicationType\": \"NEW\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\"", + " ]", + " },", + " {", + " \"applicationType\": \"RENEWAL\",", + " \"documentList\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"OWNERPHOTO\",", + " \"OLDLICENCENO\"", + " ]", + " }", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"TL\",", + " \"validityPeriod\": null", + " },", + " {", + " \"code\": \"ARCHITECT.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5", + " },", + " {", + " \"code\": \"BUILDER.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5", + " },", + " {", + " \"code\": \"ENGINEER.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5,", + " \"restrictions\":{", + " \"maxPlotArea\":500,", + " \"maxBulidingheight\":15,", + " \"maxFloors\":3", + " }", + " },", + " {", + " \"code\": \"STRUCTURALENGINEER.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5", + " },", + " {", + " \"code\": \"TOWNPLANNER.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5", + " },", + " {", + " \"code\": \"SUPERVISOR.CLASSA\",", + " \"uom\": null,", + " \"applicationDocument\": [", + " \"OWNERIDPROOF\",", + " \"OWNERSHIPPROOF\",", + " \"EXPERIENCEPROOF\"", + " ],", + " \"verificationDocument\": [],", + " \"active\": true,", + " \"type\": \"BPA\",", + " \"validityPeriod\": 5,", + " \"restrictions\":{", + " \"maxPlotArea\":100,", + " \"maxBulidingheight\":10,", + " \"maxFloors\":2", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"TradeLicense.TradeType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/TradeLicense.TradeType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "TradeLicense.TradeType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CancelReceiptReason.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CancelReceiptReason.postman_collection new file mode 100644 index 00000000000..c3fb303d16c --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CancelReceiptReason.postman_collection @@ -0,0 +1,136 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"ERRORRECEIPT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"CHEQUEBOUNCE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OTHER\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.CancelReceiptReason\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.CancelReceiptReason", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.CancelReceiptReason" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CommonInboxConfig.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CommonInboxConfig.postman_collection new file mode 100644 index 00000000000..0ca70a648b3 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CommonInboxConfig.postman_collection @@ -0,0 +1,296 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"moduleName\": \"PT\",", + " \"BusinessService\": \"PT.CREATE\",", + " \"roles\": [\"PT_CEMP\", \"PT_DOC_VERIFIER\",\"PT_FIELD_INSPECTOR\",\"PT_APPROVER\"],", + " \"active\": false,", + " \"locality\":false,", + " \"localityModule\":\"property-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/property-tax/application-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&type=property\",", + " \"DEFAULT\": \"/employee/property-tax/application-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&type=property\"", + " }", + " },", + " {", + " \"moduleName\": \"TL\",", + " \"BusinessService\": \"NewTL\",", + " \"roles\": [\"TL_CEMP\", \"TL_DOC_VERIFIER\",\"TL_APPROVER\",\"TL_FIELD_INSPECTOR\"],", + " \"active\": false,", + " \"locality\":false,", + " \"localityModule\":\"tl-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/tradelicence/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/tradelicence/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },", + " {", + " \"moduleName\": \"PT\",", + " \"BusinessService\": \"PT.UPDATE\",", + " \"roles\": [\"PT_CEMP\", \"PT_DOC_VERIFIER\",\"PT_FIELD_INSPECTOR\",\"PT_APPROVER\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"property-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/property-tax/application-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&type=updateProperty\",", + " \"DEFAULT\": \"/employee/property-tax/application-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&type=updateProperty\"", + " }", + " },", + " {", + " \"moduleName\": \"PT\",", + " \"BusinessService\": \"PT.MUTATION\",", + " \"roles\": [\"PT_CEMP\", \"PT_DOC_VERIFIER\",\"PT_FIELD_INSPECTOR\",\"PT_APPROVER\"],", + " \"active\": false,", + " \"locality\":false,", + " \"localityModule\":\"property-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/pt-mutation/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/pt-mutation/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },", + " {", + " \"moduleName\": \"TL\",", + " \"BusinessService\": \"DIRECTRENEWAL\",", + " \"roles\": [\"TL_CEMP\", \"TL_DOC_VERIFIER\",\"TL_APPROVER\",\"TL_FIELD_INSPECTOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"tl-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/tradelicence/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/tradelicence/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },", + " {", + " \"moduleName\": \"TL\",", + " \"BusinessService\": \"EDITRENEWAL\",", + " \"roles\": [\"TL_CEMP\", \"TL_DOC_VERIFIER\",\"TL_APPROVER\",\"TL_FIELD_INSPECTOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"tl-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/tradelicence/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/tradelicence/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },", + " {", + " \"moduleName\": \"FireNoc\",", + " \"BusinessService\": \"FIRENOC\",", + " \"roles\": [\"NOC_CEMP\", \"NOC_DOC_VERIFIER\",\"NOC_FIELD_INSPECTOR\",\"FIRE_NOC_APPROVER\",\"NOC_APPROVER\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"fireNoc\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/fire-noc/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/fire-noc/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },{", + " \"moduleName\": \"BPA\",", + " \"BusinessService\": \"BPA\",", + " \"roles\": [\"BPA_ARCHITECT\", \"BPA_ENGINEER\",\"BPA_BUILDER\",\"BPA_STRUCTURALENGINEER\",\"BPA_TOWNPLANNER\",\"BPA_SUPERVISOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"bpa-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/egov-bpa/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/egov-bpa/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },{", + " \"moduleName\": \"BPA\",", + " \"BusinessService\": \"BPA_OC\",", + " \"roles\": [\"BPA_ARCHITECT\", \"BPA_ENGINEER\",\"BPA_BUILDER\",\"BPA_STRUCTURALENGINEER\",\"BPA_TOWNPLANNER\",\"BPA_SUPERVISOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"bpa-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/oc-bpa/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/oc-bpa/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },{", + " \"moduleName\": \"BPA\",", + " \"BusinessService\": \"NOC-SERVICES\",", + " \"roles\": [\"NOC_CEMP\", \"NOC_DOC_VERIFIER\",\"NOC_FIELD_INSPECTOR\",\"FIRE_NOC_APPROVER\",\"NOC_APPROVER\"],", + " \"active\": false,", + " \"locality\":false,", + " \"localityModule\":\"noc-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/noc/apply?applicationNumber=^WFBID^&tenantId=^WFTNID^\",", + " \"DEFAULT\": \"/employee/noc/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^\"", + " }", + " },{", + " \"moduleName\": \"WNS\",", + " \"BusinessService\": \"NewWS1\",", + " \"roles\": [\"WS_CEMP\", \"WS_DOC_VERIFIER\",\"WS_FIELD_INSPECTOR\",\"WS_APPROVER\",\"WS_CLERK\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"ws-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=WATER\",", + " \"DEFAULT\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=WATER\"", + " }", + " },{", + " \"moduleName\": \"WNS\",", + " \"BusinessService\": \"NewSW1\",", + " \"roles\": [\"SW_CEMP\", \"SW_DOC_VERIFIER\",\"SW_FIELD_INSPECTOR\",\"SW_APPROVER\",\"SW_CLERK\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"sw-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=SEWERAGE\",", + " \"DEFAULT\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=SEWERAGE\"", + " }", + " },{", + " \"moduleName\": \"WNS\",", + " \"BusinessService\": \"ModifyWSConnection\",", + " \"roles\": [\"WS_CEMP\",\"WS_APPROVER\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"ws-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=WATER&mode=MODIFY\",", + " \"DEFAULT\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=WATER&mode=MODIFY\"", + " }", + " },{", + " \"moduleName\": \"WNS\",", + " \"BusinessService\": \"ModifySWConnection\",", + " \"roles\":[\"SW_CEMP\",\"SW_APPROVER\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"sw-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=SEWERAGE&mode=MODIFY\",", + " \"DEFAULT\": \"/employee/wns/search-preview?applicationNumber=^WFBID^&tenantId=^WFTNID^&history=true&service=SEWERAGE&mode=MODIFY\"", + " }", + " },{", + " \"moduleName\": \"PGR\",", + " \"BusinessService\": \"PGR\",", + " \"roles\":[\"GRO\",\"DGRO\",\"PGR_LME\",\"SUPERVISOR\"],", + " \"active\": true,", + " \"locality\":true,", + " \"localityModule\":\"pgr-services\",", + " \"redirectConfig\": {", + " \"INITIATED\": \"/digit-ui/employee/pgr/complaint/details/^WFBID^\",", + " \"DEFAULT\":\"/digit-ui/employee/pgr/complaint/details/^WFBID^\"", + " }", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.CommonInboxConfig\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.CommonInboxConfig", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.CommonInboxConfig" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CronJobAPIConfig.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CronJobAPIConfig.postman_collection new file mode 100644 index 00000000000..b38f644adc5 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data CronJobAPIConfig.postman_collection @@ -0,0 +1,196 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"true\",", + " \"method\": \"POST\",", + " \"url\": \"http://tl-services.egov:8080/tl-services/v1/TL/Expiry/_batch\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"false\",", + " \"method\": \"POST\",", + " \"url\": \"http://tl-services.egov:8080/tl-services/v1/TL/Reminder/_batch\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"false\",", + " \"method\": \"POST\",", + " \"url\": \"http://ws-calculator.egov:8080/ws-calculator/waterCalculator/_jobscheduler\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"false\",", + " \"method\": \"POST\",", + " \"url\": \"http://sw-calculator.egov:8080/sw-calculator/sewerageCalculator/_jobscheduler\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " {", + " \"jobName\": \"daily\",", + " \"active\": \"false\",", + " \"method\": \"POST\",", + " \"url\": \"http://xstate-chatbot.egov:8080/xstate-chatbot/reminder\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + " },", + " \t {", + " \"jobName\": \"daily\",", + " \"active\": \"true\",", + " \"method\": \"POST\",", + " \"url\": \"http://fsm.egov:8080/fsm/v1/_schedular\",", + " \"payload\": {", + " \"RequestInfo\": \"{DEFAULT_REQUESTINFO}\"", + " },", + " \"header\": {", + " \"Content-Type\": \"application/json\"", + " }", + "\t }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.CronJobAPIConfig\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.CronJobAPIConfig", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.CronJobAPIConfig" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Department.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Department.postman_collection new file mode 100644 index 00000000000..dbdaf8d960a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Department.postman_collection @@ -0,0 +1,189 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Street Lights\",", + " \"code\": \"DEPT_1\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Building & Roads\",", + " \"code\": \"DEPT_2\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Health & Sanitation\",", + " \"code\": \"DEPT_3\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Operation & Maintenance\",", + " \"code\": \"DEPT_4\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Horticulture\",", + " \"code\": \"DEPT_5\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Building Branch\",", + " \"code\": \"DEPT_6\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Citizen service desk\",", + " \"code\": \"DEPT_7\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Complaint Cell\",", + " \"code\": \"DEPT_8\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Executive Branch\",", + " \"code\": \"DEPT_9\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Others\",", + " \"code\": \"DEPT_10\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Tax Branch\",", + " \"code\": \"DEPT_13\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Accounts Branch\",", + " \"code\": \"DEPT_25\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Works Branch\",", + " \"code\": \"DEPT_35\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.Department\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.Department", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.Department" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Designation.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Designation.postman_collection new file mode 100644 index 00000000000..ee48f92d462 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data Designation.postman_collection @@ -0,0 +1,298 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"DESIG_01\",", + " \"name\": \"Superintending Engineer ( B&R)\",", + " \"description\": \"Superintending Engineer ( B&R)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_02\",", + " \"name\": \"Corporation Engineer (B&R)\",", + " \"description\": \"Corporation Engineer (B&R)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_03\",", + " \"name\": \"Asst. Engineer ( B&R)\",", + " \"description\": \"Asst. Engineer ( B&R)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_04\",", + " \"name\": \"Junior Engineer ( B&R)\",", + " \"description\": \"Junior Engineer ( B&R)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_05\",", + " \"name\": \"Land Scape Officer\",", + " \"description\": \"Land Scape Officer\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_06\",", + " \"name\": \"Superintending Engineer ( O&M)\",", + " \"description\": \"Superintending Engineer ( O&M)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_07\",", + " \"name\": \"Corporation Engineer (O&M)\",", + " \"description\": \"Corporation Engineer (O&M)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_08\",", + " \"name\": \"Asst. Engineer ( O&M)\",", + " \"description\": \"Asst. Engineer ( O&M)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_09\",", + " \"name\": \"Junior Engineer ( O&M)\",", + " \"description\": \"Junior Engineer ( O&M)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_10\",", + " \"name\": \"Superintending Engineer ( Light)\",", + " \"description\": \"Superintending Engineer ( Light)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_11\",", + " \"name\": \"Corporation Engineer (Light)\",", + " \"description\": \"Corporation Engineer (Light)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_12\",", + " \"name\": \"Junior Engineer ( Light)\",", + " \"description\": \"Junior Engineer ( Light)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_13\",", + " \"name\": \"Health Officer\",", + " \"description\": \"Health Officer\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_14\",", + " \"name\": \"Medical Officer\",", + " \"description\": \"Medical Officer\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_15\",", + " \"name\": \"Chief Sanitary Inspector\",", + " \"description\": \"Mechanical Oversear\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_16\",", + " \"name\": \"Sainitary Inspector\",", + " \"description\": \"Clerk\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_17\",", + " \"name\": \"Sainitary Supervisor\",", + " \"description\": \"Accountant\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_18\",", + " \"name\": \"Senior Town Planner\",", + " \"description\": \"Senior Town Planner\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_19\",", + " \"name\": \"Municipal Town Planner\",", + " \"description\": \"Municipal Town Planner\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_20\",", + " \"name\": \"Asst. Town Planner\",", + " \"description\": \"Asst. Town Planner\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_21\",", + " \"name\": \"Building Inspector\",", + " \"description\": \"Building Inspector\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_22\",", + " \"name\": \"Junior Enginer ( Horticulutre)\",", + " \"description\": \"Junior Enginer ( Horticulutre)\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_23\",", + " \"name\": \"Citizen service representative\",", + " \"description\": \"Citizen service representative\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Deputy Controller Finance and Accounts\",", + " \"description\": \"Deputy Controller Finance and Accounts\",", + " \"code\": \"DESIG_1001\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Accountant\",", + " \"description\": \"Accountant\",", + " \"code\": \"DESIG_58\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DESIG_24\",", + " \"name\": \"Assistant Commissioner\",", + " \"description\": \"Assistant Commissioner\",", + " \"active\": true", + " }, ", + " {", + " \"name\": \"Superintendent\",", + " \"description\": \"Superintendent\",", + " \"code\": \"DESIG_47\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Accounts Officer\",", + " \"description\": \"Accounts Officer\",", + " \"code\": \"AO\",", + " \"active\": true", + " },", + " {", + " \"name\": \"Commissioner\",", + " \"description\": \"Commissioner\",", + " \"code\": \"COMM\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.Designation\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.Designation", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.Designation" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data DocumentType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data DocumentType.postman_collection new file mode 100644 index 00000000000..f9e387ba047 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data DocumentType.postman_collection @@ -0,0 +1,287 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"APPL.IDENTITYPROOF.AADHAAR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.IDENTITYPROOF.PASSPORT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.IDENTITYPROOF.DRIVINGLICENSE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.ADDRESSPROOF.ELECTRICITYBILL\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.ADDRESSPROOF.PASSPORT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.LTR.LTR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.TDP.TDP\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.LAC.LAC\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.SSC.SSC\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.LSVS.LSVS\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.SITP.SITP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.RP.RP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.FP.FP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.SCP.SCP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.EP.EP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.SECP.SECP\",", + " \"active\": true", + " },{", + " \"code\": \"BPD.PP.PP\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NOC.FIRE.CERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NOC.AGRICULTURE.LANDUSE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NOC.AGRICULTURE_WATERBODY.FTL\",", + " \"active\": true", + " },{", + " \"code\": \"FI.FIR.FIR\",", + " \"active\": true", + " },", + " {", + " \"code\": \"FI.SINS.SINS\",", + " \"active\": true", + " },{", + " \"code\": \"FI.SISS.SISS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"FI.SIES.SIES\",", + " \"active\": true", + " },{", + " \"code\": \"FI.SIWS.SIWS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NOC.AIRPORT.CERTIFICATE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.BUILDING_DIAGRAM.SECTION_PLAN\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.BUILDING_DIAGRAM.ELEVATION_PLAN\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.BUILDING_DIAGRAM.FLOOR_PLAN\",", + " \"active\": true", + " },{", + " \"code\": \"APPL.LOCALBODY.MUNCIPAL_APPROVAL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.LOCALBODY.PANCHAYAT_APPROVAL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"APPL.LOCALBODY.DTCP_APPROVAL\",", + " \"active\": true", + " },", + " {", + " \"code\" : \"OWNERIDPROOF\",", + " \"allowedFormat\" : [\"image/*\", \".pdf\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 6000", + " },", + " {", + " \"code\" : \"OWNERSHIPPROOF\",", + " \"allowedFormat\" : [\"image/*\", \".pdf\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 6000", + " },", + " {", + " \"code\" : \"OWNERPHOTO\",", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\" : \"OLDLICENCENO\",", + " \"allowedFormat\" : [\"image/*\", \".pdf\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 6000", + " },", + " {", + " \"code\": \"COURTORDER\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\": \"SELFDECLARATION\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\": \"GOVTNOTIFICATION\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\": \"OFFICENOTEORDER\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " },", + " {", + " \"code\": \"GOVTNOTIFICATION\",", + " \"active\": true,", + " \"allowedFormat\" : [\"image/*\", \".png\", \".jpeg\"],", + " \"maxFileSize\": 3000", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.DocumentType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.DocumentType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.DocumentType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data GenderType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data GenderType.postman_collection new file mode 100644 index 00000000000..3fe3535c4ad --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data GenderType.postman_collection @@ -0,0 +1,139 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"MALE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"FEMALE\",", + " \"active\": true", + " },{", + " \"code\": \"TRANSGENDER\",", + " \"active\": true", + " },", + " {", + " \"code\": \"OTHERS\",", + " \"active\": false", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.GenderType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.GenderType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.GenderType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data IdFormat.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data IdFormat.postman_collection new file mode 100644 index 00000000000..d298a97389f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data IdFormat.postman_collection @@ -0,0 +1,840 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"watercharges.metered.receipt.id\"", + " },", + " {", + " \"format\": \"BILL-[SEQ_EGOV_COMMON_TEST_AUTOCRE]\",", + " \"idname\": \"billnumberid\"", + " },", + " {", + " \"format\": \"PT/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"pt.receipt.id\"", + " },", + " {", + " \"format\": \"TL/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tl.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"watercharges.nonmetered.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"firenoc.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.no_dues_certificate.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.electricity_chungi.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.hoardings.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.unipolls.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.municipal_shops_rent.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.land_rent.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.tower_rent.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.parking_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.jamin_theka.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.election_rally_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.parking_during_election.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.road_show.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.advance_provident_fund.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"st.stationary_not_income.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"st.expenditure_santitation_not_income.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.santitation_dumping_garbage.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.telecom_tower_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.electricity.code_chungi.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.draftsmen_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.compremasing_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.building_planner_renew.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.naksha_samjota_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.naksha_changes.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.license_fees_building_branch.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.naksha_renew_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.alteration_additional_charge.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.2_year_time_limit_of_renewal_building_naksha.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.leave_encashment_and_gratuty.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.plastic_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.rehri_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.challan_for_misuse_of_water.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.dengue_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.littering_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"snt.licence_pure_food.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.misc_challans.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.regularisation_of_buildings.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"wf.contractor_enlistment.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"wf.tenderformfee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tb.advertisement_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tb.tehbazaari.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.pf_transfer_(accounts).receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.ts1_copy_register_for_old_survey.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.transfer_property_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.rti.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.no_dues_certificate.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.architect_license_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tb.challan_under_section_156.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.grants_cheque.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.no_due_certificate_electriCITY.CODE.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.registery_and_bank_loan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.sbm_garbage_plastic_polythene_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"snt.dead_animals_contract.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.gpf.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.cpf_received_check.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.tower_installation.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.tower_annual_rent.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"css.cow_cess.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.cattle_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tb.rehri_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"lcf.manual_rikshaw.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.dairy_animals_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.bidi_&_cigrette_challan.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.community_centre_booking_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.commercial_use_of_municipal_land.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.street_vendor.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.construction_waste.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ftp.demolition_waste.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"snt.clean_safai_sanitation.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"om.plumber_license_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.light_wala_board.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.wall_paint_advertisement.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"om.water_connection_disconnection_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.noc_completion_of_building_approval.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.recovery_employee_contractor.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.house_tax.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.hadud_certificate_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.no_due_certificate_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.colony_sambandhi_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.naksha_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"wf.ofc_permission_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.economics_weaker_section_scheme_charges.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.economics_weaker_section_projects_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"om.sewerage_disconnection_connection_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.provident_fund_processing_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"css.labor_cess.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.others_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.water_charges.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.under_development_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.change_of_land_use_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.development_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.malba_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.boundary_wall_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.building_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"om.road_cut_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"admn.parking_booking_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.canopy_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.outdoor_media_display_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.test_munadi_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.property_tax_2013-14.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.noc_fee.receipt.id\"", + " },", + " {", + " \"format\": \"[cy:MM]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON\",", + " \"idname\": \"rev_grants.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.fire_tender_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.fire_call_report_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.fire_noc_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.bus_adda_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.rain_harvesting_charges.receipt.id\"", + " },", + " {", + " \"format\": \"PG-AC-[cy:yyyy-MM-dd]-[SEQ_EG_PT_ACK]\",", + " \"idname\": \"pt.acknowledgementnumber\"", + " },", + " {", + " \"format\": \"PG-AS-[cy:yyyy-MM-dd]-[SEQ_EG_PT_ASSM]\",", + " \"idname\": \"pt.assessmentnumber\"", + " },", + " {", + " \"format\": \"PG-PT-[CITY.CODE]-[SEQ_EG_PT_PTID]\",", + " \"idname\": \"pt.propertyid\"", + " },", + " {", + " \"format\": \"PG-BP-[cy:yyyy-MM-dd]-[SEQ_EG_BP_APN]\",", + " \"idname\": \"egov.idgen.bpa.applicationNum\"", + " },", + " {", + " \"format\": \"BR/ENG/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.englicensenumber\"", + " },", + " {", + " \"format\": \"BR/STR/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.strlicensenumber\"", + " },", + " {", + " \"format\": \"BR/TP/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.tplicensenumber\"", + " },", + " {", + " \"format\": \"BR/SUP/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.suplicensenumber\"", + " },", + " {", + " \"format\": \"BR/ARCT/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.arlicensenumber\"", + " },", + " {", + " \"format\": \"BR/BLD/[cy:yyyy]/[SEQ_EG_PT_LN]\",", + " \"idname\": \"egov.idgen.bpa.bdlicensenumber\"", + " },", + " {", + " \"format\": \"BPAREG/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpareg.receipt.id\"", + " },", + " {", + " \"format\": \"BPA/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpa.nc_app_fee.receipt.id\"", + " },", + " {", + " \"format\": \"BPA/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpa.nc_san_fee.receipt.id\"", + " },", + " {", + " \"format\": \"PG-MU-[cy:yyyy-MM-dd]-[SEQ_EG_PT_ASSM]\",", + " \"idname\": \"pt.mutation.receipt.id\"", + " },", + " {", + " \"format\": \"PG-MT-[CITY]-[SEQ_EG_PT_MUTATION]\",", + " \"idname\": \"pt.mutation.number\"", + " },", + " {", + " \"format\": \"WS/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_CON_[TENANT_ID]]\",", + " \"idname\": \"waterservice.connection.id\"", + " },", + " {", + " \"format\": \"SW/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_CON_[TENANT_ID]]\",", + " \"idname\": \"sewerageservice.connection.id\"", + " },", + " {", + " \"format\": \"WS/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_BILL_RCPT_[TENANT_ID]]\",", + " \"idname\": \"ws.receipt.id\"", + " },", + " {", + " \"format\": \"SW/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_BILL_RCPT_[TENANT_ID]]\",", + " \"idname\": \"sw.receipt.id\"", + " },", + " {", + " \"format\": \"WS_AP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_APP_[TENANT_ID]]\",", + " \"idname\": \"waterservice.application.id\"", + " },", + " {", + " \"format\": \"SW_AP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_APP_[TENANT_ID]]\",", + " \"idname\": \"sewerageservice.application.id\"", + " },", + " {", + " \"format\": \"WS.OTP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_FEE_RCPT_[TENANT_ID]]\",", + " \"idname\": \"ws.one_time_fee.receipt.id\"", + " },", + " {", + " \"format\": \"WS.OTP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_WS_FEE_RCPT_[TENANT_ID]]\",", + " \"idname\": \"wsreconnection.receipt.id\"", + " },", + "\t\t{", + " \"format\": \"SW.OTP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_FEE_RCPT_[TENANT_ID]]\",", + " \"idname\": \"swreconnection.receipt.id\"", + " },", + " {", + " \"format\": \"SW.OTP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_SW_FEE_RCPT_[TENANT_ID]]\",", + " \"idname\": \"sw.one_time_fee.receipt.id\"", + " },", + " {", + " \"format\": \"PG-BP-[cy:yyyy-MM-dd]-[SEQ_EG_BP_APN]\",", + " \"idname\": \"bpa.low_risk_permit_fee.receipt.id\"", + " },", + " {", + " \"format\": \"BPA/OC/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpa.nc_oc_app_fee.receipt.id\"", + " },", + " {", + " \"format\": \"BPA/OC/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"bpa.nc_oc_san_fee.receipt.id\"", + " },", + " {", + " \"format\": \"PG-NOCSRV-[cy:yyyy-MM-dd]-[SEQ_EG_NOC_APN]\",", + " \"idname\": \"noc.application.number\"", + " },", + " {", + " \"format\": \"PG-PGR-[cy:yyyy-MM-dd]-[SEQ_EG_PGR_ID]\",", + " \"idname\": \"pgr.servicerequestid\"", + " },", + " {", + " \"idname\": \"bs.amendment.id\",", + " \"format\": \"NOTETYPE-CONSUMERCODE-[SEQ_BS_MUTATION_[tenant_id]]\"", + " },", + " {", + " \"format\": \"FSM/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON[TENANT_ID]]\",", + " \"idname\": \"fsm.trip_charges.receipt.id\"", + " },", + " {", + " \"idname\": \"fsm.aplnumber\",", + " \"format\": \"[CITY.CODE]-FSM-[cy:yyyy-MM-dd]-[SEQ_EGOV_FSM]\"", + " },", + " {", + " \"idname\": \"echallan.aplnumber\",", + " \"format\": \"PG-CH-[cy:yyyy-MM-dd]-[SEQ_EG_CH_APL]\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"advt.gas_balloon_advertisement.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.property_tax_2013_14.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"tx.property tax_dishonoured_cheque_payment.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.sale_of_land.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.service_tax_gst_of_rent_of_mc_properties.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"rt.street_vendor_icard_certificate_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.tender_earnest_money_deposit_refundable fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"fn.security_deposit_fee_refundable fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.collection_and_demolition_waste_challan_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"ch.burning_of_waste_challan_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.sub_division_charges_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.information_certificate_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"nks.building_safety_certificate_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.dispensary_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.license_fee_slaughter_house.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.candy_fee_slaughter_house.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.conservancy_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.street_light_pole_transfer_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.sale_of_compost_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.sale_of_recyclable_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.dog_registration.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"other.swimming_pool_and_gymnactics_hall_fees.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"lcf.rehri_rickshaw_fee.receipt.id\"", + " },", + " {", + " \"format\": \"MP/[CITY.CODE]/[fy:yyyy-yy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"lcf.trade_license_fee.receipt.id\"", + " },", + " {", + " \"format\": \"DOC-[cy:yyyy-MM-dd]-[SEQ_EG_DOC_ID]\",", + " \"idname\": \"du.documentid\"", + " },", + " {", + " \"format\": \"PG-SK-[cy:yyyy-MM-dd]-[SEQ_EG_TL_APL]\",", + " \"idname\": \"bpareg.aplnumber\"", + " },", + " {", + " \"format\": \"PG-SK-[cy:yyyy-MM-dd]-[SEQ_EG_PT_LN]\",", + " \"idname\": \"bpareg.licensenumber\"", + " },", + " {", + " \"format\": \"PG-BP-[cy:yyyy-MM-dd]-[SEQ_EG_BP_APN]\",", + " \"idname\": \"bpa.aplnumber\"", + " },", + " {", + " \"format\": \"PG-BP-[CITY.CODE]-[SEQ_EG_BP_PN]\",", + " \"idname\": \"bpa.permitnumber\"", + " },", + " {", + " \"format\": \"BR/[CITY.CODE]/[cb.name]/[fy:yyyy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"birth_cert.receipt.id\"", + " },", + " {", + " \"format\": \"DT/[CITY.CODE]/[cb.name]/[fy:yyyy]/[SEQ_EGOV_COMMON]\",", + " \"idname\": \"death_cert.receipt.id\"", + " },", + " {", + " \"format\": \"WS_AP/[CITY.CODE]/[fy:yyyy-yy]/DC-[SEQ_WS_APP_[TENANT_ID]]\",", + " \"idname\": \"waterservice.disconnection.id\"", + " },", + " {", + " \"format\": \"SW_AP/[CITY.CODE]/[fy:yyyy-yy]/DC-[SEQ_SW_APP_[TENANT_ID]]\",", + " \"idname\": \"sewerageservice.disconnection.id\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.IdFormat\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.IdFormat", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.IdFormat" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerShipCategory.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerShipCategory.postman_collection new file mode 100644 index 00000000000..f22701c7b0c --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerShipCategory.postman_collection @@ -0,0 +1,168 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"INDIVIDUAL.SINGLEOWNER\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INDIVIDUAL.MULTIPLEOWNERS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATECOMPANY\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.NGO\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATETRUST\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.PRIVATEBOARD\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALPRIVATE.OTHERSPRIVATEINSTITUITION\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALGOVERNMENT.ULBGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALGOVERNMENT.STATEGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALGOVERNMENT.CENTRALGOVERNMENT\",", + " \"active\": true", + " },", + " {", + " \"code\": \"INSTITUTIONALGOVERNMENT.OTHERGOVERNMENTINSTITUITION\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.OwnerShipCategory\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.OwnerShipCategory", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.OwnerShipCategory" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerType.postman_collection new file mode 100644 index 00000000000..b3b1e78679f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data OwnerType.postman_collection @@ -0,0 +1,148 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"FREEDOMFIGHTER\",", + " \"active\": true", + " },", + " {", + " \"code\": \"WIDOW\",", + " \"active\": true", + " },", + " {", + " \"code\": \"HANDICAPPED\",", + " \"active\": true", + " },", + " {", + " \"code\": \"BPL\",", + " \"active\": true", + " },", + " {", + " \"code\": \"DEFENSE\",", + " \"active\": true", + " },", + " {", + " \"code\": \"NONE\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.OwnerType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.OwnerType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.OwnerType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StateInfo.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StateInfo.postman_collection new file mode 100644 index 00000000000..f70b3fd591e --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StateInfo.postman_collection @@ -0,0 +1,202 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"name\": \"Demo\",", + " \"code\": \"pg\",", + " \"qrCodeURL\":\"https://lh3.googleusercontent.com/-311gz2-xcHw/X6KRNSQTkWI/AAAAAAAAAKU/JmHSj-6rKPMVFbo6oL5x4JhYTTg8-UHmwCK8BGAsYHg/s0/2020-11-04.png\",", + " \"bannerUrl\": \"https://upyog-assets.s3.ap-south-1.amazonaws.com/bannerImage.png\",", + " \"logoUrl\": \"https://in-egov-assets.s3.ap-south-1.amazonaws.com/nugp.png\",", + " \"logoUrlWhite\": \"https://in-egov-assets.s3.ap-south-1.amazonaws.com/nugp.png\",", + " \"statelogo\":\"https://s3.ap-south-1.amazonaws.com/pg-egov-assets/pg.citya/logo.png\",", + " \"hasLocalisation\": true,", + " \"defaultUrl\": {", + " \"citizen\": \"/user/register\",", + " \"employee\": \"/user/login\"", + " },", + " \"languages\": [", + " {", + " \"label\": \"ENGLISH\",", + " \"value\": \"en_IN\"", + " },", + " {", + " \"label\": \"हिंदी\",", + " \"value\": \"hi_IN\"", + " }", + " ],", + " \"localizationModules\": [", + " {", + " \"label\": \"rainmaker-abg\",", + " \"value\": \"rainmaker-abg\"", + " },", + " {", + " \"label\": \"rainmaker-common\",", + " \"value\": \"rainmaker-common\"", + " },", + " {", + " \"label\": \"rainmaker-noc\",", + " \"value\": \"rainmaker-noc\"", + " },", + " {", + " \"label\": \"rainmaker-pt\",", + " \"value\": \"rainmaker-pt\"", + " },", + " {", + " \"label\": \"rainmaker-uc\",", + " \"value\": \"rainmaker-uc\"", + " },", + " {", + " \"label\": \"rainmaker-pgr\",", + " \"value\": \"rainmaker-pgr\"", + " },", + " {", + " \"label\": \"rainmaker-tl\",", + " \"value\": \"rainmaker-tl\"", + " },", + " {", + " \"label\": \"rainmaker-hr\",", + " \"value\": \"rainmaker-hr\"", + " },", + " {", + " \"label\": \"rainmaker-test\",", + " \"value\": \"rainmaker-test\"", + " },", + " {", + " \"label\": \"finance-erp\",", + " \"value\": \"finance-erp\"", + " },", + " {", + " \"label\": \"rainmaker-receipt\",", + " \"value\": \"rainmaker-receipt\"", + " },", + " {", + " \"label\": \"rainmaker-dss\",", + " \"value\": \"rainmaker-dss\"", + " },", + " {", + " \"label\": \"rainmaker-fsm\",", + " \"value\": \"rainmaker-fsm\"", + " }", + " ]", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.StateInfo\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.StateInfo", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.StateInfo" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StructureType.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StructureType.postman_collection new file mode 100644 index 00000000000..13d7a78a1c4 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data StructureType.postman_collection @@ -0,0 +1,140 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"IMMOVABLE.PUCCA\",", + " \"active\": true", + " },", + " {", + " \"code\": \"IMMOVABLE.KUTCHA\",", + " \"active\": true", + " },", + " {", + " \"code\": \"MOVABLE.HDV\",", + " \"active\": true", + " },", + " {", + " \"code\": \"MOVABLE.MDV\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.StructureType\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.StructureType", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.StructureType" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data UOM.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data UOM.postman_collection new file mode 100644 index 00000000000..a8df561b473 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data UOM.postman_collection @@ -0,0 +1,136 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"GALLONS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"GROSSUNITS\",", + " \"active\": true", + " },", + " {", + " \"code\": \"HP\",", + " \"active\": true", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.UOM\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.UOM", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.UOM" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data uiCommonPay.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data uiCommonPay.postman_collection new file mode 100644 index 00000000000..a6f6db08a41 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data uiCommonPay.postman_collection @@ -0,0 +1,2502 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"code\": \"FSM.TRIP_CHARGES\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"receiptKey\": \"fsm-receipt\",", + " \"billKey\": \"fsm-receipt\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"pdfModule\":\"PAYMENT\",", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FSM\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"receiptKey\": \"fsm-receipt\",", + " \"billKey\": \"fsm-receipt\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"pdfModule\":\"PAYMENT\",", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " },", + " {", + " \"code\": \"PT\",", + " \"headerBandLabel\": \"PT_COMMON_TABLE_COL_PT_ID\",", + " \"receiptKey\": \"property-receipt\",", + " \"billKey\": \"property-bill\",", + " \"pdfModule\":\"PT\",", + " \"cancelReceipt\": true,", + " \"cancelBill\": false,", + " \"arrears\": true,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/property-tax\",", + " \"employeeUrl\": \"/pt-mutation/propertySearch\"", + " }", + " ]", + " },", + " {", + " \"code\": \"PT.MUTATION\",", + " \"headerBandLabel\": \"PTM_COMMON_TABLE_COL_PT_ID\",", + " \"receiptKey\": \"property-receipt\",", + " \"billKey\": \"property-bill\",", + " \"pdfModule\":\"PT\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/property-tax\",", + " \"employeeUrl\": \"/pt-mutation/propertySearch\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TL\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"receiptKey\": \"tradelicense-receipt\",", + " \"billKey\": \"tradelicense-bill\",", + " \"pdfModule\":\"TL\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/tradelicense-citizen/home\",", + " \"employeeUrl\": \"/tradelicence/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BPA.NC_APP_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/bpastakeholder-citizen/home\",", + " \"employeeUrl\": \"/egov-bpa/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BPA.NC_SAN_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/bpastakeholder-citizen/home\",", + " \"employeeUrl\": \"/egov-bpa/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BPA.LOW_RISK_PERMIT_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/bpastakeholder-citizen/home\",", + " \"employeeUrl\": \"/egov-bpa/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"DEFAULT\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BPAREG\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"bpa-receipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/bpastakeholder-citizen/home\",", + " \"employeeUrl\": \"/bpastakeholder/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WS\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"WNS\",", + " \"receiptKey\": \"ws-onetime-receipt\",", + " \"billKey\": \"ws-bill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": true,", + " \"arrears\": true,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/wns-citizen/home\",", + " \"employeeUrl\": \"/wns/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SW\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"WNS\",", + " \"receiptKey\": \"ws-onetime-receipt\",", + " \"billKey\": \"ws-bill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": true,", + " \"arrears\": true,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/wns-citizen/home\",", + " \"employeeUrl\": \"/wns/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WS.ONE_TIME_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_APPLICATION_CODE\",", + " \"pdfModule\":\"WNS\",", + " \"receiptKey\": \"ws-onetime-receipt\",", + " \"billKey\": \"ws-bill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/wns-citizen/home\",", + " \"employeeUrl\": \"/wns/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SW.ONE_TIME_FEE\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_APPLICATION_CODE\",", + " \"pdfModule\":\"WNS\",", + " \"receiptKey\": \"ws-onetime-receipt\",", + " \"billKey\": \"ws-bill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/wns-citizen/home\",", + " \"employeeUrl\": \"/wns/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FIRENOC\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CONSUMER_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/fire-noc/home\",", + " \"employeeUrl\": \"/fire-noc/search\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Hoardings\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.No_Dues_Certificate\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.Electricity_Chungi\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.TS1_copy_register_for_old_survey\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.Transfer_Property_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.House_Tax\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.Property_tax_2013_14\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TX.Property Tax_Dishonoured_Cheque_Payment\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Unipolls\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Light_Wala_Board\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Wall_Paint_Advertisement\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Canopy_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADVT.Outdoor_Media_Display_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Municipal_Shops_Rent\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Land_Rent\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Tower_Rent\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Parking_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Jamin_Theka\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Tower_Installation\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Tower_Annual_Rent\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Community_Centre_Booking_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Commercial_Use_of_Municipal_Land\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Street_Vendor\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Sale_of_Land\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Service_Tax_GST_of_Rent_of_MC_Properties\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"RT.Street_vendor_ICARD_Certificate_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.Election_rally_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.Parking_during_election\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.Road_show\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.RTI\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.No_Dues_Certificate\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ADMN.Parking_Booking_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Advance_Provident_Fund\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.PF_transfer_(Accounts)\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Recovery_employee/contractor\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Grants_cheque\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.GPF\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.CPF_received_check\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Provident_Fund_Processing_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Tender_Earnest_Money_Deposit_Refundable fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FN.Security_Deposit_Fee_Refundable Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ST.Stationary_Not_Income\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"ST.Expenditure_santitation_Not_Income\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Santitation_dumping_garbage\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Plastic_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Rehri_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Challan_for_Misuse_of_Water\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Dengue_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Littering_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.SBM_garbage_plastic_polythene_challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Cattle_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Dairy_Animals_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Bidi_&_Cigrette_Challan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Collection_and_Demolition_Waste_Challan_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CH.Burning_of_Waste_Challan_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Telecom_tower_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Draftsmen_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Building_planner_renew\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.License_fees_building_branch\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Leave_encashment_and_gratuty\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Architect_license_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Construction_Waste\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Demolition_Waste\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"FTP.Composition_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Naksha_samjota_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Naksha_changes\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.NOC/Completion_of_building_approval\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Alteration_additional_charge\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.2_year_time_limit_of_Renewal_Building_Naksha\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Regularisation_of_Buildings\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Hadud_Certificate_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.No_Dues_Certificate\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Colony_Sambandhi_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Naksha_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Building_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Boundary_Wall_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Malba_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Development_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Change_of_Land_Use_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Under_Development_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Economic_Weaker_Section_Scheme_Charges\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Economic_Weaker_Section_Projects_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Rain_Harvesting_Charges\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Sub_division_charges_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Information_Certificate_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"NKS.Building_safety_Certificate_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OM.Water_connection/disconnection_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OM.Plumber_License_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OM.Water_connection_disconnection_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OM.Road_Cut_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SNT.Licence_Pure_food\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SNT.Dead_animals_contract\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"SNT.clean_safai_sanitation\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Misc_Challans\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.No_due_certificate_electricity\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.registery_and_bank_loan\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Water_Charges\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Other_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.NOC_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Fire_NOC_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Fire_Tender_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Fire_Call_Report_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Bus_Adda_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Dispensary_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.License_fee_Slaughter_House\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Candy_fee_Slaughter_House\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Conservancy_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Street_Light_Pole_Transfer_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Sale_of_Compost_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Sale_of_Recyclable_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Dog_Registration\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"OTHER.Swimming_Pool_And_Gymnactics_Hall_Fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WF.Contractor_Enlistment\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WF.Tender Form Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"WF.OFC_Permission_fees\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TB.Advertisement_fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TB.Tehbazaari\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"TB.Challan_Under_section_156_121_etc\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CSS.cow_cess\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"CSS.Labor_Cess\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"LCF.Manual_Rikshaw\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"LCF.Rehri_Rickshaw_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"LCF.Trade_License_Fee\",", + " \"headerBandLabel\": \"PAYMENT_COMMON_CHALLAN_CODE\",", + " \"pdfModule\":\"PAYMENT\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"mcollect-bill\",", + " \"cancelReceipt\":false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/uc/newCollection\"", + " }", + " ]", + " },", + " {", + " \"code\": \"BIRTH_CERT\",", + " \"headerBandLabel\": \"PAYMENT_BND_CONSUMER_CODE\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " },", + " {", + " \"code\": \"DEATH_CERT\",", + " \"headerBandLabel\": \"PAYMENT_BND_CONSUMER_CODE\",", + " \"receiptKey\": \"consolidatedreceipt\",", + " \"billKey\": \"consolidatedbill\",", + " \"cancelReceipt\": false,", + " \"cancelBill\": false,", + " \"arrears\": false,", + " \"buttons\": [", + " {", + " \"label\": \"COMMON_BUTTON_HOME\",", + " \"citizenUrl\": \"/\",", + " \"employeeUrl\": \"/inbox\"", + " }", + " ]", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.uiCommonPay\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.uiCommonPay", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.uiCommonPay" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data wfSlaConfig.postman_collection b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data wfSlaConfig.postman_collection new file mode 100644 index 00000000000..dadb0666705 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Migration Scripts/data-migration Collections/common-masters/MDMS v2 Bulk Data wfSlaConfig.postman_collection @@ -0,0 +1,131 @@ +{ + "info": { + "_postman_id": "fdf4d562-b56b-4752-a14e-86cfc983dad6", + "name": "MDMS v2 Bulk Data", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "25737272" + }, + "item": [ + { + "name": "MDMS v2 CreateData", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "var data=[", + " {", + " \"id\": 1,", + " \"slotPercentage\" : 33,", + " \"positiveSlabColor\" : \"#4CAF50\",", + " \"negativeSlabColor\" : \"#F44336\",", + " \"middleSlabColor\" : \"#EEA73A\"", + " }", + "]", + "", + "pm.collectionVariables.set(\"raw\", data);", + "", + "var obj = pm.collectionVariables.get(\"raw\");", + "", + "pm.collectionVariables.set(\"req\", JSON.stringify(obj[pm.globals.get(\"i\")]))", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "var data = pm.collectionVariables.get(\"raw\");\r", + "\r", + "var items = pm.globals.get(\"i\");\r", + "\r", + "\r", + "if (items < data.length){\r", + "\r", + " pm.globals.set(\"i\", Number(items) + 1);\r", + "\r", + " postman.setNextRequest(\"MDMS v2 CreateData\");\r", + "}else{\r", + " pm.globals.set(\"i\", 0);\r", + " postman.setNextRequest(null)\r", + "}\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"RequestInfo\": {\r\n \"apiId\": \"asset-services\",\r\n \"ver\": null,\r\n \"ts\": null,\r\n \"action\": null,\r\n \"did\": null,\r\n \"key\": null,\r\n \"msgId\": \"search with from and to values\",\r\n \"authToken\": \"{{authToken}}\",\r\n \"correlationId\": null,\r\n \"userInfo\": {\r\n \"id\": \"1\",\r\n \"userName\": null,\r\n \"name\": null,\r\n \"type\": null,\r\n \"mobileNumber\": null,\r\n \"emailId\": null,\r\n \"roles\": null,\r\n \"uuid\": \"40dceade-992d-4a8f-8243-19dda76a4171\"\r\n }\r\n },\r\n \"Mdms\": {\r\n \"tenantId\": \"pg\",\r\n \"schemaCode\": \"common-masters.wfSlaConfig\",\r\n \"data\": {{req}},\r\n \"isActive\": true\r\n }\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:8094/mdms-v2/v2/_create/common-masters.wfSlaConfig", + "host": [ + "localhost" + ], + "port": "8094", + "path": [ + "mdms-v2", + "v2", + "_create", + "common-masters.wfSlaConfig" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "raw", + "value": "" + }, + { + "key": "req", + "value": "" + } + ] +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/BillingService.BusinessService.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/BillingService.BusinessService.json new file mode 100644 index 00000000000..c760129bd1f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/BillingService.BusinessService.json @@ -0,0 +1,88 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "f25a130a-586e-4a32-8331-dec3d11e2bd5", + "tenantId": "pg", + "code": "BillingService.BusinessService", + "description": "BillingService BusinessService", + "definition": { + "type": "object", + "title": "Generated schema for Root", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "businessService", + "code", + "collectionModesNotAllowed", + "partPaymentAllowed", + "isAdvanceAllowed" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "billGineiURL": { + "type": "string" + }, + "businessService": { + "type": "string" + }, + "demandUpdateTime": { + "type": "number", + "default": 86400000 + }, + "isAdvanceAllowed": { + "type": "boolean", + "deault": false + }, + "minAmountPayable": { + "type": "number", + "default": 100 + }, + "partPaymentAllowed": { + "type": "boolean", + "deault": true + }, + "isBillAmendmentEnabled": { + "type": "boolean", + "deault": true + }, + "isVoucherCreationEnabled": { + "type": "boolean", + "deault": true + }, + "collectionModesNotAllowed": { + "type": "array", + "items": { + "enum": [ + "DD", + "OFFLINE_NEFT", + "OFFLINE_RTGS", + "POSTAL_ORDER" + ], + "type": "string" + } + } + }, + "x-ref-schema": [] + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702884549384, + "lastModifiedTime": 1702884549384 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/BillingService.TaxHeadMaster.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/BillingService.TaxHeadMaster.json new file mode 100644 index 00000000000..8a9836f6968 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/BillingService.TaxHeadMaster.json @@ -0,0 +1,76 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "f45d0a4f-b17a-4325-a236-cd67af741c09", + "tenantId": "pg", + "code": "BillingService.TaxHeadMaster", + "description": "BillingService TaxHeadMaster", + "definition": { + "type": "object", + "title": "Generated schema for Root", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "category", + "service", + "name", + "code", + "isDebit", + "isActualDemand", + "order" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "order": { + "type": "string" + }, + "isDebit": { + "type": "boolean", + "deault": true + }, + "service": { + "type": "string" + }, + "category": { + "type": "string" + }, + "isRequired": { + "type": "boolean" + }, + "isActualDemand": { + "type": "boolean", + "deault": true + } + }, + "x-ref-schema": [ + { + "fieldPath": "service", + "schemaCode": "BillingService.BusinessService" + } + ] + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702897702259, + "lastModifiedTime": 1702897702259 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/BillingService.TaxPeriod.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/BillingService.TaxPeriod.json new file mode 100644 index 00000000000..150f2c3ee9d --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/BillingService.TaxPeriod.json @@ -0,0 +1,70 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "4270ea1c-667d-41d4-a1e3-6b0f9b86d217", + "tenantId": "pg", + "code": "BillingService.TaxPeriod", + "description": "BillingService TaxPeriod", + "definition": { + "type": "object", + "title": "Generated schema for Root", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "fromDate", + "toDate", + "periodCycle", + "service", + "code", + "financialYear" + ], + "x-unique": [ + "code", + "financialYear" + ], + "properties": { + "code": { + "type": "string" + }, + "toDate": { + "type": "number" + }, + "service": { + "type": "string" + }, + "fromDate": { + "type": "number" + }, + "periodCycle": { + "type": "string", + "default": "ANNUAL" + }, + "financialYear": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + } + }, + "x-ref-schema": [ + { + "fieldPath": "service", + "schemaCode": "BillingService.BusinessService" + } + ] + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702884035862, + "lastModifiedTime": 1702884035862 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.CancerCess.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.CancerCess.json new file mode 100644 index 00000000000..e91eba5d7f3 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.CancerCess.json @@ -0,0 +1,64 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "6ec21766-b11a-4e2e-bc44-77b804f54bdc", + "tenantId": "pg", + "code": "PropertyTax.CancerCess", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY" + ], + "x-unique": [ + "fromFY" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917108, + "lastModifiedTime": 1701259917108 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ChargeSlabs.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ChargeSlabs.json new file mode 100644 index 00000000000..ae574f61a60 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ChargeSlabs.json @@ -0,0 +1,54 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "c28f21b1-4661-4bdb-9e51-4912599ddcde", + "tenantId": "pg", + "code": "PropertyTax.ChargeSlabs", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "floorNo", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "floorNo": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915448, + "lastModifiedTime": 1701259915448 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.CommonFieldsConfig.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.CommonFieldsConfig.json new file mode 100644 index 00000000000..293a60255c2 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.CommonFieldsConfig.json @@ -0,0 +1,116 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "26aed672-5d5a-4280-a70a-ce784802d285", + "tenantId": "pg", + "code": "PropertyTax.CommonFieldsConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "head", + "body" + ], + "x-unique": [ + "head" + ], + "properties": { + "body": { + "type": "array", + "items": { + "type": "object", + "required": [ + "route", + "component", + "nextStep", + "key", + "texts" + ], + "properties": { + "key": { + "type": "string" + }, + "type": { + "type": "string" + }, + "route": { + "type": "string" + }, + "texts": { + "type": "object", + "required": [ + "header", + "cardText" + ], + "properties": { + "header": { + "type": "string" + }, + "cardText": { + "type": "string" + }, + "nextText": { + "type": "string" + }, + "skipText": { + "type": "string" + }, + "headerCaption": { + "type": "string" + }, + "submitBarLabel": { + "type": "string" + }, + "skipAndContinueText": { + "type": "string" + } + }, + "additionalProperties": false + }, + "nextStep": { + "type": "string" + }, + "component": { + "type": "string" + }, + "isMandatory": { + "type": "boolean", + "default": true + }, + "withoutLabel": { + "type": "boolean", + "default": true + }, + "hideInEmployee": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + } + }, + "head": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916236, + "lastModifiedTime": 1701259916236 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ConstructionSubType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ConstructionSubType.json new file mode 100644 index 00000000000..488e3335b7b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ConstructionSubType.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "98840150-2d15-4515-966b-1c694249fbe3", + "tenantId": "pg", + "code": "PropertyTax.ConstructionSubType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701338549283, + "lastModifiedTime": 1701338549283 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ConstructionType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ConstructionType.json new file mode 100644 index 00000000000..c435af6b101 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ConstructionType.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cd8cb36f-e3a8-482c-85c4-766e7a246ff7", + "tenantId": "pg", + "code": "PropertyTax.ConstructionType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701339920159, + "lastModifiedTime": 1701339920159 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Documents.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Documents.json new file mode 100644 index 00000000000..cc92f1a041b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Documents.json @@ -0,0 +1,183 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "89a816d6-2bc9-4cdb-a7d7-ebb36d84f0e4", + "tenantId": "pg", + "code": "PropertyTax.Documents", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "documentType", + "required", + "active", + "hasDropdown", + "additionalDetails", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "required": { + "type": "boolean", + "default": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": true + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code", + "active" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "digit-citizen": { + "type": "boolean", + "default": true + }, + "additionalDetails": { + "type": "object", + "required": [ + "enabledActions" + ], + "properties": { + "enabledActions": { + "type": "object", + "required": [ + "assess", + "reassess", + "update", + "create" + ], + "properties": { + "assess": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "create": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "update": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "reassess": { + "type": "object", + "required": [ + "disableUpload", + "disableDropdown" + ], + "properties": { + "disableUpload": { + "type": "boolean", + "default": false + }, + "disableDropdown": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701340167673, + "lastModifiedTime": 1701340167673 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.DuesOnPTMutation.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.DuesOnPTMutation.json new file mode 100644 index 00000000000..b8039f05671 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.DuesOnPTMutation.json @@ -0,0 +1,58 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "36d9d63d-1710-471f-909b-7c464103a64c", + "tenantId": "pg", + "code": "PropertyTax.DuesOnPTMutation", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "module", + "code", + "enabled", + "fetchConsumerUrl", + "fecthBillUrl" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "module": { + "type": "string" + }, + "enabled": { + "type": "boolean", + "default": true + }, + "fecthBillUrl": { + "type": "string" + }, + "fetchConsumerUrl": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917371, + "lastModifiedTime": 1701259917371 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.FireCess.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.FireCess.json new file mode 100644 index 00000000000..6bbe64e5545 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.FireCess.json @@ -0,0 +1,90 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "6ce89ab3-cc44-428f-9386-2570761ae553", + "tenantId": "pg", + "code": "PropertyTax.FireCess", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "dynamicFirecess", + "dynamicRates" + ], + "x-unique": [ + "fromFY" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "dynamicRates": { + "type": "object", + "required": [ + "firecess_inflammable", + "firecess_building_height", + "firecess_category_major" + ], + "properties": { + "firecess_inflammable": { + "type": "integer" + }, + "firecess_category_major": { + "type": "integer" + }, + "firecess_building_height": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "dynamicFirecess": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917492, + "lastModifiedTime": 1701259917492 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Floor.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Floor.json new file mode 100644 index 00000000000..d31668a4d03 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Floor.json @@ -0,0 +1,54 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "fd9a1b5e-a790-4ee2-80ff-7d15b0ad7d01", + "tenantId": "pg", + "code": "PropertyTax.Floor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "description", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917822, + "lastModifiedTime": 1701259917822 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Interest.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Interest.json new file mode 100644 index 00000000000..f7622bc7a2a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Interest.json @@ -0,0 +1,70 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bf5a652c-4581-4c86-854d-1857f9ef9976", + "tenantId": "pg", + "code": "PropertyTax.Interest", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string", + "format": "date" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918249, + "lastModifiedTime": 1701259918249 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MapConfig.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MapConfig.json new file mode 100644 index 00000000000..c59735b1010 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MapConfig.json @@ -0,0 +1,56 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "b44df265-435c-46f7-ac4e-2c0439159ef8", + "tenantId": "pg", + "code": "PropertyTax.MapConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "defaultConfig" + ], + "x-unique": [ + "defaultConfig" + ], + "properties": { + "defaultConfig": { + "type": "object", + "required": [ + "lat", + "lng" + ], + "properties": { + "lat": { + "type": "number", + "default": 31.6160638 + }, + "lng": { + "type": "number", + "default": 74.8978579 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916969, + "lastModifiedTime": 1701259916969 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationDocuments.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationDocuments.json new file mode 100644 index 00000000000..b549fde442d --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationDocuments.json @@ -0,0 +1,85 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "b2d040bc-eb72-4b8d-a4c6-622672525929", + "tenantId": "pg", + "code": "PropertyTax.MutationDocuments", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "documentType", + "required", + "active", + "hasDropdown", + "dropdownData", + "description" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + }, + "required": { + "type": "boolean", + "default": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": false + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code", + "active" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916724, + "lastModifiedTime": 1701259916724 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationPenalty.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationPenalty.json new file mode 100644 index 00000000000..f00f5f09284 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationPenalty.json @@ -0,0 +1,69 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "350c6b68-2c9e-43f0-9c10-c0150b35684e", + "tenantId": "pg", + "code": "PropertyTax.MutationPenalty", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay", + "mutationPaymentPeriodInMonth" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string", + "format": "date" + }, + "mutationPaymentPeriodInMonth": { + "type": "string", + "default": "06" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917321, + "lastModifiedTime": 1701259917321 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationReason.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationReason.json new file mode 100644 index 00000000000..0be965526e9 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationReason.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "1b6bd580-24c0-4796-99ca-d366bcf4022a", + "tenantId": "pg", + "code": "PropertyTax.MutationReason", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915400, + "lastModifiedTime": 1701259915400 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationRebate.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationRebate.json new file mode 100644 index 00000000000..06d72be3953 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.MutationRebate.json @@ -0,0 +1,69 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "032789b6-3dc9-4b2e-8fa5-185ad31e3d9a", + "tenantId": "pg", + "code": "PropertyTax.MutationRebate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "endingDay", + "mutationPaymentPeriodInMonth" + ], + "x-unique": [ + "fromFY", + "endingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "mutationPaymentPeriodInMonth": { + "type": "string", + "default": "06" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917630, + "lastModifiedTime": 1701259917630 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OccupancyType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OccupancyType.json new file mode 100644 index 00000000000..99c2f6937bd --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OccupancyType.json @@ -0,0 +1,49 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "9588f2a3-45cc-4b34-bd78-dc233e5f5876", + "tenantId": "pg", + "code": "PropertyTax.OccupancyType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917444, + "lastModifiedTime": 1701259917444 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OwnerShipCategory.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OwnerShipCategory.json new file mode 100644 index 00000000000..7eb6f7bfafe --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OwnerShipCategory.json @@ -0,0 +1,50 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "be03f448-22ee-49da-92e9-f1c2002a3b28", + "tenantId": "pg", + "code": "PropertyTax.OwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915274, + "lastModifiedTime": 1701259915274 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OwnerType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OwnerType.json new file mode 100644 index 00000000000..5b812cabc0b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OwnerType.json @@ -0,0 +1,82 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "1d07f8a9-c340-4390-b5cf-3b82d916f469", + "tenantId": "pg", + "code": "PropertyTax.OwnerType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "required": [ + "rate" + ], + "properties": { + "rate": { + "type": [ + "number", + "null" + ] + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701331769401, + "lastModifiedTime": 1701331769401 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OwnerTypeDocument.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OwnerTypeDocument.json new file mode 100644 index 00000000000..cdfcc53be3a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.OwnerTypeDocument.json @@ -0,0 +1,60 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "ca6cea00-6f1a-4986-b646-910aad3d53aa", + "tenantId": "pg", + "code": "PropertyTax.OwnerTypeDocument", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "ownerTypeCode", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "ownerTypeCode": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "ownerTypeCode", + "schemaCode": "PropertyTax.OwnerType" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916188, + "lastModifiedTime": 1701259916188 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PTApplication.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PTApplication.json new file mode 100644 index 00000000000..493c0308b85 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PTApplication.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "11b940e7-ef0b-4d7f-8b8f-5f59d035d096", + "tenantId": "pg", + "code": "PropertyTax.PTApplication", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "creationReason", + "businessService", + "action", + "editAction" + ], + "x-unique": [ + "businessService" + ], + "properties": { + "action": { + "type": "string" + }, + "editAction": { + "type": "string" + }, + "creationReason": { + "type": "string" + }, + "businessService": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917673, + "lastModifiedTime": 1701259917673 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PTWorkflow.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PTWorkflow.json new file mode 100644 index 00000000000..71885d00bee --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PTWorkflow.json @@ -0,0 +1,56 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "13d901bb-8365-43c1-a8b0-f148a40d3a4c", + "tenantId": "pg", + "code": "PropertyTax.PTWorkflow", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "businessService", + "initialAction", + "inWorkflowStatusAllowed", + "enable" + ], + "x-unique": [ + "businessService", + "initialAction" + ], + "properties": { + "enable": { + "type": "boolean", + "default": false + }, + "initialAction": { + "type": "string" + }, + "businessService": { + "type": "string" + }, + "inWorkflowStatusAllowed": { + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916679, + "lastModifiedTime": 1701259916679 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Penalty.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Penalty.json new file mode 100644 index 00000000000..654c4285a4f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Penalty.json @@ -0,0 +1,63 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "0261b344-4cd8-4a62-b28d-dbd3c116eaf3", + "tenantId": "pg", + "code": "PropertyTax.Penalty", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "startingDay" + ], + "x-unique": [ + "fromFY", + "startingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "minAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + }, + "startingDay": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918068, + "lastModifiedTime": 1701259918068 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PropertyConfiguration.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PropertyConfiguration.json new file mode 100644 index 00000000000..fab40309b43 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PropertyConfiguration.json @@ -0,0 +1,60 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "81c87311-c7e0-419f-bcc2-192699d30979", + "tenantId": "pg", + "code": "PropertyTax.PropertyConfiguration", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "Mutation", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "Mutation": { + "type": "object", + "required": [ + "RegistrationDetails", + "MutationDetails" + ], + "properties": { + "MutationDetails": { + "type": "boolean", + "default": true + }, + "RegistrationDetails": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701345004111, + "lastModifiedTime": 1701345004111 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PropertySubType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PropertySubType.json new file mode 100644 index 00000000000..c56b25ea812 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PropertySubType.json @@ -0,0 +1,60 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "f15661aa-951c-49ed-97f9-d4707c585f92", + "tenantId": "pg", + "code": "PropertyTax.PropertySubType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "propertyType" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "propertyType": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "propertyType", + "schemaCode": "PropertyTax.PropertyType" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918019, + "lastModifiedTime": 1701259918019 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PropertyType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PropertyType.json new file mode 100644 index 00000000000..3a1418644bd --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.PropertyType.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "80680e06-1d02-41e1-9253-537d86c30847", + "tenantId": "pg", + "code": "PropertyTax.PropertyType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "propertyType": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701339234915, + "lastModifiedTime": 1701339234915 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ReasonForTransfer.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ReasonForTransfer.json new file mode 100644 index 00000000000..5e18260913a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.ReasonForTransfer.json @@ -0,0 +1,50 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bf310527-c23c-46cd-a61f-d460b2a917f7", + "tenantId": "pg", + "code": "PropertyTax.ReasonForTransfer", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916779, + "lastModifiedTime": 1701259916779 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Rebate.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Rebate.json new file mode 100644 index 00000000000..de988e402b2 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.Rebate.json @@ -0,0 +1,64 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "68213cc0-ed30-40dd-ae87-20bf0628647c", + "tenantId": "pg", + "code": "PropertyTax.Rebate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rate", + "fromFY", + "endingDay" + ], + "x-unique": [ + "fromFY", + "endingDay" + ], + "properties": { + "rate": { + "type": "integer" + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "endingDay": { + "type": "string", + "format": "date" + }, + "maxAmount": { + "type": [ + "number", + "null" + ] + }, + "flatAmount": { + "type": [ + "number", + "null" + ] + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918368, + "lastModifiedTime": 1701259918368 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.RentalDetails.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.RentalDetails.json new file mode 100644 index 00000000000..d30d1a76eb1 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.RentalDetails.json @@ -0,0 +1,50 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "8a753a66-b755-4c2b-8b1d-16585c344af1", + "tenantId": "pg", + "code": "PropertyTax.RentalDetails", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915520, + "lastModifiedTime": 1701259915520 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.SubOwnerShipCategory.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.SubOwnerShipCategory.json new file mode 100644 index 00000000000..812d5e4a3e3 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.SubOwnerShipCategory.json @@ -0,0 +1,60 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bd1aef7c-b2a7-430f-86b0-9557537b7ae4", + "tenantId": "pg", + "code": "PropertyTax.SubOwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "ownerShipCategory" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "ownerShipCategory": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "ownerShipCategory", + "schemaCode": "PropertyTax.OwnerShipCategory" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259915355, + "lastModifiedTime": 1701259915355 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UpdateNumber.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UpdateNumber.json new file mode 100644 index 00000000000..8cd618d5a7c --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UpdateNumber.json @@ -0,0 +1,114 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bc66009a-1033-4974-a74d-25404ee38d0b", + "tenantId": "pg", + "code": "PropertyTax.UpdateNumber", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "invalidPattern", + "invalidNumber", + "warningEnabled", + "skipEnabled", + "documents" + ], + "x-unique": [ + "invalidNumber" + ], + "properties": { + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "active", + "code", + "description", + "documentType", + "dropdownData", + "hasDropdown", + "required", + "inputProps", + "maxFileSize" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "required": { + "type": "boolean", + "default": false + }, + "inputProps": { + "type": "object", + "required": [ + "accept" + ], + "properties": { + "accept": { + "type": "string" + } + }, + "additionalProperties": false + }, + "description": { + "type": "string" + }, + "hasDropdown": { + "type": "boolean", + "default": false + }, + "maxFileSize": { + "type": "integer" + }, + "documentType": { + "type": "string" + }, + "dropdownData": { + "type": "array" + } + }, + "additionalProperties": false + } + }, + "skipEnabled": { + "type": "boolean", + "default": true + }, + "invalidNumber": { + "type": "string" + }, + "invalidPattern": { + "type": "string" + }, + "warningEnabled": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259916409, + "lastModifiedTime": 1701259916409 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategory.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategory.json new file mode 100644 index 00000000000..e6354e96abc --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategory.json @@ -0,0 +1,81 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "a3a6e46a-5748-450b-8b76-4f94c0547280", + "tenantId": "pg", + "code": "PropertyTax.UsageCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "properties": { + "rate": { + "type": [ + "number", + "null" + ], + "default": 0 + }, + "maxAmount": { + "type": [ + "number", + "null" + ], + "default": 0 + }, + "flatAmount": { + "type": [ + "number", + "null" + ], + "default": 0 + } + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701337092564, + "lastModifiedTime": 1701337092564 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategoryDetail.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategoryDetail.json new file mode 100644 index 00000000000..7feb3b120d9 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategoryDetail.json @@ -0,0 +1,87 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "032cb2ed-3009-4a28-853f-46bb25dbf97e", + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryDetail", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "usageCategorySubMinor", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": [ + "object", + "null" + ], + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "number" + }, + "maxAmount": { + "type": "number" + }, + "flatAmount": { + "type": "number" + } + } + }, + "usageCategorySubMinor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategorySubMinor", + "schemaCode": "PropertyTax.UsageCategorySubMinor" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701340660487, + "lastModifiedTime": 1701340660487 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategoryMajor.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategoryMajor.json new file mode 100644 index 00000000000..ae1cb812d5b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategoryMajor.json @@ -0,0 +1,55 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "4bdf0517-9860-4eae-9033-844ab280fc5c", + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryMajor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259917161, + "lastModifiedTime": 1701259917161 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategoryMinor.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategoryMinor.json new file mode 100644 index 00000000000..279a45497bf --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategoryMinor.json @@ -0,0 +1,86 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "585e05c9-cd66-4f69-97fa-174daacfe1e6", + "tenantId": "pg", + "code": "PropertyTax.UsageCategoryMinor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY", + "usageCategoryMajor", + "exemption" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": "object", + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "integer" + }, + "maxAmount": { + "type": "integer" + }, + "flatAmount": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "usageCategoryMajor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategoryMajor", + "schemaCode": "PropertyTax.UsageCategoryMajor" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701259918324, + "lastModifiedTime": 1701259918324 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategorySubMinor.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategorySubMinor.json new file mode 100644 index 00000000000..57459f70cba --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/PropertyTax.UsageCategorySubMinor.json @@ -0,0 +1,89 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "edf9cbe9-1aec-417a-9720-2747106e5ec0", + "tenantId": "pg", + "code": "PropertyTax.UsageCategorySubMinor", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active", + "fromFY", + "usageCategoryMinor", + "exemption" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "fromFY": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "exemption": { + "type": [ + "object", + "null" + ], + "required": [ + "rate", + "maxAmount", + "flatAmount" + ], + "properties": { + "rate": { + "type": "integer" + }, + "maxAmount": { + "type": "integer" + }, + "flatAmount": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "usageCategoryMinor": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "usageCategoryMinor", + "schemaCode": "PropertyTax.UsageCategoryMinor" + } + ], + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701340461780, + "lastModifiedTime": 1701340461780 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/RAINMAKER-PGR.ComplainClosingTime.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/RAINMAKER-PGR.ComplainClosingTime.json new file mode 100644 index 00000000000..49249ffbb42 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/RAINMAKER-PGR.ComplainClosingTime.json @@ -0,0 +1,42 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "b21ee8fc-6d8f-4cd0-abc2-ce85ad155dc2", + "tenantId": "pg", + "code": "RAINMAKER-PGR.ComplainClosingTime", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "ComplainMaxIdleTime" + ], + "x-unique": [ + "ComplainMaxIdleTime" + ], + "properties": { + "ComplainMaxIdleTime": { + "type": "number", + "default": 3600000, + "minimum": 0 + } + } + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701861456327, + "lastModifiedTime": 1701861456327 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/RAINMAKER-PGR.ServiceDefs.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/RAINMAKER-PGR.ServiceDefs.json new file mode 100644 index 00000000000..d28884da8e0 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/RAINMAKER-PGR.ServiceDefs.json @@ -0,0 +1,75 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "39613db9-c401-4c89-99c1-967754001c24", + "tenantId": "pg", + "code": "RAINMAKER-PGR.ServiceDefs", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "serviceCode", + "name", + "keywords", + "department", + "slaHours", + "menuPath", + "active" + ], + "x-unique": [ + "serviceCode" + ], + "properties": { + "name": { + "type": "string" + }, + "order": { + "type": "integer" + }, + "active": { + "type": "boolean" + }, + "keywords": { + "type": "string" + }, + "menuPath": { + "type": "string" + }, + "slaHours": { + "type": "integer", + "default": 336, + "minimum": 1 + }, + "department": { + "type": "string" + }, + "serviceCode": { + "type": "string" + } + }, + "x-ref-schema": [ + { + "fieldPath": "department", + "schemaCode": "common-masters.Department" + } + ] + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701865847685, + "lastModifiedTime": 1701865847685 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/RAINMAKER-PGR.UIConstants.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/RAINMAKER-PGR.UIConstants.json new file mode 100644 index 00000000000..c475f724f29 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/RAINMAKER-PGR.UIConstants.json @@ -0,0 +1,41 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "c00c7744-8bff-48af-b659-45a85884d948", + "tenantId": "pg", + "code": "RAINMAKER-PGR.UIConstants", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "REOPENSLA" + ], + "x-unique": [ + "REOPENSLA" + ], + "properties": { + "REOPENSLA": { + "type": "integer", + "default": 432000000 + } + } + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702379477350, + "lastModifiedTime": 1702379477350 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.AccessoriesCategory.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.AccessoriesCategory.json new file mode 100644 index 00000000000..0044e851803 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.AccessoriesCategory.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"code":{"type":"string"},"uom":{"type":["string","null"],"enum":["HP"]},"active":{"type":"boolean","default":true}},"additionalProperties":false,"required":["code","uom","active"],"x-unique":["code"]} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.ApplicationType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.ApplicationType.json new file mode 100644 index 00000000000..55b4be805d6 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.ApplicationType.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"code":{"type":"string"},"active":{"type":"boolean","default":true}},"additionalProperties":false,"required":["code","active"],"x-unique":["code"]} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.Documents.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.Documents.json new file mode 100644 index 00000000000..550ca913393 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.Documents.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"code":{"type":"string"},"documentType":{"type":"string"},"required":{"type":"boolean","default":true},"active":{"type":"boolean","default":true},"dropdownData":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"active":{"type":"boolean","default":false}},"additionalProperties":false,"required":["code","active"]}},"description":{"type":"string"}},"additionalProperties":false,"required":["code","documentType","required","active","dropdownData","description"],"x-unique":["code"]} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.Penalty.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.Penalty.json new file mode 100644 index 00000000000..cd04e201db0 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.Penalty.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"rate":{"type":"integer","default":10,"minimum":0},"minAmount":{"type":"number","minimum":0},"flatAmount":{"type":"number","minimum":0},"fromFY":{"type":"string","pattern":"^\\d\\d\\d\\d-\\d\\d$"},"startingDay":{"type":"string","format":"date"}},"additionalProperties":false,"required":["rate","minAmount","flatAmount","fromFY","startingDay"],"x-unique":["fromFY","startingDay"]} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.Rebate.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.Rebate.json new file mode 100644 index 00000000000..cd32a49cf62 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.Rebate.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"rate":{"type":"integer","minimum":0},"maxAmount":{"type":["null","integer"],"minimum":0},"flatAmount":{"type":"number","minimum":0},"fromFY":{"type":"string","pattern":"^\\d\\d\\d\\d-\\d\\d$"},"endingDay":{"type":"string","format":"date"}},"additionalProperties":false,"required":["rate","flatAmount","fromFY","endingDay"],"x-unique":["fromFY","endingDay"]} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.ReminderPeriods.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.ReminderPeriods.json new file mode 100644 index 00000000000..2c31716972b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.ReminderPeriods.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"tenantId":{"type":"string"},"reminderInterval":{"type":"integer","default":691200000}},"additionalProperties":false,"required":["tenantId","reminderInterval"],"x-unique":["tenantId"],"x-ref-schema":[{"fieldPath":"tenantId","schemaCode":"tenant.tenantInfo"}]} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.TradeRenewal.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.TradeRenewal.json new file mode 100644 index 00000000000..4ea64a653a3 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.TradeRenewal.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"renewalPeriod":{"type":"integer","default":7889400000,"minimum":0}},"additionalProperties":false,"required":["renewalPeriod"],"x-unique":["renewalPeriod"]} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.TradeType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.TradeType.json new file mode 100644 index 00000000000..98a1b39b873 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/TradeLicense.TradeType.json @@ -0,0 +1 @@ +{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"name":{"type":"string"},"code":{"type":"string"},"uom":{"type":"null"},"applicationDocument":{"type":"array","items":{"type":"object","properties":{"applicationType":{"type":"string"},"documentList":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"required":["applicationType","documentList"]}},"verificationDocument":{"type":"array"},"active":{"type":"boolean"},"type":{"type":"string"},"validityPeriod":{"type":"null"}},"additionalProperties":false,"required":["name","code","applicationDocument","verificationDocument","active","type"],"x-unique":["code"]} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CancelCurrentBillReasons.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CancelCurrentBillReasons.json new file mode 100644 index 00000000000..ff3266bcdd1 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CancelCurrentBillReasons.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "bbc1347b-0d21-47e1-8072-98592889f242", + "tenantId": "pg", + "code": "common-masters.CancelCurrentBillReasons", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795474, + "lastModifiedTime": 1701688795474 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CancelReceiptReason.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CancelReceiptReason.json new file mode 100644 index 00000000000..736575a8722 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CancelReceiptReason.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "6c84fe12-b5ce-4ae5-b3ab-0656b29e6583", + "tenantId": "pg", + "code": "common-masters.CancelReceiptReason", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795725, + "lastModifiedTime": 1701688795725 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CensusYear.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CensusYear.json new file mode 100644 index 00000000000..87391eb4b64 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CensusYear.json @@ -0,0 +1,49 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "7ba893ec-9fb6-4c52-98a1-59b1694e7e11", + "tenantId": "pg", + "code": "common-masters.CensusYear", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenantId", + "name", + "code" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tenantId": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795772, + "lastModifiedTime": 1701688795772 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CitizenConsentForm.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CitizenConsentForm.json new file mode 100644 index 00000000000..5f472444e4c --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CitizenConsentForm.json @@ -0,0 +1,78 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "71c0a97b-6ad0-4be1-a7a0-c377e60d99fb", + "tenantId": "pg", + "code": "common-masters.CitizenConsentForm", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "isCitizenConsentFormEnabled", + "checkBoxLabels", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "checkBoxLabels": { + "type": "array", + "items": { + "type": "object", + "required": [ + "linkPrefix", + "link", + "linkId", + "linkPostfix", + "en_IN" + ], + "properties": { + "link": { + "type": "string" + }, + "en_IN": { + "type": "string" + }, + "linkId": { + "type": "string" + }, + "linkPrefix": { + "type": "string" + }, + "linkPostfix": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "isCitizenConsentFormEnabled": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701704352680, + "lastModifiedTime": 1701704352680 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CommonInboxConfig.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CommonInboxConfig.json new file mode 100644 index 00000000000..8c4494a7751 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CommonInboxConfig.json @@ -0,0 +1,83 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "a01e5988-223a-4ca3-98df-45dc9aeefef7", + "tenantId": "pg", + "code": "common-masters.CommonInboxConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "moduleName", + "BusinessService", + "roles", + "active", + "locality", + "localityModule", + "redirectConfig" + ], + "x-unique": [ + "BusinessService" + ], + "properties": { + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "active": { + "type": "boolean", + "default": true + }, + "locality": { + "type": "boolean", + "default": true + }, + "moduleName": { + "type": "string" + }, + "localityModule": { + "type": "string" + }, + "redirectConfig": { + "type": "object", + "required": [ + "INITIATED", + "DEFAULT" + ], + "properties": { + "DEFAULT": { + "type": "string" + }, + "INITIATED": { + "type": "string" + } + }, + "additionalProperties": false + }, + "BusinessService": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795229, + "lastModifiedTime": 1701688795229 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CronJobAPIConfig.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CronJobAPIConfig.json new file mode 100644 index 00000000000..ece664f2351 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.CronJobAPIConfig.json @@ -0,0 +1,79 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "4dd4d4cb-b538-4fa1-b84e-9abb0bb3eff8", + "tenantId": "pg", + "code": "common-masters.CronJobAPIConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "jobName", + "active", + "method", + "url", + "payload", + "header" + ], + "x-unique": [ + "url" + ], + "properties": { + "url": { + "type": "string" + }, + "active": { + "type": "string" + }, + "header": { + "type": "object", + "required": [ + "Content-Type" + ], + "properties": { + "Content-Type": { + "type": "string" + } + }, + "additionalProperties": false + }, + "method": { + "type": "string" + }, + "jobName": { + "type": "string" + }, + "payload": { + "type": "object", + "required": [ + "RequestInfo" + ], + "properties": { + "RequestInfo": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688796119, + "lastModifiedTime": 1701688796119 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.Department.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.Department.json new file mode 100644 index 00000000000..a13e51baabb --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.Department.json @@ -0,0 +1,50 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "e9f2bee6-689f-4bbe-a85f-4b3fb4b3e64a", + "tenantId": "pg", + "code": "common-masters.Department", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795871, + "lastModifiedTime": 1701688795871 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.Designation.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.Designation.json new file mode 100644 index 00000000000..ca0cad2be48 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.Designation.json @@ -0,0 +1,54 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "b769ada5-aa6f-4c67-923a-22453ddc764d", + "tenantId": "pg", + "code": "common-masters.Designation", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "name", + "description", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795321, + "lastModifiedTime": 1701688795321 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.DocumentType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.DocumentType.json new file mode 100644 index 00000000000..6d88dd1d5b0 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.DocumentType.json @@ -0,0 +1,55 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "1906dbe5-0743-4fa8-be30-a03c8b5253fe", + "tenantId": "pg", + "code": "common-masters.DocumentType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + }, + "maxFileSize": { + "type": "number" + }, + "allowedFormat": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701690259579, + "lastModifiedTime": 1701690259579 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.GenderType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.GenderType.json new file mode 100644 index 00000000000..49e25000276 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.GenderType.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "8b7f8572-b9a5-438c-9e4e-bc96d00e8ac4", + "tenantId": "pg", + "code": "common-masters.GenderType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795278, + "lastModifiedTime": 1701688795278 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.IdFormat.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.IdFormat.json new file mode 100644 index 00000000000..26dd6869206 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.IdFormat.json @@ -0,0 +1,45 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cf89c8d0-3a2e-4596-9b33-a0a502e98198", + "tenantId": "pg", + "code": "common-masters.IdFormat", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "format", + "idname" + ], + "x-unique": [ + "idname" + ], + "properties": { + "format": { + "type": "string" + }, + "idname": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795683, + "lastModifiedTime": 1701688795683 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.OwnerShipCategory.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.OwnerShipCategory.json new file mode 100644 index 00000000000..211dc615793 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.OwnerShipCategory.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "0cabf550-3c9a-4056-ad7f-8cd10e34e5ce", + "tenantId": "pg", + "code": "common-masters.OwnerShipCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795517, + "lastModifiedTime": 1701688795517 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.OwnerType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.OwnerType.json new file mode 100644 index 00000000000..35dc0ccfecf --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.OwnerType.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "dfbbdbae-542d-459d-8d53-f86ed3dc90f5", + "tenantId": "pg", + "code": "common-masters.OwnerType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688796080, + "lastModifiedTime": 1701688796080 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.StateInfo.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.StateInfo.json new file mode 100644 index 00000000000..4e219e7d807 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.StateInfo.json @@ -0,0 +1,127 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "a88ed5d4-a77f-4de9-a575-edcd6c5da72f", + "tenantId": "pg", + "code": "common-masters.StateInfo", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "name", + "code", + "qrCodeURL", + "bannerUrl", + "logoUrl", + "logoUrlWhite", + "statelogo", + "hasLocalisation", + "defaultUrl", + "languages", + "localizationModules" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "logoUrl": { + "type": "string" + }, + "bannerUrl": { + "type": "string" + }, + "languages": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "qrCodeURL": { + "type": "string" + }, + "statelogo": { + "type": "string" + }, + "defaultUrl": { + "type": "object", + "required": [ + "citizen", + "employee" + ], + "properties": { + "citizen": { + "type": "string" + }, + "employee": { + "type": "string" + } + }, + "additionalProperties": false + }, + "logoUrlWhite": { + "type": "string" + }, + "hasLocalisation": { + "type": "boolean", + "default": true + }, + "localizationModules": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "value" + ], + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795828, + "lastModifiedTime": 1701688795828 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.StructureType.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.StructureType.json new file mode 100644 index 00000000000..a0408c5f13b --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.StructureType.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "e46da27a-908f-4e87-808b-4630f1eeef52", + "tenantId": "pg", + "code": "common-masters.StructureType", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795562, + "lastModifiedTime": 1701688795562 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.TablePaginationOptions.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.TablePaginationOptions.json new file mode 100644 index 00000000000..365de7f8e6f --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.TablePaginationOptions.json @@ -0,0 +1,52 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "f2684c7b-c5ab-4d61-8427-6327b8026e61", + "tenantId": "pg", + "code": "common-masters.TablePaginationOptions", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "rowsPerPageOptions", + "defaultValue", + "id" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "number" + }, + "defaultValue": { + "type": "integer" + }, + "rowsPerPageOptions": { + "type": "array", + "items": { + "type": "integer" + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701703757454, + "lastModifiedTime": 1701703757454 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.UOM.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.UOM.json new file mode 100644 index 00000000000..cb60a74b0ff --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.UOM.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "8d7d0dfd-3280-4efc-acbe-b3c1399769b7", + "tenantId": "pg", + "code": "common-masters.UOM", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688796040, + "lastModifiedTime": 1701688796040 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.Uom.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.Uom.json new file mode 100644 index 00000000000..cb60a74b0ff --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.Uom.json @@ -0,0 +1,46 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "8d7d0dfd-3280-4efc-acbe-b3c1399769b7", + "tenantId": "pg", + "code": "common-masters.UOM", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "active" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "active": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688796040, + "lastModifiedTime": 1701688796040 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.UomCategory.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.UomCategory.json new file mode 100644 index 00000000000..4547e964470 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.UomCategory.json @@ -0,0 +1,69 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cab11077-809b-4511-b60d-07e733031b6c", + "tenantId": "pg", + "code": "common-masters.UomCategory", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "tenantId", + "uomCategory", + "name", + "code", + "description", + "fromDate", + "toDate" + ], + "x-unique": [ + "code" + ], + "properties": { + "id": { + "type": "integer" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "toDate": { + "type": "integer" + }, + "fromDate": { + "type": "integer" + }, + "tenantId": { + "type": "string" + }, + "description": { + "type": "string" + }, + "uomCategory": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "a02659b8-78a7-4f22-984d-050107432f22", + "lastModifiedBy": "a02659b8-78a7-4f22-984d-050107432f22", + "createdTime": 1701688795915, + "lastModifiedTime": 1701688795915 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.bdTemplate.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.bdTemplate.json new file mode 100644 index 00000000000..3856a17c1e0 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.bdTemplate.json @@ -0,0 +1,45 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "1fc6055e-1cfe-45f2-92f5-7025be877633", + "tenantId": "pg", + "code": "common-masters.bdTemplate", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "template", + "code" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "template": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701690897009, + "lastModifiedTime": 1701690897009 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.uiCommonPay.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.uiCommonPay.json new file mode 100644 index 00000000000..a9088b567e4 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.uiCommonPay.json @@ -0,0 +1,95 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "26212c7a-382b-495c-9737-046015ab8c9f", + "tenantId": "pg", + "code": "common-masters.uiCommonPay", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "headerBandLabel", + "receiptKey", + "billKey", + "cancelReceipt", + "cancelBill", + "arrears", + "buttons" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "arrears": { + "type": "boolean", + "default": true + }, + "billKey": { + "type": "string" + }, + "buttons": { + "type": "array", + "items": { + "type": "object", + "required": [ + "label", + "citizenUrl", + "employeeUrl" + ], + "properties": { + "label": { + "type": "string" + }, + "citizenUrl": { + "type": "string" + }, + "employeeUrl": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "pdfModule": { + "type": "string" + }, + "cancelBill": { + "type": "boolean", + "default": true + }, + "receiptKey": { + "type": "string" + }, + "cancelReceipt": { + "type": "boolean", + "default": true + }, + "headerBandLabel": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701689641898, + "lastModifiedTime": 1701689641898 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.wfSlaConfig.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.wfSlaConfig.json new file mode 100644 index 00000000000..b1336e3c820 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/common-masters.wfSlaConfig.json @@ -0,0 +1,57 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "df4ce9bd-5b77-418a-b8a0-e8d155b45148", + "tenantId": "pg", + "code": "common-masters.wfSlaConfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "id", + "slotPercentage", + "positiveSlabColor", + "negativeSlabColor", + "middleSlabColor" + ], + "x-unique": [ + "id" + ], + "properties": { + "id": { + "type": "integer" + }, + "slotPercentage": { + "type": "integer" + }, + "middleSlabColor": { + "type": "string" + }, + "negativeSlabColor": { + "type": "string" + }, + "positiveSlabColor": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1701706144465, + "lastModifiedTime": 1701706144465 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/egf-master.FinancialYear.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/egf-master.FinancialYear.json new file mode 100644 index 00000000000..f2f9e833fc4 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/egf-master.FinancialYear.json @@ -0,0 +1,99 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "89bdaffd-3444-4079-9200-00f2d7828a7b", + "tenantId": "pg", + "code": "egf-master.FinancialYear", + "description": "egf-master FinancialYear", + "definition": { + "type": "object", + "title": "Generated schema for Root", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenantId", + "finYearRange", + "name", + "code", + "startingDate", + "endingDate", + "active", + "isActiveForPosting", + "isClosed", + "transferClosingBalance", + "module" + ], + "x-unique": [ + "module" + ], + "properties": { + "code": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "name": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "active": { + "type": "boolean", + "default": true + }, + "module": { + "enum": [ + "PT", + "TL", + "WS", + "SW", + "FIRENOC" + ], + "type": "string" + }, + "isClosed": { + "type": "boolean", + "default": false + }, + "tenantId": { + "enum": [ + "pg" + ], + "type": "string", + "default": "pg" + }, + "endingDate": { + "type": "number" + }, + "finYearRange": { + "type": "string", + "pattern": "^\\d\\d\\d\\d-\\d\\d$" + }, + "startingDate": { + "type": "number" + }, + "isActiveForPosting": { + "type": "boolean", + "default": true + }, + "transferClosingBalance": { + "type": "boolean", + "default": false + } + } + }, + "isActive": true, + "auditDetails": { + "createdBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "lastModifiedBy": "2e17a032-b113-4911-9449-fb53ba7a385a", + "createdTime": 1702903008889, + "lastModifiedTime": 1702903008889 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.assessmentconfig.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.assessmentconfig.json new file mode 100644 index 00000000000..10de029e6c9 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.assessmentconfig.json @@ -0,0 +1,53 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cb104b96-1b3c-4dc0-8489-7125e3adc82c", + "tenantId": "pg", + "code": "tenant.assessmentconfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenant", + "enabled", + "financialyear", + "isRented" + ], + "x-unique": [ + "tenant" + ], + "properties": { + "tenant": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "isRented": { + "type": "boolean" + }, + "financialyear": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255395766, + "lastModifiedTime": 1701255395766 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.citymodule.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.citymodule.json new file mode 100644 index 00000000000..9109676cb3a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.citymodule.json @@ -0,0 +1,73 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "7a21c080-4533-48d2-a841-69f19c9bf9f7", + "tenantId": "pg", + "code": "tenant.citymodule", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "module", + "code", + "bannerImage", + "active", + "order", + "tenants" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "order": { + "type": "integer" + }, + "active": { + "type": "boolean" + }, + "module": { + "type": "string" + }, + "tenants": { + "type": "array", + "items": { + "type": "object", + "required": [ + "code" + ], + "properties": { + "code": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "bannerImage": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255395898, + "lastModifiedTime": 1701255395898 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.footer.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.footer.json new file mode 100644 index 00000000000..b881e43b665 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.footer.json @@ -0,0 +1,85 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "5a86cbc2-ec6b-4af4-856b-9485f8079939", + "tenantId": "pg", + "code": "tenant.footer", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "service", + "receiptFooterContent", + "billFooterContent" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "service": { + "type": "string" + }, + "billFooterContent": { + "type": "array", + "items": { + "type": "object", + "required": [ + "disclaimer", + "order" + ], + "properties": { + "order": { + "type": "string" + }, + "disclaimer": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "receiptFooterContent": { + "type": "array", + "items": { + "type": "object", + "required": [ + "disclaimer", + "order" + ], + "properties": { + "order": { + "type": "string" + }, + "disclaimer": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396172, + "lastModifiedTime": 1701255396172 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.nationalInfo.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.nationalInfo.json new file mode 100644 index 00000000000..f4b30777abb --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.nationalInfo.json @@ -0,0 +1,61 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "cd042e65-7017-467f-b210-3cb09fab09ef", + "tenantId": "pg", + "code": "tenant.nationalInfo", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "stateCode", + "stateName", + "code", + "name", + "active", + "module" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "active": { + "type": "boolean" + }, + "module": { + "type": "string" + }, + "stateCode": { + "type": "string" + }, + "stateName": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396070, + "lastModifiedTime": 1701255396070 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.reassessmentconfig.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.reassessmentconfig.json new file mode 100644 index 00000000000..298199555b8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.reassessmentconfig.json @@ -0,0 +1,48 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "905efc40-2518-4cb8-ab96-73a816865ea1", + "tenantId": "pg", + "code": "tenant.reassessmentconfig", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "tenant", + "financialyear" + ], + "x-unique": [ + "tenant" + ], + "properties": { + "tenant": { + "type": "array", + "items": { + "type": "string" + } + }, + "financialyear": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396281, + "lastModifiedTime": 1701255396281 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.tenantInfo.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.tenantInfo.json new file mode 100644 index 00000000000..6ea86a26ec8 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.tenantInfo.json @@ -0,0 +1,72 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "7082bef0-30b1-4d38-92f2-cc6ae7cb7bb9", + "tenantId": "pg", + "code": "tenant.tenantInfo", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "districtCode", + "population", + "malePopulation", + "femalePopultion", + "workingPopulation", + "literacyRate", + "languagesSpoken" + ], + "x-unique": [ + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "population": { + "type": "string" + }, + "districtCode": { + "type": "string" + }, + "literacyRate": { + "type": "string" + }, + "malePopulation": { + "type": "string" + }, + "femalePopultion": { + "type": "string" + }, + "languagesSpoken": { + "type": "array", + "items": { + "type": "string" + } + }, + "workingPopulation": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396323, + "lastModifiedTime": 1701255396323 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.tenants.json b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.tenants.json new file mode 100644 index 00000000000..7b5dac552db --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/Schema Definitions/tenant.tenants.json @@ -0,0 +1,134 @@ +{ + "ResponseInfo": { + "apiId": "asset-services", + "ver": null, + "ts": null, + "resMsgId": "uief87324", + "msgId": "search with from and to values", + "status": "successful" + }, + "SchemaDefinitions": [ + { + "id": "56dc1892-6ea1-4e4f-a610-1e3632dc7645", + "tenantId": "pg", + "code": "tenant.tenants", + "description": null, + "definition": { + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "required": [ + "code", + "name", + "description", + "logoId", + "imageId", + "type", + "city", + "contactNumber", + "helpLineNumber" + ], + "x-unique": [ + "code" + ], + "properties": { + "city": { + "type": "object", + "required": [ + "name", + "districtCode", + "districtName", + "regionName", + "ulbGrade", + "longitude", + "latitude", + "code" + ], + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "captcha": { + "type": "null" + }, + "latitude": { + "type": "number" + }, + "ulbGrade": { + "type": "string" + }, + "localName": { + "type": "null" + }, + "longitude": { + "type": "number" + }, + "regionName": { + "type": "string" + }, + "districtCode": { + "type": "string" + }, + "districtName": { + "type": "string" + }, + "shapeFileLocation": { + "type": "null" + } + }, + "additionalProperties": false + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "logoId": { + "type": "string" + }, + "address": { + "type": "null" + }, + "emailId": { + "type": "null" + }, + "imageId": { + "type": "string" + }, + "domainUrl": { + "type": "null" + }, + "twitterUrl": { + "type": "null" + }, + "description": { + "type": "string" + }, + "facebookUrl": { + "type": "null" + }, + "contactNumber": { + "type": "string" + }, + "helpLineNumber": { + "type": "string" + } + }, + "additionalProperties": false + }, + "isActive": true, + "auditDetails": { + "createdBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "lastModifiedBy": "11b0e02b-0145-4de2-bc42-c97b96264807", + "createdTime": 1701255396489, + "lastModifiedTime": 1701255396489 + } + } + ] +} diff --git a/utilities/mdms-migration-toolkit/src/main/resources/application.properties b/utilities/mdms-migration-toolkit/src/main/resources/application.properties new file mode 100644 index 00000000000..90d7b3e72c9 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/application.properties @@ -0,0 +1,90 @@ +server.contextPath=/mdms-migration-toolkit +server.servlet.context-path=/mdms-migration-toolkit +server.port=8080 +app.timezone=UTC + +#DATABASE CONFIGURATION +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.url=jdbc:postgresql://localhost:5432/postgres +spring.datasource.username=postgres +spring.datasource.password=postgres + +#FLYWAY CONFIGURATION +spring.flyway.url=jdbc:postgresql://localhost:5432/postgres +spring.flyway.user=postgres +spring.flyway.password=postgres +spring.flyway.table=public +spring.flyway.baseline-on-migrate=true +spring.flyway.outOfOrder=true +spring.flyway.locations=classpath:/db/migration/main +spring.flyway.enabled=false + +# KAFKA SERVER CONFIGURATIONS +kafka.config.bootstrap_server_config=localhost:9092 +spring.kafka.consumer.value-deserializer=org.egov.tracer.kafka.deserializer.HashMapDeserializer +spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer +spring.kafka.consumer.group-id=mdms-migration-toolkit +spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.listener.missing-topics-fatal=false +spring.kafka.consumer.properties.spring.json.use.type.headers=false + +# KAFKA CONSUMER CONFIGURATIONS +kafka.consumer.config.auto_commit=true +kafka.consumer.config.auto_commit_interval=100 +kafka.consumer.config.session_timeout=15000 +kafka.consumer.config.auto_offset_reset=earliest +# KAFKA PRODUCER CONFIGURATIONS +kafka.producer.config.retries_config=0 +kafka.producer.config.batch_size_config=16384 +kafka.producer.config.linger_ms_config=1 +kafka.producer.config.buffer_memory_config=33554432 + +#Localization config +egov.localization.host=https://dev.digit.org +egov.localization.workDir.path=/localization/messages/v1 +egov.localization.context.path=/localization/messages/v1 +egov.localization.search.endpoint=/_search +egov.localization.statelevel=true + +#mdms urls +egov.mdms.host=https://dev.digit.org +egov.mdms.search.endpoint=/egov-mdms-service/v1/_search + +#hrms urls +egov.hrms.host=https://dev.digit.org +egov.hrms.search.endpoint=/egov-hrms/employees/_search + +#User config +egov.user.host=https://dev.digit.org +egov.user.context.path=/user/users +egov.user.create.path=/_createnovalidate +egov.user.search.path=/user/_search +egov.user.update.path=/_updatenovalidate + +#Idgen Config +egov.idgen.host=https://dev.digit.org/ +egov.idgen.path=egov-idgen/id/_generate + +#Workflow config +is.workflow.enabled=true +egov.workflow.host=https://dev.digit.org +egov.workflow.transition.path=/egov-workflow-v2/egov-wf/process/_transition +egov.workflow.businessservice.search.path=/egov-workflow-v2/egov-wf/businessservice/_search +egov.workflow.processinstance.search.path=/egov-workflow-v2/egov-wf/process/_search + +#url shortner +egov.url.shortner.host=https://dev.digit.org +egov.url.shortner.endpoint=/egov-url-shortening/shortener + +egov.sms.notification.topic=egov.core.notification.sms +kafka.topics.receipt.create=dss-collection + +# The value of the following field should be changed to service specific name +kafka.topics.consumer=service-consumer-topic + +#egov.mdms.conf.path=/D:/MDMS/health-campaign-mdms/data +egov.mdms.conf.path=C:/Users/Palak Garg/Desktop/New folder/ukd-mdms-data/data +masters.config.url=https://raw.githubusercontent.com/egovernments/egov-mdms-data/DEV/master-config.json +egov.mdms.stopOnAnyConfigError=true +master.schema.files.dir=C:/Users/Palak Garg/Desktop/New folder/schema \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/main/resources/mdms-migration-toolkit.yaml b/utilities/mdms-migration-toolkit/src/main/resources/mdms-migration-toolkit.yaml new file mode 100644 index 00000000000..cec4119af4a --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/main/resources/mdms-migration-toolkit.yaml @@ -0,0 +1,111 @@ +openapi: 3.0.1 +info: + title: MDMS Migration Toolkit APIs + description: APIs to migrate MDMS data from Git to RDBMS. + contact: + name: eGov + email: info@egovernments.org + version: 1.0.1 +paths: + /schema/v1/_migrate: + post: + summary: Migrate schema definitions from existing masters + description: | + Generate and migrate schema definitions from existing masters + operationId: migrateSchemaDefinition + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SchemaMigrationRequest' + responses: + '200': + description: OK + '400': + description: Invalid input. + content: + '*/*': + schema: + $ref: "https://raw.githubusercontent.com/egovernments/DIGIT-Specs/master/Common%20Services/common-contract.yaml#/components/schemas/ErrorRes" + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found + /data/v1/_migrate: + post: + summary: Migrate master data + operationId: migrateMasterData + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MasterDataMigrationRequest' + responses: + '200': + description: OK + content: + '*/*': + schema: + type: object + '400': + description: Invalid input. + content: + '*/*': + schema: + $ref: "https://raw.githubusercontent.com/egovernments/DIGIT-Specs/master/Common%20Services/common-contract.yaml#/components/schemas/ErrorRes" + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not Found +components: + schemas: + SchemaMigrationCriteria: + required: + - tenantId + type: object + properties: + moduleName: + maxLength: 100 + minLength: 2 + type: string + description: Module name of the master whose schema has to be migrated + tenantId: + type: string + description: Unique Identifier of the tenant, Like AP, AP.Kurnool etc. + example: pb.amritsar + MasterDataMigrationCriteria: + required: + - tenantId + type: object + properties: + moduleName: + maxLength: 100 + minLength: 2 + type: string + description: Module name of the master which has to be migrated + tenantId: + type: string + description: Unique Identifier of the tenant, Like AP, AP.Kurnool etc. + example: pb.amritsar + MasterDataMigrationRequest: + required: + - actions + - requestInfo + type: object + properties: + masterDataMigrationCriteria: + $ref: '#/components/schemas/MasterDataMigrationCriteria' + requestInfo: + $ref: 'https://raw.githubusercontent.com/egovernments/DIGIT-Specs/master/Common%20Services/common-contract.yaml#/components/schemas/RequestInfo' + SchemaMigrationRequest: + title: SchemaMigrationRequest + type: object + properties: + schemaMigrationCriteria: + $ref: '#/components/schemas/SchemaMigrationCriteria' + requestInfo: + $ref: "https://raw.githubusercontent.com/egovernments/DIGIT-Specs/master/Common%20Services/common-contract.yaml#/components/schemas/RequestInfo" \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/test/java/digit/TestConfiguration.java b/utilities/mdms-migration-toolkit/src/test/java/digit/TestConfiguration.java new file mode 100644 index 00000000000..c3371253d38 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/test/java/digit/TestConfiguration.java @@ -0,0 +1,16 @@ +package digit; + +import static org.mockito.Mockito.mock; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.kafka.core.KafkaTemplate; + +@Configuration +public class TestConfiguration { + @Bean + @SuppressWarnings("unchecked") + public KafkaTemplate kafkaTemplate() { + return mock(KafkaTemplate.class); + } +} \ No newline at end of file diff --git a/utilities/mdms-migration-toolkit/src/test/java/digit/web/controllers/DataApiControllerTest.java b/utilities/mdms-migration-toolkit/src/test/java/digit/web/controllers/DataApiControllerTest.java new file mode 100644 index 00000000000..aefd590b197 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/test/java/digit/web/controllers/DataApiControllerTest.java @@ -0,0 +1,44 @@ +package digit.web.controllers; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.context.annotation.Import; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import digit.TestConfiguration; + +/** +* API tests for DataApiController +*/ +@Ignore +@RunWith(SpringRunner.class) +@WebMvcTest(DataApiController.class) +@Import(TestConfiguration.class) +public class DataApiControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void migrateMasterDataSuccess() throws Exception { + mockMvc.perform(post("/data/v1/_migrate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void migrateMasterDataFailure() throws Exception { + mockMvc.perform(post("/data/v1/_migrate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + +} diff --git a/utilities/mdms-migration-toolkit/src/test/java/digit/web/controllers/SchemaApiControllerTest.java b/utilities/mdms-migration-toolkit/src/test/java/digit/web/controllers/SchemaApiControllerTest.java new file mode 100644 index 00000000000..2171e508735 --- /dev/null +++ b/utilities/mdms-migration-toolkit/src/test/java/digit/web/controllers/SchemaApiControllerTest.java @@ -0,0 +1,44 @@ +package digit.web.controllers; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.context.annotation.Import; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import digit.TestConfiguration; + +/** +* API tests for SchemaApiController +*/ +@Ignore +@RunWith(SpringRunner.class) +@WebMvcTest(SchemaApiController.class) +@Import(TestConfiguration.class) +public class SchemaApiControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void migrateSchemaDefinitionSuccess() throws Exception { + mockMvc.perform(post("/schema/v1/_migrate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isOk()); + } + + @Test + public void migrateSchemaDefinitionFailure() throws Exception { + mockMvc.perform(post("/schema/v1/_migrate").contentType(MediaType + .APPLICATION_JSON_UTF8)) + .andExpect(status().isBadRequest()); + } + +} diff --git a/utilities/mdms-migration/output/target/classes/digit/service/MDMSApplicationRunnerImpl$1.class b/utilities/mdms-migration/output/target/classes/digit/service/MDMSApplicationRunnerImpl$1.class new file mode 100644 index 00000000000..bcca1b33bcc Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/service/MDMSApplicationRunnerImpl$1.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/service/MDMSApplicationRunnerImpl$2.class b/utilities/mdms-migration/output/target/classes/digit/service/MDMSApplicationRunnerImpl$2.class new file mode 100644 index 00000000000..d832e3cc13b Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/service/MDMSApplicationRunnerImpl$2.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/Error$ErrorBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/Error$ErrorBuilder.class new file mode 100644 index 00000000000..4ab5205edb9 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/Error$ErrorBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/ErrorRes$ErrorResBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/ErrorRes$ErrorResBuilder.class new file mode 100644 index 00000000000..5a2c634beb9 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/ErrorRes$ErrorResBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/MasterDataMigrationCriteria$MasterDataMigrationCriteriaBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/MasterDataMigrationCriteria$MasterDataMigrationCriteriaBuilder.class new file mode 100644 index 00000000000..5cff060f3ad Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/MasterDataMigrationCriteria$MasterDataMigrationCriteriaBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/MasterDataMigrationRequest$MasterDataMigrationRequestBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/MasterDataMigrationRequest$MasterDataMigrationRequestBuilder.class new file mode 100644 index 00000000000..6d66092ae99 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/MasterDataMigrationRequest$MasterDataMigrationRequestBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/Mdms$MdmsBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/Mdms$MdmsBuilder.class new file mode 100644 index 00000000000..e1cd9b43cb6 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/Mdms$MdmsBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/MdmsRequest$MdmsRequestBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/MdmsRequest$MdmsRequestBuilder.class new file mode 100644 index 00000000000..fc5cc2ec783 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/MdmsRequest$MdmsRequestBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/RequestInfoWrapper$RequestInfoWrapperBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/RequestInfoWrapper$RequestInfoWrapperBuilder.class new file mode 100644 index 00000000000..a5861236733 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/RequestInfoWrapper$RequestInfoWrapperBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/ResponseInfo$ResponseInfoBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/ResponseInfo$ResponseInfoBuilder.class new file mode 100644 index 00000000000..4f34c17676a Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/ResponseInfo$ResponseInfoBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/ResponseInfo$StatusEnum.class b/utilities/mdms-migration/output/target/classes/digit/web/models/ResponseInfo$StatusEnum.class new file mode 100644 index 00000000000..8eb23722f84 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/ResponseInfo$StatusEnum.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/Role$RoleBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/Role$RoleBuilder.class new file mode 100644 index 00000000000..a3916198f0c Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/Role$RoleBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaDefinition$SchemaDefinitionBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaDefinition$SchemaDefinitionBuilder.class new file mode 100644 index 00000000000..19ba291e79a Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaDefinition$SchemaDefinitionBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaDefinitionRequest$SchemaDefinitionRequestBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaDefinitionRequest$SchemaDefinitionRequestBuilder.class new file mode 100644 index 00000000000..12eeb96c880 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaDefinitionRequest$SchemaDefinitionRequestBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaDefinitionResponse$SchemaDefinitionResponseBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaDefinitionResponse$SchemaDefinitionResponseBuilder.class new file mode 100644 index 00000000000..6bdee13ffb5 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaDefinitionResponse$SchemaDefinitionResponseBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaMigrationCriteria$SchemaMigrationCriteriaBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaMigrationCriteria$SchemaMigrationCriteriaBuilder.class new file mode 100644 index 00000000000..4381249bfe9 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaMigrationCriteria$SchemaMigrationCriteriaBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaMigrationRequest$SchemaMigrationRequestBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaMigrationRequest$SchemaMigrationRequestBuilder.class new file mode 100644 index 00000000000..6363dfc1c68 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/SchemaMigrationRequest$SchemaMigrationRequestBuilder.class differ diff --git a/utilities/mdms-migration/output/target/classes/digit/web/models/User$UserBuilder.class b/utilities/mdms-migration/output/target/classes/digit/web/models/User$UserBuilder.class new file mode 100644 index 00000000000..4d8011d4ff3 Binary files /dev/null and b/utilities/mdms-migration/output/target/classes/digit/web/models/User$UserBuilder.class differ